Skip to contentSkip to conversation

xes: Use common PCI initialization code

PATCH New Peter Tyser 4 participants 20 messages Oct 22, 2010 – Oct 27, 2010 PCI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/13 xes: Use common PCI initialization code

Common Freescale code for PCI initialization now exists, so migrate X-ES boards to use it.

---
 board/xes/common/fsl_8xxx_pci.c |  328 ++++++---------------------------------
 include/configs/XPEDITE5170.h   |   12 +-
 include/configs/XPEDITE5200.h   |    6 +-
 include/configs/XPEDITE5370.h   |   12 +-
 4 files changed, 64 insertions(+), 294 deletions(-)
board/xes/common/fsl_8xxx_pci.c +49 -279
index ece7882..f425cee 100644
@@ -25,10 +25,10 @@
 #include <pci.h>
 #include <asm/fsl_pci.h>
 #include <asm/io.h>
+#include <linux/compiler.h>
 #include <libfdt.h>
 #include <fdt_support.h>
 
-int first_free_busno = 0;
 
 #ifdef CONFIG_PCI1
 static struct pci_controller pci1_hose;
@@ -43,111 +43,6 @@ static struct pci_controller pcie2_hose;
 static struct pci_controller pcie3_hose;
 #endif
 
-#ifdef CONFIG_MPC8572
-/* Correlate host/agent POR bits to usable info. Table 4-14 */
-struct host_agent_cfg_t {
-	uchar pcie_root[3];
-	uchar rio_host;
-} host_agent_cfg[8] = {
-	{{0, 0, 0}, 0},
-	{{0, 1, 1}, 1},
-	{{1, 0, 1}, 0},
-	{{1, 1, 0}, 1},
-	{{0, 0, 1}, 0},
-	{{0, 1, 0}, 1},
-	{{1, 0, 0}, 0},
-	{{1, 1, 1}, 1}
-};
-
-/* Correlate port width POR bits to usable info. Table 4-15 */
-struct io_port_cfg_t {
-	uchar pcie_width[3];
-	uchar rio_width;
-} io_port_cfg[16] = {
-	{{0, 0, 0}, 0},
-	{{0, 0, 0}, 0},
-	{{4, 0, 0}, 0},
-	{{4, 4, 0}, 0},
-	{{0, 0, 0}, 0},
-	{{0, 0, 0}, 0},
-	{{0, 0, 0}, 4},
-	{{4, 2, 2}, 0},
-	{{0, 0, 0}, 0},
-	{{0, 0, 0}, 0},
-	{{0, 0, 0}, 0},
-	{{4, 0, 0}, 4},
-	{{4, 0, 0}, 4},
-	{{0, 0, 0}, 4},
-	{{0, 0, 0}, 4},
-	{{8, 0, 0}, 0},
-};
-#elif defined CONFIG_MPC8548
-/* Correlate host/agent POR bits to usable info. Table 4-12 */
-struct host_agent_cfg_t {
-	uchar pci_host[2];
-	uchar pcie_root[1];
-	uchar rio_host;
-} host_agent_cfg[8] = {
-	{{1, 1}, {0}, 0},
-	{{1, 1}, {1}, 0},
-	{{1, 1}, {0}, 1},
-	{{0, 0}, {0}, 0}, /* reserved */
-	{{0, 1}, {1}, 0},
-	{{1, 1}, {1}, 0},
-	{{0, 1}, {1}, 1},
-	{{1, 1}, {1}, 1}
-};
-
-/* Correlate port width POR bits to usable info. Table 4-13 */
-struct io_port_cfg_t {
-	uchar pcie_width[1];
-	uchar rio_width;
-} io_port_cfg[8] = {
-	{{0}, 0},
-	{{0}, 0},
-	{{0}, 0},
-	{{4}, 4},
-	{{4}, 4},
-	{{0}, 4},
-	{{0}, 4},
-	{{8}, 0},
-};
-#elif defined CONFIG_MPC86xx
-/* Correlate host/agent POR bits to usable info. Table 4-17 */
-struct host_agent_cfg_t {
-	uchar pcie_root[2];
-	uchar rio_host;
-} host_agent_cfg[8] = {
-	{{0, 0}, 0},
-	{{1, 0}, 1},
-	{{0, 1}, 0},
-	{{1, 1}, 1}
-};
-
-/* Correlate port width POR bits to usable info. Table 4-16 */
-struct io_port_cfg_t {
-	uchar pcie_width[2];
-	uchar rio_width;
-} io_port_cfg[16] = {
-	{{0, 0}, 0},
-	{{0, 0}, 0},
-	{{8, 0}, 0},
-	{{8, 8}, 0},
-	{{0, 0}, 0},
-	{{8, 0}, 4},
-	{{8, 0}, 4},
-	{{8, 0}, 4},
-	{{0, 0}, 0},
-	{{0, 0}, 4},
-	{{0, 0}, 4},
-	{{0, 0}, 4},
-	{{0, 0}, 0},
-	{{0, 0}, 0},
-	{{0, 8}, 0},
-	{{8, 8}, 0},
-};
-#endif
-
 /*
  * 85xx and 86xx share naming conventions, but different layout.
  * Correlate names to CPU-specific values to share common
@@ -173,22 +68,22 @@ struct io_port_cfg_t {
 
 void pci_init_board(void)
 {
-	struct pci_controller *hose;
-	volatile ccsr_fsl_pci_t *pci;
-	int width;
-	int host;
+	struct fsl_pci_info pci_info[3];
+	int first_free_busno = 0;
+	int num = 0;
+	int pcie_ep;
+	__maybe_unused int pcie_configured;
+
 #if defined(CONFIG_MPC85xx)
 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 #elif defined(CONFIG_MPC86xx)
 	immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
 	volatile ccsr_gur_t *gur = &immap->im_gur;
 #endif
-	uint devdisr = in_be32(&gur->devdisr);
-	uint io_sel = (in_be32(&gur->pordevsr) & MPC8xxx_PORDEVSR_IO_SEL) >>
+	u32 devdisr = in_be32(&gur->devdisr);
+	u32 pordevsr = in_be32(&gur->pordevsr);
+	__maybe_unused uint io_sel = (pordevsr & MPC8xxx_PORDEVSR_IO_SEL) >>
 			MPC8xxx_PORDEVSR_IO_SEL_SHIFT;
-	uint host_agent = (in_be32(&gur->porbmsr) & MPC8xxx_PORBMSR_HA) >>
-			MPC8xxx_PORBMSR_HA_SHIFT;
-	struct pci_region *r;
 
 #ifdef CONFIG_PCI1
 	uint pci_spd_norm = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1_SPD;
@@ -197,49 +92,19 @@ void pci_init_board(void)
 	uint pcix = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1;
 	uint freq = CONFIG_SYS_CLK_FREQ / 1000 / 1000;
 
-	width = 0; /* Silence compiler warning... */
-	io_sel &= 0xf; /* Silence compiler warning... */
-	pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCI1_ADDR;
-	hose = &pci1_hose;
-	host = host_agent_cfg[host_agent].pci_host[0];
-	r = hose->regions;
-
 	if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
+		SET_STD_PCI_INFO(pci_info[num], 1);
+		pcie_ep = fsl_setup_hose(&pci1_hose, pci_info[num].regs);
 		printf("\n    PCI1: %d bit %s, %s %d MHz, %s, %s\n",
 			pci_32 ? 32 : 64,
 			pcix ? "PCIX" : "PCI",
 			pci_spd_norm ? ">=" : "<=",
 			pcix ? freq * 2 : freq,
-			host ? "host" : "agent",
+			pcie_ep ? "agent" : "host",
 			pci_arb ? "arbiter" : "external-arbiter");
 
-		/* outbound memory */
-		pci_set_region(r++,
-				CONFIG_SYS_PCI1_MEM_BASE,
-				CONFIG_SYS_PCI1_MEM_PHYS,
-				CONFIG_SYS_PCI1_MEM_SIZE,
-				PCI_REGION_MEM);
-
-		/* outbound io */
-		pci_set_region(r++,
-				CONFIG_SYS_PCI1_IO_BASE,
-				CONFIG_SYS_PCI1_IO_PHYS,
-				CONFIG_SYS_PCI1_IO_SIZE,
-				PCI_REGION_IO);
-
-		hose->region_count = r - hose->regions;
-
-		hose->first_busno = first_free_busno;
-
-		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
-
-		/* Unlock inbound PCI configuration cycles */
-		if (!host)
-			fsl_pci_config_unlock(hose);
-
-		first_free_busno = hose->last_busno + 1;
-		printf("    PCI1 on bus %02x - %02x\n",
-			hose->first_busno, hose->last_busno);
+		first_free_busno = fsl_pci_init_port(&pci_info[num++],
+					&pci1_hose, first_free_busno);
 	} else {
 		printf("    PCI1: disabled\n");
 	}
@@ -247,148 +112,53 @@ void pci_init_board(void)
 	/* PCI1 not present on MPC8572 */
 	setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1);
 #endif
-#ifdef CONFIG_PCIE1
-	pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCIE1_ADDR;
-	hose = &pcie1_hose;
-	host = host_agent_cfg[host_agent].pcie_root[0];
-	width = io_port_cfg[io_sel].pcie_width[0];
-	r = hose->regions;
-
-	if (width && !(devdisr & MPC8xxx_DEVDISR_PCIE1)) {
-		printf("\n    PCIE1 connected as %s (x%d)",
-			host ? "Root Complex" : "Endpoint", width);
-		if (in_be32(&pci->pme_msg_det)) {
-			out_be32(&pci->pme_msg_det, 0xffffffff);
-			debug(" with errors.  Clearing.  Now 0x%08x",
-				in_be32(&pci->pme_msg_det));
-		}
-		printf("\n");
-
-		/* outbound memory */
-		pci_set_region(r++,
-				CONFIG_SYS_PCIE1_MEM_BASE,
-				CONFIG_SYS_PCIE1_MEM_PHYS,
-				CONFIG_SYS_PCIE1_MEM_SIZE,
-				PCI_REGION_MEM);
-
-		/* outbound io */
-		pci_set_region(r++,
-				CONFIG_SYS_PCIE1_IO_BASE,
-				CONFIG_SYS_PCIE1_IO_PHYS,
-				CONFIG_SYS_PCIE1_IO_SIZE,
-				PCI_REGION_IO);
-
-		hose->region_count = r - hose->regions;
-
-		hose->first_busno = first_free_busno;
-
-		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
-		/* Unlock inbound PCI configuration cycles */
-		if (!host)
-			fsl_pci_config_unlock(hose);
-
-		first_free_busno = hose->last_busno + 1;
-		printf("    PCIE1 on bus %02x - %02x\n",
-				hose->first_busno, hose->last_busno);
+#ifdef CONFIG_PCIE1
+	pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_1, io_sel);
+
+	if (pcie_configured && !(devdisr & MPC8xxx_DEVDISR_PCIE1)) {
+		SET_STD_PCIE_INFO(pci_info[num], 1);
+		pcie_ep = fsl_setup_hose(&pcie1_hose, pci_info[num].regs);
+		printf("    PCIE1 connected as %s\n",
+			pcie_ep ? "Endpoint" : "Root Complex");
+		first_free_busno = fsl_pci_init_port(&pci_info[num++],
+					&pcie1_hose, first_free_busno);
+	} else {
+		printf("    PCIE1: disabled\n");
 	}
 #else
 	setbits_be32(&gur->devdisr, MPC8xxx_DEVDISR_PCIE1);
 #endif /* CONFIG_PCIE1 */
 
 #ifdef CONFIG_PCIE2
