Skip to contentSkip to conversation

board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB

PATCH Superseded Prabhakar Kushwaha 2 participants 6 messages Mar 31, 2014 – Apr 1, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 10/10 board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB

Add support of 2 stage NAND, SD, SPI boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(160KB). This further initialise DDR using SPD and environment and copy u-boot(768 KB) from NAND to DDR. Finally SPL transer control to u-boot.

Initialise/create followings required for SPL framework
- Add spl.c which defines board_init_f, board_init_r
- update tlb and ddr accordingly

---
This patch depends upon
"[PATCH 3] powerpc/t104xrdb: Unification of T104xRDB header files"
http://patchwork.ozlabs.org/patch/335207/

 board/freescale/t104xrdb/Makefile      |    7 +-
 board/freescale/t104xrdb/README        |   87 ++++++++++++++++++++++
 board/freescale/t104xrdb/ddr.c         |    5 +-
 board/freescale/t104xrdb/spl.c         |  118 +++++++++++++++++++++++++++++
 board/freescale/t104xrdb/t1040_rcw.cfg |    7 ++
 board/freescale/t104xrdb/t1042_rcw.cfg |    7 ++
 board/freescale/t104xrdb/t104x_pbi.cfg |   26 +++++++
 board/freescale/t104xrdb/tlb.c         |   12 +++
 boards.cfg                             |    6 ++
 include/configs/T104xRDB.h             |  128 ++++++++++++++++++++++++++++----
 10 files changed, 384 insertions(+), 19 deletions(-)
 create mode 100644 board/freescale/t104xrdb/spl.c
 create mode 100644 board/freescale/t104xrdb/t1040_rcw.cfg
 create mode 100644 board/freescale/t104xrdb/t1042_rcw.cfg
 create mode 100644 board/freescale/t104xrdb/t104x_pbi.cfg
board/freescale/t104xrdb/Makefile +5 -2
index e51fb7a..a68c951 100644
@@ -4,10 +4,13 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+else
 obj-y	+= t104xrdb.o
-obj-y	+= ddr.o
 obj-y	+= eth.o
 obj-$(CONFIG_PCI)	+= pci.o
+endif
+obj-y	+= ddr.o
 obj-y	+= law.o
 obj-y	+= tlb.o
board/freescale/t104xrdb/README +87 -0

90 lines not on this page · raw message

board/freescale/t104xrdb/ddr.c +4 -1
index 57d0f9c..34c9224 100644
@@ -113,6 +113,7 @@ phys_size_t initdram(int board_type)
 {
 	phys_size_t dram_size;
 
+#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_RAMBOOT_PBL)
 	puts("Initializing....using SPD\n");
 
 	dram_size = fsl_ddr_sdram();
@@ -120,6 +121,8 @@ phys_size_t initdram(int board_type)
 	dram_size = setup_ddr_tlbs(dram_size / 0x100000);
 	dram_size *= 0x100000;
 
-	puts("    DDR: ");
+#else
+	dram_size =  fsl_ddr_sdram_size();
+#endif
 	return dram_size;
 }
board/freescale/t104xrdb/spl.c new file +118 -0

118 lines not on this page · raw message

