Skip to contentSkip to conversation

powerpc/p1022ds: Add support for NAND and NAND boot using SPL

PATCH New Matthew McClintock 3 participants 8 messages Feb 14, 2013 – Feb 18, 2013 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

Add defines needed to access NAND, remove second flash bank that is actually connected to NAND.

Add nand booting support for P1022DS with hardcoded DDR config using SPL framework from 2011

---
 board/freescale/common/Makefile       |    6 ++
 board/freescale/p1022ds/Makefile      |   14 ++++
 board/freescale/p1022ds/law.c         |    1 +
 board/freescale/p1022ds/spl_minimal.c |  133 +++++++++++++++++++++++++++++++
 board/freescale/p1022ds/tlb.c         |   20 +++--
 boards.cfg                            |    2 +
 drivers/video/Makefile                |    2 +
 include/configs/P1022DS.h             |  138 +++++++++++++++++++++++++++++----
 8 files changed, 296 insertions(+), 20 deletions(-)
 create mode 100644 board/freescale/p1022ds/spl_minimal.c
board/freescale/common/Makefile +6 -0
index 75725b4..72bb56c 100644
@@ -33,10 +33,14 @@ COBJS-$(CONFIG_FSL_CADMUS)	+= cadmus.o
 COBJS-$(CONFIG_FSL_VIA)		+= cds_via.o
 COBJS-$(CONFIG_FMAN_ENET)	+= fman.o
 COBJS-$(CONFIG_FSL_PIXIS)	+= pixis.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_FSL_NGPIXIS)	+= ngpixis.o
+endif
 COBJS-$(CONFIG_FSL_QIXIS)	+= qixis.o
 COBJS-$(CONFIG_PQ_MDS_PIB)	+= pq-mds-pib.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_ID_EEPROM)	+= sys_eeprom.o
+endif
 COBJS-$(CONFIG_FSL_SGMII_RISER)	+= sgmii_riser.o
 ifndef CONFIG_RAMBOOT_PBL
 COBJS-$(CONFIG_FSL_FIXED_MMC_LOCATION)	+= sdhc_boot.o
@@ -48,7 +52,9 @@ COBJS-$(CONFIG_MPC8555CDS)	+= cds_pci_ft.o
 
 COBJS-$(CONFIG_MPC8536DS)	+= ics307_clk.o
 COBJS-$(CONFIG_MPC8572DS)	+= ics307_clk.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_P1022DS)		+= ics307_clk.o
+endif
 COBJS-$(CONFIG_P2020DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P3041DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P4080DS)		+= ics307_clk.o
board/freescale/p1022ds/Makefile +14 -0
index c6d3418..0eeef05 100644
@@ -11,12 +11,26 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+MINIMAL=
+
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+
+COBJS-y        += spl_minimal.o tlb.o law.o
+
+else
 COBJS-y	+= $(BOARD).o
 COBJS-y	+= ddr.o
 COBJS-y	+= law.o
 COBJS-y	+= tlb.o
 
 COBJS-$(CONFIG_FSL_DIU_FB) += diu.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS-y))
board/freescale/p1022ds/law.c +1 -0
index b23b8f9..feee799 100644
@@ -16,6 +16,7 @@
 struct law_entry law_table[] = {
 	SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 	SET_LAW(PIXIS_BASE_PHYS, LAW_SIZE_4K, LAW_TRGT_IF_LBC),
+	SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_8K, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
board/freescale/p1022ds/spl_minimal.c new file +133 -0

133 lines not on this page · raw message

board/freescale/p1022ds/tlb.c +14 -6
index 71e71f7..3acc449 100644
@@ -41,6 +41,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 1, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	/* W**G* - Flash/promjet, localbus */
 	/* This will be changed to *I*G* after relocation to RAM. */
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
@@ -67,24 +68,31 @@ struct fsl_e_tlb_entry tlb_table[] = {
 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_IO_VIRT, CONFIG_SYS_PCIE3_IO_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 6, BOOKE_PAGESZ_256K, 1),
+#endif
 
 	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
-	/* *I*G - eSDHC/eSPI/NAND boot */
+#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL)
+	/* **** - eSDHC/eSPI/NAND boot */
 	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),