-	pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCIE2_ADDR;
-	hose = &pcie2_hose;
-	host = host_agent_cfg[host_agent].pcie_root[1];
-	width = io_port_cfg[io_sel].pcie_width[1];
-	r = hose->regions;
-
-	if (width && !(devdisr & MPC8xxx_DEVDISR_PCIE2)) {
-		printf("\n    PCIE2 connected as %s (x%d)",
-			host ? "Root Complex" : "Endpoint", width);
-		if (in_be32(&pci->pme_msg_det)) {
-			out_be32(&pci->pme_msg_det, 0xffffffff);
-			debug(" with errors.  Clearing.  Now 0x%08x",
-				in_be32(&pci->pme_msg_det));
-		}
-		printf("\n");
-
-		/* outbound memory */
-		pci_set_region(r++,
-				CONFIG_SYS_PCIE2_MEM_BASE,
-				CONFIG_SYS_PCIE2_MEM_PHYS,
-				CONFIG_SYS_PCIE2_MEM_SIZE,
-				PCI_REGION_MEM);
-
-		/* outbound io */
-		pci_set_region(r++,
-				CONFIG_SYS_PCIE2_IO_BASE,
-				CONFIG_SYS_PCIE2_IO_PHYS,
-				CONFIG_SYS_PCIE2_IO_SIZE,
-				PCI_REGION_IO);
-
-		hose->region_count = r - hose->regions;
-
-		hose->first_busno = first_free_busno;
-
-		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
-
-		/* Unlock inbound PCI configuration cycles */
-		if (!host)
-			fsl_pci_config_unlock(hose);
-
-		first_free_busno = hose->last_busno + 1;
-		printf("    PCIE2 on bus %02x - %02x\n",
-				hose->first_busno, hose->last_busno);
+	pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_2, io_sel);
+
+	if (pcie_configured && !(devdisr & MPC8xxx_DEVDISR_PCIE2)) {
+		SET_STD_PCIE_INFO(pci_info[num], 2);
+		pcie_ep = fsl_setup_hose(&pcie2_hose, pci_info[num].regs);
+		printf("    PCIE2 connected as %s\n",
+			pcie_ep ? "Endpoint" : "Root Complex");
+		first_free_busno = fsl_pci_init_port(&pci_info[num++],
+					&pcie2_hose, first_free_busno);
+	} else {
+		printf("    PCIE2: disabled\n");
 	}
 #else
 	setbits_be32(&gur->devdisr, MPC8xxx_DEVDISR_PCIE2);
 #endif /* CONFIG_PCIE2 */
 
 #ifdef CONFIG_PCIE3
-	pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCIE3_ADDR;
-	hose = &pcie3_hose;
-	host = host_agent_cfg[host_agent].pcie_root[2];
-	width = io_port_cfg[io_sel].pcie_width[2];
-	r = hose->regions;
-
-	if (width && !(devdisr & MPC8xxx_DEVDISR_PCIE3)) {
-		printf("\n    PCIE3 connected as %s (x%d)",
-			host ? "Root Complex" : "Endpoint", width);
-		if (in_be32(&pci->pme_msg_det)) {
-			out_be32(&pci->pme_msg_det, 0xffffffff);
-			debug(" with errors.  Clearing.  Now 0x%08x",
-				in_be32(&pci->pme_msg_det));
-		}
-		printf("\n");
-
-		/* outbound memory */
-		pci_set_region(r++,
-				CONFIG_SYS_PCIE3_MEM_BASE,
-				CONFIG_SYS_PCIE3_MEM_PHYS,
-				CONFIG_SYS_PCIE3_MEM_SIZE,
-				PCI_REGION_MEM);
-
-		/* outbound io */
-		pci_set_region(r++,
-				CONFIG_SYS_PCIE3_IO_BASE,
-				CONFIG_SYS_PCIE3_IO_PHYS,
-				CONFIG_SYS_PCIE3_IO_SIZE,
-				PCI_REGION_IO);
-
-		hose->region_count = r - hose->regions;
-
-		hose->first_busno = first_free_busno;
-
-		fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
-
-		/* Unlock inbound PCI configuration cycles */
-		if (!host)
-			fsl_pci_config_unlock(hose);
-
-		first_free_busno = hose->last_busno + 1;
-		printf("    PCIE3 on bus %02x - %02x\n",
-				hose->first_busno, hose->last_busno);
+	pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_3, io_sel);
+
+	if (pcie_configured && !(devdisr & MPC8xxx_DEVDISR_PCIE3)) {
+		SET_STD_PCIE_INFO(pci_info[num], 3);
+		pcie_ep = fsl_setup_hose(&pcie3_hose, pci_info[num].regs);
+		printf("    PCIE3 connected as %s\n",
+			pcie_ep ? "Endpoint" : "Root Complex");
+		first_free_busno = fsl_pci_init_port(&pci_info[num++],
+					&pcie3_hose, first_free_busno);
+	} else {
+		printf("    PCIE3: disabled\n");
 	}
 #else
 	setbits_be32(&gur->devdisr, MPC8xxx_DEVDISR_PCIE3);
include/configs/XPEDITE5170.h +6 -6
index 1851997..9ff28a2 100644
@@ -324,18 +324,18 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
  * Memory space is mapped 1-1, but I/O space must start from 0.
  */
 /* PCIE1 - PEX8518 */
-#define CONFIG_SYS_PCIE1_MEM_BASE	0x80000000
-#define CONFIG_SYS_PCIE1_MEM_PHYS	CONFIG_SYS_PCIE1_MEM_BASE
+#define CONFIG_SYS_PCIE1_MEM_BUS	0x80000000
+#define CONFIG_SYS_PCIE1_MEM_PHYS	CONFIG_SYS_PCIE1_MEM_BUS
 #define CONFIG_SYS_PCIE1_MEM_SIZE	0x40000000	/* 1G */
-#define CONFIG_SYS_PCIE1_IO_BASE	0x00000000
+#define CONFIG_SYS_PCIE1_IO_BUS		0x00000000
 #define CONFIG_SYS_PCIE1_IO_PHYS	0xe8000000
 #define CONFIG_SYS_PCIE1_IO_SIZE	0x00800000	/* 8M */
 
 /* PCIE2 - VPX P1 */
-#define CONFIG_SYS_PCIE2_MEM_BASE	0xc0000000
-#define CONFIG_SYS_PCIE2_MEM_PHYS	CONFIG_SYS_PCIE2_MEM_BASE
+#define CONFIG_SYS_PCIE2_MEM_BUS	0xc0000000
+#define CONFIG_SYS_PCIE2_MEM_PHYS	CONFIG_SYS_PCIE2_MEM_BUS
 #define CONFIG_SYS_PCIE2_MEM_SIZE	0x10000000	/* 256M */
-#define CONFIG_SYS_PCIE2_IO_BASE	0x00000000
+#define CONFIG_SYS_PCIE2_IO_BUS		0x00000000
 #define CONFIG_SYS_PCIE2_IO_PHYS	0xe8800000
 #define CONFIG_SYS_PCIE2_IO_SIZE	0x00800000	/* 8M */
 
include/configs/XPEDITE5200.h +3 -3
index d0e9492..db03777 100644
@@ -268,10 +268,10 @@
  * General PCI
  * Memory space is mapped 1-1, but I/O space must start from 0.
  */
-#define CONFIG_SYS_PCI1_MEM_BASE	0x80000000
-#define CONFIG_SYS_PCI1_MEM_PHYS	CONFIG_SYS_PCI1_MEM_BASE
+#define CONFIG_SYS_PCI1_MEM_BUS		0x80000000
+#define CONFIG_SYS_PCI1_MEM_PHYS	CONFIG_SYS_PCI1_MEM_BUS
 #define CONFIG_SYS_PCI1_MEM_SIZE	0x40000000	/* 1G */
-#define CONFIG_SYS_PCI1_IO_BASE		0x00000000
+#define CONFIG_SYS_PCI1_IO_BUS		0x00000000
 #define CONFIG_SYS_PCI1_IO_PHYS		0xe8000000
 #define CONFIG_SYS_PCI1_IO_SIZE		0x00800000	/* 1M */
 
include/configs/XPEDITE5370.h +6 -6
index 629dc0d..01047c8 100644
@@ -334,18 +334,18 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
  * Memory space is mapped 1-1, but I/O space must start from 0.
  */
 /* PCIE1 - VPX P1 */
-#define CONFIG_SYS_PCIE1_MEM_BASE	0x80000000
-#define CONFIG_SYS_PCIE1_MEM_PHYS	CONFIG_SYS_PCIE1_MEM_BASE
+#define CONFIG_SYS_PCIE1_MEM_BUS	0x80000000
+#define CONFIG_SYS_PCIE1_MEM_PHYS	CONFIG_SYS_PCIE1_MEM_BUS
 #define CONFIG_SYS_PCIE1_MEM_SIZE	0x40000000	/* 1G */
-#define CONFIG_SYS_PCIE1_IO_BASE	0x00000000
+#define CONFIG_SYS_PCIE1_IO_BUS		0x00000000
 #define CONFIG_SYS_PCIE1_IO_PHYS	0xe8000000
 #define CONFIG_SYS_PCIE1_IO_SIZE	0x00800000	/* 8M */
 
 /* PCIE2 - PEX8518 */
-#define CONFIG_SYS_PCIE2_MEM_BASE	0xc0000000
-#define CONFIG_SYS_PCIE2_MEM_PHYS	CONFIG_SYS_PCIE2_MEM_BASE
+#define CONFIG_SYS_PCIE2_MEM_BUS	0xc0000000
+#define CONFIG_SYS_PCIE2_MEM_PHYS	CONFIG_SYS_PCIE2_MEM_BUS
 #define CONFIG_SYS_PCIE2_MEM_SIZE	0x10000000	/* 256M */
-#define CONFIG_SYS_PCIE2_IO_BASE	0x00000000
+#define CONFIG_SYS_PCIE2_IO_BUS		0x00000000
 #define CONFIG_SYS_PCIE2_IO_PHYS	0xe8800000
 #define CONFIG_SYS_PCIE2_IO_SIZE	0x00800000	/* 8M */
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 2/13 pci: Add ability to re-enumerate PCI buses

From: John Schmoller <[email protected]>

Add a new 'pci enum' command which re-enumerates the PCI buses. This command is enabled via the CONFIG_CMD_PCI_ENUM define and can be useful in boards with FPGAs connected via PCI/PCIe, boards that support PCI hot-plugging, or during PCI debug.

Also enable the 'pci enum' command for X-ES's Freescale-based boards.

