Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 1 | /* |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 2 | * Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved. |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 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 | |
Stephen Warren | a58116f | 2011-12-16 15:12:32 -0700 | [diff] [blame] | 15 | #include <linux/device.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/notifier.h> |
Stephen Warren | a58116f | 2011-12-16 15:12:32 -0700 | [diff] [blame] | 18 | #include <linux/string.h> |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 19 | |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 20 | #include "board-pinmux.h" |
| 21 | #include "devices.h" |
| 22 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 23 | unsigned long tegra_pincfg_pullnone_driven[2] = { |
| 24 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), |
| 25 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), |
| 26 | }; |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 27 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 28 | unsigned long tegra_pincfg_pullnone_tristate[2] = { |
| 29 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), |
| 30 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), |
| 31 | }; |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 32 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 33 | unsigned long tegra_pincfg_pullnone_na[1] = { |
| 34 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), |
| 35 | }; |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 36 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 37 | unsigned long tegra_pincfg_pullup_driven[2] = { |
| 38 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), |
| 39 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), |
| 40 | }; |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 41 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 42 | unsigned long tegra_pincfg_pullup_tristate[2] = { |
| 43 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), |
| 44 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), |
| 45 | }; |
Stephen Warren | a58116f | 2011-12-16 15:12:32 -0700 | [diff] [blame] | 46 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 47 | unsigned long tegra_pincfg_pullup_na[1] = { |
| 48 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), |
| 49 | }; |
Stephen Warren | a58116f | 2011-12-16 15:12:32 -0700 | [diff] [blame] | 50 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 51 | unsigned long tegra_pincfg_pulldown_driven[2] = { |
| 52 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), |
| 53 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), |
| 54 | }; |
Stephen Warren | a58116f | 2011-12-16 15:12:32 -0700 | [diff] [blame] | 55 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 56 | unsigned long tegra_pincfg_pulldown_tristate[2] = { |
| 57 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), |
| 58 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), |
| 59 | }; |
Stephen Warren | 3e215d0 | 2012-02-18 01:04:55 -0700 | [diff] [blame] | 60 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 61 | unsigned long tegra_pincfg_pulldown_na[1] = { |
| 62 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), |
| 63 | }; |
Stephen Warren | 3e215d0 | 2012-02-18 01:04:55 -0700 | [diff] [blame] | 64 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 65 | unsigned long tegra_pincfg_pullna_driven[1] = { |
| 66 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), |
| 67 | }; |
Stephen Warren | a58116f | 2011-12-16 15:12:32 -0700 | [diff] [blame] | 68 | |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 69 | unsigned long tegra_pincfg_pullna_tristate[1] = { |
| 70 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), |
Stephen Warren | a58116f | 2011-12-16 15:12:32 -0700 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | static struct platform_device *devices[] = { |
| 74 | &tegra_gpio_device, |
| 75 | &tegra_pinmux_device, |
| 76 | }; |
| 77 | |
| 78 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, |
| 79 | struct tegra_board_pinmux_conf *conf_b) |
| 80 | { |
Stephen Warren | f30d12b | 2011-12-13 15:21:01 -0700 | [diff] [blame] | 81 | if (conf_a) |
| 82 | pinctrl_register_mappings(conf_a->maps, conf_a->map_count); |
| 83 | if (conf_b) |
| 84 | pinctrl_register_mappings(conf_b->maps, conf_b->map_count); |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 85 | |
Stephen Warren | ecc295b | 2012-03-15 16:27:36 -0600 | [diff] [blame] | 86 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
Stephen Warren | 54862bf | 2011-12-16 15:12:31 -0700 | [diff] [blame] | 87 | } |