aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 11:39:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 11:39:24 -0400
commit188da98800893691e47eea9335a234378e32aceb (patch)
tree57dbf491d23676e011b4946ec1867a6d55a02eef /drivers/ide/ppc
parent07fe944e87d79f8d7e1b090913fe9f2ace78f41d (diff)
parent273b8385e5817a4765f82257004c5ec661a6a5b2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (58 commits) ide: remove ide_init_default_irq() macro ide: move default IDE ports setup to ide_generic host driver ide: remove obsoleted "idex=noprobe" kernel parameter (take 2) ide: remove needless hwif->irq check from ide_hwif_configure() ide: init hwif->{io_ports,irq} explicitly in legacy VLB host drivers ide: limit legacy VLB host drivers to alpha, x86 and mips cmd640: init hwif->{io_ports,irq} explicitly cmd640: cleanup setup_device_ptrs() ide: add ide-4drives host driver (take 3) ide: remove ppc ifdef from init_ide_data() ide: remove ide_default_io_ctl() macro ide: remove CONFIG_IDE_ARCH_OBSOLETE_INIT ide: add CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS (take 2) ppc/pmac: remove no longer needed IDE quirk ppc: don't include <linux/ide.h> ppc: remove ppc_ide_md ppc/pplus: remove ppc_ide_md.ide_init_hwif hook ppc/sandpoint: remove ppc_ide_md hooks ppc/lopec: remove ppc_ide_md hooks ppc/mpc8xx: remove ppc_ide_md hooks ...
Diffstat (limited to 'drivers/ide/ppc')
-rw-r--r--drivers/ide/ppc/mpc8xx.c86
-rw-r--r--drivers/ide/ppc/pmac.c104
2 files changed, 37 insertions, 153 deletions
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index ebaba01c7551..a784a97ca7ec 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -99,32 +99,6 @@ static int _slot_ = -1; /* will be read from PCMCIA registers */
99/* Make clock cycles and always round up */ 99/* Make clock cycles and always round up */
100#define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U ) 100#define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
101 101
102
103
104/*
105 * IDE stuff.
106 */
107static int
108m8xx_ide_default_irq(unsigned long base)
109{
110#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
111 if (base >= MAX_HWIFS)
112 return 0;
113
114 printk("[%d] m8xx_ide_default_irq %d\n",__LINE__,ioport_dsc[base].irq);
115
116 return (ioport_dsc[base].irq);
117#else
118 return 9;
119#endif
120}
121
122static unsigned long
123m8xx_ide_default_io_base(int index)
124{
125 return index;
126}
127
128#define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4)) 102#define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4))
129#define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4)) 103#define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4))
130 104
@@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL;
149 */ 123 */
150 124
151/* 125/*
152 * m8xx_ide_init_hwif_ports for a direct IDE interface _using_ 126 * m8xx_ide_init_ports() for a direct IDE interface _using_
127 * MPC8xx's internal PCMCIA interface
153 */ 128 */
154#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 129#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
155static void 130static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
156m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
157 unsigned long ctrl_port, int *irq)
158{ 131{
159 unsigned long *p = hw->io_ports; 132 unsigned long *p = hw->io_ports;
160 int i; 133 int i;
@@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
173 unsigned long base; 146 unsigned long base;
174 147
175 *p = 0; 148 *p = 0;
176 if (irq)
177 *irq = 0;
178 149
179 pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia)); 150 pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia));
180 151
@@ -248,9 +219,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
248 } 219 }
249 } 220 }
250 221
251 if (data_port >= MAX_HWIFS)
252 return;
253
254 if (_slot_ == -1) { 222 if (_slot_ == -1) {
255 printk ("PCMCIA slot has not been defined! Using A as default\n"); 223 printk ("PCMCIA slot has not been defined! Using A as default\n");
256 _slot_ = 0; 224 _slot_ = 0;
@@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
292 *p++ = base + ioport_dsc[data_port].reg_off[i]; 260 *p++ = base + ioport_dsc[data_port].reg_off[i];
293 } 261 }
294 262
295 if (irq) { 263 hw->irq = ioport_dsc[data_port].irq;
264 hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
265
296#ifdef CONFIG_IDE_8xx_PCCARD 266#ifdef CONFIG_IDE_8xx_PCCARD
267 {
297 unsigned int reg; 268 unsigned int reg;
298 269
299 *irq = ioport_dsc[data_port].irq;
300 if (_slot_) 270 if (_slot_)
301 pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb; 271 pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb;
302 else 272 else
@@ -306,14 +276,11 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
306 reg |= mk_int_int_mask (pcmcia_schlvl) << 24; 276 reg |= mk_int_int_mask (pcmcia_schlvl) << 24;
307 reg |= mk_int_int_mask (pcmcia_schlvl) << 16; 277 reg |= mk_int_int_mask (pcmcia_schlvl) << 16;
308 *pgcrx = reg; 278 *pgcrx = reg;
309#else /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */
310 *irq = ioport_dsc[data_port].irq;
311#endif /* CONFIG_IDE_8xx_PCCARD */
312 } 279 }
280#endif /* CONFIG_IDE_8xx_PCCARD */
313 281
314 ide_hwifs[data_port].pio_mask = ATA_PIO4; 282 ide_hwifs[data_port].pio_mask = ATA_PIO4;
315 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 283 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
316 ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
317 284
318 /* Enable Harddisk Interrupt, 285 /* Enable Harddisk Interrupt,
319 * and make it edge sensitive 286 * and make it edge sensitive
@@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
329 /* Enable falling edge irq */ 296 /* Enable falling edge irq */
330 pcmp->pcmc_per = 0x100000 >> (16 * _slot_); 297 pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
331#endif /* CONFIG_IDE_8xx_PCCARD */ 298#endif /* CONFIG_IDE_8xx_PCCARD */
332} /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */ 299}
333#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ 300#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
334 301
335/* 302/*
336 * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using 303 * m8xx_ide_init_ports() for a direct IDE interface _not_ using
337 * MPC8xx's internal PCMCIA interface 304 * MPC8xx's internal PCMCIA interface
338 */ 305 */
339#if defined(CONFIG_IDE_EXT_DIRECT) 306#if defined(CONFIG_IDE_EXT_DIRECT)
340void m8xx_ide_init_hwif_ports (hw_regs_t *hw, 307static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
341 unsigned long data_port, unsigned long ctrl_port, int *irq)
342{ 308{
343 unsigned long *p = hw->io_ports; 309 unsigned long *p = hw->io_ports;
344 int i; 310 int i;
@@ -349,8 +315,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
349 unsigned long base; 315 unsigned long base;
350 316
351 *p = 0; 317 *p = 0;
352 if (irq)
353 *irq = 0;
354 318
355 if (!ide_base) { 319 if (!ide_base) {
356 320
@@ -372,9 +336,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
372#endif 336#endif
373 } 337 }
374 338
375 if (data_port >= MAX_HWIFS)
376 return;
377
378 base = ide_base + ioport_dsc[data_port].base_off; 339 base = ide_base + ioport_dsc[data_port].base_off;
379#ifdef DEBUG 340#ifdef DEBUG
380 printk ("base: %08x + %08x = %08x\n", 341 printk ("base: %08x + %08x = %08x\n",
@@ -392,14 +353,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
392 *p++ = base + ioport_dsc[data_port].reg_off[i]; 353 *p++ = base + ioport_dsc[data_port].reg_off[i];
393 } 354 }
394 355
395 if (irq) { 356 /* direct connected IDE drive, i.e. external IRQ */
396 /* direct connected IDE drive, i.e. external IRQ */ 357 hw->irq = ioport_dsc[data_port].irq;
397 *irq = ioport_dsc[data_port].irq; 358 hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
398 }
399 359
400 ide_hwifs[data_port].pio_mask = ATA_PIO4; 360 ide_hwifs[data_port].pio_mask = ATA_PIO4;
401 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 361 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
402 ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
403 362
404 /* Enable Harddisk Interrupt, 363 /* Enable Harddisk Interrupt,
405 * and make it edge sensitive 364 * and make it edge sensitive
@@ -407,8 +366,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
407 /* (11-18) Set edge detect for irq, no wakeup from low power mode */ 366 /* (11-18) Set edge detect for irq, no wakeup from low power mode */
408 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= 367 ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
409 (0x80000000 >> ioport_dsc[data_port].irq); 368 (0x80000000 >> ioport_dsc[data_port].irq);
410} /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */ 369}
411
412#endif /* CONFIG_IDE_8xx_DIRECT */ 370#endif /* CONFIG_IDE_8xx_DIRECT */
413 371
414 372
@@ -829,20 +787,20 @@ static int identify (volatile u8 *p)
829 return (0); /* don't know */ 787 return (0); /* don't know */
830} 788}
831 789
832void m8xx_ide_init(void)
833{
834 ppc_ide_md.default_irq = m8xx_ide_default_irq;
835 ppc_ide_md.default_io_base = m8xx_ide_default_io_base;
836 ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports;
837}
838
839static int __init mpc8xx_ide_probe(void) 790static int __init mpc8xx_ide_probe(void)
840{ 791{
792 hw_regs_t hw;
841 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 793 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
842 794
843#ifdef IDE0_BASE_OFFSET 795#ifdef IDE0_BASE_OFFSET
796 memset(&hw, 0, sizeof(hw));
797 m8xx_ide_init_ports(&hw, 0);
798 ide_init_port_hw(&ide_hwifs[0], &hw);
844 idx[0] = 0; 799 idx[0] = 0;
845#ifdef IDE1_BASE_OFFSET 800#ifdef IDE1_BASE_OFFSET
801 memset(&hw, 0, sizeof(hw));
802 m8xx_ide_init_ports(&hw, 1);
803 ide_init_port_hw(&ide_hwifs[1], &hw);
846 idx[1] = 1; 804 idx[1] = 1;
847#endif 805#endif
848#endif 806#endif
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index d9ca52e6cdab..88619b50d9ef 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -80,7 +80,6 @@ typedef struct pmac_ide_hwif {
80} pmac_ide_hwif_t; 80} pmac_ide_hwif_t;
81 81
82static pmac_ide_hwif_t pmac_ide[MAX_HWIFS]; 82static pmac_ide_hwif_t pmac_ide[MAX_HWIFS];
83static int pmac_ide_count;
84 83
85enum { 84enum {
86 controller_ohare, /* OHare based */ 85 controller_ohare, /* OHare based */
@@ -419,38 +418,8 @@ static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
419 418
420#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 419#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
421 420
422/* 421#define PMAC_IDE_REG(x) \
423 * N.B. this can't be an initfunc, because the media-bay task can 422 ((void __iomem *)((drive)->hwif->io_ports[IDE_DATA_OFFSET] + (x)))
424 * call ide_[un]register at any time.
425 */
426void
427pmac_ide_init_hwif_ports(hw_regs_t *hw,
428 unsigned long data_port, unsigned long ctrl_port,
429 int *irq)
430{
431 int i, ix;
432
433 if (data_port == 0)
434 return;
435
436 for (ix = 0; ix < MAX_HWIFS; ++ix)
437 if (data_port == pmac_ide[ix].regbase)
438 break;
439
440 if (ix >= MAX_HWIFS)
441 return; /* not an IDE PMAC interface */
442
443 for (i = 0; i < 8; ++i)
444 hw->io_ports[i] = data_port + i * 0x10;
445 hw->io_ports[8] = data_port + 0x160;
446
447 if (irq != NULL)
448 *irq = pmac_ide[ix].irq;
449
450 hw->dev = &pmac_ide[ix].mdev->ofdev.dev;
451}
452
453#define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x)))
454 423
455/* 424/*
456 * Apply the timings of the proper unit (master/slave) to the shared 425 * Apply the timings of the proper unit (master/slave) to the shared
@@ -886,58 +855,6 @@ sanitize_timings(pmac_ide_hwif_t *pmif)
886 pmif->timings[2] = pmif->timings[3] = value2; 855 pmif->timings[2] = pmif->timings[3] = value2;
887} 856}
888 857
889unsigned long
890pmac_ide_get_base(int index)
891{
892 return pmac_ide[index].regbase;
893}
894
895int
896pmac_ide_check_base(unsigned long base)
897{
898 int ix;
899
900 for (ix = 0; ix < MAX_HWIFS; ++ix)
901 if (base == pmac_ide[ix].regbase)
902 return ix;
903 return -1;
904}
905
906int
907pmac_ide_get_irq(unsigned long base)
908{
909 int ix;
910
911 for (ix = 0; ix < MAX_HWIFS; ++ix)
912 if (base == pmac_ide[ix].regbase)
913 return pmac_ide[ix].irq;
914 return 0;
915}
916
917static int ide_majors[] = { 3, 22, 33, 34, 56, 57 };
918
919dev_t __init
920pmac_find_ide_boot(char *bootdevice, int n)
921{
922 int i;
923
924 /*
925 * Look through the list of IDE interfaces for this one.
926 */
927 for (i = 0; i < pmac_ide_count; ++i) {
928 char *name;
929 if (!pmac_ide[i].node || !pmac_ide[i].node->full_name)
930 continue;
931 name = pmac_ide[i].node->full_name;
932 if (memcmp(name, bootdevice, n) == 0 && name[n] == 0) {
933 /* XXX should cope with the 2nd drive as well... */
934 return MKDEV(ide_majors[i], 0);
935 }
936 }
937
938 return 0;
939}
940
941/* Suspend call back, should be called after the child devices 858/* Suspend call back, should be called after the child devices
942 * have actually been suspended 859 * have actually been suspended
943 */ 860 */
@@ -1088,7 +1005,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1088 if (np->parent && np->parent->name 1005 if (np->parent && np->parent->name
1089 && strcasecmp(np->parent->name, "media-bay") == 0) { 1006 && strcasecmp(np->parent->name, "media-bay") == 0) {
1090#ifdef CONFIG_PMAC_MEDIABAY 1007#ifdef CONFIG_PMAC_MEDIABAY
1091 media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index); 1008 media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq,
1009 hwif);
1092#endif /* CONFIG_PMAC_MEDIABAY */ 1010#endif /* CONFIG_PMAC_MEDIABAY */
1093 pmif->mediabay = 1; 1011 pmif->mediabay = 1;
1094 if (!bidp) 1012 if (!bidp)
@@ -1119,7 +1037,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1119 hwif->hwif_data = pmif; 1037 hwif->hwif_data = pmif;
1120 ide_init_port_hw(hwif, hw); 1038 ide_init_port_hw(hwif, hw);
1121 hwif->noprobe = pmif->mediabay; 1039 hwif->noprobe = pmif->mediabay;
1122 hwif->hold = pmif->mediabay;
1123 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1040 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
1124 hwif->set_pio_mode = pmac_ide_set_pio_mode; 1041 hwif->set_pio_mode = pmac_ide_set_pio_mode;
1125 if (pmif->kind == controller_un_ata6 1042 if (pmif->kind == controller_un_ata6
@@ -1154,6 +1071,15 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1154 return 0; 1071 return 0;
1155} 1072}
1156 1073
1074static void __devinit pmac_ide_init_ports(hw_regs_t *hw, unsigned long base)
1075{
1076 int i;
1077
1078 for (i = 0; i < 8; ++i)
1079 hw->io_ports[i] = base + i * 0x10;
1080 hw->io_ports[8] = base + 0x160;
1081}
1082
1157/* 1083/*
1158 * Attach to a macio probed interface 1084 * Attach to a macio probed interface
1159 */ 1085 */
@@ -1227,7 +1153,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1227 dev_set_drvdata(&mdev->ofdev.dev, hwif); 1153 dev_set_drvdata(&mdev->ofdev.dev, hwif);
1228 1154
1229 memset(&hw, 0, sizeof(hw)); 1155 memset(&hw, 0, sizeof(hw));
1230 pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL); 1156 pmac_ide_init_ports(&hw, pmif->regbase);
1231 hw.irq = irq; 1157 hw.irq = irq;
1232 hw.dev = &mdev->ofdev.dev; 1158 hw.dev = &mdev->ofdev.dev;
1233 1159
@@ -1341,7 +1267,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1341 pci_set_drvdata(pdev, hwif); 1267 pci_set_drvdata(pdev, hwif);
1342 1268
1343 memset(&hw, 0, sizeof(hw)); 1269 memset(&hw, 0, sizeof(hw));
1344 pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL); 1270 pmac_ide_init_ports(&hw, pmif->regbase);
1345 hw.irq = pdev->irq; 1271 hw.irq = pdev->irq;
1346 hw.dev = &pdev->dev; 1272 hw.dev = &pdev->dev;
1347 1273