aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-10-15 15:44:11 -0400
committerJeff Garzik <jeff@garzik.org>2008-01-23 05:24:15 -0500
commita5df2eabdae7cd7840d59cffe621b3658a3a70cb (patch)
treebe515329d418a6c4cb4e07ad44c3abba8e1e8a5b
parent0bcc65ad78ae517de16b2ca07a2891f49d44d156 (diff)
pata_pcmcia: Add support for dumb 8bit IDE emulations
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/ata/pata_pcmcia.c71
1 files changed, 70 insertions, 1 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index fd36099428a4..bbd4d70b92de 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -86,6 +86,44 @@ static int pcmcia_set_mode(struct ata_link *link, struct ata_device **r_failed_d
86 return ata_do_set_mode(link, r_failed_dev); 86 return ata_do_set_mode(link, r_failed_dev);
87} 87}
88 88
89/**
90 * pcmcia_set_mode_8bit - PCMCIA specific mode setup
91 * @link: link
92 * @r_failed_dev: Return pointer for failed device
93 *
94 * For the simple emulated 8bit stuff the less we do the better.
95 */
96
97static int pcmcia_set_mode_8bit(struct ata_link *link,
98 struct ata_device **r_failed_dev)
99{
100 return 0;
101}
102
103/**
104 * ata_data_xfer_8bit - Transfer data by 8bit PIO
105 * @adev: device to target
106 * @buf: data buffer
107 * @buflen: buffer length
108 * @write_data: read/write
109 *
110 * Transfer data from/to the device data register by 8 bit PIO.
111 *
112 * LOCKING:
113 * Inherited from caller.
114 */
115
116static void ata_data_xfer_8bit(struct ata_device *adev, unsigned char *buf,
117 unsigned int buflen, int write_data)
118{
119 struct ata_port *ap = adev->link->ap;
120 if (write_data)
121 iowrite8_rep(ap->ioaddr.data_addr, buf, buflen);
122 else
123 ioread8_rep(ap->ioaddr.data_addr, buf, buflen);
124}
125
126
89static struct scsi_host_template pcmcia_sht = { 127static struct scsi_host_template pcmcia_sht = {
90 .module = THIS_MODULE, 128 .module = THIS_MODULE,
91 .name = DRV_NAME, 129 .name = DRV_NAME,
@@ -129,12 +167,38 @@ static struct ata_port_operations pcmcia_port_ops = {
129 .port_start = ata_sff_port_start, 167 .port_start = ata_sff_port_start,
130}; 168};
131 169
170static struct ata_port_operations pcmcia_8bit_port_ops = {
171 .set_mode = pcmcia_set_mode_8bit,
172 .tf_load = ata_tf_load,
173 .tf_read = ata_tf_read,
174 .check_status = ata_check_status,
175 .exec_command = ata_exec_command,
176 .dev_select = ata_std_dev_select,
177
178 .freeze = ata_bmdma_freeze,
179 .thaw = ata_bmdma_thaw,
180 .error_handler = ata_bmdma_error_handler,
181 .post_internal_cmd = ata_bmdma_post_internal_cmd,
182 .cable_detect = ata_cable_40wire,
183
184 .qc_prep = ata_qc_prep,
185 .qc_issue = ata_qc_issue_prot,
186
187 .data_xfer = ata_data_xfer_8bit,
188
189 .irq_clear = ata_bmdma_irq_clear,
190 .irq_on = ata_irq_on,
191
192 .port_start = ata_sff_port_start,
193};
194
132#define CS_CHECK(fn, ret) \ 195#define CS_CHECK(fn, ret) \
133do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 196do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
134 197
135/** 198/**
136 * pcmcia_init_one - attach a PCMCIA interface 199 * pcmcia_init_one - attach a PCMCIA interface
137 * @pdev: pcmcia device 200 * @pdev: pcmcia device
201 * @ops: operations for this device
138 * 202 *
139 * Register a PCMCIA IDE interface. Such interfaces are PIO 0 and 203 * Register a PCMCIA IDE interface. Such interfaces are PIO 0 and
140 * shared IRQ. 204 * shared IRQ.
@@ -157,6 +221,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
157 unsigned long io_base, ctl_base; 221 unsigned long io_base, ctl_base;
158 void __iomem *io_addr, *ctl_addr; 222 void __iomem *io_addr, *ctl_addr;
159 223
224 struct ata_port_operations *ops = &pcmcia_port_ops;
225
160 info = kzalloc(sizeof(*info), GFP_KERNEL); 226 info = kzalloc(sizeof(*info), GFP_KERNEL);
161 if (info == NULL) 227 if (info == NULL)
162 return -ENOMEM; 228 return -ENOMEM;
@@ -284,6 +350,8 @@ next_entry:
284 if (pdev->io.NumPorts1 >= 0x20) 350 if (pdev->io.NumPorts1 >= 0x20)
285 printk(KERN_WARNING DRV_NAME ": second channel not yet supported.\n"); 351 printk(KERN_WARNING DRV_NAME ": second channel not yet supported.\n");
286 352
353 if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620)
354 ops = &pcmcia_8bit_port_ops;
287 /* 355 /*
288 * Having done the PCMCIA plumbing the ATA side is relatively 356 * Having done the PCMCIA plumbing the ATA side is relatively
289 * sane. 357 * sane.
@@ -294,7 +362,7 @@ next_entry:
294 goto failed; 362 goto failed;
295 ap = host->ports[0]; 363 ap = host->ports[0];
296 364
297 ap->ops = &pcmcia_port_ops; 365 ap->ops = ops;
298 ap->pio_mask = 1; /* ISA so PIO 0 cycles */ 366 ap->pio_mask = 1; /* ISA so PIO 0 cycles */
299 ap->flags |= ATA_FLAG_SLAVE_POSS; 367 ap->flags |= ATA_FLAG_SLAVE_POSS;
300 ap->ioaddr.cmd_addr = io_addr; 368 ap->ioaddr.cmd_addr = io_addr;
@@ -360,6 +428,7 @@ static struct pcmcia_device_id pcmcia_devices[] = {
360 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704), 428 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704),
361 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x2904), 429 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x2904),
362 PCMCIA_DEVICE_MANF_CARD(0x0045, 0x0401), /* SanDisk CFA */ 430 PCMCIA_DEVICE_MANF_CARD(0x0045, 0x0401), /* SanDisk CFA */
431 PCMCIA_DEVICE_MANF_CARD(0x0097, 0x1620), /* TI emulated */
363 PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */ 432 PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */
364 PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d), 433 PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d),
365 PCMCIA_DEVICE_MANF_CARD(0x00ce, 0x0000), /* Samsung */ 434 PCMCIA_DEVICE_MANF_CARD(0x00ce, 0x0000), /* Samsung */