tb10x.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Abilis Systems TB10x platform initialisation
  3. *
  4. * Copyright (C) Abilis Systems 2012
  5. *
  6. * Author: Christian Ruppert <christian.ruppert@abilis.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  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. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/init.h>
  22. #include <linux/of_platform.h>
  23. #include <linux/clk-provider.h>
  24. #include <linux/pinctrl/consumer.h>
  25. #include <asm/mach_desc.h>
  26. static void __init tb10x_platform_init(void)
  27. {
  28. of_clk_init(NULL);
  29. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  30. }
  31. static void __init tb10x_platform_late_init(void)
  32. {
  33. struct device_node *dn;
  34. /*
  35. * Pinctrl documentation recommends setting up the iomux here for
  36. * all modules which don't require control over the pins themselves.
  37. * Modules which need this kind of assistance are compatible with
  38. * "abilis,simple-pinctrl", i.e. we can easily iterate over them.
  39. * TODO: Does this recommended method work cleanly with pins required
  40. * by modules?
  41. */
  42. for_each_compatible_node(dn, NULL, "abilis,simple-pinctrl") {
  43. struct platform_device *pd = of_find_device_by_node(dn);
  44. struct pinctrl *pctl;
  45. pctl = pinctrl_get_select(&pd->dev, "abilis,simple-default");
  46. if (IS_ERR(pctl)) {
  47. int ret = PTR_ERR(pctl);
  48. dev_err(&pd->dev, "Could not set up pinctrl: %d\n",
  49. ret);
  50. }
  51. }
  52. }
  53. static const char *tb10x_compat[] __initdata = {
  54. "abilis,arc-tb10x",
  55. NULL,
  56. };
  57. MACHINE_START(TB10x, "tb10x")
  58. .dt_compat = tb10x_compat,
  59. .init_machine = tb10x_platform_init,
  60. .init_late = tb10x_platform_late_init,
  61. MACHINE_END