board-pinmux.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. */
  14. #include <linux/of.h>
  15. #include <mach/gpio-tegra.h>
  16. #include <mach/pinmux.h>
  17. #include "board-pinmux.h"
  18. #include "devices.h"
  19. static struct platform_device *devices[] = {
  20. &tegra_gpio_device,
  21. &tegra_pinmux_device,
  22. };
  23. void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
  24. struct tegra_board_pinmux_conf *conf_b)
  25. {
  26. struct tegra_board_pinmux_conf *confs[] = {conf_a, conf_b};
  27. int i;
  28. if (of_machine_is_compatible("nvidia,tegra20"))
  29. platform_add_devices(devices, ARRAY_SIZE(devices));
  30. for (i = 0; i < ARRAY_SIZE(confs); i++) {
  31. if (!confs[i])
  32. continue;
  33. tegra_pinmux_config_table(confs[i]->pgs, confs[i]->pg_count);
  34. if (confs[i]->drives)
  35. tegra_drive_pinmux_config_table(confs[i]->drives,
  36. confs[i]->drive_count);
  37. tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count);
  38. }
  39. if (!of_machine_is_compatible("nvidia,tegra20"))
  40. platform_add_devices(devices, ARRAY_SIZE(devices));
  41. }