]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mpc83xx: Split PIB init code from pci.c and add Qoc3 ATM card support
authorTony Li <tony.li@freescale.com>
Fri, 17 Aug 2007 02:35:59 +0000 (10:35 +0800)
committerKim Phillips <kim.phillips@freescale.com>
Fri, 17 Aug 2007 04:12:11 +0000 (23:12 -0500)
The patch split the PIB init code from pci.c to a single file board/freescale/common/pq-mds-pib.c
And add Qoc3 ATM card support for MPC8360EMDS and MPC832XEMDS board.

Signed-off-by Tony Li <tony.li@freescale.com>

board/freescale/common/pq-mds-pib.c [new file with mode: 0644]
board/freescale/common/pq-mds-pib.h [new file with mode: 0644]
board/mpc832xemds/Makefile
board/mpc832xemds/mpc832xemds.c
board/mpc832xemds/pci.c
board/mpc8360emds/Makefile
board/mpc8360emds/mpc8360emds.c
board/mpc8360emds/pci.c
include/configs/MPC832XEMDS.h
include/configs/MPC8360EMDS.h

diff --git a/board/freescale/common/pq-mds-pib.c b/board/freescale/common/pq-mds-pib.c
new file mode 100644 (file)
index 0000000..9799117
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc.
+ *
+ * Tony Li <tony.li@freescale.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <asm/io.h>
+
+#include "pq-mds-pib.h"
+
+int pib_init(void)
+{
+       u8 val8;
+       u8 orig_i2c_bus;
+
+       /* Switch temporarily to I2C bus #2 */
+       orig_i2c_bus = i2c_get_bus_num();
+       i2c_set_bus_num(1);
+#if defined(CONFIG_PCI) && !defined(CONFIG_PCISLAVE)
+       /* Assign PIB PMC slot to desired PCI bus */
+       val8 = 0;
+       i2c_write(0x23, 0x6, 1, &val8, 1);
+       i2c_write(0x23, 0x7, 1, &val8, 1);
+       val8 = 0xff;
+       i2c_write(0x23, 0x2, 1, &val8, 1);
+       i2c_write(0x23, 0x3, 1, &val8, 1);
+
+       val8 = 0;
+       i2c_write(0x26, 0x6, 1, &val8, 1);
+       val8 = 0x34;
+       i2c_write(0x26, 0x7, 1, &val8, 1);
+#if defined(CONFIG_MPC832XEMDS)
+       val8 = 0xf9;            /* PMC2, PMC3 slot to PCI bus */
+#else
+       val8 = 0xf3;            /* PMC1, PMC2, PMC3 slot to PCI bus */
+#endif
+       i2c_write(0x26, 0x2, 1, &val8, 1);
+       val8 = 0xff;
+       i2c_write(0x26, 0x3, 1, &val8, 1);
+
+       val8 = 0;
+       i2c_write(0x27, 0x6, 1, &val8, 1);
+       i2c_write(0x27, 0x7, 1, &val8, 1);
+       val8 = 0xff;
+       i2c_write(0x27, 0x2, 1, &val8, 1);
+       val8 = 0xef;
+       i2c_write(0x27, 0x3, 1, &val8, 1);
+
+       eieio();
+
+#if defined(CONFIG_MPC832XEMDS)
+       printf("PCI 32bit bus on PMC2 &PMC3\n");
+#else
+       printf("PCI 32bit bus on PMC1 & PMC2 &PMC3\n");
+#endif
+#endif
+
+#if defined(CONFIG_PQ_MDS_PIB_ATM)
+#if defined(CONFIG_MPC8360EMDS)
+       val8 = 0;
+       i2c_write(0x20, 0x6, 1, &val8, 1);
+       i2c_write(0x20, 0x7, 1, &val8, 1);
+
+       val8 = 0xdf;
+       i2c_write(0x20, 0x2, 1, &val8, 1);
+       val8 = 0xf7;
+       i2c_write(0x20, 0x3, 1, &val8, 1);
+
+       eieio();
+
+       printf("QOC3 ATM card on PMC0\n");
+#elif defined(CONFIG_MPC832XEMDS)
+       val = 0;
+       i2c_write(0x26, 0x7, 1, &val, 1);
+       val = 0xf7;
+       i2c_write(0x26, 0x3, 1, &val, 1);
+
+       val = 0;
+       i2c_write(0x21, 0x6, 1, &val, 1);
+       i2c_write(0x21, 0x7, 1, &val, 1);
+
+       val = 0xdf;
+       i2c_write(0x21, 0x2, 1, &val, 1);
+       val = 0xef;
+       i2c_write(0x21, 0x3, 1, &val, 1);
+
+       eieio();
+
+       printf("QOC3 ATM card on PMC1\n");
+#endif
+#endif
+       /* Reset to original I2C bus */
+       i2c_set_bus_num(orig_i2c_bus);
+       return 0;
+}
diff --git a/board/freescale/common/pq-mds-pib.h b/board/freescale/common/pq-mds-pib.h
new file mode 100644 (file)
index 0000000..67066fd
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ */
+
+extern int pib_init(void);
index 5ec7a871d4dbbc82e79adc409265d1f62b9877b9..4da74b8277e9612268a0627326e7ded1f19d9058 100644 (file)
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
-COBJS  := $(BOARD).o pci.o
+COBJS  := $(BOARD).o pci.o ../freescale/common/pq-mds-pib.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
index f70783e73ab3b0e9b72e4d160c829e4c58addaba..207fcdf8be3853d287a38fefa6d1960e1563c22b 100644 (file)
@@ -32,6 +32,9 @@
 #elif defined(CONFIG_OF_LIBFDT)
 #include <libfdt.h>
 #endif