board/freescale/t104xrdb/t1040_rcw.cfg new file +7 -0
new file mode 100644
index 0000000..3300c18
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+aa55aa55 010e0100
+# serdes protocol 0x66
+0c18000e 0e000000 00000000 00000000
+66000002 80000002 e8106000 01000000
+00000000 00000000 00000000 00032810
+00000000 0342500f 00000000 00000000
board/freescale/t104xrdb/t1042_rcw.cfg new file +7 -0
new file mode 100644
index 0000000..a3ea8ad
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+aa55aa55 010e0100
+# serdes protocol 0x66
+0c18000e 0e000000 00000000 00000000
+06000002 00400002 e8106000 01000000
+00000000 00000000 00000000 00030810
+00000000 01fe0a06 00000000 00000000
board/freescale/t104xrdb/t104x_pbi.cfg new file +26 -0
new file mode 100644
index 0000000..7b9e9b0
@@ -0,0 +1,26 @@
+#PBI commands
+#Initialize CPC1
+09010000 00200400
+09138000 00000000
+091380c0 00000100
+#Configure CPC1 as 256KB SRAM
+09010100 00000000
+09010104 fffc0007
+09010f00 08000000
+09010000 80000000
+#Configure LAW for CPC1
+09000cd0 00000000
+09000cd4 fffc0000
+09000cd8 81000011
+#Configure alternate space
+09000010 00000000
+09000014 ff000000
+09000018 81000000
+#Configure SPI controller
+09110000 80000403
+09110020 2d170008
+09110024 00100008
+09110028 00100008
+0911002c 00100008
+#Flush PBL data
+091380c0 000FFFFF
board/freescale/t104xrdb/tlb.c +12 -0
index 84f97a4..95c15aa 100644
@@ -53,6 +53,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 		      0, 2, BOOKE_PAGESZ_256M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	/* *I*G* - PCI */
 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -82,6 +83,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 8, BOOKE_PAGESZ_16M, 1),
 #endif
+#endif
 #ifdef CONFIG_SYS_DCSRBAR_PHYS
 	SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -102,6 +104,16 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 11, BOOKE_PAGESZ_256K, 1),
 #endif
+
+#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
+	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
+		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
+		      0, 12, 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, 13, BOOKE_PAGESZ_1G, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +6 -0
index 76f3aae..1c96a51 100644
@@ -933,7 +933,13 @@ Active  powerpc     mpc85xx        -           freescale       p2041rdb
 Active  powerpc     mpc85xx        -           freescale       p2041rdb            P2041RDB_SRIO_PCIE_BOOT              P2041RDB:SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000                                                                            -
 Active  powerpc     mpc85xx        -           freescale       t1040qds            T1040QDS                             T1040QDS:PPC_T1040                                                                                                                Poonam Aggrwal <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1040RDB                             T104xRDB:PPC_T1040,T1040RDB                                                                                                                Priyanka Jain  <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1040RDB_NAND                         T104xRDB:PPC_T1040,T1040RDB,RAMBOOT_PBL,RAMBOOT_SPLPBL,NAND                                                                            Priyanka Jain  <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1040RDB_SPIFLASH                         T104xRDB:PPC_T1040,T1040RDB,RAMBOOT_PBL,RAMBOOT_SPLPBL,SPIFLASH                                                                            Priyanka Jain  <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1040RDB_SDCARD                       T104xRDB:PPC_T1040,T1040RDB,RAMBOOT_PBL,RAMBOOT_SPLPBL,SDCARD
 Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1042RDB_PI                          T104xRDB:PPC_T1042,T1042RDB_PI                                                                                                             Priyanka Jain  <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1042RDB_PI_NAND                     T104xRDB:PPC_T1042,T1042RDB_PI,RAMBOOT_PBL,RAMBOOT_SPLPBL,NAND                                                                            Priyanka Jain  <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1042RDB_PI_SPIFLASH                 T104xRDB:PPC_T1042,T1042RDB_PI,RAMBOOT_PBL,RAMBOOT_SPLPBL,SPIFLASH                                                                     Priyanka Jain  <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       t104xrdb            T1042RDB_PI_SDCARD                   T104xRDB:PPC_T1042,T1042RDB_PI,RAMBOOT_PBL,RAMBOOT_SPLPBL,SDCARD
 Active  powerpc     mpc85xx        -           freescale       t208xqds            T2080QDS                             T208xQDS:PPC_T2080                                                                                                                -
 Active  powerpc     mpc85xx        -           freescale       t208xqds            T2080QDS_NAND                        T208xQDS:PPC_T2080,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF40000                                                                      -
 Active  powerpc     mpc85xx        -           freescale       t208xqds            T2080QDS_SDCARD                      T208xQDS:PPC_T2080,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000                                                                    -
include/configs/T104xRDB.h +112 -16

193 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 10/10 board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB

Dear Prabhakar Kushwaha,

