From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Grandegger Subject: Re: Runtime driver selection for a certain device Date: Tue, 19 Apr 2011 18:14:12 +0200 Message-ID: <4DADB4D4.1010208@grandegger.com> References: <4DAC8F8A.6060301@grandegger.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Grant Likely Cc: Devicetree Discussions List-Id: devicetree@vger.kernel.org On 04/18/2011 09:22 PM, Grant Likely wrote: > On Mon, Apr 18, 2011 at 1:22 PM, Wolfgang Grandegger 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.