rockchip.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Device Tree support for Rockchip SoCs
  3. *
  4. * Copyright (c) 2013 MundoReader S.L.
  5. * Author: Heiko Stuebner <heiko@sntech.de>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/of_platform.h>
  20. #include <linux/irqchip.h>
  21. #include <linux/clk-provider.h>
  22. #include <linux/clocksource.h>
  23. #include <linux/mfd/syscon.h>
  24. #include <linux/regmap.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/hardware/cache-l2x0.h>
  28. #include "core.h"
  29. #include "pm.h"
  30. #define RK3288_TIMER6_7_PHYS 0xff810000
  31. static void __init rockchip_timer_init(void)
  32. {
  33. if (of_machine_is_compatible("rockchip,rk3288")) {
  34. void __iomem *reg_base;
  35. /*
  36. * Most/all uboot versions for rk3288 don't enable timer7
  37. * which is needed for the architected timer to work.
  38. * So make sure it is running during early boot.
  39. */
  40. reg_base = ioremap(RK3288_TIMER6_7_PHYS, SZ_16K);
  41. if (reg_base) {
  42. writel(0, reg_base + 0x30);
  43. writel(0xffffffff, reg_base + 0x20);
  44. writel(0xffffffff, reg_base + 0x24);
  45. writel(1, reg_base + 0x30);
  46. dsb();
  47. iounmap(reg_base);
  48. } else {
  49. pr_err("rockchip: could not map timer7 registers\n");
  50. }
  51. }
  52. of_clk_init(NULL);
  53. timer_probe();
  54. }
  55. static void __init rockchip_dt_init(void)
  56. {
  57. rockchip_suspend_init();
  58. }
  59. static const char * const rockchip_board_dt_compat[] = {
  60. "rockchip,rk2928",
  61. "rockchip,rk3066a",
  62. "rockchip,rk3066b",
  63. "rockchip,rk3188",
  64. "rockchip,rk3228",
  65. "rockchip,rk3288",
  66. "rockchip,rv1108",
  67. NULL,
  68. };
  69. DT_MACHINE_START(ROCKCHIP_DT, "Rockchip (Device Tree)")
  70. .l2c_aux_val = 0,
  71. .l2c_aux_mask = ~0,
  72. .init_time = rockchip_timer_init,
  73. .dt_compat = rockchip_board_dt_compat,
  74. .init_machine = rockchip_dt_init,
  75. MACHINE_END