+#if defined(CONFIG_PQ_MDS_PIB)
+#include "../freescale/common/pq-mds-pib.h"
+#endif
 
 const qe_iop_conf_t qe_iop_conf_tab[] = {
        /* ETH3 */
@@ -88,6 +91,14 @@ int board_early_init_f(void)
        return 0;
 }
 
+int board_early_init_r(void)
+{
+#ifdef CONFIG_PQ_MDS_PIB
+       pib_init();
+#endif
+       return 0;
+}
+
 int fixed_sdram(void);
 
 long int initdram(int board_type)
index c2f61ea6ad72626b102e0f8ff43589015cb6c72a..6bc35c70f2d4fff16c663021e53d1303a7310d81 100644 (file)
@@ -131,7 +131,6 @@ void pci_init_board(void)
        volatile pcictrl83xx_t *pci_ctrl;
        volatile pciconf83xx_t *pci_conf;
 
-       u8 val8, orig_i2c_bus;
        u16 reg16;
        u32 val32;
        u32 dev;
@@ -199,43 +198,6 @@ void pci_init_board(void)
            PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP | PIWAR_WTT_SNOOP |
            PIWAR_IWS_2G;
 
-       /*
-        * Assign PIB PMC slot to desired PCI bus
-        */
-
-       /* Switch temporarily to I2C bus #2 */
-       orig_i2c_bus = i2c_get_bus_num();
-       i2c_set_bus_num(1);
-
-       val8 = 0;
-       i2c_write(0x23, 0x6, 1, &val8, 1);
-       i2c_write(0x23, 0x7, 1, &val8, 1);
-       val8 = 0xff;
-       i2c_write(0x23, 0x2, 1, &val8, 1);
-       i2c_write(0x23, 0x3, 1, &val8, 1);
-
-       val8 = 0;
-       i2c_write(0x26, 0x6, 1, &val8, 1);
-       val8 = 0x34;
-       i2c_write(0x26, 0x7, 1, &val8, 1);
-
-       val8 = 0xf9;            /* PMC2, PMC3 slot to PCI bus */
-       i2c_write(0x26, 0x2, 1, &val8, 1);
-       val8 = 0xff;
-       i2c_write(0x26, 0x3, 1, &val8, 1);
-
-       val8 = 0;
-       i2c_write(0x27, 0x6, 1, &val8, 1);
-       i2c_write(0x27, 0x7, 1, &val8, 1);
-       val8 = 0xff;
-       i2c_write(0x27, 0x2, 1, &val8, 1);
-       val8 = 0xef;
-       i2c_write(0x27, 0x3, 1, &val8, 1);
-       asm("eieio");
-
-       /* Reset to original I2C bus */
-       i2c_set_bus_num(orig_i2c_bus);
-
        /*
         * Release PCI RST Output signal
         */
