Skip to contentSkip to conversation

mpc8308_p1m: support for MPC8308 P1M board

PATCH Superseded Ilya Yanok 4 participants 23 messages Aug 25, 2010 – Sep 22, 2010 PowerPC

lore
Share & tools
lore

Ilya Yanok

author
#0 lore raw

PATCH 1/1 mpc8308_p1m: support for MPC8308 P1M board

This patch provides support for MPC8308 P1M board with the following set of features:
Dual UART is supported
NOR flash is supported
Both TSEC Ethernet controllers are supported
PCI Express initialization is supported
Both I2C controllers are supported

---
 MAINTAINERS                     |    1 +
 board/mpc8308_p1m/Makefile      |   52 ++++
 board/mpc8308_p1m/config.mk     |    1 +
 board/mpc8308_p1m/mpc8308_p1m.c |  122 +++++++++
 board/mpc8308_p1m/sdram.c       |  126 +++++++++
 boards.cfg                      |    1 +
 include/configs/mpc8308_p1m.h   |  548 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 851 insertions(+), 0 deletions(-)
 create mode 100644 board/mpc8308_p1m/Makefile
 create mode 100644 board/mpc8308_p1m/config.mk
 create mode 100644 board/mpc8308_p1m/mpc8308_p1m.c
 create mode 100644 board/mpc8308_p1m/sdram.c
 create mode 100644 include/configs/mpc8308_p1m.h
MAINTAINERS +1 -0
index 4b91b0f..e28632a 100644
@@ -490,6 +490,7 @@ Stephen Williams <[email protected]>
 
 Ilya Yanok <[email protected]>
 
+	mpc8308_p1m	MPC8308
 	MPC8308RDB	MPC8308
 
 Roy Zang <[email protected]>
board/mpc8308_p1m/Makefile new file +52 -0

52 lines not on this page · raw message

board/mpc8308_p1m/config.mk new file +1 -0
new file mode 100644
index 0000000..1591df5
@@ -0,0 +1 @@
+TEXT_BASE = 0xFC000000
board/mpc8308_p1m/mpc8308_p1m.c new file +122 -0

122 lines not on this page · raw message

board/mpc8308_p1m/sdram.c new file +126 -0

126 lines not on this page · raw message

boards.cfg +1 -0
index 69c6897..4712fb0 100644
@@ -333,6 +333,7 @@ ppmc8260	powerpc	mpc8260
 RPXsuper	powerpc	mpc8260		rpxsuper
 rsdproto	powerpc	mpc8260
 MPC8266ADS	powerpc	mpc8260		mpc8266ads	freescale
+mpc8308_p1m	powerpc mpc83xx
 MPC8308RDB	powerpc	mpc83xx		mpc8308rdb	freescale
 MPC8323ERDB	powerpc	mpc83xx		mpc8323erdb	freescale
 MPC8349EMDS	powerpc	mpc83xx		mpc8349emds	freescale
include/configs/mpc8308_p1m.h new file +548 -0

548 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#1 lore raw

PATCH v2 1/1 mpc8308_p1m: support for MPC8308 P1M board

This patch provides support for MPC8308 P1M board with the following set of features:
Dual UART is supported
NOR flash is supported
Both TSEC Ethernet controllers are supported
PCI Express initialization is supported
Both I2C controllers are supported

---

Changes from previous version: corrected kernel_addr, fdt_addr and ramdisk_addr values in default environment.

 MAINTAINERS                     |    1 +
 board/mpc8308_p1m/Makefile      |   52 ++++
 board/mpc8308_p1m/config.mk     |    1 +
 board/mpc8308_p1m/mpc8308_p1m.c |  122 +++++++++
 board/mpc8308_p1m/sdram.c       |  126 +++++++++
 boards.cfg                      |    1 +
 include/configs/mpc8308_p1m.h   |  548 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 851 insertions(+), 0 deletions(-)
 create mode 100644 board/mpc8308_p1m/Makefile
 create mode 100644 board/mpc8308_p1m/config.mk
 create mode 100644 board/mpc8308_p1m/mpc8308_p1m.c
 create mode 100644 board/mpc8308_p1m/sdram.c
 create mode 100644 include/configs/mpc8308_p1m.h
MAINTAINERS +1 -0
index 4b91b0f..e28632a 100644
@@ -490,6 +490,7 @@ Stephen Williams <[email protected]>
 
 Ilya Yanok <[email protected]>
 
+	mpc8308_p1m	MPC8308
 	MPC8308RDB	MPC8308
 
 Roy Zang <[email protected]>
board/mpc8308_p1m/Makefile new file +52 -0

52 lines not on this page · raw message

board/mpc8308_p1m/config.mk new file +1 -0
new file mode 100644
index 0000000..1591df5
@@ -0,0 +1 @@
+TEXT_BASE = 0xFC000000
board/mpc8308_p1m/mpc8308_p1m.c new file +122 -0

122 lines not on this page · raw message

board/mpc8308_p1m/sdram.c new file +126 -0

126 lines not on this page · raw message

boards.cfg +1 -0
index 69c6897..4712fb0 100644
@@ -333,6 +333,7 @@ ppmc8260	powerpc	mpc8260
 RPXsuper	powerpc	mpc8260		rpxsuper
 rsdproto	powerpc	mpc8260
 MPC8266ADS	powerpc	mpc8260		mpc8266ads	freescale
+mpc8308_p1m	powerpc mpc83xx
 MPC8308RDB	powerpc	mpc83xx		mpc8308rdb	freescale
 MPC8323ERDB	powerpc	mpc83xx		mpc8323erdb	freescale
 MPC8349EMDS	powerpc	mpc83xx		mpc8349emds	freescale
include/configs/mpc8308_p1m.h new file +548 -0

548 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#2 lore raw

PATCH v2 1/1 mpc8308_p1m: support for MPC8308 P1M board

board/mpc8308_p1m/sdram.c line 53

Quoted 13 lines · On Mon, 6 Sep 2010 12:32:52 +0200 Ilya Yanok <[email protected]> wrote:
board/mpc8308_p1m/sdram.c new file +13 -0
+static void resume_from_sleep(void)
+{
+	u32 magic = *(u32 *)0;
+
+	typedef void (*func_t)(void);
+	func_t resume = *(func_t *)4;
+
+	if (magic == 0xf5153ae5)
+		resume();
+
+	gd->flags &= ~GD_FLG_SILENT;
+	puts("\nResume from sleep failed: bad magic word\n");
+}

8308 does not support deep sleep, so it doesn't need this function.

Likewise, PMCCR1 does not exist on 8308, so don't read it.

Quoted 11 lines
board/mpc8308_p1m/sdram.c new file +11 -0
+/* Fixed sdram init -- doesn't use serial presence detect.
+ *
+ * This is useful for faster booting in configs where the RAM is unlikely
+ * to be changed, or for things like NAND booting where space is tight.
+ */
+static long fixed_sdram(void)
+{
+	immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
+	u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024;
+	u32 msize_log2 = __ilog2(msize);
+

board/mpc8308_p1m/sdram.c line 75

Quoted 10 lines
board/mpc8308_p1m/sdram.c new file +10 -0
+	out_be32(&im->sysconf.ddrlaw[0].bar,
+			CONFIG_SYS_DDR_SDRAM_BASE  & 0xfffff000);
+	out_be32(&im->sysconf.ddrlaw[0].ar, LBLAWAR_EN | (msize_log2 - 1));
+	out_be32(&im->sysconf.ddrcdr, CONFIG_SYS_DDRCDR_VALUE);
+
+	/*
+	 * Erratum DDR3 requires a 50ms delay after clearing DDRCDR[DDR_cfg],
+	 * or the DDR2 controller may fail to initialize correctly.
+	 */
+	udelay(50000);

I don't see this erratum on 8308.

-Scott

author
#3 lore raw

PATCH v3 1/1 mpc8308_p1m: support for MPC8308 P1M board

This patch provides support for MPC8308 P1M board with the following set of features:
Dual UART is supported
NOR flash is supported
Both TSEC Ethernet controllers are supported
PCI Express initialization is supported
Both I2C controllers are supported

---

Scott's comments addressed.

 MAINTAINERS                     |    1 +
 board/mpc8308_p1m/Makefile      |   52 ++++
 board/mpc8308_p1m/config.mk     |    1 +
 board/mpc8308_p1m/mpc8308_p1m.c |  122 +++++++++
 board/mpc8308_p1m/sdram.c       |   93 +++++++
 boards.cfg                      |    1 +
 include/configs/mpc8308_p1m.h   |  548 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 818 insertions(+), 0 deletions(-)
 create mode 100644 board/mpc8308_p1m/Makefile
 create mode 100644 board/mpc8308_p1m/config.mk
 create mode 100644 board/mpc8308_p1m/mpc8308_p1m.c
 create mode 100644 board/mpc8308_p1m/sdram.c
 create mode 100644 include/configs/mpc8308_p1m.h
MAINTAINERS +1 -0
index 4b91b0f..e28632a 100644
@@ -490,6 +490,7 @@ Stephen Williams <[email protected]>
 
 Ilya Yanok <[email protected]>
 
+	mpc8308_p1m	MPC8308
 	MPC8308RDB	MPC8308
 
 Roy Zang <[email protected]>
board/mpc8308_p1m/Makefile new file +52 -0

52 lines not on this page · raw message

board/mpc8308_p1m/config.mk new file +1 -0
new file mode 100644
index 0000000..1591df5
@@ -0,0 +1 @@
+TEXT_BASE = 0xFC000000
board/mpc8308_p1m/mpc8308_p1m.c new file +122 -0

122 lines not on this page · raw message

board/mpc8308_p1m/sdram.c new file +93 -0

93 lines not on this page · raw message

boards.cfg +1 -0
index 69c6897..4712fb0 100644
@@ -333,6 +333,7 @@ ppmc8260	powerpc	mpc8260
 RPXsuper	powerpc	mpc8260		rpxsuper
 rsdproto	powerpc	mpc8260
 MPC8266ADS	powerpc	mpc8260		mpc8266ads	freescale
+mpc8308_p1m	powerpc mpc83xx
 MPC8308RDB	powerpc	mpc83xx		mpc8308rdb	freescale
 MPC8323ERDB	powerpc	mpc83xx		mpc8323erdb	freescale
 MPC8349EMDS	powerpc	mpc83xx		mpc8349emds	freescale
include/configs/mpc8308_p1m.h new file +548 -0

548 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#4 lore raw

PATCH v3 1/1 mpc8308_p1m: support for MPC8308 P1M board

Quoted 8 lines · On Wed, 8 Sep 2010 23:36:59 +0200 Ilya Yanok <[email protected]> wrote:
 MAINTAINERS                     |    1 +
 board/mpc8308_p1m/Makefile      |   52 ++++
 board/mpc8308_p1m/config.mk     |    1 +
 board/mpc8308_p1m/mpc8308_p1m.c |  122 +++++++++
 board/mpc8308_p1m/sdram.c       |   93 +++++++
 boards.cfg                      |    1 +
 include/configs/mpc8308_p1m.h   |  548 +++++++++++++++++++++++++++++++++++++++

missing MAKEALL entry.

board/mpc8308_p1m/config.mk line 1

Quoted 3 lines

+++ b/board/mpc8308_p1m/config.mk

board/mpc8308_p1m/config.mk new file +1 -0
@@ -0,0 +1 @@
+TEXT_BASE = 0xFC000000

ifndef TEXT_BASE
TEXT_BASE = 0xFC000000
endif

board/mpc8308_p1m/mpc8308_p1m.c line 42

Quoted 6 lines
board/mpc8308_p1m/mpc8308_p1m.c new file +6 -0
+int board_early_init_f(void)
+{
+	immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
+
+	if (in_be32(&im->pmc.pmccr1) & PMCCR1_POWER_OFF)
+		gd->flags |= GD_FLG_SILENT;

this needs to be deleted - the 8308 doesn't have a pmccr1. Same problem with the 8308rdb.

board/mpc8308_p1m/mpc8308_p1m.c line 47

Quoted 4 lines
board/mpc8308_p1m/mpc8308_p1m.c new file +4 -0
+	/* initialized GPIO default directions and values */
+	__raw_writel(CONFIG_GPIO_PDAT, &im->gpio[0].dat);
+	__raw_writel(CONFIG_GPIO_PDIR, &im->gpio[0].dir);
+

is there a reason CONFIG_SYS_GPIO1_[DIR|DAT] isn't being used instead of declaring new CONFIG_GPIO_P* macros?

board/mpc8308_p1m/mpc8308_p1m.c line 85

Quoted 3 lines
board/mpc8308_p1m/mpc8308_p1m.c new file +3 -0
+void pci_init_board(void)
+	clrsetbits_be32(&clk->sccr, SCCR_PCIEXP1CM ,
+				    SCCR_PCIEXP1CM_1);

add support for setting sccr PCIEXPCM bits in mpc83xx/cpu_init.c, and define CONFIG_SYS_SCCR_ values in the board config.

board/mpc8308_p1m/mpc8308_p1m.c line 111

Quoted 6 lines
board/mpc8308_p1m/mpc8308_p1m.c new file +6 -0
+int board_eth_init(bd_t *bis)
+{
+	int rv, num_if = 0;
+
+	/* Initialize TSECs first */
+	if ((rv = cpu_eth_init(bis)) >= 0)

no assignments in if statements.

include/configs/mpc8308_p1m.h line 86

Quoted 4 lines

+ * System IO Config
+ */

include/configs/mpc8308_p1m.h new file +2 -0
+#define CONFIG_SYS_SICRH	0xf577d100
+#define CONFIG_SYS_SICRL	0x00000000 /* 3.3V, no delay */

Use the SICR[H|L]_ macros to demystify these values (same for 8308erdb).

include/configs/mpc8308_p1m.h line 89

Quoted 2 lines
include/configs/mpc8308_p1m.h new file +2 -0
+/* GPIO Default input/output settings */
+#define CONFIG_GPIO_PDIR        0x7AAF8C00

this should be defining CONFIG_SYS_GPIO1_DIR instead.

include/configs/mpc8308_p1m.h line 94

Quoted 5 lines
include/configs/mpc8308_p1m.h new file +5 -0
+/*
+ * Default GPIO values:
+ * LED#1 enabled; WLAN enabled; Both COM LED on (orange)
+ */
+#define CONFIG_GPIO_PDAT        0x08008C00

this should be defining CONFIG_SYS_GPIO1_DAT instead.

include/configs/mpc8308_p1m.h line 263

Quoted 2 lines
include/configs/mpc8308_p1m.h new file +2 -0
+#define CONFIG_SYS_LBLAWBAR1_PRELIM	CONFIG_SYS_SJA1000_BASE
+#define CONFIG_SYS_LBLAWAR1_PRELIM	0x8000000E	/* 32KB  */

lose the comment and replace with (LBLAWAR_EN | LBLAWAR_32KB).

Quoted 4 lines
include/configs/mpc8308_p1m.h new file +4 -0
+/*
+ * CPLD on Local Bus
+ */
+#define CONFIG_SYS_CPLD_BASE		0xFBFF8000

include/configs/mpc8308_p1m.h line 278

Quoted 10 lines
include/configs/mpc8308_p1m.h new file +10 -0
+#define CONFIG_SYS_BR2_PRELIM	( CONFIG_SYS_CPLD_BASE \
+				| (1 << BR_PS_SHIFT)	/* 8 bit port size */ \
+				| BR_V )		/* valid */
+#define CONFIG_SYS_OR2_PRELIM	( 0xFFFF8000		/* length 32K */ \
+				| OR_GPCM_SCY_4 \
+				| OR_GPCM_EHTR)
+				/* 0xFFFF8042 */
+
+#define CONFIG_SYS_LBLAWBAR2_PRELIM	CONFIG_SYS_CPLD_BASE
+#define CONFIG_SYS_LBLAWAR2_PRELIM	0x8000000E	/* 32KB  */

same here.

Quoted 4 lines

+/*
+ * Fake PCIE2 definitions: there is no PCIE2 on this board but the code
+ * in arch/powerpc/cpu/mpc83xx/pcie.c doesn't compile without this
+ */

so fix the code there instead.

Kim

author
#5 lore raw

PATCH 1/5 mpc83xx/pcie: make it compile with PCIE2 unconfigured

MPC8308 has only one PCIE host controller so we want it to compile without CONFIG_SYS_PCIE2_CFG_{BASE,SIZE} defined.

---
 arch/powerpc/cpu/mpc83xx/pcie.c |   47 ++++++++++++++++++++++++++++----------
 1 files changed, 34 insertions(+), 13 deletions(-)
arch/powerpc/cpu/mpc83xx/pcie.c +34 -13
index 77f8906..abb7a49 100644
@@ -28,7 +28,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_SIZE)
 #define PCIE_MAX_BUSES 2
