2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * Pin groups which we adjust. There are three basic attributes of each pin
29 * group which use this enum:
33 * - tristate or normal
36 /* APB_MISC_PP_TRISTATE_REG_A_0 */
73 /* 32: APB_MISC_PP_TRISTATE_REG_B_0 */
110 /* 64: APB_MISC_PP_TRISTATE_REG_C_0 */
147 /* 96: APB_MISC_PP_TRISTATE_REG_D_0 */
166 /* these pin groups only have pullup and pull down control */
168 PINGRP_CK32 = PINGRP_FIRST_NO_MUX,
182 * Functions which can be assigned to each of the pin groups. The values here
183 * bear no relation to the values programmed into pinmux registers and are
184 * purely a convenience. The translation is done through a table search.
189 PMUX_FUNC_AUDIO_SYNC,
198 PMUX_FUNC_EMC_TEST0_DLL,
199 PMUX_FUNC_EMC_TEST1_DLL,
244 PMUX_FUNC_VI_SENSOR_CLK,
248 /* These don't have a name, but can be used in the table */
253 PMUX_FUNC_RSVD, /* Not valid and should not be used */
260 /* return 1 if a pmux_func is in range */
261 #define pmux_func_isvalid(func) ((func) >= 0 && (func) < PMUX_FUNC_COUNT && \
262 (func) != PMUX_FUNC_RSVD)
264 /* The pullup/pulldown state of a pin group */
266 PMUX_PULL_NORMAL = 0,
271 /* Defines whether a pin group is tristated or in normal operation */
274 PMUX_TRI_TRISTATE = 1,
277 /* Available power domains used by pin groups */
293 PMUX_TRISTATE_REGS = 4,
298 /* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */
299 struct pmux_tri_ctlr {
300 uint pmt_reserved0; /* ABP_MISC_PP_ reserved offset 00 */
301 uint pmt_reserved1; /* ABP_MISC_PP_ reserved offset 04 */
302 uint pmt_strap_opt_a; /* _STRAPPING_OPT_A_0, offset 08 */
303 uint pmt_reserved2; /* ABP_MISC_PP_ reserved offset 0C */
304 uint pmt_reserved3; /* ABP_MISC_PP_ reserved offset 10 */
305 uint pmt_tri[PMUX_TRISTATE_REGS];/* _TRI_STATE_REG_A/B/C/D_0 14-20 */
306 uint pmt_cfg_ctl; /* _CONFIG_CTL_0, offset 24 */
308 uint pmt_reserved[22]; /* ABP_MISC_PP_ reserved offs 28-7C */
310 uint pmt_ctl[PMUX_MUX_REGS]; /* _PIN_MUX_CTL_A-G_0, offset 80 */
311 uint pmt_reserved4; /* ABP_MISC_PP_ reserved offset 9c */
312 uint pmt_pull[PMUX_PULL_REGS]; /* APB_MISC_PP_PULLUPDOWN_REG_A-E */
316 * This defines the configuration for a pin, including the function assigned,
317 * pull up/down settings and tristate settings. Having set up one of these
318 * you can call pinmux_config_pingroup() to configure a pin in one step. Also
319 * available is pinmux_config_table() to configure a list of pins.
321 struct pingroup_config {
322 enum pmux_pingrp pingroup; /* pin group PINGRP_... */
323 enum pmux_func func; /* function to assign FUNC_... */
324 enum pmux_pull pull; /* pull up/down/normal PMUX_PULL_...*/
325 enum pmux_tristate tristate; /* tristate or normal PMUX_TRI_... */
328 /* Set a pin group to tristate */
329 void pinmux_tristate_enable(enum pmux_pingrp pin);
331 /* Set a pin group to normal (non tristate) */
332 void pinmux_tristate_disable(enum pmux_pingrp pin);
334 /* Set the pull up/down feature for a pin group */
335 void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);
337 /* Set the mux function for a pin group */
338 void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func);
340 /* Set the complete configuration for a pin group */
341 void pinmux_config_pingroup(const struct pingroup_config *config);
343 void pinmux_set_tristate(enum pmux_pingrp pin, int enable);
346 * Configuure a list of pin groups
348 * @param config List of config items
349 * @param len Number of config items in list
351 void pinmux_config_table(const struct pingroup_config *config, int len);
353 #endif /* PINMUX_H */