Skip to contentSkip to conversation

ARMv8/FSL_LSCH2: Add FSL_LSCH2 SoC

PATCH New Gong Qianyu 2 participants 15 messages Sep 11, 2015 – Sep 18, 2015

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 7/14 ARMv8/FSL_LSCH2: Add FSL_LSCH2 SoC

From: Mingkai Hu <[email protected]>

Freescale LayerScape with Chassis Generation 2 is a set of SoCs with ARMv8 cores and 2rd generation of Chassis.

---
 arch/arm/cpu/armv8/Makefile                       |   1 +
 arch/arm/cpu/armv8/fsl-lsch2/Makefile             |  12 +
 arch/arm/cpu/armv8/fsl-lsch2/README               |  10 +
 arch/arm/cpu/armv8/fsl-lsch2/cpu.c                | 414 ++++++++++++++++++
 arch/arm/cpu/armv8/fsl-lsch2/fdt.c                |  13 +
 arch/arm/cpu/armv8/fsl-lsch2/fsl_lsch2_serdes.c   | 116 +++++
 arch/arm/cpu/armv8/fsl-lsch2/lowlevel.S           | 122 ++++++
 arch/arm/cpu/armv8/fsl-lsch2/ls1043a_serdes.c     |  86 ++++
 arch/arm/cpu/armv8/fsl-lsch2/soc.c                |  36 ++
 arch/arm/cpu/armv8/fsl-lsch2/speed.c              | 137 ++++++
 arch/arm/cpu/armv8/fsl-lsch2/speed.h              |   7 +
 arch/arm/include/asm/arch-fsl-lsch2/clock.h       |  24 ++
 arch/arm/include/asm/arch-fsl-lsch2/config.h      | 148 +++++++
 arch/arm/include/asm/arch-fsl-lsch2/fsl_serdes.h  | 105 +++++
 arch/arm/include/asm/arch-fsl-lsch2/gpio.h        |   9 +
 arch/arm/include/asm/arch-fsl-lsch2/immap_lsch2.h | 499 ++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/imx-regs.h    |  52 +++
 arch/arm/include/asm/arch-fsl-lsch2/mmu.h         |  10 +
 arch/arm/include/asm/arch-fsl-lsch2/ns_access.h   | 179 ++++++++
 arch/arm/include/asm/arch-fsl-lsch2/soc.h         |   7 +
 arch/arm/include/asm/arch-fsl-lsch2/spl.h         |  20 +
 arch/arm/include/asm/armv8/mmu.h                  |   1 +
 arch/arm/include/asm/config.h                     |   3 +
 include/common.h                                  |   3 +
 24 files changed, 2014 insertions(+)
arch/arm/cpu/armv8/Makefile +1 -0
index adb11b3..eee8344 100644
@@ -15,6 +15,7 @@ obj-y	+= cache.o
 obj-y	+= tlb.o
 obj-y	+= transition.o
 
+obj-$(CONFIG_FSL_LSCH2) += fsl-lsch2/
 obj-$(CONFIG_FSL_LSCH3) += fsl-lsch3/
 obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/
 obj-$(CONFIG_TARGET_HIKEY) += hisilicon/
arch/arm/cpu/armv8/fsl-lsch2/Makefile new file +12 -0
new file mode 100644
index 0000000..23c5bf9
@@ -0,0 +1,12 @@
+#
+# Copyright 2014, Freescale Semiconductor
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += cpu.o
+obj-y += soc.o
+obj-y += lowlevel.o
+obj-y += speed.o
+obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o ls1043a_serdes.o
+obj-$(CONFIG_OF_LIBFDT) += fdt.o
arch/arm/cpu/armv8/fsl-lsch2/README new file +10 -0
new file mode 100644
index 0000000..1e71ad7
@@ -0,0 +1,10 @@
+#
+# Copyright 2014 Freescale Semiconductor
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+Freescale LayerScape with Chassis Generation 2
+
+This architecture supports Freescale ARMv8 SoCs with Chassis generation 2,
+for example LS1043A.
arch/arm/cpu/armv8/fsl-lsch2/cpu.c new file +414 -0

414 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-lsch2/fdt.c new file +13 -0
new file mode 100644
index 0000000..b4af812
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+
+void ft_cpu_setup(void *blob, bd_t *bd)
+{
+}
arch/arm/cpu/armv8/fsl-lsch2/fsl_lsch2_serdes.c new file +116 -0

116 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-lsch2/lowlevel.S new file +122 -0

122 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-lsch2/ls1043a_serdes.c new file +86 -0

86 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-lsch2/soc.c new file +36 -0
new file mode 100644
index 0000000..8f010ae
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2015 Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <fsl_ifc.h>
+#include <asm/arch-fsl-lsch2/soc.h>
+#include <asm/io.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void fsl_lsch2_early_init_f(void)
+{
+	struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
+
+#ifdef CONFIG_FSL_IFC
+	init_early_memctl_regs();	/* tighten IFC timing */
+#endif
+
+	/*
+	 * Enable snoop requests and DVM message requests for
+	 * Slave insterface S4 (A53 core cluster)
+	 */
+	out_le32(&cci->slave[4].snoop_ctrl,
+		 CCI400_DVM_MESSAGE_REQ_EN | CCI400_SNOOP_REQ_EN);
+}
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	return 0;
+}
+#endif
arch/arm/cpu/armv8/fsl-lsch2/speed.c new file +137 -0

137 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-lsch2/speed.h new file +7 -0
new file mode 100644
index 0000000..15af5b9
@@ -0,0 +1,7 @@
+/*
+ * Copyright 2014, Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+void get_sys_info(struct sys_info *sys_info);
arch/arm/include/asm/arch-fsl-lsch2/clock.h new file +24 -0
new file mode 100644
index 0000000..9aaf87c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ */
+
+#ifndef __ASM_ARCH_FSL_LSCH2_CLOCK_H_
+#define __ASM_ARCH_FSL_LSCH2_CLOCK_H_
+
+#include <common.h>
+
+enum mxc_clock {
+	MXC_ARM_CLK = 0,
+	MXC_BUS_CLK,
+	MXC_UART_CLK,
+	MXC_ESDHC_CLK,
+	MXC_I2C_CLK,
+	MXC_DSPI_CLK,
+};
+
+unsigned int mxc_get_clock(enum mxc_clock clk);
+
+#endif /* __ASM_ARCH_FSL_LSCH2_CLOCK_H_ */
arch/arm/include/asm/arch-fsl-lsch2/config.h new file +148 -0

148 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-lsch2/fsl_serdes.h new file +105 -0

105 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-lsch2/gpio.h new file +9 -0
new file mode 100644
index 0000000..ff03e5a
@@ -0,0 +1,9 @@
+/*
+ * (C) Copyright 2014, Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ASM_ARMV8_FSL_LSCH2_GPIO_H_
+#define _ASM_ARMV8_FSL_LSCH2_GPIO_H_
+#endif	/* _ASM_ARMV8_FSL_LSCH2_GPIO_H_ */
arch/arm/include/asm/arch-fsl-lsch2/immap_lsch2.h new file +499 -0

499 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-lsch2/imx-regs.h new file +52 -0

52 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-lsch2/mmu.h new file +10 -0
new file mode 100644
index 0000000..e28344c
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2014, Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ASM_ARMV8_FSL_LSCH2_MMU_H_
+#define _ASM_ARMV8_FSL_LSCH2_MMU_H_
+#include <asm/arch-armv8/mmu.h>
+#endif /* _ASM_ARMV8_FSL_LSCH2_MMU_H_ */
arch/arm/include/asm/arch-fsl-lsch2/ns_access.h new file +179 -0

179 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-lsch2/soc.h new file +7 -0
new file mode 100644
index 0000000..73f7de5
@@ -0,0 +1,7 @@
+/*
+ * Copyright 2015 Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+void fsl_lsch2_early_init_f(void);
arch/arm/include/asm/arch-fsl-lsch2/spl.h new file +20 -0
new file mode 100644
index 0000000..356a338
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_SPL_H__
+#define __ASM_ARCH_SPL_H__
+
+#define BOOT_DEVICE_NONE	0
+#define BOOT_DEVICE_XIP         1
+#define BOOT_DEVICE_XIPWAIT     2
+#define BOOT_DEVICE_NAND	3
+#define BOOT_DEVICE_ONENAND	4
+#define BOOT_DEVICE_MMC1	5
+#define BOOT_DEVICE_MMC2	6
+#define BOOT_DEVICE_MMC2_2	7
+#define BOOT_DEVICE_SPI		10
+
+#endif	/* __ASM_ARCH_SPL_H__ */
arch/arm/include/asm/armv8/mmu.h +1 -0
index 0c928d4..50e3a83 100644
@@ -65,6 +65,7 @@
 /*
  * Section
  */
+#define PMD_SECT_NS		(1 << 5)
 #define PMD_SECT_NON_SHARE	(0 << 8)
 #define PMD_SECT_OUTER_SHARE	(2 << 8)
 #define PMD_SECT_INNER_SHARE	(3 << 8)
arch/arm/include/asm/config.h +3 -0
index 22fff02..bca9814 100644
@@ -18,6 +18,9 @@
 #ifdef CONFIG_FSL_LSCH3
 #include <asm/arch-fsl-lsch3/config.h>
 #endif
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch-fsl-lsch2/config.h>
+#endif
 
 #if defined(CONFIG_LS102XA) || \
 	defined(CONFIG_CPU_PXA27X) || \
include/common.h +3 -0
index c12f402..6d92988 100644
@@ -76,6 +76,9 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_SOC_DA8XX
 #include <asm/arch/hardware.h>
 #endif
+#ifdef CONFIG_LS1043A
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH 8/14 ARMv8/ls1043ardb: Add LS1043ARDB board support

From: Mingkai Hu <[email protected]>

LS1043ARDB Specification:
-------------------------
Memory subsystem:
* 2GByte DDR4 SDRAM (32bit but)
* 128 Mbyte NOR flash single-chip memory
* 512 Mbyte NAND flash
* 16 Mbyte high-speed SPI memory
* SD connector to interface with the SD memory card

Ethernet:
* XFI 10G port
* QSGMII with 4x 1G ports
* Two RGMII ports

PCIe:
* PCIe2 (Lanes C) to mini-PCIe slot
* PCIe3 (Lanes D) to PCIe slot

USB 3.0: two super speed USB 3.0 type A ports

UART: supports two UARTs up to 115200 bps for console

---
 arch/arm/Kconfig                        |   8 ++
 board/freescale/ls1043ardb/Kconfig      |  16 +++
 board/freescale/ls1043ardb/MAINTAINERS  |   7 ++
 board/freescale/ls1043ardb/Makefile     |   9 ++
 board/freescale/ls1043ardb/README       |  87 +++++++++++++++
 board/freescale/ls1043ardb/cpld.c       | 115 +++++++++++++++++++
 board/freescale/ls1043ardb/cpld.h       |  43 +++++++
 board/freescale/ls1043ardb/ddr.c        | 190 +++++++++++++++++++++++++++++++
 board/freescale/ls1043ardb/ddr.h        |  45 ++++++++
 board/freescale/ls1043ardb/ls1043ardb.c | 134 ++++++++++++++++++++++
 configs/ls1043ardb_defconfig            |   3 +
 drivers/i2c/mxc_i2c.c                   |   2 +-
 include/configs/ls1043a_common.h        | 131 ++++++++++++++++++++++
 include/configs/ls1043ardb.h            | 191 ++++++++++++++++++++++++++++++++
 14 files changed, 980 insertions(+), 1 deletion(-)
arch/arm/Kconfig +8 -0
index 8085a24..f935f19 100644
@@ -662,6 +662,13 @@ config TARGET_LS1021ATWR
 	select CPU_V7
 	select SUPPORT_SPL
 
+config TARGET_LS1043ARDB
+	bool "Support ls1043ardb"
+	select ARM64
+	select SUPPORT_SPL
+	help
+	  Support for Freescale LS1043ARDB platform.
+
 config TARGET_BALLOON3
 	bool "Support balloon3"
 	select CPU_PXA
@@ -827,6 +834,7 @@ source "board/freescale/ls2085aqds/Kconfig"
 source "board/freescale/ls2085ardb/Kconfig"
 source "board/freescale/ls1021aqds/Kconfig"
 source "board/freescale/ls1021atwr/Kconfig"
