From: Stephen Warren <swarren@wwwdotorg.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Venu Byravarasu <vbyravarasu@nvidia.com>,
gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: host: tegra: Reset Tegra USB controller before init
Date: Thu, 28 Feb 2013 12:11:19 -0700 [thread overview]
Message-ID: <512FABD7.3090000@wwwdotorg.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1302281346120.1352-100000@iolanthe.rowland.org>
On 02/28/2013 11:52 AM, Alan Stern wrote:
> On Thu, 28 Feb 2013, Stephen Warren wrote:
>
>> I think this patch might cause unintended consequences.
>>
>> When the Tegra PHY code is converted to a driver (i.e. has its own
>> probe), the initial order of execution of the PHY and EHCI driver probes
>> will not be guaranteed.
>>
>> In particular, since the EHCI probe will attempt to "find" the PHY
>> device, and defer the EHCI probe until it can do so, this guarantees
>> that the PHY's probe() will have completed before EHCI's probe()
>> completes (although EHCI's probe may start running first some number of
>> times, and be retried with -EPROBE_DEFERRED for a variety of reasons).
>>
>> Now, if the PHY driver's probe() actually touches HW and sets up some
>> registers, isn't this reset call going to trash any of that register
>> setup? Or, will PHY probe() not touch registers, but only do so during
>> the standard PHY open/init "op"/API calls?
>>
>> I think the way to solve this is to put the reset call into the PHY
>> driver. I assume it has access to the appropriate clock object. This may
>> also address Alan's query re: when the unexpected interrupt occurs; it's
>> triggered by (or correlated with at least) the PHY (or USB port in
>> general) being in device mode due to the boot ROM setting it up this
>> way, then switching to host mode via the Linux driver. I /think/ that
>> device/host mode switching is more related to the PHY than EHCI driver,
>> although I could well be wrong here.
>
> With the PCI platform driver, the handoff from the firmware (we can
> categorize U-Boot as firmware for this discussion) is handled as soon
> as the controller is discovered by the platform-specific code.
> There's a special pci-quirks.c file to take care of it. It is not
> handled by the driver or the glue layer.
>
> In general I think that's what needs to be done. Errant interrupt
> sources should be disabled as quickly as possible.
>
> In this case I don't know exactly when the earliest opportunity is. I
> assume that the EHCI driver and/or the PHY driver gets probed because
> some platform-layer code has registered the device. If this is so then
> that platform-layer code is the right place to do the reset.
The first platform-specific code that is executed in this case is the
(struct platform_driver) probe() functions for the PHY and/or EHCI device.
On Tegra, all devices are listed in device tree, and core kernel code
instantiates platform devices based on the information in device tree.
The first non-core code that runs on a platform device is the driver's
probe() method. That probe() method is for a very specific piece of HW,
and hence seems to be the best place to put any quirks for it. Putting
the quirks outside the driver would mean some piece of the core DT code
would need to have a quirk list, and be able to map the registers for
the device, acquire clocks, etc. etc., implement the quirk, and tear it
all down again. All of which would just be duplicated with the driver's
own probe() function.
next prev parent reply other threads:[~2013-02-28 19:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 6:36 [PATCH] usb: host: tegra: Reset Tegra USB controller before init Venu Byravarasu
2013-02-28 15:09 ` Alan Stern
2013-02-28 18:10 ` Stephen Warren
2013-02-28 18:16 ` Stephen Warren
2013-02-28 18:52 ` Alan Stern
2013-02-28 19:11 ` Stephen Warren [this message]
2013-03-04 7:55 ` Venu Byravarasu
2013-03-04 16:55 ` Stephen Warren
2013-03-04 17:38 ` Alan Stern
2013-03-05 0:34 ` gregkh
2013-04-02 7:12 ` Venu Byravarasu
2013-04-02 15:31 ` Stephen Warren
2013-04-03 10:48 ` Venu Byravarasu
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=512FABD7.3090000@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=vbyravarasu@nvidia.com \
/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