diff options
author | Peter Griffin <peter.griffin@linaro.org> | 2015-07-30 18:55:20 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-08-12 20:48:00 -0400 |
commit | 8a954eb695326eb406c4a548bb686190fea82bca (patch) | |
tree | f311dbe22c474fa51142b69d4c689555091ed0b1 /arch/arm/include | |
parent | 8293009baa3de9ef22cff50bfea6a31f3fa1af62 (diff) | |
download | u-boot-imx-8a954eb695326eb406c4a548bb686190fea82bca.zip u-boot-imx-8a954eb695326eb406c4a548bb686190fea82bca.tar.gz u-boot-imx-8a954eb695326eb406c4a548bb686190fea82bca.tar.bz2 |
hisilicon: hi6220: Add a hi6220 pinmux driver.
This patch adds basic pinmux support for the hi6220 SoC,
which is found on the hikey board.
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/arch-hi6220/periph.h | 30 | ||||
-rw-r--r-- | arch/arm/include/asm/arch-hi6220/pinmux.h | 82 |
2 files changed, 112 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-hi6220/periph.h b/arch/arm/include/asm/arch-hi6220/periph.h new file mode 100644 index 0000000..7155f60 --- /dev/null +++ b/arch/arm/include/asm/arch-hi6220/periph.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015 Linaro + * Peter Griffin <peter.griffin@linaro.org> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __ASM_ARM_ARCH_PERIPH_H +#define __ASM_ARM_ARCH_PERIPH_H + +/* + * Peripherals required for pinmux configuration. List will + * grow with support for more devices getting added. + * Numbering based on interrupt table. + * + */ +enum periph_id { + PERIPH_ID_UART0 = 36, + PERIPH_ID_UART1, + PERIPH_ID_UART2, + PERIPH_ID_UART3, + PERIPH_ID_UART4, + PERIPH_ID_UART5, + PERIPH_ID_SDMMC0 = 72, + PERIPH_ID_SDMMC1, + + PERIPH_ID_NONE = -1, +}; + +#endif /* __ASM_ARM_ARCH_PERIPH_H */ diff --git a/arch/arm/include/asm/arch-hi6220/pinmux.h b/arch/arm/include/asm/arch-hi6220/pinmux.h new file mode 100644 index 0000000..1dd5f9b --- /dev/null +++ b/arch/arm/include/asm/arch-hi6220/pinmux.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2015 Linaro + * Peter Griffin <peter.griffin@linaro.org> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __ASM_ARM_ARCH_PINMUX_H +#define __ASM_ARM_ARCH_PINMUX_H + +#include "periph.h" + + +/* iomg bit definition */ +#define MUX_M0 0 +#define MUX_M1 1 +#define MUX_M2 2 +#define MUX_M3 3 +#define MUX_M4 4 +#define MUX_M5 5 +#define MUX_M6 6 +#define MUX_M7 7 + +/* iocg bit definition */ +#define PULL_MASK (3) +#define PULL_DIS (0) +#define PULL_UP (1 << 0) +#define PULL_DOWN (1 << 1) + +/* drive strength definition */ +#define DRIVE_MASK (7 << 4) +#define DRIVE1_02MA (0 << 4) +#define DRIVE1_04MA (1 << 4) +#define DRIVE1_08MA (2 << 4) +#define DRIVE1_10MA (3 << 4) +#define DRIVE2_02MA (0 << 4) +#define DRIVE2_04MA (1 << 4) +#define DRIVE2_08MA (2 << 4) +#define DRIVE2_10MA (3 << 4) +#define DRIVE3_04MA (0 << 4) +#define DRIVE3_08MA (1 << 4) +#define DRIVE3_12MA (2 << 4) +#define DRIVE3_16MA (3 << 4) +#define DRIVE3_20MA (4 << 4) +#define DRIVE3_24MA (5 << 4) +#define DRIVE3_32MA (6 << 4) +#define DRIVE3_40MA (7 << 4) +#define DRIVE4_02MA (0 << 4) +#define DRIVE4_04MA (2 << 4) +#define DRIVE4_08MA (4 << 4) +#define DRIVE4_10MA (6 << 4) + +#define HI6220_PINMUX0_BASE 0xf7010000 +#define HI6220_PINMUX1_BASE 0xf7010800 + +#ifndef __ASSEMBLY__ + +/* maybe more registers, but highest used is 123 */ +#define REG_NUM 123 + +struct hi6220_pinmux0_regs { + uint32_t iomg[REG_NUM]; +}; + +struct hi6220_pinmux1_regs { + uint32_t iocfg[REG_NUM]; +}; + +#endif + +/** + * Configures the pinmux for a particular peripheral. + * + * This function will configure the peripheral pinmux along with + * pull-up/down and drive strength. + * + * @param peripheral peripheral to be configured + * @return 0 if ok, -1 on error (e.g. unsupported peripheral) + */ +int hi6220_pinmux_config(int peripheral); + +#endif |