diff options
author | Kevin Hilman <khilman@linaro.org> | 2013-12-09 18:38:00 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2013-12-09 18:38:41 -0500 |
commit | ed16c8c50e26df3c16e40d35c9a4c0e9f032656c (patch) | |
tree | f268748e4bd3a6ceb08b7a7a70fb86c4dfce0e02 /drivers/gpio | |
parent | 8ae19ec3356901bafa64816d9ea9378896f8979c (diff) | |
parent | f2e2c9d9b4087b74eb9e00d8dfac148354cb0b71 (diff) |
Merge tag 'omap-for-v3.13/yet-more-dt-regressions-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
A rather big fix for a regression where we have dropped omap4 hwmod
data earlier but are not initializing it from device tree. In addition
to this fix we eventually also be fix the issues in the .dts files
and drivers, but that's too intrusive for the -rc cycle and must be
done later on.
Also a fix for a regression where we now are wrongly trying to initialize
devices on secure omaps like n900 and n9* when booted using device tree.
We need to set aes, sham and timer12 to disabled mode for secure
devices as they are claimed by the firmware running in the secure mode.
And two more legacy booting vs device tree based booting fixes for
am3517 that I did not notice earlier until Nishant Menon reported
these to me few days ago. With these we're good to go having v3.13
working both for legacy booting and device tree based booting, and we
can then go ahed and drop the legacy booting for mach-omap2 for v3.14.
* tag 'omap-for-v3.13/yet-more-dt-regressions-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (494 commits)
ARM: dts: Fix booting for secure omaps
ARM: OMAP2+: Fix the machine entry for am3517
ARM: dts: Fix missing entries for am3517
ARM: OMAP2+: Fix overwriting hwmod data with data from device tree
+Linux 3.13-rc3
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-bcm-kona.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-mpc8xxx.c | 8 | ||||
-rw-r--r-- | drivers/gpio/gpio-msm-v2.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-mvebu.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-pl061.c | 10 | ||||
-rw-r--r-- | drivers/gpio/gpio-rcar.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-tb10x.c | 1 | ||||
-rw-r--r-- | drivers/gpio/gpio-ucb1400.c | 1 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 78 |
9 files changed, 64 insertions, 42 deletions
diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c index 72c927dc3be1..54c18c220a60 100644 --- a/drivers/gpio/gpio-bcm-kona.c +++ b/drivers/gpio/gpio-bcm-kona.c | |||
@@ -158,7 +158,7 @@ static int bcm_kona_gpio_get(struct gpio_chip *chip, unsigned gpio) | |||
158 | spin_unlock_irqrestore(&kona_gpio->lock, flags); | 158 | spin_unlock_irqrestore(&kona_gpio->lock, flags); |
159 | 159 | ||
160 | /* return the specified bit status */ | 160 | /* return the specified bit status */ |
161 | return !!(val & bit); | 161 | return !!(val & BIT(bit)); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int bcm_kona_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | 164 | static int bcm_kona_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) |
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 914e859e3eda..d7d6d72eba33 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
@@ -70,10 +70,14 @@ static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio) | |||
70 | u32 val; | 70 | u32 val; |
71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | 71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); |
72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); | 72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); |
73 | u32 out_mask, out_shadow; | ||
73 | 74 | ||
74 | val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR); | 75 | out_mask = in_be32(mm->regs + GPIO_DIR); |
75 | 76 | ||
76 | return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio); | 77 | val = in_be32(mm->regs + GPIO_DAT) & ~out_mask; |
78 | out_shadow = mpc8xxx_gc->data & out_mask; | ||
79 | |||
80 | return (val | out_shadow) & mpc8xxx_gpio2mask(gpio); | ||
77 | } | 81 | } |
78 | 82 | ||
79 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) | 83 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
diff --git a/drivers/gpio/gpio-msm-v2.c b/drivers/gpio/gpio-msm-v2.c index f7a0cc4da950..7b37300973db 100644 --- a/drivers/gpio/gpio-msm-v2.c +++ b/drivers/gpio/gpio-msm-v2.c | |||
@@ -102,7 +102,7 @@ struct msm_gpio_dev { | |||
102 | DECLARE_BITMAP(wake_irqs, MAX_NR_GPIO); | 102 | DECLARE_BITMAP(wake_irqs, MAX_NR_GPIO); |
103 | DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO); | 103 | DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO); |
104 | struct irq_domain *domain; | 104 | struct irq_domain *domain; |
105 | unsigned int summary_irq; | 105 | int summary_irq; |
106 | void __iomem *msm_tlmm_base; | 106 | void __iomem *msm_tlmm_base; |
107 | }; | 107 | }; |
108 | 108 | ||
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 3c3321f94053..db3129043e63 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -79,7 +79,7 @@ struct mvebu_gpio_chip { | |||
79 | spinlock_t lock; | 79 | spinlock_t lock; |
80 | void __iomem *membase; | 80 | void __iomem *membase; |
81 | void __iomem *percpu_membase; | 81 | void __iomem *percpu_membase; |
82 | unsigned int irqbase; | 82 | int irqbase; |
83 | struct irq_domain *domain; | 83 | struct irq_domain *domain; |
84 | int soc_variant; | 84 | int soc_variant; |
85 | }; | 85 | }; |
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index f22f7f3e2e53..b4d42112d02d 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c | |||
@@ -286,11 +286,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | |||
286 | if (!chip->base) | 286 | if (!chip->base) |
287 | return -ENOMEM; | 287 | return -ENOMEM; |
288 | 288 | ||
289 | chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, | ||
290 | irq_base, &pl061_domain_ops, chip); | ||
291 | if (!chip->domain) | ||
292 | return -ENODEV; | ||
293 | |||
294 | spin_lock_init(&chip->lock); | 289 | spin_lock_init(&chip->lock); |
295 | 290 | ||
296 | chip->gc.request = pl061_gpio_request; | 291 | chip->gc.request = pl061_gpio_request; |
@@ -320,6 +315,11 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | |||
320 | irq_set_chained_handler(irq, pl061_irq_handler); | 315 | irq_set_chained_handler(irq, pl061_irq_handler); |
321 | irq_set_handler_data(irq, chip); | 316 | irq_set_handler_data(irq, chip); |
322 | 317 | ||
318 | chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, | ||
319 | irq_base, &pl061_domain_ops, chip); | ||
320 | if (!chip->domain) | ||
321 | return -ENODEV; | ||
322 | |||
323 | for (i = 0; i < PL061_GPIO_NR; i++) { | 323 | for (i = 0; i < PL061_GPIO_NR; i++) { |
324 | if (pdata) { | 324 | if (pdata) { |
325 | if (pdata->directions & (1 << i)) | 325 | if (pdata->directions & (1 << i)) |
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index d3f15ae93bd3..fe088a30567a 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c | |||
@@ -381,7 +381,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) | |||
381 | if (!p->irq_domain) { | 381 | if (!p->irq_domain) { |
382 | ret = -ENXIO; | 382 | ret = -ENXIO; |
383 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | 383 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); |
384 | goto err1; | 384 | goto err0; |
385 | } | 385 | } |
386 | 386 | ||
387 | if (devm_request_irq(&pdev->dev, irq->start, | 387 | if (devm_request_irq(&pdev->dev, irq->start, |
diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c index 0502b9a041a5..da071ddbad99 100644 --- a/drivers/gpio/gpio-tb10x.c +++ b/drivers/gpio/gpio-tb10x.c | |||
@@ -132,6 +132,7 @@ static int tb10x_gpio_direction_out(struct gpio_chip *chip, | |||
132 | int mask = BIT(offset); | 132 | int mask = BIT(offset); |
133 | int val = TB10X_GPIO_DIR_OUT << offset; | 133 | int val = TB10X_GPIO_DIR_OUT << offset; |
134 | 134 | ||
135 | tb10x_gpio_set(chip, offset, value); | ||
135 | tb10x_set_bits(tb10x_gpio, OFFSET_TO_REG_DDR, mask, val); | 136 | tb10x_set_bits(tb10x_gpio, OFFSET_TO_REG_DDR, mask, val); |
136 | 137 | ||
137 | return 0; | 138 | return 0; |
diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c index 1a605f2a0f55..06fb5cf99ded 100644 --- a/drivers/gpio/gpio-ucb1400.c +++ b/drivers/gpio/gpio-ucb1400.c | |||
@@ -105,3 +105,4 @@ module_platform_driver(ucb1400_gpio_driver); | |||
105 | 105 | ||
106 | MODULE_DESCRIPTION("Philips UCB1400 GPIO driver"); | 106 | MODULE_DESCRIPTION("Philips UCB1400 GPIO driver"); |
107 | MODULE_LICENSE("GPL"); | 107 | MODULE_LICENSE("GPL"); |
108 | MODULE_ALIAS("platform:ucb1400_gpio"); | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4e10b10d3ddd..85f772c0b26a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/idr.h> | 14 | #include <linux/idr.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/acpi.h> | 16 | #include <linux/acpi.h> |
17 | #include <linux/gpio/driver.h> | ||
17 | 18 | ||
18 | #define CREATE_TRACE_POINTS | 19 | #define CREATE_TRACE_POINTS |
19 | #include <trace/events/gpio.h> | 20 | #include <trace/events/gpio.h> |
@@ -1308,6 +1309,18 @@ struct gpio_chip *gpiochip_find(void *data, | |||
1308 | } | 1309 | } |
1309 | EXPORT_SYMBOL_GPL(gpiochip_find); | 1310 | EXPORT_SYMBOL_GPL(gpiochip_find); |
1310 | 1311 | ||
1312 | static int gpiochip_match_name(struct gpio_chip *chip, void *data) | ||
1313 | { | ||
1314 | const char *name = data; | ||
1315 | |||
1316 | return !strcmp(chip->label, name); | ||
1317 | } | ||
1318 | |||
1319 | static struct gpio_chip *find_chip_by_name(const char *name) | ||
1320 | { | ||
1321 | return gpiochip_find((void *)name, gpiochip_match_name); | ||
1322 | } | ||
1323 | |||
1311 | #ifdef CONFIG_PINCTRL | 1324 | #ifdef CONFIG_PINCTRL |
1312 | 1325 | ||
1313 | /** | 1326 | /** |
@@ -1341,8 +1354,10 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip, | |||
1341 | ret = pinctrl_get_group_pins(pctldev, pin_group, | 1354 | ret = pinctrl_get_group_pins(pctldev, pin_group, |
1342 | &pin_range->range.pins, | 1355 | &pin_range->range.pins, |
1343 | &pin_range->range.npins); | 1356 | &pin_range->range.npins); |
1344 | if (ret < 0) | 1357 | if (ret < 0) { |
1358 | kfree(pin_range); | ||
1345 | return ret; | 1359 | return ret; |
1360 | } | ||
1346 | 1361 | ||
1347 | pinctrl_add_gpio_range(pctldev, &pin_range->range); | 1362 | pinctrl_add_gpio_range(pctldev, &pin_range->range); |
1348 | 1363 | ||
@@ -2260,26 +2275,10 @@ void gpiod_add_table(struct gpiod_lookup *table, size_t size) | |||
2260 | mutex_unlock(&gpio_lookup_lock); | 2275 | mutex_unlock(&gpio_lookup_lock); |
2261 | } | 2276 | } |
2262 | 2277 | ||
2263 | /* | ||
2264 | * Caller must have a acquired gpio_lookup_lock | ||
2265 | */ | ||
2266 | static struct gpio_chip *find_chip_by_name(const char *name) | ||
2267 | { | ||
2268 | struct gpio_chip *chip = NULL; | ||
2269 | |||
2270 | list_for_each_entry(chip, &gpio_lookup_list, list) { | ||
2271 | if (chip->label == NULL) | ||
2272 | continue; | ||
2273 | if (!strcmp(chip->label, name)) | ||
2274 | break; | ||
2275 | } | ||
2276 | |||
2277 | return chip; | ||
2278 | } | ||
2279 | |||
2280 | #ifdef CONFIG_OF | 2278 | #ifdef CONFIG_OF |
2281 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | 2279 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, |
2282 | unsigned int idx, unsigned long *flags) | 2280 | unsigned int idx, |
2281 | enum gpio_lookup_flags *flags) | ||
2283 | { | 2282 | { |
2284 | char prop_name[32]; /* 32 is max size of property name */ | 2283 | char prop_name[32]; /* 32 is max size of property name */ |
2285 | enum of_gpio_flags of_flags; | 2284 | enum of_gpio_flags of_flags; |
@@ -2297,20 +2296,22 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | |||
2297 | return desc; | 2296 | return desc; |
2298 | 2297 | ||
2299 | if (of_flags & OF_GPIO_ACTIVE_LOW) | 2298 | if (of_flags & OF_GPIO_ACTIVE_LOW) |
2300 | *flags |= GPIOF_ACTIVE_LOW; | 2299 | *flags |= GPIO_ACTIVE_LOW; |
2301 | 2300 | ||
2302 | return desc; | 2301 | return desc; |
2303 | } | 2302 | } |
2304 | #else | 2303 | #else |
2305 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | 2304 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, |
2306 | unsigned int idx, unsigned long *flags) | 2305 | unsigned int idx, |
2306 | enum gpio_lookup_flags *flags) | ||
2307 | { | 2307 | { |
2308 | return ERR_PTR(-ENODEV); | 2308 | return ERR_PTR(-ENODEV); |
2309 | } | 2309 | } |
2310 | #endif | 2310 | #endif |
2311 | 2311 | ||
2312 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | 2312 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, |
2313 | unsigned int idx, unsigned long *flags) | 2313 | unsigned int idx, |
2314 | enum gpio_lookup_flags *flags) | ||
2314 | { | 2315 | { |
2315 | struct acpi_gpio_info info; | 2316 | struct acpi_gpio_info info; |
2316 | struct gpio_desc *desc; | 2317 | struct gpio_desc *desc; |
@@ -2320,13 +2321,14 @@ static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | |||
2320 | return desc; | 2321 | return desc; |
2321 | 2322 | ||
2322 | if (info.gpioint && info.active_low) | 2323 | if (info.gpioint && info.active_low) |
2323 | *flags |= GPIOF_ACTIVE_LOW; | 2324 | *flags |= GPIO_ACTIVE_LOW; |
2324 | 2325 | ||
2325 | return desc; | 2326 | return desc; |
2326 | } | 2327 | } |
2327 | 2328 | ||
2328 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | 2329 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, |
2329 | unsigned int idx, unsigned long *flags) | 2330 | unsigned int idx, |
2331 | enum gpio_lookup_flags *flags) | ||
2330 | { | 2332 | { |
2331 | const char *dev_id = dev ? dev_name(dev) : NULL; | 2333 | const char *dev_id = dev ? dev_name(dev) : NULL; |
2332 | struct gpio_desc *desc = ERR_PTR(-ENODEV); | 2334 | struct gpio_desc *desc = ERR_PTR(-ENODEV); |
@@ -2366,7 +2368,7 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | |||
2366 | continue; | 2368 | continue; |
2367 | } | 2369 | } |
2368 | 2370 | ||
2369 | if (chip->ngpio >= p->chip_hwnum) { | 2371 | if (chip->ngpio <= p->chip_hwnum) { |
2370 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", | 2372 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", |
2371 | chip->label, chip->ngpio); | 2373 | chip->label, chip->ngpio); |
2372 | continue; | 2374 | continue; |
@@ -2416,9 +2418,9 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2416 | const char *con_id, | 2418 | const char *con_id, |
2417 | unsigned int idx) | 2419 | unsigned int idx) |
2418 | { | 2420 | { |
2419 | struct gpio_desc *desc; | 2421 | struct gpio_desc *desc = NULL; |
2420 | int status; | 2422 | int status; |
2421 | unsigned long flags = 0; | 2423 | enum gpio_lookup_flags flags = 0; |
2422 | 2424 | ||
2423 | dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); | 2425 | dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); |
2424 | 2426 | ||
@@ -2429,13 +2431,23 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2429 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { | 2431 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { |
2430 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); | 2432 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); |
2431 | desc = acpi_find_gpio(dev, con_id, idx, &flags); | 2433 | desc = acpi_find_gpio(dev, con_id, idx, &flags); |
2432 | } else { | 2434 | } |
2435 | |||
2436 | /* | ||
2437 | * Either we are not using DT or ACPI, or their lookup did not return | ||
2438 | * a result. In that case, use platform lookup as a fallback. | ||
2439 | */ | ||
2440 | if (!desc || IS_ERR(desc)) { | ||
2441 | struct gpio_desc *pdesc; | ||
2433 | dev_dbg(dev, "using lookup tables for GPIO lookup"); | 2442 | dev_dbg(dev, "using lookup tables for GPIO lookup"); |
2434 | desc = gpiod_find(dev, con_id, idx, &flags); | 2443 | pdesc = gpiod_find(dev, con_id, idx, &flags); |
2444 | /* If used as fallback, do not replace the previous error */ | ||
2445 | if (!IS_ERR(pdesc) || !desc) | ||
2446 | desc = pdesc; | ||
2435 | } | 2447 | } |
2436 | 2448 | ||
2437 | if (IS_ERR(desc)) { | 2449 | if (IS_ERR(desc)) { |
2438 | dev_warn(dev, "lookup for GPIO %s failed\n", con_id); | 2450 | dev_dbg(dev, "lookup for GPIO %s failed\n", con_id); |
2439 | return desc; | 2451 | return desc; |
2440 | } | 2452 | } |
2441 | 2453 | ||
@@ -2444,8 +2456,12 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2444 | if (status < 0) | 2456 | if (status < 0) |
2445 | return ERR_PTR(status); | 2457 | return ERR_PTR(status); |
2446 | 2458 | ||
2447 | if (flags & GPIOF_ACTIVE_LOW) | 2459 | if (flags & GPIO_ACTIVE_LOW) |
2448 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | 2460 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); |
2461 | if (flags & GPIO_OPEN_DRAIN) | ||
2462 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); | ||
2463 | if (flags & GPIO_OPEN_SOURCE) | ||
2464 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | ||
2449 | 2465 | ||
2450 | return desc; | 2466 | return desc; |
2451 | } | 2467 | } |