1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 22:11:53 +02:00

libubb/mmcclk.c (mmcclk_first): base clock calculation on state of CPCCR.PCS

Also rename BEN_SYS_CLK_HZ to BEN_PLL_CLK_HZ, since the system clock
depends on CPCCR.PCS (while we assume BEN_PLL_CLK_HZ to be constant.)
This commit is contained in:
Werner Almesberger 2013-01-07 16:16:31 -03:00
parent 2f4e1bd6d7
commit b18d688570
2 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,7 @@
#include <stdint.h>
#define BEN_SYS_CLK_HZ 336000000
#define BEN_PLL_CLK_HZ 336000000
struct mmcclk {

View File

@ -30,7 +30,11 @@ static int calculate_clock(struct mmcclk *dsc)
void mmcclk_first(struct mmcclk *dsc, int sys_clk_hz)
{
dsc->sys_clk_hz = sys_clk_hz ? sys_clk_hz : BEN_SYS_CLK_HZ;
if (sys_clk_hz)
dsc->sys_clk_hz = sys_clk_hz;
else
dsc->sys_clk_hz =
(CPCCR >> 21) & 1 ? BEN_PLL_CLK_HZ : BEN_PLL_CLK_HZ/2;
dsc->clkdiv = dsc->clkrt = 0;
if (calculate_clock(dsc))
return;