+source "board/freescale/ls1043ardb/Kconfig"
 source "board/freescale/mx23evk/Kconfig"
 source "board/freescale/mx25pdk/Kconfig"
 source "board/freescale/mx28evk/Kconfig"
board/freescale/ls1043ardb/Kconfig new file +16 -0
new file mode 100644
index 0000000..eb6a12a
@@ -0,0 +1,16 @@
+
+if TARGET_LS1043ARDB
+
+config SYS_BOARD
+	default "ls1043ardb"
+
+config SYS_VENDOR
+	default "freescale"
+
+config SYS_SOC
+	default "fsl-lsch2"
+
+config SYS_CONFIG_NAME
+	default "ls1043ardb"
+
+endif
board/freescale/ls1043ardb/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000..b8f6be2
@@ -0,0 +1,7 @@
+LS1043A BOARD
+M:	Mingkai Hu <[email protected]>
+S:	Maintained
+F:	board/freescale/ls1043ardb/
+F:	board/freescale/ls1043ardb/ls1043ardb.c
+F:	include/configs/ls1043ardb.h
+F:	configs/ls1043ardb_defconfig
board/freescale/ls1043ardb/Makefile new file +9 -0
new file mode 100644
index 0000000..dd17e2e
@@ -0,0 +1,9 @@
+#
+# Copyright 2015 Freescale Semiconductor
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += cpld.o
+obj-y += ddr.o
+obj-y += ls1043ardb.o
board/freescale/ls1043ardb/README new file +87 -0

87 lines not on this page · raw message

board/freescale/ls1043ardb/cpld.c new file +115 -0

115 lines not on this page · raw message

board/freescale/ls1043ardb/cpld.h new file +43 -0

43 lines not on this page · raw message

board/freescale/ls1043ardb/ddr.c new file +190 -0

190 lines not on this page · raw message

board/freescale/ls1043ardb/ddr.h new file +45 -0

45 lines not on this page · raw message

board/freescale/ls1043ardb/ls1043ardb.c new file +134 -0

134 lines not on this page · raw message

configs/ls1043ardb_defconfig new file +3 -0
new file mode 100644
index 0000000..62a96aa
@@ -0,0 +1,3 @@
+CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4"
+CONFIG_ARM=y
+CONFIG_TARGET_LS1043ARDB=y
drivers/i2c/mxc_i2c.c +1 -1
index f1056e2..2c84847 100644
@@ -524,7 +524,7 @@ static int bus_i2c_write(struct mxc_i2c_bus *i2c_bus, u8 chip, u32 addr,
 
 static struct mxc_i2c_bus mxc_i2c_buses[] = {
 #if defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LSCH3) || \
-		defined(CONFIG_VF610)
+		defined(CONFIG_VF610) || defined(CONFIG_FSL_LSCH2)
 	{ 0, I2C1_BASE_ADDR, I2C_QUIRK_FLAG },
 	{ 1, I2C2_BASE_ADDR, I2C_QUIRK_FLAG },
 	{ 2, I2C3_BASE_ADDR, I2C_QUIRK_FLAG },
include/configs/ls1043a_common.h new file +131 -0

131 lines not on this page · raw message

include/configs/ls1043ardb.h new file +191 -0

191 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324
#2 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

In reply to Gong Qianyu
---
 arch/arm/Kconfig                                   |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91 ++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31 ++++++++
 include/configs/ls1043ardb.h                       | 40 ++++++++++
 9 files changed, 191 insertions(+)
arch/arm/Kconfig +1 -0
index f935f19..197c72d 100644
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP
 config TARGET_VEXPRESS64_JUNO
 	bool "Support Versatile Express Juno Development Platform"
 	select ARM64
+	select SUPPORT_SPL
 
 config TARGET_LS2085A_EMU
 	bool "Support ls2085a_emu"
arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
index 23c5bf9..0573659 100644
@@ -10,3 +10,4 @@ obj-y += lowlevel.o
 obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o ls1043a_serdes.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
+obj-$(CONFIG_SPL) += spl.o
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +91 -0

91 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-lsch2/config.h +2 -0
index 2125161..d0e4ba8 100644
@@ -15,6 +15,8 @@
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_FSL_OCRAM_BASE + 0xfff0)
 
 #define CONFIG_SYS_IMMR				0x01000000
+#define CONFIG_SYS_DCSRBAR			0x20000000
+#define CONFIG_SYS_DCSR_DCFG_ADDR	(CONFIG_SYS_DCSRBAR + 0x00220000)
 
 #define CONFIG_SYS_FSL_DDR_ADDR			(CONFIG_SYS_IMMR + 0x00080000)
 #define CONFIG_SYS_CCI400_ADDR			(CONFIG_SYS_IMMR + 0x00180000)
board/freescale/ls1043ardb/ls1043ardb_pbi.cfg new file +14 -0
new file mode 100644
index 0000000..f072274
@@ -0,0 +1,14 @@
+#Configure Scratch register
+09570600 00000000
+09570604 10000000
+#Alt base register
+09570158 00001000
+#Disable CCI barrier tranaction
+09570178 0000e010
+09180000 00000008
+#USB PHY frequency sel
+09570418 0000009e
+0957041c 0000009e
+09570420 0000009e
+#flush PBI data
+096100c0 000fffff
board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg new file +7 -0
new file mode 100644
index 0000000..935ffc0
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+aa55aa55 01ee0100
+# serdes protocol
+0810000f 0c000000 00000000 00000000
+14550002 80004012 e0106000 61002000
+00000000 00000000 00000000 00038800
+00000000 00001100 00000096 00000001
configs/ls1043ardb_nand_defconfig new file +4 -0
new file mode 100644
index 0000000..fffaca0
@@ -0,0 +1,4 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,NAND_BOOT,SYS_FSL_DDR4"
+CONFIG_ARM=y
+CONFIG_TARGET_LS1043ARDB=y
include/configs/ls1043a_common.h +31 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
 
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
+#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE		0x10000000
+#define CONFIG_SPL_MAX_SIZE		0x1a000
+#define CONFIG_SPL_STACK		0x1001d000
+#define CONFIG_SPL_PAD_TO		0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE	(600 << 10)
+#define CONFIG_SYS_NAND_U_BOOT_OFFS	CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE	2048
+#define CONFIG_SYS_NAND_U_BOOT_DST	CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_SPL_MALLOC_START	0x80200000
+#define CONFIG_SPL_BSS_START_ADDR	0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE		0x80000
+#define CONFIG_SYS_MONITOR_LEN		0xa0000
+#endif
+
 /* IFC */
 #define CONFIG_FSL_IFC
 /*
include/configs/ls1043ardb.h +40 -0
index 1f66201..5e6e09d 100644
@@ -12,7 +12,11 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
+#if defined(CONFIG_NAND_BOOT)
+#define CONFIG_SYS_TEXT_BASE		0x82000000
+#else
 #define CONFIG_SYS_TEXT_BASE		0x60100000
+#endif
 
 #define CONFIG_SYS_CLK_FREQ		100000000
 #define CONFIG_DDR_CLK_FREQ		100000000
@@ -33,6 +37,14 @@
 #define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
 #define CONFIG_MEM_INIT_VALUE           0xdeadbeef
 
+#ifdef CONFIG_RAMBOOT_PBL
+#define CONFIG_SYS_FSL_PBL_PBI board/freescale/ls1043ardb/ls1043ardb_pbi.cfg
+#endif
+
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SYS_FSL_PBL_RCW board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg
+#endif
+
 /*
  * NOR Flash Definitions
  */
@@ -144,6 +156,25 @@
 #define CONFIG_SYS_CPLD_FTIM3		0x0
 
 /* IFC Timing Params */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SYS_CSPR0_EXT		CONFIG_SYS_NAND_CSPR_EXT
+#define CONFIG_SYS_CSPR0		CONFIG_SYS_NAND_CSPR
+#define CONFIG_SYS_AMASK0		CONFIG_SYS_NAND_AMASK
+#define CONFIG_SYS_CSOR0		CONFIG_SYS_NAND_CSOR
+#define CONFIG_SYS_CS0_FTIM0		CONFIG_SYS_NAND_FTIM0
+#define CONFIG_SYS_CS0_FTIM1		CONFIG_SYS_NAND_FTIM1
+#define CONFIG_SYS_CS0_FTIM2		CONFIG_SYS_NAND_FTIM2
+#define CONFIG_SYS_CS0_FTIM3		CONFIG_SYS_NAND_FTIM3
+
+#define CONFIG_SYS_CSPR1_EXT		CONFIG_SYS_NOR_CSPR_EXT
+#define CONFIG_SYS_CSPR1		CONFIG_SYS_NOR_CSPR
+#define CONFIG_SYS_AMASK1		CONFIG_SYS_NOR_AMASK
+#define CONFIG_SYS_CSOR1		CONFIG_SYS_NOR_CSOR
+#define CONFIG_SYS_CS1_FTIM0		CONFIG_SYS_NOR_FTIM0
+#define CONFIG_SYS_CS1_FTIM1		CONFIG_SYS_NOR_FTIM1
+#define CONFIG_SYS_CS1_FTIM2		CONFIG_SYS_NOR_FTIM2
+#define CONFIG_SYS_CS1_FTIM3		CONFIG_SYS_NOR_FTIM3
+#else
 #define CONFIG_SYS_CSPR0_EXT		CONFIG_SYS_NOR_CSPR_EXT
 #define CONFIG_SYS_CSPR0		CONFIG_SYS_NOR_CSPR
 #define CONFIG_SYS_AMASK0		CONFIG_SYS_NOR_AMASK
@@ -161,6 +192,7 @@
 #define CONFIG_SYS_CS1_FTIM1		CONFIG_SYS_NAND_FTIM1
 #define CONFIG_SYS_CS1_FTIM2		CONFIG_SYS_NAND_FTIM2
 #define CONFIG_SYS_CS1_FTIM3		CONFIG_SYS_NAND_FTIM3
+#endif
 
 #define CONFIG_SYS_CSPR2_EXT		CONFIG_SYS_CPLD_CSPR_EXT
 #define CONFIG_SYS_CSPR2		CONFIG_SYS_CPLD_CSPR
@@ -183,9 +215,17 @@
 /*
  * Environment
  */
+#define CONFIG_ENV_OVERWRITE
+
+#if defined(CONFIG_NAND_BOOT)
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_ENV_OFFSET		(10 * CONFIG_SYS_NAND_BLOCK_SIZE)
+#else
 #define CONFIG_ENV_IS_IN_FLASH
 #define CONFIG_ENV_ADDR			(CONFIG_SYS_FLASH_BASE + 0x200000)
 #define CONFIG_ENV_SECT_SIZE		0x20000
 #define CONFIG_ENV_SIZE			0x20000
+#endif
 
 #endif /* __LS1043ARDB_H__ */
Signature · 1 line
2.1.0.27.g96db324
#3 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

Quoted 22 lines · Gong Qianyu
---
 arch/arm/Kconfig                                   |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91 
++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31 ++++++++
 include/configs/ls1043ardb.h                       | 40 ++++++++++
 9 files changed, 191 insertions(+)
arch/arm/Kconfig +0 -0
index f935f19..197c72d 100644

arch/arm/Kconfig config TARGET_VEXPRESS64_BASE_FVP · line 615

Quoted 4 lines
arch/arm/Kconfig +1 -0
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP
 config TARGET_VEXPRESS64_JUNO
      bool "Support Versatile Express Juno Development Platform"
      select ARM64
+     select SUPPORT_SPL

The subject line says you're adding nand boot support to ls1043ardb, not Juno.

Also, the previous patch adds SUPPORT_SPL to ls1043ardb -- was it supported in that patch (for non-NAND boot) or is that an error?

Quoted 23 lines
arch/arm/Kconfig +0 -0
 config TARGET_LS2085A_EMU
      bool "Support ls2085a_emu"
arch/arm/cpu/armv8/fsl- renamed from arch/arm/cpu/armv8/fsl-lsch2/Makefile +0 -0

lsch2/Makefile
index 23c5bf9..0573659 100644

arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-y += lowlevel.o
 obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o ls1043a_serdes.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
+obj-$(CONFIG_SPL) += spl.o
arch/arm/cpu/armv8/fsl- renamed from arch/arm/cpu/armv8/fsl-lsch2/spl.c +0 -0

lsch2/spl.c
new file mode 100644
index 0000000..980901a

arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +3 -0
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ *

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 13

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+ * SPDX-License-Identifier:  GPL-2.0+
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <i2c.h>
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#include "../../../../../board/freescale/common/ns_access.h"

Why is this header in board/freescale/common if code outside that directory needs it?

Where did you note the dependency on "ARMv7/ls1021a: move ns_access to common file" which is not in this patchset?

Quoted 7 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +7 -0
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong dummy)
+{
+#ifdef CONFIG_SPL_NAND_SUPPORT
+     init_early_memctl_regs();
+
+     /*

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 67

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+      * There is LS1 SoC issue where NOR, FPGA are inaccessible during
+      * NAND boot because IFC signals > IFC_AD7 are not enabled.
+      * This workaround changes RCW source to make all signals enabled.
+      */
+     u32 porsr1, pinctl;
+     struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+     porsr1 = in_be32(&gur->porsr1);
+     pinctl = ((porsr1 & ~(FSL_CHASSIS2_CCSR_PORSR1_RCW_MASK)) | 0x24800000);
+     out_be32((unsigned int *)CONFIG_SYS_DCSR_DCFG_ADDR, pinctl);
+#endif

This looks like erratum_rcw_src() in arch/cpu/armv8/fsl-lsch3/soc.c. It should probably be moved somewhere common.

Did this ever get an erratum number?

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 72

Quoted 2 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +1 -0
+     timer_init();           /* initialize timer */

This sort of comment is not useful.

Quoted 8 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +8 -0
+
+     get_clocks();
+
+     preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+     i2c_init_all();
+#endif

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 90

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+     dram_init();
+
+     /* Clear the BSS */
+     memset(__bss_start, 0, __bss_end - __bss_start);
+
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+     enable_layerscape_ns_access();
+#endif
+     board_init_r(NULL, 0);
+}

