sc520: Board Specific PCI Init
authorGraeme Russ <graeme.russ@gmail.com>
Fri, 23 Apr 2010 14:05:54 +0000 (00:05 +1000)
committerWolfgang Denk <wd@denx.de>
Wed, 5 May 2010 22:18:52 +0000 (00:18 +0200)
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
arch/i386/cpu/sc520/sc520_pci.c
arch/i386/include/asm/ic/pci.h
board/eNET/eNET_pci.c

index ee7e720188dd7a8a8111f6310e814b82dd903c1c..b91773435e9a8b23ee7e2d6ccc2af4e861e0a7a3 100644 (file)
@@ -27,6 +27,7 @@
 #include <pci.h>
 #include <asm/io.h>
 #include <asm/pci.h>
+#include <asm/ic/pci.h>
 #include <asm/ic/sc520.h>
 
 static struct {
@@ -124,43 +125,7 @@ void pci_sc520_init(struct pci_controller *hose)
 {
        hose->first_busno = 0;
        hose->last_busno = 0xff;
-
-       /* System memory space */
-       pci_set_region(hose->regions + 0,
-                      SC520_PCI_MEMORY_BUS,
-                      SC520_PCI_MEMORY_PHYS,
-                      SC520_PCI_MEMORY_SIZE,
-                      PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
-
-       /* PCI memory space */
-       pci_set_region(hose->regions + 1,
-                      SC520_PCI_MEM_BUS,
-                      SC520_PCI_MEM_PHYS,
-                      SC520_PCI_MEM_SIZE,
-                      PCI_REGION_MEM);
-
-       /* ISA/PCI memory space */
-       pci_set_region(hose->regions + 2,
-                      SC520_ISA_MEM_BUS,
-                      SC520_ISA_MEM_PHYS,
-                      SC520_ISA_MEM_SIZE,
-                      PCI_REGION_MEM);
-
-       /* PCI I/O space */
-       pci_set_region(hose->regions + 3,
-                      SC520_PCI_IO_BUS,
-                      SC520_PCI_IO_PHYS,
-                      SC520_PCI_IO_SIZE,
-                      PCI_REGION_IO);
-
-       /* ISA/PCI I/O space */
-       pci_set_region(hose->regions + 4,
-                      SC520_ISA_IO_BUS,
-                      SC520_ISA_IO_PHYS,
-                      SC520_ISA_IO_SIZE,
-                      PCI_REGION_IO);
-
-       hose->region_count = 5;
+       hose->region_count = pci_set_regions(hose);
 
        pci_setup_type1(hose,
                        SC520_REG_ADDR,
index 1a35f3492d16b33050443e84c349c979c194e3c9..2e4376b9b0383ea66bc7bf706b6a260ec07748ee 100644 (file)
@@ -73,6 +73,7 @@
 extern int sc520_pci_ints[];
 
 void pci_sc520_init(struct pci_controller *hose);
+int pci_set_regions(struct pci_controller *hose);
 int pci_sc520_set_irq(int pci_pin, int irq);
 
 #endif
index e80a8feb162b7eb019afb72bac60db319f13335a..fefb1a4fbeb1efdbe4129f5e482c68d3b2f56165 100644 (file)
@@ -93,3 +93,36 @@ void pci_init_board(void)
 {
        pci_sc520_init(&enet_hose);
 }
+
+int pci_set_regions(struct pci_controller *hose)
+{
+       /* System memory space */
+       pci_set_region(hose->regions + 0,
+                      SC520_PCI_MEMORY_BUS,
+                      SC520_PCI_MEMORY_PHYS,
+                      SC520_PCI_MEMORY_SIZE,
+                      PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
+
+       /* ISA/PCI memory space */
+       pci_set_region(hose->regions + 1,
+                      SC520_ISA_MEM_BUS,
+                      SC520_ISA_MEM_PHYS,
+                      SC520_ISA_MEM_SIZE,
+                      PCI_REGION_MEM);
+
+       /* PCI I/O space */
+       pci_set_region(hose->regions + 2,
+                      SC520_PCI_IO_BUS,
+                      SC520_PCI_IO_PHYS,
+                      SC520_PCI_IO_SIZE,
+                      PCI_REGION_IO);
+
+       /* ISA/PCI I/O space */
+       pci_set_region(hose->regions + 3,
+                      SC520_ISA_IO_BUS,
+                      SC520_ISA_IO_PHYS,
+                      SC520_ISA_IO_SIZE,
+                      PCI_REGION_IO);
+
+       return 4;
+}