* [U-Boot] [PATCH] sunxi: musb: Properly put the musb controller back in reset on exit
@ 2015-05-20 14:40 Hans de Goede
2015-05-21 12:45 ` Chen-Yu Tsai
0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2015-05-20 14:40 UTC (permalink / raw)
To: u-boot
Assert reset and disable the clock to properly put the musb controller
back in reset on exit.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/usb/musb-new/sunxi.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index e8a3a23..e2c9d5a 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -284,6 +284,8 @@ static int sunxi_musb_init(struct musb *musb)
static int sunxi_musb_exit(struct musb *musb)
{
+ struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
pr_debug("%s():\n", __func__);
USBC_DisableDpDmPullUp(musb->mregs);
@@ -291,6 +293,11 @@ static int sunxi_musb_exit(struct musb *musb)
sunxi_usb_phy_power_off(0);
sunxi_usb_phy_exit(0);
+#ifdef CONFIG_SUNXI_GEN_SUN6I
+ clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0);
+#endif
+ clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0);
+
return 0;
}
--
2.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] sunxi: musb: Properly put the musb controller back in reset on exit
2015-05-20 14:40 [U-Boot] [PATCH] sunxi: musb: Properly put the musb controller back in reset on exit Hans de Goede
@ 2015-05-21 12:45 ` Chen-Yu Tsai
2015-05-21 13:13 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: Chen-Yu Tsai @ 2015-05-21 12:45 UTC (permalink / raw)
To: u-boot
On Wed, May 20, 2015 at 10:40 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> Assert reset and disable the clock to properly put the musb controller
> back in reset on exit.
Last I checked the exit functions are not called except for error handling
in the probe sequence. Has this been fixed?
ChenYu
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/usb/musb-new/sunxi.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> index e8a3a23..e2c9d5a 100644
> --- a/drivers/usb/musb-new/sunxi.c
> +++ b/drivers/usb/musb-new/sunxi.c
> @@ -284,6 +284,8 @@ static int sunxi_musb_init(struct musb *musb)
>
> static int sunxi_musb_exit(struct musb *musb)
> {
> + struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
> +
> pr_debug("%s():\n", __func__);
>
> USBC_DisableDpDmPullUp(musb->mregs);
> @@ -291,6 +293,11 @@ static int sunxi_musb_exit(struct musb *musb)
> sunxi_usb_phy_power_off(0);
> sunxi_usb_phy_exit(0);
>
> +#ifdef CONFIG_SUNXI_GEN_SUN6I
> + clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0);
> +#endif
> + clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0);
> +
> return 0;
> }
>
> --
> 2.4.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] sunxi: musb: Properly put the musb controller back in reset on exit
2015-05-21 12:45 ` Chen-Yu Tsai
@ 2015-05-21 13:13 ` Hans de Goede
2015-05-24 9:36 ` Paul Kocialkowski
0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2015-05-21 13:13 UTC (permalink / raw)
To: u-boot
Hi,
On 21-05-15 14:45, Chen-Yu Tsai wrote:
> On Wed, May 20, 2015 at 10:40 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> Assert reset and disable the clock to properly put the musb controller
>> back in reset on exit.
>
> Last I checked the exit functions are not called except for error handling
> in the probe sequence. Has this been fixed?
It seems not, I made this patch because Paul (added to the Cc) was having
some troubles when changing the gadget role. It looks like you're right and
unfortunately this function never gets called though ...
Worse it seems that in gadget mode even all calls to musb_stop() are commented
out of the musb-new code...
Note all this does not mean that this patch is incorrect though, just that it
is not really useful atm.
Regards,
Hans
>
> ChenYu
>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/usb/musb-new/sunxi.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
>> index e8a3a23..e2c9d5a 100644
>> --- a/drivers/usb/musb-new/sunxi.c
>> +++ b/drivers/usb/musb-new/sunxi.c
>> @@ -284,6 +284,8 @@ static int sunxi_musb_init(struct musb *musb)
>>
>> static int sunxi_musb_exit(struct musb *musb)
>> {
>> + struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>> +
>> pr_debug("%s():\n", __func__);
>>
>> USBC_DisableDpDmPullUp(musb->mregs);
>> @@ -291,6 +293,11 @@ static int sunxi_musb_exit(struct musb *musb)
>> sunxi_usb_phy_power_off(0);
>> sunxi_usb_phy_exit(0);
>>
>> +#ifdef CONFIG_SUNXI_GEN_SUN6I
>> + clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0);
>> +#endif
>> + clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0);
>> +
>> return 0;
>> }
>>
>> --
>> 2.4.1
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] sunxi: musb: Properly put the musb controller back in reset on exit
2015-05-21 13:13 ` Hans de Goede
@ 2015-05-24 9:36 ` Paul Kocialkowski
0 siblings, 0 replies; 4+ messages in thread
From: Paul Kocialkowski @ 2015-05-24 9:36 UTC (permalink / raw)
To: u-boot
Le jeudi 21 mai 2015 ? 15:13 +0200, Hans de Goede a ?crit :
> Hi,
>
> On 21-05-15 14:45, Chen-Yu Tsai wrote:
> > On Wed, May 20, 2015 at 10:40 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> >> Assert reset and disable the clock to properly put the musb controller
> >> back in reset on exit.
> >
> > Last I checked the exit functions are not called except for error handling
> > in the probe sequence. Has this been fixed?
>
> It seems not, I made this patch because Paul (added to the Cc) was having
> some troubles when changing the gadget role. It looks like you're right and
> unfortunately this function never gets called though ...
>
> Worse it seems that in gadget mode even all calls to musb_stop() are commented
> out of the musb-new code...
It seems to be the problem here. I added an explicit call to musb_stop
in usb_gadget_unregister_driver and it seems to solve the problem: I can
run fastboot multiple times and the host always enumerates it correctly.
I'll submit some patches implementing this correctly, probably next
week-end.
However, it doesn't work as well with the USB mass storage function.
I'll have to take a closer look at it later.
> Note all this does not mean that this patch is incorrect though, just that it
> is not really useful atm.
>
> Regards,
>
> Hans
>
>
> >
> > ChenYu
> >
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >> ---
> >> drivers/usb/musb-new/sunxi.c | 7 +++++++
> >> 1 file changed, 7 insertions(+)
> >>
> >> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> >> index e8a3a23..e2c9d5a 100644
> >> --- a/drivers/usb/musb-new/sunxi.c
> >> +++ b/drivers/usb/musb-new/sunxi.c
> >> @@ -284,6 +284,8 @@ static int sunxi_musb_init(struct musb *musb)
> >>
> >> static int sunxi_musb_exit(struct musb *musb)
> >> {
> >> + struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
> >> +
> >> pr_debug("%s():\n", __func__);
> >>
> >> USBC_DisableDpDmPullUp(musb->mregs);
> >> @@ -291,6 +293,11 @@ static int sunxi_musb_exit(struct musb *musb)
> >> sunxi_usb_phy_power_off(0);
> >> sunxi_usb_phy_exit(0);
> >>
> >> +#ifdef CONFIG_SUNXI_GEN_SUN6I
> >> + clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0);
> >> +#endif
> >> + clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0);
> >> +
> >> return 0;
> >> }
> >>
> >> --
> >> 2.4.1
> >>
> >> _______________________________________________
> >> U-Boot mailing list
> >> U-Boot at lists.denx.de
> >> http://lists.denx.de/mailman/listinfo/u-boot
-------------- 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/20150524/2d6d70a3/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-24 9:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-20 14:40 [U-Boot] [PATCH] sunxi: musb: Properly put the musb controller back in reset on exit Hans de Goede
2015-05-21 12:45 ` Chen-Yu Tsai
2015-05-21 13:13 ` Hans de Goede
2015-05-24 9:36 ` Paul Kocialkowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox