Skip to contentSkip to conversation

davinci: omapl138_lcdk: fix a few bugs for SPL boot

PATCH Superseded Fabien Parent 2 participants 10 messages Nov 22, 2016 – Nov 28, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover davinci: omapl138_lcdk: fix a few bugs for SPL boot

This patchset tries to fix the SPL on omapl138_lcdk. With this patchset, the SPL will be able to boot from EMMC/SPI.

The NAND support is still broken so the default u-boot.ais image still has a SPL that is unable to load u-boot.

Change v1 .. v2:
* Don't add an AIS config file but instead configure the PLL and DDR in the SPL. This follow what other boards are doing.
* Use new kconfig option to support EMMC boot.

#1 lore raw

PATCH v2 1/4 davinci: omapl138_lcdk: configure pll0

The SPL is not able to boot properly because the PLL0 is not configured. Configure it.

---

V1 -> V2
* New patch

---
 include/configs/omapl138_lcdk.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/omapl138_lcdk.h +1 -0
index 854fc47..ce3a8f4 100644
@@ -30,6 +30,7 @@
 #define CONFIG_SYS_TIMERBASE		DAVINCI_TIMER0_BASE
 #define CONFIG_SYS_HZ_CLOCK		clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ			1000
+#define CONFIG_SYS_DA850_PLL_INIT
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE		0xc1080000
 
Signature · 1 line
2.10.2
#2 lore raw

PATCH v2 1/4 davinci: omapl138_lcdk: configure pll0

Quoted 18 lines · Fabien Parent

The SPL is not able to boot properly because the PLL0 is not configured. Configure it.

---

V1 -> V2
* New patch

---
 include/configs/omapl138_lcdk.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/omapl138_lcdk.h +0 -0
index 854fc47..ce3a8f4 100644

include/configs/omapl138_lcdk.h line 35

Quoted 6 lines
include/configs/omapl138_lcdk.h +1 -0
@@ -30,6 +30,7 @@
 #define CONFIG_SYS_TIMERBASE		DAVINCI_TIMER0_BASE
 #define CONFIG_SYS_HZ_CLOCK		clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ			1000
+#define CONFIG_SYS_DA850_PLL_INIT
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE		0xc1080000

OK, but.. can you move this to Kconfig and migrate the small handful of platforms that use it? That'll be real good progress here, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161122/ecbab7e8/attachment.sig>
#3 lore raw

PATCH v2 2/4 davinci: omapl138_lcdk: configure ddr2

In reply to Fabien Parent

The SPL is unable to load u-boot because the DDR2 is not configured. Configure the DDR2.

---

V1 -> V2

* New patch

---
 include/configs/omapl138_lcdk.h | 42 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
include/configs/omapl138_lcdk.h +42 -0
index ce3a8f4..2cdf892 100644
@@ -31,6 +31,7 @@
 #define CONFIG_SYS_HZ_CLOCK		clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE		0xc1080000
 
