aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/arm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/arm')
-rw-r--r--drivers/ide/arm/Makefile1
-rw-r--r--drivers/ide/arm/bast-ide.c90
-rw-r--r--drivers/ide/arm/icside.c105
-rw-r--r--drivers/ide/arm/palm_bk3710.c3
-rw-r--r--drivers/ide/arm/rapide.c33
5 files changed, 74 insertions, 158 deletions
diff --git a/drivers/ide/arm/Makefile b/drivers/ide/arm/Makefile
index 936e7b0237f5..5bc26053afa6 100644
--- a/drivers/ide/arm/Makefile
+++ b/drivers/ide/arm/Makefile
@@ -1,7 +1,6 @@
1 1
2obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o 2obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o
3obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o 3obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o
4obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o
5obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o 4obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o
6 5
7ifeq ($(CONFIG_IDE_ARM), m) 6ifeq ($(CONFIG_IDE_ARM), m)
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c
deleted file mode 100644
index 8e8c28104b45..000000000000
--- a/drivers/ide/arm/bast-ide.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Copyright (c) 2003-2004 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9*/
10
11#include <linux/module.h>
12#include <linux/errno.h>
13#include <linux/ide.h>
14#include <linux/init.h>
15
16#include <asm/mach-types.h>
17
18#include <asm/io.h>
19#include <asm/irq.h>
20#include <asm/arch/map.h>
21#include <asm/arch/bast-map.h>
22#include <asm/arch/bast-irq.h>
23
24#define DRV_NAME "bast-ide"
25
26static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
27{
28 ide_hwif_t *hwif;
29 hw_regs_t hw;
30 int i;
31 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
32
33 memset(&hw, 0, sizeof(hw));
34
35 base += BAST_IDE_CS;
36 aux += BAST_IDE_CS;
37
38 for (i = 0; i <= 7; i++) {
39 hw.io_ports_array[i] = (unsigned long)base;
40 base += 0x20;
41 }
42
43 hw.io_ports.ctl_addr = aux + (6 * 0x20);
44 hw.irq = irq;
45 hw.chipset = ide_generic;
46
47 hwif = ide_find_port();
48 if (hwif == NULL)
49 goto out;
50
51 i = hwif->index;
52
53 ide_init_port_data(hwif, i);
54 ide_init_port_hw(hwif, &hw);
55 hwif->port_ops = NULL;
56
57 idx[0] = i;
58
59 ide_device_add(idx, NULL);
60out:
61 return 0;
62}
63
64static int __init bastide_init(void)
65{
66 unsigned long base = BAST_VA_IDEPRI + BAST_IDE_CS;
67
68 /* we can treat the VR1000 and the BAST the same */
69
70 if (!(machine_is_bast() || machine_is_vr1000()))
71 return 0;
72
73 printk("BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n");
74
75 if (!request_mem_region(base, 0x400000, DRV_NAME)) {
76 printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
77 return -EBUSY;
78 }
79
80 bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0);
81 bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1);
82
83 return 0;
84}
85
86module_init(bastide_init);
87
88MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
89MODULE_LICENSE("GPL");
90MODULE_DESCRIPTION("Simtec BAST / Thorcom VR1000 IDE driver");
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 061456914ca3..52f58c885783 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -21,6 +21,8 @@
21#include <asm/dma.h> 21#include <asm/dma.h>
22#include <asm/ecard.h> 22#include <asm/ecard.h>
23 23
24#define DRV_NAME "icside"
25
24#define ICS_IDENT_OFFSET 0x2280 26#define ICS_IDENT_OFFSET 0x2280
25 27
26#define ICS_ARCIN_V5_INTRSTAT 0x0000 28#define ICS_ARCIN_V5_INTRSTAT 0x0000
@@ -68,6 +70,7 @@ struct icside_state {
68 unsigned int enabled; 70 unsigned int enabled;
69 void __iomem *irq_port; 71 void __iomem *irq_port;
70 void __iomem *ioc_base; 72 void __iomem *ioc_base;
73 unsigned int sel;
71 unsigned int type; 74 unsigned int type;
72 ide_hwif_t *hwif[2]; 75 ide_hwif_t *hwif[2];
73}; 76};
@@ -165,7 +168,8 @@ static const expansioncard_ops_t icside_ops_arcin_v6 = {
165static void icside_maskproc(ide_drive_t *drive, int mask) 168static void icside_maskproc(ide_drive_t *drive, int mask)
166{ 169{
167 ide_hwif_t *hwif = HWIF(drive); 170 ide_hwif_t *hwif = HWIF(drive);
168 struct icside_state *state = hwif->hwif_data; 171 struct expansion_card *ec = ECARD_DEV(hwif->dev);
172 struct icside_state *state = ecard_get_drvdata(ec);
169 unsigned long flags; 173 unsigned long flags;
170 174
171 local_irq_save(flags); 175 local_irq_save(flags);
@@ -308,6 +312,7 @@ static int icside_dma_setup(ide_drive_t *drive)
308{ 312{
309 ide_hwif_t *hwif = HWIF(drive); 313 ide_hwif_t *hwif = HWIF(drive);
310 struct expansion_card *ec = ECARD_DEV(hwif->dev); 314 struct expansion_card *ec = ECARD_DEV(hwif->dev);
315 struct icside_state *state = ecard_get_drvdata(ec);
311 struct request *rq = hwif->hwgroup->rq; 316 struct request *rq = hwif->hwgroup->rq;
312 unsigned int dma_mode; 317 unsigned int dma_mode;
313 318
@@ -331,7 +336,7 @@ static int icside_dma_setup(ide_drive_t *drive)
331 /* 336 /*
332 * Route the DMA signals to the correct interface. 337 * Route the DMA signals to the correct interface.
333 */ 338 */
334 writeb(hwif->select_data, hwif->config_data); 339 writeb(state->sel | hwif->channel, state->ioc_base);
335 340
336 /* 341 /*
337 * Select the correct timing for this drive. 342 * Select the correct timing for this drive.
@@ -359,7 +364,8 @@ static void icside_dma_exec_cmd(ide_drive_t *drive, u8 cmd)
359static int icside_dma_test_irq(ide_drive_t *drive) 364static int icside_dma_test_irq(ide_drive_t *drive)
360{ 365{
361 ide_hwif_t *hwif = HWIF(drive); 366 ide_hwif_t *hwif = HWIF(drive);
362 struct icside_state *state = hwif->hwif_data; 367 struct expansion_card *ec = ECARD_DEV(hwif->dev);
368 struct icside_state *state = ecard_get_drvdata(ec);
363 369
364 return readb(state->irq_port + 370 return readb(state->irq_port +
365 (hwif->channel ? 371 (hwif->channel ?
@@ -411,36 +417,24 @@ static int icside_dma_off_init(ide_hwif_t *hwif, const struct ide_port_info *d)
411 return -EOPNOTSUPP; 417 return -EOPNOTSUPP;
412} 418}
413 419
414static ide_hwif_t * 420static void icside_setup_ports(hw_regs_t *hw, void __iomem *base,
415icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) 421 struct cardinfo *info, struct expansion_card *ec)
416{ 422{
417 unsigned long port = (unsigned long)base + info->dataoffset; 423 unsigned long port = (unsigned long)base + info->dataoffset;
418 ide_hwif_t *hwif;
419 424
420 hwif = ide_find_port(); 425 hw->io_ports.data_addr = port;
421 if (hwif) { 426 hw->io_ports.error_addr = port + (1 << info->stepping);
422 /* 427 hw->io_ports.nsect_addr = port + (2 << info->stepping);
423 * Ensure we're using MMIO 428 hw->io_ports.lbal_addr = port + (3 << info->stepping);
424 */ 429 hw->io_ports.lbam_addr = port + (4 << info->stepping);
425 default_hwif_mmiops(hwif); 430 hw->io_ports.lbah_addr = port + (5 << info->stepping);
426 431 hw->io_ports.device_addr = port + (6 << info->stepping);
427 hwif->io_ports.data_addr = port; 432 hw->io_ports.status_addr = port + (7 << info->stepping);
428 hwif->io_ports.error_addr = port + (1 << info->stepping); 433 hw->io_ports.ctl_addr = (unsigned long)base + info->ctrloffset;
429 hwif->io_ports.nsect_addr = port + (2 << info->stepping); 434
430 hwif->io_ports.lbal_addr = port + (3 << info->stepping); 435 hw->irq = ec->irq;
431 hwif->io_ports.lbam_addr = port + (4 << info->stepping); 436 hw->dev = &ec->dev;
432 hwif->io_ports.lbah_addr = port + (5 << info->stepping); 437 hw->chipset = ide_acorn;
433 hwif->io_ports.device_addr = port + (6 << info->stepping);
434 hwif->io_ports.status_addr = port + (7 << info->stepping);
435 hwif->io_ports.ctl_addr =
436 (unsigned long)base + info->ctrloffset;
437 hwif->irq = ec->irq;
438 hwif->chipset = ide_acorn;
439 hwif->gendev.parent = &ec->dev;
440 hwif->dev = &ec->dev;
441 }
442
443 return hwif;
444} 438}
445 439
446static int __init 440static int __init
@@ -449,6 +443,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
449 ide_hwif_t *hwif; 443 ide_hwif_t *hwif;
450 void __iomem *base; 444 void __iomem *base;
451 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 445 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
446 hw_regs_t hw;
452 447
453 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); 448 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
454 if (!base) 449 if (!base)
@@ -466,12 +461,19 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
466 */ 461 */
467 icside_irqdisable_arcin_v5(ec, 0); 462 icside_irqdisable_arcin_v5(ec, 0);
468 463
469 hwif = icside_setup(base, &icside_cardinfo_v5, ec); 464 icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec);
465
466 hwif = ide_find_port();
470 if (!hwif) 467 if (!hwif)
471 return -ENODEV; 468 return -ENODEV;
472 469
470 ide_init_port_hw(hwif, &hw);
471 default_hwif_mmiops(hwif);
472
473 state->hwif[0] = hwif; 473 state->hwif[0] = hwif;
474 474
475 ecard_set_drvdata(ec, state);
476
475 idx[0] = hwif->index; 477 idx[0] = hwif->index;
476 478
477 ide_device_add(idx, NULL); 479 ide_device_add(idx, NULL);
@@ -497,6 +499,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
497 int ret; 499 int ret;
498 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 500 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
499 struct ide_port_info d = icside_v6_port_info; 501 struct ide_port_info d = icside_v6_port_info;
502 hw_regs_t hw[2];
500 503
501 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); 504 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
502 if (!ioc_base) { 505 if (!ioc_base) {
@@ -525,43 +528,47 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
525 528
526 state->irq_port = easi_base; 529 state->irq_port = easi_base;
527 state->ioc_base = ioc_base; 530 state->ioc_base = ioc_base;
531 state->sel = sel;
528 532
529 /* 533 /*
530 * Be on the safe side - disable interrupts 534 * Be on the safe side - disable interrupts
531 */ 535 */
532 icside_irqdisable_arcin_v6(ec, 0); 536 icside_irqdisable_arcin_v6(ec, 0);
533 537
538 icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec);
539 icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec);
540
534 /* 541 /*
535 * Find and register the interfaces. 542 * Find and register the interfaces.
536 */ 543 */
537 hwif = icside_setup(easi_base, &icside_cardinfo_v6_1, ec); 544 hwif = ide_find_port();
538 mate = icside_setup(easi_base, &icside_cardinfo_v6_2, ec); 545 if (hwif == NULL)
546 return -ENODEV;
539 547
540 if (!hwif || !mate) { 548 ide_init_port_hw(hwif, &hw[0]);
541 ret = -ENODEV; 549 default_hwif_mmiops(hwif);
542 goto out; 550
551 idx[0] = hwif->index;
552
553 mate = ide_find_port();
554 if (mate) {
555 ide_init_port_hw(mate, &hw[1]);
556 default_hwif_mmiops(mate);
557
558 idx[1] = mate->index;
543 } 559 }
544 560
545 state->hwif[0] = hwif; 561 state->hwif[0] = hwif;
546 state->hwif[1] = mate; 562 state->hwif[1] = mate;
547 563
548 hwif->hwif_data = state; 564 ecard_set_drvdata(ec, state);
549 hwif->config_data = (unsigned long)ioc_base;
550 hwif->select_data = sel;
551
552 mate->hwif_data = state;
553 mate->config_data = (unsigned long)ioc_base;
554 mate->select_data = sel | 1;
555 565
556 if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { 566 if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) {
557 d.init_dma = icside_dma_init; 567 d.init_dma = icside_dma_init;
558 d.port_ops = &icside_v6_port_ops; 568 d.port_ops = &icside_v6_port_ops;
559 d.dma_ops = NULL; 569 d.dma_ops = NULL;
560 } 570 }
561 571
562 idx[0] = hwif->index;
563 idx[1] = mate->index;
564
565 ide_device_add(idx, &d); 572 ide_device_add(idx, &d);
566 573
567 return 0; 574 return 0;
@@ -627,10 +634,8 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
627 break; 634 break;
628 } 635 }
629 636
630 if (ret == 0) { 637 if (ret == 0)
631 ecard_set_drvdata(ec, state);
632 goto out; 638 goto out;
633 }
634 639
635 kfree(state); 640 kfree(state);
636 release: 641 release:
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c
index 3839f5722985..c79b85b6e4a3 100644
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -74,8 +74,6 @@ struct palm_bk3710_udmatiming {
74#define BK3710_IORDYTMP 0x78 74#define BK3710_IORDYTMP 0x78
75#define BK3710_IORDYTMS 0x7C 75#define BK3710_IORDYTMS 0x7C
76 76
77#include "../ide-timing.h"
78
79static unsigned ideclk_period; /* in nanoseconds */ 77static unsigned ideclk_period; /* in nanoseconds */
80 78
81static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { 79static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = {
@@ -402,7 +400,6 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
402 400
403 i = hwif->index; 401 i = hwif->index;
404 402
405 ide_init_port_data(hwif, i);
406 ide_init_port_hw(hwif, &hw); 403 ide_init_port_hw(hwif, &hw);
407 404
408 default_hwif_mmiops(hwif); 405 default_hwif_mmiops(hwif);
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 1747b2358775..43057e0303c8 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -11,6 +11,10 @@
11 11
12#include <asm/ecard.h> 12#include <asm/ecard.h>
13 13
14static struct const ide_port_info rapide_port_info = {
15 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
16};
17
14static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base, 18static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
15 void __iomem *ctrl, unsigned int sz, int irq) 19 void __iomem *ctrl, unsigned int sz, int irq)
16{ 20{
@@ -44,25 +48,26 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
44 goto release; 48 goto release;
45 } 49 }
46 50
47 hwif = ide_find_port(); 51 memset(&hw, 0, sizeof(hw));
48 if (hwif) { 52 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
49 memset(&hw, 0, sizeof(hw)); 53 hw.chipset = ide_generic;
50 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq); 54 hw.dev = &ec->dev;
51 hw.chipset = ide_generic;
52 hw.dev = &ec->dev;
53 55
54 ide_init_port_hw(hwif, &hw); 56 hwif = ide_find_port();
57 if (hwif == NULL) {
58 ret = -ENOENT;
59 goto release;
60 }
55 61
56 hwif->host_flags = IDE_HFLAG_MMIO; 62 ide_init_port_hw(hwif, &hw);
57 default_hwif_mmiops(hwif); 63 default_hwif_mmiops(hwif);
58 64
59 idx[0] = hwif->index; 65 idx[0] = hwif->index;
60 66
61 ide_device_add(idx, NULL); 67 ide_device_add(idx, &rapide_port_info);
62 68
63 ecard_set_drvdata(ec, hwif); 69 ecard_set_drvdata(ec, hwif);
64 goto out; 70 goto out;
65 }
66 71
67 release: 72 release:
68 ecard_release_resources(ec); 73 ecard_release_resources(ec);