summaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorTimur Tabi2011-06-23 21:48:54 +0200
committerKumar Gala2011-06-27 15:36:16 +0200
commit7b93eccf2876ba3b1c10dae22ca864a0eb08de4f (patch)
treed3afaa61a0e162eace990d7621a8949d4ae7291a /arch/powerpc
parentpowerpc/e500mc: Add support for the wait instruction in e500_idle (diff)
downloadkernel-qcow2-linux-7b93eccf2876ba3b1c10dae22ca864a0eb08de4f.tar.gz
kernel-qcow2-linux-7b93eccf2876ba3b1c10dae22ca864a0eb08de4f.tar.xz
kernel-qcow2-linux-7b93eccf2876ba3b1c10dae22ca864a0eb08de4f.zip
powerpc/85xx: clamp the P1022DS DIU pixel clock to allowed values
To ensure that the DIU pixel clock will not be set to an invalid value, clamp the PXCLK divider to the allowed range (2-255). This also acts as a limiter for the pixel clock. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index e083e1f4a6f4..266b3aadfe5e 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -195,8 +195,13 @@ void p1022ds_set_pixel_clock(unsigned int pixclock)
do_div(temp, pixclock);
freq = temp;
- /* pixclk is the ratio of the platform clock to the pixel clock */
+ /*
+ * 'pxclk' is the ratio of the platform clock to the pixel clock.
+ * This number is programmed into the CLKDVDR register, and the valid
+ * range of values is 2-255.
+ */
pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq);
+ pxclk = clamp_t(u32, pxclk, 2, 255);
/* Disable the pixel clock, and set it to non-inverted and no delay */
clrbits32(&guts->clkdvdr,