-
-	/* map the second 1G */
+	/* **** - eSDHC/eSPI/NAND boot - second 1GB of memory */
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
 			CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
-			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_1G, 1),
 #endif
-#
+
+#ifdef CONFIG_SYS_NAND_BASE
+	/* *I*G - NAND */
+	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 10, BOOKE_PAGESZ_16K, 1),
+#endif
+
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +2 -0
index 98f7a14..010e2d6 100644
@@ -785,6 +785,8 @@ P1021RDB-PC_NAND             powerpc     mpc85xx     p1_p2_rdb_pc        freesca
 P1021RDB-PC_SDCARD           powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1021RDB,SDCARD
 P1021RDB-PC_SPIFLASH         powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1021RDB,SPIFLASH
 P1022DS                      powerpc     mpc85xx     p1022ds             freescale
+P1022DS_NAND                 powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:NAND
+P1022DS_36BIT_NAND           powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:36BIT,NAND
 P1022DS_SPIFLASH             powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:SPIFLASH
 P1022DS_36BIT_SPIFLASH       powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:36BIT,SPIFLASH
 P1022DS_SDCARD               powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:SDCARD
drivers/video/Makefile +2 -0
index 170a358..a1c7895 100644
@@ -34,7 +34,9 @@ COBJS-$(CONFIG_EXYNOS_FB) += exynos_fb.o exynos_fimd.o
 COBJS-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o exynos_mipi_dsi_common.o \
 				exynos_mipi_dsi_lowlevel.o
 COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
+endif
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_LD9040) += ld9040.o
include/configs/P1022DS.h +124 -14

221 lines not on this page · raw message

Signature · 1 line
1.7.9.7
#1 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

board/freescale/p1022ds/spl_minimal.c line 92

Quoted 7 lines · Matthew McClintock
board/freescale/p1022ds/spl_minimal.c new file +7 -0
+#if defined(CONFIG_SYS_BR2_PRELIM) && defined(CONFIG_SYS_OR2_PRELIM)
+	/* for FPGA */
+	set_lbc_br(2, CONFIG_SYS_BR2_PRELIM);
+	set_lbc_or(2, CONFIG_SYS_OR2_PRELIM);
+#else
+#error CONFIG_SYS_BR2_PRELIM, CONFIG_SYS_OR2_PRELIM must be defined
+#endif

As discussed internally, this if/else is pointless. In internal discussion, you said it was moot, and then you post it again here?

Quoted 8 lines
drivers/video/Makefile +0 -0
index 170a358..a1c7895 100644
@@ -34,7 +34,9 @@ COBJS-$(CONFIG_EXYNOS_FB) += exynos_fb.o  

exynos_fimd.o
COBJS-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o
exynos_mipi_dsi_common.o \

drivers/video/Makefile COBJS-$(CONFIG_EXYNOS_FB) += exynos_fb.o exynos_fimd.o · line 42

Quoted 8 lines
drivers/video/Makefile +2 -0
 				exynos_mipi_dsi_lowlevel.o
 COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
+endif
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_LD9040) += ld9040.o

I thought we discussed internally that you don't need this?

drivers/video/Makefile

Quoted 8 lines
drivers/video/Makefile +8 -0
+/* Nand Flash */
+#if defined(CONFIG_NAND_FSL_ELBC) && !defined(CONFIG_FSL_DIU_FB)
+#define CONFIG_SYS_NAND_BASE		0xff800000
+#ifdef CONFIG_PHYS_64BIT
+#define CONFIG_SYS_NAND_BASE_PHYS	0xfff800000ull
+#else
+#define CONFIG_SYS_NAND_BASE_PHYS	CONFIG_SYS_NAND_BASE
+#endif

