mediatek.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Device Tree support for Mediatek SoCs
  4. *
  5. * Copyright (c) 2014 MundoReader S.L.
  6. * Author: Matthias Brugger <[email protected]>
  7. */
  8. #include <linux/init.h>
  9. #include <linux/io.h>
  10. #include <asm/mach/arch.h>
  11. #include <linux/of.h>
  12. #include <linux/of_clk.h>
  13. #include <linux/clocksource.h>
  14. #define GPT6_CON_MT65xx 0x10008060
  15. #define GPT_ENABLE 0x31
  16. static void __init mediatek_timer_init(void)
  17. {
  18. void __iomem *gpt_base;
  19. if (of_machine_is_compatible("mediatek,mt6589") ||
  20. of_machine_is_compatible("mediatek,mt7623") ||
  21. of_machine_is_compatible("mediatek,mt8135") ||
  22. of_machine_is_compatible("mediatek,mt8127")) {
  23. /* turn on GPT6 which ungates arch timer clocks */
  24. gpt_base = ioremap(GPT6_CON_MT65xx, 0x04);
  25. /* enable clock and set to free-run */
  26. writel(GPT_ENABLE, gpt_base);
  27. iounmap(gpt_base);
  28. }
  29. of_clk_init(NULL);
  30. timer_probe();
  31. };
  32. static const char * const mediatek_board_dt_compat[] = {
  33. "mediatek,mt2701",
  34. "mediatek,mt6589",
  35. "mediatek,mt6592",
  36. "mediatek,mt7623",
  37. "mediatek,mt7629",
  38. "mediatek,mt8127",
  39. "mediatek,mt8135",
  40. NULL,
  41. };
  42. DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
  43. .dt_compat = mediatek_board_dt_compat,
  44. .init_time = mediatek_timer_init,
  45. MACHINE_END