|
@@ -176,3 +176,175 @@ static void pci_fixup_ide_bases(struct pci_dev *dev)
|
|
|
r->end = r->start;
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_ide_bases);
|
|
|
+
|
|
|
+/*
|
|
|
+ * Put the DEC21142 to sleep
|
|
|
+ */
|
|
|
+static void pci_fixup_dec21142(struct pci_dev *dev)
|
|
|
+{
|
|
|
+ pci_write_config_dword(dev, 0x40, 0x80000000);
|
|
|
+}
|
|
|
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, pci_fixup_dec21142);
|
|
|
+
|
|
|
+/*
|
|
|
+ * The CY82C693 needs some rather major fixups to ensure that it does
|
|
|
+ * the right thing. Idea from the Alpha people, with a few additions.
|
|
|
+ *
|
|
|
+ * We ensure that the IDE base registers are set to 1f0/3f4 for the
|
|
|
+ * primary bus, and 170/374 for the secondary bus. Also, hide them
|
|
|
+ * from the PCI subsystem view as well so we won't try to perform
|
|
|
+ * our own auto-configuration on them.
|
|
|
+ *
|
|
|
+ * In addition, we ensure that the PCI IDE interrupts are routed to
|
|
|
+ * IRQ 14 and IRQ 15 respectively.
|
|
|
+ *
|
|
|
+ * The above gets us to a point where the IDE on this device is
|
|
|
+ * functional. However, The CY82C693U _does not work_ in bus
|
|
|
+ * master mode without locking the PCI bus solid.
|
|
|
+ */
|
|
|
+static void pci_fixup_cy82c693(struct pci_dev *dev)
|
|
|
+{
|
|
|
+ if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
|
|
|
+ u32 base0, base1;
|
|
|
+
|
|
|
+ if (dev->class & 0x80) { /* primary */
|
|
|
+ base0 = 0x1f0;
|
|
|
+ base1 = 0x3f4;
|
|
|
+ } else { /* secondary */
|
|
|
+ base0 = 0x170;
|
|
|
+ base1 = 0x374;
|
|
|
+ }
|
|
|
+
|
|
|
+ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0,
|
|
|
+ base0 | PCI_BASE_ADDRESS_SPACE_IO);
|
|
|
+ pci_write_config_dword(dev, PCI_BASE_ADDRESS_1,
|
|
|
+ base1 | PCI_BASE_ADDRESS_SPACE_IO);
|
|
|
+
|
|
|
+ dev->resource[0].start = 0;
|
|
|
+ dev->resource[0].end = 0;
|
|
|
+ dev->resource[0].flags = 0;
|
|
|
+
|
|
|
+ dev->resource[1].start = 0;
|
|
|
+ dev->resource[1].end = 0;
|
|
|
+ dev->resource[1].flags = 0;
|
|
|
+ } else if (PCI_FUNC(dev->devfn) == 0) {
|
|
|
+ /*
|
|
|
+ * Setup IDE IRQ routing.
|
|
|
+ */
|
|
|
+ pci_write_config_byte(dev, 0x4b, 14);
|
|
|
+ pci_write_config_byte(dev, 0x4c, 15);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Disable FREQACK handshake, enable USB.
|
|
|
+ */
|
|
|
+ pci_write_config_byte(dev, 0x4d, 0x41);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Enable PCI retry, and PCI post-write buffer.
|
|
|
+ */
|
|
|
+ pci_write_config_byte(dev, 0x44, 0x17);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Enable ISA master and DMA post write buffering.
|
|
|
+ */
|
|
|
+ pci_write_config_byte(dev, 0x45, 0x03);
|
|
|
+ }
|
|
|
+}
|
|
|
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693);
|
|
|
+
|
|
|
+static void pci_fixup_it8152(struct pci_dev *dev)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+ /* fixup for ITE 8152 devices */
|
|
|
+ /* FIXME: add defines for class 0x68000 and 0x80103 */
|
|
|
+ if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
|
|
|
+ dev->class == 0x68000 ||
|
|
|
+ dev->class == 0x80103) {
|
|
|
+ for (i = 0; i < PCI_NUM_RESOURCES; i++) {
|
|
|
+ dev->resource[i].start = 0;
|
|
|
+ dev->resource[i].end = 0;
|
|
|
+ dev->resource[i].flags = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8152, pci_fixup_it8152);
|
|
|
+
|
|
|
+/*
|
|
|
+ * If the bus contains any of these devices, then we must not turn on
|
|
|
+ * parity checking of any kind. Currently this is CyberPro 20x0 only.
|
|
|
+ */
|
|
|
+static inline int pdev_bad_for_parity(struct pci_dev *dev)
|
|
|
+{
|
|
|
+ return ((dev->vendor == PCI_VENDOR_ID_INTERG &&
|
|
|
+ (dev->device == PCI_DEVICE_ID_INTERG_2000 ||
|
|
|
+ dev->device == PCI_DEVICE_ID_INTERG_2010)) ||
|
|
|
+ (dev->vendor == PCI_VENDOR_ID_ITE &&
|
|
|
+ dev->device == PCI_DEVICE_ID_ITE_8152));
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+ * pcibios_fixup_bus - Called after each bus is probed,
|
|
|
+ * but before its children are examined.
|
|
|
+ */
|
|
|
+void pcibios_fixup_bus(struct pci_bus *bus)
|
|
|
+{
|
|
|
+ struct pci_dev *dev;
|
|
|
+ u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Walk the devices on this bus, working out what we can
|
|
|
+ * and can't support.
|
|
|
+ */
|
|
|
+ list_for_each_entry(dev, &bus->devices, bus_list) {
|
|
|
+ u16 status;
|
|
|
+
|
|
|
+ pci_read_config_word(dev, PCI_STATUS, &status);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * If any device on this bus does not support fast back
|
|
|
+ * to back transfers, then the bus as a whole is not able
|
|
|
+ * to support them. Having fast back to back transfers
|
|
|
+ * on saves us one PCI cycle per transaction.
|
|
|
+ */
|
|
|
+ if (!(status & PCI_STATUS_FAST_BACK))
|
|
|
+ features &= ~PCI_COMMAND_FAST_BACK;
|
|
|
+
|
|
|
+ if (pdev_bad_for_parity(dev))
|
|
|
+ features &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
|
|
|
+
|
|
|
+ switch (dev->class >> 8) {
|
|
|
+ case PCI_CLASS_BRIDGE_PCI:
|
|
|
+ pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &status);
|
|
|
+ status |= PCI_BRIDGE_CTL_PARITY|PCI_BRIDGE_CTL_MASTER_ABORT;
|
|
|
+ status &= ~(PCI_BRIDGE_CTL_BUS_RESET|PCI_BRIDGE_CTL_FAST_BACK);
|
|
|
+ pci_write_config_word(dev, PCI_BRIDGE_CONTROL, status);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case PCI_CLASS_BRIDGE_CARDBUS:
|
|
|
+ pci_read_config_word(dev, PCI_CB_BRIDGE_CONTROL, &status);
|
|
|
+ status |= PCI_CB_BRIDGE_CTL_PARITY|PCI_CB_BRIDGE_CTL_MASTER_ABORT;
|
|
|
+ pci_write_config_word(dev, PCI_CB_BRIDGE_CONTROL, status);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Now walk the devices again, this time setting them up.
|
|
|
+ */
|
|
|
+ list_for_each_entry(dev, &bus->devices, bus_list) {
|
|
|
+ u16 cmd;
|
|
|
+
|
|
|
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
|
|
+ cmd |= features;
|
|
|
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
|
|
|
+
|
|
|
+ pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
|
|
|
+ L1_CACHE_BYTES >> 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Propagate the flags to the PCI bridge.
|
|
|
+ */
|