+#else
+#define PCIE_MAX_BUSES 1
+#endif
 
 #ifdef CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES
 
@@ -93,6 +97,18 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
 	static struct pci_controller pcie_hose[PCIE_MAX_BUSES];
 	struct pci_controller *hose = &pcie_hose[bus];
 	int i;
+	unsigned int *cfg_addr;
+
+	if (bus == 0) {
+		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE1_CFG_BASE;
+	} else {
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_SIZE)
+		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE2_CFG_BASE;
+#else
+		printf("Second PCIE host controller not configured!\n");
+		return;
+#endif
+	}
 
 	/*
 	 * There are no spare BATs to remap all PCI-E windows for U-Boot, so
@@ -124,10 +140,7 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
 	hose->first_busno = pci_last_busno() + 1;
 	hose->last_busno = 0xff;
 
-	if (bus == 0)
-		hose->cfg_addr = (unsigned int *)CONFIG_SYS_PCIE1_CFG_BASE;
-	else
-		hose->cfg_addr = (unsigned int *)CONFIG_SYS_PCIE2_CFG_BASE;
+	hose->cfg_addr = cfg_addr;
 
 	pci_set_ops(hose,
 			pcie_read_config_byte,
@@ -170,6 +183,21 @@ static void mpc83xx_pcie_init_bus(int bus, struct pci_region *reg)
 	unsigned int tar;
 	u16 reg16;
 	int i;
+	u32 cfg_size;
+	u32 cfg_base;
+
+	if (bus) {
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_SIZE)
+		cfg_size = CONFIG_SYS_PCIE2_SIZE;
+		cfg_base = CONFIG_SYS_PCIE2_CFG_BASE;
+#else
+		printf("Second PCIE host controller not configured!\n");
+		return;
+#endif
+	} else {
+		cfg_size = CONFIG_SYS_PCIE1_CFG_SIZE;
+		cfg_base = CONFIG_SYS_PCIE1_CFG_BASE;
+	}
 
 	/* Enable pex csb bridge inbound & outbound transactions */
 	out_le32(&pex->bridge.pex_csb_ctrl,
@@ -182,15 +210,8 @@ static void mpc83xx_pcie_init_bus(int bus, struct pci_region *reg)
 		PEX_CSB_OBCTRL_CFGWE);
 
 	out_win = &pex->bridge.pex_outbound_win[0];
-	if (bus) {
-		out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
-			CONFIG_SYS_PCIE2_CFG_SIZE);
-		out_le32(&out_win->bar, CONFIG_SYS_PCIE2_CFG_BASE);
-	} else {
-		out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
-			CONFIG_SYS_PCIE1_CFG_SIZE);
-		out_le32(&out_win->bar, CONFIG_SYS_PCIE1_CFG_BASE);
-	}
+	out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG | cfg_size);
+	out_le32(&out_win->bar, cfg_base);
 	out_le32(&out_win->tarl, 0);
 	out_le32(&out_win->tarh, 0);
 
Signature · 1 line
1.6.2.5
author
#6 lore raw

PATCH 2/5 mpc83xx: add support for setting PCIE clocks

This patch adds support for setting PCIE clocks in cpu_init.c by providing CONFIG_SYS_SCCR_PCIEXP{1,2} in configuration.

---
 arch/powerpc/cpu/mpc83xx/cpu_init.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/powerpc/cpu/mpc83xx/cpu_init.c +12 -0
index 83cba93..f01c09a 100644
@@ -126,6 +126,12 @@ void cpu_init_f (volatile immap_t * im)
 #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
 		SCCR_PCICM |
 #endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP1CM	/* PCIE1 clock mode */
+		SCCR_PCIEXP1CM |
+#endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP2CM	/* PCIE2 clock mode */
+		SCCR_PCIEXP2CM |
+#endif
 #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
 		SCCR_TSECCM |
 #endif
@@ -158,6 +164,12 @@ void cpu_init_f (volatile immap_t * im)
 #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
 		(CONFIG_SYS_SCCR_PCICM << SCCR_PCICM_SHIFT) |
 #endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP1CM	/* PCIE1 clock mode */
+		(CONFIG_SYS_SCCR_PCIEXP1CM << SCCR_PCIEXP1CM_SHIFT) |
+#endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP2CM	/* PCIE2 clock mode */
+		(CONFIG_SYS_SCCR_PCIEXP2CM << SCCR_PCIEXP2CM_SHIFT) |
+#endif
 #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
 		(CONFIG_SYS_SCCR_TSECCM << SCCR_TSECCM_SHIFT) |
 #endif
Signature · 1 line
1.6.2.5
author
#7 lore raw

PATCH 3/5 mpc8308: add SICR{L,H} fields definitions

This patch adds defines to set supported fields in System I/O Configuration Registers High and Low on Freescale MPC8308 CPU.

---
 include/mpc83xx.h |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)
include/mpc83xx.h +48 -0
index ba6cdf1..0ae83da 100644
@@ -319,6 +319,54 @@
 #define SICRH_GPIO2_H			0x00000030
 #define SICRH_SPI			0x00000003
 #define SICRH_SPI_SD			0x00000001
+
+#elif defined(CONFIG_MPC8308)
+/* SICRL bits - MPC8308 specific */
+#define SICRL_SPI_PF0			(0 << 28)
+#define SICRL_SPI_PF1			(1 << 28)
+#define SICRL_SPI_PF3			(3 << 28)
+#define SICRL_UART_PF0			(0 << 26)
+#define SICRL_UART_PF1			(1 << 26)
+#define SICRL_UART_PF3			(3 << 26)
+#define SICRL_IRQ_PF0			(0 << 24)
+#define SICRL_IRQ_PF1			(1 << 24)
+#define SICRL_I2C2_PF0			(0 << 20)
+#define SICRL_I2C2_PF1			(1 << 20)
+#define SICRL_ETSEC1_TX_CLK		(0 << 6)
+#define SICRL_ETSEC1_GTX_CLK125		(1 << 6)
+
+/* SICRH bits - MPC8308 specific */
+#define SICRH_ESDHC_A_SD		(0 << 30)
+#define SICRH_ESDHC_A_GTM		(1 << 30)
+#define SICRH_ESDHC_A_GPIO		(3 << 30)
+#define SICRH_ESDHC_B_SD		(0 << 28)
+#define SICRH_ESDHC_B_GTM		(1 << 28)
+#define SICRH_ESDHC_B_GPIO		(3 << 28)
+#define SICRH_ESDHC_C_SD		(0 << 26)
+#define SICRH_ESDHC_C_GTM		(1 << 26)
+#define SICRH_ESDHC_C_GPIO		(3 << 26)
+#define SICRH_GPIO_A_GPIO		(0 << 24)
+#define SICRH_GPIO_A_TSEC2		(1 << 24)
+#define SICRH_GPIO_B_GPIO		(0 << 22)
+#define SICRH_GPIO_B_TSEC2_TX_CLK	(1 << 22)
+#define SICRH_GPIO_B_TSEC2_GTX_CLK125	(2 << 22)
+#define SICRH_IEEE1588_A_TMR		(1 << 20)
+#define SICRH_IEEE1588_A_GPIO		(3 << 20)
+#define SICRH_USB			(1 << 18)
+#define SICRH_GTM_GTM			(1 << 16)
+#define SICRH_GTM_GPIO			(3 << 16)
+#define SICRH_IEEE1588_B_TMR		(1 << 14)
+#define SICRH_IEEE1588_B_GPIO		(3 << 14)
+#define SICRH_ETSEC2_CRS		(1 << 12)
+#define SICRH_ETSEC2_GPIO		(3 << 12)
+#define SICRH_GPIOSEL_0			(0 << 8)
+#define SICRH_GPIOSEL_1			(1 << 8)
+#define SICRH_TMROBI_V3P3		(0 << 4)
+#define SICRH_TMROBI_V2P5		(1 << 4)
+#define SICRH_TSOBI1_V3P3		(0 << 1)
+#define SICRH_TSOBI1_V2P5		(1 << 1)
+#define SICRH_TSOBI2_V3P3		(0 << 0)
+#define SICRH_TSOBI2_V2P5		(1 << 0)
 #endif
 
 /* SWCRR - System Watchdog Control Register
Signature · 1 line
1.6.2.5
author
#8 lore raw

PATCH 4/5 MPC8308RDB: various clean ups

This patch cleans up the Freescale MPC8308RDB Development board support. Things fixed:
- Removed unused PCIE2 definitions from configuration
- SICR{L,H} defines used for System I/O Configuration Registers values instead of hardcoding
- CONFIG_SYS_SCCR_PCIEXP1CM used to enable PCIE clock instead of writing to SCCR from the board code
- sleep mode stuff removed as MPC8308 has no support for deep sleep and PMCCR1 register. board_early_init_f() removed.
- MPC8308 has no ERRATA for DDR controller so workaround removed
- 'assignment in if statement' issues solved
- use LBLAWAR_* defines instead of hardcoding

---
 board/freescale/mpc8308rdb/mpc8308rdb.c |   19 +++----------
 board/freescale/mpc8308rdb/sdram.c      |   31 +--------------------
 include/configs/MPC8308RDB.h            |   46 +++++++++++++++++-------------
 3 files changed, 31 insertions(+), 65 deletions(-)
board/freescale/mpc8308rdb/mpc8308rdb.c +4 -15
index a864189..4acc9a8 100644
@@ -36,16 +36,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int board_early_init_f(void)
-{
-	immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
-
-	if (in_be32(&im->pmc.pmccr1) & PMCCR1_POWER_OFF)
-		gd->flags |= GD_FLG_SILENT;
-
-	return 0;
-}
-
 static u8 read_board_info(void)
 {
 	u8 val8;
@@ -103,9 +93,6 @@ void pci_init_board(void)
 	fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX,
 					FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
 
-	clrsetbits_be32(&clk->sccr, SCCR_PCIEXP1CM ,
-				    SCCR_PCIEXP1CM_1);
-
 	/* Deassert the resets in the control register */
 	out_be32(&sysconf->pecr1, 0xE0008000);
 	udelay(2000);
@@ -146,12 +133,14 @@ int board_eth_init(bd_t *bis)
 	int rv, num_if = 0;
 
 	/* Initialize TSECs first */
-	if ((rv = cpu_eth_init(bis)) >= 0)
+	rv = cpu_eth_init(bis);
+	if (rv >= 0)
 		num_if += rv;
 	else
 		printf("ERROR: failed to initialize TSECs.\n");
 
-	if ((rv = pci_eth_init(bis)) >= 0)
+	rv = pci_eth_init(bis);
+	if (rv >= 0)
 		num_if += rv;
 	else
 		printf("ERROR: failed to initialize PCI Ethernet.\n");
board/freescale/mpc8308rdb/sdram.c +1 -30
index 939c1b8..1a6b9c7 100644
@@ -38,20 +38,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static void resume_from_sleep(void)
-{
-	u32 magic = *(u32 *)0;
-
-	typedef void (*func_t)(void);
-	func_t resume = *(func_t *)4;
-
-	if (magic == 0xf5153ae5)
-		resume();
-
-	gd->flags &= ~GD_FLG_SILENT;
-	puts("\nResume from sleep failed: bad magic word\n");
-}
-
 /* Fixed sdram init -- doesn't use serial presence detect.
  *
  * This is useful for faster booting in configs where the RAM is unlikely
@@ -68,12 +54,6 @@ static long fixed_sdram(void)
 	out_be32(&im->sysconf.ddrlaw[0].ar, LBLAWAR_EN | (msize_log2 - 1));
 	out_be32(&im->sysconf.ddrcdr, CONFIG_SYS_DDRCDR_VALUE);
 
-	/*
-	 * Erratum DDR3 requires a 50ms delay after clearing DDRCDR[DDR_cfg],
-	 * or the DDR2 controller may fail to initialize correctly.
-	 */
-	udelay(50000);
-
 	out_be32(&im->ddr.csbnds[0].csbnds, (msize - 1) >> 24);
 	out_be32(&im->ddr.cs_config[0], CONFIG_SYS_DDR_CS0_CONFIG);
 
@@ -86,13 +66,7 @@ static long fixed_sdram(void)
 	out_be32(&im->ddr.timing_cfg_2, CONFIG_SYS_DDR_TIMING_2);
 	out_be32(&im->ddr.timing_cfg_0, CONFIG_SYS_DDR_TIMING_0);
 
-	if (in_be32(&im->pmc.pmccr1) & PMCCR1_POWER_OFF) {
-		out_be32(&im->ddr.sdram_cfg,
-			CONFIG_SYS_DDR_SDRAM_CFG | SDRAM_CFG_BI);
-	} else {
-		out_be32(&im->ddr.sdram_cfg, CONFIG_SYS_DDR_SDRAM_CFG);
-	}
-
+	out_be32(&im->ddr.sdram_cfg, CONFIG_SYS_DDR_SDRAM_CFG);
 	out_be32(&im->ddr.sdram_cfg2, CONFIG_SYS_DDR_SDRAM_CFG2);
 	out_be32(&im->ddr.sdram_mode, CONFIG_SYS_DDR_MODE);
 	out_be32(&im->ddr.sdram_mode2, CONFIG_SYS_DDR_MODE2);
@@ -118,9 +92,6 @@ phys_size_t initdram(int board_type)
 	/* DDR SDRAM */
 	msize = fixed_sdram();
 
-	if (in_be32(&im->pmc.pmccr1) & PMCCR1_POWER_OFF)
-		resume_from_sleep();
-
 	/* return total bus SDRAM size(bytes)  -- DDR */
 	return msize;
 }
include/configs/MPC8308RDB.h +26 -20

76 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#9 lore raw

PATCH 5/5 mpc8308_p1m: support for MPC8308 P1M board

This patch provides support for MPC8308 P1M board with the following set of features:
Dual UART is supported
NOR flash is supported
Both TSEC Ethernet controllers are supported
PCI Express initialization is supported
Both I2C controllers are supported

---

Kim's comments addressed (except for MAKEALL one I believe boards from boards.cfg are now in MAKEALL automagically).

Regards, Ilya.

 MAINTAINERS                     |    1 +
 board/mpc8308_p1m/Makefile      |   52 ++++
 board/mpc8308_p1m/config.mk     |    3 +
 board/mpc8308_p1m/mpc8308_p1m.c |  107 ++++++++
 board/mpc8308_p1m/sdram.c       |   93 +++++++
 boards.cfg                      |    1 +
 include/configs/mpc8308_p1m.h   |  555 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 812 insertions(+), 0 deletions(-)
 create mode 100644 board/mpc8308_p1m/Makefile
 create mode 100644 board/mpc8308_p1m/config.mk
 create mode 100644 board/mpc8308_p1m/mpc8308_p1m.c
 create mode 100644 board/mpc8308_p1m/sdram.c
 create mode 100644 include/configs/mpc8308_p1m.h
MAINTAINERS +1 -0
index 0c6ce2b..2cf29dd 100644
@@ -486,6 +486,7 @@ Stephen Williams <[email protected]>
 
 Ilya Yanok <[email protected]>
 
+	mpc8308_p1m	MPC8308
 	MPC8308RDB	MPC8308
 
 Roy Zang <[email protected]>
board/mpc8308_p1m/Makefile new file +52 -0

52 lines not on this page · raw message

board/mpc8308_p1m/config.mk new file +3 -0
new file mode 100644
index 0000000..183d3e8
@@ -0,0 +1,3 @@
+ifndef TEXT_BASE
+TEXT_BASE = 0xFC000000
+endif
board/mpc8308_p1m/mpc8308_p1m.c new file +107 -0

107 lines not on this page · raw message

board/mpc8308_p1m/sdram.c new file +93 -0

93 lines not on this page · raw message

boards.cfg +1 -0
index 05ddb8c..b9d4a77 100644
@@ -334,6 +334,7 @@ ppmc8260	powerpc	mpc8260
 RPXsuper	powerpc	mpc8260		rpxsuper
 rsdproto	powerpc	mpc8260
 MPC8266ADS	powerpc	mpc8260		mpc8266ads	freescale
+mpc8308_p1m	powerpc mpc83xx
 MPC8308RDB	powerpc	mpc83xx		mpc8308rdb	freescale
 MPC8323ERDB	powerpc	mpc83xx		mpc8323erdb	freescale
 MPC8349EMDS	powerpc	mpc83xx		mpc8349emds	freescale
include/configs/mpc8308_p1m.h new file +555 -0

555 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#10 lore raw

PATCH 4/5 MPC8308RDB: various clean ups

In reply to Ilya Yanok

board/freescale/mpc8308rdb/mpc8308rdb.c void pci_init_board(void) · line 108

Quoted 3 lines · On Tue, 14 Sep 2010 22:40:40 +0200 Ilya Yanok <[email protected]> wrote:
board/freescale/mpc8308rdb/mpc8308rdb.c +0 -3
-	clrsetbits_be32(&clk->sccr, SCCR_PCIEXP1CM ,
-				    SCCR_PCIEXP1CM_1);
-

this causes a new warning:

Configuring for MPC8308RDB board...
mpc8308rdb.c: In function 'pci_init_board':
mpc8308rdb.c:89: warning: unused variable 'clk'

same for the 8308_p1m in the next 5/5 patch.

everything else looks good to me.

Thanks,

Kim

#11 lore raw

PATCH 1/5 mpc83xx/pcie: make it compile with PCIE2 unconfigured

In reply to Ilya Yanok

arch/powerpc/cpu/mpc83xx/pcie.c line 35

Quoted 8 lines · On Tue, 14 Sep 2010 22:40:37 +0200 Ilya Yanok <[email protected]> wrote:

MPC8308 has only one PCIE host controller so we want it to compile without CONFIG_SYS_PCIE2_CFG_{BASE,SIZE} defined.

arch/powerpc/cpu/mpc83xx/pcie.c +4 -0
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_SIZE)
 #define PCIE_MAX_BUSES 2
+#else
+#define PCIE_MAX_BUSES 1
+#endif

Technically this should be an indirect function of MPC8308, but what's the problem with leaving MAX_BUSES as 2 always?

arch/powerpc/cpu/mpc83xx/pcie.c static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg, · line 110

Quoted 11 lines
arch/powerpc/cpu/mpc83xx/pcie.c +11 -0
+	unsigned int *cfg_addr;
+
+	if (bus == 0) {
+		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE1_CFG_BASE;
+	} else {
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_SIZE)
+		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE2_CFG_BASE;
+#else
+		printf("Second PCIE host controller not configured!\n");
+		return;
+#endif

let's reduce the new ifdefs introduced in the file down to one, and still be able remove the 'if (bus)' clauses by adding a static pcie cfg struct array[], to which this and code below it would directly dereference with array[bus]. The single ifdef should protect the second entry in the array. The "second PCIE host controller not configured" check can be made by comparing num_buses with ARRAY_SIZE (array) in mpc83xx_pcie_init prior to calling mpc83xx_pcie_init_bus with an illegal bus value.

Kim

author
#12 lore raw

PATCH 1/5 mpc83xx/pcie: make it compile with PCIE2 unconfigured

Hi Kim,

Quoted 9 lines · Kim Phillips

arch/powerpc/cpu/mpc83xx/pcie.c line 35

Quoted 6 lines
arch/powerpc/cpu/mpc83xx/pcie.c +4 -0
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE)&&  defined(CONFIG_SYS_PCIE2_SIZE)
  #define PCIE_MAX_BUSES 2
+#else
+#define PCIE_MAX_BUSES 1
+#endif

Technically this should be an indirect function of MPC8308, but what's the problem with leaving MAX_BUSES as 2 always?

Well, we can save a couple of bytes but I agree it doesn't worth it. I'll remove the ifdef here.

Quoted 12 lines

arch/powerpc/cpu/mpc83xx/pcie.c static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg, · line 110

Quoted 12 lines
arch/powerpc/cpu/mpc83xx/pcie.c +11 -0
+	unsigned int *cfg_addr;
+
+	if (bus == 0) {
+		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE1_CFG_BASE;
+	} else {
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE)&&  defined(CONFIG_SYS_PCIE2_SIZE)
+		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE2_CFG_BASE;
+#else
+		printf("Second PCIE host controller not configured!\n");
+		return;
+#endif
Quoted 9 lines

