diff options
author | Stephen Warren <swarren@nvidia.com> | 2011-12-16 17:12:31 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2011-12-19 21:03:11 -0500 |
commit | 54862bf00968427cf8f7ffcb6dacf03161eae862 (patch) | |
tree | a8990b08d6380e23f8569d196c234306769f5501 /arch/arm/mach-tegra/board-pinmux.c | |
parent | b49cae59e12348474f7a82bbec187877f83381a9 (diff) |
arm/tegra: Refactor board-*-pinmux.c to share code
This moves the implementation of *_pinmux_init() into a single location.
The board-specific pinmux data is left in each board's own file. This
will allow future changes that set up the pinmux in a more complex
fashion to do so without duplicating that code in each board's pinmux
file.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-tegra/board-pinmux.c')
-rw-r--r-- | arch/arm/mach-tegra/board-pinmux.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-pinmux.c b/arch/arm/mach-tegra/board-pinmux.c new file mode 100644 index 000000000000..103ef65ca62a --- /dev/null +++ b/arch/arm/mach-tegra/board-pinmux.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011, 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 | |||
15 | #include <linux/of.h> | ||
16 | |||
17 | #include <mach/gpio-tegra.h> | ||
18 | #include <mach/pinmux.h> | ||
19 | |||
20 | #include "board-pinmux.h" | ||
21 | #include "devices.h" | ||
22 | |||
23 | static struct platform_device *devices[] = { | ||
24 | &tegra_gpio_device, | ||
25 | &tegra_pinmux_device, | ||
26 | }; | ||
27 | |||
28 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, | ||
29 | struct tegra_board_pinmux_conf *conf_b) | ||
30 | { | ||
31 | struct tegra_board_pinmux_conf *confs[] = {conf_a, conf_b}; | ||
32 | int i; | ||
33 | |||
34 | if (of_machine_is_compatible("nvidia,tegra20")) | ||
35 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
36 | |||
37 | for (i = 0; i < ARRAY_SIZE(confs); i++) { | ||
38 | if (!confs[i]) | ||
39 | continue; | ||
40 | |||
41 | tegra_pinmux_config_table(confs[i]->pgs, confs[i]->pg_count); | ||
42 | |||
43 | if (confs[i]->drives) | ||
44 | tegra_drive_pinmux_config_table(confs[i]->drives, | ||
45 | confs[i]->drive_count); | ||
46 | |||
47 | tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count); | ||
48 | } | ||
49 | |||
50 | if (!of_machine_is_compatible("nvidia,tegra20")) | ||
51 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
52 | } | ||