Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281721
b: refs/heads/master
c: 54862bf
h: refs/heads/master
i:
  281719: 3ff1794
v: v3
  • Loading branch information
Stephen Warren authored and Olof Johansson committed Dec 20, 2011
1 parent 7b9db0f commit 6e5034f
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 65 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b49cae59e12348474f7a82bbec187877f83381a9
refs/heads/master: 54862bf00968427cf8f7ffcb6dacf03161eae862
1 change: 1 addition & 0 deletions trunk/arch/arm/mach-tegra/Makefile
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
Expand Down
22 changes: 9 additions & 13 deletions trunk/arch/arm/mach-tegra/board-harmony-pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "gpio-names.h"
#include "board-harmony.h"
#include "devices.h"
#include "board-pinmux.h"

static struct tegra_pingroup_config harmony_pinmux[] = {
{TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
Expand Down Expand Up @@ -143,11 +143,6 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
{TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
};

static struct platform_device *pinmux_devices[] = {
&tegra_gpio_device,
&tegra_pinmux_device,
};

static struct tegra_gpio_table gpio_table[] = {
{ .gpio = TEGRA_GPIO_SD2_CD, .enable = true },
{ .gpio = TEGRA_GPIO_SD2_WP, .enable = true },
Expand All @@ -161,13 +156,14 @@ static struct tegra_gpio_table gpio_table[] = {
{ .gpio = TEGRA_GPIO_EXT_MIC_EN, .enable = true },
};

static struct tegra_board_pinmux_conf conf = {
.pgs = harmony_pinmux,
.pg_count = ARRAY_SIZE(harmony_pinmux),
.gpios = gpio_table,
.gpio_count = ARRAY_SIZE(gpio_table),
};

void harmony_pinmux_init(void)
{
if (!of_machine_is_compatible("nvidia,tegra20"))
platform_add_devices(pinmux_devices,
ARRAY_SIZE(pinmux_devices));

tegra_pinmux_config_table(harmony_pinmux, ARRAY_SIZE(harmony_pinmux));

tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table));
tegra_board_pinmux_init(&conf, NULL);
}
22 changes: 9 additions & 13 deletions trunk/arch/arm/mach-tegra/board-paz00-pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "gpio-names.h"
#include "board-paz00.h"
#include "devices.h"
#include "board-pinmux.h"

static struct tegra_pingroup_config paz00_pinmux[] = {
{TEGRA_PINGROUP_ATA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
Expand Down Expand Up @@ -143,11 +143,6 @@ static struct tegra_pingroup_config paz00_pinmux[] = {
{TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
};

static struct platform_device *pinmux_devices[] = {
&tegra_gpio_device,
&tegra_pinmux_device,
};

static struct tegra_gpio_table gpio_table[] = {
{ .gpio = TEGRA_GPIO_SD1_CD, .enable = true },
{ .gpio = TEGRA_GPIO_SD1_WP, .enable = true },
Expand All @@ -158,13 +153,14 @@ static struct tegra_gpio_table gpio_table[] = {
{ .gpio = TEGRA_WIFI_LED, .enable = true },
};

static struct tegra_board_pinmux_conf conf = {
.pgs = paz00_pinmux,
.pg_count = ARRAY_SIZE(paz00_pinmux),
.gpios = gpio_table,
.gpio_count = ARRAY_SIZE(gpio_table),
};

void paz00_pinmux_init(void)
{
if (!of_machine_is_compatible("nvidia,tegra20"))
platform_add_devices(pinmux_devices,
ARRAY_SIZE(pinmux_devices));

tegra_pinmux_config_table(paz00_pinmux, ARRAY_SIZE(paz00_pinmux));

tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table));
tegra_board_pinmux_init(&conf, NULL);
}
52 changes: 52 additions & 0 deletions trunk/arch/arm/mach-tegra/board-pinmux.c
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));
}
38 changes: 38 additions & 0 deletions trunk/arch/arm/mach-tegra/board-pinmux.h
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
51 changes: 25 additions & 26 deletions trunk/arch/arm/mach-tegra/board-seaboard-pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <mach/pinmux-t2.h>

#include "gpio-names.h"
#include "board-pinmux.h"
#include "board-seaboard.h"
#include "devices.h"

