pdata-quirks.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Legacy platform_data quirks
  3. *
  4. * Copyright (C) 2013 Texas Instruments
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/clk.h>
  11. #include <linux/init.h>
  12. #include <linux/kernel.h>
  13. #include "common.h"
  14. #include "common-board-devices.h"
  15. #include "dss-common.h"
  16. struct pdata_init {
  17. const char *compatible;
  18. void (*fn)(void);
  19. };
  20. /*
  21. * Create alias for USB host PHY clock.
  22. * Remove this when clock phandle can be provided via DT
  23. */
  24. static void __init __used legacy_init_ehci_clk(char *clkname)
  25. {
  26. int ret;
  27. ret = clk_add_alias("main_clk", NULL, clkname, NULL);
  28. if (ret)
  29. pr_err("%s:Failed to add main_clk alias to %s :%d\n",
  30. __func__, clkname, ret);
  31. }
  32. #ifdef CONFIG_ARCH_OMAP4
  33. static void __init omap4_sdp_legacy_init(void)
  34. {
  35. omap_4430sdp_display_init_of();
  36. }
  37. static void __init omap4_panda_legacy_init(void)
  38. {
  39. omap4_panda_display_init_of();
  40. legacy_init_ehci_clk("auxclk3_ck");
  41. }
  42. #endif
  43. #ifdef CONFIG_SOC_OMAP5
  44. static void __init omap5_uevm_legacy_init(void)
  45. {
  46. legacy_init_ehci_clk("auxclk1_ck");
  47. }
  48. #endif
  49. static struct pdata_init pdata_quirks[] __initdata = {
  50. #ifdef CONFIG_ARCH_OMAP4
  51. { "ti,omap4-sdp", omap4_sdp_legacy_init, },
  52. { "ti,omap4-panda", omap4_panda_legacy_init, },
  53. #endif
  54. #ifdef CONFIG_SOC_OMAP5
  55. { "ti,omap5-uevm", omap5_uevm_legacy_init, },
  56. #endif
  57. { /* sentinel */ },
  58. };
  59. void __init pdata_quirks_init(void)
  60. {
  61. struct pdata_init *quirks = pdata_quirks;
  62. while (quirks->compatible) {
  63. if (of_machine_is_compatible(quirks->compatible)) {
  64. if (quirks->fn)
  65. quirks->fn();
  66. break;
  67. }
  68. quirks++;
  69. }
  70. }