---
 common/cmd_pci.c              |   13 +++++++++++++
 drivers/pci/fsl_pci_init.c    |    3 +++
 drivers/pci/pci.c             |    4 +++-
 include/configs/XPEDITE5170.h |    1 +
 include/configs/XPEDITE5200.h |    1 +
 include/configs/XPEDITE5370.h |    1 +
 6 files changed, 22 insertions(+), 1 deletions(-)
common/cmd_pci.c +13 -0
index 4bde059..ccf5ada 100644
@@ -497,6 +497,10 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if ((bdf = get_pci_dev(argv[2])) == -1)
 			return 1;
 		break;
+#ifdef CONFIG_CMD_PCI_ENUM
+	case 'e':
+		break;
+#endif
 	default:		/* scan bus */
 		value = 1; /* short listing */
 		bdf = 0;   /* bus number  */
@@ -518,6 +522,11 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 0;
 	case 'd':		/* display */
 		return pci_cfg_display(bdf, addr, size, value);
+#ifdef CONFIG_CMD_PCI_ENUM
+	case 'e':
+		pci_init();
+		return 0;
+#endif
 	case 'n':		/* next */
 		if (argc < 4)
 			goto usage;
@@ -545,6 +554,10 @@ U_BOOT_CMD(
 	"list and access PCI Configuration Space",
 	"[bus] [long]\n"
 	"    - short or long list of PCI devices on bus 'bus'\n"
+#ifdef CONFIG_CMD_PCI_ENUM
+	"pci enum\n"
+	"    - re-enumerate PCI buses\n"
+#endif
 	"pci header b.d.f\n"
 	"    - show header of PCI device 'bus.device.function'\n"
 	"pci display[.b, .w, .l] b.d.f [address] [# of objects]\n"
drivers/pci/fsl_pci_init.c +3 -0
index 001e6eb..1f02103 100644
@@ -91,6 +91,9 @@ int fsl_setup_hose(struct pci_controller *hose, unsigned long addr)
 {
 	volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) addr;
 
+	/* Reset hose to make sure its in a clean state */
+	memset(hose, 0, sizeof(struct pci_controller));
+
 	pci_setup_indirect(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
 
 	return fsl_is_pci_agent(hose);
drivers/pci/pci.c +3 -1
index cd64a87..848746f 100644
@@ -139,7 +139,7 @@ void *pci_map_bar(pci_dev_t pdev, int bar, int flags)
  *
  */
 
-static struct pci_controller* hose_head = NULL;
+static struct pci_controller* hose_head;
 
 void pci_register_hose(struct pci_controller* hose)
 {
@@ -640,6 +640,8 @@ void pci_init(void)
 	}
 #endif /* CONFIG_PCI_BOOTDELAY */
 
+	hose_head = NULL;
+
 	/* now call board specific pci_init()... */
 	pci_init_board();
 }
include/configs/XPEDITE5170.h +1 -0
index 9ff28a2..ab6d4b4 100644
@@ -545,6 +545,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_CMD_PCA953X
 #define CONFIG_CMD_PCA953X_INFO
 #define CONFIG_CMD_PCI
+#define CONFIG_CMD_PCI_ENUM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SNTP
include/configs/XPEDITE5200.h +1 -0
index db03777..00cd516 100644
@@ -339,6 +339,7 @@
 #define CONFIG_CMD_PCA953X
 #define CONFIG_CMD_PCA953X_INFO
 #define CONFIG_CMD_PCI
+#define CONFIG_CMD_PCI_ENUM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SNTP
 #define CONFIG_CMD_REGINFO
include/configs/XPEDITE5370.h +1 -0
index 01047c8..73e3d52 100644
@@ -396,6 +396,7 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #define CONFIG_CMD_PCA953X
 #define CONFIG_CMD_PCA953X_INFO
 #define CONFIG_CMD_PCI
+#define CONFIG_CMD_PCI_ENUM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVEENV
 #define CONFIG_CMD_SNTP
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v2 3/13 xes: Consolidate checkboard()

In reply to Peter Tyser

From: John Schmoller <[email protected]>

Create a common checkboard() function to support all X-ES's Freescale boards.

Also, add a get_board_derivative() function which reads hardware strapping resistors to determine what model a board is. This allows one U-Boot image to support multiple boards.

---
 board/xes/common/Makefile           |    2 +
 board/xes/common/board.c            |   64 +++++++++++++++++++++++++++++++++++
 board/xes/common/fsl_8xxx_misc.c    |   47 +++++++++++++++++++++++++
 board/xes/common/fsl_8xxx_misc.h    |   28 +++++++++++++++
 board/xes/xpedite5170/xpedite5170.c |   20 +----------
 board/xes/xpedite5200/xpedite5200.c |   27 ---------------
 board/xes/xpedite5370/xpedite5370.c |   20 -----------
 include/configs/XPEDITE1000.h       |    1 +
 include/configs/XPEDITE5170.h       |    1 +
 include/configs/XPEDITE5200.h       |    1 +
 include/configs/XPEDITE5370.h       |    1 +
 11 files changed, 146 insertions(+), 66 deletions(-)
 create mode 100644 board/xes/common/board.c
 create mode 100644 board/xes/common/fsl_8xxx_misc.c
 create mode 100644 board/xes/common/fsl_8xxx_misc.h
board/xes/common/Makefile +2 -0
index d022831..bfade31 100644
@@ -33,6 +33,8 @@ COBJS-$(CONFIG_FSL_PCI_INIT)	+= fsl_8xxx_pci.o
 COBJS-$(CONFIG_MPC8572)		+= fsl_8xxx_clk.o
 COBJS-$(CONFIG_MPC86xx)		+= fsl_8xxx_clk.o
 COBJS-$(CONFIG_FSL_DDR2)	+= fsl_8xxx_ddr.o
+COBJS-$(CONFIG_MPC85xx)		+= fsl_8xxx_misc.o board.o
+COBJS-$(CONFIG_MPC86xx)		+= fsl_8xxx_misc.o board.o
 COBJS-$(CONFIG_NAND_ACTL)	+= actl_nand.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
board/xes/common/board.c new file +64 -0

64 lines not on this page · raw message

board/xes/common/fsl_8xxx_misc.c new file +47 -0

47 lines not on this page · raw message

board/xes/common/fsl_8xxx_misc.h new file +28 -0
new file mode 100644
index 0000000..ecc70da
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2008 Extreme Engineering Solutions, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __FSL_8XXX_MISC_H___
+#define __FSL_8XXX_MISC_H___
+
+uint get_board_derivative(void);
+
+#endif /* __FSL_8XXX_MISC_H__ */
board/xes/xpedite5170/xpedite5170.c +1 -19
index 5822941..0f7fa6c 100644
@@ -26,30 +26,12 @@
 #include <asm/io.h>
 #include <fdt_support.h>
 #include <pca953x.h>
+#include "../common/fsl_8xxx_misc.h"
 
 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_PCI)
 extern void ft_board_pci_setup(void *blob, bd_t *bd);
 #endif
 
