Commit e3c33e3b authored by Russell King's avatar Russell King

[ARM] Clean up ARM PCI support (bios32.c)

Eliminate have_isa_bridge - use isa_bridge instead.
Clean up PCI bus walking.
Clean up detection of fast back to back capability.
Ensure we set the bridge control register appropriately.
Pin swizzle functions are never called with pin == 0.
parent 25e9b4db
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
static int debug_pci; static int debug_pci;
int have_isa_bridge;
void pcibios_report_status(u_int status_mask, int warn) void pcibios_report_status(u_int status_mask, int warn)
{ {
...@@ -363,9 +362,8 @@ pbus_assign_bus_resources(struct pci_bus *bus, struct pci_sys_data *root) ...@@ -363,9 +362,8 @@ pbus_assign_bus_resources(struct pci_bus *bus, struct pci_sys_data *root)
void __devinit pcibios_fixup_bus(struct pci_bus *bus) void __devinit pcibios_fixup_bus(struct pci_bus *bus)
{ {
struct pci_sys_data *root = bus->sysdata; struct pci_sys_data *root = bus->sysdata;
struct list_head *walk; struct pci_dev *dev;
u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY; u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK;
u16 all_status = -1;
pbus_assign_bus_resources(bus, root); pbus_assign_bus_resources(bus, root);
...@@ -373,42 +371,43 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus) ...@@ -373,42 +371,43 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
* Walk the devices on this bus, working out what we can * Walk the devices on this bus, working out what we can
* and can't support. * and can't support.
*/ */
for (walk = bus->devices.next; walk != &bus->devices; walk = walk->next) { list_for_each_entry(dev, &bus->devices, bus_list) {
struct pci_dev *dev = pci_dev_b(walk);
u16 status; u16 status;
pdev_fixup_device_resources(root, dev); pdev_fixup_device_resources(root, dev);
pci_read_config_word(dev, PCI_STATUS, &status); pci_read_config_word(dev, PCI_STATUS, &status);
all_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)) if (pdev_bad_for_parity(dev))
features &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY); features &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
/* switch (dev->class >> 8) {
* If this device is an ISA bridge, set the have_isa_bridge #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
* flag. We will then go looking for things like keyboard, case PCI_CLASS_BRIDGE_ISA:
* etc case PCI_CLASS_BRIDGE_EISA:
*/ /*
if (dev->class >> 8 == PCI_CLASS_BRIDGE_ISA || * If this device is an ISA bridge, set isa_bridge
dev->class >> 8 == PCI_CLASS_BRIDGE_EISA) * to point at this device. We will then go looking
have_isa_bridge = !0; * for things like keyboard, etc.
*/
isa_bridge = dev;
break;
#endif
} }
/*
* 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 (all_status & PCI_STATUS_FAST_BACK)
features |= PCI_COMMAND_FAST_BACK;
/* /*
* Now walk the devices again, this time setting them up. * Now walk the devices again, this time setting them up.
*/ */
for (walk = bus->devices.next; walk != &bus->devices; walk = walk->next) { list_for_each_entry(dev, &bus->devices, bus_list) {
struct pci_dev *dev = pci_dev_b(walk);
u16 cmd; u16 cmd;
pci_read_config_word(dev, PCI_COMMAND, &cmd); pci_read_config_word(dev, PCI_COMMAND, &cmd);
...@@ -416,7 +415,17 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus) ...@@ -416,7 +415,17 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
pci_write_config_word(dev, PCI_COMMAND, cmd); pci_write_config_word(dev, PCI_COMMAND, cmd);
pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
SMP_CACHE_BYTES >> 2); L1_CACHE_BYTES >> 2);
}
/*
* Propagate the flags to the PCI bridge.
*/
if (bus->self && bus->self->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
if (features & PCI_COMMAND_FAST_BACK)
bus->bridge_ctl |= PCI_BRIDGE_CTL_FAST_BACK;
if (features & PCI_COMMAND_PARITY)
bus->bridge_ctl |= PCI_BRIDGE_CTL_PARITY;
} }
/* /*
...@@ -454,20 +463,17 @@ pcibios_fixup_pbus_ranges(struct pci_bus *bus, struct pbus_set_ranges_data *rang ...@@ -454,20 +463,17 @@ pcibios_fixup_pbus_ranges(struct pci_bus *bus, struct pbus_set_ranges_data *rang
*/ */
u8 __devinit pci_std_swizzle(struct pci_dev *dev, u8 *pinp) u8 __devinit pci_std_swizzle(struct pci_dev *dev, u8 *pinp)
{ {
int pin = *pinp; int pin = *pinp - 1;
if (pin != 0) { while (dev->bus->self) {
pin -= 1; pin = (pin + PCI_SLOT(dev->devfn)) & 3;
while (dev->bus->self) { /*
pin = (pin + PCI_SLOT(dev->devfn)) & 3; * move up the chain of bridges,
/* * swizzling as we go.
* move up the chain of bridges, */
* swizzling as we go. dev = dev->bus->self;
*/
dev = dev->bus->self;
}
*pinp = pin + 1;
} }
*pinp = pin + 1;
return PCI_SLOT(dev->devfn); return PCI_SLOT(dev->devfn);
} }
......
...@@ -14,16 +14,6 @@ extern unsigned int system_serial_low; ...@@ -14,16 +14,6 @@ extern unsigned int system_serial_low;
extern unsigned int system_serial_high; extern unsigned int system_serial_high;
extern unsigned int mem_fclk_21285; extern unsigned int mem_fclk_21285;
/*
* This tells us if we have an ISA bridge
* present in a PCI system.
*/
#ifdef CONFIG_PCI
extern int have_isa_bridge;
#else
#define have_isa_bridge (0)
#endif
struct pt_regs; struct pt_regs;
void die(const char *msg, struct pt_regs *regs, int err) void die(const char *msg, struct pt_regs *regs, int err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment