mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-30 17:31:54 +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:
parent
2f4e1bd6d7
commit
b18d688570
@ -16,7 +16,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define BEN_SYS_CLK_HZ 336000000
|
#define BEN_PLL_CLK_HZ 336000000
|
||||||
|
|
||||||
|
|
||||||
struct mmcclk {
|
struct mmcclk {
|
||||||
|
@ -30,7 +30,11 @@ static int calculate_clock(struct mmcclk *dsc)
|
|||||||
|
|
||||||
void mmcclk_first(struct mmcclk *dsc, int sys_clk_hz)
|
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;
|
dsc->clkdiv = dsc->clkrt = 0;
|
||||||
if (calculate_clock(dsc))
|
if (calculate_clock(dsc))
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user