-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Stephen Warren
authored and
Olof Johansson
committed
Dec 20, 2011
1 parent
b49cae5
commit 54862bf
Showing
7 changed files
with
144 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
obj-y += board-pinmux.o | ||
obj-y += common.o | ||
obj-y += devices.o | ||
obj-y += io.o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
* | ||
* This software is licensed under the terms of the GNU General Public | ||
* License version 2, as published by the Free Software Foundation, and | ||
* may be copied, distributed, and modified under those terms. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
*/ | ||
|
||
#include <linux/of.h> | ||
|
||
#include <mach/gpio-tegra.h> | ||
#include <mach/pinmux.h> | ||
|
||
#include "board-pinmux.h" | ||
#include "devices.h" | ||
|
||
static struct platform_device *devices[] = { | ||
&tegra_gpio_device, | ||
&tegra_pinmux_device, | ||
}; | ||
|
||
void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, | ||
struct tegra_board_pinmux_conf *conf_b) | ||
{ | ||
struct tegra_board_pinmux_conf *confs[] = {conf_a, conf_b}; | ||
int i; | ||
|
||
if (of_machine_is_compatible("nvidia,tegra20")) | ||
platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
|
||
for (i = 0; i < ARRAY_SIZE(confs); i++) { | ||
if (!confs[i]) | ||
continue; | ||
|
||
tegra_pinmux_config_table(confs[i]->pgs, confs[i]->pg_count); | ||
|
||
if (confs[i]->drives) | ||
tegra_drive_pinmux_config_table(confs[i]->drives, | ||
confs[i]->drive_count); | ||
|
||
tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count); | ||
} | ||
|
||
if (!of_machine_is_compatible("nvidia,tegra20")) | ||
platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
* | ||
* This software is licensed under the terms of the GNU General Public | ||
* License version 2, as published by the Free Software Foundation, and | ||
* may be copied, distributed, and modified under those terms. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
*/ | ||
|
||
#ifndef __MACH_TEGRA_BOARD_PINMUX_H | ||
#define __MACH_TEGRA_BOARD_PINMUX_H | ||
|
||
#define GPIO_DEV "tegra-gpio" | ||
#define PINMUX_DEV "tegra-pinmux" | ||
|
||
struct tegra_pingroup_config; | ||
struct tegra_gpio_table; | ||
|
||
struct tegra_board_pinmux_conf { | ||
struct tegra_pingroup_config *pgs; | ||
int pg_count; | ||
|
||
struct tegra_drive_pingroup_config *drives; | ||
int drive_count; | ||
|
||
struct tegra_gpio_table *gpios; | ||
int gpio_count; | ||
}; | ||
|
||
void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, | ||
struct tegra_board_pinmux_conf *conf_b); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters