mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-13 16:37:30 +00:00
mpc83xx: Add 831x support to speed.c.
Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
0f253283a3
commit
7c98e5193e
1 changed files with 42 additions and 26 deletions
|
@ -99,11 +99,13 @@ int get_clocks(void)
|
||||||
u32 lcrr;
|
u32 lcrr;
|
||||||
|
|
||||||
u32 csb_clk;
|
u32 csb_clk;
|
||||||
#if defined(CONFIG_MPC834X)
|
#if defined(CONFIG_MPC834X) || defined(CONFIG_MPC831X)
|
||||||
u32 tsec1_clk;
|
u32 tsec1_clk;
|
||||||
u32 tsec2_clk;
|
u32 tsec2_clk;
|
||||||
u32 usbmph_clk;
|
|
||||||
u32 usbdr_clk;
|
u32 usbdr_clk;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_MPC834X
|
||||||
|
u32 usbmph_clk;
|
||||||
#endif
|
#endif
|
||||||
u32 core_clk;
|
u32 core_clk;
|
||||||
u32 i2c1_clk;
|
u32 i2c1_clk;
|
||||||
|
@ -148,7 +150,7 @@ int get_clocks(void)
|
||||||
|
|
||||||
sccr = im->clk.sccr;
|
sccr = im->clk.sccr;
|
||||||
|
|
||||||
#if defined(CONFIG_MPC834X)
|
#if defined(CONFIG_MPC834X) || defined(CONFIG_MPC831X)
|
||||||
switch ((sccr & SCCR_TSEC1CM) >> SCCR_TSEC1CM_SHIFT) {
|
switch ((sccr & SCCR_TSEC1CM) >> SCCR_TSEC1CM_SHIFT) {
|
||||||
case 0:
|
case 0:
|
||||||
tsec1_clk = 0;
|
tsec1_clk = 0;
|
||||||
|
@ -167,6 +169,26 @@ int get_clocks(void)
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch ((sccr & SCCR_USBDRCM) >> SCCR_USBDRCM_SHIFT) {
|
||||||
|
case 0:
|
||||||
|
usbdr_clk = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
usbdr_clk = csb_clk;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
usbdr_clk = csb_clk / 2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
usbdr_clk = csb_clk / 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* unkown SCCR_USBDRCM value */
|
||||||
|
return -8;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_MPC834X)
|
||||||
switch ((sccr & SCCR_TSEC2CM) >> SCCR_TSEC2CM_SHIFT) {
|
switch ((sccr & SCCR_TSEC2CM) >> SCCR_TSEC2CM_SHIFT) {
|
||||||
case 0:
|
case 0:
|
||||||
tsec2_clk = 0;
|
tsec2_clk = 0;
|
||||||
|
@ -205,24 +227,6 @@ int get_clocks(void)
|
||||||
return -7;
|
return -7;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ((sccr & SCCR_USBDRCM) >> SCCR_USBDRCM_SHIFT) {
|
|
||||||
case 0:
|
|
||||||
usbdr_clk = 0;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
usbdr_clk = csb_clk;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
usbdr_clk = csb_clk / 2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
usbdr_clk = csb_clk / 3;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* unkown SCCR_USBDRCM value */
|
|
||||||
return -8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usbmph_clk != 0 && usbdr_clk != 0 && usbmph_clk != usbdr_clk) {
|
if (usbmph_clk != 0 && usbdr_clk != 0 && usbmph_clk != usbdr_clk) {
|
||||||
/* if USB MPH clock is not disabled and
|
/* if USB MPH clock is not disabled and
|
||||||
* USB DR clock is not disabled then
|
* USB DR clock is not disabled then
|
||||||
|
@ -230,8 +234,16 @@ int get_clocks(void)
|
||||||
*/
|
*/
|
||||||
return -9;
|
return -9;
|
||||||
}
|
}
|
||||||
|
#elif defined(CONFIG_MPC831X)
|
||||||
|
tsec2_clk = tsec1_clk;
|
||||||
|
|
||||||
|
if (!(sccr & SCCR_TSEC1ON))
|
||||||
|
tsec1_clk = 0;
|
||||||
|
if (!(sccr & SCCR_TSEC2ON))
|
||||||
|
tsec2_clk = 0;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MPC8360) || defined(CONFIG_MPC832X)
|
|
||||||
|
#if !defined(CONFIG_MPC834X)
|
||||||
i2c1_clk = csb_clk;
|
i2c1_clk = csb_clk;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(CONFIG_MPC832X)
|
#if !defined(CONFIG_MPC832X)
|
||||||
|
@ -314,11 +326,13 @@ int get_clocks(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gd->csb_clk = csb_clk;
|
gd->csb_clk = csb_clk;
|
||||||
#if defined(CONFIG_MPC834X)
|
#if defined(CONFIG_MPC834X) || defined(CONFIG_MPC831X)
|
||||||
gd->tsec1_clk = tsec1_clk;
|
gd->tsec1_clk = tsec1_clk;
|
||||||
gd->tsec2_clk = tsec2_clk;
|
gd->tsec2_clk = tsec2_clk;
|
||||||
gd->usbmph_clk = usbmph_clk;
|
|
||||||
gd->usbdr_clk = usbdr_clk;
|
gd->usbdr_clk = usbdr_clk;
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_MPC834X)
|
||||||
|
gd->usbmph_clk = usbmph_clk;
|
||||||
#endif
|
#endif
|
||||||
gd->core_clk = core_clk;
|
gd->core_clk = core_clk;
|
||||||
gd->i2c1_clk = i2c1_clk;
|
gd->i2c1_clk = i2c1_clk;
|
||||||
|
@ -371,11 +385,13 @@ int print_clock_conf(void)
|
||||||
#if !defined(CONFIG_MPC832X)
|
#if !defined(CONFIG_MPC832X)
|
||||||
printf(" I2C2: %4d MHz\n", gd->i2c2_clk / 1000000);
|
printf(" I2C2: %4d MHz\n", gd->i2c2_clk / 1000000);
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MPC834X)
|
#if defined(CONFIG_MPC834X) || defined(CONFIG_MPC831X)
|
||||||
printf(" TSEC1: %4d MHz\n", gd->tsec1_clk / 1000000);
|
printf(" TSEC1: %4d MHz\n", gd->tsec1_clk / 1000000);
|
||||||
printf(" TSEC2: %4d MHz\n", gd->tsec2_clk / 1000000);
|
printf(" TSEC2: %4d MHz\n", gd->tsec2_clk / 1000000);
|
||||||
printf(" USB MPH: %4d MHz\n", gd->usbmph_clk / 1000000);
|
|
||||||
printf(" USB DR: %4d MHz\n", gd->usbdr_clk / 1000000);
|
printf(" USB DR: %4d MHz\n", gd->usbdr_clk / 1000000);
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_MPC834X)
|
||||||
|
printf(" USB MPH: %4d MHz\n", gd->usbmph_clk / 1000000);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue