/* Tegra2 high-level function multiplexing */
#include <common.h>
#include <asm/arch/clock.h>
+#include <asm/arch/funcmux.h>
#include <asm/arch/pinmux.h>
int funcmux_select(enum periph_id id, int config)
{
- int bad_config = config != 0;
+ int bad_config = config != FUNCMUX_DEFAULT;
switch (id) {
case PERIPH_ID_UART1:
- if (config == 0) {
+ if (config == FUNCMUX_UART1_IRRX_IRTX) {
pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA);
pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA);
pinmux_tristate_disable(PINGRP_IRRX);
break;
case PERIPH_ID_UART2:
- if (config == 0) {
+ if (config == FUNCMUX_UART2_IRDA) {
pinmux_set_func(PINGRP_UAD, PMUX_FUNC_IRDA);
pinmux_tristate_disable(PINGRP_UAD);
}
break;
case PERIPH_ID_UART4:
- if (config == 0) {
+ if (config == FUNCMUX_UART4_GMC) {
pinmux_set_func(PINGRP_GMC, PMUX_FUNC_UARTD);
pinmux_tristate_disable(PINGRP_GMC);
}
#ifndef __FUNCMUX_H
#define __FUNCMUX_H
+/* Configs supported by the func mux */
+enum {
+ FUNCMUX_DEFAULT = 0, /* default config */
+
+ /* UART configs */
+ FUNCMUX_UART1_IRRX_IRTX = 0,
+ FUNCMUX_UART2_IRDA = 0,
+ FUNCMUX_UART4_GMC = 0,
+};
+
/**
* Select a config for a particular peripheral.
*
* so that they operate in normal mode.
*
* @param id Peripheral id
- * @param config Configuration to use (generally 0)
+ * @param config Configuration to use (FUNCMUX_...), 0 for default
* @return 0 if ok, -1 on error (e.g. incorrect id or config)
*/
int funcmux_select(enum periph_id id, int config);