From: "Grant Likely" <grant.likely@secretlab.ca>
To: Dave Hylands <dhylands@gmail.com>
Cc: linux-embedded@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: How to handle device drivers depending on another device.
Date: Wed, 10 Dec 2008 07:46:54 -0700 [thread overview]
Message-ID: <fa686aa40812100646t14eab32duca8cbaa761ab5037@mail.gmail.com> (raw)
In-Reply-To: <c32efac40812092209v52c3b425i9aede2f096a13bfa@mail.gmail.com>
On Tue, Dec 9, 2008 at 11:09 PM, Dave Hylands <dhylands@gmail.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.
prev parent reply other threads:[~2008-12-10 14:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-10 5:45 How to handle device drivers depending on another device Grant Likely
2008-12-10 6:09 ` Dave Hylands
2008-12-10 14:46 ` Grant Likely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa686aa40812100646t14eab32duca8cbaa761ab5037@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=dhylands@gmail.com \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox