]> git.ipfire.org Git - thirdparty/u-boot.git/blame - arch/powerpc/cpu/mpc512x/diu.c
arm: mach-omap2: Generate MLO file from SD boot capable targets
[thirdparty/u-boot.git] / arch / powerpc / cpu / mpc512x / diu.c
CommitLineData
0e1bad47
YS
1/*
2 * Copyright 2008 Freescale Semiconductor, Inc.
3 * York Sun <yorksun@freescale.com>
4 *
5 * FSL DIU Framebuffer driver
6 *
1a459660 7 * SPDX-License-Identifier: GPL-2.0+
0e1bad47
YS
8 */
9
10#include <common.h>
11#include <command.h>
12#include <asm/io.h>
13
9e70d137 14#include <fsl_diu_fb.h>
0e1bad47 15
a3921eef
AG
16DECLARE_GLOBAL_DATA_PTR;
17
0e1bad47
YS
18void diu_set_pixel_clock(unsigned int pixclock)
19{
6d0f6bcf 20 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
0e1bad47
YS
21 volatile clk512x_t *clk = &immap->clk;
22 volatile unsigned int *clkdvdr = &clk->scfr[0];
23 unsigned long speed_ccb, temp, pixval;
24
25 speed_ccb = get_bus_freq(0) * 4;
26 temp = 1000000000/pixclock;
27 temp *= 1000;
28 pixval = speed_ccb / temp;
29 debug("DIU pixval = %lu\n", pixval);
30
31 /* Modify PXCLK in GUTS CLKDVDR */
57ae8a5c
DZ
32 debug("DIU: Current value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
33 temp = in_be32(clkdvdr) & 0xFFFFFF00;
34 out_be32(clkdvdr, temp | (pixval & 0xFF));
35 debug("DIU: Modified value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
0e1bad47
YS
36}
37
ba8e76bd 38int platform_diu_init(unsigned int xres, unsigned int yres, const char *port)
0e1bad47 39{
ba8e76bd 40 unsigned int pixel_format = 0x88883316;
0e1bad47 41
de26ef99 42 debug("mpc5121_diu_init\n");
3b4a2263 43 return fsl_diu_init(xres, yres, pixel_format, 0);
0e1bad47 44}