uboot-omap: switch to u-boot.mk
[openwrt/staging/yousong.git] / package / boot / uboot-oxnas / files / arch / arm / cpu / arm1136 / nas782x / pinmux.c
1 #include <common.h>
2 #include <asm/arch/pinmux.h>
3
4 void pinmux_set(int bank, int pin, int func)
5 {
6 u32 reg;
7 u32 base;
8 /* TODO: check parameters */
9
10 if (bank == PINMUX_BANK_MFA)
11 base = SYS_CONTROL_BASE;
12 else
13 base = SEC_CONTROL_BASE;
14
15 clrbits_le32(base + PINMUX_SECONDARY_SEL, BIT(pin));
16 clrbits_le32(base + PINMUX_TERTIARY_SEL, BIT(pin));
17 clrbits_le32(base + PINMUX_QUATERNARY_SEL, BIT(pin));
18 clrbits_le32(base + PINMUX_DEBUG_SEL, BIT(pin));
19 clrbits_le32(base + PINMUX_ALTERNATIVE_SEL, BIT(pin));
20
21 switch (func) {
22 case PINMUX_GPIO:
23 default:
24 return;
25 break;
26 case PINMUX_2:
27 reg = base + PINMUX_SECONDARY_SEL;
28 break;
29 case PINMUX_3:
30 reg = base + PINMUX_TERTIARY_SEL;
31 break;
32 case PINMUX_4:
33 reg = base + PINMUX_QUATERNARY_SEL;
34 break;
35 case PINMUX_DEBUG:
36 reg = base + PINMUX_DEBUG_SEL;
37 break;
38 case PINMUX_ALT:
39 reg = base + PINMUX_ALTERNATIVE_SEL;
40 break;
41 }
42 setbits_le32(reg, BIT(pin));
43 }