Can you explain the differences between this and the fsl-lsch3 version?

Quoted 29 lines
include/configs/ls1043a_common.h +20 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE                      115200
 #define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600, 115200 }
 
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT          "arch/arm/cpu/armv8/u-boot-spl.lds"
+#define CONFIG_SPL_TARGET            "u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE         0x10000000
+#define CONFIG_SPL_MAX_SIZE          0x1a000
+#define CONFIG_SPL_STACK             0x1001d000
+#define CONFIG_SPL_PAD_TO            0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE  (600 << 10)

include/configs/ls1043a_common.h line 92

Quoted 10 lines
include/configs/ls1043a_common.h +10 -0
+#define CONFIG_SYS_NAND_U_BOOT_OFFS  CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE    2048
+#define CONFIG_SYS_NAND_U_BOOT_DST   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_SPL_MALLOC_START  0x80200000
+#define CONFIG_SPL_BSS_START_ADDR    0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE   0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE              0x80000
+#define CONFIG_SYS_MONITOR_LEN               0xa0000
+#endif

Can you explain the differences relative to ls2085a, especially addresses, offsets, sizes, and padding?

Why is board-specific information such as NAND page size being hardcoded in an SoC common header file?

600 KiB for the payload is an unusual size. It doesn't look erase-block- aligned. What components share an erase block in this scheme?

-Scott

author
#4 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

Quoted 40 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, September 15, 2015 7:08 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

Quoted 22 lines · Gong Qianyu
Signed-off-by Gong Qianyu <Qianyu.Gong at freescale.com<mailto:[email protected]>>
Signed-off-by Hou Zhiqiang <B48286 at freescale.com<mailto:[email protected]>>
Signed-off-by Shaohui Xie <Shaohui.Xie at freescale.com<mailto:[email protected]>>
Signed-off-by Mingkai Hu <Mingkai.Hu at freescale.com<mailto:[email protected]>>
---
 arch/arm/Kconfig                                   |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91
++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31 ++++++++
 include/configs/ls1043ardb.h                       | 40 ++++++++++
 9 files changed, 191 insertions(+)
arch/arm/Kconfig index renamed from arch/arm/Kconfig +0 -0

f935f19..197c72d 100644

arch/arm/Kconfig +0 -0
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP  config
Quoted 4 lines

TARGET_VEXPRESS64_JUNO
bool "Support Versatile Express Juno Development Platform" select ARM64
+ select SUPPORT_SPL

The subject line says you're adding nand boot support to ls1043ardb, not Juno.

Quoted 3 lines

Also, the previous patch adds SUPPORT_SPL to ls1043ardb -- was it supported in that patch (for non-NAND boot) or is that an error?

Sorry, this is really a patching mistake.:(

Quoted 34 lines
Quoted 20 lines

config TARGET_LS2085A_EMU

      bool "Support ls2085a_emu"
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/Makefile index 23c5bf9..0573659 100644

arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-y += lowlevel.o
 obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o ls1043a_serdes.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
+obj-$(CONFIG_SPL) += spl.o
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/spl.c new file mode 100644 index 0000000..980901a

arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +2 -0
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 12

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+ *
+ * SPDX-License-Identifier:  GPL-2.0+  */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <i2c.h>
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#include "../../../../../board/freescale/common/ns_access.h"

Why is this header in board/freescale/common if code outside that directory needs it?

Quoted 4 lines

Where did you note the dependency on "ARMv7/ls1021a: move ns_access to common file" which is not in this patchset?

The ns_access.h is common and shared by not only LS1043A but also LS1021A boards.

The "ARMv7/ls1021a? patch had been sent out much earlier while the ls1043a patches were not ready. Some details are still overlooked, though.

Quoted 16 lines
Quoted 5 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +5 -0
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong dummy)
+{
+#ifdef CONFIG_SPL_NAND_SUPPORT
+     init_early_memctl_regs();

arch/arm/cpu/armv8/fsl-lsch2/spl.c

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+
+     /*
+      * There is LS1 SoC issue where NOR, FPGA are during
+      * NAND boot because IFC signals > IFC_AD7 are not enabled.
+      * This workaround changes RCW source to make all signals enabled.
+      */
+     u32 porsr1, pinctl;
+     struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+     porsr1 = in_be32(&gur->porsr1);
+     pinctl = ((porsr1 & ~(FSL_CHASSIS2_CCSR_PORSR1_RCW_MASK)) |

0x24800000);

Quoted 8 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 29

Quoted 2 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +2 -0
+     out_be32((unsigned int *)CONFIG_SYS_DCSR_DCFG_ADDR, pinctl);
+#endif

This looks like erratum_rcw_src() in arch/cpu/armv8/fsl-lsch3/soc.c. It should probably be moved somewhere common.

Did this ever get an erratum number?

This is from ls1021a spl code. Seems that it could be removed now since ls1043a won?t get that issue.

Quoted 4 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 72

Quoted 2 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +1 -0
+     timer_init();           /* initialize timer */

This sort of comment is not useful.

OK, thanks.

Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +12 -0
+
+     get_clocks();
+
+     preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+     i2c_init_all();
+#endif
+     dram_init();
+
+     /* Clear the BSS */
+     memset(__bss_start, 0, __bss_end - __bss_start);
Quoted 9 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 90

Quoted 6 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +6 -0
+
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+     enable_layerscape_ns_access();
+#endif
+     board_init_r(NULL, 0);
+}

Can you explain the differences between this and the fsl-lsch3 version?

The basic board_init_f() for spl contains necessary initializations such as clocks, serial, ddr and BSS. So they are generally the same.
I?m not very clear about how spl works on LS2085A. Why does its spl need arch_cpu_init() and env_init()?

Quoted 36 lines

include/configs/ls1043a_common.h line 61

Quoted 8 lines
include/configs/ls1043a_common.h +0 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE                      115200
 #define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600,

115200 }

include/configs/ls1043a_common.h

Quoted 6 lines
include/configs/ls1043a_common.h +5 -0
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT          "arch/arm/cpu/armv8/u-boot-

spl.lds"

Quoted 20 lines
include/configs/ls1043a_common.h +20 -0
+#define CONFIG_SPL_TARGET            "u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE         0x10000000
+#define CONFIG_SPL_MAX_SIZE          0x1a000
+#define CONFIG_SPL_STACK             0x1001d000
+#define CONFIG_SPL_PAD_TO            0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE  (600 << 10)
+#define CONFIG_SYS_NAND_U_BOOT_OFFS  CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE    2048
+#define CONFIG_SYS_NAND_U_BOOT_DST   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_SPL_MALLOC_START  0x80200000
Quoted 9 lines

include/configs/ls1043a_common.h line 92

Quoted 5 lines
include/configs/ls1043a_common.h +5 -0
+#define CONFIG_SPL_BSS_START_ADDR    0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE   0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE              0x80000
+#define CONFIG_SYS_MONITOR_LEN               0xa0000
+#endif

Can you explain the differences relative to ls2085a, especially addresses, offsets, sizes, and padding?

I?m not clear about how ls102085a specifies the values.
As I know on ls1043a boards,
CONFIG_SPL_TEXT_BASE is where SPL code is put. The max size also depends on SPL image.
CONFIG_SPL_PAD_TO is actually U-Boot image offset to NAND 0x0 base because the U-Boot image is put right after padded SPL image. CONFIG_SPL_PAD_TO must be larger than CONFIG_SPL_MAX_SIZE.
Do you think the spl code could be common for ls1043a and ls2085a ?

Quoted 4 lines

Why is board-specific information such as NAND page size being hardcoded in
an SoC common header file?

Now both LS1043ARDB and LS1043AQDS boards share the same NAND page size.

Quoted 2 lines

600 KiB for the payload is an unusual size. It doesn't look erase-block- aligned. What components share an erase block in this scheme?

You?re right. Maybe a 640KiB size is more satisfying.

Quoted 2 lines

-Scott

#5 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

[Added York Sun -- please CC him on future patches]

Quoted 85 lines · On Tue, 2015-09-15 at 06:47 -0500, Gong Qianyu-B52263 wrote:
Quoted 40 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, September 15, 2015 7:08 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

Quoted 22 lines · Gong Qianyu
---
 arch/arm/Kconfig                                   |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91
++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31 ++++++++
 include/configs/ls1043ardb.h                       | 40 ++++++++++
 9 files changed, 191 insertions(+)
arch/arm/Kconfig index renamed from arch/arm/Kconfig +0 -0

f935f19..197c72d 100644

arch/arm/Kconfig +0 -0
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP  config
Quoted 4 lines

TARGET_VEXPRESS64_JUNO
bool "Support Versatile Express Juno Development Platform" select ARM64
+ select SUPPORT_SPL

The subject line says you're adding nand boot support to ls1043ardb, not Juno.

Quoted 3 lines

Also, the previous patch adds SUPPORT_SPL to ls1043ardb -- was it supported in that patch (for non-NAND boot) or is that an error?

Sorry, this is really a patching mistake.:(

Quoted 34 lines
Quoted 20 lines

config TARGET_LS2085A_EMU

      bool "Support ls2085a_emu"
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/Makefile index 23c5bf9..0573659 100644

arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-y += lowlevel.o
 obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o ls1043a_serdes.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
+obj-$(CONFIG_SPL) += spl.o
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/spl.c new file mode 100644 index 0000000..980901a

arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +2 -0
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 12

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+ *
+ * SPDX-License-Identifier:  GPL-2.0+  */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <i2c.h>
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#include "../../../../../board/freescale/common/ns_access.h"

Why is this header in board/freescale/common if code outside that directory needs it?

Quoted 4 lines

Where did you note the dependency on "ARMv7/ls1021a: move ns_access to common file" which is not in this patchset?

Quoted 6 lines

The ns_access.h is common and shared by not only LS1043A but also LS1021A boards.

The "ARMv7/ls1021a? patch had been sent out much earlier while the ls1043a patches were not ready.
Some details are still overlooked, though.

That doesn't answer my question. If the header needs to be accessed from outside board/freescale/common it should not go in board/freescale/common. How about include/fsl-ns-access.h? What does "ns" stand for here?

Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +12 -0
+
+     get_clocks();
+
+     preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+     i2c_init_all();
+#endif
+     dram_init();
+
+     /* Clear the BSS */
+     memset(__bss_start, 0, __bss_end - __bss_start);
Quoted 9 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 90

Quoted 6 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +6 -0
+
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+     enable_layerscape_ns_access();
+#endif
+     board_init_r(NULL, 0);
+}

