Skip to contentSkip to conversation

powerpc/p1022ds: Add sdcard and spi boot support to P1022DS

PATCH New Dirk Eibach 2 participants 2 messages May 7, 2012 – Jul 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 powerpc/p1022ds: Add sdcard and spi boot support to P1022DS

---
Changes in v2:
- add Cc
- split up original patch series
Changes in v3:
- use clrsetbits() instead of clrbits()/setbits()
- remove dead code
- remove unnecessary #undef
Changes in v4:
- Add some documentation
- set pmuxcr depending on bootmode
- use 'ifdef' instead of 'if defined'
- undo unrelated whitespace change
- fix CONFIG_ENV_ADDR

 board/freescale/p1022ds/p1022ds.c |    5 +++
 board/freescale/p1022ds/tlb.c     |   10 +++++++
 boards.cfg                        |    4 +++
 doc/README.p1022ds                |   52 +++++++++++++++++++++++++++++++++++
 include/configs/P1022DS.h         |   55 +++++++++++++++++++++++++++++++++---
 5 files changed, 121 insertions(+), 5 deletions(-)
board/freescale/p1022ds/p1022ds.c +5 -0
index 456d9b0..e1e074e 100644
@@ -37,6 +37,11 @@ int board_early_init_f(void)
 {
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 
+#if defined(CONFIG_RAMBOOT_SPIFLASH) || defined(CONFIG_RAMBOOT_SDCARD)
+	/* Reset eLBC_DIU and SPI_eLBC in case we are booting from SD */
+	clrsetbits_be32(&gur->pmuxcr, 0x00600000, 0x80000000);
+#endif
+
 	/* Set pmuxcr to allow both i2c1 and i2c2 */
 	setbits_be32(&gur->pmuxcr, 0x1000);
 
board/freescale/p1022ds/tlb.c +10 -0
index e620112..013e9a7 100644
@@ -71,6 +71,16 @@ struct fsl_e_tlb_entry tlb_table[] = {
 	SET_TLB_ENTRY(1, PIXIS_BASE, PIXIS_BASE_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 7, BOOKE_PAGESZ_4K, 1),
+
+#ifdef CONFIG_SYS_RAMBOOT
+	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
+			MAS3_SX|MAS3_SW|MAS3_SR, 0,
+			0, 8, BOOKE_PAGESZ_1G, 1),
+	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
+			CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
+			MAS3_SX|MAS3_SW|MAS3_SR, 0,
+			0, 9, BOOKE_PAGESZ_1G, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +4 -0
index 24c5879..8de4235 100644
@@ -700,6 +700,10 @@ P1021RDB-PC_SDCARD           powerpc     mpc85xx     p1_p2_rdb_pc        freesca
 P1021RDB-PC_SPIFLASH         powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1021RDB,SPIFLASH
 P1022DS                      powerpc     mpc85xx     p1022ds             freescale
 P1022DS_36BIT                powerpc     mpc85xx     p1022ds             freescale      -           P1022DS:36BIT
+P1022DS_36BIT_SDCARD         powerpc     mpc85xx     p1022ds             freescale      -           P1022DS:36BIT,SDCARD
+P1022DS_36BIT_SPIFLASH       powerpc     mpc85xx     p1022ds             freescale      -           P1022DS:36BIT,SPIFLASH
+P1022DS_SDCARD               powerpc     mpc85xx     p1022ds             freescale      -           P1022DS:SDCARD
+P1022DS_SPIFLASH             powerpc     mpc85xx     p1022ds             freescale      -           P1022DS:SPIFLASH
 P1023RDS                     powerpc     mpc85xx     p1023rds            freescale      -           P1023RDS
 P1023RDS_NAND                powerpc     mpc85xx     p1023rds            freescale      -           P1023RDS:NAND
 P1024RDB                     powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1024RDB
doc/README.p1022ds +52 -0

55 lines not on this page · raw message

include/configs/P1022DS.h +50 -5

73 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#1 lore raw

PATCH v4 1/1 powerpc/p1022ds: Add sdcard and spi boot support to P1022DS

Quoted 29 lines · Dirk Eibach

---
Changes in v2:
- add Cc
- split up original patch series
Changes in v3:
- use clrsetbits() instead of clrbits()/setbits()
- remove dead code
- remove unnecessary #undef
Changes in v4:
- Add some documentation
- set pmuxcr depending on bootmode
- use 'ifdef' instead of 'if defined'
- undo unrelated whitespace change
- fix CONFIG_ENV_ADDR

 board/freescale/p1022ds/p1022ds.c |    5 +++
 board/freescale/p1022ds/tlb.c     |   10 +++++++
 boards.cfg                        |    4 +++
 doc/README.p1022ds                |   52 +++++++++++++++++++++++++++++++++++
 include/configs/P1022DS.h         |   55 +++++++++++++++++++++++++++++++++---
 5 files changed, 121 insertions(+), 5 deletions(-)
board/freescale/p1022ds/p1022ds.c +0 -0
index 456d9b0..e1e074e 100644

board/freescale/p1022ds/p1022ds.c int board_early_init_f(void) · line 44

Quoted 8 lines
board/freescale/p1022ds/p1022ds.c +5 -0
@@ -37,6 +37,11 @@ int board_early_init_f(void)
 {
        ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 
+#if defined(CONFIG_RAMBOOT_SPIFLASH) || defined(CONFIG_RAMBOOT_SDCARD)
+       /* Reset eLBC_DIU and SPI_eLBC in case we are booting from SD */
+       clrsetbits_be32(&gur->pmuxcr, 0x00600000, 0x80000000);
+#endif
+

This is somewhat convoluted, and also uses magic numbers. Please use named constants. Also, if we're going to change multiple bits in the pmuxcr, we might as well craft variables with the correct mask and set values, and set it once.

board/freescale/p1022ds/p1022ds.c int board_early_init_f(void) · line 46

Quoted 2 lines
board/freescale/p1022ds/p1022ds.c +0 -0
        /* Set pmuxcr to allow both i2c1 and i2c2 */
        setbits_be32(&gur->pmuxcr, 0x1000);

While you're at it, please change this to a named constant.

Thanks,
Andy