diff options
Diffstat (limited to 'firmware/target/arm/as3525/usb-drv-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c index 2cb1318f72..61a1265f42 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525.c +++ b/firmware/target/arm/as3525/usb-drv-as3525.c | |||
@@ -306,6 +306,29 @@ static struct usb_dev_setup_buf dummy __attribute__((unused)); | |||
306 | static char rx_buf[1024]; | 306 | static char rx_buf[1024]; |
307 | static char tx_buf[1024]; | 307 | static char tx_buf[1024]; |
308 | 308 | ||
309 | #if AS3525_MCLK_SEL != AS3525_CLK_PLLB | ||
310 | static inline void usb_enable_pll(void) | ||
311 | { | ||
312 | CGU_COUNTB = CGU_LOCK_CNT; | ||
313 | CGU_PLLB = AS3525_PLLB_SETTING; | ||
314 | CGU_PLLBSUP = 0; /* enable PLLB */ | ||
315 | while(!(CGU_INTCTRL & CGU_PLLB_LOCK)); /* wait until PLLB is locked */ | ||
316 | } | ||
317 | |||
318 | static inline void usb_disable_pll(void) | ||
319 | { | ||
320 | CGU_PLLBSUP = CGU_PLL_POWERDOWN; | ||
321 | } | ||
322 | #else | ||
323 | static inline void usb_enable_pll(void) | ||
324 | { | ||
325 | } | ||
326 | |||
327 | static inline void usb_disable_pll(void) | ||
328 | { | ||
329 | } | ||
330 | #endif /* AS3525_MCLK_SEL != AS3525_CLK_PLLB */ | ||
331 | |||
309 | void usb_attach(void) | 332 | void usb_attach(void) |
310 | { | 333 | { |
311 | usb_enable(true); | 334 | usb_enable(true); |
@@ -448,6 +471,8 @@ void usb_drv_init(void) | |||
448 | { | 471 | { |
449 | logf("usb_drv_init() !!!!\n"); | 472 | logf("usb_drv_init() !!!!\n"); |
450 | 473 | ||
474 | usb_enable_pll(); | ||
475 | |||
451 | /* length regulator: normal operation */ | 476 | /* length regulator: normal operation */ |
452 | ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) | 1<<2); | 477 | ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) | 1<<2); |
453 | 478 | ||
@@ -524,6 +549,7 @@ void usb_drv_exit(void) | |||
524 | CGU_PERI &= ~CGU_USB_CLOCK_ENABLE; | 549 | CGU_PERI &= ~CGU_USB_CLOCK_ENABLE; |
525 | /* Disable UVDD generating LDO */ | 550 | /* Disable UVDD generating LDO */ |
526 | ascodec_write(AS3515_USB_UTIL, ascodec_read(AS3515_USB_UTIL) & ~(1<<4)); | 551 | ascodec_write(AS3515_USB_UTIL, ascodec_read(AS3515_USB_UTIL) & ~(1<<4)); |
552 | usb_disable_pll(); | ||
527 | logf("usb_drv_exit() !!!!\n"); | 553 | logf("usb_drv_exit() !!!!\n"); |
528 | } | 554 | } |
529 | 555 | ||