patch-2.4.20 linux-2.4.20/arch/mips/ddb5xxx/ddb5477/pci.c
Next file: linux-2.4.20/arch/mips/ddb5xxx/ddb5477/pci_ops.c
Previous file: linux-2.4.20/arch/mips/ddb5xxx/ddb5477/irq_5477.c
Back to the patch index
Back to the overall index
- Lines: 257
- Date:
Thu Nov 28 15:53:09 2002
- Orig file:
linux-2.4.19/arch/mips/ddb5xxx/ddb5477/pci.c
- Orig date:
Fri Aug 2 17:39:43 2002
diff -urN linux-2.4.19/arch/mips/ddb5xxx/ddb5477/pci.c linux-2.4.20/arch/mips/ddb5xxx/ddb5477/pci.c
@@ -11,36 +11,38 @@
*
*/
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/pci.h>
+#include <asm/bootinfo.h>
#include <asm/pci_channel.h>
#include <asm/debug.h>
#include <asm/ddb5xxx/ddb5xxx.h>
static struct resource extpci_io_resource = {
- "ext pci IO space",
- DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE,
+ "ext pci IO space",
+ DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + 0x4000,
DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI0_IO_SIZE -1,
IORESOURCE_IO};
static struct resource extpci_mem_resource = {
- "ext pci memory space",
- DDB_PCI0_MEM_BASE,
+ "ext pci memory space",
+ DDB_PCI0_MEM_BASE + 0x100000,
DDB_PCI0_MEM_BASE + DDB_PCI0_MEM_SIZE -1,
IORESOURCE_MEM};
static struct resource iopci_io_resource = {
- "io pci IO space",
+ "io pci IO space",
DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE,
DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI1_IO_SIZE -1,
IORESOURCE_IO};
static struct resource iopci_mem_resource = {
- "ext pci memory space",
+ "ext pci memory space",
DDB_PCI1_MEM_BASE,
DDB_PCI1_MEM_BASE + DDB_PCI1_MEM_SIZE -1,
IORESOURCE_MEM};
@@ -59,79 +61,108 @@
* we fix up irqs based on the slot number.
* The first entry is at AD:11.
* Fortunately this works because, although we have two pci buses,
- * they all have different slot numbers.
- *
- * This does not work for devices on sub-buses.
+ * they all have different slot numbers (except for rockhopper slot 20
+ * which is handled below).
*
- * Note that the irq number in the array is relative number in vrc5477.
- * We need to translate it to global irq number.
*/
/*
- * irq mapping : PCI int # -> vrc5477 irq #
- * based on vrc5477 manual page 46
- */
-#define PCI_EXT_INTA 8
-#define PCI_EXT_INTB 9
-#define PCI_EXT_INTC 10
-#define PCI_EXT_INTD 11
-#define PCI_EXT_INTE 12
-
-#define PCI_IO_INTA 16
-#define PCI_IO_INTB 17
-#define PCI_IO_INTC 18
-#define PCI_IO_INTD 19
-
-/*
- * irq mapping : device -> pci int #,
+ * irq mapping : device -> pci int # -> vrc4377 irq# ,
* ddb5477 board manual page 4 and vrc5477 manual page 46
*/
-#define INT_ONBOARD_TULIP PCI_EXT_INTA
-#define INT_SLOT1 PCI_EXT_INTB
-#define INT_SLOT2 PCI_EXT_INTC
-#define INT_SLOT3 PCI_EXT_INTD
-#define INT_SLOT4 PCI_EXT_INTE
-
-#define INT_USB_HOST PCI_IO_INTA
-#define INT_USB_PERI PCI_IO_INTB
-#define INT_AC97 PCI_IO_INTC
/*
* based on ddb5477 manual page 11
*/
#define MAX_SLOT_NUM 21
static unsigned char irq_map[MAX_SLOT_NUM] = {
- /* AD:11 */ 0xff, 0xff, 0xff, 0xff,
- /* AD:15 */ INT_ONBOARD_TULIP, INT_SLOT1, INT_SLOT2, INT_SLOT3,
- /* AD:19 */ INT_SLOT4, 0xff, 0xff, 0xff,
- /* AD:23 */ 0xff, 0xff, 0xff, 0xff,
- /* AD:27 */ 0xff, 0xff, INT_AC97, INT_USB_PERI,
- /* AD:31 */ INT_USB_HOST
+ /* SLOT: 0, AD:11 */ 0xff,
+ /* SLOT: 1, AD:12 */ 0xff,
+ /* SLOT: 2, AD:13 */ 0xff,
+ /* SLOT: 3, AD:14 */ 0xff,
+ /* SLOT: 4, AD:15 */ VRC5477_IRQ_INTA, /* onboard tulip */
+ /* SLOT: 5, AD:16 */ VRC5477_IRQ_INTB, /* slot 1 */
+ /* SLOT: 6, AD:17 */ VRC5477_IRQ_INTC, /* slot 2 */
+ /* SLOT: 7, AD:18 */ VRC5477_IRQ_INTD, /* slot 3 */
+ /* SLOT: 8, AD:19 */ VRC5477_IRQ_INTE, /* slot 4 */
+ /* SLOT: 9, AD:20 */ 0xff,
+ /* SLOT: 10, AD:21 */ 0xff,
+ /* SLOT: 11, AD:22 */ 0xff,
+ /* SLOT: 12, AD:23 */ 0xff,
+ /* SLOT: 13, AD:24 */ 0xff,
+ /* SLOT: 14, AD:25 */ 0xff,
+ /* SLOT: 15, AD:26 */ 0xff,
+ /* SLOT: 16, AD:27 */ 0xff,
+ /* SLOT: 17, AD:28 */ 0xff,
+ /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */
+ /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */
+ /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */
+};
+static unsigned char rockhopperII_irq_map[MAX_SLOT_NUM] = {
+ /* SLOT: 0, AD:11 */ 0xff,
+ /* SLOT: 1, AD:12 */ VRC5477_IRQ_INTB, /* onboard AMD PCNET */
+ /* SLOT: 2, AD:13 */ 0xff,
+ /* SLOT: 3, AD:14 */ 0xff,
+ /* SLOT: 4, AD:15 */ 14, /* M5229 ide ISA irq */
+ /* SLOT: 5, AD:16 */ VRC5477_IRQ_INTD, /* slot 3 */
+ /* SLOT: 6, AD:17 */ VRC5477_IRQ_INTA, /* slot 4 */
+ /* SLOT: 7, AD:18 */ VRC5477_IRQ_INTD, /* slot 5 */
+ /* SLOT: 8, AD:19 */ 0, /* M5457 modem nop */
+ /* SLOT: 9, AD:20 */ VRC5477_IRQ_INTA, /* slot 2 */
+ /* SLOT: 10, AD:21 */ 0xff,
+ /* SLOT: 11, AD:22 */ 0xff,
+ /* SLOT: 12, AD:23 */ 0xff,
+ /* SLOT: 13, AD:24 */ 0xff,
+ /* SLOT: 14, AD:25 */ 0xff,
+ /* SLOT: 15, AD:26 */ 0xff,
+ /* SLOT: 16, AD:27 */ 0xff,
+ /* SLOT: 17, AD:28 */ 0, /* M7101 PMU nop */
+ /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */
+ /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */
+ /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */
};
-extern int vrc5477_irq_to_irq(int irq);
void __init pcibios_fixup_irqs(void)
{
struct pci_dev *dev;
int slot_num;
+ unsigned char *slot_irq_map;
+ unsigned char irq;
+
+ if (mips_machtype == MACH_NEC_ROCKHOPPERII)
+ slot_irq_map = rockhopperII_irq_map;
+ else
+ slot_irq_map = irq_map;
+
pci_for_each_dev(dev) {
slot_num = PCI_SLOT(dev->devfn);
-
- /* we don't do IRQ fixup for sub-bus yet */
- if (dev->bus->parent != NULL) {
- db_run(printk("Don't know how to fixup irq for PCI device %d on sub-bus %d\n",
- slot_num, dev->bus->number));
- continue;
- }
+ irq = slot_irq_map[slot_num];
db_assert(slot_num < MAX_SLOT_NUM);
- db_assert(irq_map[slot_num] != 0xff);
- pci_write_config_byte(dev,
+ db_assert(irq != 0xff);
+
+ pci_write_config_byte(dev,
PCI_INTERRUPT_LINE,
- irq_map[slot_num]);
- dev->irq = vrc5477_irq_to_irq(irq_map[slot_num]);
+ irq);
+
+ dev->irq = irq;
+
+ if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
+ /* hack to distinquish overlapping slot 20s, one
+ * on bus 0 (ALI USB on the M1535 on the backplane),
+ * and one on bus 2 (NEC USB controller on the CPU board)
+ * Make the M1535 USB - ISA IRQ number 9.
+ */
+ if (slot_num == 20 && dev->bus->number == 0) {
+ pci_write_config_byte(dev,
+ PCI_INTERRUPT_LINE,
+ 9);
+ dev->irq = 9;
+ }
+ }
+
}
}
@@ -139,8 +170,8 @@
extern void jsun_scan_pci_bus(void);
extern void jsun_assign_pci_resource(void);
#endif
-void __init ddb_pci_reset_bus(void)
-{
+void ddb_pci_reset_bus(void)
+{
u32 temp;
/*
@@ -175,5 +206,43 @@
void __init pcibios_fixup(void)
{
+ if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
+ struct pci_dev *dev;
+
+#define M1535_CONFIG_PORT 0x3f0
+#define M1535_INDEX_PORT 0x3f0
+#define M1535_DATA_PORT 0x3f1
+
+ printk("Configuring ALI M1535 Super I/O mouse irq.\n");
+
+ request_region(M1535_CONFIG_PORT, 2, "M1535 Super I/O config");
+
+ /* Enter config mode. */
+ outb(0x51, M1535_CONFIG_PORT);
+ outb(0x23, M1535_CONFIG_PORT);
+
+ /* Select device 0x07. */
+ outb(0x07, M1535_INDEX_PORT);
+ outb(0x07, M1535_DATA_PORT);
+
+ /* Set mouse irq (register 0x72) to 12. */
+ outb(0x72, M1535_INDEX_PORT);
+ outb(0x0c, M1535_DATA_PORT);
+
+ /* Exit config mode. */
+ outb(0xbb, M1535_CONFIG_PORT);
+
+ pci_for_each_dev(dev) {
+ if(dev->vendor == PCI_VENDOR_ID_AL)
+ if(dev->device == PCI_DEVICE_ID_AL_M1535
+ || dev->device == PCI_DEVICE_ID_AL_M1533) {
+ u8 old;
+ printk("Enabling ALI M1533/35 PS2 keyboard/mouse.\n");
+ pci_read_config_byte(dev, 0x41, &old);
+ pci_write_config_byte(dev, 0x41, old | 0xd0);
+ }
+ }
+
+ }
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)