summaryrefslogtreecommitdiff
path: root/firmware/export/jz4740.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/jz4740.h')
-rw-r--r--firmware/export/jz4740.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/firmware/export/jz4740.h b/firmware/export/jz4740.h
index 7910fbec92..f1060686f1 100644
--- a/firmware/export/jz4740.h
+++ b/firmware/export/jz4740.h
@@ -3381,13 +3381,17 @@ static __inline__ unsigned int __cpm_get_pllout(void)
3381 unsigned long m, n, no, pllout; 3381 unsigned long m, n, no, pllout;
3382 unsigned long cppcr = REG_CPM_CPPCR; 3382 unsigned long cppcr = REG_CPM_CPPCR;
3383 unsigned long od[4] = {1, 2, 2, 4}; 3383 unsigned long od[4] = {1, 2, 2, 4};
3384 if ((cppcr & CPM_CPPCR_PLLEN) && !(cppcr & CPM_CPPCR_PLLBP)) { 3384
3385 if ((cppcr & CPM_CPPCR_PLLEN) && !(cppcr & CPM_CPPCR_PLLBP))
3386 {
3385 m = __cpm_get_pllm() + 2; 3387 m = __cpm_get_pllm() + 2;
3386 n = __cpm_get_plln() + 2; 3388 n = __cpm_get_plln() + 2;
3387 no = od[__cpm_get_pllod()]; 3389 no = od[__cpm_get_pllod()];
3388 pllout = ((JZ_EXTAL) / (n * no)) * m; 3390 pllout = ((JZ_EXTAL) / (n * no)) * m;
3389 } else 3391 }
3392 else
3390 pllout = JZ_EXTAL; 3393 pllout = JZ_EXTAL;
3394
3391 return pllout; 3395 return pllout;
3392} 3396}
3393 3397
@@ -3447,23 +3451,19 @@ static __inline__ unsigned int __cpm_get_pixclk(void)
3447/* I2S clock */ 3451/* I2S clock */
3448static __inline__ unsigned int __cpm_get_i2sclk(void) 3452static __inline__ unsigned int __cpm_get_i2sclk(void)
3449{ 3453{
3450 if (REG_CPM_CPCCR & CPM_CPCCR_I2CS) { 3454 if (REG_CPM_CPCCR & CPM_CPCCR_I2CS)
3451 return __cpm_get_pllout2() / (__cpm_get_i2sdiv() + 1); 3455 return __cpm_get_pllout2() / (__cpm_get_i2sdiv() + 1);
3452 } 3456 else
3453 else {
3454 return JZ_EXTAL; 3457 return JZ_EXTAL;
3455 }
3456} 3458}
3457 3459
3458/* USB clock */ 3460/* USB clock */
3459static __inline__ unsigned int __cpm_get_usbclk(void) 3461static __inline__ unsigned int __cpm_get_usbclk(void)
3460{ 3462{
3461 if (REG_CPM_CPCCR & CPM_CPCCR_UCS) { 3463 if (REG_CPM_CPCCR & CPM_CPCCR_UCS)
3462 return __cpm_get_pllout2() / (__cpm_get_udiv() + 1); 3464 return __cpm_get_pllout2() / (__cpm_get_udiv() + 1);
3463 } 3465 else
3464 else {
3465 return JZ_EXTAL; 3466 return JZ_EXTAL;
3466 }
3467} 3467}
3468 3468
3469/* MSC clock */ 3469/* MSC clock */
@@ -3492,12 +3492,10 @@ static inline void __cpm_select_msc_clk(int sd)
3492 unsigned int pllout2 = __cpm_get_pllout2(); 3492 unsigned int pllout2 = __cpm_get_pllout2();
3493 unsigned int div = 0; 3493 unsigned int div = 0;
3494 3494
3495 if (sd) { 3495 if (sd)
3496 div = pllout2 / 24000000; 3496 div = pllout2 / 24000000;
3497 } 3497 else
3498 else {
3499 div = pllout2 / 16000000; 3498 div = pllout2 / 16000000;
3500 }
3501 3499
3502 REG_CPM_MSCCDR = div - 1; 3500 REG_CPM_MSCCDR = div - 1;
3503} 3501}
@@ -3510,12 +3508,11 @@ static inline void __cpm_select_msc_hs_clk(int sd)
3510 unsigned int pllout2 = __cpm_get_pllout2(); 3508 unsigned int pllout2 = __cpm_get_pllout2();
3511 unsigned int div = 0; 3509 unsigned int div = 0;
3512 3510
3513 if (sd) { 3511 if (sd)
3514 div = pllout2 / 48000000; 3512 div = pllout2 / 48000000;
3515 } 3513 else
3516 else {
3517 div = pllout2 / 16000000; 3514 div = pllout2 / 16000000;
3518 } 3515
3519 REG_CPM_MSCCDR = div - 1; 3516 REG_CPM_MSCCDR = div - 1;
3520} 3517}
3521 3518