diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/as3525/usb-as3525.c | 6 | ||||
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525.c | 46 |
2 files changed, 26 insertions, 26 deletions
diff --git a/firmware/target/arm/as3525/usb-as3525.c b/firmware/target/arm/as3525/usb-as3525.c index 5e913789b5..c32aa3c249 100644 --- a/firmware/target/arm/as3525/usb-as3525.c +++ b/firmware/target/arm/as3525/usb-as3525.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "usb.h" | 24 | #include "usb.h" |
25 | #include "usb_core.h" | ||
25 | #include "usb-target.h" | 26 | #include "usb-target.h" |
26 | #include "power.h" | 27 | #include "power.h" |
27 | #include "as3525.h" | 28 | #include "as3525.h" |
@@ -38,7 +39,10 @@ | |||
38 | 39 | ||
39 | void usb_enable(bool on) | 40 | void usb_enable(bool on) |
40 | { | 41 | { |
41 | (void)on; | 42 | if (on) |
43 | usb_core_init(); | ||
44 | else | ||
45 | usb_core_exit(); | ||
42 | } | 46 | } |
43 | 47 | ||
44 | void usb_init_device(void) | 48 | void usb_init_device(void) |
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c index bac5f6776b..8a1abea74f 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525.c +++ b/firmware/target/arm/as3525/usb-drv-as3525.c | |||
@@ -26,6 +26,10 @@ | |||
26 | #include "ascodec.h" | 26 | #include "ascodec.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | #include <stdbool.h> | 28 | #include <stdbool.h> |
29 | #include "panic.h" | ||
30 | //#define LOGF_ENABLE | ||
31 | #include "logf.h" | ||
32 | |||
29 | 33 | ||
30 | /* 4 input endpoints */ | 34 | /* 4 input endpoints */ |
31 | #define USB_IEP_CTRL(i) *((volatile unsigned long*) USB_BASE + 0x0000 + (i*0x20)) | 35 | #define USB_IEP_CTRL(i) *((volatile unsigned long*) USB_BASE + 0x0000 + (i*0x20)) |
@@ -120,11 +124,6 @@ void usb_drv_init(void) | |||
120 | ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) | 1<<2); | 124 | ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) | 1<<2); |
121 | ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) & ~(1<<4)); | 125 | ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) & ~(1<<4)); |
122 | 126 | ||
123 | USB_GPIO_CSR |= 0x1C00000; //sleep(3) | ||
124 | sleep(1); | ||
125 | USB_GPIO_CSR |= 0x200000; //sleep(10) | ||
126 | sleep(1); | ||
127 | |||
128 | /* PHY part */ | 127 | /* PHY part */ |
129 | CGU_USB = 1<<5 /* enable */ | 128 | CGU_USB = 1<<5 /* enable */ |
130 | | (CLK_DIV(AS3525_PLLA_FREQ, 48000000) / 2) << 2 | 129 | | (CLK_DIV(AS3525_PLLA_FREQ, 48000000) / 2) << 2 |
@@ -133,37 +132,33 @@ void usb_drv_init(void) | |||
133 | /* AHB part */ | 132 | /* AHB part */ |
134 | CGU_PERI |= CGU_USB_CLOCK_ENABLE; | 133 | CGU_PERI |= CGU_USB_CLOCK_ENABLE; |
135 | 134 | ||
136 | /* UVDD */ | ||
137 | ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) | (1<<4)); | ||
138 | |||
139 | sleep(10); | ||
140 | |||
141 | USB_DEV_CFG |= (1<<31); /* soft reset */ | ||
142 | volatile int tmp = USB_DEV_CFG; | ||
143 | (void)tmp; | ||
144 | |||
145 | USB_GPIO_CSR = 0x6180000; | 135 | USB_GPIO_CSR = 0x6180000; |
146 | |||
147 | USB_DEV_CFG = (USB_DEV_CFG & ~3) | 1; /* full speed */ | 136 | USB_DEV_CFG = (USB_DEV_CFG & ~3) | 1; /* full speed */ |
148 | |||
149 | USB_DEV_CTRL |= 0x400; /* soft disconnect */ | 137 | USB_DEV_CTRL |= 0x400; /* soft disconnect */ |
150 | 138 | ||
139 | /* UVDD */ | ||
140 | ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) | (1<<4)); | ||
141 | sleep(10); //msleep(100) | ||
142 | |||
143 | USB_GPIO_CSR = 0x6180000; | ||
151 | 144 | ||
152 | USB_GPIO_CSR |= 0x1C00000; //sleep(3) | 145 | USB_GPIO_CSR |= 0x1C00000; |
153 | sleep(1); | 146 | sleep(1); //msleep(3) |
154 | USB_GPIO_CSR |= 0x200000; //sleep(10) | 147 | USB_GPIO_CSR |= 0x200000; |
155 | sleep(1); | 148 | sleep(1); //msleep(10) |
156 | 149 | ||
157 | USB_DEV_CTRL |= 0x400; /* soft disconnect */ | 150 | USB_DEV_CTRL |= 0x400; /* soft disconnect */ |
158 | 151 | ||
159 | USB_GPIO_CSR &= ~0x1C00000; //sleep(3) | 152 | USB_GPIO_CSR &= ~0x1C00000; |
160 | sleep(1); | 153 | sleep(1); //msleep(3) |
161 | USB_GPIO_CSR &= ~0x200000; //sleep(10) | 154 | USB_GPIO_CSR &= ~0x200000; |
162 | sleep(1); | 155 | sleep(1); //msleep(10) |
163 | USB_DEV_CTRL &= ~0x400; /* soft disconnect */ | 156 | USB_DEV_CTRL &= ~0x400; /* clear soft disconnect */ |
164 | 157 | ||
158 | /* note : this pin might be Clip specific */ | ||
165 | GPIOA_DIR |= (1<<6); | 159 | GPIOA_DIR |= (1<<6); |
166 | GPIOA_PIN(6) = (1<<6); | 160 | GPIOA_PIN(6) = (1<<6); |
161 | GPIOA_DIR &= ~(1<<6); /* restore direction for usb_detect() */ | ||
167 | 162 | ||
168 | #if 0 /* linux */ | 163 | #if 0 /* linux */ |
169 | USB_DEV_CFG |= (1<<17) /* csr programming */ | 164 | USB_DEV_CFG |= (1<<17) /* csr programming */ |
@@ -260,6 +255,7 @@ int usb_drv_send_nonblocking(int ep, void *ptr, int len) | |||
260 | /* interrupt service routine */ | 255 | /* interrupt service routine */ |
261 | void INT_USB(void) | 256 | void INT_USB(void) |
262 | { | 257 | { |
258 | panicf("USB interrupt !"); | ||
263 | } | 259 | } |
264 | 260 | ||
265 | /* (not essential? , not implemented in usb-tcc.c) */ | 261 | /* (not essential? , not implemented in usb-tcc.c) */ |