-int checkboard(void)
-{
-	char *s;
-
-	printf("Board: X-ES %s 3U VPX SBC\n", CONFIG_SYS_BOARD_NAME);
-	printf("       ");
-	s = getenv("board_rev");
-	if (s)
-		printf("Rev %s, ", s);
-	s = getenv("serial#");
-	if (s)
-		printf("Serial# %s, ", s);
-	s = getenv("board_cfg");
-	if (s)
-		printf("Cfg %s", s);
-	printf("\n");
-
-	return 0;
-}
 /*
  * Print out which flash was booted from and if booting from the 2nd flash,
  * swap flash chip selects to maintain consistent flash numbering/addresses.
board/xes/xpedite5200/xpedite5200.c +0 -27
index a2627f8..dc5c965 100644
@@ -36,33 +36,6 @@
 
 extern void ft_board_pci_setup(void *blob, bd_t *bd);
 
-int checkboard(void)
-{
-	volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
-	volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
-	char *s;
-
-	printf("Board: X-ES %s PMC\n", CONFIG_SYS_BOARD_NAME);
-	printf("       ");
-	s = getenv("board_rev");
-	if (s)
-		printf("Rev %s, ", s);
-	s = getenv("serial#");
-	if (s)
-		printf("Serial# %s, ", s);
-	s = getenv("board_cfg");
-	if (s)
-		printf("Cfg %s", s);
-	printf("\n");
-
-	out_be32(&lbc->ltesr, 0xffffffff);	/* Clear LBC error IRQs */
-	out_be32(&lbc->lteir, 0xffffffff);	/* Enable LBC error IRQs */
-	out_be32(&ecm->eedr, 0xffffffff);	/* Clear ecm errors */
-	out_be32(&ecm->eeer, 0xffffffff);	/* Enable ecm errors */
-
-	return 0;
-}
-
 static void flash_cs_fixup(void)
 {
 	int flash_sel;
board/xes/xpedite5370/xpedite5370.c +0 -20
index 2a060c2..89fa6c7 100644
@@ -36,26 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 extern void ft_board_pci_setup(void *blob, bd_t *bd);
 
-int checkboard(void)
-{
-	char *s;
-
-	printf("Board: X-ES %s 3U VPX SBC\n", CONFIG_SYS_BOARD_NAME);
-	printf("       ");
-	s = getenv("board_rev");
-	if (s)
-		printf("Rev %s, ", s);
-	s = getenv("serial#");
-	if (s)
-		printf("Serial# %s, ", s);
-	s = getenv("board_cfg");
-	if (s)
-		printf("Cfg %s", s);
-	printf("\n");
-
-	return 0;
-}
-
 static void flash_cs_fixup(void)
 {
 	int flash_sel;
include/configs/XPEDITE1000.h +1 -0
index 5605849..64030dd 100644
@@ -33,6 +33,7 @@
 /* High Level Configuration Options */
 #define CONFIG_XPEDITE1000	1
 #define CONFIG_SYS_BOARD_NAME	"XPedite1000"
+#define CONFIG_SYS_FORM_PMC	1
 #define CONFIG_4xx		1		/* ... PPC4xx family */
 #define CONFIG_440		1
 #define CONFIG_440GX		1		/* 440 GX */
include/configs/XPEDITE5170.h +1 -0
index ab6d4b4..eeae5f0 100644
@@ -34,6 +34,7 @@
 #define CONFIG_MPC8641		1	/* MPC8641 specific */
 #define CONFIG_XPEDITE5140	1	/* MPC8641HPCN board specific */
 #define CONFIG_SYS_BOARD_NAME	"XPedite5170"
+#define CONFIG_SYS_FORM_3U_VPX	1
 #define CONFIG_LINUX_RESET_VEC	0x100	/* Reset vector used by Linux */
 #define CONFIG_BOARD_EARLY_INIT_R	/* Call board_pre_init */
 #define CONFIG_BAT_RW		1	/* Use common BAT rw code */
include/configs/XPEDITE5200.h +1 -0
index 00cd516..4221829 100644
@@ -36,6 +36,7 @@
 #define CONFIG_MPC8548		1
 #define CONFIG_XPEDITE5200	1
 #define CONFIG_SYS_BOARD_NAME	"XPedite5200"
+#define CONFIG_SYS_FORM_PMC_XMC	1
 #define CONFIG_BOARD_EARLY_INIT_R	/* Call board_pre_init */
 
 #ifndef CONFIG_SYS_TEXT_BASE
include/configs/XPEDITE5370.h +1 -0
index 73e3d52..9b0ac4b 100644
@@ -36,6 +36,7 @@
 #define CONFIG_MPC8572		1
 #define CONFIG_XPEDITE5370	1
 #define CONFIG_SYS_BOARD_NAME	"XPedite5370"
+#define CONFIG_SYS_FORM_3U_VPX	1
 #define CONFIG_BOARD_EARLY_INIT_R	/* Call board_pre_init */
 
 #ifndef CONFIG_SYS_TEXT_BASE
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v2 4/13 xes: Add board_flash_wp_on()

In reply to Peter Tyser

From: John Schmoller <[email protected]>

Add board_flash_wp_on() to check a pca9557 gpio pin to see if non-volatile memory write protection is enabled.

Previously, write protected NOR flashes would fail initialization which resulted in a bootup error such as:

...
DTT: 53 C local / 64 C remote (adt7461 at 4c)
DTT: 54 C local (ds1621 at 48)
FLASH: Executed from FLASH1
POST memory PASSED
FLASH: ## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB ## Unknown FLASH on Bank 2 - Size = 0x00000000 = 0 MB *** failed ***
### ERROR ### Please RESET the board ###

With this patch, NOR flash initialization is skipped:

...
DTT: 53 C local / 64 C remote (adt7461 at 4c)
DTT: 54 C local (ds1621 at 48)
FLASH: Executed from FLASH1
POST memory PASSED
FLASH: Uninitialized - Write Protect On
L2: 1024 KB enabled
NAND: 1024 MiB
...

Note that flash related commands such as flinfo and saveenv will error out when flash write protection is enabled.

---
 board/xes/common/fsl_8xxx_misc.c |   15 +++++++++++++++
 include/configs/XPEDITE5200.h    |    2 +-
 2 files changed, 16 insertions(+), 1 deletions(-)
board/xes/common/fsl_8xxx_misc.c +15 -0
index e37a3c1..b7fa695 100644
@@ -22,6 +22,21 @@
 
 #include <common.h>
 #include <asm/mmu.h>
+#ifdef CONFIG_PCA953X
+#include <pca953x.h>
+
+/*
+ * Determine if a board's flashes are write protected
+ */
+int board_flash_wp_on(void)
+{
+	if (pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
+			CONFIG_SYS_PCA953X_NVM_WP)
+		return 1;
+
+	return 0;
+}
+#endif
 
 /*
  * Return a board's derivative model number.  For example:
include/configs/XPEDITE5200.h +1 -1
index 4221829..1ad9b46 100644
@@ -251,7 +251,7 @@
 #define CONFIG_SYS_PCA953X_BRD_CFG2		0x04
 #define CONFIG_SYS_PCA953X_XMC_ROOT0		0x08
 #define CONFIG_SYS_PCA953X_FLASH_PASS_CS	0x10
-#define CONFIG_SYS_PCA953X_FLASH_WP		0x20
+#define CONFIG_SYS_PCA953X_NVM_WP		0x20
 #define CONFIG_SYS_PCA953X_MONARCH		0x40
 #define CONFIG_SYS_PCA953X_EREADY		0x80
 
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v2 5/13 xes: Make X-ES board names more generic

In reply to Peter Tyser

Some U-Boot images for X-ES boards support multiple products in the same family. For example, the XPedite5370, XPedite5371, and XPedite5372 are similar enough that one U-Boot image can work on all 3 cards. To make it clear that a U-Boot image can work on boards of the same family, rename the boards with the least significant digit of 'x'.

While we're at it, change the board config file and make targets to be lowercase.

Also change the default uImage and fdt filenames to "board.uImage" and "board.dtb" to be more generic.

---
 MAINTAINERS                                        |    8 ++++----
 board/xes/{xpedite5170 => xpedite517x}/Makefile    |    0
 board/xes/{xpedite5170 => xpedite517x}/ddr.c       |    0
 board/xes/{xpedite5170 => xpedite517x}/law.c       |    0
 .../xpedite5170.c => xpedite517x/xpedite517x.c}    |    0
 board/xes/{xpedite5200 => xpedite520x}/Makefile    |    0
 board/xes/{xpedite5200 => xpedite520x}/ddr.c       |    0
 board/xes/{xpedite5200 => xpedite520x}/law.c       |    0
 board/xes/{xpedite5200 => xpedite520x}/tlb.c       |    0
 .../xpedite5200.c => xpedite520x/xpedite520x.c}    |    0
 board/xes/{xpedite5370 => xpedite537x}/Makefile    |    0
 board/xes/{xpedite5370 => xpedite537x}/ddr.c       |    0
 board/xes/{xpedite5370 => xpedite537x}/law.c       |    0
 board/xes/{xpedite5370 => xpedite537x}/tlb.c       |    0
 .../xpedite5370.c => xpedite537x/xpedite537x.c}    |    0
 boards.cfg                                         |    8 ++++----
 include/configs/{XPEDITE1000.h => xpedite1000.h}   |    4 ++--
 include/configs/{XPEDITE5170.h => xpedite517x.h}   |    6 +++---
 include/configs/{XPEDITE5200.h => xpedite520x.h}   |    6 +++---
 include/configs/{XPEDITE5370.h => xpedite537x.h}   |    6 +++---
 20 files changed, 19 insertions(+), 19 deletions(-)
 rename board/xes/{xpedite5170 => xpedite517x}/Makefile (100%)
 rename board/xes/{xpedite5170 => xpedite517x}/ddr.c (100%)
 rename board/xes/{xpedite5170 => xpedite517x}/law.c (100%)
 rename board/xes/{xpedite5170/xpedite5170.c => xpedite517x/xpedite517x.c} (100%)
 rename board/xes/{xpedite5200 => xpedite520x}/Makefile (100%)
 rename board/xes/{xpedite5200 => xpedite520x}/ddr.c (100%)
 rename board/xes/{xpedite5200 => xpedite520x}/law.c (100%)
 rename board/xes/{xpedite5200 => xpedite520x}/tlb.c (100%)
 rename board/xes/{xpedite5200/xpedite5200.c => xpedite520x/xpedite520x.c} (100%)
 rename board/xes/{xpedite5370 => xpedite537x}/Makefile (100%)
 rename board/xes/{xpedite5370 => xpedite537x}/ddr.c (100%)
 rename board/xes/{xpedite5370 => xpedite537x}/law.c (100%)
 rename board/xes/{xpedite5370 => xpedite537x}/tlb.c (100%)
 rename board/xes/{xpedite5370/xpedite5370.c => xpedite537x/xpedite537x.c} (100%)
 rename include/configs/{XPEDITE1000.h => xpedite1000.h} (99%)
 rename include/configs/{XPEDITE5170.h => xpedite517x.h} (99%)
 rename include/configs/{XPEDITE5200.h => xpedite520x.h} (99%)
 rename include/configs/{XPEDITE5370.h => xpedite537x.h} (99%)
MAINTAINERS +4 -4
index 2f61776..2da0561 100644
@@ -462,10 +462,10 @@ Rune Torgersen <[email protected]>
 
 Peter Tyser <[email protected]>
 
-	XPEDITE1000	PPC440GX
-	XPEDITE5170	MPC8640
-	XPEDITE5200	MPC8548
-	XPEDITE5370	MPC8572
+	xpedite1000	PPC440GX
+	xpedite5170	MPC8640
+	xpedite5200	MPC8548
+	xpedite5370	MPC8572
 
 David Updegraff <[email protected]>
 
board/xes/xpedite517x/Makefile renamed from board/xes/xpedite5170/Makefile +0 -0
similarity index 100%
rename from board/xes/xpedite5170/Makefile
rename to board/xes/xpedite517x/Makefile
board/xes/xpedite517x/ddr.c renamed from board/xes/xpedite5170/ddr.c +0 -0
similarity index 100%
rename from board/xes/xpedite5170/ddr.c
rename to board/xes/xpedite517x/ddr.c
board/xes/xpedite517x/law.c renamed from board/xes/xpedite5170/law.c +0 -0
similarity index 100%
rename from board/xes/xpedite5170/law.c
rename to board/xes/xpedite517x/law.c
board/xes/xpedite517x/xpedite517x.c renamed from board/xes/xpedite5170/xpedite5170.c +0 -0
similarity index 100%
rename from board/xes/xpedite5170/xpedite5170.c
rename to board/xes/xpedite517x/xpedite517x.c
board/xes/xpedite520x/Makefile renamed from board/xes/xpedite5200/Makefile +0 -0
similarity index 100%
rename from board/xes/xpedite5200/Makefile
rename to board/xes/xpedite520x/Makefile
board/xes/xpedite520x/ddr.c renamed from board/xes/xpedite5200/ddr.c +0 -0
similarity index 100%
rename from board/xes/xpedite5200/ddr.c
rename to board/xes/xpedite520x/ddr.c
board/xes/xpedite520x/law.c renamed from board/xes/xpedite5200/law.c +0 -0
similarity index 100%
rename from board/xes/xpedite5200/law.c
rename to board/xes/xpedite520x/law.c
board/xes/xpedite520x/tlb.c renamed from board/xes/xpedite5200/tlb.c +0 -0
similarity index 100%
rename from board/xes/xpedite5200/tlb.c
rename to board/xes/xpedite520x/tlb.c
board/xes/xpedite520x/xpedite520x.c renamed from board/xes/xpedite5200/xpedite5200.c +0 -0
similarity index 100%
rename from board/xes/xpedite5200/xpedite5200.c
rename to board/xes/xpedite520x/xpedite520x.c
board/xes/xpedite537x/Makefile renamed from board/xes/xpedite5370/Makefile +0 -0
similarity index 100%
rename from board/xes/xpedite5370/Makefile
rename to board/xes/xpedite537x/Makefile
board/xes/xpedite537x/ddr.c renamed from board/xes/xpedite5370/ddr.c +0 -0
similarity index 100%
rename from board/xes/xpedite5370/ddr.c
rename to board/xes/xpedite537x/ddr.c
board/xes/xpedite537x/law.c renamed from board/xes/xpedite5370/law.c +0 -0
similarity index 100%
rename from board/xes/xpedite5370/law.c
rename to board/xes/xpedite537x/law.c
board/xes/xpedite537x/tlb.c renamed from board/xes/xpedite5370/tlb.c +0 -0
similarity index 100%
rename from board/xes/xpedite5370/tlb.c
rename to board/xes/xpedite537x/tlb.c
board/xes/xpedite537x/xpedite537x.c renamed from board/xes/xpedite5370/xpedite5370.c +0 -0
similarity index 100%
rename from board/xes/xpedite5370/xpedite5370.c
rename to board/xes/xpedite537x/xpedite537x.c
boards.cfg +4 -4
index 0f3292f..a524272 100644
@@ -556,8 +556,8 @@ MPC8540ADS	powerpc	mpc85xx		mpc8540ads	freescale
 MPC8544DS	powerpc	mpc85xx		mpc8544ds	freescale
 MPC8560ADS	powerpc	mpc85xx		mpc8560ads	freescale
 MPC8568MDS	powerpc	mpc85xx		mpc8568mds	freescale
-XPEDITE5200	powerpc	mpc85xx		xpedite5200	xes
-XPEDITE5370	powerpc	mpc85xx		xpedite5370	xes
+xpedite520x	powerpc	mpc85xx		-		xes
+xpedite537x	powerpc	mpc85xx		-		xes
 sbc8540_33	powerpc	mpc85xx		sbc8560		-		-	SBC8540
 sbc8540_66	powerpc	mpc85xx		sbc8560		-		-	SBC8540
 sbc8548_PCI_33	powerpc	mpc85xx		sbc8548		-		-	sbc8548:PCI,33
@@ -597,7 +597,7 @@ P2020RDB_NAND	powerpc	mpc85xx		p1_p2_rdb	freescale	-	P1_P2_RDB:P2020,NAND
 P2020RDB_SDCARD	powerpc	mpc85xx		p1_p2_rdb	freescale	-	P1_P2_RDB:P2020,SDCARD
 sbc8641d	powerpc	mpc86xx
 MPC8610HPCD	powerpc	mpc86xx		mpc8610hpcd	freescale
-XPEDITE5170	powerpc	mpc86xx		xpedite5170	xes
+xpedite517x	powerpc	mpc86xx		-		xes
 MPC8641HPCN	powerpc	mpc86xx		mpc8641hpcn	freescale	-	MPC8641HPCN
 cogent_mpc8xx	powerpc	mpc8xx		cogent
 ESTEEM192E	powerpc	mpc8xx		esteem192e
@@ -648,7 +648,7 @@ CPCIISER4	powerpc	ppc4xx		cpciiser4	esd
 DASA_SIM	powerpc	ppc4xx		dasa_sim	esd
 PMC405DE	powerpc	ppc4xx		pmc405de	esd
 METROBOX	powerpc	ppc4xx		metrobox	sandburst
-XPEDITE1000	powerpc	ppc4xx		xpedite1000	xes
+xpedite1000	powerpc	ppc4xx		-		xes
 korat_perm	powerpc	ppc4xx		korat		-		-	korat:KORAT_PERMANENT
 haleakala	powerpc	ppc4xx		kilauea		amcc		-	kilauea:HALEAKALA
 sycamore	powerpc	ppc4xx		walnut		amcc		-	walnut
include/configs/xpedite1000.h renamed from include/configs/XPEDITE1000.h +2 -2
similarity index 99%
rename from include/configs/XPEDITE1000.h
rename to include/configs/xpedite1000.h
index 64030dd..d0f9363 100644
@@ -342,8 +342,8 @@ extern void out32(unsigned int, unsigned long);
 	"misc_args=ip=on\0"						\
 	"set_bootargs=setenv bootargs ${console_args} ${root_args} ${misc_args}\0" \
 	"bootfile=/home/user/file\0"					\
-	"osfile=/home/user/uImage-XPedite1000\0"			\
-	"fdtfile=/home/user/xpedite1000.dtb\0"				\
+	"osfile=/home/user/board.uImage\0"				\
+	"fdtfile=/home/user/board.dtb\0"				\
 	"ubootfile=/home/user/u-boot.bin\0"				\
 	"fdtaddr=c00000\0"						\
 	"osaddr=0x1000000\0"						\
include/configs/xpedite517x.h renamed from include/configs/XPEDITE5170.h +3 -3
similarity index 99%
rename from include/configs/XPEDITE5170.h
rename to include/configs/xpedite517x.h
index eeae5f0..2b6e895 100644
@@ -22,7 +22,7 @@
  */
 
 /*
- * xpedite5170 board configuration file
+ * xpedite517x board configuration file
  */
 #ifndef __CONFIG_H
 #define __CONFIG_H
@@ -727,8 +727,8 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 	"misc_args=ip=on\0"						\
 	"set_bootargs=setenv bootargs ${console_args} ${root_args} ${misc_args}\0" \
 	"bootfile=/home/user/file\0"					\
-	"osfile=/home/user/uImage-XPedite5170\0"			\
-	"fdtfile=/home/user/xpedite5170.dtb\0"				\
+	"osfile=/home/user/board.uImage\0"				\
+	"fdtfile=/home/user/board.dtb\0"				\
 	"ubootfile=/home/user/u-boot.bin\0"				\
 	"fdtaddr=c00000\0"						\
 	"osaddr=0x1000000\0"						\
include/configs/xpedite520x.h renamed from include/configs/XPEDITE5200.h +3 -3
similarity index 99%
rename from include/configs/XPEDITE5200.h
rename to include/configs/xpedite520x.h
index 1ad9b46..fc15d8e 100644
@@ -22,7 +22,7 @@
  */
 
 /*
- * xpedite5200 board configuration file
+ * xpedite520x board configuration file
  */
 #ifndef __CONFIG_H
 #define __CONFIG_H
@@ -523,8 +523,8 @@
 	"misc_args=ip=on\0"						\
 	"set_bootargs=setenv bootargs ${console_args} ${root_args} ${misc_args}\0" \
 	"bootfile=/home/user/file\0"					\
-	"osfile=/home/user/uImage-XPedite5200\0"			\
-	"fdtfile=/home/user/xpedite5200.dtb\0"				\
+	"osfile=/home/user/board.uImage\0"				\
+	"fdtfile=/home/user/board.dtb\0"				\
 	"ubootfile=/home/user/u-boot.bin\0"				\
 	"fdtaddr=c00000\0"						\
 	"osaddr=0x1000000\0"						\
include/configs/xpedite537x.h renamed from include/configs/XPEDITE5370.h +3 -3
similarity index 99%
rename from include/configs/XPEDITE5370.h
rename to include/configs/xpedite537x.h
index 9b0ac4b..309e32c 100644
@@ -22,7 +22,7 @@
  */
 
 /*
- * xpedite5370 board configuration file
+ * xpedite537x board configuration file
  */
 #ifndef __CONFIG_H
 #define __CONFIG_H
@@ -580,8 +580,8 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 	"misc_args=ip=on\0"						\
 	"set_bootargs=setenv bootargs ${console_args} ${root_args} ${misc_args}\0" \
 	"bootfile=/home/user/file\0"					\
-	"osfile=/home/user/uImage-XPedite5370\0"			\
-	"fdtfile=/home/user/xpedite5370.dtb\0"				\
+	"osfile=/home/user/board.uImage\0"				\
+	"fdtfile=/home/user/board.dtb\0"				\
 	"ubootfile=/home/user/u-boot.bin\0"				\
 	"fdtaddr=c00000\0"						\
 	"osaddr=0x1000000\0"						\
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v2 6/13 post/i2c: General clean up

In reply to Peter Tyser

- Clean up ifdeffery
- Update coding style

No functional change should have occurred.

---
 post/drivers/i2c.c |   48 +++++++++++++++++++++++-------------------------
 1 files changed, 23 insertions(+), 25 deletions(-)
post/drivers/i2c.c +23 -25
index b152dea..84a6035 100644
@@ -21,8 +21,6 @@
  * MA 02111-1307 USA
  */
 
-#include <common.h>
-
 /*
  * I2C test
  *
@@ -36,6 +34,7 @@
  * #endif
  */
 
+#include <common.h>
 #include <post.h>
 #include <i2c.h>
 
@@ -44,42 +43,41 @@
 int i2c_post_test (int flags)
 {
 	unsigned int i;
+#ifndef I2C_ADDR_LIST
+	for (i = 0; i < 128; i++)
+		if (i2c_probe (i) == 0)
+			return 0;
+
+	/* No devices found */
+	return -1;
+#else
 	unsigned int good = 0;
-#ifdef I2C_ADDR_LIST
 	unsigned int bad  = 0;
 	int j;
 	unsigned char i2c_addr_list[] = I2C_ADDR_LIST;
 	unsigned char i2c_miss_list[] = I2C_ADDR_LIST;
-#endif
 
 	for (i = 0; i < 128; i++) {
-		if (i2c_probe (i) == 0) {
-#ifndef	I2C_ADDR_LIST
-			good++;
-#else	/* I2C_ADDR_LIST */
-			for (j=0; j<sizeof(i2c_addr_list); ++j) {
-				if (i == i2c_addr_list[j]) {
-					good++;
-					i2c_miss_list[j] = 0xFF;
-					break;
-				}
-			}
-			if (j == sizeof(i2c_addr_list)) {
-				bad++;
-				post_log ("I2C: addr %02X not expected\n",
-						i);
+		if (i2c_probe(i) != 0)
+			continue;
+		for (j = 0; j < sizeof(i2c_addr_list); ++j) {
+			if (i == i2c_addr_list[j]) {
+				good++;
+				i2c_miss_list[j] = 0xFF;
+				break;
 			}
-#endif	/* I2C_ADDR_LIST */
+		}
+
+		if (j == sizeof(i2c_addr_list)) {
+			bad++;
+			post_log("I2C: addr %02X not expected\n", i);
 		}
 	}
 
-#ifndef	I2C_ADDR_LIST
-	return good > 0 ? 0 : -1;
-#else	/* I2C_ADDR_LIST */
 	if (good != sizeof(i2c_addr_list)) {
-		for (j=0; j<sizeof(i2c_miss_list); ++j) {
+		for (j = 0; j < sizeof(i2c_miss_list); ++j) {
 			if (i2c_miss_list[j] != 0xFF) {
-				post_log ("I2C: addr %02X did not respond\n",
+				post_log("I2C: addr %02X did not respond\n",
 						i2c_miss_list[j]);
 			}
 		}
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH v2 6/13 post/i2c: General clean up

Dear Kumar,

Quoted 10 lines · In message <[email protected]> Peter Tyser…

- Clean up ifdeffery
- Update coding style

No functional change should have occurred.

---
 post/drivers/i2c.c |   48 +++++++++++++++++++++++-------------------------
 1 files changed, 23 insertions(+), 25 deletions(-)

for this and the other POST related patches of this series.

Please pull the whole series through the mpc85xx repo.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can do this in a number of ways.     IBM chose to do all of them.
Why do you find that funny?        -- D. Taylor, Computer Science 350
#7 lore raw

PATCH v2 7/13 post/i2c: Clean up detection logic

In reply to Peter Tyser

The logic previously used in the I2C post was a bit convoluted.

---
 post/drivers/i2c.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)
post/drivers/i2c.c +13 -16
index 84a6035..0cbbf77 100644
@@ -51,38 +51,35 @@ int i2c_post_test (int flags)
 	/* No devices found */
 	return -1;
 #else
-	unsigned int good = 0;
-	unsigned int bad  = 0;
+	unsigned int ret  = 0;
 	int j;
-	unsigned char i2c_addr_list[] = I2C_ADDR_LIST;
-	unsigned char i2c_miss_list[] = I2C_ADDR_LIST;
+	const unsigned char i2c_addr_list[] = I2C_ADDR_LIST;
 
 	for (i = 0; i < 128; i++) {
 		if (i2c_probe(i) != 0)
 			continue;
+
 		for (j = 0; j < sizeof(i2c_addr_list); ++j) {
 			if (i == i2c_addr_list[j]) {
-				good++;
-				i2c_miss_list[j] = 0xFF;
+				i2c_addr_list[j] = 0xff;
 				break;
 			}
 		}
 
 		if (j == sizeof(i2c_addr_list)) {
-			bad++;
-			post_log("I2C: addr %02X not expected\n", i);
+			ret = -1;
+			post_log("I2C: addr %02x not expected\n", i);
 		}
 	}
 
-	if (good != sizeof(i2c_addr_list)) {
-		for (j = 0; j < sizeof(i2c_miss_list); ++j) {
-			if (i2c_miss_list[j] != 0xFF) {
-				post_log("I2C: addr %02X did not respond\n",
-						i2c_miss_list[j]);
-			}
-		}
+	for (i = 0; i < sizeof(i2c_addr_list); ++i) {
+		if (i2c_addr_list[i] == 0xff)
+			continue;
+		post_log("I2C: addr %02x did not respond\n", i2c_addr_list[i]);
+		ret = -1;
 	}
-	return ((good == sizeof(i2c_addr_list)) && (bad == 0)) ? 0 : -1;
+
+	return ret;
 #endif
 }
 
Signature · 1 line
1.7.0.4
#8 lore raw

PATCH 1/1 post/drivers/i2c.c: fix compile error

Commit 7e263ce "post/i2c: Clean up detection logic" added a "const" qualifier to the declaration of i2c_addr_list[], missing the fact that the list gets modified later in the code, which results in build errors like these:

i2c.c: In function 'i2c_post_test':
i2c.c:88: error: assignment of read-only location

Remove the incorrect "const".

Cc Peter Tyser <[email protected]>
Cc Heiko Schocher <[email protected]>
---
 post/drivers/i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
post/drivers/i2c.c +1 -1
index 3080e81..4a1b1a4 100644
@@ -74,7 +74,7 @@ int i2c_post_test (int flags)
 #else
 	unsigned int ret  = 0;
 	int j;
-	const unsigned char i2c_addr_list[] = CONFIG_SYS_POST_I2C_ADDRS;
+	unsigned char i2c_addr_list[] = CONFIG_SYS_POST_I2C_ADDRS;
 
 	/* Start at address 1, address 0 is the general call address */
 	for (i = 1; i < 128; i++) {
Signature · 1 line
1.7.2.3
#9 lore raw

PATCH 1/1 post/drivers/i2c.c: fix compile error

Hello Wolfgang,

Quoted 8 lines · Wolfgang Denk

Commit 7e263ce "post/i2c: Clean up detection logic" added a "const" qualifier to the declaration of i2c_addr_list[], missing the fact that the list gets modified later in the code, which results in build errors like these:

i2c.c: In function 'i2c_post_test':
i2c.c:88: error: assignment of read-only location

Quoted 8 lines

Remove the incorrect "const".

Cc Peter Tyser <[email protected]>
Cc Heiko Schocher <[email protected]>
---
 post/drivers/i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Thanks for detecting this. If you want, you can apply this patch directly.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#10 lore raw

PATCH 1/1 post/drivers/i2c.c: fix compile error

In reply to Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:

Commit 7e263ce "post/i2c: Clean up detection logic" added a "const" qualifier to the declaration of i2c_addr_list[], missing the fact that the list gets modified later in the code, which results in build errors like these:

i2c.c: In function 'i2c_post_test':
i2c.c:88: error: assignment of read-only location

Quoted 8 lines

Remove the incorrect "const".

Cc Peter Tyser <[email protected]>
Cc Heiko Schocher <[email protected]>
---
 post/drivers/i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The computer programmer is a creator of universes for which he alone
is responsible. Universes of virtually unlimited  complexity  can  be
created  in  the  form  of  computer  programs." - Joseph Weizenbaum,
_Computer Power and Human Reason_
#11 lore raw

PATCH v2 8/13 post/i2c: Don't probe address 0

In reply to Peter Tyser

According to the I2C specification device address 0 is the "general call address", ie a broadcast address. The I2C specification states that the format of a general call uses at least 2 bytes, which U-Boot's probing routine does not adhere to.

Not probing device address 0 will prevent possible issues with devices that accept general calls. Additionally, this change shouldn't reduce POST coverage since each I2C device should still be accessed via its own, unique address.

---
 post/drivers/i2c.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
post/drivers/i2c.c +4 -2
index 0cbbf77..3508177 100644
@@ -44,7 +44,8 @@ int i2c_post_test (int flags)
 {
 	unsigned int i;
 #ifndef I2C_ADDR_LIST
-	for (i = 0; i < 128; i++)
+	/* Start at address 1, address 0 is the general call address */
+	for (i = 1; i < 128; i++)
 		if (i2c_probe (i) == 0)
 			return 0;
 
@@ -55,7 +56,8 @@ int i2c_post_test (int flags)
 	int j;
 	const unsigned char i2c_addr_list[] = I2C_ADDR_LIST;
 
-	for (i = 0; i < 128; i++) {
+	/* Start@address 1, address 0 is the general call address */
+	for (i = 1; i < 128; i++) {
 		if (i2c_probe(i) != 0)
 			continue;
 
Signature · 1 line
1.7.0.4
#12 lore raw

PATCH v2 9/13 post/i2c: Rename I2C_ADDR_LIST to CONFIG_SYS_POST_I2C_ADDRS

In reply to Peter Tyser
CC hs at denx.de
---
 doc/README.POST           |   11 ++++-----
 include/configs/KUP4K.h   |    6 ++--
 include/configs/KUP4X.h   |    6 ++--
 include/configs/TB5200.h  |    8 +++---
 include/configs/TQM5200.h |    8 +++---
 include/configs/cm5200.h  |    4 ++-
 include/configs/lwmon.h   |   50 ++++++++++++++++++++++----------------------
 include/configs/lwmon5.h  |   15 ++++++-------
 include/configs/spieval.h |    8 +++---
 post/drivers/i2c.c        |    8 +++---
 10 files changed, 62 insertions(+), 62 deletions(-)
doc/README.POST +5 -6
index eeb218d..695497e 100644
@@ -659,12 +659,11 @@ not need any modifications for porting them to another board/CPU.
 2.2.2.1. I2C test
 
 For verifying the I2C bus, a full I2C bus scanning will be performed
-using the i2c_probe() routine. If any I2C device is found, the test
-will be considered as passed, otherwise failed. This particular way
-will be used because it provides the most common method of testing.
-For example, using the internal loopback mode of the CPM I2C
-controller for testing would not work on boards where the software
-I2C driver (also known as bit-banged driver) is used.
+using the i2c_probe() routine. If a board defines
+CONFIG_SYS_POST_I2C_ADDRS the I2C test will pass if all devices
+listed in CONFIG_SYS_POST_I2C_ADDRS are found, and no additional
+devices are detected.  If CONFIG_SYS_POST_I2C_ADDRS is not defined
+the test will pass if any I2C device is found.
 
 2.2.2.2. Watchdog timer test
 
include/configs/KUP4K.h +3 -3
index 9702d63..c8e0ff2 100644
@@ -139,9 +139,9 @@
 
 /* List of I2C addresses to be verified by POST */
 
-#define I2C_ADDR_LIST	{CONFIG_SYS_I2C_PICIO_ADDR,	\
-			CONFIG_SYS_I2C_RTC_ADDR,	\
-			}
+#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_PICIO_ADDR,	\
+					 CONFIG_SYS_I2C_RTC_ADDR,	\
+					}
 
 #define CONFIG_RTC_PCF8563		/* use Philips PCF8563 RTC	*/
 
include/configs/KUP4X.h +3 -3
index 9613ed9..ce731e3 100644
@@ -149,9 +149,9 @@
 
 /* List of I2C addresses to be verified by POST */
 
-#define I2C_ADDR_LIST	{CONFIG_SYS_I2C_PICIO_ADDR,	\
-			CONFIG_SYS_I2C_RTC_ADDR,	\
-			}
+#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_PICIO_ADDR,	\
+					 CONFIG_SYS_I2C_RTC_ADDR,	\
+					}
 
 
 #define CONFIG_RTC_PCF8563		/* use Philips PCF8563 RTC	*/
include/configs/TB5200.h +4 -4
index ad86e2e..f336e8d 100644
@@ -251,10 +251,10 @@
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	20
 
 /* List of I2C addresses to be verified by POST */
-#undef I2C_ADDR_LIST
-#define I2C_ADDR_LIST	{	CONFIG_SYS_I2C_EEPROM_ADDR,	\
-				CONFIG_SYS_I2C_RTC_ADDR,	\
-				CONFIG_SYS_I2C_SLAVE }
+#undef CONFIG_SYS_POST_I2C_ADDRS
+#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_EEPROM_ADDR,	\
+					 CONFIG_SYS_I2C_RTC_ADDR,	\
+					 CONFIG_SYS_I2C_SLAVE}
 
 /*
  * Flash configuration
include/configs/TQM5200.h +4 -4
index 2612c7a..794e11b 100644
@@ -370,10 +370,10 @@
 
 /* List of I2C addresses to be verified by POST */
 #if defined (CONFIG_MINIFAP)
-#undef I2C_ADDR_LIST
-#define I2C_ADDR_LIST	{	CONFIG_SYS_I2C_EEPROM_ADDR,	\
-				CONFIG_SYS_I2C_HWMON_ADDR,	\
-				CONFIG_SYS_I2C_SLAVE }
+#undef CONFIG_SYS_POST_I2C_ADDRS
+#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_EEPROM_ADDR,	\
+					 CONFIG_SYS_I2C_HWMON_ADDR,	\
+					 CONFIG_SYS_I2C_SLAVE}
 #endif
 
 /*
include/configs/cm5200.h +3 -1
index 1b129a2..af6769b 100644
@@ -80,7 +80,9 @@
 #define CONFIG_POST		(CONFIG_SYS_POST_MEMORY | CONFIG_SYS_POST_CPU | CONFIG_SYS_POST_I2C)
 #define MPC5XXX_SRAM_POST_SIZE	(MPC5XXX_SRAM_SIZE - 4)
 /* List of I2C addresses to be verified by POST */
-#define I2C_ADDR_LIST		{ CONFIG_SYS_I2C_SLAVE, CONFIG_SYS_I2C_IO, CONFIG_SYS_I2C_EEPROM }
+#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_SLAVE,	\
+					 CONFIG_SYS_I2C_IO,	\
+					 CONFIG_SYS_I2C_EEPROM}
 
 /* display image timestamps */
 #define CONFIG_TIMESTAMP	1
include/configs/lwmon.h +25 -25

57 lines not on this page · raw message

include/configs/lwmon5.h +7 -8
index a4e92cc..63e22d4 100644
@@ -306,14 +306,13 @@
 #define CONFIG_SYS_I2C_KEYBD_ADDR	0x56	/* PIC LWE keyboard		*/
 #define CONFIG_SYS_I2C_DSPIC_IO_ADDR	0x57	/* PIC I/O addr               */
 
-#define I2C_ADDR_LIST	{						\
-			CONFIG_SYS_I2C_RTC_ADDR,			\
-			CONFIG_SYS_I2C_EEPROM_CPU_ADDR,			\
-			CONFIG_SYS_I2C_EEPROM_MB_ADDR,			\
-			CONFIG_SYS_I2C_DSPIC_ADDR,			\
-			CONFIG_SYS_I2C_DSPIC_2_ADDR,			\
-			CONFIG_SYS_I2C_DSPIC_KEYB_ADDR,			\
-			CONFIG_SYS_I2C_DSPIC_IO_ADDR }
+#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_RTC_ADDR,	\
+					 CONFIG_SYS_I2C_EEPROM_CPU_ADDR,\
+					 CONFIG_SYS_I2C_EEPROM_MB_ADDR,	\
+					 CONFIG_SYS_I2C_DSPIC_ADDR,	\
+					 CONFIG_SYS_I2C_DSPIC_2_ADDR,	\
+					 CONFIG_SYS_I2C_DSPIC_KEYB_ADDR,\
+					 CONFIG_SYS_I2C_DSPIC_IO_ADDR }
 
 /*
  * Pass open firmware flat tree
include/configs/spieval.h +4 -4
index b5ac168..880c8a3 100644
@@ -271,10 +271,10 @@
 
 /* List of I2C addresses to be verified by POST */
 #if defined (CONFIG_MINIFAP)
