2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com>
5 * SPDX-License-Identifier: GPL-2.0+
12 * Pin groups which we adjust. There are three basic attributes of each pin
13 * group which use this enum:
17 * - tristate or normal
20 /* APB_MISC_PP_TRISTATE_REG_A_0 */
57 /* 32: APB_MISC_PP_TRISTATE_REG_B_0 */
94 /* 64: APB_MISC_PP_TRISTATE_REG_C_0 */
131 /* 96: APB_MISC_PP_TRISTATE_REG_D_0 */
150 /* these pin groups only have pullup and pull down control */
152 PINGRP_CK32 = PINGRP_FIRST_NO_MUX,
166 * Functions which can be assigned to each of the pin groups. The values here
167 * bear no relation to the values programmed into pinmux registers and are
168 * purely a convenience. The translation is done through a table search.
173 PMUX_FUNC_AUDIO_SYNC,
182 PMUX_FUNC_EMC_TEST0_DLL,
183 PMUX_FUNC_EMC_TEST1_DLL,
228 PMUX_FUNC_VI_SENSOR_CLK,
231 /* These don't have a name, but can be used in the table */
236 PMUX_FUNC_RSVD, /* Not valid and should not be used */
243 /* return 1 if a pmux_func is in range */
244 #define pmux_func_isvalid(func) ((func) >= 0 && (func) < PMUX_FUNC_COUNT && \
245 (func) != PMUX_FUNC_RSVD)
247 /* The pullup/pulldown state of a pin group */
249 PMUX_PULL_NORMAL = 0,
254 /* Defines whether a pin group is tristated or in normal operation */
257 PMUX_TRI_TRISTATE = 1,
261 PMUX_TRISTATE_REGS = 4,
266 /* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */
267 struct pmux_tri_ctlr {
268 uint pmt_reserved0; /* ABP_MISC_PP_ reserved offset 00 */
269 uint pmt_reserved1; /* ABP_MISC_PP_ reserved offset 04 */
270 uint pmt_strap_opt_a; /* _STRAPPING_OPT_A_0, offset 08 */
271 uint pmt_reserved2; /* ABP_MISC_PP_ reserved offset 0C */
272 uint pmt_reserved3; /* ABP_MISC_PP_ reserved offset 10 */
273 uint pmt_tri[PMUX_TRISTATE_REGS];/* _TRI_STATE_REG_A/B/C/D_0 14-20 */
274 uint pmt_cfg_ctl; /* _CONFIG_CTL_0, offset 24 */
276 uint pmt_reserved[22]; /* ABP_MISC_PP_ reserved offs 28-7C */
278 uint pmt_ctl[PMUX_MUX_REGS]; /* _PIN_MUX_CTL_A-G_0, offset 80 */
279 uint pmt_reserved4; /* ABP_MISC_PP_ reserved offset 9c */
280 uint pmt_pull[PMUX_PULL_REGS]; /* APB_MISC_PP_PULLUPDOWN_REG_A-E */
284 * This defines the configuration for a pin, including the function assigned,
285 * pull up/down settings and tristate settings. Having set up one of these
286 * you can call pinmux_config_pingroup() to configure a pin in one step. Also
287 * available is pinmux_config_table() to configure a list of pins.
289 struct pingroup_config {
290 enum pmux_pingrp pingroup; /* pin group PINGRP_... */
291 enum pmux_func func; /* function to assign FUNC_... */
292 enum pmux_pull pull; /* pull up/down/normal PMUX_PULL_...*/
293 enum pmux_tristate tristate; /* tristate or normal PMUX_TRI_... */
296 /* Set a pin group to tristate */
297 void pinmux_tristate_enable(enum pmux_pingrp pin);
299 /* Set a pin group to normal (non tristate) */
300 void pinmux_tristate_disable(enum pmux_pingrp pin);
302 /* Set the pull up/down feature for a pin group */
303 void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);
305 /* Set the mux function for a pin group */
306 void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func);
308 /* Set the complete configuration for a pin group */
309 void pinmux_config_pingroup(const struct pingroup_config *config);
311 void pinmux_set_tristate(enum pmux_pingrp pin, int enable);
314 * Configuure a list of pin groups
316 * @param config List of config items
317 * @param len Number of config items in list
319 void pinmux_config_table(const struct pingroup_config *config, int len);
321 #endif /* PINMUX_H */