CONFIG_FSL_DIU_FB is always defined, so when would we ever set CONFIG_SYS_NAND_BASE?

Quoted 1 line

+#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE, }

...and here you use it outside the ifdef. I think the only reason that this builds is that CONFIG_FSL_DIU_FB is defined *after* the above check.

Why are you introducing a new ifdefs on CONFIG_FSL_DIU_FB here in the first place?

drivers/video/Makefile

Quoted 5 lines
drivers/video/Makefile +5 -0
+#ifdef CONFIG_FSL_DIU_FB
+#define CONFIG_SYS_BR1_PRELIM \
+	(BR_PHYS_ADDR(0xe0000000) | BR_PS_16 | BR_V)
+#define CONFIG_SYS_OR1_PRELIM	(OR_AM_128MB | 0xff7)
+#endif

Here's another -- this one is dead code. What does this have to do with NAND at all?

drivers/video/Makefile line 290

Quoted 8 lines
drivers/video/Makefile +2 -0
@@ -177,6 +284,8 @@
 #define PIXIS_LBMAP_SWITCH	7
 #define PIXIS_LBMAP_MASK	0xF0
 #define PIXIS_LBMAP_ALTBANK	0x20
+#define PIXIS_SPD		0x07
+#define PIXIS_SPD_SYSCLK_MASK	0x07
 #define PIXIS_ELBC_SPI_MASK	0xc0
 #define PIXIS_SPI		0x80

Relevance?

-Scott

#2 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

Quoted 13 lines · Scott Wood

board/freescale/p1022ds/spl_minimal.c line 92

Quoted 8 lines · Matthew McClintock
board/freescale/p1022ds/spl_minimal.c new file +7 -0
+#if defined(CONFIG_SYS_BR2_PRELIM) && defined(CONFIG_SYS_OR2_PRELIM)
+       /* for FPGA */
+       set_lbc_br(2, CONFIG_SYS_BR2_PRELIM);
+       set_lbc_or(2, CONFIG_SYS_OR2_PRELIM);
+#else
+#error CONFIG_SYS_BR2_PRELIM, CONFIG_SYS_OR2_PRELIM must be defined
+#endif

As discussed internally, this if/else is pointless. In internal discussion, you said it was moot, and then you post it again here?

Because one of us was confused. At some point I switched over the thinking we were talking about the ifdefs in dui.c. But, this clears things up quite a bit - these ifdefs are not required and not sure why there were ever put there.

Quoted 10 lines
Quoted 10 lines
drivers/video/Makefile +1 -0
index 170a358..a1c7895 100644
@@ -34,7 +34,9 @@ COBJS-$(CONFIG_EXYNOS_FB) += exynos_fb.o exynos_fimd.o
 COBJS-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o
 exynos_mipi_dsi_common.o \
                                exynos_mipi_dsi_lowlevel.o
 COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
+ifndef CONFIG_SPL_BUILD
Quoted 8 lines
Quoted 5 lines
drivers/video/Makefile +1 -0
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
+endif
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o

COBJS-$(CONFIG_LD9040) += ld9040.o

I thought we discussed internally that you don't need this?

Right, I tested without this but somehow lost the changes. Will fix in v2.

Quoted 15 lines

drivers/video/Makefile

Quoted 10 lines
drivers/video/Makefile +8 -0
+/* Nand Flash */
+#if defined(CONFIG_NAND_FSL_ELBC) && !defined(CONFIG_FSL_DIU_FB)
+#define CONFIG_SYS_NAND_BASE           0xff800000
+#ifdef CONFIG_PHYS_64BIT
+#define CONFIG_SYS_NAND_BASE_PHYS      0xfff800000ull
+#else
+#define CONFIG_SYS_NAND_BASE_PHYS      CONFIG_SYS_NAND_BASE
+#endif

CONFIG_FSL_DIU_FB is always defined, so when would we ever set CONFIG_SYS_NAND_BASE?

Quoted 8 lines
Quoted 1 line

+#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE, }

...and here you use it outside the ifdef. I think the only reason that this builds is that CONFIG_FSL_DIU_FB is defined *after* the above check.

Why are you introducing a new ifdefs on CONFIG_FSL_DIU_FB here in the first place?

Seems you are right about these bits. Not sure why this is or was ever written like this (for reference this is several "internal patches" squashed together). I'll remove the CONFIG_FSL_DIU_FB bits

Quoted 9 lines

drivers/video/Makefile

Quoted 5 lines
drivers/video/Makefile +5 -0
+#ifdef CONFIG_FSL_DIU_FB
+#define CONFIG_SYS_BR1_PRELIM \
+       (BR_PHYS_ADDR(0xe0000000) | BR_PS_16 | BR_V)
+#define CONFIG_SYS_OR1_PRELIM  (OR_AM_128MB | 0xff7)
+#endif

Here's another -- this one is dead code. What does this have to do with NAND at all?

This should have been removed. It's since been fixed by Timur's other patch to keep the BR/OR set when using the DIU.

Quoted 13 lines

drivers/video/Makefile line 290

Quoted 10 lines
drivers/video/Makefile +2 -0
@@ -177,6 +284,8 @@
 #define PIXIS_LBMAP_SWITCH     7
 #define PIXIS_LBMAP_MASK       0xF0
 #define PIXIS_LBMAP_ALTBANK    0x20
+#define PIXIS_SPD              0x07
+#define PIXIS_SPD_SYSCLK_MASK  0x07
 #define PIXIS_ELBC_SPI_MASK    0xc0
 #define PIXIS_SPI              0x80

Relevance?

The two new lines are used in spl_minimal.c when communicating with the PIXIS to determine what the bus_clk is for serial baud rate.

-M

#3 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

In reply to Scott Wood

Add defines needed to access NAND, remove second flash bank that is actually connected to NAND.

Add nand booting support for P1022DS with hardcoded DDR config using SPL framework from 2011

---
v2:
- remove unneeded changes to drivers/video/Makefile
- remove unneeded preprocessor usage around setting OR2/BR2
- remove stale code that is now addressed by another DIU fix

 board/freescale/common/Makefile       |    6 ++
 board/freescale/p1022ds/Makefile      |   14 ++++
 board/freescale/p1022ds/law.c         |    1 +
 board/freescale/p1022ds/spl_minimal.c |  129 ++++++++++++++++++++++++++++++++
 board/freescale/p1022ds/tlb.c         |   20 +++--
 boards.cfg                            |    2 +
 include/configs/P1022DS.h             |  132 +++++++++++++++++++++++++++++----
 7 files changed, 284 insertions(+), 20 deletions(-)
 create mode 100644 board/freescale/p1022ds/spl_minimal.c
board/freescale/common/Makefile +6 -0
index 75725b4..72bb56c 100644
@@ -33,10 +33,14 @@ COBJS-$(CONFIG_FSL_CADMUS)	+= cadmus.o
 COBJS-$(CONFIG_FSL_VIA)		+= cds_via.o
 COBJS-$(CONFIG_FMAN_ENET)	+= fman.o
 COBJS-$(CONFIG_FSL_PIXIS)	+= pixis.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_FSL_NGPIXIS)	+= ngpixis.o
+endif
 COBJS-$(CONFIG_FSL_QIXIS)	+= qixis.o
 COBJS-$(CONFIG_PQ_MDS_PIB)	+= pq-mds-pib.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_ID_EEPROM)	+= sys_eeprom.o
+endif
 COBJS-$(CONFIG_FSL_SGMII_RISER)	+= sgmii_riser.o
 ifndef CONFIG_RAMBOOT_PBL
 COBJS-$(CONFIG_FSL_FIXED_MMC_LOCATION)	+= sdhc_boot.o
@@ -48,7 +52,9 @@ COBJS-$(CONFIG_MPC8555CDS)	+= cds_pci_ft.o
 
 COBJS-$(CONFIG_MPC8536DS)	+= ics307_clk.o
 COBJS-$(CONFIG_MPC8572DS)	+= ics307_clk.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_P1022DS)		+= ics307_clk.o
