board-pinmux.c 3.0 KB

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