2 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 /* Derived loosely from ide-pmac.c, so:
21 * Copyright (C) 1998 Paul Mackerras.
22 * Copyright (C) 1995-1998 Mark Lord
24 #include <linux/kernel.h>
25 #include <linux/ide.h>
27 #include <asm/sibyte/board.h>
29 #define SIBYTE_IDE_BASE (IO_SPACE_BASE + IDE_PHYS - mips_io_port_base)
30 #define SIBYTE_IDE_REG(pcaddr) (SIBYTE_IDE_BASE + ((pcaddr) << 5))
32 extern void sibyte_set_ideops(ide_hwif_t *hwif);
34 void __init sibyte_ide_probe(void)
37 ide_hwif_t *hwif = NULL;
40 * Find the first untaken slot in hwifs. Also set the io ops
41 * to the non-swapping SiByte versions. XXXKW It would be
42 * nice to find a safe place to do this outside of
43 * ide-sibyte.c so PCI-IDE would work without the SiByte
46 for (i = 0; i < MAX_HWIFS; i++) {
47 sibyte_set_ideops(&ide_hwifs[i]);
48 if (!ide_hwifs[i].io_ports[IDE_DATA_OFFSET] && (hwif == NULL)) {
53 printk("No space for SiByte onboard IDE driver in ide_hwifs[]. Not enabled.\n");
58 * Set up our stuff; we're a little odd because our io_ports
59 * aren't in the usual place, and byte-swapping isn't
62 hwif->hw.io_ports[IDE_DATA_OFFSET] = SIBYTE_IDE_REG(0x1f0);
63 hwif->hw.io_ports[IDE_ERROR_OFFSET] = SIBYTE_IDE_REG(0x1f1);
64 hwif->hw.io_ports[IDE_NSECTOR_OFFSET] = SIBYTE_IDE_REG(0x1f2);
65 hwif->hw.io_ports[IDE_SECTOR_OFFSET] = SIBYTE_IDE_REG(0x1f3);
66 hwif->hw.io_ports[IDE_LCYL_OFFSET] = SIBYTE_IDE_REG(0x1f4);
67 hwif->hw.io_ports[IDE_HCYL_OFFSET] = SIBYTE_IDE_REG(0x1f5);
68 hwif->hw.io_ports[IDE_SELECT_OFFSET] = SIBYTE_IDE_REG(0x1f6);
69 hwif->hw.io_ports[IDE_STATUS_OFFSET] = SIBYTE_IDE_REG(0x1f7);
70 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = SIBYTE_IDE_REG(0x3f6);
71 hwif->hw.irq = K_INT_GB_IDE;
72 hwif->irq = hwif->hw.irq;
74 hwif->hw.ack_intr = NULL;
77 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
78 printk(KERN_INFO "SiByte onboard IDE configured as device %i\n", hwif-ide_hwifs);