diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-01-27 21:29:41 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-01-28 08:18:43 +0100 |
commit | 478ea1c0b1e4db8275786ff7fb285d61d7697656 (patch) | |
tree | 49539757b594969e029a5a0585fa939ac829dc9b /arch/arm/mach-mxs/iomux-imx.c | |
parent | 2a0f2d46fd4b4e6d0da83dee944916a7ce7013b1 (diff) | |
download | barebox-478ea1c0b1e4db8275786ff7fb285d61d7697656.tar.gz barebox-478ea1c0b1e4db8275786ff7fb285d61d7697656.tar.xz |
ARM: MXS: Make gpio a driver
This turns the MXS gpio support into a driver.
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 | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/arch/arm/mach-mxs/iomux-imx.c b/arch/arm/mach-mxs/iomux-imx.c index 84c6ca4ca7..68a4e3cbd6 100644 --- a/arch/arm/mach-mxs/iomux-imx.c +++ b/arch/arm/mach-mxs/iomux-imx.c @@ -75,12 +75,6 @@ static unsigned calc_output_reg(unsigned no) return ((no >> 5) << 4) + HW_PINCTRL_DOUT0; } -static unsigned calc_input_reg(unsigned no) -{ - /* each register controls 32 pads */ - return ((no >> 5) << 4) + HW_PINCTRL_DIN0; -} - /** * @param[in] m One pin define per call from iomux-mx23.h/iomux-mx28.h */ @@ -168,57 +162,3 @@ void imx_gpio_mode(uint32_t m) } } } - -int gpio_direction_input(unsigned gpio) -{ - unsigned reg_offset; - - if (gpio > MAX_GPIO_NO) - return -EINVAL; - - reg_offset = calc_output_enable_reg(gpio); - writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + reg_offset + STMP_OFFSET_REG_CLR); - - return 0; -} - -int gpio_direction_output(unsigned gpio, int val) -{ - unsigned reg_offset; - - if (gpio > MAX_GPIO_NO) - return -EINVAL; - - /* first set the output value... */ - reg_offset = calc_output_reg(gpio); - writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + - 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 + STMP_OFFSET_REG_SET); - - return 0; -} - -void gpio_set_value(unsigned gpio, int val) -{ - unsigned reg_offset; - - reg_offset = calc_output_reg(gpio); - writel(0x1 << (gpio % 32), IMX_IOMUXC_BASE + - reg_offset + (val != 0 ? - STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR)); -} - -int gpio_get_value(unsigned gpio) -{ - uint32_t reg; - unsigned reg_offset; - - reg_offset = calc_input_reg(gpio); - reg = readl(IMX_IOMUXC_BASE + reg_offset); - if (reg & (0x1 << (gpio % 32))) - return 1; - - return 0; -} |