Skip to content

Commit

Permalink
arm/tegra: prepare pinmux code for multiple tegra variants
Browse files Browse the repository at this point in the history
This patch modifies the pinmux code to be useable for multiple tegra variants.
Some tegra20 specific constants will be replaced by variables which will be
initialized to the appropriate value at runtime.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
  • Loading branch information
Peter De Schrijver authored and Olof Johansson committed Dec 18, 2011
1 parent 57be3bd commit 6996e08
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 63 deletions.
1 change: 1 addition & 0 deletions arch/arm/mach-tegra/board-harmony-pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <asm/mach-types.h>

#include <mach/pinmux.h>
#include <mach/pinmux-tegra20.h>
#include "board.h"
#include "board-harmony.h"

Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-tegra/board-harmony-pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/of.h>

#include <mach/pinmux.h>
#include <mach/pinmux-tegra20.h>

#include "gpio-names.h"
#include "board-harmony.h"
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-tegra/board-paz00-pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/of.h>

#include <mach/pinmux.h>
#include <mach/pinmux-tegra20.h>

#include "gpio-names.h"
#include "board-paz00.h"
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-tegra/board-trimslice-pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/of.h>

#include <mach/pinmux.h>
#include <mach/pinmux-tegra20.h>

#include "gpio-names.h"
#include "board-trimslice.h"
Expand Down
25 changes: 10 additions & 15 deletions arch/arm/mach-tegra/include/mach/pinmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
#ifndef __MACH_TEGRA_PINMUX_H
#define __MACH_TEGRA_PINMUX_H

#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
#include "pinmux-tegra20.h"
#else
#error "Undefined Tegra architecture"
#endif

enum tegra_mux_func {
TEGRA_MUX_RSVD = 0x8000,
TEGRA_MUX_RSVD1 = 0x8000,
Expand Down Expand Up @@ -118,7 +112,7 @@ enum tegra_vddio {
};

struct tegra_pingroup_config {
enum tegra_pingroup pingroup;
int pingroup;
enum tegra_mux_func func;
enum tegra_pullupdown pupd;
enum tegra_tristate tristate;
Expand Down Expand Up @@ -187,7 +181,7 @@ enum tegra_schmitt {
};

struct tegra_drive_pingroup_config {
enum tegra_drive_pingroup pingroup;
int pingroup;
enum tegra_hsm hsm;
enum tegra_schmitt schmitt;
enum tegra_drive drive;
Expand Down Expand Up @@ -219,13 +213,15 @@ struct tegra_pingroup_desc {
s8 pupd_bit; /* offset into the PULL_UPDOWN_REG_* register bit */
};

extern const struct tegra_pingroup_desc tegra_soc_pingroups[];
extern const struct tegra_drive_pingroup_desc tegra_soc_drive_pingroups[];
typedef void (*pinmux_init) (const struct tegra_pingroup_desc **pg,
int *pg_max, const struct tegra_drive_pingroup_desc **pgdrive,
int *pgdrive_max);

int tegra_pinmux_set_tristate(enum tegra_pingroup pg,
enum tegra_tristate tristate);
int tegra_pinmux_set_pullupdown(enum tegra_pingroup pg,
enum tegra_pullupdown pupd);
void tegra20_pinmux_init(const struct tegra_pingroup_desc **pg, int *pg_max,
const struct tegra_drive_pingroup_desc **pgdrive, int *pgdrive_max);

int tegra_pinmux_set_tristate(int pg, enum tegra_tristate tristate);
int tegra_pinmux_set_pullupdown(int pg, enum tegra_pullupdown pupd);

void tegra_pinmux_config_table(const struct tegra_pingroup_config *config,
int len);
Expand All @@ -241,4 +237,3 @@ void tegra_pinmux_config_tristate_table(const struct tegra_pingroup_config *conf
void tegra_pinmux_config_pullupdown_table(const struct tegra_pingroup_config *config,
int len, enum tegra_pullupdown pupd);
#endif

15 changes: 13 additions & 2 deletions arch/arm/mach-tegra/pinmux-tegra20-tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
.reg = ((r) - PINGROUP_REG_A) \
}

const struct tegra_drive_pingroup_desc tegra_soc_drive_pingroups[TEGRA_MAX_DRIVE_PINGROUP] = {
static const struct tegra_drive_pingroup_desc tegra_soc_drive_pingroups[TEGRA_MAX_DRIVE_PINGROUP] = {
DRIVE_PINGROUP(AO1, 0x868),
DRIVE_PINGROUP(AO2, 0x86c),
DRIVE_PINGROUP(AT1, 0x870),
Expand Down Expand Up @@ -108,7 +108,7 @@ const struct tegra_drive_pingroup_desc tegra_soc_drive_pingroups[TEGRA_MAX_DRIVE
.pupd_bit = pupd_b, \
}

const struct tegra_pingroup_desc tegra_soc_pingroups[TEGRA_MAX_PINGROUP] = {
static const struct tegra_pingroup_desc tegra_soc_pingroups[TEGRA_MAX_PINGROUP] = {
PINGROUP(ATA, NAND, IDE, NAND, GMI, RSVD, IDE, 0x14, 0, 0x80, 24, 0xA0, 0),
PINGROUP(ATB, NAND, IDE, NAND, GMI, SDIO4, IDE, 0x14, 1, 0x80, 16, 0xA0, 2),
PINGROUP(ATC, NAND, IDE, NAND, GMI, SDIO4, IDE, 0x14, 2, 0x80, 22, 0xA0, 4),
Expand Down Expand Up @@ -227,3 +227,14 @@ const struct tegra_pingroup_desc tegra_soc_pingroups[TEGRA_MAX_PINGROUP] = {
PINGROUP(XM2C, DDR, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xA8, 30),
PINGROUP(XM2D, DDR, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xA8, 28),
};

void __init tegra20_pinmux_init(const struct tegra_pingroup_desc **pg,
int *pg_max, const struct tegra_drive_pingroup_desc **pgdrive,
int *pgdrive_max)
{
*pg = tegra_soc_pingroups;
*pg_max = TEGRA_MAX_PINGROUP;
*pgdrive = tegra_soc_drive_pingroups;
*pgdrive_max = TEGRA_MAX_DRIVE_PINGROUP;
}

Loading

0 comments on commit 6996e08

Please sign in to comment.