#define DEFAULT_DRIVE(_name) \
{ \
Expand Down Expand Up @@ -179,11 +179,6 @@ static __initdata struct tegra_pingroup_config ventana_pinmux[] = {
{TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
};

static struct platform_device *pinmux_devices[] = {
&tegra_gpio_device,
&tegra_pinmux_device,
};

static struct tegra_gpio_table common_gpio_table[] = {
{ .gpio = TEGRA_GPIO_SD2_CD, .enable = true },
{ .gpio = TEGRA_GPIO_SD2_WP, .enable = true },
Expand All @@ -208,31 +203,35 @@ static struct tegra_gpio_table ventana_gpio_table[] = {
{ .gpio = TEGRA_GPIO_PX1, .enable = true },
};

void __init seaboard_common_pinmux_init(void)
{
if (!of_machine_is_compatible("nvidia,tegra20"))
platform_add_devices(pinmux_devices,
ARRAY_SIZE(pinmux_devices));

tegra_pinmux_config_table(common_pinmux, ARRAY_SIZE(common_pinmux));
static struct tegra_board_pinmux_conf common_conf = {
.pgs = common_pinmux,
.pg_count = ARRAY_SIZE(common_pinmux),
.gpios = common_gpio_table,
.gpio_count = ARRAY_SIZE(common_gpio_table),
};

tegra_drive_pinmux_config_table(seaboard_drive_pinmux,
ARRAY_SIZE(seaboard_drive_pinmux));
static struct tegra_board_pinmux_conf seaboard_conf = {
.pgs = seaboard_pinmux,
.pg_count = ARRAY_SIZE(seaboard_pinmux),
.drives = seaboard_drive_pinmux,
.drive_count = ARRAY_SIZE(seaboard_drive_pinmux),
.gpios = seaboard_gpio_table,
.gpio_count = ARRAY_SIZE(seaboard_gpio_table),
};

tegra_gpio_config(common_gpio_table, ARRAY_SIZE(common_gpio_table));
}
static struct tegra_board_pinmux_conf ventana_conf = {
.pgs = ventana_pinmux,
.pg_count = ARRAY_SIZE(ventana_pinmux),
.gpios = ventana_gpio_table,
.gpio_count = ARRAY_SIZE(ventana_gpio_table),
};

void __init seaboard_pinmux_init(void)
void seaboard_pinmux_init(void)
{
seaboard_common_pinmux_init();
tegra_pinmux_config_table(seaboard_pinmux, ARRAY_SIZE(seaboard_pinmux));
tegra_gpio_config(seaboard_gpio_table, ARRAY_SIZE(seaboard_gpio_table));
tegra_board_pinmux_init(&common_conf, &seaboard_conf);
}

void __init ventana_pinmux_init(void)
void ventana_pinmux_init(void)
{
seaboard_common_pinmux_init();
tegra_pinmux_config_table(ventana_pinmux, ARRAY_SIZE(ventana_pinmux));
tegra_gpio_config(ventana_gpio_table, ARRAY_SIZE(ventana_gpio_table));
tegra_board_pinmux_init(&common_conf, &ventana_conf);
}

22 changes: 10 additions & 12 deletions trunk/arch/arm/mach-tegra/board-trimslice-pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <mach/pinmux.h>

#include "gpio-names.h"
#include "board-pinmux.h"
#include "board-trimslice.h"
#include "devices.h"

static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
{TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
Expand Down Expand Up @@ -143,11 +143,6 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
{TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
};

static struct platform_device *pinmux_devices[] = {
&tegra_gpio_device,
&tegra_pinmux_device,
};

static struct tegra_gpio_table gpio_table[] = {
{ .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true }, /* mmc4 cd */
{ .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */
Expand All @@ -156,11 +151,14 @@ static struct tegra_gpio_table gpio_table[] = {
{ .gpio = TRIMSLICE_GPIO_USB2_RST, .enable = true }, /* USB2 PHY rst */
};

void __init trimslice_pinmux_init(void)
static struct tegra_board_pinmux_conf conf = {
.pgs = trimslice_pinmux,
.pg_count = ARRAY_SIZE(trimslice_pinmux),
.gpios = gpio_table,
.gpio_count = ARRAY_SIZE(gpio_table),
};

void trimslice_pinmux_init(void)
{
if (!of_machine_is_compatible("nvidia,tegra20"))
platform_add_devices(pinmux_devices,
ARRAY_SIZE(pinmux_devices));
tegra_pinmux_config_table(trimslice_pinmux, ARRAY_SIZE(trimslice_pinmux));
tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table));
tegra_board_pinmux_init(&conf, NULL);
}

0 comments on commit 6e5034f

Please sign in to comment.