board-pinmux.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) 2011,2012, 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/device.h>
  15. #include <linux/kernel.h>
  16. #include <linux/notifier.h>
  17. #include <linux/string.h>
  18. #include "board-pinmux.h"
  19. #include "devices.h"
  20. unsigned long tegra_pincfg_pullnone_driven[2] = {
  21. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
  22. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
  23. };
  24. unsigned long tegra_pincfg_pullnone_tristate[2] = {
  25. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
  26. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
  27. };
  28. unsigned long tegra_pincfg_pullnone_na[1] = {
  29. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
  30. };
  31. unsigned long tegra_pincfg_pullup_driven[2] = {
  32. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
  33. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
  34. };
  35. unsigned long tegra_pincfg_pullup_tristate[2] = {
  36. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
  37. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
  38. };
  39. unsigned long tegra_pincfg_pullup_na[1] = {
  40. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
  41. };
  42. unsigned long tegra_pincfg_pulldown_driven[2] = {
  43. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
  44. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
  45. };
  46. unsigned long tegra_pincfg_pulldown_tristate[2] = {
  47. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
  48. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
  49. };
  50. unsigned long tegra_pincfg_pulldown_na[1] = {
  51. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
  52. };
  53. unsigned long tegra_pincfg_pullna_driven[1] = {
  54. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
  55. };
  56. unsigned long tegra_pincfg_pullna_tristate[1] = {
  57. TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
  58. };
  59. static struct platform_device *devices[] = {
  60. &tegra_gpio_device,
  61. &tegra_pinmux_device,
  62. };
  63. void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
  64. struct tegra_board_pinmux_conf *conf_b)
  65. {
  66. if (conf_a)
  67. pinctrl_register_mappings(conf_a->maps, conf_a->map_count);
  68. if (conf_b)
  69. pinctrl_register_mappings(conf_b->maps, conf_b->map_count);
  70. platform_add_devices(devices, ARRAY_SIZE(devices));
  71. }