+endif
 COBJS-$(CONFIG_P2020DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P3041DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P4080DS)		+= ics307_clk.o
board/freescale/p1022ds/Makefile +14 -0
index c6d3418..0eeef05 100644
@@ -11,12 +11,26 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+MINIMAL=
+
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+
+COBJS-y        += spl_minimal.o tlb.o law.o
+
+else
 COBJS-y	+= $(BOARD).o
 COBJS-y	+= ddr.o
 COBJS-y	+= law.o
 COBJS-y	+= tlb.o
 
 COBJS-$(CONFIG_FSL_DIU_FB) += diu.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS-y))
board/freescale/p1022ds/law.c +1 -0
index b23b8f9..feee799 100644
@@ -16,6 +16,7 @@
 struct law_entry law_table[] = {
 	SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 	SET_LAW(PIXIS_BASE_PHYS, LAW_SIZE_4K, LAW_TRGT_IF_LBC),
+	SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_8K, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
board/freescale/p1022ds/spl_minimal.c new file +129 -0

129 lines not on this page · raw message

board/freescale/p1022ds/tlb.c +14 -6
index 71e71f7..3acc449 100644
@@ -41,6 +41,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 1, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	/* W**G* - Flash/promjet, localbus */
 	/* This will be changed to *I*G* after relocation to RAM. */
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
@@ -67,24 +68,31 @@ struct fsl_e_tlb_entry tlb_table[] = {
 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_IO_VIRT, CONFIG_SYS_PCIE3_IO_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 6, BOOKE_PAGESZ_256K, 1),
+#endif
 
 	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
-	/* *I*G - eSDHC/eSPI/NAND boot */
+#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL)
+	/* **** - eSDHC/eSPI/NAND boot */
 	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),
-
-	/* map the second 1G */
+	/* **** - eSDHC/eSPI/NAND boot - second 1GB of memory */
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
 			CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
-			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_1G, 1),
 #endif
-#
+
+#ifdef CONFIG_SYS_NAND_BASE
+	/* *I*G - NAND */
+	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 10, BOOKE_PAGESZ_16K, 1),
+#endif
+
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +2 -0
index 98f7a14..010e2d6 100644
@@ -785,6 +785,8 @@ P1021RDB-PC_NAND             powerpc     mpc85xx     p1_p2_rdb_pc        freesca
 P1021RDB-PC_SDCARD           powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1021RDB,SDCARD
 P1021RDB-PC_SPIFLASH         powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1021RDB,SPIFLASH
 P1022DS                      powerpc     mpc85xx     p1022ds             freescale
+P1022DS_NAND                 powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:NAND
+P1022DS_36BIT_NAND           powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:36BIT,NAND
 P1022DS_SPIFLASH             powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:SPIFLASH
 P1022DS_36BIT_SPIFLASH       powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:36BIT,SPIFLASH
 P1022DS_SDCARD               powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:SDCARD
include/configs/P1022DS.h +118 -14

215 lines not on this page · raw message

Signature · 1 line
1.7.9.7
#4 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

Quoted 6 lines · Matthew McClintock
(quoted diff) +0 -0
@@ -118,6 +172,7 @@
  * Localbus non-cacheable
  * 0xe000_0000	0xe80f_ffff	Promjet/free		128M  

non-cacheable
* 0xe800_0000 0xefff_ffff FLASH 128M
non-cacheable

Quoted 8 lines

+ * 0xff80_0000 0xff80_1fff NAND 8K
non-cacheable
* 0xffdf_0000 0xffdf_7fff PIXIS 32K
non-cacheable TLB0
* 0xffd0_0000 0xffd0_3fff L1 for stack 16K
Cacheable TLB0
* 0xffe0_0000 0xffef_ffff CCSR 1M
non-cacheable

This says 8K...

