cpufreq-dt-platdev.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2016 Linaro.
  3. * Viresh Kumar <viresh.kumar@linaro.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/err.h>
  10. #include <linux/of.h>
  11. #include <linux/platform_device.h>
  12. #include "cpufreq-dt.h"
  13. static const struct of_device_id machines[] __initconst = {
  14. { .compatible = "allwinner,sun4i-a10", },
  15. { .compatible = "allwinner,sun5i-a10s", },
  16. { .compatible = "allwinner,sun5i-a13", },
  17. { .compatible = "allwinner,sun5i-r8", },
  18. { .compatible = "allwinner,sun6i-a31", },
  19. { .compatible = "allwinner,sun6i-a31s", },
  20. { .compatible = "allwinner,sun7i-a20", },
  21. { .compatible = "allwinner,sun8i-a23", },
  22. { .compatible = "allwinner,sun8i-a33", },
  23. { .compatible = "allwinner,sun8i-a83t", },
  24. { .compatible = "allwinner,sun8i-h3", },
  25. { .compatible = "hisilicon,hi6220", },
  26. { .compatible = "fsl,imx27", },
  27. { .compatible = "fsl,imx51", },
  28. { .compatible = "fsl,imx53", },
  29. { .compatible = "fsl,imx7d", },
  30. { .compatible = "marvell,berlin", },
  31. { .compatible = "samsung,exynos3250", },
  32. { .compatible = "samsung,exynos4210", },
  33. { .compatible = "samsung,exynos4212", },
  34. { .compatible = "samsung,exynos4412", },
  35. { .compatible = "samsung,exynos5250", },
  36. #ifndef CONFIG_BL_SWITCHER
  37. { .compatible = "samsung,exynos5420", },
  38. { .compatible = "samsung,exynos5433", },
  39. { .compatible = "samsung,exynos5800", },
  40. #endif
  41. { .compatible = "renesas,emev2", },
  42. { .compatible = "renesas,r7s72100", },
  43. { .compatible = "renesas,r8a73a4", },
  44. { .compatible = "renesas,r8a7740", },
  45. { .compatible = "renesas,r8a7778", },
  46. { .compatible = "renesas,r8a7779", },
  47. { .compatible = "renesas,r8a7790", },
  48. { .compatible = "renesas,r8a7791", },
  49. { .compatible = "renesas,r8a7792", },
  50. { .compatible = "renesas,r8a7793", },
  51. { .compatible = "renesas,r8a7794", },
  52. { .compatible = "renesas,sh73a0", },
  53. { .compatible = "rockchip,rk2928", },
  54. { .compatible = "rockchip,rk3036", },
  55. { .compatible = "rockchip,rk3066a", },
  56. { .compatible = "rockchip,rk3066b", },
  57. { .compatible = "rockchip,rk3188", },
  58. { .compatible = "rockchip,rk3228", },
  59. { .compatible = "rockchip,rk3288", },
  60. { .compatible = "rockchip,rk3366", },
  61. { .compatible = "rockchip,rk3368", },
  62. { .compatible = "rockchip,rk3399", },
  63. { .compatible = "sigma,tango4" },
  64. { .compatible = "ti,am33xx", },
  65. { .compatible = "ti,dra7", },
  66. { .compatible = "ti,omap2", },
  67. { .compatible = "ti,omap3", },
  68. { .compatible = "ti,omap4", },
  69. { .compatible = "ti,omap5", },
  70. { .compatible = "xlnx,zynq-7000", },
  71. { }
  72. };
  73. static int __init cpufreq_dt_platdev_init(void)
  74. {
  75. struct device_node *np = of_find_node_by_path("/");
  76. const struct of_device_id *match;
  77. if (!np)
  78. return -ENODEV;
  79. match = of_match_node(machines, np);
  80. of_node_put(np);
  81. if (!match)
  82. return -ENODEV;
  83. return PTR_ERR_OR_ZERO(platform_device_register_data(NULL, "cpufreq-dt",
  84. -1, match->data,
  85. sizeof(struct cpufreq_dt_platform_data)));
  86. }
  87. device_initcall(cpufreq_dt_platdev_init);