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,
245 PMUX_FUNC_VI_SENSOR_CLK,
249 /* These don't have a name, but can be used in the table */
254 PMUX_FUNC_RSVD, /* Not valid and should not be used */
261 /* return 1 if a pmux_func is in range */
262 #define pmux_func_isvalid(func) ((func) >= 0 && (func) < PMUX_FUNC_COUNT && \
263 (func) != PMUX_FUNC_RSVD)
265 /* The pullup/pulldown state of a pin group */
267 PMUX_PULL_NORMAL = 0,
272 /* Defines whether a pin group is tristated or in normal operation */
275 PMUX_TRI_TRISTATE = 1,
278 /* Available power domains used by pin groups */
294 PMUX_TRISTATE_REGS = 4,
299 /* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */
300 struct pmux_tri_ctlr {
301 uint pmt_reserved0; /* ABP_MISC_PP_ reserved offset 00 */
302 uint pmt_reserved1; /* ABP_MISC_PP_ reserved offset 04 */
303 uint pmt_strap_opt_a; /* _STRAPPING_OPT_A_0, offset 08 */
304 uint pmt_reserved2; /* ABP_MISC_PP_ reserved offset 0C */
305 uint pmt_reserved3; /* ABP_MISC_PP_ reserved offset 10 */
306 uint pmt_tri[PMUX_TRISTATE_REGS];/* _TRI_STATE_REG_A/B/C/D_0 14-20 */
307 uint pmt_cfg_ctl; /* _CONFIG_CTL_0, offset 24 */
309 uint pmt_reserved[22]; /* ABP_MISC_PP_ reserved offs 28-7C */
311 uint pmt_ctl[PMUX_MUX_REGS]; /* _PIN_MUX_CTL_A-G_0, offset 80 */
312 uint pmt_reserved4; /* ABP_MISC_PP_ reserved offset 9c */
313 uint pmt_pull[PMUX_PULL_REGS]; /* APB_MISC_PP_PULLUPDOWN_REG_A-E */
317 * This defines the configuration for a pin, including the function assigned,
318 * pull up/down settings and tristate settings. Having set up one of these
319 * you can call pinmux_config_pingroup() to configure a pin in one step. Also
320 * available is pinmux_config_table() to configure a list of pins.
322 struct pingroup_config {
323 enum pmux_pingrp pingroup; /* pin group PINGRP_... */
324 enum pmux_func func; /* function to assign FUNC_... */
325 enum pmux_pull pull; /* pull up/down/normal PMUX_PULL_...*/
326 enum pmux_tristate tristate; /* tristate or normal PMUX_TRI_... */
329 /* Set a pin group to tristate */
330 void pinmux_tristate_enable(enum pmux_pingrp pin);
332 /* Set a pin group to normal (non tristate) */
333 void pinmux_tristate_disable(enum pmux_pingrp pin);
335 /* Set the pull up/down feature for a pin group */
336 void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);
338 /* Set the mux function for a pin group */
339 void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func);
341 /* Set the complete configuration for a pin group */
342 void pinmux_config_pingroup(struct pingroup_config *config);
344 void pinmux_set_tristate(enum pmux_pingrp pin, int enable);
347 * Configuure a list of pin groups
349 * @param config List of config items
350 * @param len Number of config items in list
352 void pinmux_config_table(struct pingroup_config *config, int len);
354 #endif /* PINMUX_H */