Can you explain the differences between this and the fsl-lsch3 version?

Quoted 3 lines

The basic board_init_f() for spl contains necessary initializations such as clocks, serial, ddr and BSS.
So they are generally the same.

Right. It would be nice if things that "are generally the same" between similar chips actually be the same, except where differences are justified.

Quoted 2 lines

I?m not very clear about how spl works on LS2085A. Why does its spl need arch_cpu_init() and env_init()?

arch_cpu_init() is low-level CPU initialization -- primarily setting up caches. In theory you may not need it in SPL, but it speeds things up. It was especially important when we were running in a hardware emulator, but it's still nice to have.

env_init() initializes the environment, though we need to enable CONFIG_NAND_ENV_DST for it to actually get loaded from NAND.

Quoted 46 lines
Quoted 36 lines

include/configs/ls1043a_common.h line 61

Quoted 8 lines
include/configs/ls1043a_common.h +0 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE                      115200
 #define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600,

115200 }

include/configs/ls1043a_common.h

Quoted 6 lines
include/configs/ls1043a_common.h +5 -0
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT          "arch/arm/cpu/armv8/u-boot-

spl.lds"

Quoted 20 lines
include/configs/ls1043a_common.h +20 -0
+#define CONFIG_SPL_TARGET            "u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE         0x10000000
+#define CONFIG_SPL_MAX_SIZE          0x1a000
+#define CONFIG_SPL_STACK             0x1001d000
+#define CONFIG_SPL_PAD_TO            0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE  (600 << 10)
+#define CONFIG_SYS_NAND_U_BOOT_OFFS  CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE    2048
+#define CONFIG_SYS_NAND_U_BOOT_DST   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_SPL_MALLOC_START  0x80200000
Quoted 9 lines

include/configs/ls1043a_common.h line 92

Quoted 5 lines
include/configs/ls1043a_common.h +5 -0
+#define CONFIG_SPL_BSS_START_ADDR    0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE   0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE              0x80000
+#define CONFIG_SYS_MONITOR_LEN               0xa0000
+#endif

Can you explain the differences relative to ls2085a, especially addresses, offsets, sizes, and padding?

Quoted 3 lines

I?m not clear about how ls102085a specifies the values. As I know on ls1043a boards, CONFIG_SPL_TEXT_BASE is where SPL code is put.

Which parts of OCRAM does the bootrom use while processing PBI? On ls208x we avoided the first 0xa000 bytes because of this.

Quoted 1 line

The max size also depends on SPL image.

What do you mean by "The max size also depends on SPL image"? The max size depends on the size of OCRAM and the offset within OCRAM of the SPL image (minus any areas at the end of OCRAM that need to be reserved).

Quoted 10 lines

CONFIG_SPL_PAD_TO is actually U-Boot image offset to NAND 0x0 base because the U-Boot image is put right after padded SPL image. CONFIG_SPL_PAD_TO must be larger than CONFIG_SPL_MAX_SIZE.
Do you think the spl code could be common for ls1043a and ls2085a ?

Quoted 4 lines

Why is board-specific information such as NAND page size being hardcoded in
an SoC common header file?

Now both LS1043ARDB and LS1043AQDS boards share the same NAND page size.

So? It's still board-specific. Don't make it hard to add support for a custom board with a different NAND chip. Likewise for any other parameters that depend on page/block size (e.g. to ensure alignment).

-Scott

author
#6 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

Quoted 101 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, September 16, 2015 6:33 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

[Added York Sun -- please CC him on future patches]

Quoted 89 lines · On Tue, 2015-09-15 at 06:47 -0500, Gong Qianyu-B52263 wrote:
Quoted 40 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, September 15, 2015 7:08 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

Quoted 22 lines · Gong Qianyu
---
 arch/arm/Kconfig                                   |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91
++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31 ++++++++
 include/configs/ls1043ardb.h                       | 40 ++++++++++
 9 files changed, 191 insertions(+)
arch/arm/Kconfig index renamed from arch/arm/Kconfig +0 -0

f935f19..197c72d 100644

arch/arm/Kconfig +0 -0
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP  config
Quoted 4 lines

TARGET_VEXPRESS64_JUNO
bool "Support Versatile Express Juno Development Platform" select ARM64
+ select SUPPORT_SPL

The subject line says you're adding nand boot support to ls1043ardb, not Juno.

Quoted 3 lines

Also, the previous patch adds SUPPORT_SPL to ls1043ardb -- was it supported in that patch (for non-NAND boot) or is that an error?

Sorry, this is really a patching mistake.:(

Quoted 35 lines
Quoted 21 lines

config TARGET_LS2085A_EMU

      bool "Support ls2085a_emu"
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/Makefile index 23c5bf9..0573659 100644

arch/arm/cpu/armv8/fsl-lsch2/Makefile +0 -0
@@ -10,3 +10,4 @@ obj-y += lowlevel.o  obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o

ls1043a_serdes.o
obj-$(CONFIG_OF_LIBFDT) += fdt.o

arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
+obj-$(CONFIG_SPL) += spl.o
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/spl.c new file mode 100644 index 0000000..980901a

arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +2 -0
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 12

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+ *
+ * SPDX-License-Identifier:  GPL-2.0+  */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <i2c.h>
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#include "../../../../../board/freescale/common/ns_access.h"

Why is this header in board/freescale/common if code outside that directory needs it?

Quoted 4 lines

Where did you note the dependency on "ARMv7/ls1021a: move ns_access to common file" which is not in this patchset?

The ns_access.h is common and shared by not only LS1043A but also LS1021A boards.

Quoted 8 lines
Quoted 3 lines

The "ARMv7/ls1021a? patch had been sent out much earlier while the ls1043a patches were not ready.
Some details are still overlooked, though.

That doesn't answer my question. If the header needs to be accessed from outside board/freescale/common it should not go in board/freescale/common. How about include/fsl-ns-access.h? What does "ns" stand for here?

OK. Our team discussed and now decide to create a include/fsl_csu.h to include the csu common parts.

Quoted 32 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +11 -0
+
+     get_clocks();
+
+     preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+     i2c_init_all();
+#endif
+     dram_init();
+
+     /* Clear the BSS */
Quoted 8 lines
Quoted 8 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 90

Quoted 6 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +6 -0
+     memset(__bss_start, 0, __bss_end - __bss_start);
+
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+     enable_layerscape_ns_access(); #endif
+     board_init_r(NULL, 0);
+}

Can you explain the differences between this and the fsl-lsch3

version?

Quoted 5 lines
Quoted 1 line

The basic board_init_f() for spl contains necessary initializations such as clocks, serial, ddr and BSS.
So they are generally the same.

Right. It would be nice if things that "are generally the same" between similar chips actually be the same, except where differences are justified.

Quoted 8 lines
Quoted 3 lines

I?m not very clear about how spl works on LS2085A. Why does its spl need
arch_cpu_init() and env_init()?

arch_cpu_init() is low-level CPU initialization -- primarily setting up caches. In theory you may not need it in SPL, but it speeds things up. It was especially important when we were running in a hardware emulator, but it's still nice to have.

OK. It's nice of it to "speed things up".

Quoted 4 lines

env_init() initializes the environment, though we need to enable CONFIG_NAND_ENV_DST for it to actually get loaded from NAND.

But why do you need to get env variables in early spl? Is it indispensable for ls2085? U-Boot will just do the same initialization later.

Quoted 44 lines
Quoted 44 lines
Quoted 43 lines

include/configs/ls1043a_common.h line 61

Quoted 8 lines
include/configs/ls1043a_common.h +0 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE                      115200
 #define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600,

115200 }

include/configs/ls1043a_common.h

Quoted 6 lines
include/configs/ls1043a_common.h +5 -0
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT          "arch/arm/cpu/armv8/u-boot-

spl.lds"

Quoted 13 lines
include/configs/ls1043a_common.h +13 -0
+#define CONFIG_SPL_TARGET            "u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT #define
+CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT #define
+CONFIG_SPL_I2C_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT #define
+CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE         0x10000000
+#define CONFIG_SPL_MAX_SIZE          0x1a000
+#define CONFIG_SPL_STACK             0x1001d000
+#define CONFIG_SPL_PAD_TO            0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE  (600 << 10) #define

include/configs/ls1043a_common.h line 92

Quoted 10 lines
include/configs/ls1043a_common.h +10 -0
+CONFIG_SYS_NAND_U_BOOT_OFFS  CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE    2048
+#define CONFIG_SYS_NAND_U_BOOT_DST   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE #define
+CONFIG_SYS_SPL_MALLOC_START  0x80200000
+#define CONFIG_SPL_BSS_START_ADDR    0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE   0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE              0x80000
+#define CONFIG_SYS_MONITOR_LEN               0xa0000
+#endif

Can you explain the differences relative to ls2085a, especially addresses, offsets, sizes, and padding?

Quoted 7 lines
Quoted 3 lines

I?m not clear about how ls102085a specifies the values. As I know on ls1043a boards, CONFIG_SPL_TEXT_BASE is where SPL code is put.

Which parts of OCRAM does the bootrom use while processing PBI? On ls208x we avoided the first 0xa000 bytes because of this.

At the end of ls1043a bootrom, it just jumps to OCRAM offset 0x0 to execute spl code. So the CONFIG_SPL_TEXT_BASE is 0x1000_0000 which is the OCRAM base address on ls1043a. "Avoided the first 0xa000 bytes" means the ls208x bootrom reserves the first 0xa000 bytes for itself?

Quoted 6 lines
Quoted 1 line

The max size also depends on SPL image.

What do you mean by "The max size also depends on SPL image"? The max size depends on the size of OCRAM and the offset within OCRAM of the SPL image (minus any areas at the end of OCRAM that need to be reserved).

Thanks. You make it more detailed. Of course the SPL max size mustn't be larger than OCRAM size.

Quoted 5 lines
Quoted 5 lines

CONFIG_SPL_PAD_TO is actually U-Boot image offset to NAND 0x0 base because the U-Boot image is put right after padded SPL image. CONFIG_SPL_PAD_TO must be larger than CONFIG_SPL_MAX_SIZE. Do you think the spl code could be common for ls1043a and ls2085a ?

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Why is board-specific information such as NAND page size being hardcoded in an SoC common header file?

Now both LS1043ARDB and LS1043AQDS boards share the same NAND page size.

So? It's still board-specific. Don't make it hard to add support for a custom board with a different NAND chip. Likewise for any other parameters that depend on page/block size (e.g. to ensure alignment).

Oh, we didn't consider any custom board. Maybe it's better to keep their respective macros for long-term consideration.

Quoted 2 lines

-Scott

#7 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

Quoted 157 lines · On Wed, 2015-09-16 at 04:25 -0500, Gong Qianyu-B52263 wrote:
Quoted 101 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, September 16, 2015 6:33 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

[Added York Sun -- please CC him on future patches]

Quoted 89 lines · On Tue, 2015-09-15 at 06:47 -0500, Gong Qianyu-B52263 wrote:
Quoted 40 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, September 15, 2015 7:08 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

Quoted 22 lines · Gong Qianyu
---
 arch/arm/Kconfig                                   |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91
++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31 ++++++++
 include/configs/ls1043ardb.h                       | 40 ++++++++++
 9 files changed, 191 insertions(+)
arch/arm/Kconfig index renamed from arch/arm/Kconfig +0 -0

f935f19..197c72d 100644

arch/arm/Kconfig +0 -0
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP  config
Quoted 4 lines

TARGET_VEXPRESS64_JUNO
bool "Support Versatile Express Juno Development Platform" select ARM64
+ select SUPPORT_SPL

The subject line says you're adding nand boot support to ls1043ardb, not Juno.

Quoted 3 lines

Also, the previous patch adds SUPPORT_SPL to ls1043ardb -- was it supported in that patch (for non-NAND boot) or is that an error?

