1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <common.h>
27#include <command.h>
28#include <asm/io.h>
29
30#include <fsl_diu_fb.h>
31
32DECLARE_GLOBAL_DATA_PTR;
33
34void diu_set_pixel_clock(unsigned int pixclock)
35{
36 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
37 volatile clk512x_t *clk = &immap->clk;
38 volatile unsigned int *clkdvdr = &clk->scfr[0];
39 unsigned long speed_ccb, temp, pixval;
40
41 speed_ccb = get_bus_freq(0) * 4;
42 temp = 1000000000/pixclock;
43 temp *= 1000;
44 pixval = speed_ccb / temp;
45 debug("DIU pixval = %lu\n", pixval);
46
47
48 debug("DIU: Current value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
49 temp = in_be32(clkdvdr) & 0xFFFFFF00;
50 out_be32(clkdvdr, temp | (pixval & 0xFF));
51 debug("DIU: Modified value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
52}
53
54int platform_diu_init(unsigned int xres, unsigned int yres, const char *port)
55{
56 unsigned int pixel_format = 0x88883316;
57
58 debug("mpc5121_diu_init\n");
59 return fsl_diu_init(xres, yres, pixel_format, 0);
60}
61