rockchip.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #define RK3288_GRF_SOC_CON0 0x244
  30. static void __init rockchip_timer_init(void)
  31. {
  32. if (of_machine_is_compatible("rockchip,rk3288")) {
  33. struct regmap *grf;
  34. /*
  35. * Disable auto jtag/sdmmc switching that causes issues
  36. * with the mmc controllers making them unreliable
  37. */
  38. grf = syscon_regmap_lookup_by_compatible("rockchip,rk3288-grf");
  39. if (!IS_ERR(grf))
  40. regmap_write(grf, RK3288_GRF_SOC_CON0, 0x10000000);
  41. else
  42. pr_err("rockchip: could not get grf syscon\n");
  43. }
  44. of_clk_init(NULL);
  45. clocksource_of_init();
  46. }
  47. static void __init rockchip_dt_init(void)
  48. {
  49. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  50. platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
  51. }
  52. static const char * const rockchip_board_dt_compat[] = {
  53. "rockchip,rk2928",
  54. "rockchip,rk3066a",
  55. "rockchip,rk3066b",
  56. "rockchip,rk3188",
  57. "rockchip,rk3288",
  58. NULL,
  59. };
  60. DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
  61. .l2c_aux_val = 0,
  62. .l2c_aux_mask = ~0,
  63. .init_time = rockchip_timer_init,
  64. .dt_compat = rockchip_board_dt_compat,
  65. .init_machine = rockchip_dt_init,
  66. MACHINE_END