Sorry, this is really a patching mistake.:(

Quoted 35 lines
Quoted 21 lines

config TARGET_LS2085A_EMU

      bool "Support ls2085a_emu"
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/Makefile index 23c5bf9..0573659 100644

arch/arm/cpu/armv8/fsl-lsch2/Makefile +0 -0
@@ -10,3 +10,4 @@ obj-y += lowlevel.o  obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o

ls1043a_serdes.o
obj-$(CONFIG_OF_LIBFDT) += fdt.o

arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
+obj-$(CONFIG_SPL) += spl.o
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/spl.c new file mode 100644 index 0000000..980901a

arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +2 -0
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 12

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+ *
+ * SPDX-License-Identifier:  GPL-2.0+  */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <i2c.h>
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#include "../../../../../board/freescale/common/ns_access.h"

Why is this header in board/freescale/common if code outside that directory needs it?

Quoted 4 lines

Where did you note the dependency on "ARMv7/ls1021a: move ns_access to common file" which is not in this patchset?

The ns_access.h is common and shared by not only LS1043A but also LS1021A boards.

Quoted 8 lines
Quoted 3 lines

The "ARMv7/ls1021a? patch had been sent out much earlier while the ls1043a patches were not ready.
Some details are still overlooked, though.

That doesn't answer my question. If the header needs to be accessed from outside board/freescale/common it should not go in board/freescale/common. How about include/fsl-ns-access.h? What does "ns" stand for here?

OK. Our team discussed and now decide to create a include/fsl_csu.h to include the csu common parts.

Quoted 32 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +11 -0
+
+     get_clocks();
+
+     preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+     i2c_init_all();
+#endif
+     dram_init();
+
+     /* Clear the BSS */
Quoted 8 lines
Quoted 8 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 90

Quoted 6 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +6 -0
+     memset(__bss_start, 0, __bss_end - __bss_start);
+
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+     enable_layerscape_ns_access(); #endif
+     board_init_r(NULL, 0);
+}

Can you explain the differences between this and the fsl-lsch3

version?

Quoted 5 lines
Quoted 1 line

The basic board_init_f() for spl contains necessary initializations such as clocks, serial, ddr and BSS.
So they are generally the same.

Right. It would be nice if things that "are generally the same" between similar chips actually be the same, except where differences are justified.

Quoted 8 lines
Quoted 3 lines

I?m not very clear about how spl works on LS2085A. Why does its spl need
arch_cpu_init() and env_init()?

arch_cpu_init() is low-level CPU initialization -- primarily setting up caches. In theory you may not need it in SPL, but it speeds things up. It was especially important when we were running in a hardware emulator, but it's still nice to have.

OK. It's nice of it to "speed things up".

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

env_init() initializes the environment, though we need to enable CONFIG_NAND_ENV_DST for it to actually get loaded from NAND.

But why do you need to get env variables in early spl? Is it indispensable for ls2085?
U-Boot will just do the same initialization later.

I don't remember the exact consequences of not having it, given that (unless I'm missing something) only the default environment is currently used in the SPL on this target, but env variables are used by DDR init and serial output.

Quoted 49 lines
Quoted 49 lines
Quoted 48 lines
Quoted 35 lines

include/configs/ls1043a_common.h line 61

Quoted 9 lines
include/configs/ls1043a_common.h +0 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE                      115200
 #define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600,

115200 }

include/configs/ls1043a_common.h

Quoted 6 lines
include/configs/ls1043a_common.h +5 -0
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT          "arch/arm/cpu/armv8/u-boot-

spl.lds"

Quoted 18 lines
include/configs/ls1043a_common.h +18 -0
+#define CONFIG_SPL_TARGET            "u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT #define
+CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT #define
+CONFIG_SPL_I2C_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT #define
+CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE         0x10000000
+#define CONFIG_SPL_MAX_SIZE          0x1a000
+#define CONFIG_SPL_STACK             0x1001d000
+#define CONFIG_SPL_PAD_TO            0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE  (600 << 10) #define
+CONFIG_SYS_NAND_U_BOOT_OFFS  CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE    2048
+#define CONFIG_SYS_NAND_U_BOOT_DST   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE #define
+CONFIG_SYS_SPL_MALLOC_START  0x80200000
Quoted 9 lines

include/configs/ls1043a_common.h line 92

Quoted 5 lines
include/configs/ls1043a_common.h +5 -0
+#define CONFIG_SPL_BSS_START_ADDR    0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE   0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE              0x80000
+#define CONFIG_SYS_MONITOR_LEN               0xa0000
+#endif

Can you explain the differences relative to ls2085a, especially addresses, offsets, sizes, and padding?

I?m not clear about how ls102085a specifies the values. As I know on ls1043a boards, CONFIG_SPL_TEXT_BASE is where SPL code is put.

Quoted 6 lines
Quoted 3 lines

Which parts of OCRAM does the bootrom use while processing PBI? On ls208x we avoided the first 0xa000 bytes because of this.

At the end of ls1043a bootrom, it just jumps to OCRAM offset 0x0 to execute spl code.

Is this because there's something in PBI telling it to do so, or is it hardcoded in the bootrom?

Quoted 5 lines

So the CONFIG_SPL_TEXT_BASE is 0x1000_0000 which is the OCRAM base address on ls1043a.

"Avoided the first 0xa000 bytes" means the ls208x bootrom reserves the first 0xa000 bytes for itself?

Yes, the bootrom uses those bytes while it is running. Once the SPL takes control we can reuse that region, but the SPL image itself can't be there.

-Scott

author
#8 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

Quoted 244 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Friday, September 18, 2015 3:26 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

Quoted 22 lines · On Wed, 2015-09-16 at 04:25 -0500, Gong Qianyu-B52263 wrote:
Quoted 22 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, September 16, 2015 6:33 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

[Added York Sun -- please CC him on future patches]

Quoted 10 lines · On Tue, 2015-09-15 at 06:47 -0500, Gong Qianyu-B52263 wrote:
Quoted 10 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, September 15, 2015 7:08 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

On Fri, 2015-09-11 at 19:07 +0800, Gong Qianyu wrote:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
---
 arch/arm/Kconfig                                   |  1 +
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91
++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31

++++++++

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
 include/configs/ls1043ardb.h                       | 40

++++++++++

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
 9 files changed, 191 insertions(+)
arch/arm/Kconfig index renamed from arch/arm/Kconfig +0 -0

f935f19..197c72d 100644

arch/arm/Kconfig +0 -0
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP  config

TARGET_VEXPRESS64_JUNO
bool "Support Versatile Express Juno Development

Platform"

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

select ARM64
+ select SUPPORT_SPL

The subject line says you're adding nand boot support to ls1043ardb, not Juno.

Also, the previous patch adds SUPPORT_SPL to ls1043ardb -- was it supported in that patch (for non-NAND boot) or is that an

error?

Quoted 48 lines
Quoted 48 lines
Quoted 48 lines
Quoted 1 line

Sorry, this is really a patching mistake.:(

Quoted 36 lines
Quoted 22 lines

config TARGET_LS2085A_EMU

      bool "Support ls2085a_emu"
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/Makefile index 23c5bf9..0573659
100644

arch/arm/cpu/armv8/fsl-lsch2/Makefile +0 -0
@@ -10,3 +10,4 @@ obj-y += lowlevel.o  obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o

ls1043a_serdes.o
obj-$(CONFIG_OF_LIBFDT) += fdt.o

arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
+obj-$(CONFIG_SPL) += spl.o
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/spl.c new file mode 100644 index 0000000..980901a

arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +2 -0
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 12

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+ *
+ * SPDX-License-Identifier:  GPL-2.0+  */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <i2c.h>
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#include "../../../../../board/freescale/common/ns_access.h"

Why is this header in board/freescale/common if code outside that directory needs it?

Quoted 4 lines

Where did you note the dependency on "ARMv7/ls1021a: move ns_access to common file" which is not in this patchset?

The ns_access.h is common and shared by not only LS1043A but also LS1021A boards.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

The "ARMv7/ls1021a? patch had been sent out much earlier while the ls1043a patches were not ready.
Some details are still overlooked, though.

That doesn't answer my question. If the header needs to be accessed from outside board/freescale/common it should not go in

board/freescale/common.

Quoted 44 lines
Quoted 2 lines

How about include/fsl-ns-access.h? What does "ns" stand for here?

OK. Our team discussed and now decide to create a include/fsl_csu.h to include the csu common parts.

Quoted 38 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +11 -0
+
+     get_clocks();
+
+     preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+     i2c_init_all();
+#endif
+     dram_init();
+
+     /* Clear the BSS */
Quoted 8 lines
Quoted 8 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 90

Quoted 6 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +6 -0
+     memset(__bss_start, 0, __bss_end - __bss_start);
+
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+     enable_layerscape_ns_access(); #endif
+     board_init_r(NULL, 0);
+}

Can you explain the differences between this and the fsl-lsch3

version?

Quoted 5 lines
Quoted 1 line

The basic board_init_f() for spl contains necessary initializations such as clocks, serial, ddr and BSS. So they are generally the same.

Right. It would be nice if things that "are generally the same" between similar chips actually be the same, except where differences are justified.

Quoted 3 lines

I?m not very clear about how spl works on LS2085A. Why does its spl need
arch_cpu_init() and env_init()?

arch_cpu_init() is low-level CPU initialization -- primarily setting up caches. In theory you may not need it in SPL, but it speeds

things up.

Quoted 6 lines
Quoted 2 lines

It was especially important when we were running in a hardware emulator, but it's still nice to have.

OK. It's nice of it to "speed things up".

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

env_init() initializes the environment, though we need to enable CONFIG_NAND_ENV_DST for it to actually get loaded from NAND.

But why do you need to get env variables in early spl? Is it indispensable for ls2085?
U-Boot will just do the same initialization later.

I don't remember the exact consequences of not having it, given that (unless I'm missing something) only the default environment is currently used in the SPL on this target, but env variables are used by DDR init and serial output.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

include/configs/ls1043a_common.h line 61

Quoted 9 lines
include/configs/ls1043a_common.h +0 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE                      115200
 #define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400,

57600,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

115200 }

include/configs/ls1043a_common.h

Quoted 6 lines
include/configs/ls1043a_common.h +5 -0
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT          "arch/arm/cpu/armv8/u-

boot-

Quoted 37 lines
Quoted 36 lines
Quoted 29 lines
Quoted 19 lines

spl.lds"

Quoted 18 lines
include/configs/ls1043a_common.h +18 -0
+#define CONFIG_SPL_TARGET            "u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT #define
+CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT #define
+CONFIG_SPL_I2C_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT #define
+CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE         0x10000000
+#define CONFIG_SPL_MAX_SIZE          0x1a000
+#define CONFIG_SPL_STACK             0x1001d000
+#define CONFIG_SPL_PAD_TO            0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE  (600 << 10) #define
+CONFIG_SYS_NAND_U_BOOT_OFFS  CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE    2048
+#define CONFIG_SYS_NAND_U_BOOT_DST   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_SPL_MALLOC_START  0x80200000
Quoted 9 lines

include/configs/ls1043a_common.h line 92

Quoted 5 lines
include/configs/ls1043a_common.h +5 -0
+#define CONFIG_SPL_BSS_START_ADDR    0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE   0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE              0x80000
+#define CONFIG_SYS_MONITOR_LEN               0xa0000
+#endif

Can you explain the differences relative to ls2085a, especially addresses, offsets, sizes, and padding?

Quoted 3 lines

I?m not clear about how ls102085a specifies the values. As I know on ls1043a boards, CONFIG_SPL_TEXT_BASE is where SPL code is put.

Which parts of OCRAM does the bootrom use while processing PBI? On ls208x we avoided the first 0xa000 bytes because of this.

Quoted 6 lines
Quoted 2 lines

At the end of ls1043a bootrom, it just jumps to OCRAM offset 0x0 to execute spl code.

Is this because there's something in PBI telling it to do so, or is it hardcoded in the bootrom?

Yes. Which address the bootrom will jump directly depends on the value in scratch registers. It is hardcoded. PBI actually set the SPL address in scratch registers for it.

Quoted 11 lines
Quoted 5 lines

