diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-28 17:06:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-28 17:06:43 -0500 |
commit | fe2b0cdabcd9e6aeca66a104bc03576946e5fee2 (patch) | |
tree | 3abffb169919155a4039188f7262c9fd9c64457d | |
parent | 956eb6cb36765e3a79a744e6c9364dab1548e460 (diff) | |
parent | 9f83cfdb1ace3ef268ecc6fda50058d2ec37d603 (diff) |
Merge tag 'for-4.21/libata-20181221' of git://git.kernel.dk/linux-block
Pull libata updates from Jens Axboe:
"Here are the libata changes for this merge window. Nothing major in
here. This contains:
- GPIO descriptor conversions (Linus Walleij)
- rcar deferred probing fix (Sergei Shtylyov)"
* tag 'for-4.21/libata-20181221' of git://git.kernel.dk/linux-block:
sata_rcar: fix deferred probing
ata: palmld: Introduce state container
ata: palmld: Convert to GPIO descriptors
ata: rb532_cf: Convert to use GPIO descriptors
ata: sata_highbank: Convert to use GPIO descriptors
ata: pxa: Drop <linux/gpio.h> include
-rw-r--r-- | arch/arm/mach-pxa/palm27x.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmld.c | 12 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-rc32434/rb.h | 6 | ||||
-rw-r--r-- | arch/mips/rb532/devices.c | 12 | ||||
-rw-r--r-- | drivers/ata/pata_palmld.c | 83 | ||||
-rw-r--r-- | drivers/ata/pata_pxa.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_rb532_cf.c | 45 | ||||
-rw-r--r-- | drivers/ata/sata_highbank.c | 37 | ||||
-rw-r--r-- | drivers/ata/sata_rcar.c | 4 |
9 files changed, 97 insertions, 105 deletions
diff --git a/arch/arm/mach-pxa/palm27x.h b/arch/arm/mach-pxa/palm27x.h index d4eac3d6ffb5..3316ed2016f3 100644 --- a/arch/arm/mach-pxa/palm27x.h +++ b/arch/arm/mach-pxa/palm27x.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #ifndef __INCLUDE_MACH_PALM27X__ | 12 | #ifndef __INCLUDE_MACH_PALM27X__ |
13 | #define __INCLUDE_MACH_PALM27X__ | 13 | #define __INCLUDE_MACH_PALM27X__ |
14 | 14 | ||
15 | #include <linux/gpio/machine.h> | ||
16 | |||
15 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | 17 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
16 | extern void __init palm27x_mmc_init(int detect, int ro, int power, | 18 | extern void __init palm27x_mmc_init(int detect, int ro, int power, |
17 | int power_inverted); | 19 | int power_inverted); |
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 980f2847f5b5..a37ceec22903 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c | |||
@@ -288,8 +288,20 @@ static struct platform_device palmld_ide_device = { | |||
288 | .id = -1, | 288 | .id = -1, |
289 | }; | 289 | }; |
290 | 290 | ||
291 | static struct gpiod_lookup_table palmld_ide_gpio_table = { | ||
292 | .dev_id = "pata_palmld", | ||
293 | .table = { | ||
294 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_PWEN, | ||
295 | "power", GPIO_ACTIVE_HIGH), | ||
296 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_RESET, | ||
297 | "reset", GPIO_ACTIVE_LOW), | ||
298 | { }, | ||
299 | }, | ||
300 | }; | ||
301 | |||
291 | static void __init palmld_ide_init(void) | 302 | static void __init palmld_ide_init(void) |
292 | { | 303 | { |
304 | gpiod_add_lookup_table(&palmld_ide_gpio_table); | ||
293 | platform_device_register(&palmld_ide_device); | 305 | platform_device_register(&palmld_ide_device); |
294 | } | 306 | } |
295 | #else | 307 | #else |
diff --git a/arch/mips/include/asm/mach-rc32434/rb.h b/arch/mips/include/asm/mach-rc32434/rb.h index aac8ce8902e7..5dfd4d66d6fc 100644 --- a/arch/mips/include/asm/mach-rc32434/rb.h +++ b/arch/mips/include/asm/mach-rc32434/rb.h | |||
@@ -71,12 +71,6 @@ struct korina_device { | |||
71 | struct net_device *dev; | 71 | struct net_device *dev; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | struct cf_device { | ||
75 | int gpio_pin; | ||
76 | void *dev; | ||
77 | struct gendisk *gd; | ||
78 | }; | ||
79 | |||
80 | struct mpmc_device { | 74 | struct mpmc_device { |
81 | unsigned char state; | 75 | unsigned char state; |
82 | spinlock_t lock; | 76 | spinlock_t lock; |
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c index 2b23ad640f39..828d8cc3a5df 100644 --- a/arch/mips/rb532/devices.c +++ b/arch/mips/rb532/devices.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mtd/platnand.h> | 23 | #include <linux/mtd/platnand.h> |
24 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <linux/gpio/machine.h> | ||
26 | #include <linux/gpio_keys.h> | 27 | #include <linux/gpio_keys.h> |
27 | #include <linux/input.h> | 28 | #include <linux/input.h> |
28 | #include <linux/serial_8250.h> | 29 | #include <linux/serial_8250.h> |
@@ -127,14 +128,18 @@ static struct resource cf_slot0_res[] = { | |||
127 | } | 128 | } |
128 | }; | 129 | }; |
129 | 130 | ||
130 | static struct cf_device cf_slot0_data = { | 131 | static struct gpiod_lookup_table cf_slot0_gpio_table = { |
131 | .gpio_pin = CF_GPIO_NUM | 132 | .dev_id = "pata-rb532-cf", |
133 | .table = { | ||
134 | GPIO_LOOKUP("gpio0", CF_GPIO_NUM, | ||
135 | NULL, GPIO_ACTIVE_HIGH), | ||
136 | { }, | ||
137 | }, | ||
132 | }; | 138 | }; |
133 | 139 | ||
134 | static struct platform_device cf_slot0 = { | 140 | static struct platform_device cf_slot0 = { |
135 | .id = -1, | 141 | .id = -1, |
136 | .name = "pata-rb532-cf", | 142 | .name = "pata-rb532-cf", |
137 | .dev.platform_data = &cf_slot0_data, | ||
138 | .resource = cf_slot0_res, | 143 | .resource = cf_slot0_res, |
139 | .num_resources = ARRAY_SIZE(cf_slot0_res), | 144 | .num_resources = ARRAY_SIZE(cf_slot0_res), |
140 | }; | 145 | }; |
@@ -305,6 +310,7 @@ static int __init plat_setup_devices(void) | |||
305 | 310 | ||
306 | dev_set_drvdata(&korina_dev0.dev, &korina_dev0_data); | 311 | dev_set_drvdata(&korina_dev0.dev, &korina_dev0_data); |
307 | 312 | ||
313 | gpiod_add_lookup_table(&cf_slot0_gpio_table); | ||
308 | return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); | 314 | return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); |
309 | } | 315 | } |
310 | 316 | ||
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c index d071ab6864a8..26817fd91700 100644 --- a/drivers/ata/pata_palmld.c +++ b/drivers/ata/pata_palmld.c | |||
@@ -26,16 +26,17 @@ | |||
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/gpio.h> | 29 | #include <linux/gpio/consumer.h> |
30 | 30 | ||
31 | #include <scsi/scsi_host.h> | 31 | #include <scsi/scsi_host.h> |
32 | #include <mach/palmld.h> | 32 | #include <mach/palmld.h> |
33 | 33 | ||
34 | #define DRV_NAME "pata_palmld" | 34 | #define DRV_NAME "pata_palmld" |
35 | 35 | ||
36 | static struct gpio palmld_hdd_gpios[] = { | 36 | struct palmld_pata { |
37 | { GPIO_NR_PALMLD_IDE_PWEN, GPIOF_INIT_HIGH, "HDD Power" }, | 37 | struct ata_host *host; |
38 | { GPIO_NR_PALMLD_IDE_RESET, GPIOF_INIT_LOW, "HDD Reset" }, | 38 | struct gpio_desc *power; |
39 | struct gpio_desc *reset; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | static struct scsi_host_template palmld_sht = { | 42 | static struct scsi_host_template palmld_sht = { |
@@ -50,39 +51,44 @@ static struct ata_port_operations palmld_port_ops = { | |||
50 | 51 | ||
51 | static int palmld_pata_probe(struct platform_device *pdev) | 52 | static int palmld_pata_probe(struct platform_device *pdev) |
52 | { | 53 | { |
53 | struct ata_host *host; | 54 | struct palmld_pata *lda; |
54 | struct ata_port *ap; | 55 | struct ata_port *ap; |
55 | void __iomem *mem; | 56 | void __iomem *mem; |
57 | struct device *dev = &pdev->dev; | ||
56 | int ret; | 58 | int ret; |
57 | 59 | ||
60 | lda = devm_kzalloc(dev, sizeof(*lda), GFP_KERNEL); | ||
61 | if (!lda) | ||
62 | return -ENOMEM; | ||
63 | |||
58 | /* allocate host */ | 64 | /* allocate host */ |
59 | host = ata_host_alloc(&pdev->dev, 1); | 65 | lda->host = ata_host_alloc(dev, 1); |
60 | if (!host) { | 66 | if (!lda->host) |
61 | ret = -ENOMEM; | 67 | return -ENOMEM; |
62 | goto err1; | ||
63 | } | ||
64 | 68 | ||
65 | /* remap drive's physical memory address */ | 69 | /* remap drive's physical memory address */ |
66 | mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000); | 70 | mem = devm_ioremap(dev, PALMLD_IDE_PHYS, 0x1000); |
67 | if (!mem) { | 71 | if (!mem) |
68 | ret = -ENOMEM; | 72 | return -ENOMEM; |
69 | goto err1; | 73 | |
74 | /* request and activate power and reset GPIOs */ | ||
75 | lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH); | ||
76 | if (IS_ERR(lda->power)) | ||
77 | return PTR_ERR(lda->power); | ||
78 | lda->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); | ||
79 | if (IS_ERR(lda->reset)) { | ||
80 | gpiod_set_value(lda->power, 0); | ||
81 | return PTR_ERR(lda->reset); | ||
70 | } | 82 | } |
71 | 83 | ||
72 | /* request and activate power GPIO, IRQ GPIO */ | 84 | /* Assert reset to reset the drive */ |
73 | ret = gpio_request_array(palmld_hdd_gpios, | 85 | gpiod_set_value(lda->reset, 1); |
74 | ARRAY_SIZE(palmld_hdd_gpios)); | ||
75 | if (ret) | ||
76 | goto err1; | ||
77 | |||
78 | /* reset the drive */ | ||
79 | gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0); | ||
80 | msleep(30); | 86 | msleep(30); |
81 | gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 1); | 87 | gpiod_set_value(lda->reset, 0); |
82 | msleep(30); | 88 | msleep(30); |
83 | 89 | ||
84 | /* setup the ata port */ | 90 | /* setup the ata port */ |
85 | ap = host->ports[0]; | 91 | ap = lda->host->ports[0]; |
86 | ap->ops = &palmld_port_ops; | 92 | ap->ops = &palmld_port_ops; |
87 | ap->pio_mask = ATA_PIO4; | 93 | ap->pio_mask = ATA_PIO4; |
88 | ap->flags |= ATA_FLAG_PIO_POLLING; | 94 | ap->flags |= ATA_FLAG_PIO_POLLING; |
@@ -96,27 +102,26 @@ static int palmld_pata_probe(struct platform_device *pdev) | |||
96 | ata_sff_std_ports(&ap->ioaddr); | 102 | ata_sff_std_ports(&ap->ioaddr); |
97 | 103 | ||
98 | /* activate host */ | 104 | /* activate host */ |
99 | ret = ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, | 105 | ret = ata_host_activate(lda->host, 0, NULL, IRQF_TRIGGER_RISING, |
100 | &palmld_sht); | 106 | &palmld_sht); |
101 | if (ret) | 107 | /* power down on failure */ |
102 | goto err2; | 108 | if (ret) { |
103 | 109 | gpiod_set_value(lda->power, 0); | |
104 | return ret; | 110 | return ret; |
111 | } | ||
105 | 112 | ||
106 | err2: | 113 | platform_set_drvdata(pdev, lda); |
107 | gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios)); | 114 | return 0; |
108 | err1: | ||
109 | return ret; | ||
110 | } | 115 | } |
111 | 116 | ||
112 | static int palmld_pata_remove(struct platform_device *dev) | 117 | static int palmld_pata_remove(struct platform_device *pdev) |
113 | { | 118 | { |
114 | ata_platform_remove_one(dev); | 119 | struct palmld_pata *lda = platform_get_drvdata(pdev); |
115 | 120 | ||
116 | /* power down the HDD */ | 121 | ata_platform_remove_one(pdev); |
117 | gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); | ||
118 | 122 | ||
119 | gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios)); | 123 | /* power down the HDD */ |
124 | gpiod_set_value(lda->power, 0); | ||
120 | 125 | ||
121 | return 0; | 126 | return 0; |
122 | } | 127 | } |
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c index e8b6a2e464c9..4b9b9e120188 100644 --- a/drivers/ata/pata_pxa.c +++ b/drivers/ata/pata_pxa.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/dmaengine.h> | 27 | #include <linux/dmaengine.h> |
28 | #include <linux/gpio.h> | ||
29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
30 | #include <linux/completion.h> | 29 | #include <linux/completion.h> |
31 | 30 | ||
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c index 653b9a0bf727..66bb5bff126b 100644 --- a/drivers/ata/pata_rb532_cf.c +++ b/drivers/ata/pata_rb532_cf.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/irq.h> | 29 | #include <linux/irq.h> |
30 | #include <linux/gpio.h> | 30 | #include <linux/gpio/consumer.h> |
31 | 31 | ||
32 | #include <linux/libata.h> | 32 | #include <linux/libata.h> |
33 | #include <scsi/scsi_host.h> | 33 | #include <scsi/scsi_host.h> |
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | struct rb532_cf_info { | 50 | struct rb532_cf_info { |
51 | void __iomem *iobase; | 51 | void __iomem *iobase; |
52 | unsigned int gpio_line; | 52 | struct gpio_desc *gpio_line; |
53 | unsigned int irq; | 53 | unsigned int irq; |
54 | }; | 54 | }; |
55 | 55 | ||
@@ -60,7 +60,7 @@ static irqreturn_t rb532_pata_irq_handler(int irq, void *dev_instance) | |||
60 | struct ata_host *ah = dev_instance; | 60 | struct ata_host *ah = dev_instance; |
61 | struct rb532_cf_info *info = ah->private_data; | 61 | struct rb532_cf_info *info = ah->private_data; |
62 | 62 | ||
63 | if (gpio_get_value(info->gpio_line)) { | 63 | if (gpiod_get_value(info->gpio_line)) { |
64 | irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); | 64 | irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); |
65 | ata_sff_interrupt(info->irq, dev_instance); | 65 | ata_sff_interrupt(info->irq, dev_instance); |
66 | } else { | 66 | } else { |
@@ -106,10 +106,9 @@ static void rb532_pata_setup_ports(struct ata_host *ah) | |||
106 | static int rb532_pata_driver_probe(struct platform_device *pdev) | 106 | static int rb532_pata_driver_probe(struct platform_device *pdev) |
107 | { | 107 | { |
108 | int irq; | 108 | int irq; |
109 | int gpio; | 109 | struct gpio_desc *gpiod; |
110 | struct resource *res; | 110 | struct resource *res; |
111 | struct ata_host *ah; | 111 | struct ata_host *ah; |
112 | struct cf_device *pdata; | ||
113 | struct rb532_cf_info *info; | 112 | struct rb532_cf_info *info; |
114 | int ret; | 113 | int ret; |
115 | 114 | ||
@@ -125,23 +124,12 @@ static int rb532_pata_driver_probe(struct platform_device *pdev) | |||
125 | return -ENOENT; | 124 | return -ENOENT; |
126 | } | 125 | } |
127 | 126 | ||
128 | pdata = dev_get_platdata(&pdev->dev); | 127 | gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_IN); |
129 | if (!pdata) { | 128 | if (IS_ERR(gpiod)) { |
130 | dev_err(&pdev->dev, "no platform data specified\n"); | ||
131 | return -EINVAL; | ||
132 | } | ||
133 | |||
134 | gpio = pdata->gpio_pin; | ||
135 | if (gpio < 0) { | ||
136 | dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq); | 129 | dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq); |
137 | return -ENOENT; | 130 | return PTR_ERR(gpiod); |
138 | } | ||
139 | |||
140 | ret = gpio_request(gpio, DRV_NAME); | ||
141 | if (ret) { | ||
142 | dev_err(&pdev->dev, "GPIO request failed\n"); | ||
143 | return ret; | ||
144 | } | 131 | } |
132 | gpiod_set_consumer_name(gpiod, DRV_NAME); | ||
145 | 133 | ||
146 | /* allocate host */ | 134 | /* allocate host */ |
147 | ah = ata_host_alloc(&pdev->dev, RB500_CF_MAXPORTS); | 135 | ah = ata_host_alloc(&pdev->dev, RB500_CF_MAXPORTS); |
@@ -153,7 +141,7 @@ static int rb532_pata_driver_probe(struct platform_device *pdev) | |||
153 | return -ENOMEM; | 141 | return -ENOMEM; |
154 | 142 | ||
155 | ah->private_data = info; | 143 | ah->private_data = info; |
156 | info->gpio_line = gpio; | 144 | info->gpio_line = gpiod; |
157 | info->irq = irq; | 145 | info->irq = irq; |
158 | 146 | ||
159 | info->iobase = devm_ioremap_nocache(&pdev->dev, res->start, | 147 | info->iobase = devm_ioremap_nocache(&pdev->dev, res->start, |
@@ -161,26 +149,14 @@ static int rb532_pata_driver_probe(struct platform_device *pdev) | |||
161 | if (!info->iobase) | 149 | if (!info->iobase) |
162 | return -ENOMEM; | 150 | return -ENOMEM; |
163 | 151 | ||
164 | ret = gpio_direction_input(gpio); | ||
165 | if (ret) { | ||
166 | dev_err(&pdev->dev, "unable to set GPIO direction, err=%d\n", | ||
167 | ret); | ||
168 | goto err_free_gpio; | ||
169 | } | ||
170 | |||
171 | rb532_pata_setup_ports(ah); | 152 | rb532_pata_setup_ports(ah); |
172 | 153 | ||
173 | ret = ata_host_activate(ah, irq, rb532_pata_irq_handler, | 154 | ret = ata_host_activate(ah, irq, rb532_pata_irq_handler, |
174 | IRQF_TRIGGER_LOW, &rb532_pata_sht); | 155 | IRQF_TRIGGER_LOW, &rb532_pata_sht); |
175 | if (ret) | 156 | if (ret) |
176 | goto err_free_gpio; | 157 | return ret; |
177 | 158 | ||
178 | return 0; | 159 | return 0; |
179 | |||
180 | err_free_gpio: | ||
181 | gpio_free(gpio); | ||
182 | |||
183 | return ret; | ||
184 | } | 160 | } |
185 | 161 | ||
186 | static int rb532_pata_driver_remove(struct platform_device *pdev) | 162 | static int rb532_pata_driver_remove(struct platform_device *pdev) |
@@ -189,7 +165,6 @@ static int rb532_pata_driver_remove(struct platform_device *pdev) | |||
189 | struct rb532_cf_info *info = ah->private_data; | 165 | struct rb532_cf_info *info = ah->private_data; |
190 | 166 | ||
191 | ata_host_detach(ah); | 167 | ata_host_detach(ah); |
192 | gpio_free(info->gpio_line); | ||
193 | 168 | ||
194 | return 0; | 169 | return 0; |
195 | } | 170 | } |
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c index e67815b896fc..c8fc9280d6e4 100644 --- a/drivers/ata/sata_highbank.c +++ b/drivers/ata/sata_highbank.c | |||
@@ -31,8 +31,7 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/export.h> | 33 | #include <linux/export.h> |
34 | #include <linux/gpio.h> | 34 | #include <linux/gpio/consumer.h> |
35 | #include <linux/of_gpio.h> | ||
36 | 35 | ||
37 | #include "ahci.h" | 36 | #include "ahci.h" |
38 | 37 | ||
@@ -85,7 +84,7 @@ struct ecx_plat_data { | |||
85 | /* number of extra clocks that the SGPIO PIC controller expects */ | 84 | /* number of extra clocks that the SGPIO PIC controller expects */ |
86 | u32 pre_clocks; | 85 | u32 pre_clocks; |
87 | u32 post_clocks; | 86 | u32 post_clocks; |
88 | unsigned sgpio_gpio[SGPIO_PINS]; | 87 | struct gpio_desc *sgpio_gpiod[SGPIO_PINS]; |
89 | u32 sgpio_pattern; | 88 | u32 sgpio_pattern; |
90 | u32 port_to_sgpio[SGPIO_PORTS]; | 89 | u32 port_to_sgpio[SGPIO_PORTS]; |
91 | }; | 90 | }; |
@@ -131,9 +130,9 @@ static void ecx_parse_sgpio(struct ecx_plat_data *pdata, u32 port, u32 state) | |||
131 | */ | 130 | */ |
132 | static void ecx_led_cycle_clock(struct ecx_plat_data *pdata) | 131 | static void ecx_led_cycle_clock(struct ecx_plat_data *pdata) |
133 | { | 132 | { |
134 | gpio_set_value(pdata->sgpio_gpio[SCLOCK], 1); | 133 | gpiod_set_value(pdata->sgpio_gpiod[SCLOCK], 1); |
135 | udelay(50); | 134 | udelay(50); |
136 | gpio_set_value(pdata->sgpio_gpio[SCLOCK], 0); | 135 | gpiod_set_value(pdata->sgpio_gpiod[SCLOCK], 0); |
137 | udelay(50); | 136 | udelay(50); |
138 | } | 137 | } |
139 | 138 | ||
@@ -164,15 +163,15 @@ static ssize_t ecx_transmit_led_message(struct ata_port *ap, u32 state, | |||
164 | for (i = 0; i < pdata->pre_clocks; i++) | 163 | for (i = 0; i < pdata->pre_clocks; i++) |
165 | ecx_led_cycle_clock(pdata); | 164 | ecx_led_cycle_clock(pdata); |
166 | 165 | ||
167 | gpio_set_value(pdata->sgpio_gpio[SLOAD], 1); | 166 | gpiod_set_value(pdata->sgpio_gpiod[SLOAD], 1); |
168 | ecx_led_cycle_clock(pdata); | 167 | ecx_led_cycle_clock(pdata); |
169 | gpio_set_value(pdata->sgpio_gpio[SLOAD], 0); | 168 | gpiod_set_value(pdata->sgpio_gpiod[SLOAD], 0); |
170 | /* | 169 | /* |
171 | * bit-bang out the SGPIO pattern, by consuming a bit and then | 170 | * bit-bang out the SGPIO pattern, by consuming a bit and then |
172 | * clocking it out. | 171 | * clocking it out. |
173 | */ | 172 | */ |
174 | for (i = 0; i < (SGPIO_SIGNALS * pdata->n_ports); i++) { | 173 | for (i = 0; i < (SGPIO_SIGNALS * pdata->n_ports); i++) { |
175 | gpio_set_value(pdata->sgpio_gpio[SDATA], sgpio_out & 1); | 174 | gpiod_set_value(pdata->sgpio_gpiod[SDATA], sgpio_out & 1); |
176 | sgpio_out >>= 1; | 175 | sgpio_out >>= 1; |
177 | ecx_led_cycle_clock(pdata); | 176 | ecx_led_cycle_clock(pdata); |
178 | } | 177 | } |
@@ -193,21 +192,19 @@ static void highbank_set_em_messages(struct device *dev, | |||
193 | struct device_node *np = dev->of_node; | 192 | struct device_node *np = dev->of_node; |
194 | struct ecx_plat_data *pdata = hpriv->plat_data; | 193 | struct ecx_plat_data *pdata = hpriv->plat_data; |
195 | int i; | 194 | int i; |
196 | int err; | ||
197 | 195 | ||
198 | for (i = 0; i < SGPIO_PINS; i++) { | 196 | for (i = 0; i < SGPIO_PINS; i++) { |
199 | err = of_get_named_gpio(np, "calxeda,sgpio-gpio", i); | 197 | struct gpio_desc *gpiod; |
200 | if (err < 0) | 198 | |
201 | return; | 199 | gpiod = devm_gpiod_get_index(dev, "calxeda,sgpio", i, |
202 | 200 | GPIOD_OUT_HIGH); | |
203 | pdata->sgpio_gpio[i] = err; | 201 | if (IS_ERR(gpiod)) { |
204 | err = gpio_request(pdata->sgpio_gpio[i], "CX SGPIO"); | 202 | dev_err(dev, "failed to get GPIO %d\n", i); |
205 | if (err) { | 203 | continue; |
206 | pr_err("sata_highbank gpio_request %d failed: %d\n", | ||
207 | i, err); | ||
208 | return; | ||
209 | } | 204 | } |
210 | gpio_direction_output(pdata->sgpio_gpio[i], 1); | 205 | gpiod_set_consumer_name(gpiod, "CX SGPIO"); |
206 | |||
207 | pdata->sgpio_gpiod[i] = gpiod; | ||
211 | } | 208 | } |
212 | of_property_read_u32_array(np, "calxeda,led-order", | 209 | of_property_read_u32_array(np, "calxeda,led-order", |
213 | pdata->port_to_sgpio, | 210 | pdata->port_to_sgpio, |
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 4b1ff5bc256a..59b2317acea9 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c | |||
@@ -891,7 +891,9 @@ static int sata_rcar_probe(struct platform_device *pdev) | |||
891 | int ret = 0; | 891 | int ret = 0; |
892 | 892 | ||
893 | irq = platform_get_irq(pdev, 0); | 893 | irq = platform_get_irq(pdev, 0); |
894 | if (irq <= 0) | 894 | if (irq < 0) |
895 | return irq; | ||
896 | if (!irq) | ||
895 | return -EINVAL; | 897 | return -EINVAL; |
896 | 898 | ||
897 | priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL); | 899 | priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL); |