aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_palmld.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-18 12:12:14 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-18 12:12:14 -0400
commitfac56c2df51bc29b07b3c2dcfabf32a015a0522c (patch)
tree1ff5d84ecf4ea0bcbd42e2ef9624b5ade3810890 /drivers/ata/pata_palmld.c
parent6caa15d0b84d2ea688fd31f4f172c8353463e109 (diff)
parenta6360dd37e1a144ed11e6548371bade559a1e4df (diff)
Merge commit 'v2.6.39-rc3' into for-2.6.39
Diffstat (limited to 'drivers/ata/pata_palmld.c')
-rw-r--r--drivers/ata/pata_palmld.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
index a2a73d953840..b86d7e22595e 100644
--- a/drivers/ata/pata_palmld.c
+++ b/drivers/ata/pata_palmld.c
@@ -33,6 +33,11 @@
33 33
34#define DRV_NAME "pata_palmld" 34#define DRV_NAME "pata_palmld"
35 35
36static struct gpio palmld_hdd_gpios[] = {
37 { GPIO_NR_PALMLD_IDE_PWEN, GPIOF_INIT_HIGH, "HDD Power" },
38 { GPIO_NR_PALMLD_IDE_RESET, GPIOF_INIT_LOW, "HDD Reset" },
39};
40
36static struct scsi_host_template palmld_sht = { 41static struct scsi_host_template palmld_sht = {
37 ATA_PIO_SHT(DRV_NAME), 42 ATA_PIO_SHT(DRV_NAME),
38}; 43};
@@ -52,28 +57,23 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev)
52 57
53 /* allocate host */ 58 /* allocate host */
54 host = ata_host_alloc(&pdev->dev, 1); 59 host = ata_host_alloc(&pdev->dev, 1);
55 if (!host) 60 if (!host) {
56 return -ENOMEM; 61 ret = -ENOMEM;
62 goto err1;
63 }
57 64
58 /* remap drive's physical memory address */ 65 /* remap drive's physical memory address */
59 mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000); 66 mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000);
60 if (!mem) 67 if (!mem) {
61 return -ENOMEM; 68 ret = -ENOMEM;
69 goto err1;
70 }
62 71
63 /* request and activate power GPIO, IRQ GPIO */ 72 /* request and activate power GPIO, IRQ GPIO */
64 ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR"); 73 ret = gpio_request_array(palmld_hdd_gpios,
74 ARRAY_SIZE(palmld_hdd_gpios));
65 if (ret) 75 if (ret)
66 goto err1; 76 goto err1;
67 ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_PWEN, 1);
68 if (ret)
69 goto err2;
70
71 ret = gpio_request(GPIO_NR_PALMLD_IDE_RESET, "HDD RST");
72 if (ret)
73 goto err2;
74 ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_RESET, 0);
75 if (ret)
76 goto err3;
77 77
78 /* reset the drive */ 78 /* reset the drive */
79 gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0); 79 gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0);
@@ -96,13 +96,15 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev)
96 ata_sff_std_ports(&ap->ioaddr); 96 ata_sff_std_ports(&ap->ioaddr);
97 97
98 /* activate host */ 98 /* activate host */
99 return ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, 99 ret = ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING,
100 &palmld_sht); 100 &palmld_sht);
101 if (ret)
102 goto err2;
103
104 return ret;
101 105
102err3:
103 gpio_free(GPIO_NR_PALMLD_IDE_RESET);
104err2: 106err2:
105 gpio_free(GPIO_NR_PALMLD_IDE_PWEN); 107 gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios));
106err1: 108err1:
107 return ret; 109 return ret;
108} 110}
@@ -116,8 +118,7 @@ static __devexit int palmld_pata_remove(struct platform_device *dev)
116 /* power down the HDD */ 118 /* power down the HDD */
117 gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); 119 gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0);
118 120
119 gpio_free(GPIO_NR_PALMLD_IDE_RESET); 121 gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios));
120 gpio_free(GPIO_NR_PALMLD_IDE_PWEN);
121 122
122 return 0; 123 return 0;
123} 124}