Quoted 4 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:

Add support of 2 stage NAND, SD, SPI boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(160KB). This further initialise DDR using SPD and environment and copy u-boot(768 KB) from NAND

to DDR.

Quoted 1 line

Finally SPL transer control to u-boot.

This patch does not apply to HEAD.

[u-boot (X_2stage $)]$ pw_u.sh 335250

2014-04-01 07:11:13 URL:http://patchwork.ozlabs.org/patch/335250/mbox/ 

[23256] -> "pw-am-335250.patch" [1]
Applying: board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB
error: patch failed: boards.cfg:933
error: boards.cfg: patch does not apply
error: include/configs/T104xRDB.h: does not exist in index

More comments below.

8>< snipped ><8

Review

Quoted 1 line
(quoted diff) +0 -0

b/board/freescale/t104xrdb/t1040_rcw.cfg

board/freescale/t104xrdb/t1040_rcw.cfg line 5

Quoted 10 lines

new file mode 100644
index 0000000..3300c18

board/freescale/t104xrdb/t1040_rcw.cfg new file +5 -0
 <at>  <at>  -0,0 +1,7  <at>  <at> 
+#PBL preamble and RCW header
+aa55aa55 010e0100
+# serdes protocol 0x66
+0c18000e 0e000000 00000000 00000000
+66000002 80000002 e8106000 01000000

e8106000
^^^^^^^^
Don't you need a separate RCW setting for SPI?
The previous patchset had a note about it.

Review

Quoted 4 lines

+00000000 00000000 00000000 00032810
+00000000 0342500f 00000000 00000000

(quoted diff) +0 -0

b/board/freescale/t104xrdb/t1042_rcw.cfg

Review

Quoted 13 lines

new file mode 100644
index 0000000..a3ea8ad

board/freescale/t104xrdb/t1042_rcw.cfg new file +7 -0
 <at>  <at>  -0,0 +1,7  <at>  <at> 
+#PBL preamble and RCW header
+aa55aa55 010e0100
+# serdes protocol 0x66
+0c18000e 0e000000 00000000 00000000
+06000002 00400002 e8106000 01000000
+00000000 00000000 00000000 00030810
+00000000 01fe0a06 00000000 00000000
(quoted diff) +0 -0

b/board/freescale/t104xrdb/t104x_pbi.cfg

Quoted 21 lines

new file mode 100644
index 0000000..7b9e9b0

board/freescale/t104xrdb/t104x_pbi.cfg new file +16 -0
 <at>  <at>  -0,0 +1,26  <at>  <at> 
+#PBI commands
+#Initialize CPC1
+09010000 00200400
+09138000 00000000
+091380c0 00000100
+#Configure CPC1 as 256KB SRAM
+09010100 00000000
+09010104 fffc0007
+09010f00 08000000
+09010000 80000000
+#Configure LAW for CPC1
+09000cd0 00000000
+09000cd4 fffc0000
+09000cd8 81000011
+#Configure alternate space
+09000010 00000000

board/freescale/t104xrdb/t104x_pbi.cfg line 26

Quoted 10 lines
board/freescale/t104xrdb/t104x_pbi.cfg new file +10 -0
+09000014 ff000000
+09000018 81000000
+#Configure SPI controller
+09110000 80000403
+09110020 2d170008
+09110024 00100008
+09110028 00100008
+0911002c 00100008
+#Flush PBL data
+091380c0 000FFFFF

