1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c
index 1514e76..749117f 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c
@@ -121,13 +121,15 @@ static void usb_delay(void)
 static void as3525v2_connect(void)
 {
     logf("usb-drv: init as3525v2");
+    CGU_USB = 0;
+    CCU_USB_THINGY = (CCU_USB_THINGY & ~0x3000000) | 0x1000000;
     /* 1) enable usb core clock */
     bitset32(&CGU_PERI, CGU_USB_CLOCK_ENABLE);
     usb_delay();
     /* 2) enable usb phy clock */
     /* PHY clock */
     CGU_USB = 1<<5 /* enable */
-        | (CLK_DIV(AS3525_PLLA_FREQ, 60000000)) << 2
+        | (CLK_DIV(AS3525_PLLA_FREQ, 48000000)) << 2
         | 1; /* source = PLLA */
     usb_delay();
     /* 3) clear "stop pclk" */
@@ -156,10 +158,8 @@ static void as3525v2_connect(void)
     GUSBCFG |= GUSBCFG_force_device_mode;
     usb_delay();
     /* 11) Do something that is probably CCU related but undocumented*/
-    CCU_USB &= ~0x1000;
-    usb_delay();
+    CCU_USB |= 0x1000;
     CCU_USB &= ~0x300000;
-    usb_delay();
     /* 12) reset usb core parameters (dev addr, speed, ...) */
     DCFG = 0;
     usb_delay();