diff options
author | Felix Fietkau <nbd@nbd.name> | 2017-01-23 12:40:32 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-01-24 16:21:25 +0100 |
commit | bb88ec947fc7f4db6ada9ccccb0c4d09c75742b0 (patch) | |
tree | 192ce26a517d60b19740bc30a2c2aaa821589cc7 /package/boot/uboot-oxnas/src/arch/arm/cpu/arm1136/nas782x/pinmux.c | |
parent | 12bfa1c425e5012e063b0afd9a09d2dfefc20eee (diff) | |
download | upstream-bb88ec947fc7f4db6ada9ccccb0c4d09c75742b0.tar.gz upstream-bb88ec947fc7f4db6ada9ccccb0c4d09c75742b0.tar.bz2 upstream-bb88ec947fc7f4db6ada9ccccb0c4d09c75742b0.zip |
uboot-oxnas: switch to u-boot.mk
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/boot/uboot-oxnas/src/arch/arm/cpu/arm1136/nas782x/pinmux.c')
-rw-r--r-- | package/boot/uboot-oxnas/src/arch/arm/cpu/arm1136/nas782x/pinmux.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/package/boot/uboot-oxnas/src/arch/arm/cpu/arm1136/nas782x/pinmux.c b/package/boot/uboot-oxnas/src/arch/arm/cpu/arm1136/nas782x/pinmux.c new file mode 100644 index 0000000000..a6f5e9abc4 --- /dev/null +++ b/package/boot/uboot-oxnas/src/arch/arm/cpu/arm1136/nas782x/pinmux.c @@ -0,0 +1,43 @@ +#include <common.h> +#include <asm/arch/pinmux.h> + +void pinmux_set(int bank, int pin, int func) +{ + u32 reg; + u32 base; + /* TODO: check parameters */ + + if (bank == PINMUX_BANK_MFA) + base = SYS_CONTROL_BASE; + else + base = SEC_CONTROL_BASE; + + clrbits_le32(base + PINMUX_SECONDARY_SEL, BIT(pin)); + clrbits_le32(base + PINMUX_TERTIARY_SEL, BIT(pin)); + clrbits_le32(base + PINMUX_QUATERNARY_SEL, BIT(pin)); + clrbits_le32(base + PINMUX_DEBUG_SEL, BIT(pin)); + clrbits_le32(base + PINMUX_ALTERNATIVE_SEL, BIT(pin)); + + switch (func) { + case PINMUX_GPIO: + default: + return; + break; + case PINMUX_2: + reg = base + PINMUX_SECONDARY_SEL; + break; + case PINMUX_3: + reg = base + PINMUX_TERTIARY_SEL; + break; + case PINMUX_4: + reg = base + PINMUX_QUATERNARY_SEL; + break; + case PINMUX_DEBUG: + reg = base + PINMUX_DEBUG_SEL; + break; + case PINMUX_ALT: + reg = base + PINMUX_ALTERNATIVE_SEL; + break; + } + setbits_le32(reg, BIT(pin)); +} |