That's a "Wait" command.
Unless the "Flush" was command (that is in most PBI files I've read, Flush/Wait pait) was inadvertantly deleted.

8>< snipped ><8

All the best,
Rommel

#2 lore raw

PATCH 10/10 board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB

Quoted 9 lines · Rommel G Custodio <sessyargc+u-boot <at> gmail.com> writes:

Dear Prabhakar Kushwaha,

Quoted 4 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:

Add support of 2 stage NAND, SD, SPI boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(160KB). This further initialise DDR using SPD and environment and copy u-boot(768 KB) from

NAND

Quoted 4 lines

to DDR.

Quoted 1 line

Finally SPL transer control to u-boot.

This patch does not apply to HEAD.

Arrggh ... guess I think I need this

[U-BOOT] [PATCH v3] powerpc/t104xrdb: Unification of T104xRDB header
files

Quoted 11 lines

[u-boot (X_2stage $)]$ pw_u.sh 335250

2014-04-01 07:11:13 URL:http://patchwork.ozlabs.org/patch/335250/mbox/ 

[23256] -> "pw-am-335250.patch" [1]
Applying: board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB
error: patch failed: boards.cfg:933
error: boards.cfg: patch does not apply
error: include/configs/T104xRDB.h: does not exist in index

More comments below.

8>< snipped ><8

All the best,
Rommel

#3 lore raw

PATCH 10/10 board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB

Quoted 9 lines · Rommel G Custodio
Quoted 7 lines · Rommel G Custodio <sessyargc+u-boot <at> gmail.com> writes:

Dear Prabhakar Kushwaha,

Quoted 3 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:

Add support of 2 stage NAND, SD, SPI boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(160KB). This further initialise DDR using SPD and environment and copy u-boot(768 KB) from

Quoted 9 lines

NAND

Quoted 3 lines

to DDR.

Quoted 1 line

Finally SPL transer control to u-boot.

This patch does not apply to HEAD.

Arrggh ... guess I think I need this

[U-BOOT] [PATCH v3] powerpc/t104xrdb: Unification of T104xRDB header
files

You may also need below patches in sequence

[U-Boot,U-BOOT,v3] powerpc/t104xrdb: Unification of T104xRDB header files [U-Boot] powerpc/mpc85xx:Add CONFIG_SYS_FSL_ERRATUM_ESDHC111 to Txx/Bxx [U-Boot,01/2] powerpc/mpc85xx:Avoid fix address of bootpg section [U-Boot,2/2] powerpc/mpc85xx:Update MONITOR_LEN
[U-Boot] driver/mmc: fix compile warnings

+ 2 stage boot loader patch set

Please let me know, if any other information is required.

Regards,
Prabhakar

#4 lore raw

PATCH 10/10 board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB

In reply to Rommel G Custodio
Quoted 26 lines · Rommel G Custodio

Dear Prabhakar Kushwaha,

Quoted 3 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:

Add support of 2 stage NAND, SD, SPI boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(160KB). This further initialise DDR using SPD and environment and copy u-boot(768 KB) from NAND

to DDR.

Quoted 1 line

Finally SPL transer control to u-boot.

This patch does not apply to HEAD.

[u-boot (X_2stage $)]$ pw_u.sh 335250

2014-04-01 07:11:13 URL:http://patchwork.ozlabs.org/patch/335250/mbox/

[23256] -> "pw-am-335250.patch" [1]
Applying: board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB
error: patch failed: boards.cfg:933
error: boards.cfg: patch does not apply
error: include/configs/T104xRDB.h: does not exist in index

More comments below.

8>< snipped ><8

Review

Quoted 1 line
(quoted diff) +0 -0

b/board/freescale/t104xrdb/t1040_rcw.cfg

Quoted 15 lines

board/freescale/t104xrdb/t1040_rcw.cfg line 5

Quoted 10 lines

new file mode 100644
index 0000000..3300c18

board/freescale/t104xrdb/t1040_rcw.cfg new file +5 -0
  <at>  <at>  -0,0 +1,7  <at>  <at>
+#PBL preamble and RCW header
+aa55aa55 010e0100
+# serdes protocol 0x66
+0c18000e 0e000000 00000000 00000000
+66000002 80000002 e8106000 01000000

e8106000
^^^^^^^^
Don't you need a separate RCW setting for SPI?
The previous patchset had a note about it.

You can change.
Generally switch has higher precedence over PBI_SRC in RCW.

Quoted 44 lines

Review

Quoted 3 lines

+00000000 00000000 00000000 00032810
+00000000 0342500f 00000000 00000000

(quoted diff) +0 -0

b/board/freescale/t104xrdb/t1042_rcw.cfg

Review

Quoted 13 lines

new file mode 100644
index 0000000..a3ea8ad

board/freescale/t104xrdb/t1042_rcw.cfg new file +7 -0
  <at>  <at>  -0,0 +1,7  <at>  <at>
+#PBL preamble and RCW header
+aa55aa55 010e0100
+# serdes protocol 0x66
+0c18000e 0e000000 00000000 00000000
+06000002 00400002 e8106000 01000000
+00000000 00000000 00000000 00030810
+00000000 01fe0a06 00000000 00000000
(quoted diff) +0 -0

b/board/freescale/t104xrdb/t104x_pbi.cfg

Quoted 26 lines

new file mode 100644
index 0000000..7b9e9b0

board/freescale/t104xrdb/t104x_pbi.cfg new file +21 -0
  <at>  <at>  -0,0 +1,26  <at>  <at>
+#PBI commands
+#Initialize CPC1
+09010000 00200400
+09138000 00000000
+091380c0 00000100
+#Configure CPC1 as 256KB SRAM
+09010100 00000000
+09010104 fffc0007
+09010f00 08000000
+09010000 80000000
+#Configure LAW for CPC1
+09000cd0 00000000
+09000cd4 fffc0000
+09000cd8 81000011
+#Configure alternate space
+09000010 00000000
+09000014 ff000000
+09000018 81000000
+#Configure SPI controller
+09110000 80000403
+09110020 2d170008
Quoted 9 lines
Quoted 5 lines

+09110024 00100008
+09110028 00100008
+0911002c 00100008
+#Flush PBL data
+091380c0 000FFFFF

That's a "Wait" command.
Unless the "Flush" was command (that is in most PBI files I've read, Flush/Wait pait) was inadvertantly deleted.

Flush command only work for CCSRBAR address space. It should not be used for CPC-SRAM.

This is the reason, it has been removed.

Regards,
Prabhakar

#5 lore raw

PATCH 10/10 board/t104xrdb: Add support of NAND, SD, SPI boot for T1040RDB

Dear Prabhakar Kushwaha,

Quoted 7 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:
Quoted 4 lines · Rommel G Custodio

Dear Prabhakar Kushwaha,

Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:

8>< snipped ><8

Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

+#Flush PBL data
+091380c0 000FFFFF

That's a "Wait" command.
Unless the "Flush" was command (that is in most PBI files I've read, Flush/Wait pait) was inadvertantly deleted.

Flush command only work for CCSRBAR address space. It should not be used for CPC-SRAM.

This is the reason, it has been removed.

Does this affect all mpc85xx cores?

I've noticed this same weird behavior on a T1040QDS.
A simple write to CPC-SRAM before a Flush command causes the LEDs to report an error.
i.e
89ffff00 4bfff004
09138000 00000000
091380c0 00000001

After putting the CPC-SRAM write after the Flush the write was successful (as verified by a BDI-3000).
i.e
09138000 00000000
091380c0 00000001
89ffff00 4bfff004
091380c0 00000001

BUT it seems this does not occur on the P5040DS. The P5040DS_SPIFLASH creates a u-boot that has Flush commands and it boots correctly. [local]$ xxd -g4 obj-P5040DS_SPIFLASH/u-boot.pbl
:

00cc0a0: ffffffff 81ffffc0 ffffffff ffffffff  ................
00cc0b0: ffffffff ffffffff ffffffff ffffffff  ................
00cc0c0: ffffffff ffffffff ffffffff ffffffff  ................
00cc0d0: ffffffff ffffffff ffffffff ffffffff  ................
00cc0e0: ffffffff 4bfff004 09138000 00000000  ....K...........
00cc0f0: 091380c0 00000000 08138040 aa69eb89  ........... at .i..

On another note, if this affects all mpc85xx cores then I guess tools/pblimage.c needs updating. The add_end_cmd() always adds a Flush command prior to a CRC check (CONT=0) command.

Quoted 4 lines

Regards,
Prabhakar

All the best,
Rommel