Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243455
b: refs/heads/master
c: 6b1e3fc
h: refs/heads/master
i:
  243453: dc28158
  243451: 6b149ed
  243447: cda7b61
  243439: c221462
  243423: 92bc7c3
  243391: f50f473
  243327: 2b791a9
  243199: c9c8f67
v: v3
  • Loading branch information
Marek Vasut authored and Eric Miao committed Mar 16, 2011
1 parent 5f8ec6c commit 52c587e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e27af7edda008d225ad542c3b6645483683a7e91
refs/heads/master: 6b1e3fca6ffb981db05688b1660a5d03d242edd4
43 changes: 22 additions & 21 deletions trunk/drivers/ata/pata_palmld.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@

#define DRV_NAME "pata_palmld"

static struct gpio palmld_hdd_gpios[] = {
{ GPIO_NR_PALMLD_IDE_PWEN, GPIOF_INIT_HIGH, "HDD Power" },
{ GPIO_NR_PALMLD_IDE_RESET, GPIOF_INIT_LOW, "HDD Reset" },
};

static struct scsi_host_template palmld_sht = {
ATA_PIO_SHT(DRV_NAME),
};
Expand All @@ -52,28 +57,23 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev)

/* allocate host */
host = ata_host_alloc(&pdev->dev, 1);
if (!host)
return -ENOMEM;
if (!host) {
ret = -ENOMEM;
goto err1;
}

/* remap drive's physical memory address */
mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000);
if (!mem)
return -ENOMEM;
if (!mem) {
ret = -ENOMEM;
goto err1;
}

/* request and activate power GPIO, IRQ GPIO */
ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR");
ret = gpio_request_array(palmld_hdd_gpios,
ARRAY_SIZE(palmld_hdd_gpios));
if (ret)
goto err1;
ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_PWEN, 1);
if (ret)
goto err2;

ret = gpio_request(GPIO_NR_PALMLD_IDE_RESET, "HDD RST");
if (ret)
goto err2;
ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_RESET, 0);
if (ret)
goto err3;

/* reset the drive */
gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0);
Expand All @@ -96,13 +96,15 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev)
ata_sff_std_ports(&ap->ioaddr);

/* activate host */
return ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING,
ret = ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING,
&palmld_sht);
if (ret)
goto err2;

return ret;

err3:
gpio_free(GPIO_NR_PALMLD_IDE_RESET);
err2:
gpio_free(GPIO_NR_PALMLD_IDE_PWEN);
gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios));
err1:
return ret;
}
Expand All @@ -116,8 +118,7 @@ static __devexit int palmld_pata_remove(struct platform_device *dev)
/* power down the HDD */
gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0);

gpio_free(GPIO_NR_PALMLD_IDE_RESET);
gpio_free(GPIO_NR_PALMLD_IDE_PWEN);
gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios));

return 0;
}
Expand Down

0 comments on commit 52c587e

Please sign in to comment.