| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From c4e04f1c54928a49b227a5420d38b18226838775 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jonas Gorski <jogo@openwrt.org> |
| 3 | Date: Wed, 25 Mar 2015 13:54:56 +0100 |
| 4 | Subject: [PATCH 2/2] pcmcia: bcm63xx_pmcia: use the new named gpio |
| 5 | |
| 6 | Use the new named gpio instead of relying on the hardware gpio numbers |
| 7 | matching the virtual gpio numbers. |
| 8 | |
| 9 | Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
| 10 | --- |
| 11 | drivers/pcmcia/bcm63xx_pcmcia.c | 9 ++++++++- |
| 12 | drivers/pcmcia/bcm63xx_pcmcia.h | 4 ++++ |
| 13 | 2 files changed, 12 insertions(+), 1 deletion(-) |
| 14 | |
| 15 | --- a/drivers/pcmcia/bcm63xx_pcmcia.c |
| 16 | +++ b/drivers/pcmcia/bcm63xx_pcmcia.c |
| 17 | @@ -237,7 +237,7 @@ static unsigned int __get_socket_status( |
| 18 | stat |= SS_XVCARD; |
| 19 | stat |= SS_POWERON; |
| 20 | |
| 21 | - if (gpio_get_value(skt->pd->ready_gpio)) |
| 22 | + if (gpiod_get_value(skt->ready_gpio)) |
| 23 | stat |= SS_READY; |
| 24 | |
| 25 | return stat; |
| 26 | @@ -373,6 +373,13 @@ static int bcm63xx_drv_pcmcia_probe(stru |
| 27 | goto err; |
| 28 | } |
| 29 | |
| 30 | + /* get ready gpio */ |
| 31 | + skt->ready_gpio = devm_gpiod_get(&pdev->dev, "ready", GPIOD_IN); |
| 32 | + if (IS_ERR(skt->ready_gpio)) { |
| 33 | + ret = PTR_ERR(skt->ready_gpio); |
| 34 | + goto err; |
| 35 | + } |
| 36 | + |
| 37 | /* resources are static */ |
| 38 | sock->resource_ops = &pccard_static_ops; |
| 39 | sock->ops = &bcm63xx_pcmcia_operations; |
| 40 | --- a/drivers/pcmcia/bcm63xx_pcmcia.h |
| 41 | +++ b/drivers/pcmcia/bcm63xx_pcmcia.h |
| 42 | @@ -4,6 +4,7 @@ |
| 43 | |
| 44 | #include <linux/types.h> |
| 45 | #include <linux/timer.h> |
| 46 | +#include <linux/gpio/consumer.h> |
| 47 | #include <pcmcia/ss.h> |
| 48 | #include <bcm63xx_dev_pcmcia.h> |
| 49 | |
| 50 | @@ -56,6 +57,9 @@ struct bcm63xx_pcmcia_socket { |
| 51 | |
| 52 | /* base address of io memory */ |
| 53 | void __iomem *io_base; |
| 54 | + |
| 55 | + /* ready gpio */ |
| 56 | + struct gpio_desc *ready_gpio; |
| 57 | }; |
| 58 | |
| 59 | #endif /* BCM63XX_PCMCIA_H_ */ |