diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-09 13:01:00 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-23 16:25:13 +0200 |
commit | ca13a84ac2580d8507f292b469751a919af60411 (patch) | |
tree | 8cc52c2a7520bdd0d1f0b8c8175e4862503abc77 /arch/arm/mach-mxs/iomux-imx.c | |
parent | 66891566ccf72c19c3c25182f98eda4dc2a8ad3e (diff) | |
download | barebox-ca13a84ac2580d8507f292b469751a919af60411.tar.gz barebox-ca13a84ac2580d8507f292b469751a919af60411.tar.xz |
ARM: MXS: introduce stmp device support
MXS specific devices have some common infrastructure in the kernel
known as STMP devices. We have the same in barebox, but with a
mxs_ prefix instead of a stmp_ prefix. As some STMP devices are
also found on i.MX6 move the common infrastructure out of MXS
specific files and use the stmp_ prefix.
This is done in preparation for i.MX6 NAND support.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mxs/iomux-imx.c')
-rw-r--r-- | arch/arm/mach-mxs/iomux-imx.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/arch/arm/mach-mxs/iomux-imx.c b/arch/arm/mach-mxs/iomux-imx.c index 66ba74309d..3d26302d4c 100644 --- a/arch/arm/mach-mxs/iomux-imx.c +++ b/arch/arm/mach-mxs/iomux-imx.c @@ -18,6 +18,7 @@ #include <gpio.h> #include <errno.h> #include <io.h> +#include <stmp-device.h> #include <mach/imx-regs.h> #define HW_PINCTRL_CTRL 0x000 @@ -112,22 +113,24 @@ void imx_gpio_mode(uint32_t m) reg_offset = calc_strength_reg(gpio_pin); if (GET_VOLTAGE(m) == 1) writel(0x1 << (((gpio_pin % 8) << 2) + 2), - IMX_IOMUXC_BASE + reg_offset + BIT_SET); + IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_SET); else writel(0x1 << (((gpio_pin % 8) << 2) + 2), - IMX_IOMUXC_BASE + reg_offset + BIT_CLR); + IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_CLR); } if (PE_PRESENT(m)) { reg_offset = calc_pullup_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + - (GET_PULLUP(m) == 1 ? BIT_SET : BIT_CLR)); + (GET_PULLUP(m) == 1 ? + STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR)); } if (BK_PRESENT(m)) { reg_offset = calc_pullup_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + reg_offset + - (GET_BITKEEPER(m) == 1 ? BIT_CLR : BIT_SET)); + (GET_BITKEEPER(m) == 1 ? + STMP_OFFSET_REG_CLR : STMP_OFFSET_REG_SET)); } if (GET_FUNC(m) == IS_GPIO) { @@ -135,16 +138,17 @@ void imx_gpio_mode(uint32_t m) /* first set the output value */ reg_offset = calc_output_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), IMX_IOMUXC_BASE + - reg_offset + (GET_GPIOVAL(m) == 1 ? BIT_SET : BIT_CLR)); + reg_offset + (GET_GPIOVAL(m) == 1 ? + STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR)); /* then the direction */ reg_offset = calc_output_enable_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), - IMX_IOMUXC_BASE + reg_offset + BIT_SET); + IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_SET); } else { /* then the direction */ reg_offset = calc_output_enable_reg(gpio_pin); writel(0x1 << (gpio_pin % 32), - IMX_IOMUXC_BASE + reg_offset + BIT_CLR); + IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_CLR); } } } @@ -157,7 +161,7 @@ int gpio_direction_input(unsigned gpio) return -EINVAL; reg_offset = calc_output_enable_reg(gpio); - writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + reg_offset + BIT_CLR); + writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_CLR); return 0; } @@ -172,10 +176,10 @@ int gpio_direction_output(unsigned gpio, int val) /* first set the output value... */ reg_offset = calc_output_reg(gpio); writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + - reg_offset + (val != 0 ? BIT_SET : BIT_CLR)); + reg_offset + (val != 0 ? STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR)); /* ...then the direction */ reg_offset = calc_output_enable_reg(gpio); - writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + reg_offset + BIT_SET); + writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_SET); return 0; } @@ -186,7 +190,8 @@ void gpio_set_value(unsigned gpio, int val) reg_offset = calc_output_reg(gpio); writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + - reg_offset + (val != 0 ? BIT_SET : BIT_CLR)); + reg_offset + (val != 0 ? + STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR)); } int gpio_get_value(unsigned gpio) |