From: hzpeterchen@gmail.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] usb: core: add power sequence for USB devices
Date: Fri, 4 Mar 2016 10:07:38 +0800 [thread overview]
Message-ID: <20160304020738.GD30272@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1603031326310.1380-100000@iolanthe.rowland.org>
On Thu, Mar 03, 2016 at 01:31:56PM -0500, Alan Stern wrote:
> On Thu, 3 Mar 2016, Peter Chen wrote:
>
> > Some hard-wired USB devices need to do power sequence to let the
> > device work normally, the typical power sequence like: enable USB
> > PHY clock, toggle reset pin, etc. But current Linux USB driver
> > lacks of such code to do it, it may cause some hard-wired USB devices
> > works abnormal or can't be recognized by controller at all.
> >
> > In this patch, it will do power on sequence at hub's probe for all
> > devices under this hub (includes root hub) if this device is described
> > at dts and there is a phandle "usb-pwrseq" for it. At hub_disconnect,
> > it will do power off sequence.
> >
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
>
>
> > +static int hub_of_pwrseq(struct usb_device *hdev, bool on)
> > +{
> > + struct device *parent;
> > + struct device_node *node;
> > + int ret = 0;
> > +
> > + if (hdev->parent)
> > + parent = &hdev->dev;
> > + else
> > + parent = bus_to_hcd(hdev->bus)->self.controller;
> > +
> > + for_each_child_of_node(parent->of_node, node) {
> > + ret = on ? usb_child_pwrseq_on(node)
> > + : usb_child_pwrseq_off(node);
> > + if (ret)
> > + return ret;
> > + }
> > +
> > + return 0;
> > +}
>
> If you get a failure, do you want to leave the power to all the
> preceding devices turned on? It seems to me you should either turn all
> of them back off, or else continue trying to turn on power for the
> remaining children.
>
Thanks, I will show error message for that device, and continue to turn
on power for the remaining children.
--
Best Regards,
Peter Chen
next prev parent reply other threads:[~2016-03-04 2:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 10:01 [PATCH 0/3] Add power sequence for hard-wired USB devices Peter Chen
2016-03-03 10:01 ` [PATCH 1/3] usb: core: add power sequence for " Peter Chen
2016-03-03 18:31 ` Alan Stern
2016-03-04 2:07 ` Peter Chen [this message]
2016-03-03 20:54 ` Rob Herring
2016-03-04 2:02 ` Peter Chen
2016-03-04 2:23 ` Andrew Lunn
2016-03-04 2:37 ` Peter Chen
2016-03-05 4:28 ` Rob Herring
2016-03-05 8:33 ` Peter Chen
2016-03-05 14:10 ` Andrew Lunn
2016-03-14 10:42 ` Peter Chen
2016-04-05 9:35 ` Peter Chen
2016-03-03 10:01 ` [PATCH 2/3] usb: chipidea: host: let the hcd know's parent device node Peter Chen
2016-03-03 14:42 ` Andrew Lunn
2016-03-04 1:53 ` Peter Chen
2016-03-04 2:17 ` Andrew Lunn
2016-03-04 2:32 ` Peter Chen
2016-03-03 10:01 ` [PATCH 3/3] ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property Peter Chen
2016-03-03 22:30 ` Maciej S. Szmigiero
2016-03-04 2:04 ` Peter Chen
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=20160304020738.GD30272@shlinux2.ap.freescale.net \
--to=hzpeterchen@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).