mach-imx51.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
  4. * Copyright 2011 Linaro Ltd.
  5. */
  6. #include <linux/io.h>
  7. #include <linux/irq.h>
  8. #include <linux/of_address.h>
  9. #include <linux/of_irq.h>
  10. #include <linux/of_platform.h>
  11. #include <asm/mach/arch.h>
  12. #include <asm/mach/time.h>
  13. #include "common.h"
  14. #include "hardware.h"
  15. static void __init imx51_init_early(void)
  16. {
  17. mxc_set_cpu_type(MXC_CPU_MX51);
  18. }
  19. /*
  20. * The MIPI HSC unit has been removed from the i.MX51 Reference Manual by
  21. * the Freescale marketing division. However this did not remove the
  22. * hardware from the chip which still needs to be configured for proper
  23. * IPU support.
  24. */
  25. #define MX51_MIPI_HSC_BASE 0x83fdc000
  26. static void __init imx51_ipu_mipi_setup(void)
  27. {
  28. void __iomem *hsc_addr;
  29. hsc_addr = ioremap(MX51_MIPI_HSC_BASE, SZ_16K);
  30. WARN_ON(!hsc_addr);
  31. /* setup MIPI module to legacy mode */
  32. imx_writel(0xf00, hsc_addr);
  33. /* CSI mode: reserved; DI control mode: legacy (from Freescale BSP) */
  34. imx_writel(imx_readl(hsc_addr + 0x800) | 0x30ff, hsc_addr + 0x800);
  35. iounmap(hsc_addr);
  36. }
  37. static void __init imx51_m4if_setup(void)
  38. {
  39. void __iomem *m4if_base;
  40. struct device_node *np;
  41. np = of_find_compatible_node(NULL, NULL, "fsl,imx51-m4if");
  42. if (!np)
  43. return;
  44. m4if_base = of_iomap(np, 0);
  45. of_node_put(np);
  46. if (!m4if_base) {
  47. pr_err("Unable to map M4IF registers\n");
  48. return;
  49. }
  50. /*
  51. * Configure VPU and IPU with higher priorities
  52. * in order to avoid artifacts during video playback
  53. */
  54. writel_relaxed(0x00000203, m4if_base + 0x40);
  55. writel_relaxed(0x00000000, m4if_base + 0x44);
  56. writel_relaxed(0x00120125, m4if_base + 0x9c);
  57. writel_relaxed(0x001901A3, m4if_base + 0x48);
  58. iounmap(m4if_base);
  59. }
  60. static void __init imx51_dt_init(void)
  61. {
  62. imx51_ipu_mipi_setup();
  63. imx_src_init();
  64. imx51_m4if_setup();
  65. imx5_pmu_init();
  66. imx_aips_allow_unprivileged_access("fsl,imx51-aipstz");
  67. }
  68. static void __init imx51_init_late(void)
  69. {
  70. mx51_neon_fixup();
  71. imx51_pm_init();
  72. }
  73. static const char * const imx51_dt_board_compat[] __initconst = {
  74. "fsl,imx51",
  75. NULL
  76. };
  77. DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
  78. .init_early = imx51_init_early,
  79. .init_machine = imx51_dt_init,
  80. .init_late = imx51_init_late,
  81. .dt_compat = imx51_dt_board_compat,
  82. MACHINE_END