From: Paul Kocialkowski <contact@paulk.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] sunxi: musb: Fix some lo speed devices not working with musb host
Date: Mon, 30 Mar 2015 15:27:46 +0200 [thread overview]
Message-ID: <1427722066.2521.3.camel@collins> (raw)
In-Reply-To: <1427490403-20163-2-git-send-email-hdegoede@redhat.com>
Le vendredi 27 mars 2015 ? 22:06 +0100, Hans de Goede a ?crit :
> The usb0 / otg phy on sunxi boards has a bug where it wrongly detects a
> high speed squelch on usb reset deassert when a lo speed device is plugged in.
>
> The android kernel has a work around for this in the form of temporary
> disabling the phy's squelch detection on reset deassert, this commit adds
> the same workaround to the u-boot sunxi musb code, thereby fixing various usb
> lo speed devices not working.
>
> Tested with a (before non working) usb keyboard and a usb 2.4 GHz wireless
> keyboard/mouse combo receiver.
This also made my USB low speed keyboard work with U-Boot, but I'm
getting the following message after USB init:
musb_h_ep0_irq 1069: no URB for end 0
In addition, enabling caps lock or num lock (which should trigger a LED)
makes the keyboard stop working until I reset the board. On an USB2
keyboard, caps lock and num lock work just fine.
I'll try to investigate that when I have time, thanks for working on
this!
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> arch/arm/cpu/armv7/sunxi/usbc.c | 7 +++++++
> arch/arm/include/asm/arch-sunxi/usbc.h | 1 +
> drivers/usb/musb-new/musb_uboot.c | 14 ++++++++++++++
> 3 files changed, 22 insertions(+)
>
> diff --git a/arch/arm/cpu/armv7/sunxi/usbc.c b/arch/arm/cpu/armv7/sunxi/usbc.c
> index d2d9891..1c777aa 100644
> --- a/arch/arm/cpu/armv7/sunxi/usbc.c
> +++ b/arch/arm/cpu/armv7/sunxi/usbc.c
> @@ -182,6 +182,13 @@ static void sunxi_usb_passby(struct sunxi_usbc_hcd *sunxi_usbc, int enable)
> return;
> }
>
> +void sunxi_usbc_enable_squelch_detect(int index, int enable)
> +{
> + struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
> +
> + usb_phy_write(sunxi_usbc, 0x3c, enable ? 0 : 2, 2);
> +}
> +
> int sunxi_usbc_request_resources(int index)
> {
> struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
> diff --git a/arch/arm/include/asm/arch-sunxi/usbc.h b/arch/arm/include/asm/arch-sunxi/usbc.h
> index 67281ec..ab0f272 100644
> --- a/arch/arm/include/asm/arch-sunxi/usbc.h
> +++ b/arch/arm/include/asm/arch-sunxi/usbc.h
> @@ -21,3 +21,4 @@ void sunxi_usbc_disable(int index);
> void sunxi_usbc_vbus_enable(int index);
> void sunxi_usbc_vbus_disable(int index);
> int sunxi_usbc_vbus_detect(int index);
> +void sunxi_usbc_enable_squelch_detect(int index, int enable);
> diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c
> index 6e58ddf..51fb3fd 100644
> --- a/drivers/usb/musb-new/musb_uboot.c
> +++ b/drivers/usb/musb-new/musb_uboot.c
> @@ -1,5 +1,8 @@
> #include <common.h>
> #include <watchdog.h>
> +#ifdef CONFIG_ARCH_SUNXI
> +#include <asm/arch/usbc.h>
> +#endif
> #include <asm/errno.h>
> #include <linux/usb/ch9.h>
> #include <linux/usb/gadget.h>
> @@ -186,8 +189,19 @@ void usb_reset_root_port(void)
> power &= 0xf0;
> musb_writeb(mbase, MUSB_POWER, MUSB_POWER_RESET | power);
> mdelay(50);
> +#ifdef CONFIG_ARCH_SUNXI
> + /*
> + * sunxi phy has a bug and it will wrongly detect high speed squelch
> + * when clearing reset on low-speed devices, temporary disable
> + * squelch detection to work around this.
> + */
> + sunxi_usbc_enable_squelch_detect(0, 0);
> +#endif
> power = musb_readb(mbase, MUSB_POWER);
> musb_writeb(mbase, MUSB_POWER, ~MUSB_POWER_RESET & power);
> +#ifdef CONFIG_ARCH_SUNXI
> + sunxi_usbc_enable_squelch_detect(0, 1);
> +#endif
> host->isr(0, host);
> host_speed = (musb_readb(mbase, MUSB_POWER) & MUSB_POWER_HSMODE) ?
> USB_SPEED_HIGH :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150330/4be7c767/attachment.sig>
next prev parent reply other threads:[~2015-03-30 13:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-27 21:06 [U-Boot] [PATCH 0/4] sunxi: various musb host related fixes Hans de Goede
2015-03-27 21:06 ` [U-Boot] [PATCH 1/4] sunxi: musb: Fix some lo speed devices not working with musb host Hans de Goede
2015-03-30 13:27 ` Paul Kocialkowski [this message]
2015-03-27 21:06 ` [U-Boot] [PATCH 2/4] sunxi: usbc: Initialize vusb value on request_resources Hans de Goede
2015-03-27 21:06 ` [U-Boot] [PATCH 3/4] sunxi: usbc: Wait for vbus to fall after disabling it Hans de Goede
2015-03-27 21:06 ` [U-Boot] [PATCH 4/4] sunxi: axp221: Use vbus-available rather then vbus-usable for vbus-detect Hans de Goede
2015-03-28 14:13 ` [U-Boot] [PATCH 0/4] sunxi: various musb host related fixes Ian Campbell
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=1427722066.2521.3.camel@collins \
--to=contact@paulk.fr \
--cc=u-boot@lists.denx.de \
/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