@@ -80,6 +81,47 @@
 #define CONFIG_SYS_DA850_PLL1_PLLM     21
 
 /*
+ * DDR2 memory configuration
+ */
+#define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
+					DV_DDR_PHY_EXT_STRBEN | \
+					(0x5 << DV_DDR_PHY_RD_LATENCY_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDBCR (		  \
+	(1 << DV_DDR_SDCR_DDR2EN_SHIFT)		| \
+	(1 << DV_DDR_SDCR_DDREN_SHIFT)		| \
+	(1 << DV_DDR_SDCR_SDRAMEN_SHIFT)	| \
+	(1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT)	| \
+	(4 << DV_DDR_SDCR_CL_SHIFT)		| \
+	(3 << DV_DDR_SDCR_IBANK_SHIFT)		| \
+	(2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
+
+/* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
+#define CONFIG_SYS_DA850_DDR2_SDBCR2 0
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR (		  \
+	(19 << DV_DDR_SDTMR1_RFC_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_RP_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_RCD_SHIFT)		| \
+	(2 << DV_DDR_SDTMR1_WR_SHIFT)		| \
+	(6 << DV_DDR_SDTMR1_RAS_SHIFT)		| \
+	(8 << DV_DDR_SDTMR1_RC_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_RRD_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_WTR_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR2 (		  \
+	(7 << DV_DDR_SDTMR2_RASMAX_SHIFT)	| \
+	(2 << DV_DDR_SDTMR2_XP_SHIFT)		| \
+	(0 << DV_DDR_SDTMR2_ODT_SHIFT)		| \
+	(10 << DV_DDR_SDTMR2_XSNR_SHIFT)	| \
+	(199 << DV_DDR_SDTMR2_XSRD_SHIFT)	| \
+	(1 << DV_DDR_SDTMR2_RTP_SHIFT)		| \
+	(2 << DV_DDR_SDTMR2_CKE_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDRCR    0x00000492
+#define CONFIG_SYS_DA850_DDR2_PBBPR    0x30
+
+/*
  * Serial Driver info
  */
 #define CONFIG_SYS_NS16550_SERIAL
Signature · 1 line
2.10.2
#4 lore raw

PATCH v2 2/4 davinci: omapl138_lcdk: configure ddr2

Quoted 19 lines · Fabien Parent

The SPL is unable to load u-boot because the DDR2 is not configured. Configure the DDR2.

---

V1 -> V2

* New patch

---
 include/configs/omapl138_lcdk.h | 42 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
include/configs/omapl138_lcdk.h +0 -0
index ce3a8f4..2cdf892 100644

include/configs/omapl138_lcdk.h line 36

Quoted 6 lines
include/configs/omapl138_lcdk.h +1 -0
@@ -31,6 +31,7 @@
 #define CONFIG_SYS_HZ_CLOCK		clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE		0xc1080000

This would be "easy" to move to Kconfig, so please do.

Quoted 33 lines
include/configs/omapl138_lcdk.h +29 -0
@@ -80,6 +81,47 @@
 #define CONFIG_SYS_DA850_PLL1_PLLM     21
 
 /*
+ * DDR2 memory configuration
+ */
+#define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
+					DV_DDR_PHY_EXT_STRBEN | \
+					(0x5 << DV_DDR_PHY_RD_LATENCY_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDBCR (		  \
+	(1 << DV_DDR_SDCR_DDR2EN_SHIFT)		| \
+	(1 << DV_DDR_SDCR_DDREN_SHIFT)		| \
+	(1 << DV_DDR_SDCR_SDRAMEN_SHIFT)	| \
+	(1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT)	| \
+	(4 << DV_DDR_SDCR_CL_SHIFT)		| \
+	(3 << DV_DDR_SDCR_IBANK_SHIFT)		| \
+	(2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
+
+/* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
+#define CONFIG_SYS_DA850_DDR2_SDBCR2 0
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR (		  \
+	(19 << DV_DDR_SDTMR1_RFC_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_RP_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_RCD_SHIFT)		| \
+	(2 << DV_DDR_SDTMR1_WR_SHIFT)		| \
+	(6 << DV_DDR_SDTMR1_RAS_SHIFT)		| \
+	(8 << DV_DDR_SDTMR1_RC_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_RRD_SHIFT)		| \
+	(1 << DV_DDR_SDTMR1_WTR_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR2 (		  \

include/configs/omapl138_lcdk.h line 122

Quoted 10 lines
include/configs/omapl138_lcdk.h +10 -0
+	(7 << DV_DDR_SDTMR2_RASMAX_SHIFT)	| \
+	(2 << DV_DDR_SDTMR2_XP_SHIFT)		| \
+	(0 << DV_DDR_SDTMR2_ODT_SHIFT)		| \
+	(10 << DV_DDR_SDTMR2_XSNR_SHIFT)	| \
+	(199 << DV_DDR_SDTMR2_XSRD_SHIFT)	| \
+	(1 << DV_DDR_SDTMR2_RTP_SHIFT)		| \
+	(2 << DV_DDR_SDTMR2_CKE_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDRCR    0x00000492
+#define CONFIG_SYS_DA850_DDR2_PBBPR    0x30

This is a little harder. I think this should be done more like arch/arm/include/asm/arch-omap3/mem.h:#define where we name-space the values that we construct based on the part (maker and size/speed). Do you have time to look into this migration? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161122/541d0f1c/attachment.sig>
#5 lore raw

PATCH v2 2/4 davinci: omapl138_lcdk: configure ddr2

Quoted 70 lines · Tom Rini
Quoted 19 lines · Fabien Parent

The SPL is unable to load u-boot because the DDR2 is not configured. Configure the DDR2.

---

V1 -> V2

* New patch

---
 include/configs/omapl138_lcdk.h | 42 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
include/configs/omapl138_lcdk.h +0 -0
index ce3a8f4..2cdf892 100644

include/configs/omapl138_lcdk.h line 36

Quoted 6 lines
include/configs/omapl138_lcdk.h +1 -0
@@ -31,6 +31,7 @@
 #define CONFIG_SYS_HZ_CLOCK          clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ                        1000
 #define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE         0xc1080000

This would be "easy" to move to Kconfig, so please do.

Quoted 40 lines
include/configs/omapl138_lcdk.h +36 -0
@@ -80,6 +81,47 @@
 #define CONFIG_SYS_DA850_PLL1_PLLM     21
 
 /*
+ * DDR2 memory configuration
+ */
+#define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
+                                     DV_DDR_PHY_EXT_STRBEN | \
+                                     (0x5 << DV_DDR_PHY_RD_LATENCY_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDBCR (                  \
+     (1 << DV_DDR_SDCR_DDR2EN_SHIFT)         | \
+     (1 << DV_DDR_SDCR_DDREN_SHIFT)          | \
+     (1 << DV_DDR_SDCR_SDRAMEN_SHIFT)        | \
+     (1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT)      | \
+     (4 << DV_DDR_SDCR_CL_SHIFT)             | \
+     (3 << DV_DDR_SDCR_IBANK_SHIFT)          | \
+     (2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
+
+/* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
+#define CONFIG_SYS_DA850_DDR2_SDBCR2 0
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR (                 \
+     (19 << DV_DDR_SDTMR1_RFC_SHIFT)         | \
+     (1 << DV_DDR_SDTMR1_RP_SHIFT)           | \
+     (1 << DV_DDR_SDTMR1_RCD_SHIFT)          | \
+     (2 << DV_DDR_SDTMR1_WR_SHIFT)           | \
+     (6 << DV_DDR_SDTMR1_RAS_SHIFT)          | \
+     (8 << DV_DDR_SDTMR1_RC_SHIFT)           | \
+     (1 << DV_DDR_SDTMR1_RRD_SHIFT)          | \
+     (1 << DV_DDR_SDTMR1_WTR_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR2 (                \
+     (7 << DV_DDR_SDTMR2_RASMAX_SHIFT)       | \
+     (2 << DV_DDR_SDTMR2_XP_SHIFT)           | \
+     (0 << DV_DDR_SDTMR2_ODT_SHIFT)          | \
+     (10 << DV_DDR_SDTMR2_XSNR_SHIFT)        | \
+     (199 << DV_DDR_SDTMR2_XSRD_SHIFT)       | \
+     (1 << DV_DDR_SDTMR2_RTP_SHIFT)          | \
+     (2 << DV_DDR_SDTMR2_CKE_SHIFT))
Quoted 8 lines

include/configs/omapl138_lcdk.h line 122

Quoted 3 lines
include/configs/omapl138_lcdk.h +3 -0
+
+#define CONFIG_SYS_DA850_DDR2_SDRCR    0x00000492
+#define CONFIG_SYS_DA850_DDR2_PBBPR    0x30

This is a little harder. I think this should be done more like arch/arm/include/asm/arch-omap3/mem.h:#define where we name-space the values that we construct based on the part (maker and size/speed). Do you have time to look into this migration? Thanks!

Given that I don't have a lot of time right now, in the v3 I will just move CONFIG_SYS_DA850_DDR_INIT to Kconfig and keep all the config in the header file and at a later time once my current work on OMAPl138-LCDK is over I will sent a new patchset for all the CONFIG_SYS_DA85_DDR* options.

Quoted 3 lines

--
Tom

#6 lore raw

PATCH v2 2/4 davinci: omapl138_lcdk: configure ddr2

Quoted 80 lines · Fabien Parent
Quoted 70 lines · Tom Rini
Quoted 19 lines · Fabien Parent

The SPL is unable to load u-boot because the DDR2 is not configured. Configure the DDR2.

---

V1 -> V2

* New patch

---
 include/configs/omapl138_lcdk.h | 42 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
include/configs/omapl138_lcdk.h +0 -0
index ce3a8f4..2cdf892 100644

include/configs/omapl138_lcdk.h line 36

Quoted 6 lines
include/configs/omapl138_lcdk.h +1 -0
@@ -31,6 +31,7 @@
 #define CONFIG_SYS_HZ_CLOCK          clk_get(DAVINCI_AUXCLK_CLKID)
 #define CONFIG_SYS_HZ                        1000
 #define CONFIG_SYS_DA850_PLL_INIT
+#define CONFIG_SYS_DA850_DDR_INIT
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE         0xc1080000

This would be "easy" to move to Kconfig, so please do.

Quoted 40 lines
include/configs/omapl138_lcdk.h +36 -0
@@ -80,6 +81,47 @@
 #define CONFIG_SYS_DA850_PLL1_PLLM     21
 
 /*
+ * DDR2 memory configuration
+ */
+#define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
+                                     DV_DDR_PHY_EXT_STRBEN | \
+                                     (0x5 << DV_DDR_PHY_RD_LATENCY_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDBCR (                  \
+     (1 << DV_DDR_SDCR_DDR2EN_SHIFT)         | \
+     (1 << DV_DDR_SDCR_DDREN_SHIFT)          | \
+     (1 << DV_DDR_SDCR_SDRAMEN_SHIFT)        | \
+     (1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT)      | \
+     (4 << DV_DDR_SDCR_CL_SHIFT)             | \
+     (3 << DV_DDR_SDCR_IBANK_SHIFT)          | \
+     (2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
+
+/* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
+#define CONFIG_SYS_DA850_DDR2_SDBCR2 0
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR (                 \
+     (19 << DV_DDR_SDTMR1_RFC_SHIFT)         | \
+     (1 << DV_DDR_SDTMR1_RP_SHIFT)           | \
+     (1 << DV_DDR_SDTMR1_RCD_SHIFT)          | \
+     (2 << DV_DDR_SDTMR1_WR_SHIFT)           | \
+     (6 << DV_DDR_SDTMR1_RAS_SHIFT)          | \
+     (8 << DV_DDR_SDTMR1_RC_SHIFT)           | \
+     (1 << DV_DDR_SDTMR1_RRD_SHIFT)          | \
+     (1 << DV_DDR_SDTMR1_WTR_SHIFT))
+
+#define CONFIG_SYS_DA850_DDR2_SDTIMR2 (                \
+     (7 << DV_DDR_SDTMR2_RASMAX_SHIFT)       | \
+     (2 << DV_DDR_SDTMR2_XP_SHIFT)           | \
+     (0 << DV_DDR_SDTMR2_ODT_SHIFT)          | \
+     (10 << DV_DDR_SDTMR2_XSNR_SHIFT)        | \
+     (199 << DV_DDR_SDTMR2_XSRD_SHIFT)       | \
+     (1 << DV_DDR_SDTMR2_RTP_SHIFT)          | \
+     (2 << DV_DDR_SDTMR2_CKE_SHIFT))
Quoted 8 lines

include/configs/omapl138_lcdk.h line 122

Quoted 3 lines
include/configs/omapl138_lcdk.h +3 -0
+
+#define CONFIG_SYS_DA850_DDR2_SDRCR    0x00000492
+#define CONFIG_SYS_DA850_DDR2_PBBPR    0x30

This is a little harder. I think this should be done more like arch/arm/include/asm/arch-omap3/mem.h:#define where we name-space the values that we construct based on the part (maker and size/speed). Do you have time to look into this migration? Thanks!

Quoted 5 lines

Given that I don't have a lot of time right now, in the v3 I will just move CONFIG_SYS_DA850_DDR_INIT to Kconfig and keep all the config in the header file and at a later time once my current work on OMAPl138-LCDK is over I will sent a new patchset for all the CONFIG_SYS_DA85_DDR* options.

OK, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161128/3a30b336/attachment.sig>
#7 lore raw

PATCH v2 3/4 davinci: da850evm: fix empty boot method list in the SPL

In reply to Fabien Parent

The list of available boot method is not part of the binary which prevent the SPL from booting u-boot or Linux.

Add the missing .u_boot_list* sections to the binary to fix it.

---

v1 -> v2:

* No change

---
 board/davinci/da8xxevm/u-boot-spl-da850evm.lds | 3 +++
 1 file changed, 3 insertions(+)
board/davinci/da8xxevm/u-boot-spl-da850evm.lds +3 -0
index ab4f50c..85a6be9 100644
@@ -34,6 +34,9 @@ SECTIONS
 	.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
 
 	. = ALIGN(4);
+	.u_boot_list : { KEEP(*(SORT(.u_boot_list*))); } >.sram
+
+	. = ALIGN(4);
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
Signature · 1 line
2.10.2
#8 lore raw

PATCH v2 4/4 davinci: omapl138_lcdk: add u-boot sector for mmc/sd boot

In reply to Fabien Parent

Set the correct CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR value in order to be able to boot from MMC/SD.

The SPL is stored at sector 0x75, while u-boot will follow at sector 0xb5.

---

v1 -> v2

* Rebased on Sam's patches, i.e. use new Kconfig option instead of setting the value inside the config header file

---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/omapl138_lcdk_defconfig +1 -0
index bcd1acb..4a5f435 100644
@@ -9,6 +9,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot > "
 # CONFIG_CMD_IMLS is not set
Signature · 1 line
2.10.2
#9 lore raw

PATCH v2 4/4 davinci: omapl138_lcdk: add u-boot sector for mmc/sd boot

Quoted 7 lines · Fabien Parent

Set the correct CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR value in order to be able to boot from MMC/SD.

The SPL is stored at sector 0x75, while u-boot will follow at sector 0xb5.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161122/68d83305/attachment.sig>