diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/cs5535-gpio.c | 19 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 3 | ||||
-rw-r--r-- | drivers/gpio/rdc321x-gpio.c | 2 |
3 files changed, 19 insertions, 5 deletions
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index 599f6c9e0fbf..d3e55a0ae92b 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c | |||
@@ -56,15 +56,26 @@ static struct cs5535_gpio_chip { | |||
56 | * registers, see include/linux/cs5535.h. | 56 | * registers, see include/linux/cs5535.h. |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static void errata_outl(u32 val, unsigned long addr) | 59 | static void errata_outl(struct cs5535_gpio_chip *chip, u32 val, |
60 | unsigned int reg) | ||
60 | { | 61 | { |
62 | unsigned long addr = chip->base + 0x80 + reg; | ||
63 | |||
61 | /* | 64 | /* |
62 | * According to the CS5536 errata (#36), after suspend | 65 | * According to the CS5536 errata (#36), after suspend |
63 | * a write to the high bank GPIO register will clear all | 66 | * a write to the high bank GPIO register will clear all |
64 | * non-selected bits; the recommended workaround is a | 67 | * non-selected bits; the recommended workaround is a |
65 | * read-modify-write operation. | 68 | * read-modify-write operation. |
69 | * | ||
70 | * Don't apply this errata to the edge status GPIOs, as writing | ||
71 | * to their lower bits will clear them. | ||
66 | */ | 72 | */ |
67 | val |= inl(addr); | 73 | if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) { |
74 | if (val & 0xffff) | ||
75 | val |= (inl(addr) & 0xffff); /* ignore the high bits */ | ||
76 | else | ||
77 | val |= (inl(addr) ^ (val >> 16)); | ||
78 | } | ||
68 | outl(val, addr); | 79 | outl(val, addr); |
69 | } | 80 | } |
70 | 81 | ||
@@ -76,7 +87,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | |||
76 | outl(1 << offset, chip->base + reg); | 87 | outl(1 << offset, chip->base + reg); |
77 | else | 88 | else |
78 | /* high bank register */ | 89 | /* high bank register */ |
79 | errata_outl(1 << (offset - 16), chip->base + 0x80 + reg); | 90 | errata_outl(chip, 1 << (offset - 16), reg); |
80 | } | 91 | } |
81 | 92 | ||
82 | void cs5535_gpio_set(unsigned offset, unsigned int reg) | 93 | void cs5535_gpio_set(unsigned offset, unsigned int reg) |
@@ -98,7 +109,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset, | |||
98 | outl(1 << (offset + 16), chip->base + reg); | 109 | outl(1 << (offset + 16), chip->base + reg); |
99 | else | 110 | else |
100 | /* high bank register */ | 111 | /* high bank register */ |
101 | errata_outl(1 << offset, chip->base + 0x80 + reg); | 112 | errata_outl(chip, 1 << offset, reg); |
102 | } | 113 | } |
103 | 114 | ||
104 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) | 115 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 21da9c19a0cb..649550e2cae9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1281,6 +1281,9 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | |||
1281 | err = gpio_direction_output(gpio, | 1281 | err = gpio_direction_output(gpio, |
1282 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); | 1282 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); |
1283 | 1283 | ||
1284 | if (err) | ||
1285 | gpio_free(gpio); | ||
1286 | |||
1284 | return err; | 1287 | return err; |
1285 | } | 1288 | } |
1286 | EXPORT_SYMBOL_GPL(gpio_request_one); | 1289 | EXPORT_SYMBOL_GPL(gpio_request_one); |
diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c index 2762698e0204..897e0577e65e 100644 --- a/drivers/gpio/rdc321x-gpio.c +++ b/drivers/gpio/rdc321x-gpio.c | |||
@@ -135,7 +135,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev) | |||
135 | struct rdc321x_gpio *rdc321x_gpio_dev; | 135 | struct rdc321x_gpio *rdc321x_gpio_dev; |
136 | struct rdc321x_gpio_pdata *pdata; | 136 | struct rdc321x_gpio_pdata *pdata; |
137 | 137 | ||
138 | pdata = pdev->dev.platform_data; | 138 | pdata = platform_get_drvdata(pdev); |
139 | if (!pdata) { | 139 | if (!pdata) { |
140 | dev_err(&pdev->dev, "no platform data supplied\n"); | 140 | dev_err(&pdev->dev, "no platform data supplied\n"); |
141 | return -ENODEV; | 141 | return -ENODEV; |