powerpc/p1022ds: Add sdcard and spi boot support to P1022DS
PATCH v3 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
board/freescale/p1022ds/p1022ds.c | 3 ++ board/freescale/p1022ds/tlb.c | 10 ++++++ boards.cfg | 4 ++ include/configs/P1022DS.h | 56 +++++++++++++++++++++++++++++++++--- 4 files changed, 68 insertions(+), 5 deletions(-)
board/freescale/p1022ds/p1022ds.c +3 -0
@@ -37,6 +37,9 @@ int board_early_init_f(void) {ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR; +/* Reset eLBC_DIU and SPI_eLBC in case we are booting from SD */ +clrsetbits_be32 (&gur->pmuxcr,0x00600000 ,0x80000000 ); +/* Set pmuxcr to allow both i2c1 and i2c2 */ setbits_be32 (&gur->pmuxcr,0x1000 );
board/freescale/p1022ds/tlb.c +10 -0
@@ -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), + +#if defined(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
@@ -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
include/configs/P1022DS.h +51 -5
80 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v3 1/1 powerpc/p1022ds: Add sdcard and spi boot support to P1022DS
Quoted 3 lines · Dirk Eibach
Signed-off-by Dirk Eibach <[email protected]>Cc Timur Tabi <[email protected]>---
Can you give me some instructions on how to test this? I'm working on adding NAND boot support to the P1022, so I need to make sure I don't conflict with your patch.
Quoted 19 lines
Changes in v2:
- add Cc
- split up original patch series
Changes in v3:
- useclrsetbits()instead of clrbits()/setbits()
- remove dead code
- remove unnecessary #undefboard/freescale/p1022ds/p1022ds.c | 3 ++ board/freescale/p1022ds/tlb.c | 10 ++++++ boards.cfg | 4 ++ include/configs/P1022DS.h | 56 +++++++++++++++++++++++++++++++++--- 4 files changed, 68 insertions(+), 5 deletions(-)board/freescale/p1022ds/p1022ds.c +0
-0
board/freescale/p1022ds/p1022ds.c int board_early_init_f(void) · line 42
Quoted 6 lines
board/freescale/p1022ds/p1022ds.c +3
-0@@ -37,6 +37,9 @@ int board_early_init_f(void) {ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR; +/* Reset eLBC_DIU and SPI_eLBC in case we are booting from SD */ +clrsetbits_be32 (&gur->pmuxcr,0x00600000 ,0x80000000 ); +
Should there be an #ifdef around this, like maybe:
#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH) /* Reset eLBC_DIU and SPI_eLBC when we are booting from SD */ clrsetbits_be32(&gur->pmuxcr, 0x00600000, 0x80000000);
#endif
board/freescale/p1022ds/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 75
Quoted 13 lines
board/freescale/p1022ds/p1022ds.c +0
-0/* Set pmuxcr to allow both i2c1 and i2c2 */ setbits_be32 (&gur->pmuxcr,0x1000 );board/freescale/p1022ds/tlb.c +2
-0@@ -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), + +#if defined(CONFIG_SYS_RAMBOOT )
Please use #ifdef instead of "#if defined" where possible.
Quoted 50 lines
board/freescale/p1022ds/tlb.c +8
-0+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@@ -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:P1024RDBinclude/configs/P1022DS.h +12
-0@@ -26,6 +26,18 @@#define CONFIG_P1022DS #define CONFIG_MP /* support multiple processors */ +#ifdef CONFIG_SDCARD +#define CONFIG_RAMBOOT_SDCARD 1 +#define CONFIG_SYS_TEXT_BASE 0x11000000 +#define CONFIG_RESET_VECTOR_ADDRESS 0x1107fffc +#endif + +#ifdef CONFIG_SPIFLASH +#define CONFIG_RAMBOOT_SPIFLASH 1 +#define CONFIG_SYS_TEXT_BASE 0x11000000 +#define CONFIG_RESET_VECTOR_ADDRESS 0x1107fffc +#endif +#ifndef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0xeff80000#endif
include/configs/P1022DS.h line 70
Quoted 5 lines
include/configs/P1022DS.h +1
-0@@ -54,6 +66,7 @@#define CONFIG_SYS_CLK_FREQ get_board_sys_clk()#define CONFIG_DDR_CLK_FREQ get_board_ddr_clk() +#define CONFIG_ICS307_REFCLK_HZ 33333000/* ICS307 clock chip ref freq */
Unrelated whitespace change, please remove.
Quoted 38 lines
include/configs/P1022DS.h +20
-5/* @@ -138,6 +151,12 @@#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE/* start of monitor */ +#if defined(CONFIG_RAMBOOT_NAND ) || defined(CONFIG_RAMBOOT_SDCARD ) || \ + defined(CONFIG_RAMBOOT_SPIFLASH ) +#define CONFIG_SYS_RAMBOOT +#define CONFIG_SYS_EXTRA_ENV_RELOC +#endif +#define CONFIG_FLASH_CFI_DRIVER #define CONFIG_SYS_FLASH_CFI #define CONFIG_SYS_FLASH_EMPTY_INFO @@ -403,11 +422,38 @@/* * Environment */ -#define CONFIG_ENV_IS_IN_FLASH -#define CONFIG_ENV_OVERWRITE -#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE) -#define CONFIG_ENV_SIZE 0x2000 -#define CONFIG_ENV_SECT_SIZE 0x20000 +#if defined(CONFIG_SYS_RAMBOOT ) +#if defined(CONFIG_RAMBOOT_NAND ) +#define CONFIG_ENV_IS_IN_NAND 1 +#define CONFIG_ENV_SIZE CONFIG_SYS_NAND_BLOCK_SIZE +#define CONFIG_ENV_OFFSET ((512 * 1024) + CONFIG_SYS_NAND_BLOCK_SIZE) +#define CONFIG_ENV_RANGE (3 * CONFIG_ENV_SIZE) +#elif defined(CONFIG_RAMBOOT_SPIFLASH ) +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_SPI_BUS 0 +#define CONFIG_ENV_SPI_CS 0 +#define CONFIG_ENV_SPI_MAX_HZ 10000000 +#define CONFIG_ENV_SPI_MODE 0 +#define CONFIG_ENV_SIZE 0x2000/* 8KB */ +#define CONFIG_ENV_OFFSET 0x100000
include/configs/P1022DS.h line 448
Quoted 10 lines
include/configs/P1022DS.h +10
-0+#define CONFIG_ENV_SECT_SIZE 0x10000 +#elif defined(CONFIG_RAMBOOT_SDCARD ) +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_FSL_FIXED_MMC_LOCATION +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_SYS_MMC_ENV_DEV 0 +#else +#define CONFIG_ENV_IS_NOWHERE 1/* Store ENV in memory only */ +#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - 0x1000) +#define CONFIG_ENV_SIZE 0x2000
Shouldn't this be
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
Otherwise, the environment won't fit?
Quoted 11 lines
include/configs/P1022DS.h +8
-0+#endif +#else +#define CONFIG_ENV_IS_IN_FLASH +#define CONFIG_ENV_OVERWRITE +#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE) +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_SECT_SIZE 0x20000 +#endif #define CONFIG_LOADS_ECHO #define CONFIG_SYS_LOADS_BAUD_CHANGE
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
Eibach
PATCH v3 1/1 powerpc/p1022ds: Add sdcard and spi boot support to P1022DS
Quoted 38 lines
include/configs/P1022DS.h line 408
Quoted 9 lines
include/configs/P1022DS.h +0
-3@@ -403,11 +422,38 @@/* * Environment */ -#define CONFIG_ENV_IS_IN_FLASH -#define CONFIG_ENV_OVERWRITE -#define CONFIG_ENV_ADDR (
CONFIG_SYS_MONITOR_BASE-CONFIG_ENV_SECT_SIZE)include/configs/P1022DS.h
Quoted 7 lines
include/configs/P1022DS.h +5
-2-#define CONFIG_ENV_SIZE 0x2000 -#define CONFIG_ENV_SECT_SIZE 0x20000 +#if defined(CONFIG_SYS_RAMBOOT ) +#if defined(CONFIG_RAMBOOT_NAND ) +#define CONFIG_ENV_IS_IN_NAND 1 +#define CONFIG_ENV_SIZE CONFIG_SYS_NAND_BLOCK_SIZE +#define CONFIG_ENV_OFFSET ((512 * 1024) +
CONFIG_SYS_NAND_BLOCK_SIZE)Quoted 7 lines
include/configs/P1022DS.h +7
-0+#define CONFIG_ENV_RANGE (3 * CONFIG_ENV_SIZE) +#elif defined(CONFIG_RAMBOOT_SPIFLASH) #define +CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_SPI_BUS 0 +#define CONFIG_ENV_SPI_CS 0 +#define CONFIG_ENV_SPI_MAX_HZ 10000000 +#define CONFIG_ENV_SPI_MODE 0include/configs/P1022DS.h
Quoted 10 lines
include/configs/P1022DS.h +10
-0+#define CONFIG_ENV_SIZE 0x2000/* 8KB */ +#define CONFIG_ENV_OFFSET 0x100000 +#define CONFIG_ENV_SECT_SIZE 0x10000 +#elif defined(CONFIG_RAMBOOT_SDCARD ) +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_FSL_FIXED_MMC_LOCATION +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_SYS_MMC_ENV_DEV 0 +#else +#define CONFIG_ENV_IS_NOWHERE 1/* Store ENV in memory only */
Review line 447
Quoted 1 line
(quoted diff) +1
-0+ #define CONFIG_ENV_ADDR(
CONFIG_SYS_MONITOR_BASE-0x1000)
Quoted 8 lines
Review line 448
Quoted 1 line
(quoted diff) +1
-0+ #define CONFIG_ENV_SIZE 0x2000Shouldn't this be
#define
CONFIG_ENV_ADDR(CONFIG_SYS_MONITOR_BASE-CONFIG_ENV_SIZE)Otherwise, the environment won't fit?
Probably you are right. Though these lines are inspired by other Freescale boards.
git grep -3 "CONFIG_SYS_MONITOR_BASE - 0x1000" include/configs gives lots of examples where it is set up this way and probably needs fixing.
Maybe it was originally copied from one of the places where CONFIG_ENV_SIZE is 0x200 and the 0x1000 value was not adjusted.
I will fix it for P1022DS in the v4 patch.
Cheers
Dirk
Eibach
PATCH v3 1/1 powerpc/p1022ds: Add sdcard and spi boot support to P1022DS
In reply to Timur TabiQuoted 5 lines
Can you give me some instructions on how to test this? I'm working on adding NAND boot support to the P1022, so I need to make sure I don't conflict with your patch.
Hi Timur,
What is the current status of this stuff?
Cheers
Dirk