-#undef I2C_ADDR_LIST
-#define I2C_ADDR_LIST	{	CONFIG_SYS_I2C_EEPROM_ADDR,	\
-				CONFIG_SYS_I2C_HWMON_ADDR,	\
-				CONFIG_SYS_I2C_SLAVE }
+#undef CONFIG_SYS_POST_I2C_ADDRS
+#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_EEPROM_ADDR,	\
+					 CONFIG_SYS_I2C_HWMON_ADDR,	\
+					 CONFIG_SYS_I2C_SLAVE}
 #endif
 
 /*
post/drivers/i2c.c +4 -4
index 3508177..e6f4c6a 100644
@@ -26,10 +26,10 @@
  *
  * For verifying the I2C bus, a full I2C bus scanning is performed.
  *
- * #ifdef I2C_ADDR_LIST
+ * #ifdef CONFIG_SYS_POST_I2C_ADDRS
  *   The test is considered as passed if all the devices and
  *   only the devices in the list are found.
- * #else [ ! I2C_ADDR_LIST ]
+ * #else [ ! CONFIG_SYS_POST_I2C_ADDRS ]
  *   The test is considered as passed if any I2C device is found.
  * #endif
  */
@@ -43,7 +43,7 @@
 int i2c_post_test (int flags)
 {
 	unsigned int i;
-#ifndef I2C_ADDR_LIST
+#ifndef CONFIG_SYS_POST_I2C_ADDRS
 	/* Start at address 1, address 0 is the general call address */
 	for (i = 1; i < 128; i++)
 		if (i2c_probe (i) == 0)
@@ -54,7 +54,7 @@ int i2c_post_test (int flags)
 #else
 	unsigned int ret  = 0;
 	int j;
-	const unsigned char i2c_addr_list[] = I2C_ADDR_LIST;
+	const unsigned char i2c_addr_list[] = CONFIG_SYS_POST_I2C_ADDRS;
 
 	/* Start@address 1, address 0 is the general call address */
 	for (i = 1; i < 128; i++) {
Signature · 1 line
1.7.0.4
#13 lore raw

PATCH v2 9/13 post/i2c: Rename I2C_ADDR_LIST to CONFIG_SYS_POST_I2C_ADDRS

Hello Peter,

Quoted 14 lines · Peter Tyser
CC hs at denx.de
---
 doc/README.POST           |   11 ++++-----
 include/configs/KUP4K.h   |    6 ++--
 include/configs/KUP4X.h   |    6 ++--
 include/configs/TB5200.h  |    8 +++---
 include/configs/TQM5200.h |    8 +++---
 include/configs/cm5200.h  |    4 ++-
 include/configs/lwmon.h   |   50 ++++++++++++++++++++++----------------------
 include/configs/lwmon5.h  |   15 ++++++-------
 include/configs/spieval.h |    8 +++---
 post/drivers/i2c.c        |    8 +++---
 10 files changed, 62 insertions(+), 62 deletions(-)

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#14 lore raw

PATCH v2 9/13 post/i2c: Rename I2C_ADDR_LIST to CONFIG_SYS_POST_I2C_ADDRS

In reply to Peter Tyser

Dear Peter Tyser,

Quoted 14 lines · In message <[email protected]> you wrote:
CC hs at denx.de
---
 doc/README.POST           |   11 ++++-----
 include/configs/KUP4K.h   |    6 ++--
 include/configs/KUP4X.h   |    6 ++--
 include/configs/TB5200.h  |    8 +++---
 include/configs/TQM5200.h |    8 +++---
 include/configs/cm5200.h  |    4 ++-
 include/configs/lwmon.h   |   50 ++++++++++++++++++++++----------------------
 include/configs/lwmon5.h  |   15 ++++++-------
 include/configs/spieval.h |    8 +++---
 post/drivers/i2c.c        |    8 +++---
 10 files changed, 62 insertions(+), 62 deletions(-)

Hm... it seems these patches were not compile tested on the affected boards?

Commit 60aaaa0 "post/i2c: Rename I2C_ADDR_LIST to CONFIG_SYS_POST_I2C_ADDRS" breaks building of the KUP4X, MiniFAP, TB5200, TB5200_B, cm5200, lwmon, and lwmon5 configurations like that:

Configuring for lwmon5 board...
i2c.c: In function 'i2c_post_test':
i2c.c:88: error: assignment of read-only location make[2]: *** [/work/wd/tmp-ppc/post/drivers/i2c.o] Error 1 make[2]: *** Waiting for unfinished jobs.... i2c.c: In function 'i2c_post_test':
i2c.c:88: error: assignment of read-only location make[2]: *** [/work/wd/tmp-ppc/post/drivers/i2c.o] Error 1

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The evolution of the human race will not be accomplished in  the  ten
thousand  years  of  tame  animals,  but in the million years of wild
animals, because man is and will always be a wild animal.
                                              - Charles Galton Darwin
#15 lore raw

PATCH v2 10/13 post/i2c: Add ability to ignore I2C devices

In reply to Peter Tyser

Add the ability to not report an I2C POST error for a set of given I2C addresses on bootup. This is useful for cases when a device may or may not be present, and neither case is considered an error. For example:

- Some form factors such as XMC and Compact PCI Express have an I2C EEPROM whose address changes based on geographical address. Eg installed in one slot its EEPROM address is, 0x50, in another its 0x51, etc. This allows multiple devices to have their EEPROMs present on the same I2C bus. Thus the I2C devices present for an XMC or CPCIe card depend on if and where other cards are installed in the same system.

- Some cards have optional I2C devices. Eg one hardware build configuration has different I2C devices than another and software can't determine if the optional device should be present or not.

- Some cards have optional daughtercards with I2C devices on them.

- I2C EEPROMs address range depends on their size. Its possible to support differently size EEPROMs by only probing the EEPROM's base address and ignoring the other addresses that are impacted by its size.

A new CONFIG_SYS_POST_I2C_IGNORES define has been added which specifies a list of I2C addresses for the I2C POST to ignore.

---
 doc/README.POST    |    8 ++++++++
 post/drivers/i2c.c |   26 ++++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)
doc/README.POST +8 -0
index 695497e..6815d49 100644
@@ -665,6 +665,14 @@ listed in CONFIG_SYS_POST_I2C_ADDRS are found, and no additional
 devices are detected.  If CONFIG_SYS_POST_I2C_ADDRS is not defined
 the test will pass if any I2C device is found.
 
+The CONFIG_SYS_POST_I2C_IGNORES define can be used to list I2C
+devices which may or may not be present when using
+CONFIG_SYS_POST_I2C_ADDRS.  The I2C POST test will pass regardless
+if the devices in CONFIG_SYS_POST_I2C_IGNORES are found or not.
+This is useful in cases when I2C devices are optional (eg on a
+daughtercard that may or may not be present) or not critical
+to board operation.
+
 2.2.2.2. Watchdog timer test
 
 To test the watchdog timer the scheme mentioned above (refer to
post/drivers/i2c.c +24 -2
index e6f4c6a..3080e81 100644
@@ -27,8 +27,12 @@
  * For verifying the I2C bus, a full I2C bus scanning is performed.
  *
  * #ifdef CONFIG_SYS_POST_I2C_ADDRS
- *   The test is considered as passed if all the devices and
- *   only the devices in the list are found.
+ *   The test is considered as passed if all the devices and only the devices
+ *   in the list are found.
+ *   #ifdef CONFIG_SYS_POST_I2C_IGNORES
+ *     Ignore devices listed in CONFIG_SYS_POST_I2C_IGNORES.  These devices
+ *     are optional or not vital to board functionality.
+ *   #endif
  * #else [ ! CONFIG_SYS_POST_I2C_ADDRS ]
  *   The test is considered as passed if any I2C device is found.
  * #endif
@@ -40,12 +44,28 @@
 
 #if CONFIG_POST & CONFIG_SYS_POST_I2C
 
+static int i2c_ignore_device(unsigned int chip)
+{
+#ifdef CONFIG_SYS_POST_I2C_IGNORES
+	const unsigned char i2c_ignore_list[] = CONFIG_SYS_POST_I2C_IGNORES;
+	int i;
+
+	for (i = 0; i < sizeof(i2c_ignore_list); i++)
+		if (i2c_ignore_list[i] == chip)
+			return 1;
+#endif
+
+	return 0;
+}
+
 int i2c_post_test (int flags)
 {
 	unsigned int i;
 #ifndef CONFIG_SYS_POST_I2C_ADDRS
 	/* Start at address 1, address 0 is the general call address */
 	for (i = 1; i < 128; i++)
+		if (i2c_ignore_device(i))
+			continue;
 		if (i2c_probe (i) == 0)
 			return 0;
 
@@ -58,6 +78,8 @@ int i2c_post_test (int flags)
 
 	/* Start@address 1, address 0 is the general call address */
 	for (i = 1; i < 128; i++) {
+		if (i2c_ignore_device(i))
+			continue;
 		if (i2c_probe(i) != 0)
 			continue;
 
Signature · 1 line
1.7.0.4
#16 lore raw

PATCH v2 11/13 mpc86xx: Add generic POST word read/write support

In reply to Peter Tyser

The PIC's TFRR register doesn't affect hardware and is generally unused, so use as storage for the POST word.

---
 include/post.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
include/post.h +4 -0
index daa9047..abe47da 100644
@@ -60,6 +60,10 @@
 #include <asm/immap_85xx.h>
 #define _POST_WORD_ADDR	(CONFIG_SYS_IMMR + offsetof(ccsr_pic_t, tfrr))
 
+#elif defined (CONFIG_MPC86xx)
+#include <asm/immap_86xx.h>
+#define _POST_WORD_ADDR	(CONFIG_SYS_IMMR + offsetof(ccsr_pic_t, tfrr))
+
 #elif defined (CONFIG_4xx)
 #define _POST_WORD_ADDR \
 	(CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
Signature · 1 line
1.7.0.4
#17 lore raw

PATCH v2 12/13 xes: Add POST support for 8xxx boards

In reply to Peter Tyser

Add memory and I2C posts to the XPedite517x/520x/537x board families.

---
 include/configs/xpedite517x.h |   17 +++++++++++++++++
 include/configs/xpedite520x.h |   10 ++++++++++
 include/configs/xpedite537x.h |   15 +++++++++++++++
 3 files changed, 42 insertions(+), 0 deletions(-)
include/configs/xpedite517x.h +17 -0
index 2b6e895..8df9edd 100644
@@ -108,6 +108,21 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_ALT_MEMTEST
 #define CONFIG_SYS_MEMTEST_START	0x10000000
 #define CONFIG_SYS_MEMTEST_END		0x20000000
+#define CONFIG_POST			(CONFIG_SYS_POST_MEMORY |\
+					 CONFIG_SYS_POST_I2C)
+#define I2C_ADDR_LIST			{CONFIG_SYS_I2C_DS1621_ADDR,	\
+					 CONFIG_SYS_I2C_DS4510_ADDR,	\
+					 CONFIG_SYS_I2C_EEPROM_ADDR,	\
+					 CONFIG_SYS_I2C_LM90_ADDR,	\
+					 CONFIG_SYS_I2C_PCA9553_ADDR,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR0,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR1,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR2,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR3,	\
+					 CONFIG_SYS_I2C_PEX8518_ADDR,	\
+					 CONFIG_SYS_I2C_RTC_ADDR}
+/* The XPedite5170 can host an XMC which has an EEPROM at address 0x50 */
+#define I2C_ADDR_IGNORE_LIST		{0x50}
 
 /*
  * Memory map
@@ -259,6 +274,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_I2C_DS1621_ADDR	0x48
 #define CONFIG_DTT_DS1621
 #define CONFIG_DTT_SENSORS		{ 0 }
+#define CONFIG_SYS_I2C_LM90_ADDR	0x4c
 
 /* I2C EEPROM - AT24C128B */
 #define CONFIG_SYS_I2C_EEPROM_ADDR		0x54
@@ -282,6 +298,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_I2C_PCA953X_ADDR2	0x1e
 #define CONFIG_SYS_I2C_PCA953X_ADDR3	0x1f
 #define CONFIG_SYS_I2C_PCA953X_ADDR	CONFIG_SYS_I2C_PCA953X_ADDR0
+#define CONFIG_SYS_I2C_PCA9553_ADDR	0x62
 
 /*
  * PU = pulled high, PD = pulled low
include/configs/xpedite520x.h +10 -0
index fc15d8e..2f31337 100644
@@ -93,6 +93,13 @@
 #define CONFIG_SYS_ALT_MEMTEST
 #define CONFIG_SYS_MEMTEST_START	0x10000000
 #define CONFIG_SYS_MEMTEST_END		0x20000000
+#define CONFIG_POST			(CONFIG_SYS_POST_MEMORY | \
+					 CONFIG_SYS_POST_I2C)
+#define I2C_ADDR_LIST			{CONFIG_SYS_I2C_MAX1237_ADDR,	\
+					 CONFIG_SYS_I2C_EEPROM_ADDR,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR0,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR1,	\
+					 CONFIG_SYS_I2C_RTC_ADDR}
 
 /*
  * Memory map
@@ -265,6 +272,9 @@
 #define CONFIG_SYS_PCA953X_P14_IO6		0x40
 #define CONFIG_SYS_PCA953X_P14_IO7		0x80
 
+/* 12-bit ADC used to measure CPU diode */
+#define CONFIG_SYS_I2C_MAX1237_ADDR		0x34
+
 /*
  * General PCI
  * Memory space is mapped 1-1, but I/O space must start from 0.
include/configs/xpedite537x.h +15 -0
index 309e32c..e7de13a 100644
@@ -111,6 +111,20 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #define CONFIG_SYS_ALT_MEMTEST
 #define CONFIG_SYS_MEMTEST_START	0x10000000
 #define CONFIG_SYS_MEMTEST_END		0x20000000
+#define CONFIG_POST			(CONFIG_SYS_POST_MEMORY | \
+					 CONFIG_SYS_POST_I2C)
+#define I2C_ADDR_LIST			{CONFIG_SYS_I2C_DS1621_ADDR,	\
+					 CONFIG_SYS_I2C_DS4510_ADDR,	\
+					 CONFIG_SYS_I2C_EEPROM_ADDR,	\
+					 CONFIG_SYS_I2C_LM90_ADDR,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR0,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR1,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR2,	\
+					 CONFIG_SYS_I2C_PCA953X_ADDR3,	\
+					 CONFIG_SYS_I2C_PEX8518_ADDR,	\
+					 CONFIG_SYS_I2C_RTC_ADDR}
+/* The XPedite5370 can host an XMC which has an EEPROM at address 0x50 */
+#define I2C_ADDR_IGNORE_LIST		{0x50}
 
 /*
  * Memory map
@@ -266,6 +280,7 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #define CONFIG_SYS_I2C_DS1621_ADDR	0x48
 #define CONFIG_DTT_DS1621
 #define CONFIG_DTT_SENSORS		{ 0 }
+#define CONFIG_SYS_I2C_LM90_ADDR	0x4c
 
 /* I2C EEPROM - AT24C128B */
 #define CONFIG_SYS_I2C_EEPROM_ADDR		0x54
Signature · 1 line
1.7.0.4
#18 lore raw

PATCH v2 13/13 XPedite5500 board support

In reply to Peter Tyser

From: John Schmoller <[email protected]>

Initial support for Extreme Engineering Solutions XPedite5500 - a P2020-based PMC/XMC single board computer.

---
 MAINTAINERS                         |    1 +
 board/xes/common/Makefile           |    2 +
 board/xes/common/fsl_8xxx_clk.c     |   11 +
 board/xes/xpedite550x/Makefile      |   39 +++
 board/xes/xpedite550x/ddr.c         |  165 ++++++++++
 board/xes/xpedite550x/law.c         |   54 +++
 board/xes/xpedite550x/tlb.c         |   98 ++++++
 board/xes/xpedite550x/xpedite550x.c |  107 ++++++
 boards.cfg                          |    1 +
 include/configs/xpedite550x.h       |  607 +++++++++++++++++++++++++++++++++++
 10 files changed, 1085 insertions(+), 0 deletions(-)
 create mode 100644 board/xes/xpedite550x/Makefile
 create mode 100644 board/xes/xpedite550x/ddr.c
 create mode 100644 board/xes/xpedite550x/law.c
 create mode 100644 board/xes/xpedite550x/tlb.c
 create mode 100644 board/xes/xpedite550x/xpedite550x.c
 create mode 100644 include/configs/xpedite550x.h
MAINTAINERS +1 -0
index 2da0561..b0da631 100644
@@ -466,6 +466,7 @@ Peter Tyser <[email protected]>
 	xpedite5170	MPC8640
 	xpedite5200	MPC8548
 	xpedite5370	MPC8572
+	xpedite5500	P2020
 
 David Updegraff <[email protected]>
 
board/xes/common/Makefile +2 -0
index bfade31..16e0b66 100644
@@ -32,7 +32,9 @@ LIB	= $(obj)lib$(VENDOR).a
 COBJS-$(CONFIG_FSL_PCI_INIT)	+= fsl_8xxx_pci.o
 COBJS-$(CONFIG_MPC8572)		+= fsl_8xxx_clk.o
 COBJS-$(CONFIG_MPC86xx)		+= fsl_8xxx_clk.o
+COBJS-$(CONFIG_P2020)		+= fsl_8xxx_clk.o
 COBJS-$(CONFIG_FSL_DDR2)	+= fsl_8xxx_ddr.o
+COBJS-$(CONFIG_FSL_DDR3)	+= fsl_8xxx_ddr.o
 COBJS-$(CONFIG_MPC85xx)		+= fsl_8xxx_misc.o board.o
 COBJS-$(CONFIG_MPC86xx)		+= fsl_8xxx_misc.o board.o
 COBJS-$(CONFIG_NAND_ACTL)	+= actl_nand.o
board/xes/common/fsl_8xxx_clk.c +11 -0
index f4a17b7..20d0a30 100644
@@ -38,7 +38,11 @@ unsigned long get_board_sys_clk(ulong dummy)
 	if (in_be32(&gur->gpporcr) & 0x10000)
 		return 66666666;
 	else
+#ifdef CONFIG_P2020
+		return 100000000;
+#else
 		return 50000000;
+#endif
 }
 
 #ifdef CONFIG_MPC85xx
@@ -54,6 +58,13 @@ unsigned long get_board_ddr_clk(ulong dummy)
 	if (ddr_ratio == 0x7)
 		return get_board_sys_clk(dummy);
 
+#ifdef CONFIG_P2020
+	if (in_be32(&gur->gpporcr) & 0x20000)
+		return 66666666;
+	else
+		return 100000000;
+#else
 	return 66666666;
+#endif
 }
 #endif
board/xes/xpedite550x/Makefile new file +39 -0
new file mode 100644
index 0000000..8980a4b
@@ -0,0 +1,39 @@
+#
+# Copyright 2007-2008 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 as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= $(BOARD).o
+COBJS-y	+= ddr.o
+COBJS-y	+= law.o
+COBJS-y	+= tlb.o
+
+SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+	rm -f $(OBJS) $(SOBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/xes/xpedite550x/ddr.c new file +165 -0

165 lines not on this page · raw message

board/xes/xpedite550x/law.c new file +54 -0

54 lines not on this page · raw message

board/xes/xpedite550x/tlb.c new file +98 -0

98 lines not on this page · raw message

board/xes/xpedite550x/xpedite550x.c new file +107 -0

107 lines not on this page · raw message

boards.cfg +1 -0
index a524272..e8afdb1 100644
@@ -558,6 +558,7 @@ MPC8560ADS	powerpc	mpc85xx		mpc8560ads	freescale
 MPC8568MDS	powerpc	mpc85xx		mpc8568mds	freescale
 xpedite520x	powerpc	mpc85xx		-		xes
 xpedite537x	powerpc	mpc85xx		-		xes
+xpedite550x	powerpc	mpc85xx		-		xes
 sbc8540_33	powerpc	mpc85xx		sbc8560		-		-	SBC8540
 sbc8540_66	powerpc	mpc85xx		sbc8560		-		-	SBC8540
 sbc8548_PCI_33	powerpc	mpc85xx		sbc8548		-		-	sbc8548:PCI,33
include/configs/xpedite550x.h new file +607 -0

607 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#19 lore raw

PATCH v2 1/13 xes: Use common PCI initialization code

In reply to Peter Tyser
Quoted 11 lines · Peter Tyser

Common Freescale code for PCI initialization now exists, so migrate X-ES boards to use it.

---

board/xes/common/fsl_8xxx_pci.c |  328 ++++++---------------------------------
include/configs/XPEDITE5170.h   |   12 +-
include/configs/XPEDITE5200.h   |    6 +-
include/configs/XPEDITE5370.h   |   12 +-
4 files changed, 64 insertions(+), 294 deletions(-)

all applied to 85xx

- k