@@ -292,8 +254,6 @@ void pci_init_board(void)
        pci_hose_write_config_byte(&hose[0], dev, PCI_LATENCY_TIMER, 0x80);
        pci_hose_write_config_byte(&hose[0], dev, PCI_CACHE_LINE_SIZE, 0x08);
 
-       printf("PCI 32bit bus on PMC2 & PMC3\n");
-
        /*
         * Hose scan.
         */
index 5ec7a871d4dbbc82e79adc409265d1f62b9877b9..4da74b8277e9612268a0627326e7ded1f19d9058 100644 (file)
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).a
 
-COBJS  := $(BOARD).o pci.o
+COBJS  := $(BOARD).o pci.o ../freescale/common/pq-mds-pib.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
index 386173351ca301e446e5840e3035358411b65f7e..d6d0f4e25f76f46ad46b0b4f6970639257752055 100644 (file)
@@ -30,6 +30,9 @@
 #elif defined(CONFIG_OF_LIBFDT)
 #include <libfdt.h>
 #endif
+#if defined(CONFIG_PQ_MDS_PIB)
+#include "../freescale/common/pq-mds-pib.h"
+#endif
 
 const qe_iop_conf_t qe_iop_conf_tab[] = {
        /* GETH1 */
@@ -106,6 +109,14 @@ int board_early_init_f(void)
        return 0;
 }
 
+int board_early_init_r(void)
+{
+#ifdef CONFIG_PQ_MDS_PIB
+       pib_init();
+#endif
+       return 0;
+}
+
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
 extern void ddr_enable_ecc(unsigned int dram_size);
 #endif
index 79812853e88d5469efaa71e3fe47e7ff71eee687..cf7ef90443f7e97c7de11a43a456bfeae78db913 100644 (file)
@@ -131,7 +131,6 @@ void pci_init_board(void)
        volatile pcictrl83xx_t *pci_ctrl;
        volatile pciconf83xx_t *pci_conf;
 
-       u8 val8, orig_i2c_bus;
        u16 reg16;
        u32 val32;
        u32 dev;
@@ -199,43 +198,6 @@ void pci_init_board(void)
            PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP | PIWAR_WTT_SNOOP |
            PIWAR_IWS_2G;
 
-       /*
-        * Assign PIB PMC slot to desired PCI bus
-        */
-
-       /* Switch temporarily to I2C bus #2 */
-       orig_i2c_bus = i2c_get_bus_num();
-       i2c_set_bus_num(1);
-
-       val8 = 0;
-       i2c_write(0x23, 0x6, 1, &val8, 1);
-       i2c_write(0x23, 0x7, 1, &val8, 1);
-       val8 = 0xff;
-       i2c_write(0x23, 0x2, 1, &val8, 1);
-       i2c_write(0x23, 0x3, 1, &val8, 1);
-
-       val8 = 0;
-       i2c_write(0x26, 0x6, 1, &val8, 1);
-       val8 = 0x34;
-       i2c_write(0x26, 0x7, 1, &val8, 1);
-
-       val8 = 0xf3;            /*PMC1, PMC2, PMC3 slot to PCI bus */
-       i2c_write(0x26, 0x2, 1, &val8, 1);
-       val8 = 0xff;
-       i2c_write(0x26, 0x3, 1, &val8, 1);
-
-       val8 = 0;
-       i2c_write(0x27, 0x6, 1, &val8, 1);
-       i2c_write(0x27, 0x7, 1, &val8, 1);
-       val8 = 0xff;
-       i2c_write(0x27, 0x2, 1, &val8, 1);
-       val8 = 0xef;
-       i2c_write(0x27, 0x3, 1, &val8, 1);
-       asm("eieio");
-
-       /* Reset to original I2C bus */
-       i2c_set_bus_num(orig_i2c_bus);
-
        /*
         * Release PCI RST Output signal
         */