let's reduce the new ifdefs introduced in the file down to one, and still be able remove the 'if (bus)' clauses by adding a static pcie cfg struct array[], to which this and code below it would directly dereference with array[bus]. The single ifdef should protect the second entry in the array. The "second PCIE host controller not configured" check can be made by comparing num_buses with ARRAY_SIZE (array) in mpc83xx_pcie_init prior to calling mpc83xx_pcie_init_bus with an illegal bus value.

Yes, this sounds like much cleaner code. I'll post the updated patches in the short while.

Regards, Ilya.

author
#13 lore raw

PATCH 1/5 mpc83xx/pcie: make it compile with PCIE2 unconfigured

In reply to Kim Phillips

MPC8308 has only one PCIE host controller so we want it to compile without CONFIG_SYS_PCIE2_CFG_{BASE,SIZE} defined.

---
 arch/powerpc/cpu/mpc83xx/pcie.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)
arch/powerpc/cpu/mpc83xx/pcie.c +25 -13
index 77f8906..e70d19e 100644
@@ -30,6 +30,22 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define PCIE_MAX_BUSES 2
 
+static struct {
+	u32 base;
+	u32 size;
+} mpc83xx_pcie_cfg_space[] = {
+	{
+		.base = CONFIG_SYS_PCIE1_CFG_BASE,
+		.size = CONFIG_SYS_PCIE1_CFG_SIZE,
+	},
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_CFG_SIZE)
+	{
+		.base = CONFIG_SYS_PCIE2_CFG_BASE,
+		.size = CONFIG_SYS_PCIE2_CFG_SIZE,
+	},
+#endif
+};
+
 #ifdef CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES
 
 static int mpc83xx_pcie_remap_cfg(struct pci_controller *hose, pci_dev_t dev)
@@ -124,10 +140,7 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
 	hose->first_busno = pci_last_busno() + 1;
 	hose->last_busno = 0xff;
 
-	if (bus == 0)
-		hose->cfg_addr = (unsigned int *)CONFIG_SYS_PCIE1_CFG_BASE;
-	else
-		hose->cfg_addr = (unsigned int *)CONFIG_SYS_PCIE2_CFG_BASE;
+	hose->cfg_addr = mpc83xx_pcie_cfg_space[bus].base;
 
 	pci_set_ops(hose,
 			pcie_read_config_byte,
@@ -182,15 +195,9 @@ static void mpc83xx_pcie_init_bus(int bus, struct pci_region *reg)
 		PEX_CSB_OBCTRL_CFGWE);
 
 	out_win = &pex->bridge.pex_outbound_win[0];
-	if (bus) {
-		out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
-			CONFIG_SYS_PCIE2_CFG_SIZE);
-		out_le32(&out_win->bar, CONFIG_SYS_PCIE2_CFG_BASE);
-	} else {
-		out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
-			CONFIG_SYS_PCIE1_CFG_SIZE);
-		out_le32(&out_win->bar, CONFIG_SYS_PCIE1_CFG_BASE);
-	}
+	out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
+			mpc83xx_pcie_cfg_space[bus].size);
+	out_le32(&out_win->bar, mpc83xx_pcie_cfg_space[bus].base);
 	out_le32(&out_win->tarl, 0);
 	out_le32(&out_win->tarh, 0);
 
@@ -312,6 +319,11 @@ void mpc83xx_pcie_init(int num_buses, struct pci_region **reg, int warmboot)
 	 */
 	udelay(warmboot ? 1000 : 100000);
 
+	if (num_buses > ARRAY_SIZE(mpc83xx_pcie_cfg_space)) {
+		printf("Second PCIE host contoller not configured!\n");
+		num_buses = ARRAY_SIZE(mpc83xx_pcie_cfg_space);
+	}
+
 	for (i = 0; i < num_buses; i++)
 		mpc83xx_pcie_init_bus(i, reg[i]);
 }
Signature · 1 line
1.6.2.5
#14 lore raw

PATCH 1/5 mpc83xx/pcie: make it compile with PCIE2 unconfigured

Quoted 5 lines · On Fri, 17 Sep 2010 23:41:46 +0200 Ilya Yanok <[email protected]> wrote:

MPC8308 has only one PCIE host controller so we want it to compile without CONFIG_SYS_PCIE2_CFG_{BASE,SIZE} defined.

---

5 out of 5 patches applied to u-boot-mpc83xx/next.

one more added:

author
#15 lore raw

PATCH 2/5 mpc83xx: add support for setting PCIE clocks

In reply to Kim Phillips

This patch adds support for setting PCIE clocks in cpu_init.c by providing CONFIG_SYS_SCCR_PCIEXP{1,2} in configuration.

---
 arch/powerpc/cpu/mpc83xx/cpu_init.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/powerpc/cpu/mpc83xx/cpu_init.c +12 -0
index 83cba93..f01c09a 100644
@@ -126,6 +126,12 @@ void cpu_init_f (volatile immap_t * im)
 #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
 		SCCR_PCICM |
 #endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP1CM	/* PCIE1 clock mode */
+		SCCR_PCIEXP1CM |
+#endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP2CM	/* PCIE2 clock mode */
+		SCCR_PCIEXP2CM |
+#endif
 #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
 		SCCR_TSECCM |
 #endif
@@ -158,6 +164,12 @@ void cpu_init_f (volatile immap_t * im)
 #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
 		(CONFIG_SYS_SCCR_PCICM << SCCR_PCICM_SHIFT) |
 #endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP1CM	/* PCIE1 clock mode */
+		(CONFIG_SYS_SCCR_PCIEXP1CM << SCCR_PCIEXP1CM_SHIFT) |
+#endif
+#ifdef CONFIG_SYS_SCCR_PCIEXP2CM	/* PCIE2 clock mode */
+		(CONFIG_SYS_SCCR_PCIEXP2CM << SCCR_PCIEXP2CM_SHIFT) |
+#endif
 #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
 		(CONFIG_SYS_SCCR_TSECCM << SCCR_TSECCM_SHIFT) |
 #endif
Signature · 1 line
1.6.2.5
author
#16 lore raw

PATCH 3/5 mpc8308: add SICR{L,H} fields definitions

In reply to Kim Phillips

This patch adds defines to set supported fields in System I/O Configuration Registers High and Low on Freescale MPC8308 CPU.

---
 include/mpc83xx.h |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)
include/mpc83xx.h +48 -0
index ba6cdf1..0ae83da 100644
@@ -319,6 +319,54 @@
 #define SICRH_GPIO2_H			0x00000030
 #define SICRH_SPI			0x00000003
 #define SICRH_SPI_SD			0x00000001
