From: Bin Liu <b-liu@ti.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, <od@zcrc.me>,
<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 7/7] usb: musb: jz4740: Disable pullup at init
Date: Tue, 10 Dec 2019 13:52:30 -0600 [thread overview]
Message-ID: <20191210195230.GA16429@iaqt7> (raw)
In-Reply-To: <20191210171110.62141-7-paul@crapouillou.net>
Hi,
On Tue, Dec 10, 2019 at 06:11:10PM +0100, Paul Cercueil wrote:
> The pullup may be already enabled before the driver is initialized.
> It has to be disabled at init time, as we cannot guarantee that a gadget
> driver will be bound to the UDC.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>
> Notes:
> v3: New patch
>
> drivers/usb/musb/jz4740.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
> index f948eca654f3..1af9e4053312 100644
> --- a/drivers/usb/musb/jz4740.c
> +++ b/drivers/usb/musb/jz4740.c
> @@ -75,6 +75,7 @@ static const struct musb_hdrc_config jz4740_musb_config = {
> static int jz4740_musb_init(struct musb *musb)
> {
> struct device *dev = musb->controller->parent;
> + u8 power;
> int err;
>
> if (dev->of_node)
> @@ -97,6 +98,14 @@ static int jz4740_musb_init(struct musb *musb)
> musb->isr = jz4740_musb_interrupt;
> musb->dma_share_usb_irq = true;
>
> + /*
> + * If the SoC booted from USB the pullup might still be set.
> + * Disable it until a gadget is bound.
> + */
> + power = musb_readb(musb->mregs, MUSB_POWER);
> + power &= ~MUSB_POWER_SOFTCONN;
> + musb_writeb(musb->mregs, MUSB_POWER, power);
> +
> return 0;
> }
It is preferred the glue drivers don't touch the controller core
registers if possible. Please try the following patch instead.
-Bin.
------------- >8 ------------
t a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 683b719c5026..2f9105e8ea38 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2317,6 +2317,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
musb_disable_interrupts(musb);
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+ /* MUSB_POWER_SOFTCONN might be already set, jz4740 does this. */
+ musb_writeb(musb->mregs, MUSB_POWER, 0);
+
/* Init IRQ workqueue before request_irq */
INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work);
INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset);
next prev parent reply other threads:[~2019-12-10 19:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 17:11 [PATCH v3 1/7] usb: musb: dma: Correct parameter passed to IRQ handler Paul Cercueil
2019-12-10 17:11 ` [PATCH v3 2/7] usb: musb: dma: Add support for shared IRQ Paul Cercueil
2019-12-11 18:52 ` Bin Liu
2019-12-17 14:42 ` Bin Liu
2019-12-17 21:04 ` Paul Cercueil
2019-12-17 21:17 ` Bin Liu
2019-12-10 17:11 ` [PATCH v3 3/7] usb: musb: jz4740: Add support for DMA Paul Cercueil
2019-12-11 18:52 ` Bin Liu
2019-12-10 17:11 ` [PATCH v3 4/7] usb: musb: jz4740: Drop dependency on NOP_USB_XCEIV Paul Cercueil
2019-12-11 18:53 ` Bin Liu
2019-12-10 17:11 ` [PATCH v3 5/7] usb: musb: jz4740: Silence error if code is -EPROBE_DEFER Paul Cercueil
2019-12-11 19:00 ` Bin Liu
2019-12-10 17:11 ` [PATCH v3 6/7] usb: musb: jz4740: Code cleanup Paul Cercueil
2019-12-10 19:59 ` Bin Liu
2019-12-14 11:30 ` Greg Kroah-Hartman
2019-12-10 17:11 ` [PATCH v3 7/7] usb: musb: jz4740: Disable pullup at init Paul Cercueil
2019-12-10 19:52 ` Bin Liu [this message]
2019-12-11 18:51 ` [PATCH v3 1/7] usb: musb: dma: Correct parameter passed to IRQ handler Bin Liu
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=20191210195230.GA16429@iaqt7 \
--to=b-liu@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=od@zcrc.me \
--cc=paul@crapouillou.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.