Quoted 12 lines
(quoted diff) +2 -0
+/* NAND flash config */
+#define CONFIG_SYS_NAND_BR_PRELIM   

(BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \

(quoted diff) +1 -0
+			       | (2<<BR_DECC_SHIFT)    /* Use HW ECC */  

\

(quoted diff) +1 -0
+			       | BR_PS_8	       /* Port Size = 8  

bit */ \

(quoted diff) +1 -0
+			       | BR_MS_FCM	       /* MSEL = FCM */  

\

(quoted diff) +2 -0
+			       | BR_V)		       /* valid */
+#define CONFIG_SYS_NAND_OR_PRELIM  (OR_AM_256KB	       /*  

length 256K */ \

include/configs/P1022DS.h line 251

Quoted 7 lines
include/configs/P1022DS.h +7 -0
+			       | OR_FCM_PGS	       /* Large Page*/ \
+			       | OR_FCM_CSCT \
+			       | OR_FCM_CST \
+			       | OR_FCM_CHT \
+			       | OR_FCM_SCY_1 \
+			       | OR_FCM_TRLX \
+			       | OR_FCM_EHTR)

...this says 256K.

IIRC the minimum for localbus is 32K.

-Scott

#5 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

Quoted 37 lines · Scott Wood
Quoted 10 lines · Matthew McClintock
include/configs/P1022DS.h +1 -0
@@ -118,6 +172,7 @@
  * Localbus non-cacheable
  * 0xe000_0000 0xe80f_ffff     Promjet/free            128M non-cacheable
  * 0xe800_0000 0xefff_ffff     FLASH                   128M non-cacheable
+ * 0xff80_0000 0xff80_1fff     NAND                    8K non-cacheable
  * 0xffdf_0000 0xffdf_7fff     PIXIS                   32K non-cacheable

TLB0

  * 0xffd0_0000 0xffd0_3fff     L1 for stack            16K Cacheable TLB0
  * 0xffe0_0000 0xffef_ffff     CCSR                    1M non-cacheable

This says 8K...

Quoted 10 lines
(quoted diff) +2 -0
+/* NAND flash config */
+#define CONFIG_SYS_NAND_BR_PRELIM

(BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \

(quoted diff) +2 -0
+                              | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
+                              | BR_PS_8               /* Port Size = 8

bit */ \

include/configs/P1022DS.h +3 -0
+                              | BR_MS_FCM             /* MSEL = FCM */ \
+                              | BR_V)                 /* valid */
+#define CONFIG_SYS_NAND_OR_PRELIM  (OR_AM_256KB               /* length

256K */ \

include/configs/P1022DS.h line 251

Quoted 7 lines
include/configs/P1022DS.h +7 -0
+                              | OR_FCM_PGS            /* Large Page*/ \
+                              | OR_FCM_CSCT \
+                              | OR_FCM_CST \
+                              | OR_FCM_CHT \
+                              | OR_FCM_SCY_1 \
+                              | OR_FCM_TRLX \
+                              | OR_FCM_EHTR)

...this says 256K.

Quoted 1 line

IIRC the minimum for localbus is 32K.

And the law is 8K and TLB is 16K - should I go with 32K for everything? However, I don't think 32K TLB works on this part.

-M

#6 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

Quoted 48 lines · On 02/18/2013 01:24:44 PM, McClintock Matthew-B29882 wrote:
Quoted 5 lines · Scott Wood

Review line 173

Quoted 4 lines · Matthew McClintock
(quoted diff) +0 -0
@@ -118,6 +172,7 @@
  * Localbus non-cacheable
  * 0xe000_0000 0xe80f_ffff     Promjet/free            128M  

non-cacheable

Quoted 1 line

Review line 174

Quoted 1 line
(quoted diff) +0 -0
  * 0xe800_0000 0xefff_ffff     FLASH                   128M  

non-cacheable

Quoted 1 line

Review line 175

Quoted 1 line
(quoted diff) +1 -0
+ * 0xff80_0000 0xff80_1fff     NAND                    8K  