So the CONFIG_SPL_TEXT_BASE is 0x1000_0000 which is the OCRAM base address on ls1043a.

"Avoided the first 0xa000 bytes" means the ls208x bootrom reserves the first 0xa000 bytes for itself?

Yes, the bootrom uses those bytes while it is running. Once the SPL takes control we can reuse that region, but the SPL image itself can't be there.

-Scott

#9 lore raw

PATCH 9/14 armv8/ls1043ardb: Add nand boot support

Quoted 246 lines · On Fri, 2015-09-18 at 07:07 -0500, Gong Qianyu-B52263 wrote:
Quoted 246 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Friday, September 18, 2015 3:26 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

Quoted 22 lines · On Wed, 2015-09-16 at 04:25 -0500, Gong Qianyu-B52263 wrote:
Quoted 22 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, September 16, 2015 6:33 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

[Added York Sun -- please CC him on future patches]

Quoted 10 lines · On Tue, 2015-09-15 at 06:47 -0500, Gong Qianyu-B52263 wrote:
Quoted 10 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, September 15, 2015 7:08 AM
To: Gong Qianyu-B52263
Cc: u-boot at lists.denx.de; Xie Shaohui-B21989; Hou Zhiqiang-B48286; Hu Mingkai-B21284; Song Wenbin-B53747
Subject: Re: [U-Boot] [PATCH 09/14] armv8/ls1043ardb: Add nand boot support

On Fri, 2015-09-11 at 19:07 +0800, Gong Qianyu wrote:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
---
 arch/arm/Kconfig                                   |  1 +
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
 arch/arm/cpu/armv8/fsl-lsch2/Makefile              |  1 +
 arch/arm/cpu/armv8/fsl-lsch2/spl.c                 | 91
++++++++++++++++++++++
 arch/arm/include/asm/arch-fsl-lsch2/config.h       |  2 +
 board/freescale/ls1043ardb/ls1043ardb_pbi.cfg      | 14 ++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg |  7 ++
 configs/ls1043ardb_nand_defconfig                  |  4 +
 include/configs/ls1043a_common.h                   | 31

++++++++

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
 include/configs/ls1043ardb.h                       | 40

++++++++++

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
 9 files changed, 191 insertions(+)
arch/arm/Kconfig index renamed from arch/arm/Kconfig +0 -0

f935f19..197c72d 100644

arch/arm/Kconfig +0 -0
@@ -612,6 +612,7 @@ config TARGET_VEXPRESS64_BASE_FVP  config

TARGET_VEXPRESS64_JUNO
bool "Support Versatile Express Juno Development

Platform"

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

select ARM64
+ select SUPPORT_SPL

The subject line says you're adding nand boot support to ls1043ardb, not Juno.

Also, the previous patch adds SUPPORT_SPL to ls1043ardb -- was it supported in that patch (for non-NAND boot) or is that an

error?

Quoted 48 lines
Quoted 48 lines
Quoted 48 lines
Quoted 1 line

Sorry, this is really a patching mistake.:(

Quoted 36 lines
Quoted 22 lines

config TARGET_LS2085A_EMU

      bool "Support ls2085a_emu"
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/Makefile index 23c5bf9..0573659
100644

arch/arm/cpu/armv8/fsl-lsch2/Makefile +0 -0
@@ -10,3 +10,4 @@ obj-y += lowlevel.o  obj-y += speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o

ls1043a_serdes.o
obj-$(CONFIG_OF_LIBFDT) += fdt.o

arch/arm/cpu/armv8/fsl-lsch2/Makefile +1 -0
+obj-$(CONFIG_SPL) += spl.o
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl- lsch2/spl.c new file mode 100644 index 0000000..980901a

arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +2 -0
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 12

Quoted 10 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +10 -0
+ *
+ * SPDX-License-Identifier:  GPL-2.0+  */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <i2c.h>
+#include <asm/arch-fsl-lsch2/immap_lsch2.h>
+#include "../../../../../board/freescale/common/ns_access.h"

Why is this header in board/freescale/common if code outside that directory needs it?

Quoted 4 lines

Where did you note the dependency on "ARMv7/ls1021a: move ns_access to common file" which is not in this patchset?

The ns_access.h is common and shared by not only LS1043A but also LS1021A boards.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

The "ARMv7/ls1021a? patch had been sent out much earlier while the ls1043a patches were not ready.
Some details are still overlooked, though.

That doesn't answer my question. If the header needs to be accessed from outside board/freescale/common it should not go in

board/freescale/common.

Quoted 44 lines
Quoted 2 lines

How about include/fsl-ns-access.h? What does "ns" stand for here?

OK. Our team discussed and now decide to create a include/fsl_csu.h to include the csu common parts.

Quoted 38 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +11 -0
+
+     get_clocks();
+
+     preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+     i2c_init_all();
+#endif
+     dram_init();
+
+     /* Clear the BSS */
Quoted 8 lines
Quoted 8 lines

arch/arm/cpu/armv8/fsl-lsch2/spl.c line 29

Quoted 6 lines
arch/arm/cpu/armv8/fsl-lsch2/spl.c new file +6 -0
+     memset(__bss_start, 0, __bss_end - __bss_start);
+
+#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
+     enable_layerscape_ns_access(); #endif
+     board_init_r(NULL, 0);
+}

Can you explain the differences between this and the fsl-lsch3

version?

Quoted 5 lines
Quoted 1 line

The basic board_init_f() for spl contains necessary initializations such as clocks, serial, ddr and BSS. So they are generally the same.

Right. It would be nice if things that "are generally the same" between similar chips actually be the same, except where differences are justified.

Quoted 3 lines

I?m not very clear about how spl works on LS2085A. Why does its spl need
arch_cpu_init() and env_init()?

arch_cpu_init() is low-level CPU initialization -- primarily setting up caches. In theory you may not need it in SPL, but it speeds

things up.

Quoted 6 lines
Quoted 2 lines

It was especially important when we were running in a hardware emulator, but it's still nice to have.

OK. It's nice of it to "speed things up".

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

env_init() initializes the environment, though we need to enable CONFIG_NAND_ENV_DST for it to actually get loaded from NAND.

But why do you need to get env variables in early spl? Is it indispensable for ls2085?
U-Boot will just do the same initialization later.

I don't remember the exact consequences of not having it, given that (unless I'm missing something) only the default environment is currently used in the SPL on this target, but env variables are used by DDR init and serial output.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

include/configs/ls1043a_common.h line 61

Quoted 9 lines
include/configs/ls1043a_common.h +0 -0
index 139005c..4bda296 100644
@@ -60,6 +60,37 @@
 #define CONFIG_BAUDRATE                      115200
 #define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400,

57600,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

115200 }

include/configs/ls1043a_common.h line 66

Quoted 6 lines
include/configs/ls1043a_common.h +5 -0
+/* NAND SPL */
+#ifdef CONFIG_NAND_BOOT
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT          "arch/arm/cpu/armv8/u-

boot-

Quoted 39 lines
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines

spl.lds"

Quoted 13 lines
include/configs/ls1043a_common.h +13 -0
+#define CONFIG_SPL_TARGET            "u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT #define
+CONFIG_SPL_LIBGENERIC_SUPPORT #define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT #define
+CONFIG_SPL_I2C_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_NAND_SUPPORT #define
+CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_TEXT_BASE         0x10000000
+#define CONFIG_SPL_MAX_SIZE          0x1a000
+#define CONFIG_SPL_STACK             0x1001d000
+#define CONFIG_SPL_PAD_TO            0x1c000
+#define CONFIG_SYS_NAND_U_BOOT_SIZE  (600 << 10) #define

include/configs/ls1043a_common.h line 89

Quoted 10 lines
include/configs/ls1043a_common.h +10 -0
+CONFIG_SYS_NAND_U_BOOT_OFFS  CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_PAGE_SIZE    2048
+#define CONFIG_SYS_NAND_U_BOOT_DST   CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_SPL_MALLOC_START  0x80200000
+#define CONFIG_SPL_BSS_START_ADDR    0x80100000
+#define CONFIG_SYS_SPL_MALLOC_SIZE   0x100000
+#define CONFIG_SPL_BSS_MAX_SIZE              0x80000
+#define CONFIG_SYS_MONITOR_LEN               0xa0000
+#endif

Can you explain the differences relative to ls2085a, especially addresses, offsets, sizes, and padding?

Quoted 7 lines
Quoted 3 lines

I?m not clear about how ls102085a specifies the values. As I know on ls1043a boards, CONFIG_SPL_TEXT_BASE is where SPL code is put.

Which parts of OCRAM does the bootrom use while processing PBI? On ls208x we avoided the first 0xa000 bytes because of this.

At the end of ls1043a bootrom, it just jumps to OCRAM offset 0x0 to execute spl code.

Quoted 8 lines
Quoted 3 lines

Is this because there's something in PBI telling it to do so, or is it hardcoded in the bootrom?

Yes. Which address the bootrom will jump directly depends on the value in scratch registers.
It is hardcoded. PBI actually set the SPL address in scratch registers for it.

If the PBI sets the value in the scratch registers, then why do you say it's hardcoded?

Where does the bootrom put its own runtime data?

-Scott

#10 lore raw

PATCH 10/14 armv8/ls1043ardb: Add cpld command to boot from nand

In reply to Gong Qianyu
---
 board/freescale/ls1043ardb/cpld.c | 18 ++++++++++++++++++
 board/freescale/ls1043ardb/cpld.h |  1 +
 2 files changed, 19 insertions(+)
board/freescale/ls1043ardb/cpld.c +18 -0
index 3f1101e..5acb97d 100644
@@ -45,6 +45,21 @@ void cpld_set_defbank(void)
 	CPLD_WRITE(global_rst, 1);
 }
 
