From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v10 4/8] usb: chipidea: udc: add pullup/pulldown dp at hw_device_state
Date: Thu, 28 Feb 2013 14:21:17 +0800 [thread overview]
Message-ID: <20130228062116.GE19387@nchen-desktop> (raw)
In-Reply-To: <CAB7JpEFWMQaAS+tnR2Xd9OL+3eFeOp5ELLA92t55Vu0oMfKn7Q@mail.gmail.com>
On Wed, Feb 27, 2013 at 11:06:05PM +0200, Alexander Shishkin wrote:
> On Feb 27, 2013 8:33 AM, "Peter Chen" <peter.chen@freescale.com> wrote:
> >
> > - During the connect/disconnect host, we need to pullup
> > and pulldown dp
> > - Make sure the dp is not pullup until the vbus is on when
> > flag CI13XXX_PULLUP_ON_VBUS is set
> > - Using hw_device_state when set run/stop bit
> >
> > Signed-off-by: Peter Chen <peter.chen@freescale.com>
> > ---
> > drivers/usb/chipidea/udc.c | 10 ++++++++--
> > 1 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> > index e82dae4..597ae64 100644
> > --- a/drivers/usb/chipidea/udc.c
> > +++ b/drivers/usb/chipidea/udc.c
> > @@ -91,8 +91,10 @@ static int hw_device_state(struct ci13xxx *ci, u32
> dma)
> > /* interrupt, error, port change, reset, sleep/suspend
> */
> > hw_write(ci, OP_USBINTR, ~0,
> >
> USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI);
> > + hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
> > } else {
> > hw_write(ci, OP_USBINTR, ~0, 0);
> > + hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
> > }
> > return 0;
> > }
> > @@ -1424,10 +1426,14 @@ static int ci13xxx_pullup(struct usb_gadget
> *_gadget, int is_on)
> > {
> > struct ci13xxx *ci = container_of(_gadget, struct ci13xxx,
> gadget);
> >
> > + if ((ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) &&
> > + !ci->vbus_active)
> > + return -ENOTSUPP;
>
> This doesn't look right, if !ci->vbus_active *and* is_on, then we can't do
> what we're asked to do, so it makes sense to return error (which, by the
> looks of it, will be ignored by gadgets anyway, but that's another thing),
> and I don't think ENOTSUPP is the right choice here.
>
> In case !ci->vbus_active and !is_on, it should be safe to return 0.
At later patch, the flag CI13XXX_PULLUP_ON_VBUS is retired. The code likes
below:
static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on)
{
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget);
if (!ci->vbus_active)
return -ENOTSUPP;
if (is_on)
hw_device_state(ci, ci->ep0out->qh.dma);
else
hw_device_state(ci, 0);
return 0;
}
So you suggested I change like below:
static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on)
{
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget);
if (!ci->vbus_active)
return -EPERM;
if (is_on)
hw_device_state(ci, ci->ep0out->qh.dma);
else
hw_device_state(ci, 0);
return 0;
}
--
Best Regards,
Peter Chen
next prev parent reply other threads:[~2013-02-28 6:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-27 6:33 [PATCH v10 0/8] Add tested id switch and vbus connect detect support for Chipidea Peter Chen
2013-02-27 6:33 ` [PATCH v10 1/8] Revert "USB: chipidea: add vbus detect for udc" Peter Chen
2013-02-27 6:33 ` [PATCH v10 2/8] usb: chipidea: add otg file Peter Chen
2013-02-27 6:33 ` [PATCH v10 3/8] usb: chipidea: add otg id switch and vbus connect/disconnect detect Peter Chen
2013-02-27 6:33 ` [PATCH v10 4/8] usb: chipidea: udc: add pullup/pulldown dp at hw_device_state Peter Chen
[not found] ` <CAB7JpEFWMQaAS+tnR2Xd9OL+3eFeOp5ELLA92t55Vu0oMfKn7Q@mail.gmail.com>
2013-02-28 6:21 ` Peter Chen [this message]
2013-02-27 6:33 ` [PATCH v10 5/8] usb: chipidea: udc: retire the flag CI13_PULLUP_ON_VBUS Peter Chen
2013-02-27 6:33 ` [PATCH v10 6/8] usb: chipidea: imx: add internal vbus regulator control Peter Chen
2013-02-27 7:55 ` Felipe Balbi
2013-02-27 8:07 ` Sascha Hauer
2013-02-27 8:13 ` Peter Chen
2013-02-27 8:36 ` Felipe Balbi
2013-02-27 14:43 ` Darius Augulis
2013-03-04 11:13 ` Felipe Balbi
[not found] ` <CAB7JpEHq6rDS4=twUf7gito5zxinYiHZban77psKEQ962z0LYw@mail.gmail.com>
2013-02-27 20:42 ` Felipe Balbi
2013-02-28 6:06 ` Peter Chen
2013-02-28 7:29 ` Felipe Balbi
2013-02-28 8:24 ` Peter Chen
2013-02-27 6:33 ` [PATCH v10 7/8] usb: chipidea: udc: fix the oops when plugs in usb cable after rmmod gadget Peter Chen
2013-02-27 6:33 ` [PATCH v10 8/8] usb: chipidea: imx: fix the error that using uninitialized pointer Peter Chen
2013-02-27 12:39 ` Sergei Shtylyov
2013-02-28 3:24 ` Peter Chen
[not found] ` <CAB7JpEEuGP2Vo6HMZz30BZgiGQbBYqEVMRFEb7m0MbsC8oDjgQ@mail.gmail.com>
2013-02-28 3:34 ` 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=20130228062116.GE19387@nchen-desktop \
--to=peter.chen@freescale.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