]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
powerpc/mpc85xx: Set SYSCLK to the required frequency
authorJerry Huang <Chang-Ming.Huang@freescale.com>
Thu, 3 Nov 2011 07:18:06 +0000 (15:18 +0800)
committerKumar Gala <galak@kernel.crashing.org>
Fri, 11 Nov 2011 13:48:54 +0000 (07:48 -0600)
commit71775d3b54780f1901ff6eac7c5ae05676938107
treeea6e79554893a014d014f9fd49d9de62e23c10ff
parent8d22ddca3db2577b7f2bf1040972231279288847
powerpc/mpc85xx: Set SYSCLK to the required frequency

For ICS307-02, there is one general expression to generate SYSCLK:
CLK1Frequency = InputFrequency * 2 * (VDW + 8) / ((RDW + 2) * OD)

If we want the required frequency for SYSCLK, we must find one solution
to generate this frequency, this solution includes VDW, RDW and OD.
For OD, there are only eight option value: 10, 2, 8, 4, 5, 7, 3, 6.
For RDW, the range is 1 to 127.
For VDW, the range is 4 to 511.

First, we use one OD, RDW and required SYSCLK to calculate the VDW,
if VDW is in it's range, we will calculate the CLK1Frequency with
the OD, RDW and VDW calculated, and we will check this percent
(CLK1Frequency / required SYSCLK), and the precision is 1/1000.
if the percent is less than 1/1000, we think the CLK1Frequency is we want.
Otherwise, We will continue to calculate it with the next OD and RDW.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
board/freescale/common/ics307_clk.c
board/freescale/common/ics307_clk.h
board/freescale/common/ngpixis.c