+void cpld_set_nand(void)
+{
+	u16 reg = CPLD_CFG_RCW_SRC_NAND;
+	u8 reg5 = (u8)(reg >> 1);
+	u8 reg6 = (u8)(reg & 1);
+	cpld_rev_bit(&reg5);
+
+	CPLD_WRITE(soft_mux_on, 1);
+
+	CPLD_WRITE(cfg_rcw_src1, reg5);
+	CPLD_WRITE(cfg_rcw_src2, reg6);
+
+	CPLD_WRITE(system_rst, 1);
+}
+
 #ifdef DEBUG
 static void cpld_dump_regs(void)
 {
@@ -91,6 +106,8 @@ int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (strcmp(argv[1], "reset") == 0) {
 		if (strcmp(argv[2], "altbank") == 0)
 			cpld_set_altbank();
+		else if (strcmp(argv[2], "nand") == 0)
+			cpld_set_nand();
 		else
 			cpld_set_defbank();
 #ifdef DEBUG
@@ -109,6 +126,7 @@ U_BOOT_CMD(
 	"Reset the board or alternate bank",
 	"reset: reset to default bank\n"
 	"cpld reset altbank: reset to alternate bank\n"
+	"cpld reset nand: reset to boot from NAND flash\n"
 #ifdef DEBUG
 	"cpld dump - display the CPLD registers\n"
 #endif
board/freescale/ls1043ardb/cpld.h +1 -0
index ea4efd8..5f43a8a 100644
@@ -40,4 +40,5 @@ void cpld_rev_bit(unsigned char *value);
 #define CPLD_SW_MUX_BANK_SEL	0x40
 #define CPLD_BANK_SEL_MASK	0x07
 #define CPLD_BANK_SEL_ALTBANK	0x04
+#define CPLD_CFG_RCW_SRC_NAND	0x106
 #endif
Signature · 1 line
2.1.0.27.g96db324
#11 lore raw

PATCH 11/14 armv8/ls1043a: Add Fman support

In reply to Gong Qianyu

From: Shaohui Xie <[email protected]>

---
 arch/arm/cpu/armv8/fsl-lsch2/cpu.c      |  19 +++++
 arch/arm/cpu/armv8/fsl-lsch2/fdt.c      |   7 ++
 arch/arm/cpu/armv8/fsl-lsch2/speed.c    |  23 ++++++
 board/freescale/common/fman.c           |   6 +-
 board/freescale/ls1043ardb/Makefile     |   1 +
 board/freescale/ls1043ardb/eth.c        |  77 +++++++++++++++++++++
 board/freescale/ls1043ardb/ls1043ardb.c |   4 ++
 drivers/net/fm/Makefile                 |   1 +
 drivers/net/fm/init.c                   |  10 ++-
 drivers/net/fm/ls1043.c                 | 119 ++++++++++++++++++++++++++++++++
 include/configs/ls1043a_common.h        |  12 ++++
 include/configs/ls1043ardb.h            |  25 +++++++
 12 files changed, 301 insertions(+), 3 deletions(-)
arch/arm/cpu/armv8/fsl-lsch2/cpu.c +19 -0
index f81ad83..c358534 100644
@@ -11,6 +11,7 @@
 #include <asm/io.h>
 #include <asm/arch-fsl-lsch2/immap_lsch2.h>
 #include <asm/arch/fsl_serdes.h>
+#include <fm_eth.h>
 #include "speed.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -358,6 +359,9 @@ int print_cpuinfo(void)
 	printf("\n       Bus:      %-4s MHz  ",
 	       strmhz(buf, sysinfo.freq_systembus));
 	printf("DDR:      %-4s MT/s", strmhz(buf, sysinfo.freq_ddrbus));
+#ifdef CONFIG_SYS_DPAA_FMAN
+	printf("  FMAN:     %-4s MHz", strmhz(buf, sysinfo.freq_fman[0]));
+#endif
 	puts("\n");
 
 	/*
@@ -378,11 +382,26 @@ int print_cpuinfo(void)
 }
 #endif
 
+/*
+ * Initializes on-chip ethernet controllers.
+ * to override, implement board_eth_init()
+ */
+int cpu_eth_init(bd_t *bis)
+{
+#ifdef CONFIG_FMAN_ENET
+	fm_standard_init(bis);
+#endif
+	return 0;
+}
+
 int arch_early_init_r(void)
 {
 #ifdef CONFIG_SYS_HAS_SERDES
 	fsl_serdes_init();
 #endif
+#ifdef CONFIG_FMAN_ENET
+	fman_enet_init();
+#endif
 	return 0;
 }
 
arch/arm/cpu/armv8/fsl-lsch2/fdt.c +7 -0
index b4af812..fd9063d 100644
@@ -7,6 +7,13 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <phy.h>
+
+int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
+{
+	return fdt_setprop_string(blob, offset, "phy-connection-type",
+					 phy_string_for_interface(phyc));
+}
 
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
arch/arm/cpu/armv8/fsl-lsch2/speed.c +23 -0
index 2912d67..f5a7f73 100644
@@ -25,6 +25,9 @@ void get_sys_info(struct sys_info *sys_info)
 	struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
 	u32 ccr;
 #endif
+#ifdef CONFIG_SYS_DPAA_FMAN
+	u32 rcw_tmp;
+#endif
 	struct ccsr_clk *clk = (void *)(CONFIG_SYS_FSL_CLK_ADDR);
 	unsigned int cpu;
 	const u8 core_cplx_pll[8] = {
@@ -79,6 +82,26 @@ void get_sys_info(struct sys_info *sys_info)
 
 #define HWA_CGA_M1_CLK_SEL	0xe0000000
 #define HWA_CGA_M1_CLK_SHIFT	29
+#ifdef CONFIG_SYS_DPAA_FMAN
+	rcw_tmp = in_be32(&gur->rcwsr[7]);
+	switch ((rcw_tmp & HWA_CGA_M1_CLK_SEL) >> HWA_CGA_M1_CLK_SHIFT) {
+	case 2:
+		sys_info->freq_fman[0] = freq_c_pll[0] / 2;
+		break;
+	case 3:
+		sys_info->freq_fman[0] = freq_c_pll[0] / 3;
+		break;
+	case 6:
+		sys_info->freq_fman[0] = freq_c_pll[1] / 2;
+		break;
+	case 7:
+		sys_info->freq_fman[0] = freq_c_pll[1] / 3;
+		break;
+	default:
+		printf("Error: Unknown FMan1 clock select!\n");
+		break;
+	}
+#endif
 
 #define HWA_CGA_M2_CLK_SEL	0x00000007
 #define HWA_CGA_M2_CLK_SHIFT	0
board/freescale/common/fman.c +5 -1
index 9dc5402..e491064 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011-2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -10,7 +10,11 @@
 #include <fdt_support.h>
 
 #include <fm_eth.h>
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch/fsl_serdes.h>
+#else
 #include <asm/fsl_serdes.h>
+#endif
 
 /*
  * Given the following ...
board/freescale/ls1043ardb/Makefile +1 -0
index dd17e2e..5fe1cc9 100644
@@ -7,3 +7,4 @@
 obj-y += cpld.o
 obj-y += ddr.o
 obj-y += ls1043ardb.o
+obj-$(CONFIG_SYS_DPAA_FMAN) += eth.o
board/freescale/ls1043ardb/eth.c new file +77 -0

77 lines not on this page · raw message

board/freescale/ls1043ardb/ls1043ardb.c +4 -0
index 5f80b6d..81dd271 100644
@@ -15,6 +15,7 @@
 #include <ahci.h>
 #include <scsi.h>
 #include <fsl_esdhc.h>
+#include <fm_eth.h>
 #include <fsl_ifc.h>
 #include "cpld.h"
 #include "../common/ns_access.h"
@@ -111,6 +112,9 @@ int misc_init_r(void)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
+#ifdef CONFIG_SYS_DPAA_FMAN
+	fdt_fixup_fman_ethernet(blob);
+#endif
 	return 0;
 }
 
drivers/net/fm/Makefile +1 -0
index d052fcb..a3c9f99 100644
@@ -37,3 +37,4 @@ obj-$(CONFIG_PPC_T4160) += t4240.o
 obj-$(CONFIG_PPC_T4080) += t4240.o
 obj-$(CONFIG_PPC_B4420) += b4860.o
 obj-$(CONFIG_PPC_B4860) += b4860.o
+obj-$(CONFIG_LS1043A)	+= ls1043.o
drivers/net/fm/init.c +8 -2
index b3ff4c5..00a036c 100644
@@ -1,13 +1,17 @@
 /*
- * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011-2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
 #include <errno.h>
 #include <common.h>
 #include <asm/io.h>
-#include <asm/fsl_serdes.h>
 #include <fsl_mdio.h>
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch/fsl_serdes.h>
+#else
+#include <asm/fsl_serdes.h>
+#endif
 
 #include "fm.h"
 
@@ -153,7 +157,9 @@ void fm_disable_port(enum fm_port port)
 		return;
 
 	fm_info[i].enabled = 0;
+#ifndef CONFIG_SYS_FMAN_V3
 	fman_disable_port(port);
+#endif
 }
 
 void fm_enable_port(enum fm_port port)
drivers/net/fm/ls1043.c new file +119 -0

119 lines not on this page · raw message

include/configs/ls1043a_common.h +12 -0
index 4bda296..6c85bfc 100644
@@ -116,6 +116,18 @@
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MXC
 
+/* FMan ucode */
+#define CONFIG_SYS_DPAA_FMAN
+#ifdef CONFIG_SYS_DPAA_FMAN
+#define CONFIG_SYS_FM_MURAM_SIZE	0x60000
+
+#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
+/* FMan fireware Pre-load address */
+#define CONFIG_SYS_FMAN_FW_ADDR		0x60300000
+#define CONFIG_SYS_QE_FMAN_FW_LENGTH	0x10000
+#define CONFIG_SYS_FDT_PAD		(0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
+#endif
+
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LOAD_ADDR	(CONFIG_SYS_DDR_SDRAM_BASE + 0x10000000)
 #define CONFIG_ARCH_EARLY_INIT_R
include/configs/ls1043ardb.h +25 -0
index 5e6e09d..e612cee 100644
@@ -228,4 +228,29 @@
 #define CONFIG_ENV_SIZE			0x20000
 #endif
 
+/* FMan */
+#ifdef CONFIG_SYS_DPAA_FMAN
+#define CONFIG_FMAN_ENET
+#define CONFIG_MII
+#define CONFIG_PHYLIB
+#define CONFIG_PHYLIB_10G
+#define CONFIG_PHY_GIGE		/* Include GbE speed/duplex detection */
+
+#define CONFIG_PHY_VITESSE
+#define CONFIG_PHY_REALTEK
+#define CONFIG_PHY_AQUANTIA
+
+#define RGMII_PHY1_ADDR			0x1
+#define RGMII_PHY2_ADDR			0x2
+
+#define QSGMII_PORT1_PHY_ADDR		0x4
+#define QSGMII_PORT2_PHY_ADDR		0x5
+#define QSGMII_PORT3_PHY_ADDR		0x6
+#define QSGMII_PORT4_PHY_ADDR		0x7
+
+#define FM1_10GEC1_PHY_ADDR		0x1
+
+#define CONFIG_ETHPRIME			"FM1 at DTSEC3"
+#endif
+
 #endif /* __LS1043ARDB_H__ */
Signature · 1 line
2.1.0.27.g96db324
#12 lore raw

PATCH 12/14 armv8/ls1043ardb: esdhc: Add esdhc support for ls1043ardb

In reply to Gong Qianyu

From: Yangbo Lu <[email protected]>

This patch adds esdhc support for ls1043ardb.

---
 arch/arm/cpu/armv8/fsl-lsch2/cpu.c   | 10 ++++++++++
 arch/arm/cpu/armv8/fsl-lsch2/fdt.c   |  6 ++++++
 arch/arm/cpu/armv8/fsl-lsch2/speed.c | 18 +++++++++++++++++-
 drivers/mmc/fsl_esdhc.c              | 13 +++++++------
 include/configs/ls1043a_common.h     | 11 +++++++++++
 include/fsl_esdhc.h                  |  2 +-
 6 files changed, 52 insertions(+), 8 deletions(-)
arch/arm/cpu/armv8/fsl-lsch2/cpu.c +10 -0
index c358534..238cc68 100644
@@ -12,6 +12,9 @@
 #include <asm/arch-fsl-lsch2/immap_lsch2.h>
 #include <asm/arch/fsl_serdes.h>
 #include <fm_eth.h>
+#ifdef CONFIG_FSL_ESDHC
+#include <fsl_esdhc.h>
+#endif
 #include "speed.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -382,6 +385,13 @@ int print_cpuinfo(void)
 }
 #endif
 
+#ifdef CONFIG_FSL_ESDHC
+int cpu_mmc_init(bd_t *bis)
+{
+	return fsl_esdhc_mmc_init(bis);
+}
+#endif
+
 /*
  * Initializes on-chip ethernet controllers.
  * to override, implement board_eth_init()
arch/arm/cpu/armv8/fsl-lsch2/fdt.c +6 -0
index fd9063d..2650107 100644
@@ -8,6 +8,9 @@
 #include <libfdt.h>
 #include <fdt_support.h>
 #include <phy.h>
+#ifdef CONFIG_FSL_ESDHC
+#include <fsl_esdhc.h>
+#endif
 
 int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
 {
@@ -17,4 +20,7 @@ int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
 
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
+#if defined(CONFIG_FSL_ESDHC)
+	fdt_fixup_esdhc(blob, bd);
+#endif
 }
arch/arm/cpu/armv8/fsl-lsch2/speed.c +17 -1
index f5a7f73..e12d485 100644
@@ -25,7 +25,7 @@ void get_sys_info(struct sys_info *sys_info)
 	struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
 	u32 ccr;
 #endif
-#ifdef CONFIG_SYS_DPAA_FMAN
+#if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_SYS_DPAA_FMAN)
 	u32 rcw_tmp;
 #endif
 	struct ccsr_clk *clk = (void *)(CONFIG_SYS_FSL_CLK_ADDR);
@@ -105,6 +105,11 @@ void get_sys_info(struct sys_info *sys_info)
 
 #define HWA_CGA_M2_CLK_SEL	0x00000007
 #define HWA_CGA_M2_CLK_SHIFT	0
+#if defined(CONFIG_FSL_ESDHC)
+	rcw_tmp = in_be32(&gur->rcwsr[15]);
+	rcw_tmp = (rcw_tmp & HWA_CGA_M2_CLK_SEL) >> HWA_CGA_M2_CLK_SHIFT;
+	sys_info->freq_sdhc = freq_c_pll[1] / rcw_tmp;
+#endif
 
 #if defined(CONFIG_FSL_IFC)
 	ccr = in_le32(&ifc_regs.gregs->ifc_ccr);
@@ -123,6 +128,10 @@ int get_clocks(void)
 	gd->bus_clk = sys_info.freq_systembus;
 	gd->mem_clk = sys_info.freq_ddrbus;
 
+#if defined(CONFIG_FSL_ESDHC)
+	gd->arch.sdhc_clk = sys_info.freq_sdhc;
+#endif
+
 	if (gd->cpu_clk != 0)
 		return 0;
 	else
@@ -139,6 +148,11 @@ ulong get_ddr_freq(ulong dummy)
 	return gd->mem_clk;
 }
 
+int get_sdhc_freq(ulong dummy)
+{
+	return gd->arch.sdhc_clk;
+}
+
 int get_serial_clock(void)
 {
 	return gd->bus_clk;
@@ -149,6 +163,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
 	switch (clk) {
 	case MXC_I2C_CLK:
 		return get_bus_freq(0);
+	case MXC_ESDHC_CLK:
+		return get_sdhc_freq(0);
 	case MXC_DSPI_CLK:
 		return get_bus_freq(0);
 	case MXC_UART_CLK:
drivers/mmc/fsl_esdhc.c +7 -6
index 0b37002..0a22874 100644
@@ -106,7 +106,8 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
 		xfertyp |= XFERTYP_RSPTYP_48;
 
 #if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
-	defined(CONFIG_LS102XA) || defined(CONFIG_LS2085A)
+	defined(CONFIG_LS102XA) || defined(CONFIG_LS2085A) || \
+	defined(CONFIG_LS1043A)
 	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
 		xfertyp |= XFERTYP_CMDTYP_ABORT;
 #endif
@@ -184,7 +185,7 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 	int timeout;
 	struct fsl_esdhc_cfg *cfg = mmc->priv;
 	struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
-#ifdef CONFIG_LS2085A
+#if defined(CONFIG_LS2085A) || defined(CONFIG_LS1043A)
 	dma_addr_t addr;
 #endif
 	uint wml_value;
@@ -197,7 +198,7 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 
 		esdhc_clrsetbits32(&regs->wml, WML_RD_WML_MASK, wml_value);
 #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
-#ifdef CONFIG_LS2085A
+#if defined(CONFIG_LS2085A) || defined(CONFIG_LS1043A)
 		addr = virt_to_phys((void *)(data->dest));
 		if (upper_32_bits(addr))
 			printf("Error found for upper 32 bits\n");
@@ -223,7 +224,7 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 		esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK,
 					wml_value << 16);
 #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
-#ifdef CONFIG_LS2085A
+#if defined(CONFIG_LS2085A) || defined(CONFIG_LS1043A)
 		addr = virt_to_phys((void *)(data->src));
 		if (upper_32_bits(addr))
 			printf("Error found for upper 32 bits\n");
@@ -277,7 +278,7 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 static void check_and_invalidate_dcache_range
 	(struct mmc_cmd *cmd,
 	 struct mmc_data *data) {
-#ifdef CONFIG_LS2085A
+#if defined(CONFIG_LS2085A) || defined(CONFIG_LS1043A)
 	unsigned start = 0;
 #else
 	unsigned start = (unsigned)data->dest ;
@@ -285,7 +286,7 @@ static void check_and_invalidate_dcache_range
 	unsigned size = roundup(ARCH_DMA_MINALIGN,
 				data->blocks*data->blocksize);
 	unsigned end = start+size ;
-#ifdef CONFIG_LS2085A
+#if defined(CONFIG_LS2085A) || defined(CONFIG_LS1043A)
 	dma_addr_t addr;
 
 	addr = virt_to_phys((void *)(data->dest));
include/configs/ls1043a_common.h +11 -0
index 6c85bfc..bf1ddc7 100644
@@ -116,6 +116,17 @@
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MXC
 
+/*  MMC  */
+#define CONFIG_MMC
+#ifdef CONFIG_MMC
+#define CONFIG_CMD_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+#endif
+
 /* FMan ucode */
 #define CONFIG_SYS_DPAA_FMAN
 #ifdef CONFIG_SYS_DPAA_FMAN
include/fsl_esdhc.h +1 -1
index 0d00b7d..b6572e7 100644
@@ -166,7 +166,7 @@
 #define ESDHC_VENDORSPEC_VSELECT 0x00000002 /* Use 1.8V */
 
 struct fsl_esdhc_cfg {
-#ifdef CONFIG_LS2085A
+#if defined(CONFIG_LS2085A) || defined(CONFIG_LS1043A)
 	u64	esdhc_base;
 #else
 	u32	esdhc_base;
Signature · 1 line
2.1.0.27.g96db324
#13 lore raw

PATCH 13/14 armv8/ls1043ardb: Add sd boot support

In reply to Gong Qianyu
---
 board/freescale/ls1043ardb/ls1043ardb.c          |  8 +++++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg |  7 ++++++
 configs/ls1043ardb_sdcard_defconfig              |  4 ++++
 include/configs/ls1043a_common.h                 | 30 ++++++++++++++++++++++++
 include/configs/ls1043ardb.h                     | 13 ++++++++--
 5 files changed, 60 insertions(+), 2 deletions(-)
board/freescale/ls1043ardb/ls1043ardb.c +8 -0
index 81dd271..991404a 100644
@@ -12,11 +12,13 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
 #include <hwconfig.h>
+#include <mmc.h>
 #include <ahci.h>
 #include <scsi.h>
 #include <fsl_esdhc.h>
 #include <fm_eth.h>
 #include <fsl_ifc.h>
+#include <spl.h>
 #include "cpld.h"
 #include "../common/ns_access.h"
 
@@ -25,12 +27,17 @@ DECLARE_GLOBAL_DATA_PTR;
 int checkboard(void)
 {
 	static const char *freq[3] = {"100.00MHZ", "156.25MHZ"};
+#ifndef CONFIG_SD_BOOT
 	u8 cfg_rcw_src1, cfg_rcw_src2;
 	u32 cfg_rcw_src;
+#endif
 	u32 sd1refclk_sel;
 
 	printf("Board: LS1043ARDB, boot from ");
 
+#ifdef CONFIG_SD_BOOT
+	puts("SD\n");
+#else
 	cfg_rcw_src1 = CPLD_READ(cfg_rcw_src1);
 	cfg_rcw_src2 = CPLD_READ(cfg_rcw_src2);
 	cpld_rev_bit(&cfg_rcw_src1);
@@ -43,6 +50,7 @@ int checkboard(void)
 		puts("NAND\n");
 	else
 		printf("Invalid setting of SW4\n");
+#endif
 
 	printf("CPLD:  V%x.%x\nPCBA:  V%x.0\n", CPLD_READ(cpld_ver),
 	       CPLD_READ(cpld_ver_sub), CPLD_READ(pcba_ver));
board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg new file +7 -0
new file mode 100644
index 0000000..28cd958
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+aa55aa55 01ee0100
+# RCW
+0810000f 0c000000 00000000 00000000
+14550002 80004012 60040000 61002000
+00000000 00000000 00000000 00038800
+00000000 00001100 00000096 00000001
configs/ls1043ardb_sdcard_defconfig new file +4 -0
new file mode 100644
index 0000000..5fe0470
@@ -0,0 +1,4 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT,SYS_FSL_DDR4"
+CONFIG_ARM=y
+CONFIG_TARGET_LS1043ARDB=y
include/configs/ls1043a_common.h +30 -0
index bf1ddc7..1e726fb 100644
@@ -60,6 +60,36 @@
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
 
+/* SD boot SPL */
+#ifdef CONFIG_SD_BOOT
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
+#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR		0xf0
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS		0x500
+
+#define CONFIG_SPL_TEXT_BASE		0x10000000
+#define CONFIG_SPL_MAX_SIZE		0x1d000
+#define CONFIG_SPL_STACK		0x1001e000
+#define CONFIG_SPL_PAD_TO		0x1d000
+
+#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SYS_TEXT_BASE + \
+					CONFIG_SYS_MONITOR_LEN)
+#define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000
+#define CONFIG_SPL_BSS_START_ADDR	0x80100000
+#define CONFIG_SPL_BSS_MAX_SIZE		0x80000
+#define CONFIG_SYS_MONITOR_LEN		0xa0000
+#endif
+
 /* NAND SPL */
 #ifdef CONFIG_NAND_BOOT
 #define CONFIG_SPL_PBL_PAD
include/configs/ls1043ardb.h +11 -2
index e612cee..4565500 100644
@@ -12,7 +12,7 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
-#if defined(CONFIG_NAND_BOOT)
+#if defined(CONFIG_NAND_BOOT) || defined(CONFIG_SD_BOOT)
 #define CONFIG_SYS_TEXT_BASE		0x82000000
 #else
 #define CONFIG_SYS_TEXT_BASE		0x60100000
@@ -45,6 +45,10 @@
 #define CONFIG_SYS_FSL_PBL_RCW board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg
 #endif
 
+#ifdef CONFIG_SD_BOOT
+#define CONFIG_SYS_FSL_PBL_RCW board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg
+#endif
+
 /*
  * NOR Flash Definitions
  */
@@ -217,7 +221,12 @@
  */
 #define CONFIG_ENV_OVERWRITE
 
-#if defined(CONFIG_NAND_BOOT)
+#if defined(CONFIG_SD_BOOT)
+#define CONFIG_ENV_OFFSET		(1024 * 1024)
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV		0
+#define CONFIG_ENV_SIZE			0x2000
+#elif defined(CONFIG_NAND_BOOT)
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_SIZE			0x2000
 #define CONFIG_ENV_OFFSET		(10 * CONFIG_SYS_NAND_BLOCK_SIZE)
Signature · 1 line
2.1.0.27.g96db324
#14 lore raw

PATCH 14/14 armv8/ls1043ardb: Add cpld command to boot from sd

In reply to Gong Qianyu
---
 board/freescale/ls1043ardb/cpld.c | 17 +++++++++++++++++
 board/freescale/ls1043ardb/cpld.h |  1 +
 2 files changed, 18 insertions(+)
board/freescale/ls1043ardb/cpld.c +17 -0
index 5acb97d..faa0de8 100644
@@ -60,6 +60,20 @@ void cpld_set_nand(void)
 	CPLD_WRITE(system_rst, 1);
 }
 
+void cpld_set_sd(void)
+{
+	u16 reg = CPLD_CFG_RCW_SRC_SD;
+	u8 reg5 = (u8)(reg >> 1);
+	u8 reg6 = (u8)(reg & 1);
+	cpld_rev_bit(&reg5);
+
+	CPLD_WRITE(soft_mux_on, 1);
+
+	CPLD_WRITE(cfg_rcw_src1, reg5);
+	CPLD_WRITE(cfg_rcw_src2, reg6);
+
+	CPLD_WRITE(system_rst, 1);
+}
 #ifdef DEBUG
 static void cpld_dump_regs(void)
 {
@@ -108,6 +122,8 @@ int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			cpld_set_altbank();
 		else if (strcmp(argv[2], "nand") == 0)
 			cpld_set_nand();
+		else if (strcmp(argv[2], "sd") == 0)
+			cpld_set_sd();
 		else
 			cpld_set_defbank();
 #ifdef DEBUG
@@ -127,6 +143,7 @@ U_BOOT_CMD(
 	"reset: reset to default bank\n"
 	"cpld reset altbank: reset to alternate bank\n"
 	"cpld reset nand: reset to boot from NAND flash\n"
+	"cpld reset sd: reset to boot from SD card\n"
 #ifdef DEBUG
 	"cpld dump - display the CPLD registers\n"
 #endif
board/freescale/ls1043ardb/cpld.h +1 -0
index 5f43a8a..bd59c0e 100644
@@ -41,4 +41,5 @@ void cpld_rev_bit(unsigned char *value);
 #define CPLD_BANK_SEL_MASK	0x07
 #define CPLD_BANK_SEL_ALTBANK	0x04
 #define CPLD_CFG_RCW_SRC_NAND	0x106
+#define CPLD_CFG_RCW_SRC_SD	0x040
 #endif
Signature · 1 line
2.1.0.27.g96db324