diu.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2008 Freescale Semiconductor, Inc.
  3. * York Sun <yorksun@freescale.com>
  4. *
  5. * FSL DIU Framebuffer driver
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <common.h>
  10. #include <command.h>
  11. #include <asm/io.h>
  12. #include <fsl_diu_fb.h>
  13. DECLARE_GLOBAL_DATA_PTR;
  14. void diu_set_pixel_clock(unsigned int pixclock)
  15. {
  16. volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
  17. volatile clk512x_t *clk = &immap->clk;
  18. volatile unsigned int *clkdvdr = &clk->scfr[0];
  19. unsigned long speed_ccb, temp, pixval;
  20. speed_ccb = get_bus_freq(0) * 4;
  21. temp = 1000000000/pixclock;
  22. temp *= 1000;
  23. pixval = speed_ccb / temp;
  24. debug("DIU pixval = %lu\n", pixval);
  25. /* Modify PXCLK in GUTS CLKDVDR */
  26. debug("DIU: Current value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
  27. temp = in_be32(clkdvdr) & 0xFFFFFF00;
  28. out_be32(clkdvdr, temp | (pixval & 0xFF));
  29. debug("DIU: Modified value of CLKDVDR = 0x%08x\n", in_be32(clkdvdr));
  30. }
  31. int platform_diu_init(unsigned int xres, unsigned int yres, const char *port)
  32. {
  33. unsigned int pixel_format = 0x88883316;
  34. debug("mpc5121_diu_init\n");
  35. return fsl_diu_init(xres, yres, pixel_format, 0);
  36. }