non-cacheable

Quoted 1 line

Review line 176

Quoted 1 line
(quoted diff) +0 -0
  * 0xffdf_0000 0xffdf_7fff     PIXIS                   32K  

non-cacheable

Quoted 2 lines
Quoted 2 lines

TLB0
* 0xffd0_0000 0xffd0_3fff L1 for stack 16K

Cacheable TLB0

Quoted 1 line
Quoted 1 line

* 0xffe0_0000 0xffef_ffff CCSR 1M

non-cacheable

Quoted 9 lines

This says 8K...

Quoted 4 lines
(quoted diff) +2 -0
+/* NAND flash config */
+#define CONFIG_SYS_NAND_BR_PRELIM

(BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
+ | (2<<BR_DECC_SHIFT) /* Use HW

ECC */ \

Quoted 1 line
Quoted 1 line

+ | BR_PS_8 /* Port

Size = 8

Quoted 2 lines
Quoted 2 lines

bit */ \
+ | BR_MS_FCM /* MSEL =

FCM */ \

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+                              | BR_V)                 /* valid */
+#define CONFIG_SYS_NAND_OR_PRELIM  (OR_AM_256KB               /*  

length

Quoted 2 lines
Quoted 2 lines

256K */ \
+ | OR_FCM_PGS /* Large

Page*/ \

Quoted 8 lines
Quoted 6 lines
include/configs/P1022DS.h +6 -0
+                              | OR_FCM_CSCT \
+                              | OR_FCM_CST \
+                              | OR_FCM_CHT \
+                              | OR_FCM_SCY_1 \
+                              | OR_FCM_TRLX \
+                              | OR_FCM_EHTR)
Quoted 6 lines
Quoted 3 lines

...this says 256K.

IIRC the minimum for localbus is 32K.

And the law is 8K and TLB is 16K - should I go with 32K for everything? However, I don't think 32K TLB works on this part.

You don't need to create a 32K TLB, but the documented address map should agree with what you put in the actual hardware (and LAWs should agree with ORn/BRn).

-Scott

#7 lore raw

PATCH 1/1 powerpc/p1022ds: Add support for NAND and NAND boot using SPL

Add defines needed to access NAND, remove second flash bank that is actually connected to NAND.

Add nand booting support for P1022DS with hardcoded DDR config using SPL framework from 2011

---
v2:
- remove unneeded changes to drivers/video/Makefile
- remove unneeded preprocessor usage around setting OR2/BR2
- remove stale code that is now addressed by another DIU fix v3:
- make law and localbus sizes consistent

 board/freescale/common/Makefile       |    6 ++
 board/freescale/p1022ds/Makefile      |   14 ++++
 board/freescale/p1022ds/law.c         |    1 +
 board/freescale/p1022ds/spl_minimal.c |  129 ++++++++++++++++++++++++++++++++
 board/freescale/p1022ds/tlb.c         |   20 +++--
 boards.cfg                            |    2 +
 include/configs/P1022DS.h             |  132 +++++++++++++++++++++++++++++----
 7 files changed, 284 insertions(+), 20 deletions(-)
 create mode 100644 board/freescale/p1022ds/spl_minimal.c
board/freescale/common/Makefile +6 -0
index 75725b4..72bb56c 100644
@@ -33,10 +33,14 @@ COBJS-$(CONFIG_FSL_CADMUS)	+= cadmus.o
 COBJS-$(CONFIG_FSL_VIA)		+= cds_via.o
 COBJS-$(CONFIG_FMAN_ENET)	+= fman.o
 COBJS-$(CONFIG_FSL_PIXIS)	+= pixis.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_FSL_NGPIXIS)	+= ngpixis.o
+endif
 COBJS-$(CONFIG_FSL_QIXIS)	+= qixis.o
 COBJS-$(CONFIG_PQ_MDS_PIB)	+= pq-mds-pib.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_ID_EEPROM)	+= sys_eeprom.o