@@ -292,8 +254,6 @@ void pci_init_board(void)
        pci_hose_write_config_byte(&hose[0], dev, PCI_LATENCY_TIMER, 0x80);
        pci_hose_write_config_byte(&hose[0], dev, PCI_CACHE_LINE_SIZE, 0x08);
 
-       printf("PCI 32bit bus on PMC1 & PMC2 & PMC3\n");
-
        /*
         * Hose scan.
         */
index e8c6b75025bd1e02cad26bec8453b16e2a55c020..efc317288e2b556241ca7fe1a17be9c2cd53144e 100644 (file)
@@ -30,6 +30,8 @@
 #define CONFIG_MPC83XX         1       /* MPC83xx family */
 #define CONFIG_MPC832X         1       /* MPC832x CPU specific */
 #define CONFIG_MPC832XEMDS     1       /* MPC832XEMDS board specific */
+#undef CONFIG_PQ_MDS_PIB /* POWERQUICC MDS Platform IO Board */
+#undef CONFIG_PQ_MDS_PIB_ATM   /* QOC3 ATM card */
 
 /*
  * System Clock Setup
@@ -87,6 +89,7 @@
 #define CFG_SICRL              0x00000000
 
 #define CONFIG_BOARD_EARLY_INIT_F      /* call board_pre_init */
+#define CONFIG_BOARD_EARLY_INIT_R
 
 /*
  * IMMR new address
index 4b32a140e8182305a066f69560e6f20597cebbe8..094b66e7c9d675b99e5653dfa21d64986666bb94 100644 (file)
@@ -32,6 +32,8 @@
 #define CONFIG_MPC83XX         1 /* MPC83XX family */
 #define CONFIG_MPC8360         1 /* MPC8360 CPU specific */
 #define CONFIG_MPC8360EMDS     1 /* MPC8360EMDS board specific */
+#undef CONFIG_PQ_MDS_PIB /* POWERQUICC MDS Platform IO Board */
+#undef CONFIG_PQ_MDS_PIB_ATM /* QOC3 ATM card */
 
 /*
  * System Clock Setup
@@ -88,6 +90,7 @@
 #define CFG_SICRL              0x40000000
 
 #define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */
+#define CONFIG_BOARD_EARLY_INIT_R
 
 /*
  * IMMR new address
 /*
  * CS4 on Local Bus, to PIB
  */
-#define CFG_BR4_PRELIM 0xf8008801 /* CS4 base address at 0xf8008000 */
+#define CFG_BR4_PRELIM 0xf8010801 /* CS4 base address at 0xf8010000 */
 #define CFG_OR4_PRELIM 0xffffe9f7 /* size 32KB, port size 8bit, GPCM */
 
 /*
  * CS5 on Local Bus, to PIB
  */
-#define CFG_BR5_PRELIM 0xf8010801 /* CS5 base address at 0xf8010000 */
+#define CFG_BR5_PRELIM 0xf8008801 /* CS5 base address at 0xf8008000 */
 #define CFG_OR5_PRELIM 0xffffe9f7 /* size 32KB, port size 8bit, GPCM */
 
 /*