summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/include/mach/pinmux.h
blob: 67e0fc48ef6d9f98b06ad451232296c1cfefb200 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
 * linux/arch/arm/mach-tegra/include/mach/pinmux.h
 *
 * Copyright (C) 2010 Google, Inc.
 *
 * 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_PINMUX_H
#define __MACH_TEGRA_PINMUX_H

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

typedef enum {
	TEGRA_MUX_RSVD = 0x8000,
	TEGRA_MUX_RSVD1 = 0x8000,
	TEGRA_MUX_RSVD2 = 0x8001,
	TEGRA_MUX_RSVD3 = 0x8002,
	TEGRA_MUX_RSVD4 = 0x8003,
	TEGRA_MUX_NONE = -1,
	TEGRA_MUX_AHB_CLK,
	TEGRA_MUX_APB_CLK,
	TEGRA_MUX_AUDIO_SYNC,
	TEGRA_MUX_CRT,
	TEGRA_MUX_DAP1,
	TEGRA_MUX_DAP2,
	TEGRA_MUX_DAP3,
	TEGR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RA_PUPD_PULL_DOWN,
	TEGRA_PUPD_PULL_UP,
} tegra_pullupdown_t;

typedef enum {
	TEGRA_TRI_NORMAL = 0,
	TEGRA_TRI_TRISTATE = 1,
} tegra_tristate_t;

typedef enum {
	TEGRA_VDDIO_BB = 0,
	TEGRA_VDDIO_LCD,
	TEGRA_VDDIO_VI,
	TEGRA_VDDIO_UART,
	TEGRA_VDDIO_DDR,
	TEGRA_VDDIO_NAND,
	TEGRA_VDDIO_SYS,
	TEGRA_VDDIO_AUDIO,
	TEGRA_VDDIO_SD,
} tegra_vddio_t;

struct tegra_pingroup_config {
	tegra_pingroup_t	pingroup;
	tegra_mux_func_t	func;
	tegra_pullupdown_t	pupd;
	tegra_tristate_t	tristate;
};

struct tegra_pingroup_desc {
	const char *name;
	int funcs[4];
	int func_safe;
	int vddio;
	s16 tri_reg; 		/* offset into the TRISTATE_REG_* register bank */
	s16 mux_reg;		/* offset into the PIN_MUX_CTL_* register bank */
	s16 pupd_reg;		/* offset into the PULL_UPDOWN_REG_* register bank */
	s8 tri_bit; 		/* offset into the TRISTATE_REG_* register bit */
	s8 mux_bit;		/* offset into the PIN_MUX_CTL_* register bit */
	s8 pupd_bit;		/* offset into the PULL_UPDOWN_REG_* register bit */
};

int tegra_pinmux_set_tristate(tegra_pingroup_t pg, tegra_tristate_t tristate);
int tegra_pinmux_set_pullupdown(tegra_pingroup_t pg, tegra_pullupdown_t pupd);

void tegra_pinmux_init_pingroups(void);
const struct tegra_pingroup_desc* tegra_pinmux_get_pingroups(void);

void tegra_pinmux_config_table(const struct tegra_pingroup_config *config, int len);

void tegra_pinmux_config_pinmux_table(const struct tegra_pingroup_config *config,
				      int len, bool is_set);
void tegra_pinmux_config_tristate_table(const struct tegra_pingroup_config *config,
					int len, tegra_tristate_t tristate);
void tegra_pinmux_config_pullupdown_table(const struct tegra_pingroup_config *config,
					  int len, tegra_pullupdown_t pupd);
int tegra_pinmux_get_vddio(tegra_pingroup_t pg);
void tegra_pinmux_set_vddio_tristate(tegra_vddio_t vddio,
				     tegra_tristate_t tristate);
#endif