aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-03-03 02:57:59 -0500
committerDavid S. Miller <davem@davemloft.net>2010-03-03 02:57:59 -0500
commit950f564b707ca1b1c5bb94cd1e7d2a0702bfcadc (patch)
tree290cc32af2f8cfd232c57d491733592aed4dbf88 /drivers/ide
parentb1681c56f5b6bf551bed2617a395855055836571 (diff)
parent8495fb1b8d016657133c01a2f258c5f192d2a1b7 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/ide-2.6
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/cmd640.c2
-rw-r--r--drivers/ide/icside.c64
-rw-r--r--drivers/ide/ide-cs.c23
-rw-r--r--drivers/ide/pdc202xx_old.c4
-rw-r--r--drivers/ide/scc_pata.c12
5 files changed, 79 insertions, 26 deletions
diff --git a/drivers/ide/cmd640.c b/drivers/ide/cmd640.c
index c7d46a3d347a..d2b8b272bc27 100644
--- a/drivers/ide/cmd640.c
+++ b/drivers/ide/cmd640.c
@@ -606,7 +606,7 @@ static void cmd640_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
606} 606}
607#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 607#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
608 608
609static void cmd640_init_dev(ide_drive_t *drive) 609static void __init cmd640_init_dev(ide_drive_t *drive)
610{ 610{
611 unsigned int i = drive->hwif->channel * 2 + (drive->dn & 1); 611 unsigned int i = drive->hwif->channel * 2 + (drive->dn & 1);
612 612
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c
index 26b6c0a1f772..4a697a238e28 100644
--- a/drivers/ide/icside.c
+++ b/drivers/ide/icside.c
@@ -65,6 +65,8 @@ static struct cardinfo icside_cardinfo_v6_2 = {
65}; 65};
66 66
67struct icside_state { 67struct icside_state {
68 unsigned int channel;
69 unsigned int enabled;
68 void __iomem *irq_port; 70 void __iomem *irq_port;
69 void __iomem *ioc_base; 71 void __iomem *ioc_base;
70 unsigned int sel; 72 unsigned int sel;
@@ -114,11 +116,18 @@ static void icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr)
114 struct icside_state *state = ec->irq_data; 116 struct icside_state *state = ec->irq_data;
115 void __iomem *base = state->irq_port; 117 void __iomem *base = state->irq_port;
116 118
117 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1); 119 state->enabled = 1;
118 readb(base + ICS_ARCIN_V6_INTROFFSET_2);
119 120
120 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2); 121 switch (state->channel) {
121 readb(base + ICS_ARCIN_V6_INTROFFSET_1); 122 case 0:
123 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1);
124 readb(base + ICS_ARCIN_V6_INTROFFSET_2);
125 break;
126 case 1:
127 writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2);
128 readb(base + ICS_ARCIN_V6_INTROFFSET_1);
129 break;
130 }
122} 131}
123 132
124/* Prototype: icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr) 133/* Prototype: icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
@@ -128,6 +137,8 @@ static void icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
128{ 137{
129 struct icside_state *state = ec->irq_data; 138 struct icside_state *state = ec->irq_data;
130 139
140 state->enabled = 0;
141
131 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1); 142 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
132 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2); 143 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
133} 144}
@@ -149,6 +160,44 @@ static const expansioncard_ops_t icside_ops_arcin_v6 = {
149 .irqpending = icside_irqpending_arcin_v6, 160 .irqpending = icside_irqpending_arcin_v6,
150}; 161};
151 162
163/*
164 * Handle routing of interrupts. This is called before
165 * we write the command to the drive.
166 */
167static void icside_maskproc(ide_drive_t *drive, int mask)
168{
169 ide_hwif_t *hwif = drive->hwif;
170 struct expansion_card *ec = ECARD_DEV(hwif->dev);
171 struct icside_state *state = ecard_get_drvdata(ec);
172 unsigned long flags;
173
174 local_irq_save(flags);
175
176 state->channel = hwif->channel;
177
178 if (state->enabled && !mask) {
179 switch (hwif->channel) {
180 case 0:
181 writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
182 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
183 break;
184 case 1:
185 writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
186 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
187 break;
188 }
189 } else {
190 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
191 readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
192 }
193
194 local_irq_restore(flags);
195}
196
197static const struct ide_port_ops icside_v6_no_dma_port_ops = {
198 .maskproc = icside_maskproc,
199};
200
152#ifdef CONFIG_BLK_DEV_IDEDMA_ICS 201#ifdef CONFIG_BLK_DEV_IDEDMA_ICS
153/* 202/*
154 * SG-DMA support. 203 * SG-DMA support.
@@ -229,6 +278,7 @@ static void icside_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
229 278
230static const struct ide_port_ops icside_v6_port_ops = { 279static const struct ide_port_ops icside_v6_port_ops = {
231 .set_dma_mode = icside_set_dma_mode, 280 .set_dma_mode = icside_set_dma_mode,
281 .maskproc = icside_maskproc,
232}; 282};
233 283
234static void icside_dma_host_set(ide_drive_t *drive, int on) 284static void icside_dma_host_set(ide_drive_t *drive, int on)
@@ -273,6 +323,11 @@ static int icside_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
273 BUG_ON(dma_channel_active(ec->dma)); 323 BUG_ON(dma_channel_active(ec->dma));
274 324
275 /* 325 /*
326 * Ensure that we have the right interrupt routed.
327 */
328 icside_maskproc(drive, 0);
329
330 /*
276 * Route the DMA signals to the correct interface. 331 * Route the DMA signals to the correct interface.
277 */ 332 */
278 writeb(state->sel | hwif->channel, state->ioc_base); 333 writeb(state->sel | hwif->channel, state->ioc_base);
@@ -400,6 +455,7 @@ err_free:
400 455
401static const struct ide_port_info icside_v6_port_info __initdata = { 456static const struct ide_port_info icside_v6_port_info __initdata = {
402 .init_dma = icside_dma_off_init, 457 .init_dma = icside_dma_off_init,
458 .port_ops = &icside_v6_no_dma_port_ops,
403 .dma_ops = &icside_v6_dma_ops, 459 .dma_ops = &icside_v6_dma_ops,
404 .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO, 460 .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO,
405 .mwdma_mask = ATA_MWDMA2, 461 .mwdma_mask = ATA_MWDMA2,
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index dd6396384c25..ab87e4f7cec9 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -121,19 +121,11 @@ static int ide_probe(struct pcmcia_device *link)
121static void ide_detach(struct pcmcia_device *link) 121static void ide_detach(struct pcmcia_device *link)
122{ 122{
123 ide_info_t *info = link->priv; 123 ide_info_t *info = link->priv;
124 ide_hwif_t *hwif = info->host->ports[0];
125 unsigned long data_addr, ctl_addr;
126 124
127 dev_dbg(&link->dev, "ide_detach(0x%p)\n", link); 125 dev_dbg(&link->dev, "ide_detach(0x%p)\n", link);
128 126
129 data_addr = hwif->io_ports.data_addr;
130 ctl_addr = hwif->io_ports.ctl_addr;
131
132 ide_release(link); 127 ide_release(link);
133 128
134 release_region(ctl_addr, 1);
135 release_region(data_addr, 8);
136
137 kfree(info); 129 kfree(info);
138} /* ide_detach */ 130} /* ide_detach */
139 131
@@ -354,12 +346,19 @@ static void ide_release(struct pcmcia_device *link)
354 346
355 dev_dbg(&link->dev, "ide_release(0x%p)\n", link); 347 dev_dbg(&link->dev, "ide_release(0x%p)\n", link);
356 348
357 if (info->ndev) 349 if (info->ndev) {
358 /* FIXME: if this fails we need to queue the cleanup somehow 350 ide_hwif_t *hwif = host->ports[0];
359 -- need to investigate the required PCMCIA magic */ 351 unsigned long data_addr, ctl_addr;
352
353 data_addr = hwif->io_ports.data_addr;
354 ctl_addr = hwif->io_ports.ctl_addr;
355
360 ide_host_remove(host); 356 ide_host_remove(host);
357 info->ndev = 0;
361 358
362 info->ndev = 0; 359 release_region(ctl_addr, 1);
360 release_region(data_addr, 8);
361 }
363 362
364 pcmcia_disable_device(link); 363 pcmcia_disable_device(link);
365} /* ide_release */ 364} /* ide_release */
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c
index 07cd37516ba6..c5f3841af360 100644
--- a/drivers/ide/pdc202xx_old.c
+++ b/drivers/ide/pdc202xx_old.c
@@ -93,13 +93,13 @@ static int pdc202xx_test_irq(ide_hwif_t *hwif)
93 * bit 7: error, bit 6: interrupting, 93 * bit 7: error, bit 6: interrupting,
94 * bit 5: FIFO full, bit 4: FIFO empty 94 * bit 5: FIFO full, bit 4: FIFO empty
95 */ 95 */
96 return ((sc1d & 0x50) == 0x40) ? 1 : 0; 96 return ((sc1d & 0x50) == 0x50) ? 1 : 0;
97 } else { 97 } else {
98 /* 98 /*
99 * bit 3: error, bit 2: interrupting, 99 * bit 3: error, bit 2: interrupting,
100 * bit 1: FIFO full, bit 0: FIFO empty 100 * bit 1: FIFO full, bit 0: FIFO empty
101 */ 101 */
102 return ((sc1d & 0x05) == 0x04) ? 1 : 0; 102 return ((sc1d & 0x05) == 0x05) ? 1 : 0;
103 } 103 }
104} 104}
105 105
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index e9d4b441d1c3..b7f5b0c4310c 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -872,20 +872,18 @@ static struct pci_driver scc_pci_driver = {
872 .remove = __devexit_p(scc_remove), 872 .remove = __devexit_p(scc_remove),
873}; 873};
874 874
875static int scc_ide_init(void) 875static int __init scc_ide_init(void)
876{ 876{
877 return ide_pci_register_driver(&scc_pci_driver); 877 return ide_pci_register_driver(&scc_pci_driver);
878} 878}
879 879
880module_init(scc_ide_init); 880static void __exit scc_ide_exit(void)
881/* -- No exit code?
882static void scc_ide_exit(void)
883{ 881{
884 ide_pci_unregister_driver(&scc_pci_driver); 882 pci_unregister_driver(&scc_pci_driver);
885} 883}
886module_exit(scc_ide_exit);
887 */
888 884
885module_init(scc_ide_init);
886module_exit(scc_ide_exit);
889 887
890MODULE_DESCRIPTION("PCI driver module for Toshiba SCC IDE"); 888MODULE_DESCRIPTION("PCI driver module for Toshiba SCC IDE");
891MODULE_LICENSE("GPL"); 889MODULE_LICENSE("GPL");