+
+#elif defined(CONFIG_MPC8308)
+/* SICRL bits - MPC8308 specific */
+#define SICRL_SPI_PF0			(0 << 28)
+#define SICRL_SPI_PF1			(1 << 28)
+#define SICRL_SPI_PF3			(3 << 28)
+#define SICRL_UART_PF0			(0 << 26)
+#define SICRL_UART_PF1			(1 << 26)
+#define SICRL_UART_PF3			(3 << 26)
+#define SICRL_IRQ_PF0			(0 << 24)
+#define SICRL_IRQ_PF1			(1 << 24)
+#define SICRL_I2C2_PF0			(0 << 20)
+#define SICRL_I2C2_PF1			(1 << 20)
+#define SICRL_ETSEC1_TX_CLK		(0 << 6)
+#define SICRL_ETSEC1_GTX_CLK125		(1 << 6)
+
+/* SICRH bits - MPC8308 specific */
+#define SICRH_ESDHC_A_SD		(0 << 30)
+#define SICRH_ESDHC_A_GTM		(1 << 30)
+#define SICRH_ESDHC_A_GPIO		(3 << 30)
+#define SICRH_ESDHC_B_SD		(0 << 28)
+#define SICRH_ESDHC_B_GTM		(1 << 28)
+#define SICRH_ESDHC_B_GPIO		(3 << 28)
+#define SICRH_ESDHC_C_SD		(0 << 26)
+#define SICRH_ESDHC_C_GTM		(1 << 26)
+#define SICRH_ESDHC_C_GPIO		(3 << 26)
+#define SICRH_GPIO_A_GPIO		(0 << 24)
+#define SICRH_GPIO_A_TSEC2		(1 << 24)
+#define SICRH_GPIO_B_GPIO		(0 << 22)
+#define SICRH_GPIO_B_TSEC2_TX_CLK	(1 << 22)
+#define SICRH_GPIO_B_TSEC2_GTX_CLK125	(2 << 22)
+#define SICRH_IEEE1588_A_TMR		(1 << 20)
+#define SICRH_IEEE1588_A_GPIO		(3 << 20)
+#define SICRH_USB			(1 << 18)
+#define SICRH_GTM_GTM			(1 << 16)
+#define SICRH_GTM_GPIO			(3 << 16)
+#define SICRH_IEEE1588_B_TMR		(1 << 14)
+#define SICRH_IEEE1588_B_GPIO		(3 << 14)
+#define SICRH_ETSEC2_CRS		(1 << 12)
+#define SICRH_ETSEC2_GPIO		(3 << 12)
+#define SICRH_GPIOSEL_0			(0 << 8)
+#define SICRH_GPIOSEL_1			(1 << 8)
+#define SICRH_TMROBI_V3P3		(0 << 4)
+#define SICRH_TMROBI_V2P5		(1 << 4)
+#define SICRH_TSOBI1_V3P3		(0 << 1)
+#define SICRH_TSOBI1_V2P5		(1 << 1)
+#define SICRH_TSOBI2_V3P3		(0 << 0)
+#define SICRH_TSOBI2_V2P5		(1 << 0)
 #endif
 
 /* SWCRR - System Watchdog Control Register
Signature · 1 line
1.6.2.5
author
#17 lore raw

PATCH 4/5 MPC8308RDB: various clean ups

In reply to Kim Phillips

This patch cleans up the Freescale MPC8308RDB Development board support. Things fixed:
- Removed unused PCIE2 definitions from configuration
- SICR{L,H} defines used for System I/O Configuration Registers values instead of hardcoding
- CONFIG_SYS_SCCR_PCIEXP1CM used to enable PCIE clock instead of writing to SCCR from the board code
- sleep mode stuff removed as MPC8308 has no support for deep sleep and PMCCR1 register. board_early_init_f() removed.
- MPC8308 has no ERRATA for DDR controller so workaround removed
- 'assignment in if statement' issues solved
- use LBLAWAR_* defines instead of hardcoding

---
 board/freescale/mpc8308rdb/mpc8308rdb.c |   20 +++-----------
 board/freescale/mpc8308rdb/sdram.c      |   31 +--------------------
 include/configs/MPC8308RDB.h            |   46 +++++++++++++++++-------------
 3 files changed, 31 insertions(+), 66 deletions(-)
board/freescale/mpc8308rdb/mpc8308rdb.c +4 -16
index a864189..fb29abf 100644
@@ -36,16 +36,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int board_early_init_f(void)
-{
-	immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
-
-	if (in_be32(&im->pmc.pmccr1) & PMCCR1_POWER_OFF)
-		gd->flags |= GD_FLG_SILENT;
-
-	return 0;
-}
-
 static u8 read_board_info(void)
 {
 	u8 val8;
@@ -96,16 +86,12 @@ void pci_init_board(void)
 {
 	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	sysconf83xx_t *sysconf = &immr->sysconf;
-	clk83xx_t *clk = (clk83xx_t *)&immr->clk;
 	law83xx_t *pcie_law = sysconf->pcielaw;
 	struct pci_region *pcie_reg[] = { pcie_regions_0 };
 
 	fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX,
 					FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
 
-	clrsetbits_be32(&clk->sccr, SCCR_PCIEXP1CM ,
-				    SCCR_PCIEXP1CM_1);
-
 	/* Deassert the resets in the control register */
 	out_be32(&sysconf->pecr1, 0xE0008000);
 	udelay(2000);
@@ -146,12 +132,14 @@ int board_eth_init(bd_t *bis)
 	int rv, num_if = 0;
 
 	/* Initialize TSECs first */
-	if ((rv = cpu_eth_init(bis)) >= 0)
+	rv = cpu_eth_init(bis);
+	if (rv >= 0)
 		num_if += rv;
 	else
 		printf("ERROR: failed to initialize TSECs.\n");
 
-	if ((rv = pci_eth_init(bis)) >= 0)
+	rv = pci_eth_init(bis);
+	if (rv >= 0)
 		num_if += rv;
 	else
 		printf("ERROR: failed to initialize PCI Ethernet.\n");
board/freescale/mpc8308rdb/sdram.c +1 -30
index 939c1b8..1a6b9c7 100644
@@ -38,20 +38,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static void resume_from_sleep(void)
-{
-	u32 magic = *(u32 *)0;
-
-	typedef void (*func_t)(void);
-	func_t resume = *(func_t *)4;
-
-	if (magic == 0xf5153ae5)
-		resume();
-
-	gd->flags &= ~GD_FLG_SILENT;
-	puts("\nResume from sleep failed: bad magic word\n");
-}
-
 /* Fixed sdram init -- doesn't use serial presence detect.
  *
  * This is useful for faster booting in configs where the RAM is unlikely
@@ -68,12 +54,6 @@ static long fixed_sdram(void)
 	out_be32(&im->sysconf.ddrlaw[0].ar, LBLAWAR_EN | (msize_log2 - 1));
 	out_be32(&im->sysconf.ddrcdr, CONFIG_SYS_DDRCDR_VALUE);
 
-	/*
-	 * Erratum DDR3 requires a 50ms delay after clearing DDRCDR[DDR_cfg],
-	 * or the DDR2 controller may fail to initialize correctly.
-	 */
-	udelay(50000);
-
 	out_be32(&im->ddr.csbnds[0].csbnds, (msize - 1) >> 24);
 	out_be32(&im->ddr.cs_config[0], CONFIG_SYS_DDR_CS0_CONFIG);
 
@@ -86,13 +66,7 @@ static long fixed_sdram(void)
 	out_be32(&im->ddr.timing_cfg_2, CONFIG_SYS_DDR_TIMING_2);
 	out_be32(&im->ddr.timing_cfg_0, CONFIG_SYS_DDR_TIMING_0);
 
-	if (in_be32(&im->pmc.pmccr1) & PMCCR1_POWER_OFF) {
-		out_be32(&im->ddr.sdram_cfg,
-			CONFIG_SYS_DDR_SDRAM_CFG | SDRAM_CFG_BI);
-	} else {
-		out_be32(&im->ddr.sdram_cfg, CONFIG_SYS_DDR_SDRAM_CFG);
-	}
-
+	out_be32(&im->ddr.sdram_cfg, CONFIG_SYS_DDR_SDRAM_CFG);
 	out_be32(&im->ddr.sdram_cfg2, CONFIG_SYS_DDR_SDRAM_CFG2);
 	out_be32(&im->ddr.sdram_mode, CONFIG_SYS_DDR_MODE);
 	out_be32(&im->ddr.sdram_mode2, CONFIG_SYS_DDR_MODE2);
