aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/macide.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:50 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:50 -0500
commit29dd59755a849cc6475faa6a75f3b804e23a6fc2 (patch)
tree007f73aed935c22438e69cb2d2438b93f249d955 /drivers/ide/legacy/macide.c
parentf2694b7e3bad75436b47b6840de352f7b7f53feb (diff)
ide: remove ide_setup_ports()
ide-cris.c: * Add cris_setup_ports() helper and use it instead of ide_setup_ports() (fixes random value being set in ->io_ports[IDE_IRQ_OFFSET]). buddha.c: * Add buddha_setup_ports() helper and use it instead of ide_setup_ports(). falconide.c: * Add falconide_setup_ports() helper and use it instead of ide_setup_ports(), also fix return value of falconide_init() while at it. gayle.c: * Add gayle_setup_ports() helper and use it instead of ide_setup_ports(). macide.c: * Add macide_setup_ports() helper and use it instead of ide_setup_ports() (fixes incorrect value being set in ->io_ports[IDE_IRQ_OFFSET]). q40ide.c: * Fix q40_ide_setup_ports() comments. ide.c: * Remove no longer needed ide_setup_ports(). Cc: Mikael Starvik <starvik@axis.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy/macide.c')
-rw-r--r--drivers/ide/legacy/macide.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 06df8df857a3..a61e60737dc7 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -31,14 +31,6 @@
31 * These match MkLinux so they should be correct. 31 * These match MkLinux so they should be correct.
32 */ 32 */
33 33
34#define IDE_DATA 0x00
35#define IDE_ERROR 0x04 /* see err-bits */
36#define IDE_NSECTOR 0x08 /* nr of sectors to read/write */
37#define IDE_SECTOR 0x0c /* starting sector */
38#define IDE_LCYL 0x10 /* starting cylinder */
39#define IDE_HCYL 0x14 /* high byte of starting cyl */
40#define IDE_SELECT 0x18 /* 101dhhhh , d=drive, hhhh=head */
41#define IDE_STATUS 0x1c /* see status-bits */
42#define IDE_CONTROL 0x38 /* control/altstatus */ 34#define IDE_CONTROL 0x38 /* control/altstatus */
43 35
44/* 36/*
@@ -63,11 +55,6 @@
63 55
64volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR); 56volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR);
65 57
66static int macide_offsets[IDE_NR_PORTS] = {
67 IDE_DATA, IDE_ERROR, IDE_NSECTOR, IDE_SECTOR, IDE_LCYL,
68 IDE_HCYL, IDE_SELECT, IDE_STATUS, IDE_CONTROL
69};
70
71int macide_ack_intr(ide_hwif_t* hwif) 58int macide_ack_intr(ide_hwif_t* hwif)
72{ 59{
73 if (*ide_ifr & 0x20) { 60 if (*ide_ifr & 0x20) {
@@ -77,6 +64,22 @@ int macide_ack_intr(ide_hwif_t* hwif)
77 return 0; 64 return 0;
78} 65}
79 66
67static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
68 int irq, ide_ack_intr_t *ack_intr)
69{
70 int i;
71
72 memset(hw, 0, sizeof(*hw));
73
74 for (i = 0; i < 8; i++)
75 hw->io_ports[i] = base + i * 4;
76
77 hw->io_ports[IDE_CONTROL_OFFSET] = IDE_CONTROL;
78
79 hw->irq = irq;
80 hw->ack_intr = ack_intr;
81}
82
80static const char *mac_ide_name[] = 83static const char *mac_ide_name[] =
81 { "Quadra", "Powerbook", "Powerbook Baboon" }; 84 { "Quadra", "Powerbook", "Powerbook Baboon" };
82 85
@@ -86,27 +89,27 @@ static const char *mac_ide_name[] =
86 89
87static int __init macide_init(void) 90static int __init macide_init(void)
88{ 91{
89 hw_regs_t hw;
90 ide_hwif_t *hwif; 92 ide_hwif_t *hwif;
93 ide_ack_intr_t *ack_intr;
94 unsigned long base;
95 int irq;
96 hw_regs_t hw;
91 97
92 switch (macintosh_config->ide_type) { 98 switch (macintosh_config->ide_type) {
93 case MAC_IDE_QUADRA: 99 case MAC_IDE_QUADRA:
94 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 100 base = IDE_BASE;
95 0, 0, macide_ack_intr, 101 ack_intr = macide_ack_intr;
96// quadra_ide_iops, 102 irq = IRQ_NUBUS_F;
97 IRQ_NUBUS_F);
98 break; 103 break;
99 case MAC_IDE_PB: 104 case MAC_IDE_PB:
100 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 105 base = IDE_BASE;
101 0, 0, macide_ack_intr, 106 ack_intr = macide_ack_intr;
102// macide_pb_iops, 107 irq = IRQ_NUBUS_C;
103 IRQ_NUBUS_C);
104 break; 108 break;
105 case MAC_IDE_BABOON: 109 case MAC_IDE_BABOON:
106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 110 base = BABOON_BASE;
107 0, 0, NULL, 111 ack_intr = NULL;
108// macide_baboon_iops, 112 irq = IRQ_BABOON_1;
109 IRQ_BABOON_1);
110 break; 113 break;
111 default: 114 default:
112 return -ENODEV; 115 return -ENODEV;
@@ -115,6 +118,8 @@ static int __init macide_init(void)
115 printk(KERN_INFO "ide: Macintosh %s IDE controller\n", 118 printk(KERN_INFO "ide: Macintosh %s IDE controller\n",
116 mac_ide_name[macintosh_config->ide_type - 1]); 119 mac_ide_name[macintosh_config->ide_type - 1]);
117 120
121 macide_setup_ports(&hw, base, irq, ack_intr);
122
118 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); 123 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
119 if (hwif) { 124 if (hwif) {
120 u8 index = hwif->index; 125 u8 index = hwif->index;