pci/fsl_pci_init: Fold pci_setup_indirect into fsl_pci_init
[oweals/u-boot.git] / board / tqc / tqm85xx / tqm85xx.c
index 3a828edc1ad2667962fc3145b3fb80d75251b74c..07a6db3b8dda729ba625b3d06f3164f976479997 100644 (file)
@@ -36,7 +36,7 @@
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/immap_85xx.h>
-#include <asm/immap_fsl_pci.h>
+#include <asm/fsl_pci.h>
 #include <asm/io.h>
 #include <ioports.h>
 #include <flash.h>
@@ -315,8 +315,7 @@ int misc_init_r (void)
 
        /* Monitor protection ON by default */
        flash_protect (FLAG_PROTECT_SET,
-                      CONFIG_SYS_MONITOR_BASE,
-                      CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1,
+                      CONFIG_SYS_MONITOR_BASE, 0xffffffff,
                       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 
        /* Environment protection ON by default */
@@ -329,7 +328,7 @@ int misc_init_r (void)
        /* Redundant environment protection ON by default */
        flash_protect (FLAG_PROTECT_SET,
                       CONFIG_ENV_ADDR_REDUND,
-                      CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SIZE_REDUND - 1,
+                      CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
                       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 #endif
 
@@ -361,7 +360,7 @@ uint get_lbc_clock (void)
 {
        volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
        sys_info_t sys_info;
-       ulong clkdiv = lbc->lcrr & 0x0f;
+       ulong clkdiv = lbc->lcrr & LCRR_CLKDIV;
 
        get_sys_info (&sys_info);
 
@@ -538,12 +537,9 @@ void local_bus_init (void)
  */
 static int first_free_busno;
 
-extern int fsl_pci_setup_inbound_windows(struct pci_region *r);
-extern void fsl_pci_init(struct pci_controller *hose);
-
-#if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
+#ifdef CONFIG_PCI1
 static struct pci_controller pci1_hose;
-#endif /* CONFIG_PCI || CONFIG_PCI1 */
+#endif /* CONFIG_PCI1 */
 
 #ifdef CONFIG_PCIE1
 static struct pci_controller pcie1_hose;
@@ -552,7 +548,7 @@ static struct pci_controller pcie1_hose;
 static inline void init_pci1(void)
 {
        volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-#if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
+#ifdef CONFIG_PCI1
        uint host_agent = (gur->porbmsr & MPC85xx_PORBMSR_HA) >> 16;
        volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)CONFIG_SYS_PCI1_ADDR;
        struct pci_controller *hose = &pci1_hose;
@@ -600,17 +596,15 @@ static inline void init_pci1(void)
                hose->region_count = r - hose->regions;
 
                hose->first_busno = first_free_busno;
-               pci_setup_indirect (hose, (int)&pci->cfg_addr,
-                                   (int)&pci->cfg_data);
 
-               fsl_pci_init (hose);
+               fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
                printf ("       PCI on bus %02x..%02x\n",
                        hose->first_busno, hose->last_busno);
 
                first_free_busno = hose->last_busno + 1;
 #ifdef CONFIG_PCIX_CHECK
-               if (!(gur->pordevsr & PORDEVSR_PCI)) {
+               if (!(gur->pordevsr & MPC85xx_PORDEVSR_PCI1)) {
                        ushort reg16 =
                                PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ |
                                PCI_X_CMD_ERO | PCI_X_CMD_DPERR_E;
@@ -627,9 +621,9 @@ static inline void init_pci1(void)
        } else {
                puts ("PCI1:  disabled\n");
        }
-#else /* !(CONFIG_PCI || CONFIG_PCI1) */
+#else /* !CONFIG_PCI1 */
        gur->devdisr |= MPC85xx_DEVDISR_PCI1; /* disable */
-#endif /* CONFIG_PCI || CONFIG_PCI1) */
+#endif /* CONFIG_PCI1 */
 }
 
 static inline void init_pcie1(void)
@@ -677,10 +671,8 @@ static inline void init_pcie1(void)
                hose->region_count = r - hose->regions;
 
                hose->first_busno = first_free_busno;
-               pci_setup_indirect(hose, (int)&pci->cfg_addr,
-                                  (int)&pci->cfg_data);
 
-               fsl_pci_init (hose);
+               fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
                printf ("       PCIe on bus %02x..%02x\n",
                        hose->first_busno, hose->last_busno);
 
@@ -701,14 +693,11 @@ void pci_init_board (void)
 }
 
 #ifdef CONFIG_OF_BOARD_SETUP
-extern void ft_fsl_pci_setup(void *blob, const char *pci_alias,
-                       struct pci_controller *hose);
-
 void ft_board_setup (void *blob, bd_t *bd)
 {
        ft_cpu_setup (blob, bd);
 
-#if defined(CONFIG_PCI) || defined(CONFIG_PCI1)
+#ifdef CONFIG_PCI1
        ft_fsl_pci_setup(blob, "pci0", &pci1_hose);
 #endif
 #ifdef CONFIG_PCIE1