@@ -118,9 +92,6 @@ phys_size_t initdram(int board_type)
 	/* DDR SDRAM */
 	msize = fixed_sdram();
 
-	if (in_be32(&im->pmc.pmccr1) & PMCCR1_POWER_OFF)
-		resume_from_sleep();
-
 	/* return total bus SDRAM size(bytes)  -- DDR */
 	return msize;
 }
include/configs/MPC8308RDB.h +26 -20

76 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#18 lore raw

PATCH 5/5 mpc8308_p1m: support for MPC8308 P1M board

In reply to Kim Phillips

This patch provides support for MPC8308 P1M board with the following set of features:
Dual UART is supported
NOR flash is supported
Both TSEC Ethernet controllers are supported
PCI Express initialization is supported
Both I2C controllers are supported

---
 MAINTAINERS                     |    1 +
 board/mpc8308_p1m/Makefile      |   52 ++++
 board/mpc8308_p1m/config.mk     |    3 +
 board/mpc8308_p1m/mpc8308_p1m.c |  106 ++++++++
 board/mpc8308_p1m/sdram.c       |   93 +++++++
 boards.cfg                      |    1 +
 include/configs/mpc8308_p1m.h   |  555 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 811 insertions(+), 0 deletions(-)
 create mode 100644 board/mpc8308_p1m/Makefile
 create mode 100644 board/mpc8308_p1m/config.mk
 create mode 100644 board/mpc8308_p1m/mpc8308_p1m.c
 create mode 100644 board/mpc8308_p1m/sdram.c
 create mode 100644 include/configs/mpc8308_p1m.h
MAINTAINERS +1 -0
index 0c6ce2b..2cf29dd 100644
@@ -486,6 +486,7 @@ Stephen Williams <[email protected]>
 
 Ilya Yanok <[email protected]>
 
+	mpc8308_p1m	MPC8308
 	MPC8308RDB	MPC8308
 
 Roy Zang <[email protected]>
board/mpc8308_p1m/Makefile new file +52 -0

52 lines not on this page · raw message

board/mpc8308_p1m/config.mk new file +3 -0
new file mode 100644
index 0000000..183d3e8
@@ -0,0 +1,3 @@
+ifndef TEXT_BASE
+TEXT_BASE = 0xFC000000
+endif
board/mpc8308_p1m/mpc8308_p1m.c new file +106 -0

106 lines not on this page · raw message

board/mpc8308_p1m/sdram.c new file +93 -0

93 lines not on this page · raw message

boards.cfg +1 -0
index 05ddb8c..b9d4a77 100644
@@ -334,6 +334,7 @@ ppmc8260	powerpc	mpc8260
 RPXsuper	powerpc	mpc8260		rpxsuper
 rsdproto	powerpc	mpc8260
 MPC8266ADS	powerpc	mpc8260		mpc8266ads	freescale
+mpc8308_p1m	powerpc mpc83xx
 MPC8308RDB	powerpc	mpc83xx		mpc8308rdb	freescale
 MPC8323ERDB	powerpc	mpc83xx		mpc8323erdb	freescale
 MPC8349EMDS	powerpc	mpc83xx		mpc8349emds	freescale
include/configs/mpc8308_p1m.h new file +555 -0

555 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#19 lore raw

PATCH v3 1/1 mpc8308_p1m: support for MPC8308 P1M board

In reply to Kim Phillips

Dear Kim Phillips,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 8 lines
 MAINTAINERS                     |    1 +
 board/mpc8308_p1m/Makefile      |   52 ++++
 board/mpc8308_p1m/config.mk     |    1 +
 board/mpc8308_p1m/mpc8308_p1m.c |  122 +++++++++
 board/mpc8308_p1m/sdram.c       |   93 +++++++
 boards.cfg                      |    1 +
 include/configs/mpc8308_p1m.h   |  548 +++++++++++++++++++++++++++++++++++++++

missing MAKEALL entry.

Not needed any more since we pick this off from boards.cfg for "simple" boards.

Quoted 7 lines

board/mpc8308_p1m/config.mk line 1

Quoted 3 lines

+++ b/board/mpc8308_p1m/config.mk

board/mpc8308_p1m/config.mk new file +1 -0
@@ -0,0 +1 @@
+TEXT_BASE = 0xFC000000

ifndef TEXT_BASE
TEXT_BASE = 0xFC000000
endif

Why?

Quoted 8 lines

board/mpc8308_p1m/mpc8308_p1m.c line 111

Quoted 6 lines
board/mpc8308_p1m/mpc8308_p1m.c new file +6 -0
+int board_eth_init(bd_t *bis)
+{
+	int rv, num_if = 0;
+
+	/* Initialize TSECs first */
+	if ((rv = cpu_eth_init(bis)) >= 0)

no assignments in if statements.

Why?

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
Never ascribe to malice that which can  adequately  be  explained  by
stupidity.
#20 lore raw

PATCH v3 1/1 mpc8308_p1m: support for MPC8308 P1M board

Quoted 9 lines · On Sat, 18 Sep 2010 22:35:54 +0200 Wolfgang Denk <[email protected]> wrote:
Quoted 7 lines

board/mpc8308_p1m/config.mk line 1

Quoted 3 lines

+++ b/board/mpc8308_p1m/config.mk

board/mpc8308_p1m/config.mk new file +1 -0
@@ -0,0 +1 @@
+TEXT_BASE = 0xFC000000

ifndef TEXT_BASE
TEXT_BASE = 0xFC000000
endif

Why?

It might have been already set to something else by nand_spl or similar.

Quoted 10 lines
Quoted 8 lines

board/mpc8308_p1m/mpc8308_p1m.c line 111

Quoted 6 lines
board/mpc8308_p1m/mpc8308_p1m.c new file +6 -0
+int board_eth_init(bd_t *bis)
+{
+	int rv, num_if = 0;
+
+	/* Initialize TSECs first */
+	if ((rv = cpu_eth_init(bis)) >= 0)

no assignments in if statements.

Why?

It could just as easily, and more readably, be written as:

rv = cpu_eth_init(bis);
if (rv >= 0)

	...

FWIW, Linux's checkpatch.pl looks for this and calls it an error, and U-Boot says it follows Linux coding style.

-Scott

#21 lore raw

PATCH v3 1/1 mpc8308_p1m: support for MPC8308 P1M board

Dear Scott Wood,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 3 lines

ifndef TEXT_BASE
TEXT_BASE = 0xFC000000
endif

Why?

It might have been already set to something else by nand_spl or similar.

No. There is no NAND on that board.

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

no assignments in if statements.

Why?

It could just as easily, and more readably, be written as:

rv = cpu_eth_init(bis);
if (rv >= 0)

	...

It depends whether you call that more readable. The UNIX code where I learned C was full of that, and I find it actually easier to read.

Quoted 2 lines

FWIW, Linux's checkpatch.pl looks for this and calls it an error, and U-Boot says it follows Linux coding style.

OK, that's an argument.

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
"The value of marriage is not that adults produce children, but  that
children produce adults."                            - Peter De Vries
#22 lore raw

PATCH v3 1/1 mpc8308_p1m: support for MPC8308 P1M board

Quoted 11 lines · On Mon, 20 Sep 2010 18:42:27 +0200 Wolfgang Denk <[email protected]> wrote:
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 3 lines

ifndef TEXT_BASE
TEXT_BASE = 0xFC000000
endif

Why?

It might have been already set to something else by nand_spl or similar.

No. There is no NAND on that board.

it's consistent with other board ports, and there may be a derivative board port with NAND, or some other boot source.

btw, subsequent versions of this patch have the ifndef added...

Kim