+endif
 COBJS-$(CONFIG_FSL_SGMII_RISER)	+= sgmii_riser.o
 ifndef CONFIG_RAMBOOT_PBL
 COBJS-$(CONFIG_FSL_FIXED_MMC_LOCATION)	+= sdhc_boot.o
@@ -48,7 +52,9 @@ COBJS-$(CONFIG_MPC8555CDS)	+= cds_pci_ft.o
 
 COBJS-$(CONFIG_MPC8536DS)	+= ics307_clk.o
 COBJS-$(CONFIG_MPC8572DS)	+= ics307_clk.o
+ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_P1022DS)		+= ics307_clk.o
+endif
 COBJS-$(CONFIG_P2020DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P3041DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P4080DS)		+= ics307_clk.o
board/freescale/p1022ds/Makefile +14 -0
index c6d3418..0eeef05 100644
@@ -11,12 +11,26 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+MINIMAL=
+
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+
+COBJS-y        += spl_minimal.o tlb.o law.o
+
+else
 COBJS-y	+= $(BOARD).o
 COBJS-y	+= ddr.o
 COBJS-y	+= law.o
 COBJS-y	+= tlb.o
 
 COBJS-$(CONFIG_FSL_DIU_FB) += diu.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS-y))
board/freescale/p1022ds/law.c +1 -0
index b23b8f9..c4398dd 100644
@@ -16,6 +16,7 @@
 struct law_entry law_table[] = {
 	SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
 	SET_LAW(PIXIS_BASE_PHYS, LAW_SIZE_4K, LAW_TRGT_IF_LBC),
+	SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_32K, LAW_TRGT_IF_LBC),
 };
 
 int num_law_entries = ARRAY_SIZE(law_table);
board/freescale/p1022ds/spl_minimal.c new file +129 -0

129 lines not on this page · raw message

board/freescale/p1022ds/tlb.c +14 -6
index 71e71f7..3acc449 100644
@@ -41,6 +41,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 1, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	/* W**G* - Flash/promjet, localbus */
 	/* This will be changed to *I*G* after relocation to RAM. */
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
@@ -67,24 +68,31 @@ struct fsl_e_tlb_entry tlb_table[] = {
 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_IO_VIRT, CONFIG_SYS_PCIE3_IO_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 6, BOOKE_PAGESZ_256K, 1),
+#endif
 
 	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
-	/* *I*G - eSDHC/eSPI/NAND boot */
+#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL)
+	/* **** - eSDHC/eSPI/NAND boot */
 	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),
-
-	/* map the second 1G */
+	/* **** - eSDHC/eSPI/NAND boot - second 1GB of memory */
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
 			CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
-			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_1G, 1),
 #endif
-#
+
+#ifdef CONFIG_SYS_NAND_BASE
+	/* *I*G - NAND */
+	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 10, BOOKE_PAGESZ_16K, 1),
+#endif
+
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +2 -0
index 98f7a14..010e2d6 100644
@@ -785,6 +785,8 @@ P1021RDB-PC_NAND             powerpc     mpc85xx     p1_p2_rdb_pc        freesca
 P1021RDB-PC_SDCARD           powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1021RDB,SDCARD
 P1021RDB-PC_SPIFLASH         powerpc     mpc85xx     p1_p2_rdb_pc        freescale      -           p1_p2_rdb_pc:P1021RDB,SPIFLASH
 P1022DS                      powerpc     mpc85xx     p1022ds             freescale
+P1022DS_NAND                 powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:NAND
+P1022DS_36BIT_NAND           powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:36BIT,NAND
 P1022DS_SPIFLASH             powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:SPIFLASH
 P1022DS_36BIT_SPIFLASH       powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:36BIT,SPIFLASH
 P1022DS_SDCARD               powerpc     mpc85xx     p1022ds             freescale	-	    P1022DS:SDCARD
include/configs/P1022DS.h +118 -14

215 lines not on this page · raw message

Signature · 1 line
1.7.9.7