aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-pxa/include/mach/palmld.h1
-rw-r--r--arch/arm/mach-pxa/palmld.c11
-rw-r--r--drivers/ata/Kconfig9
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/pata_palmld.c150
5 files changed, 170 insertions, 2 deletions
diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h
index fb13c82ad6d..8721b801022 100644
--- a/arch/arm/mach-pxa/include/mach/palmld.h
+++ b/arch/arm/mach-pxa/include/mach/palmld.h
@@ -56,7 +56,6 @@
56#define GPIO_NR_PALMLD_LED_AMBER 94 56#define GPIO_NR_PALMLD_LED_AMBER 94
57 57
58/* IDE */ 58/* IDE */
59#define GPIO_NR_PALMLD_IDE_IRQ 95
60#define GPIO_NR_PALMLD_IDE_RESET 98 59#define GPIO_NR_PALMLD_IDE_RESET 98
61#define GPIO_NR_PALMLD_IDE_PWEN 115 60#define GPIO_NR_PALMLD_IDE_PWEN 115
62 61
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 1cec1806f00..24a967e1e14 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -127,7 +127,7 @@ static unsigned long palmld_pin_config[] __initdata = {
127 GPIO81_GPIO, /* wifi reset */ 127 GPIO81_GPIO, /* wifi reset */
128 128
129 /* HDD */ 129 /* HDD */
130 GPIO95_GPIO, /* HDD irq */ 130 GPIO98_GPIO, /* HDD reset */
131 GPIO115_GPIO, /* HDD power */ 131 GPIO115_GPIO, /* HDD power */
132 132
133 /* MISC */ 133 /* MISC */
@@ -494,6 +494,14 @@ static struct platform_device palmld_asoc = {
494}; 494};
495 495
496/****************************************************************************** 496/******************************************************************************
497 * HDD
498 ******************************************************************************/
499static struct platform_device palmld_hdd = {
500 .name = "pata_palmld",
501 .id = -1,
502};
503
504/******************************************************************************
497 * Framebuffer 505 * Framebuffer
498 ******************************************************************************/ 506 ******************************************************************************/
499static struct pxafb_mode_info palmld_lcd_modes[] = { 507static struct pxafb_mode_info palmld_lcd_modes[] = {
@@ -557,6 +565,7 @@ static struct platform_device *devices[] __initdata = {
557 &palmld_leds, 565 &palmld_leds,
558 &power_supply, 566 &power_supply,
559 &palmld_asoc, 567 &palmld_asoc,
568 &palmld_hdd,
560}; 569};
561 570
562static struct map_desc palmld_io_desc[] __initdata = { 571static struct map_desc palmld_io_desc[] __initdata = {
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 9120717c070..2aa1908e5ce 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -535,6 +535,15 @@ config PATA_OPTIDMA
535 535
536 If unsure, say N. 536 If unsure, say N.
537 537
538config PATA_PALMLD
539 tristate "Palm LifeDrive PATA support"
540 depends on MACH_PALMLD
541 help
542 This option enables support for Palm LifeDrive's internal ATA
543 port via the new ATA layer.
544
545 If unsure, say N.
546
538config PATA_PCMCIA 547config PATA_PCMCIA
539 tristate "PCMCIA PATA support" 548 tristate "PCMCIA PATA support"
540 depends on PCMCIA 549 depends on PCMCIA
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 7f1ecf99528..1558059874f 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o
50obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o 50obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o
51obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o 51obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o
52obj-$(CONFIG_PATA_OLDPIIX) += pata_oldpiix.o 52obj-$(CONFIG_PATA_OLDPIIX) += pata_oldpiix.o
53obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o
53obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia.o 54obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia.o
54obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o 55obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o
55obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o 56obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
new file mode 100644
index 00000000000..11fb4ccc74b
--- /dev/null
+++ b/drivers/ata/pata_palmld.c
@@ -0,0 +1,150 @@
1/*
2 * drivers/ata/pata_palmld.c
3 *
4 * Driver for IDE channel in Palm LifeDrive
5 *
6 * Based on research of:
7 * Alex Osborne <ato@meshy.org>
8 *
9 * Rewrite for mainline:
10 * Marek Vasut <marek.vasut@gmail.com>
11 *
12 * Rewritten version based on pata_ixp4xx_cf.c:
13 * ixp4xx PATA/Compact Flash driver
14 * Copyright (C) 2006-07 Tower Technologies
15 * Author: Alessandro Zummo <a.zummo@towertech.it>
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 */
22
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/libata.h>
26#include <linux/irq.h>
27#include <linux/platform_device.h>
28#include <linux/delay.h>
29#include <linux/gpio.h>
30
31#include <scsi/scsi_host.h>
32#include <mach/palmld.h>
33
34#define DRV_NAME "pata_palmld"
35
36static struct scsi_host_template palmld_sht = {
37 ATA_PIO_SHT(DRV_NAME),
38};
39
40static struct ata_port_operations palmld_port_ops = {
41 .inherits = &ata_sff_port_ops,
42 .sff_data_xfer = ata_sff_data_xfer_noirq,
43 .cable_detect = ata_cable_40wire,
44};
45
46static __devinit int palmld_pata_probe(struct platform_device *pdev)
47{
48 struct ata_host *host;
49 struct ata_port *ap;
50 void __iomem *mem;
51 int ret;
52
53 /* allocate host */
54 host = ata_host_alloc(&pdev->dev, 1);
55 if (!host)
56 return -ENOMEM;
57
58 /* remap drive's physical memory address */
59 mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000);
60 if (!mem)
61 return -ENOMEM;
62
63 /* request and activate power GPIO, IRQ GPIO */
64 ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR");
65 if (ret)
66 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
78 /* reset the drive */
79 gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0);
80 msleep(30);
81 gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 1);
82 msleep(30);
83
84 /* setup the ata port */
85 ap = host->ports[0];
86 ap->ops = &palmld_port_ops;
87 ap->pio_mask = ATA_PIO4;
88 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_PIO_POLLING;
89
90 /* memory mapping voodoo */
91 ap->ioaddr.cmd_addr = mem + 0x10;
92 ap->ioaddr.altstatus_addr = mem + 0xe;
93 ap->ioaddr.ctl_addr = mem + 0xe;
94
95 /* start the port */
96 ata_sff_std_ports(&ap->ioaddr);
97
98 /* activate host */
99 return ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING,
100 &palmld_sht);
101
102err3:
103 gpio_free(GPIO_NR_PALMLD_IDE_RESET);
104err2:
105 gpio_free(GPIO_NR_PALMLD_IDE_PWEN);
106err1:
107 return ret;
108}
109
110static __devexit int palmld_pata_remove(struct platform_device *dev)
111{
112 struct ata_host *host = platform_get_drvdata(dev);
113
114 ata_host_detach(host);
115
116 /* power down the HDD */
117 gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0);
118
119 gpio_free(GPIO_NR_PALMLD_IDE_RESET);
120 gpio_free(GPIO_NR_PALMLD_IDE_PWEN);
121
122 return 0;
123}
124
125static struct platform_driver palmld_pata_platform_driver = {
126 .driver = {
127 .name = DRV_NAME,
128 .owner = THIS_MODULE,
129 },
130 .probe = palmld_pata_probe,
131 .remove = __devexit_p(palmld_pata_remove),
132};
133
134static int __init palmld_pata_init(void)
135{
136 return platform_driver_register(&palmld_pata_platform_driver);
137}
138
139static void __exit palmld_pata_exit(void)
140{
141 platform_driver_unregister(&palmld_pata_platform_driver);
142}
143
144MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
145MODULE_DESCRIPTION("PalmLD PATA driver");
146MODULE_LICENSE("GPL");
147MODULE_ALIAS("platform:" DRV_NAME);
148
149module_init(palmld_pata_init);
150module_exit(palmld_pata_exit);