diff options
Diffstat (limited to 'arch/arm/mach-tegra/board-pinmux.c')
-rw-r--r-- | arch/arm/mach-tegra/board-pinmux.c | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/arch/arm/mach-tegra/board-pinmux.c b/arch/arm/mach-tegra/board-pinmux.c index 3015b5a3893..3b7ad07fcbc 100644 --- a/arch/arm/mach-tegra/board-pinmux.c +++ b/arch/arm/mach-tegra/board-pinmux.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This software is licensed under the terms of the GNU General Public | 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 | 5 | * License version 2, as published by the Free Software Foundation, and |
@@ -18,47 +18,57 @@ | |||
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | 20 | ||
21 | #include <mach/pinmux.h> | ||
22 | |||
23 | #include "board-pinmux.h" | 21 | #include "board-pinmux.h" |
24 | #include "devices.h" | 22 | #include "devices.h" |
25 | 23 | ||
26 | struct tegra_board_pinmux_conf *confs[2]; | 24 | unsigned long tegra_pincfg_pullnone_driven[2] = { |
25 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), | ||
26 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), | ||
27 | }; | ||
27 | 28 | ||
28 | static void tegra_board_pinmux_setup_pinmux(void) | 29 | unsigned long tegra_pincfg_pullnone_tristate[2] = { |
29 | { | 30 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), |
30 | int i; | 31 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), |
32 | }; | ||
31 | 33 | ||
32 | for (i = 0; i < ARRAY_SIZE(confs); i++) { | 34 | unsigned long tegra_pincfg_pullnone_na[1] = { |
33 | if (!confs[i]) | 35 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), |
34 | continue; | 36 | }; |
35 | 37 | ||
36 | tegra_pinmux_config_table(confs[i]->pgs, confs[i]->pg_count); | 38 | unsigned long tegra_pincfg_pullup_driven[2] = { |
39 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), | ||
40 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), | ||
41 | }; | ||
37 | 42 | ||
38 | if (confs[i]->drives) | 43 | unsigned long tegra_pincfg_pullup_tristate[2] = { |
39 | tegra_drive_pinmux_config_table(confs[i]->drives, | 44 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), |
40 | confs[i]->drive_count); | 45 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), |
41 | } | 46 | }; |
42 | } | ||
43 | 47 | ||
44 | static int tegra_board_pinmux_bus_notify(struct notifier_block *nb, | 48 | unsigned long tegra_pincfg_pullup_na[1] = { |
45 | unsigned long event, void *vdev) | 49 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), |
46 | { | 50 | }; |
47 | struct device *dev = vdev; | ||
48 | 51 | ||
49 | if (event != BUS_NOTIFY_BOUND_DRIVER) | 52 | unsigned long tegra_pincfg_pulldown_driven[2] = { |
50 | return NOTIFY_DONE; | 53 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), |
54 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), | ||
55 | }; | ||
51 | 56 | ||
52 | if (strcmp(dev_name(dev), PINMUX_DEV)) | 57 | unsigned long tegra_pincfg_pulldown_tristate[2] = { |
53 | return NOTIFY_DONE; | 58 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), |
59 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), | ||
60 | }; | ||
54 | 61 | ||
55 | tegra_board_pinmux_setup_pinmux(); | 62 | unsigned long tegra_pincfg_pulldown_na[1] = { |
63 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), | ||
64 | }; | ||
56 | 65 | ||
57 | return NOTIFY_STOP_MASK; | 66 | unsigned long tegra_pincfg_pullna_driven[1] = { |
58 | } | 67 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), |
68 | }; | ||
59 | 69 | ||
60 | static struct notifier_block nb = { | 70 | unsigned long tegra_pincfg_pullna_tristate[1] = { |
61 | .notifier_call = tegra_board_pinmux_bus_notify, | 71 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), |
62 | }; | 72 | }; |
63 | 73 | ||
64 | static struct platform_device *devices[] = { | 74 | static struct platform_device *devices[] = { |
@@ -69,10 +79,10 @@ static struct platform_device *devices[] = { | |||
69 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, | 79 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, |
70 | struct tegra_board_pinmux_conf *conf_b) | 80 | struct tegra_board_pinmux_conf *conf_b) |
71 | { | 81 | { |
72 | confs[0] = conf_a; | 82 | if (conf_a) |
73 | confs[1] = conf_b; | 83 | pinctrl_register_mappings(conf_a->maps, conf_a->map_count); |
74 | 84 | if (conf_b) | |
75 | bus_register_notifier(&platform_bus_type, &nb); | 85 | pinctrl_register_mappings(conf_b->maps, conf_b->map_count); |
76 | 86 | ||
77 | if (!of_machine_is_compatible("nvidia,tegra20")) | 87 | if (!of_machine_is_compatible("nvidia,tegra20")) |
78 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 88 | platform_add_devices(devices, ARRAY_SIZE(devices)); |