[PATCH 04/12] MIPS: PCI: Add BRIDGE 'pre_enable' hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Joshua Kinard <kumba@xxxxxxxxxx>

Add a hook for a 'pre_enable' function in struct pci_controller in
arch/mips/include/asm/pci.h and arch/mips/pci/pci-legacy.c.  This is
used to do any needed housekeeping on the BRIDGE/XBRIDGE ASICs prior
to PCI detection, such setting up DevIO windows or applying any known
BRIDGE WARs.  This change originates from the earliest days of the
IP30 patchset by Stanislaw Skowronek.

Signed-off-by: Joshua Kinard <kumba@xxxxxxxxxx>
Cc: Stanislaw Skowronek <skylark@xxxxxxxxxxxxx>
---
 arch/mips/include/asm/pci.h |  3 +++
 arch/mips/pci/pci-legacy.c  | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 30d1129d8624..0f1e381a79e3 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -48,6 +48,9 @@ struct pci_controller {
 	unsigned int need_domain_info;
 #endif
 
+	/* BRIDGE/XBRIDGE may need to config things before bringup */
+	int (*pre_enable)(struct pci_controller *, struct pci_dev *, int);
+
 	/* Optional access methods for reading/writing the bus number
 	   of the PCI controller */
 	int (*get_busno)(void);
diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c
index 98f36ed8f7da..68268bbb15b8 100644
--- a/arch/mips/pci/pci-legacy.c
+++ b/arch/mips/pci/pci-legacy.c
@@ -7,6 +7,7 @@
  * Copyright (C) 2003, 04, 11 Ralf Baechle (ralf@xxxxxxxxxxxxxx)
  * Copyright (C) 2011 Wind River Systems,
  *   written by Ralf Baechle (ralf@xxxxxxxxxxxxxx)
+ * Copyright (C) 2004-2007 Stanislaw Skowronek <skylark@xxxxxxxxxxxxx>
  */
 #include <linux/bug.h>
 #include <linux/kernel.h>
@@ -232,6 +233,7 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
 	u16 cmd, old_cmd;
 	int idx;
 	struct resource *r;
+	struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
 
 	pci_read_config_word(dev, PCI_COMMAND, &cmd);
 	old_cmd = cmd;
@@ -240,6 +242,15 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
 		if (!(mask & (1 << idx)))
 			continue;
 
+		/*
+		 * Some devices, like BRIDGE/XBRIDGE, may need to do a little
+		 * housekeeping prior to the generic code setting up the PCI
+		 * resources.
+		 */
+		if (hose->pre_enable)
+			if (hose->pre_enable(hose, dev, idx) < 0)
+				return -EINVAL;
+
 		r = &dev->resource[idx];
 		if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
 			continue;
-- 
2.11.1





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux