[<prev] [next>] [day] [month] [year] [list]
Message-ID: <fa686aa40812100646t14eab32duca8cbaa761ab5037@mail.gmail.com>
Date: Wed, 10 Dec 2008 07:46:54 -0700
From: "Grant Likely" <grant.likely@...retlab.ca>
To: "Dave Hylands" <dhylands@...il.com>
Cc: linux-embedded@...r.kernel.org,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: Re: How to handle device drivers depending on another device.
On Tue, Dec 9, 2008 at 11:09 PM, Dave Hylands <dhylands@...il.com> wrote:
> Hi Grant,
>
>> Problem: There are no guarantees that the MDIO bus controller will be
>> probed before the Ethernet device.
>
> I believe that what you're supposed to do is to have "bus" controllers
> initilize themselves using subsys_initcall rather than module_init. If
> you look in include/linux/init.h you can see the various initcall
> definitions. module_init is at the same level as device_initcall. All
> of the initcalls at one "level" are completed before moving onto the
> next level.
Even so the problem still exists. There is 1 bus and 3 devices
involved. The 'bus' infrastructure is the MDIO bus (drivers/net/phy),
and it does indeed use subsys_initcall(). But then there is the
Ethernet device, the MDIO controller device, and the PHY device. Both
the Ethernet device and the MDIO controller device are probed via the
of_platform bus. The PHY device is attached to the MDIO controller.
So, while the MDIO bus infrastructure is guaranteed to be initialized
first; there is no guarantee that the MDIO bus controller will be
probed before the Ethernet device. Secondly, even if the MDIO
controller is probed before the Ethernet device, there is no guarantee
that the PHY device will get registered onto the MDIO bus before the
Ethernet device is probed. There remains the uncertainty of which of
the two devices will get registered first and the Ethernet driver
needs a mechanism to defer initialization until the PHY device is
ready.
> Of course, if you're using loadable modules, then the dependencies
> should take care of things for you.
For the bus infrastructure, yes, but not for the bus instances.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists