summaryrefslogtreecommitdiff
path: root/drivers/gpio/mxs_gpio.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2012-01-13 20:07:40 +0100
committerWolfgang Denk <wd@denx.de>2012-01-13 20:07:40 +0100
commit3dc5ea500ffc00a1b3602b5e7fe69e72908a1818 (patch)
tree5964d7f08dd5bb3eb6b4a7dd32c1466363390079 /drivers/gpio/mxs_gpio.c
parent8eee2bd7f484c4933c4e3112c3c3db886ac945ca (diff)
parentc947c12e7805e5562b5c803f74eaceba8c66ba56 (diff)
downloadu-boot-imx-3dc5ea500ffc00a1b3602b5e7fe69e72908a1818.zip
u-boot-imx-3dc5ea500ffc00a1b3602b5e7fe69e72908a1818.tar.gz
u-boot-imx-3dc5ea500ffc00a1b3602b5e7fe69e72908a1818.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-mpc83xx
* 'master' of git://git.denx.de/u-boot-mpc83xx: mpc8313erdb: fix mtdparts address powerpc/83xx/km: add support for 8321 based tuge1 board powerpc/83xx/km: merge tuxa and tuda1 boards to tuxx1 powerpc/83xx/km: remove obsolete defines for tuda1 powerpc/83xx/km: update SDRAM parameters for km8321 boards mpc8313erdb: Enable GPIO support on the MPC8313E RDB mpc83xx: Add a GPIO driver for the MPC83XX family gpio: Replace ARM gpio.h with the common API in include/asm-generic gpio: Modify common gpio.h to more closely match Linux
Diffstat (limited to 'drivers/gpio/mxs_gpio.c')
-rw-r--r--drivers/gpio/mxs_gpio.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c
index 539738b..0365812 100644
--- a/drivers/gpio/mxs_gpio.c
+++ b/drivers/gpio/mxs_gpio.c
@@ -69,68 +69,64 @@ void mxs_gpio_init(void)
}
}
-int gpio_get_value(int gp)
+int gpio_get_value(unsigned gpio)
{
- uint32_t bank = PAD_BANK(gp);
+ uint32_t bank = PAD_BANK(gpio);
uint32_t offset = PINCTRL_DIN(bank);
struct mx28_register *reg =
(struct mx28_register *)(MXS_PINCTRL_BASE + offset);
- return (readl(&reg->reg) >> PAD_PIN(gp)) & 1;
+ return (readl(&reg->reg) >> PAD_PIN(gpio)) & 1;
}
-void gpio_set_value(int gp, int value)
+void gpio_set_value(unsigned gpio, int value)
{
- uint32_t bank = PAD_BANK(gp);
+ uint32_t bank = PAD_BANK(gpio);
uint32_t offset = PINCTRL_DOUT(bank);
struct mx28_register *reg =
(struct mx28_register *)(MXS_PINCTRL_BASE + offset);
if (value)
- writel(1 << PAD_PIN(gp), &reg->reg_set);
+ writel(1 << PAD_PIN(gpio), &reg->reg_set);
else
- writel(1 << PAD_PIN(gp), &reg->reg_clr);
+ writel(1 << PAD_PIN(gpio), &reg->reg_clr);
}
-int gpio_direction_input(int gp)
+int gpio_direction_input(unsigned gpio)
{
- uint32_t bank = PAD_BANK(gp);
+ uint32_t bank = PAD_BANK(gpio);
uint32_t offset = PINCTRL_DOE(bank);
struct mx28_register *reg =
(struct mx28_register *)(MXS_PINCTRL_BASE + offset);
- writel(1 << PAD_PIN(gp), &reg->reg_clr);
+ writel(1 << PAD_PIN(gpio), &reg->reg_clr);
return 0;
}
-int gpio_direction_output(int gp, int value)
+int gpio_direction_output(unsigned gpio, int value)
{
- uint32_t bank = PAD_BANK(gp);
+ uint32_t bank = PAD_BANK(gpio);
uint32_t offset = PINCTRL_DOE(bank);
struct mx28_register *reg =
(struct mx28_register *)(MXS_PINCTRL_BASE + offset);
- writel(1 << PAD_PIN(gp), &reg->reg_set);
+ writel(1 << PAD_PIN(gpio), &reg->reg_set);
- gpio_set_value(gp, value);
+ gpio_set_value(gpio, value);
return 0;
}
-int gpio_request(int gp, const char *label)
+int gpio_request(unsigned gpio, const char *label)
{
- if (PAD_BANK(gp) >= PINCTRL_BANKS)
- return -EINVAL;
+ if (PAD_BANK(gpio) >= PINCTRL_BANKS)
+ return -1;
return 0;
}
-void gpio_free(int gp)
+int gpio_free(unsigned gpio)
{
-}
-
-void gpio_toggle_value(int gp)
-{
- gpio_set_value(gp, !gpio_get_value(gp));
+ return 0;
}