devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Runtime driver selection for a certain device
       [not found] ` <4DAC8F8A.6060301-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
@ 2011-04-18 19:22   ` Grant Likely
       [not found]     ` <BANLkTim6Zbh05sO_LpH5RAJUoBFr_=jHLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2011-04-18 19:22 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Devicetree Discussions

On Mon, Apr 18, 2011 at 1:22 PM, Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> wrote:
> Hallo,
>
> I'm looking for a solution for the following problem:
>
> A device may be served by more than one driver depending on the
> application. Therefore the driver to use should be selectable at
> run-time. Lets imaging 4 serial line devices normally handled by the
> Linux serial driver. One of those needs eventually be handled by another
> driver. How could that be realized, especially together with the device
> tree, which is pretty static. Is there a generic way? The bind/unbind
> functions look promising but it's not possible to register more than one
> driver for a device.

Depends on the bus type.  I would look at registering the device in
such a way that no driver will bind against it, and then change the
configuration from userspace so the one of the drivers will get bound.

g.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Runtime driver selection for a certain device
@ 2011-04-18 19:22 Wolfgang Grandegger
       [not found] ` <4DAC8F8A.6060301-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Grandegger @ 2011-04-18 19:22 UTC (permalink / raw)
  To: Devicetree Discussions

Hallo,

I'm looking for a solution for the following problem:

A device may be served by more than one driver depending on the
application. Therefore the driver to use should be selectable at
run-time. Lets imaging 4 serial line devices normally handled by the
Linux serial driver. One of those needs eventually be handled by another
driver. How could that be realized, especially together with the device
tree, which is pretty static. Is there a generic way? The bind/unbind
functions look promising but it's not possible to register more than one
driver for a device.

TIA,

Wolfgang.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Runtime driver selection for a certain device
       [not found]     ` <BANLkTim6Zbh05sO_LpH5RAJUoBFr_=jHLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-04-19 16:14       ` Wolfgang Grandegger
       [not found]         ` <4DADB4D4.1010208-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Grandegger @ 2011-04-19 16:14 UTC (permalink / raw)
  To: Grant Likely; +Cc: Devicetree Discussions

On 04/18/2011 09:22 PM, Grant Likely wrote:
> On Mon, Apr 18, 2011 at 1:22 PM, Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> wrote:
>> Hallo,
>>
>> I'm looking for a solution for the following problem:
>>
>> A device may be served by more than one driver depending on the
>> application. Therefore the driver to use should be selectable at
>> run-time. Lets imaging 4 serial line devices normally handled by the
>> Linux serial driver. One of those needs eventually be handled by another
>> driver. How could that be realized, especially together with the device
>> tree, which is pretty static. Is there a generic way? The bind/unbind
>> functions look promising but it's not possible to register more than one
>> driver for a device.
> 
> Depends on the bus type.  I would look at registering the device in
> such a way that no driver will bind against it, and then change the
> configuration from userspace so the one of the drivers will get bound.

OK, I got a bit further. I think the following will work:

# echo f0002c00.serial > \
	/sys/devices/f0000000.soc5200/f0002c00.serial/driver/unbind

will unbind the driver for PSC6 and when I then load another serial
driver module, it will grap the unbound devices, e.g. PSC6 in this
example. But how can I avoid that the driver probes all relevant devices
when it's registered, or even better, how can I avoid automatic driver
binding for certain devices. I think that's not forseen, at least not
for the platform bus... but maybe I have missed something.

Thanks,

Wolfgang.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Runtime driver selection for a certain device
       [not found]         ` <4DADB4D4.1010208-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
@ 2011-04-19 17:25           ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2011-04-19 17:25 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: Devicetree Discussions

On Tue, Apr 19, 2011 at 06:14:12PM +0200, Wolfgang Grandegger wrote:
> On 04/18/2011 09:22 PM, Grant Likely wrote:
> > On Mon, Apr 18, 2011 at 1:22 PM, Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> wrote:
> >> Hallo,
> >>
> >> I'm looking for a solution for the following problem:
> >>
> >> A device may be served by more than one driver depending on the
> >> application. Therefore the driver to use should be selectable at
> >> run-time. Lets imaging 4 serial line devices normally handled by the
> >> Linux serial driver. One of those needs eventually be handled by another
> >> driver. How could that be realized, especially together with the device
> >> tree, which is pretty static. Is there a generic way? The bind/unbind
> >> functions look promising but it's not possible to register more than one
> >> driver for a device.
> > 
> > Depends on the bus type.  I would look at registering the device in
> > such a way that no driver will bind against it, and then change the
> > configuration from userspace so the one of the drivers will get bound.
> 
> OK, I got a bit further. I think the following will work:
> 
> # echo f0002c00.serial > \
> 	/sys/devices/f0000000.soc5200/f0002c00.serial/driver/unbind
> 
> will unbind the driver for PSC6 and when I then load another serial
> driver module, it will grap the unbound devices, e.g. PSC6 in this
> example. But how can I avoid that the driver probes all relevant devices
> when it's registered, or even better, how can I avoid automatic driver
> binding for certain devices. I think that's not forseen, at least not
> for the platform bus... but maybe I have missed something.

You're venturing into new territory.  You'll need to come up with a
mechanism for doing so and propose it.  It would be nice to have an
explicit method for specifying the driver that should be bound to a
driver.  The following /might/ work:

echo f0002c00.serial > /sys/bus/platform/drivers/<your-driver>/bind

g.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-19 17:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 19:22 Runtime driver selection for a certain device Wolfgang Grandegger
     [not found] ` <4DAC8F8A.6060301-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2011-04-18 19:22   ` Grant Likely
     [not found]     ` <BANLkTim6Zbh05sO_LpH5RAJUoBFr_=jHLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-19 16:14       ` Wolfgang Grandegger
     [not found]         ` <4DADB4D4.1010208-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2011-04-19 17:25           ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).