blob: a5574c71b931dc9a25da4ea7a13ba24e52150f34 [file] [log] [blame]
Stephen Warren54862bf2011-12-16 15:12:31 -07001/*
Stephen Warrenf30d12b2011-12-13 15:21:01 -07002 * Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved.
Stephen Warren54862bf2011-12-16 15:12:31 -07003 *
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 Warrena58116f2011-12-16 15:12:32 -070015#include <linux/device.h>
16#include <linux/kernel.h>
17#include <linux/notifier.h>
Stephen Warrena58116f2011-12-16 15:12:32 -070018#include <linux/string.h>
Stephen Warren54862bf2011-12-16 15:12:31 -070019
Stephen Warren54862bf2011-12-16 15:12:31 -070020#include "board-pinmux.h"
21#include "devices.h"
22
Stephen Warrenf30d12b2011-12-13 15:21:01 -070023unsigned 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 Warren54862bf2011-12-16 15:12:31 -070027
Stephen Warrenf30d12b2011-12-13 15:21:01 -070028unsigned 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 Warren54862bf2011-12-16 15:12:31 -070032
Stephen Warrenf30d12b2011-12-13 15:21:01 -070033unsigned long tegra_pincfg_pullnone_na[1] = {
34 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
35};
Stephen Warren54862bf2011-12-16 15:12:31 -070036
Stephen Warrenf30d12b2011-12-13 15:21:01 -070037unsigned 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 Warren54862bf2011-12-16 15:12:31 -070041
Stephen Warrenf30d12b2011-12-13 15:21:01 -070042unsigned 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 Warrena58116f2011-12-16 15:12:32 -070046
Stephen Warrenf30d12b2011-12-13 15:21:01 -070047unsigned long tegra_pincfg_pullup_na[1] = {
48 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
49};
Stephen Warrena58116f2011-12-16 15:12:32 -070050
Stephen Warrenf30d12b2011-12-13 15:21:01 -070051unsigned 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 Warrena58116f2011-12-16 15:12:32 -070055
Stephen Warrenf30d12b2011-12-13 15:21:01 -070056unsigned 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 Warren3e215d02012-02-18 01:04:55 -070060
Stephen Warrenf30d12b2011-12-13 15:21:01 -070061unsigned long tegra_pincfg_pulldown_na[1] = {
62 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
63};
Stephen Warren3e215d02012-02-18 01:04:55 -070064
Stephen Warrenf30d12b2011-12-13 15:21:01 -070065unsigned long tegra_pincfg_pullna_driven[1] = {
66 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
67};
Stephen Warrena58116f2011-12-16 15:12:32 -070068
Stephen Warrenf30d12b2011-12-13 15:21:01 -070069unsigned long tegra_pincfg_pullna_tristate[1] = {
70 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
Stephen Warrena58116f2011-12-16 15:12:32 -070071};
72
73static struct platform_device *devices[] = {
74 &tegra_gpio_device,
75 &tegra_pinmux_device,
76};
77
78void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
79 struct tegra_board_pinmux_conf *conf_b)
80{
Stephen Warrenf30d12b2011-12-13 15:21:01 -070081 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 Warren54862bf2011-12-16 15:12:31 -070085
Stephen Warrenecc295b2012-03-15 16:27:36 -060086 platform_add_devices(devices, ARRAY_SIZE(devices));
Stephen Warren54862bf2011-12-16 15:12:31 -070087}