diff options
-rw-r--r-- | firmware/export/as3525.h | 7 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 16 | ||||
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525.c | 26 |
3 files changed, 41 insertions, 8 deletions
diff --git a/firmware/export/as3525.h b/firmware/export/as3525.h index 699762a9b2..e578b608a6 100644 --- a/firmware/export/as3525.h +++ b/firmware/export/as3525.h | |||
@@ -242,6 +242,13 @@ CE lines | |||
242 | #define CGU_TIMER2_CLOCK_ENABLE ( 1 << 8 ) /* timer 2 */ | 242 | #define CGU_TIMER2_CLOCK_ENABLE ( 1 << 8 ) /* timer 2 */ |
243 | #define CGU_TIMERIF_CLOCK_ENABLE ( 1 << 7 ) /* timer interface */ | 243 | #define CGU_TIMERIF_CLOCK_ENABLE ( 1 << 7 ) /* timer interface */ |
244 | 244 | ||
245 | /* CGU_PLL[AB]SUP bits */ | ||
246 | #define CGU_PLL_POWERDOWN ( 1 << 3 ) | ||
247 | |||
248 | /* CGU_INTCTRL bits */ | ||
249 | #define CGU_PLLA_LOCK ( 1 << 0 ) | ||
250 | #define CGU_PLLB_LOCK ( 1 << 1 ) | ||
251 | |||
245 | /** ------------------------------------------------------------------ | 252 | /** ------------------------------------------------------------------ |
246 | * Number of cycles to wait before cgu is safely locked. | 253 | * Number of cycles to wait before cgu is safely locked. |
247 | **/ | 254 | **/ |
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index dbbe1a1905..ae7c71d939 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -320,16 +320,16 @@ void system_init(void) | |||
320 | "mcr p15, 0, r0, c1, c0 \n" | 320 | "mcr p15, 0, r0, c1, c0 \n" |
321 | : : : "r0" ); | 321 | : : : "r0" ); |
322 | 322 | ||
323 | CGU_COUNTA = 0xff; | 323 | CGU_COUNTA = CGU_LOCK_CNT; |
324 | CGU_PLLA = AS3525_PLLA_SETTING; | 324 | CGU_PLLA = AS3525_PLLA_SETTING; |
325 | CGU_PLLASUP = 0; /* enable PLLA */ | 325 | CGU_PLLASUP = 0; /* enable PLLA */ |
326 | while(!(CGU_INTCTRL & (1<<0))); /* wait until PLLA is locked */ | 326 | while(!(CGU_INTCTRL & CGU_PLLA_LOCK)); /* wait until PLLA is locked */ |
327 | 327 | ||
328 | #if (defined(USE_ROCKBOX_USB) && CONFIG_CPU==AS3525) || (AS3525_MCLK_SEL == AS3525_CLK_PLLB) | 328 | #if AS3525_MCLK_SEL == AS3525_CLK_PLLB |
329 | CGU_COUNTB = 0xff; | 329 | CGU_COUNTB = CGU_LOCK_CNT; |
330 | CGU_PLLB = AS3525_PLLB_SETTING; | 330 | CGU_PLLB = AS3525_PLLB_SETTING; |
331 | CGU_PLLBSUP = 0; /* enable PLLB */ | 331 | CGU_PLLBSUP = 0; /* enable PLLB */ |
332 | while(!(CGU_INTCTRL & (1<<1))); /* wait until PLLB is locked */ | 332 | while(!(CGU_INTCTRL & CGU_PLLB_LOCK)); /* wait until PLLB is locked */ |
333 | #endif | 333 | #endif |
334 | 334 | ||
335 | /* Set FCLK frequency */ | 335 | /* Set FCLK frequency */ |
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 | ||