diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-01-13 02:00:29 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-20 05:03:22 -0500 |
commit | 1dfb4a0d7615811ec4a61b0a7631c8ddc0baf335 (patch) | |
tree | e5c551306d8e6eb4bc62ea1f0c9f76e0c6fce73a /drivers/gpio | |
parent | ee65ef609aa81539ac3792df88f04bfe29a77546 (diff) |
gpio: stmpe: enforce device tree only mode
Require that device tree be used with STMPE (all platforms use this)
and enforce OF_GPIO, then delete the platform data.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/Kconfig | 1 | ||||
-rw-r--r-- | drivers/gpio/gpio-stmpe.c | 23 |
2 files changed, 4 insertions, 20 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 4187fcbc88fd..22b46567b3bb 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -644,6 +644,7 @@ config GPIO_SX150X | |||
644 | config GPIO_STMPE | 644 | config GPIO_STMPE |
645 | bool "STMPE GPIOs" | 645 | bool "STMPE GPIOs" |
646 | depends on MFD_STMPE | 646 | depends on MFD_STMPE |
647 | depends on OF_GPIO | ||
647 | select GPIOLIB_IRQCHIP | 648 | select GPIOLIB_IRQCHIP |
648 | help | 649 | help |
649 | This enables support for the GPIOs found on the STMPE I/O | 650 | This enables support for the GPIOs found on the STMPE I/O |
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 85c5b1974294..dabfb99dddef 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c | |||
@@ -30,7 +30,7 @@ struct stmpe_gpio { | |||
30 | struct stmpe *stmpe; | 30 | struct stmpe *stmpe; |
31 | struct device *dev; | 31 | struct device *dev; |
32 | struct mutex irq_lock; | 32 | struct mutex irq_lock; |
33 | unsigned norequest_mask; | 33 | u32 norequest_mask; |
34 | /* Caches of interrupt control registers for bus_lock */ | 34 | /* Caches of interrupt control registers for bus_lock */ |
35 | u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS]; | 35 | u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS]; |
36 | u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS]; | 36 | u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS]; |
@@ -340,13 +340,10 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
340 | { | 340 | { |
341 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | 341 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); |
342 | struct device_node *np = pdev->dev.of_node; | 342 | struct device_node *np = pdev->dev.of_node; |
343 | struct stmpe_gpio_platform_data *pdata; | ||
344 | struct stmpe_gpio *stmpe_gpio; | 343 | struct stmpe_gpio *stmpe_gpio; |
345 | int ret; | 344 | int ret; |
346 | int irq = 0; | 345 | int irq = 0; |
347 | 346 | ||
348 | pdata = stmpe->pdata->gpio; | ||
349 | |||
350 | irq = platform_get_irq(pdev, 0); | 347 | irq = platform_get_irq(pdev, 0); |
351 | 348 | ||
352 | stmpe_gpio = kzalloc(sizeof(struct stmpe_gpio), GFP_KERNEL); | 349 | stmpe_gpio = kzalloc(sizeof(struct stmpe_gpio), GFP_KERNEL); |
@@ -360,19 +357,14 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
360 | stmpe_gpio->chip = template_chip; | 357 | stmpe_gpio->chip = template_chip; |
361 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; | 358 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; |
362 | stmpe_gpio->chip.dev = &pdev->dev; | 359 | stmpe_gpio->chip.dev = &pdev->dev; |
363 | #ifdef CONFIG_OF | ||
364 | stmpe_gpio->chip.of_node = np; | 360 | stmpe_gpio->chip.of_node = np; |
365 | #endif | ||
366 | stmpe_gpio->chip.base = -1; | 361 | stmpe_gpio->chip.base = -1; |
367 | 362 | ||
368 | if (IS_ENABLED(CONFIG_DEBUG_FS)) | 363 | if (IS_ENABLED(CONFIG_DEBUG_FS)) |
369 | stmpe_gpio->chip.dbg_show = stmpe_dbg_show; | 364 | stmpe_gpio->chip.dbg_show = stmpe_dbg_show; |
370 | 365 | ||
371 | if (pdata) | 366 | of_property_read_u32(np, "st,norequest-mask", |
372 | stmpe_gpio->norequest_mask = pdata->norequest_mask; | 367 | &stmpe_gpio->norequest_mask); |
373 | else if (np) | ||
374 | of_property_read_u32(np, "st,norequest-mask", | ||
375 | &stmpe_gpio->norequest_mask); | ||
376 | 368 | ||
377 | if (irq < 0) | 369 | if (irq < 0) |
378 | dev_info(&pdev->dev, | 370 | dev_info(&pdev->dev, |
@@ -414,9 +406,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
414 | NULL); | 406 | NULL); |
415 | } | 407 | } |
416 | 408 | ||
417 | if (pdata && pdata->setup) | ||
418 | pdata->setup(stmpe, stmpe_gpio->chip.base); | ||
419 | |||
420 | platform_set_drvdata(pdev, stmpe_gpio); | 409 | platform_set_drvdata(pdev, stmpe_gpio); |
421 | 410 | ||
422 | return 0; | 411 | return 0; |
@@ -433,15 +422,9 @@ static int stmpe_gpio_remove(struct platform_device *pdev) | |||
433 | { | 422 | { |
434 | struct stmpe_gpio *stmpe_gpio = platform_get_drvdata(pdev); | 423 | struct stmpe_gpio *stmpe_gpio = platform_get_drvdata(pdev); |
435 | struct stmpe *stmpe = stmpe_gpio->stmpe; | 424 | struct stmpe *stmpe = stmpe_gpio->stmpe; |
436 | struct stmpe_gpio_platform_data *pdata = stmpe->pdata->gpio; | ||
437 | |||
438 | if (pdata && pdata->remove) | ||
439 | pdata->remove(stmpe, stmpe_gpio->chip.base); | ||
440 | 425 | ||
441 | gpiochip_remove(&stmpe_gpio->chip); | 426 | gpiochip_remove(&stmpe_gpio->chip); |
442 | |||
443 | stmpe_disable(stmpe, STMPE_BLOCK_GPIO); | 427 | stmpe_disable(stmpe, STMPE_BLOCK_GPIO); |
444 | |||
445 | kfree(stmpe_gpio); | 428 | kfree(stmpe_gpio); |
446 | 429 | ||
447 | return 0; | 430 | return 0; |