rockchip.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Device Tree support for Rockchip SoCs
  4. *
  5. * Copyright (c) 2013 MundoReader S.L.
  6. * Author: Heiko Stuebner <[email protected]>
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/io.h>
  11. #include <linux/of_clk.h>
  12. #include <linux/of_platform.h>
  13. #include <linux/irqchip.h>
  14. #include <linux/clocksource.h>
  15. #include <linux/mfd/syscon.h>
  16. #include <linux/regmap.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/map.h>
  19. #include <asm/hardware/cache-l2x0.h>
  20. #include "core.h"
  21. #include "pm.h"
  22. #define RK3288_TIMER6_7_PHYS 0xff810000
  23. static void __init rockchip_timer_init(void)
  24. {
  25. if (of_machine_is_compatible("rockchip,rk3288")) {
  26. void __iomem *reg_base;
  27. /*
  28. * Most/all uboot versions for rk3288 don't enable timer7
  29. * which is needed for the architected timer to work.
  30. * So make sure it is running during early boot.
  31. */
  32. reg_base = ioremap(RK3288_TIMER6_7_PHYS, SZ_16K);
  33. if (reg_base) {
  34. writel(0, reg_base + 0x30);
  35. writel(0xffffffff, reg_base + 0x20);
  36. writel(0xffffffff, reg_base + 0x24);
  37. writel(1, reg_base + 0x30);
  38. dsb();
  39. iounmap(reg_base);
  40. } else {
  41. pr_err("rockchip: could not map timer7 registers\n");
  42. }
  43. }
  44. of_clk_init(NULL);
  45. timer_probe();
  46. }
  47. static void __init rockchip_dt_init(void)
  48. {
  49. rockchip_suspend_init();
  50. }
  51. static const char * const rockchip_board_dt_compat[] = {
  52. "rockchip,rk2928",
  53. "rockchip,rk3066a",
  54. "rockchip,rk3066b",
  55. "rockchip,rk3188",
  56. "rockchip,rk3228",
  57. "rockchip,rk3288",
  58. "rockchip,rv1108",
  59. NULL,
  60. };
  61. DT_MACHINE_START(ROCKCHIP_DT, "Rockchip (Device Tree)")
  62. .l2c_aux_val = 0,
  63. .l2c_aux_mask = ~0,
  64. .init_time = rockchip_timer_init,
  65. .dt_compat = rockchip_board_dt_compat,
  66. .init_machine = rockchip_dt_init,
  67. MACHINE_END