Skip to contentSkip to conversation

Add LS1043A platform support

PATCH Superseded Gong Qianyu 3 participants 27 messages Oct 15, 2015 – Oct 19, 2015

Subsystems (9)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add LS1043A platform support

Hi all,

Here are the main changes for v5, please help to review.
- Wrap up the in_be32 and in_le32 to gur_in32/scfg_in32 for GUR/SCFG block
- Move DDR related macros moved out of #ifdef in config.h
- Move the mmu table to cpu.h
- Change commit message for patch: armv8/fsl_lsch3: Change arch to fsl-layerscape

[Patch V5 01/17] armv7/ls1021a: move ns_access to common file [Patch V5 02/17] common/board_f.c: modify the macro to use [Patch V5 03/17] net/fm: Fix the endian issue to support both [Patch V5 04/17] net/fm/eth: Use mb() to be compatible for both ARM [Patch V5 05/17] net/fm: Add support for 64-bit platforms [Patch V5 06/17] net/fm: Make the return value logic consistent with [Patch V5 07/17] net/fm: bug fix when CONFIG_PHYLIB not defined [Patch V5 08/17] net: Move some header files to include/ [Patch V5 09/17] net/fm: Add QSGMII PCS init
[Patch V5 10/17] net/fm: fix MDIO controller base on FMAN2 [Patch V5 11/17] armv8/fsl_lsch3: Change arch to fsl-layerscape [Patch V5 12/17] armv8/fsl_lsch2: Add fsl_lsch2 SoC [Patch V5 13/17] armv8/ls1043ardb: Add LS1043ARDB board support [Patch V5 14/17] armv8/ls1043ardb: Add nand boot support [Patch V5 15/17] armv8/ls1043a: Add Fman support
[Patch V5 16/17] armv8/ls1043ardb: esdhc: Add esdhc support for [Patch V5 17/17] armv8/ls1043ardb: Add sd boot support

Thanks,
Qianyu

#1 lore raw

PATCH v5 1/17 armv7/ls1021a: move ns_access to common file

From: Mingkai Hu <[email protected]>

Config Security Level Register is different between different SoCs, so put the CSL register definition into the arch specific directory.

---
V5:
- No change.
V4:
- No change.
V3:
- No change.
V2:
- Create include/fsl_csu.h instead of board/freescale/common/ns_access.h

 arch/arm/include/asm/arch-ls102xa/ns_access.h | 103 ++++++++++++++++++++------
 board/freescale/common/Makefile               |   2 +-
 board/freescale/common/ns_access.c            |   8 +-
 board/freescale/ls1021aqds/ls1021aqds.c       | 101 ++-----------------------
 board/freescale/ls1021atwr/ls1021atwr.c       |  92 +----------------------
 include/configs/ls1021aqds.h                  |   2 +-
 include/configs/ls1021atwr.h                  |   2 +-
 include/fsl_csu.h                             |  34 +++++++++
 8 files changed, 136 insertions(+), 208 deletions(-)
arch/arm/include/asm/arch-ls102xa/ns_access.h +82 -21
index b53f699..a921fb6 100644
@@ -7,22 +7,6 @@
 #ifndef __FSL_NS_ACCESS_H_
 #define __FSL_NS_ACCESS_H_
 
-enum csu_cslx_access {
-	CSU_NS_SUP_R = 0x08,
-	CSU_NS_SUP_W = 0x80,
-	CSU_NS_SUP_RW = 0x88,
-	CSU_NS_USER_R = 0x04,
-	CSU_NS_USER_W = 0x40,
-	CSU_NS_USER_RW = 0x44,
-	CSU_S_SUP_R = 0x02,
-	CSU_S_SUP_W = 0x20,
-	CSU_S_SUP_RW = 0x22,
-	CSU_S_USER_R = 0x01,
-	CSU_S_USER_W = 0x10,
-	CSU_S_USER_RW = 0x11,
-	CSU_ALL_RW = 0xff,
-};
-
 enum csu_cslx_ind {
 	CSU_CSLX_PCIE2_IO = 0,
 	CSU_CSLX_PCIE1_IO,
@@ -108,11 +92,88 @@ enum csu_cslx_ind {
 	CSU_CSLX_MAX,
 };
 
-struct csu_ns_dev {
-	unsigned long ind;
-	uint32_t val;
+static struct csu_ns_dev ns_dev[] = {
+	{ CSU_CSLX_PCIE2_IO, CSU_ALL_RW },
+	{ CSU_CSLX_PCIE1_IO, CSU_ALL_RW },
+	{ CSU_CSLX_MG2TPR_IP, CSU_ALL_RW },
+	{ CSU_CSLX_IFC_MEM, CSU_ALL_RW },
+	{ CSU_CSLX_OCRAM, CSU_ALL_RW },
+	{ CSU_CSLX_GIC, CSU_ALL_RW },
+	{ CSU_CSLX_PCIE1, CSU_ALL_RW },
+	{ CSU_CSLX_OCRAM2, CSU_ALL_RW },
+	{ CSU_CSLX_QSPI_MEM, CSU_ALL_RW },
+	{ CSU_CSLX_PCIE2, CSU_ALL_RW },
+	{ CSU_CSLX_SATA, CSU_ALL_RW },
+	{ CSU_CSLX_USB3, CSU_ALL_RW },
+	{ CSU_CSLX_SERDES, CSU_ALL_RW },
+	{ CSU_CSLX_QDMA, CSU_ALL_RW },
+	{ CSU_CSLX_LPUART2, CSU_ALL_RW },
+	{ CSU_CSLX_LPUART1, CSU_ALL_RW },
+	{ CSU_CSLX_LPUART4, CSU_ALL_RW },
+	{ CSU_CSLX_LPUART3, CSU_ALL_RW },
+	{ CSU_CSLX_LPUART6, CSU_ALL_RW },
+	{ CSU_CSLX_LPUART5, CSU_ALL_RW },
+	{ CSU_CSLX_DSPI2, CSU_ALL_RW },
+	{ CSU_CSLX_DSPI1, CSU_ALL_RW },
+	{ CSU_CSLX_QSPI, CSU_ALL_RW },
+	{ CSU_CSLX_ESDHC, CSU_ALL_RW },
+	{ CSU_CSLX_2D_ACE, CSU_ALL_RW },
+	{ CSU_CSLX_IFC, CSU_ALL_RW },
+	{ CSU_CSLX_I2C1, CSU_ALL_RW },
+	{ CSU_CSLX_USB2, CSU_ALL_RW },
+	{ CSU_CSLX_I2C3, CSU_ALL_RW },
+	{ CSU_CSLX_I2C2, CSU_ALL_RW },
+	{ CSU_CSLX_DUART2, CSU_ALL_RW },
+	{ CSU_CSLX_DUART1, CSU_ALL_RW },
+	{ CSU_CSLX_WDT2, CSU_ALL_RW },
+	{ CSU_CSLX_WDT1, CSU_ALL_RW },
+	{ CSU_CSLX_EDMA, CSU_ALL_RW },
+	{ CSU_CSLX_SYS_CNT, CSU_ALL_RW },
+	{ CSU_CSLX_DMA_MUX2, CSU_ALL_RW },
+	{ CSU_CSLX_DMA_MUX1, CSU_ALL_RW },
+	{ CSU_CSLX_DDR, CSU_ALL_RW },
+	{ CSU_CSLX_QUICC, CSU_ALL_RW },
+	{ CSU_CSLX_DCFG_CCU_RCPM, CSU_ALL_RW },
+	{ CSU_CSLX_SECURE_BOOTROM, CSU_ALL_RW },
+	{ CSU_CSLX_SFP, CSU_ALL_RW },
+	{ CSU_CSLX_TMU, CSU_ALL_RW },
+	{ CSU_CSLX_SECURE_MONITOR, CSU_ALL_RW },
+	{ CSU_CSLX_RESERVED0, CSU_ALL_RW },
+	{ CSU_CSLX_ETSEC1, CSU_ALL_RW },
+	{ CSU_CSLX_SEC5_5, CSU_ALL_RW },
+	{ CSU_CSLX_ETSEC3, CSU_ALL_RW },
+	{ CSU_CSLX_ETSEC2, CSU_ALL_RW },
+	{ CSU_CSLX_GPIO2, CSU_ALL_RW },
+	{ CSU_CSLX_GPIO1, CSU_ALL_RW },
+	{ CSU_CSLX_GPIO4, CSU_ALL_RW },
+	{ CSU_CSLX_GPIO3, CSU_ALL_RW },
+	{ CSU_CSLX_PLATFORM_CONT, CSU_ALL_RW },
+	{ CSU_CSLX_CSU, CSU_ALL_RW },
+	{ CSU_CSLX_ASRC, CSU_ALL_RW },
+	{ CSU_CSLX_SPDIF, CSU_ALL_RW },
+	{ CSU_CSLX_FLEXCAN2, CSU_ALL_RW },
+	{ CSU_CSLX_FLEXCAN1, CSU_ALL_RW },
+	{ CSU_CSLX_FLEXCAN4, CSU_ALL_RW },
+	{ CSU_CSLX_FLEXCAN3, CSU_ALL_RW },
+	{ CSU_CSLX_SAI2, CSU_ALL_RW },
+	{ CSU_CSLX_SAI1, CSU_ALL_RW },
+	{ CSU_CSLX_SAI4, CSU_ALL_RW },
+	{ CSU_CSLX_SAI3, CSU_ALL_RW },
+	{ CSU_CSLX_FTM2, CSU_ALL_RW },
+	{ CSU_CSLX_FTM1, CSU_ALL_RW },
+	{ CSU_CSLX_FTM4, CSU_ALL_RW },
+	{ CSU_CSLX_FTM3, CSU_ALL_RW },
+	{ CSU_CSLX_FTM6, CSU_ALL_RW },
+	{ CSU_CSLX_FTM5, CSU_ALL_RW },
+	{ CSU_CSLX_FTM8, CSU_ALL_RW },
+	{ CSU_CSLX_FTM7, CSU_ALL_RW },
+	{ CSU_CSLX_COP_DCSR, CSU_ALL_RW },
+	{ CSU_CSLX_EPU, CSU_ALL_RW },
+	{ CSU_CSLX_GDI, CSU_ALL_RW },
+	{ CSU_CSLX_DDI, CSU_ALL_RW },
+	{ CSU_CSLX_RESERVED1, CSU_ALL_RW },
+	{ CSU_CSLX_USB3_PHY, CSU_ALL_RW },
+	{ CSU_CSLX_RESERVED2, CSU_ALL_RW },
 };
 
-void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num);
-
 #endif
board/freescale/common/Makefile +1 -1
index 87d0578..51d2814 100644
@@ -71,7 +71,7 @@ obj-$(CONFIG_P4080DS)	+= p_corenet/
 obj-$(CONFIG_P5020DS)	+= p_corenet/
 obj-$(CONFIG_P5040DS)	+= p_corenet/
 
-obj-$(CONFIG_LS102XA_NS_ACCESS)	+= ns_access.o
+obj-$(CONFIG_LAYERSCAPE_NS_ACCESS)	+= ns_access.o
 
 ifdef CONFIG_SECURE_BOOT
 obj-$(CONFIG_CMD_ESBC_VALIDATE) += fsl_validate.o cmd_esbc_validate.o
board/freescale/common/ns_access.c +7 -1
index d7de982..d8d16c5 100644
@@ -6,9 +6,10 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <fsl_csu.h>
 #include <asm/arch/ns_access.h>
 
-void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
+static void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
 {
 	u32 *base = (u32 *)CONFIG_SYS_FSL_CSU_ADDR;
 	u32 *reg;
@@ -28,3 +29,8 @@ void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
 		out_be32(reg, val);
 	}
 }
+
+void enable_layerscape_ns_access(void)
+{
+	enable_devices_ns_access(ns_dev, ARRAY_SIZE(ns_dev));
+}
board/freescale/ls1021aqds/ls1021aqds.c +7 -94

137 lines not on this page · raw message

board/freescale/ls1021atwr/ls1021atwr.c +3 -89

116 lines not on this page · raw message

include/configs/ls1021aqds.h +1 -1
index f73900f..9b8b001 100644
@@ -563,7 +563,7 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_ARMV7_NONSEC
 #define CONFIG_ARMV7_VIRT
 #define CONFIG_PEN_ADDR_BIG_ENDIAN
-#define CONFIG_LS102XA_NS_ACCESS
+#define CONFIG_LAYERSCAPE_NS_ACCESS
 #define CONFIG_SMP_PEN_ADDR		0x01ee0200
 #define CONFIG_TIMER_CLK_FREQ		12500000
 
include/configs/ls1021atwr.h +1 -1
index 02cc09c..676c096 100644
@@ -415,7 +415,7 @@
 #define CONFIG_ARMV7_NONSEC
 #define CONFIG_ARMV7_VIRT
 #define CONFIG_PEN_ADDR_BIG_ENDIAN
-#define CONFIG_LS102XA_NS_ACCESS
+#define CONFIG_LAYERSCAPE_NS_ACCESS
 #define CONFIG_SMP_PEN_ADDR		0x01ee0200
 #define CONFIG_TIMER_CLK_FREQ		12500000
 
include/fsl_csu.h new file +34 -0
new file mode 100644
index 0000000..f4d97fb
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ */
+
+#ifndef __FSL_CSU_H__
+#define __FSL_CSU_H__
+
+enum csu_cslx_access {
+	CSU_NS_SUP_R = 0x08,
+	CSU_NS_SUP_W = 0x80,
+	CSU_NS_SUP_RW = 0x88,
+	CSU_NS_USER_R = 0x04,
+	CSU_NS_USER_W = 0x40,
+	CSU_NS_USER_RW = 0x44,
+	CSU_S_SUP_R = 0x02,
+	CSU_S_SUP_W = 0x20,
+	CSU_S_SUP_RW = 0x22,
+	CSU_S_USER_R = 0x01,
+	CSU_S_USER_W = 0x10,
+	CSU_S_USER_RW = 0x11,
+	CSU_ALL_RW = 0xff,
+};
+
+struct csu_ns_dev {
+	unsigned long ind;
+	uint32_t val;
+};
+
+void enable_layerscape_ns_access(void);
+
+#endif
Signature · 1 line
2.1.0.27.g96db324
#2 lore raw

PATCH v5 2/17 common/board_f.c: modify the macro to use get_clocks() more common

In reply to Gong Qianyu

get_clocks() should not be limited by ESDHC.

---
V5:
- No change.
V4:
- No change.
V3:
- Removed defines in PPC configs that have no need to use.
V2:
- No change.

 common/board_f.c                  | 2 +-
 include/configs/colibri_vf.h      | 1 +
 include/configs/ls1021aqds.h      | 1 +
 include/configs/ls1021atwr.h      | 1 +
 include/configs/ls2085aqds.h      | 1 +
 include/configs/ls2085ardb.h      | 1 +
 include/configs/m53evk.h          | 1 +
 include/configs/mx25pdk.h         | 1 +
 include/configs/mx35pdk.h         | 1 +
 include/configs/mx51evk.h         | 1 +
 include/configs/mx53ard.h         | 1 +
 include/configs/mx53evk.h         | 1 +
 include/configs/mx53loco.h        | 1 +
 include/configs/mx53smd.h         | 1 +
 include/configs/mx6_common.h      | 1 +
 include/configs/mx7_common.h      | 1 +
 include/configs/usbarmory.h       | 1 +
 include/configs/vf610twr.h        | 1 +
 include/configs/woodburn_common.h | 1 +
 19 files changed, 19 insertions(+), 1 deletion(-)
common/board_f.c +1 -1
index 613332e..1bb84b3 100644
@@ -806,7 +806,7 @@ static init_fnc_t init_sequence_f[] = {
 #if defined(CONFIG_BOARD_POSTCLK_INIT)
 	board_postclk_init,
 #endif
-#ifdef CONFIG_FSL_ESDHC
+#ifdef CONFIG_FSL_CLK
 	get_clocks,
 #endif
 #ifdef CONFIG_M68K
include/configs/colibri_vf.h +1 -0
index 2583155..5bd742d 100644
@@ -18,6 +18,7 @@
 #define CONFIG_SYS_THUMB_BUILD
 #define CONFIG_USE_ARCH_MEMCPY
 #define CONFIG_USE_ARCH_MEMSET
+#define CONFIG_FSL_CLK
 
 #define CONFIG_SYS_GENERIC_BOARD
 #define CONFIG_ARCH_MISC_INIT
include/configs/ls1021aqds.h +1 -0
index 9b8b001..42b66b3 100644
@@ -12,6 +12,7 @@
 #define CONFIG_ARMV7_PSCI
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
include/configs/ls1021atwr.h +1 -0
index 676c096..8a86473 100644
@@ -12,6 +12,7 @@
 #define CONFIG_ARMV7_PSCI
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
include/configs/ls2085aqds.h +1 -0
index f7f3870..4cfcf98 100644
@@ -16,6 +16,7 @@ unsigned long get_board_sys_clk(void);
 unsigned long get_board_ddr_clk(void);
 #endif
 
+#define CONFIG_FSL_CLK
 #define CONFIG_SYS_CLK_FREQ		get_board_sys_clk()
 #define CONFIG_DDR_CLK_FREQ		get_board_ddr_clk()
 #define COUNTER_FREQUENCY_REAL		(CONFIG_SYS_CLK_FREQ/4)
include/configs/ls2085ardb.h +1 -0
index a190bc7..583fed5 100644
@@ -18,6 +18,7 @@
 unsigned long get_board_sys_clk(void);
 #endif
 
+#define CONFIG_FSL_CLK
 #define CONFIG_SYS_CLK_FREQ		get_board_sys_clk()
 #define CONFIG_DDR_CLK_FREQ		133333333
 #define COUNTER_FREQUENCY_REAL		(CONFIG_SYS_CLK_FREQ/4)
include/configs/m53evk.h +1 -0
index 8853d8f..456e5b4 100644
@@ -18,6 +18,7 @@
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_REVISION_TAG
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_FSL_CLK
 
 #define CONFIG_FIT
 
include/configs/mx25pdk.h +1 -0
index 0414086..afe2a02 100644
@@ -15,6 +15,7 @@
 #define CONFIG_SYS_TEXT_BASE		0x81200000
 #define CONFIG_MXC_GPIO
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 #define CONFIG_SYS_TIMER_RATE		32768
 #define CONFIG_SYS_TIMER_COUNTER	\
include/configs/mx35pdk.h +1 -0
index 6bfdaa6..dca2f86 100644
@@ -20,6 +20,7 @@
 
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 /* Set TEXT at the beginning of the NOR flash */
 #define CONFIG_SYS_TEXT_BASE	0xA0000000
include/configs/mx51evk.h +1 -0
index 2203c15..e3763c1 100644
@@ -18,6 +18,7 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
+#define CONFIG_FSL_CLK
 #define CONFIG_SYS_TEXT_BASE	0x97800000
 
 #include <asm/arch/imx-regs.h>
include/configs/mx53ard.h +1 -0
index b889c25..9ef973d 100644
@@ -24,6 +24,7 @@
 #define CONFIG_REVISION_TAG
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2 * 1024 * 1024)
include/configs/mx53evk.h +1 -0
index 4f304ed..56ef9e6 100644
@@ -24,6 +24,7 @@
 #define CONFIG_REVISION_TAG
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 #define CONFIG_OF_LIBFDT
 
include/configs/mx53loco.h +1 -0
index 3a65861..7b2917f 100644
@@ -23,6 +23,7 @@
 #define CONFIG_INITRD_TAG
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(10 * 1024 * 1024)
include/configs/mx53smd.h +1 -0
index e46f2ee..5b21dd5 100644
@@ -24,6 +24,7 @@
 #define CONFIG_REVISION_TAG
 
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 2 * 1024 * 1024)
include/configs/mx6_common.h +1 -0
index ef4cb68..c157e81 100644
@@ -46,6 +46,7 @@
 #define CONFIG_DISPLAY_BOARDINFO
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_FSL_CLK
 
 /* ATAGs */
 #define CONFIG_CMDLINE_TAG
include/configs/mx7_common.h +1 -0
index ea2be49..85c8df8 100644
@@ -21,6 +21,7 @@
 #define CONFIG_MXC_GPT_HCLK
 #define CONFIG_SYSCOUNTER_TIMER
 #define CONFIG_SC_TIMER_CLK 8000000 /* 8Mhz */
+#define CONFIG_FSL_CLK
 
 /* Enable iomux-lpsr support */
 #define CONFIG_IOMUX_LPSR
include/configs/usbarmory.h +1 -0
index 714e3e2..e8cbd8f 100644
@@ -14,6 +14,7 @@
 #define CONFIG_MX53
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_FSL_CLK
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_OF_LIBFDT
 #define CONFIG_SYS_GENERIC_BOARD
include/configs/vf610twr.h +1 -0
index 324ba8f..a7c3e68 100644
@@ -16,6 +16,7 @@
 #define CONFIG_SYS_GENERIC_BOARD
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
+#define CONFIG_FSL_CLK
 
 #define CONFIG_MACH_TYPE		4146
 
include/configs/woodburn_common.h +1 -0
index fc46565..76d22e7 100644
@@ -16,6 +16,7 @@
  /* High Level Configuration Options */
 #define CONFIG_MX35
 #define CONFIG_MX35_HCLK_FREQ	24000000
+#define CONFIG_FSL_CLK
 
 #define CONFIG_SYS_DCACHE_OFF
 #define CONFIG_SYS_CACHELINE_SIZE	32
Signature · 1 line
2.1.0.27.g96db324
#3 lore raw

PATCH v5 2/17 common/board_f.c: modify the macro to use get_clocks() more common

Quoted 55 lines

-----Original Message-----
From: Gong Qianyu [mailto:Qianyu.Gong at freescale.com]
Sent: Thursday, October 15, 2015 6:32 PM
To: u-boot at lists.denx.de
Cc: Hu Mingkai-B21284 <[email protected]>; Sun York-R58495 <[email protected]>; Hou Zhiqiang-B48286 <[email protected]>; Xie Shaohui-B21989 <[email protected]>; Song Wenbin-B53747 <[email protected]>; Wood Scott-B07421 <[email protected]>; Kushwaha Prabhakar-B32579 <[email protected]>; Wang Huan-B18965 <[email protected]>; Gong Qianyu-B52263 <[email protected]>
Subject: [Patch V5 02/17] common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

---
V5:
- No change.
V4:
- No change.
V3:
- Removed defines in PPC configs that have no need to use.
V2:
- No change.

 common/board_f.c                  | 2 +-
 include/configs/colibri_vf.h      | 1 +
 include/configs/ls1021aqds.h      | 1 +
 include/configs/ls1021atwr.h      | 1 +
 include/configs/ls2085aqds.h      | 1 +
 include/configs/ls2085ardb.h      | 1 +
 include/configs/m53evk.h          | 1 +
 include/configs/mx25pdk.h         | 1 +
 include/configs/mx35pdk.h         | 1 +
 include/configs/mx51evk.h         | 1 +
 include/configs/mx53ard.h         | 1 +
 include/configs/mx53evk.h         | 1 +
 include/configs/mx53loco.h        | 1 +
 include/configs/mx53smd.h         | 1 +
 include/configs/mx6_common.h      | 1 +
 include/configs/mx7_common.h      | 1 +
 include/configs/usbarmory.h       | 1 +
 include/configs/vf610twr.h        | 1 +
 include/configs/woodburn_common.h | 1 +
 19 files changed, 19 insertions(+), 1 deletion(-)
common/board_f.c index 613332e..1bb84b3 renamed from common/board_f.c +0 -0

100644

common/board_f.c static init_fnc_t init_sequence_f[] = { #if · line 811

Quoted 7 lines
common/board_f.c +1 -1
@@ -806,7 +806,7 @@ static init_fnc_t init_sequence_f[] = {  #if
 defined(CONFIG_BOARD_POSTCLK_INIT)
 	board_postclk_init,
 #endif
-#ifdef CONFIG_FSL_ESDHC
+#ifdef CONFIG_FSL_CLK
 	get_clocks,
 #endif

New define CONFIG_FSL_CLK used. Please add its description in README file.

Also, is there no need of defining CONFIG_FSL_CLK for PowerPC platforms?

--prabhakar

author
#4 lore raw

PATCH v5 2/17 common/board_f.c: modify the macro to use get_clocks() more common

Quoted 77 lines

-----Original Message-----
From: Kushwaha Prabhakar-B32579
Sent: Friday, October 16, 2015 12:08 PM
To: Gong Qianyu-B52263; u-boot at lists.denx.de
Cc: Hu Mingkai-B21284; Sun York-R58495; Hou Zhiqiang-B48286; Xie Shaohui- B21989; Song Wenbin-B53747; Wood Scott-B07421; Wang Huan-B18965; Gong Qianyu-B52263
Subject: RE: [Patch V5 02/17] common/board_f.c: modify the macro to use get_clocks() more common

Quoted 55 lines

-----Original Message-----
From: Gong Qianyu [mailto:Qianyu.Gong at freescale.com]
Sent: Thursday, October 15, 2015 6:32 PM
To: u-boot at lists.denx.de
Cc: Hu Mingkai-B21284 <[email protected]>; Sun York-R58495 <[email protected]>; Hou Zhiqiang-B48286 <[email protected]>; Xie Shaohui-B21989 <[email protected]>; Song Wenbin-B53747 <[email protected]>; Wood Scott-B07421 <[email protected]>; Kushwaha Prabhakar-B32579 <[email protected]>; Wang Huan-B18965 <[email protected]>; Gong Qianyu-B52263 <[email protected]>
Subject: [Patch V5 02/17] common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

---
V5:
- No change.
V4:
- No change.
V3:
- Removed defines in PPC configs that have no need to use.
V2:
- No change.

 common/board_f.c                  | 2 +-
 include/configs/colibri_vf.h      | 1 +
 include/configs/ls1021aqds.h      | 1 +
 include/configs/ls1021atwr.h      | 1 +
 include/configs/ls2085aqds.h      | 1 +
 include/configs/ls2085ardb.h      | 1 +
 include/configs/m53evk.h          | 1 +
 include/configs/mx25pdk.h         | 1 +
 include/configs/mx35pdk.h         | 1 +
 include/configs/mx51evk.h         | 1 +
 include/configs/mx53ard.h         | 1 +
 include/configs/mx53evk.h         | 1 +
 include/configs/mx53loco.h        | 1 +
 include/configs/mx53smd.h         | 1 +
 include/configs/mx6_common.h      | 1 +
 include/configs/mx7_common.h      | 1 +
 include/configs/usbarmory.h       | 1 +
 include/configs/vf610twr.h        | 1 +
 include/configs/woodburn_common.h | 1 +
 19 files changed, 19 insertions(+), 1 deletion(-)
common/board_f.c index renamed from common/board_f.c +0 -0

613332e..1bb84b3
100644

common/board_f.c static init_fnc_t init_sequence_f[] = { #if · line 811

Quoted 7 lines
common/board_f.c +1 -1
@@ -806,7 +806,7 @@ static init_fnc_t init_sequence_f[] = {  #if
 defined(CONFIG_BOARD_POSTCLK_INIT)
 	board_postclk_init,
 #endif
-#ifdef CONFIG_FSL_ESDHC
+#ifdef CONFIG_FSL_CLK
 	get_clocks,
 #endif

New define CONFIG_FSL_CLK used. Please add its description in README file.

Quoted 3 lines

Also, is there no need of defining CONFIG_FSL_CLK for PowerPC platforms?

--prabhakar

No. They have already called the first get_clocks() in init_sequence_f[] as they define CONFIG_PPC. CONFIG_FSL_CLK is then used to call the second get_clocks(), which may be redundant for PPC.

Regards,
Qianyu

#5 lore raw

PATCH v5 3/17 net/fm: Fix the endian issue to support both endianness platforms

In reply to Gong Qianyu

From: Hou Zhiqiang <[email protected]>

The Frame Manager(FMan) is a big-endian peripheral, so the registers, internal MURAM and BDs, which are allocated in main memory and used to communication between core and FMan, should be accessed in big-endian. The big-endian platforms can access them directly as the code implemented so far, while for the little-endian platforms it need to swap the byte-order.

---
V5:
- No change.
V4:
- No change.
V3:
- Modify the subject to make the aim clear.
V2:
- No change.

 drivers/net/fm/eth.c | 70 +++++++++++++++++++++++++++-------------------------
 drivers/net/fm/fm.c  | 11 +++++----
 2 files changed, 43 insertions(+), 38 deletions(-)
drivers/net/fm/eth.c +37 -33
index 6702f5a..368d554 100644
@@ -109,7 +109,7 @@ static int tgec_is_fibre(struct eth_device *dev)
 static u16 muram_readw(u16 *addr)
 {
 	u32 base = (u32)addr & ~0x3;
-	u32 val32 = *(u32 *)base;
+	u32 val32 = in_be32((u32 *)base);
 	int byte_pos;
 	u16 ret;
 
@@ -125,7 +125,7 @@ static u16 muram_readw(u16 *addr)
 static void muram_writew(u16 *addr, u16 val)
 {
 	u32 base = (u32)addr & ~0x3;
-	u32 org32 = *(u32 *)base;
+	u32 org32 = in_be32((u32 *)base);
 	u32 val32;
 	int byte_pos;
 
@@ -135,7 +135,7 @@ static void muram_writew(u16 *addr, u16 val)
 	else
 		val32 = (org32 & 0x0000ffff) | ((u32)val << 16);
 
-	*(u32 *)base = val32;
+	out_be32((u32 *)base, val32);
 }
 
 static void bmi_rx_port_disable(struct fm_bmi_rx_port *rx_port)
@@ -213,10 +213,10 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	pram_page_offset = (u32)pram - fm_muram_base(fm_eth->fm_index);
 
 	/* enable global mode- snooping data buffers and BDs */
-	pram->mode = PRAM_MODE_GLOBAL;
+	out_be32(&pram->mode, PRAM_MODE_GLOBAL);
 
 	/* init the Rx queue descriptor pionter */
-	pram->rxqd_ptr = pram_page_offset + 0x20;
+	out_be32(&pram->rxqd_ptr, pram_page_offset + 0x20);
 
 	/* set the max receive buffer length, power of 2 */
 	muram_writew(&pram->mrblr, MAX_RXBUF_LOG2);
@@ -243,10 +243,11 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	/* init Rx BDs ring */
 	rxbd = (struct fm_port_bd *)rx_bd_ring_base;
 	for (i = 0; i < RX_BD_RING_SIZE; i++) {
-		rxbd->status = RxBD_EMPTY;
-		rxbd->len = 0;
-		rxbd->buf_ptr_hi = 0;
-		rxbd->buf_ptr_lo = (u32)rx_buf_pool + i * MAX_RXBUF_LEN;
+		muram_writew(&rxbd->status, RxBD_EMPTY);
+		muram_writew(&rxbd->len, 0);
+		muram_writew(&rxbd->buf_ptr_hi, 0);
+		out_be32(&rxbd->buf_ptr_lo, (u32)rx_buf_pool +
+				i * MAX_RXBUF_LEN);
 		rxbd++;
 	}
 
@@ -254,7 +255,7 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	rxqd = &pram->rxqd;
 	muram_writew(&rxqd->gen, 0);
 	muram_writew(&rxqd->bd_ring_base_hi, 0);
-	rxqd->bd_ring_base_lo = (u32)rx_bd_ring_base;
+	out_be32(&rxqd->bd_ring_base_lo, (u32)rx_bd_ring_base);
 	muram_writew(&rxqd->bd_ring_size, sizeof(struct fm_port_bd)
 			* RX_BD_RING_SIZE);
 	muram_writew(&rxqd->offset_in, 0);
@@ -285,10 +286,10 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 	pram_page_offset = (u32)pram - fm_muram_base(fm_eth->fm_index);
 
 	/* enable global mode- snooping data buffers and BDs */
-	pram->mode = PRAM_MODE_GLOBAL;
+	out_be32(&pram->mode, PRAM_MODE_GLOBAL);
 
 	/* init the Tx queue descriptor pionter */
-	pram->txqd_ptr = pram_page_offset + 0x40;
+	out_be32(&pram->txqd_ptr, pram_page_offset + 0x40);
 
 	/* alloc Tx buffer descriptors from main memory */
 	tx_bd_ring_base = malloc(sizeof(struct fm_port_bd)
@@ -304,16 +305,17 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 	/* init Tx BDs ring */
 	txbd = (struct fm_port_bd *)tx_bd_ring_base;
 	for (i = 0; i < TX_BD_RING_SIZE; i++) {
-		txbd->status = TxBD_LAST;
-		txbd->len = 0;
-		txbd->buf_ptr_hi = 0;
-		txbd->buf_ptr_lo = 0;
+		muram_writew(&txbd->status, TxBD_LAST);
+		muram_writew(&txbd->len, 0);
+		muram_writew(&txbd->buf_ptr_hi, 0);
+		out_be32(&txbd->buf_ptr_lo, 0);
+		txbd++;
 	}
 
 	/* set the Tx queue decriptor */
 	txqd = &pram->txqd;
 	muram_writew(&txqd->bd_ring_base_hi, 0);
-	txqd->bd_ring_base_lo = (u32)tx_bd_ring_base;
+	out_be32(&txqd->bd_ring_base_lo, (u32)tx_bd_ring_base);
 	muram_writew(&txqd->bd_ring_size, sizeof(struct fm_port_bd)
 			* TX_BD_RING_SIZE);
 	muram_writew(&txqd->offset_in, 0);
@@ -368,7 +370,7 @@ static void fmc_tx_port_graceful_stop_enable(struct fm_eth *fm_eth)
 
 	pram = fm_eth->tx_pram;
 	/* graceful stop transmission of frames */
-	pram->mode |= PRAM_MODE_GRACEFUL_STOP;
+	setbits_be32(&pram->mode, PRAM_MODE_GRACEFUL_STOP);
 	sync();
 }
 
@@ -378,7 +380,7 @@ static void fmc_tx_port_graceful_stop_disable(struct fm_eth *fm_eth)
 
 	pram = fm_eth->tx_pram;
 	/* re-enable transmission of frames */
-	pram->mode &= ~PRAM_MODE_GRACEFUL_STOP;
+	clrbits_be32(&pram->mode, PRAM_MODE_GRACEFUL_STOP);
 	sync();
 }
 
@@ -469,19 +471,20 @@ static int fm_eth_send(struct eth_device *dev, void *buf, int len)
 	txbd = fm_eth->cur_txbd;
 
 	/* find one empty TxBD */
-	for (i = 0; txbd->status & TxBD_READY; i++) {
+	for (i = 0; muram_readw(&txbd->status) & TxBD_READY; i++) {
 		udelay(100);
 		if (i > 0x1000) {
-			printf("%s: Tx buffer not ready\n", dev->name);
+			printf("%s: Tx buffer not ready, txbd->status = 0x%x\n",
+			       dev->name, muram_readw(&txbd->status));
 			return 0;
 		}
 	}
 	/* setup TxBD */
-	txbd->buf_ptr_hi = 0;
-	txbd->buf_ptr_lo = (u32)buf;
-	txbd->len = len;
+	muram_writew(&txbd->buf_ptr_hi, 0);
+	out_be32(&txbd->buf_ptr_lo, (u32)buf);
+	muram_writew(&txbd->len, len);
 	sync();
-	txbd->status = TxBD_READY | TxBD_LAST;
+	muram_writew(&txbd->status, TxBD_READY | TxBD_LAST);
 	sync();
 
 	/* update TxQD, let RISC to send the packet */
@@ -493,10 +496,11 @@ static int fm_eth_send(struct eth_device *dev, void *buf, int len)
 	sync();
 
 	/* wait for buffer to be transmitted */
-	for (i = 0; txbd->status & TxBD_READY; i++) {
+	for (i = 0; muram_readw(&txbd->status) & TxBD_READY; i++) {
 		udelay(100);
 		if (i > 0x10000) {
-			printf("%s: Tx error\n", dev->name);
+			printf("%s: Tx error, txbd->status = 0x%x\n",
+			       dev->name, muram_readw(&txbd->status));
 			return 0;
 		}
 	}
@@ -525,12 +529,12 @@ static int fm_eth_recv(struct eth_device *dev)
 	fm_eth = (struct fm_eth *)dev->priv;
 	pram = fm_eth->rx_pram;
 	rxbd = fm_eth->cur_rxbd;
-	status = rxbd->status;
+	status = muram_readw(&rxbd->status);
 
 	while (!(status & RxBD_EMPTY)) {
 		if (!(status & RxBD_ERROR)) {
-			data = (u8 *)rxbd->buf_ptr_lo;
-			len = rxbd->len;
+			data = (u8 *)in_be32(&rxbd->buf_ptr_lo);
+			len = muram_readw(&rxbd->len);
 			net_process_received_packet(data, len);
 		} else {
 			printf("%s: Rx error\n", dev->name);
@@ -538,8 +542,8 @@ static int fm_eth_recv(struct eth_device *dev)
 		}
 
 		/* clear the RxBDs */
-		rxbd->status = RxBD_EMPTY;
-		rxbd->len = 0;
+		muram_writew(&rxbd->status, RxBD_EMPTY);
+		muram_writew(&rxbd->len, 0);
 		sync();
 
 		/* advance RxBD */
@@ -548,7 +552,7 @@ static int fm_eth_recv(struct eth_device *dev)
 		if (rxbd >= (rxbd_base + RX_BD_RING_SIZE))
 			rxbd = rxbd_base;
 		/* read next status */
-		status = rxbd->status;
+		status = muram_readw(&rxbd->status);
 
 		/* update RxQD */
 		offset_out = muram_readw(&pram->rxqd.offset_out);
drivers/net/fm/fm.c +6 -5
index 400e9dd..eb0eb3d 100644
@@ -80,11 +80,11 @@ static void fm_upload_ucode(int fm_idx, struct fm_imem *imem,
 	out_be32(&imem->iadd, IRAM_IADD_AIE);
 	/* write microcode to IRAM */
 	for (i = 0; i < size / 4; i++)
-		out_be32(&imem->idata, ucode[i]);
+		out_be32(&imem->idata, (be32_to_cpu(ucode[i])));
 
 	/* verify if the writing is over */
 	out_be32(&imem->iadd, 0);
-	while ((in_be32(&imem->idata) != ucode[0]) && --timeout)
+	while ((in_be32(&imem->idata) != be32_to_cpu(ucode[0])) && --timeout)
 		;
 	if (!timeout)
 		printf("Fman%u: microcode upload timeout\n", fm_idx + 1);
@@ -177,14 +177,15 @@ static int fman_upload_firmware(int fm_idx,
 		const struct qe_microcode *ucode = &firmware->microcode[i];
 
 		/* Upload a microcode if it's present */
-		if (ucode->code_offset) {
+		if (be32_to_cpu(ucode->code_offset)) {
 			u32 ucode_size;
 			u32 *code;
 			printf("Fman%u: Uploading microcode version %u.%u.%u\n",
 			       fm_idx + 1, ucode->major, ucode->minor,
 			       ucode->revision);
-			code = (void *)firmware + ucode->code_offset;
-			ucode_size = sizeof(u32) * ucode->count;
+			code = (void *)firmware +
+			       be32_to_cpu(ucode->code_offset);
+			ucode_size = sizeof(u32) * be32_to_cpu(ucode->count);
 			fm_upload_ucode(fm_idx, fm_imem, code, ucode_size);
 		}
 	}
Signature · 1 line
2.1.0.27.g96db324
#6 lore raw

PATCH v5 4/17 net/fm/eth: Use mb() to be compatible for both ARM and PowerPC

In reply to Gong Qianyu

From: Shaohui Xie <[email protected]>

Use mb() instead of sync() to be compatible for both ARM and PowerPC.

---
V5:
- No change.
V4:
- No change.
V3:
- New patch. Separated from patch 'net: Move some header files to include/'

 drivers/net/fm/eth.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/fm/eth.c +7 -7
index 368d554..ad02c66 100644
@@ -371,7 +371,7 @@ static void fmc_tx_port_graceful_stop_enable(struct fm_eth *fm_eth)
 	pram = fm_eth->tx_pram;
 	/* graceful stop transmission of frames */
 	setbits_be32(&pram->mode, PRAM_MODE_GRACEFUL_STOP);
-	sync();
+	mb();
 }
 
 static void fmc_tx_port_graceful_stop_disable(struct fm_eth *fm_eth)
@@ -381,7 +381,7 @@ static void fmc_tx_port_graceful_stop_disable(struct fm_eth *fm_eth)
 	pram = fm_eth->tx_pram;
 	/* re-enable transmission of frames */
 	clrbits_be32(&pram->mode, PRAM_MODE_GRACEFUL_STOP);
-	sync();
+	mb();
 }
 
 static int fm_eth_open(struct eth_device *dev, bd_t *bd)
@@ -483,9 +483,9 @@ static int fm_eth_send(struct eth_device *dev, void *buf, int len)
 	muram_writew(&txbd->buf_ptr_hi, 0);
 	out_be32(&txbd->buf_ptr_lo, (u32)buf);
 	muram_writew(&txbd->len, len);
-	sync();
+	mb();
 	muram_writew(&txbd->status, TxBD_READY | TxBD_LAST);
-	sync();
+	mb();
 
 	/* update TxQD, let RISC to send the packet */
 	offset_in = muram_readw(&pram->txqd.offset_in);
@@ -493,7 +493,7 @@ static int fm_eth_send(struct eth_device *dev, void *buf, int len)
 	if (offset_in >= muram_readw(&pram->txqd.bd_ring_size))
 		offset_in = 0;
 	muram_writew(&pram->txqd.offset_in, offset_in);
-	sync();
+	mb();
 
 	/* wait for buffer to be transmitted */
 	for (i = 0; muram_readw(&txbd->status) & TxBD_READY; i++) {
@@ -544,7 +544,7 @@ static int fm_eth_recv(struct eth_device *dev)
 		/* clear the RxBDs */
 		muram_writew(&rxbd->status, RxBD_EMPTY);
 		muram_writew(&rxbd->len, 0);
-		sync();
+		mb();
 
 		/* advance RxBD */
 		rxbd++;
@@ -560,7 +560,7 @@ static int fm_eth_recv(struct eth_device *dev)
 		if (offset_out >= muram_readw(&pram->rxqd.bd_ring_size))
 			offset_out = 0;
 		muram_writew(&pram->rxqd.offset_out, offset_out);
-		sync();
+		mb();
 	}
 	fm_eth->cur_rxbd = (void *)rxbd;
 
Signature · 1 line
2.1.0.27.g96db324
#7 lore raw

PATCH v5 5/17 net/fm: Add support for 64-bit platforms

In reply to Gong Qianyu

From: Hou Zhiqiang <[email protected]>

The FMan IM driver is developed for 32-bit platfroms and isn't friendly to 64-bit platforms, so do the minimal refactor:

1. Refine the MURAM management and access.
2. Correct the initialization and operations for QDs and BDs.

---
V5:
- No change.
V4:
- No change.
V3:
- New patch.

 drivers/net/fm/eth.c | 61 ++++++++++++++++++++++++++++++++++++----------------
 drivers/net/fm/fm.c  | 20 ++++++++++-------
 drivers/net/fm/fm.h  | 12 +++++------
 3 files changed, 60 insertions(+), 33 deletions(-)
drivers/net/fm/eth.c +42 -19
index ad02c66..6451dce 100644
@@ -108,12 +108,12 @@ static int tgec_is_fibre(struct eth_device *dev)
 
 static u16 muram_readw(u16 *addr)
 {
-	u32 base = (u32)addr & ~0x3;
-	u32 val32 = in_be32((u32 *)base);
+	ulong base = (ulong)addr & ~0x3UL;
+	u32 val32 = in_be32((void *)base);
 	int byte_pos;
 	u16 ret;
 
-	byte_pos = (u32)addr & 0x3;
+	byte_pos = (ulong)addr & 0x3UL;
 	if (byte_pos)
 		ret = (u16)(val32 & 0x0000ffff);
 	else
@@ -124,18 +124,18 @@ static u16 muram_readw(u16 *addr)
 
 static void muram_writew(u16 *addr, u16 val)
 {
-	u32 base = (u32)addr & ~0x3;
-	u32 org32 = in_be32((u32 *)base);
+	ulong base = (ulong)addr & ~0x3UL;
+	u32 org32 = in_be32((void *)base);
 	u32 val32;
 	int byte_pos;
 
-	byte_pos = (u32)addr & 0x3;
+	byte_pos = (ulong)addr & 0x3UL;
 	if (byte_pos)
 		val32 = (org32 & 0xffff0000) | val;
 	else
 		val32 = (org32 & 0x0000ffff) | ((u32)val << 16);
 
-	out_be32((u32 *)base, val32);
+	out_be32((void *)base, val32);
 }
 
 static void bmi_rx_port_disable(struct fm_bmi_rx_port *rx_port)
@@ -199,6 +199,8 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	u32 pram_page_offset;
 	void *rx_bd_ring_base;
 	void *rx_buf_pool;
+	u32 bd_ring_base_lo, bd_ring_base_hi;
+	u32 buf_lo, buf_hi;
 	struct fm_port_bd *rxbd;
 	struct fm_port_qd *rxqd;
 	struct fm_bmi_rx_port *bmi_rx_port = fm_eth->rx_port;
@@ -207,10 +209,15 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	/* alloc global parameter ram at MURAM */
 	pram = (struct fm_port_global_pram *)fm_muram_alloc(fm_eth->fm_index,
 		FM_PRAM_SIZE, FM_PRAM_ALIGN);
+	if (!pram) {
+		printf("%s: No muram for Rx global parameter\n", __func__);
+		return 0;
+	}
+
 	fm_eth->rx_pram = pram;
 
 	/* parameter page offset to MURAM */
-	pram_page_offset = (u32)pram - fm_muram_base(fm_eth->fm_index);
+	pram_page_offset = (void *)pram - fm_muram_base(fm_eth->fm_index);
 
 	/* enable global mode- snooping data buffers and BDs */
 	out_be32(&pram->mode, PRAM_MODE_GLOBAL);
@@ -234,6 +241,7 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	if (!rx_buf_pool)
 		return 0;
 	memset(rx_buf_pool, 0, MAX_RXBUF_LEN * RX_BD_RING_SIZE);
+	debug("%s: rx_buf_pool = %p\n", __func__, rx_buf_pool);
 
 	/* save them to fm_eth */
 	fm_eth->rx_bd_ring = rx_bd_ring_base;
@@ -245,17 +253,22 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	for (i = 0; i < RX_BD_RING_SIZE; i++) {
 		muram_writew(&rxbd->status, RxBD_EMPTY);
 		muram_writew(&rxbd->len, 0);
-		muram_writew(&rxbd->buf_ptr_hi, 0);
-		out_be32(&rxbd->buf_ptr_lo, (u32)rx_buf_pool +
-				i * MAX_RXBUF_LEN);
+		buf_hi = upper_32_bits(virt_to_phys(rx_buf_pool +
+					i * MAX_RXBUF_LEN));
+		buf_lo = lower_32_bits(virt_to_phys(rx_buf_pool +
+					i * MAX_RXBUF_LEN));
+		muram_writew(&rxbd->buf_ptr_hi, (u16)buf_hi);
+		out_be32(&rxbd->buf_ptr_lo, buf_lo);
 		rxbd++;
 	}
 
 	/* set the Rx queue descriptor */
 	rxqd = &pram->rxqd;
 	muram_writew(&rxqd->gen, 0);
-	muram_writew(&rxqd->bd_ring_base_hi, 0);
-	out_be32(&rxqd->bd_ring_base_lo, (u32)rx_bd_ring_base);
+	bd_ring_base_hi = upper_32_bits(virt_to_phys(rx_bd_ring_base));
+	bd_ring_base_lo = lower_32_bits(virt_to_phys(rx_bd_ring_base));
+	muram_writew(&rxqd->bd_ring_base_hi, (u16)bd_ring_base_hi);
+	out_be32(&rxqd->bd_ring_base_lo, bd_ring_base_lo);
 	muram_writew(&rxqd->bd_ring_size, sizeof(struct fm_port_bd)
 			* RX_BD_RING_SIZE);
 	muram_writew(&rxqd->offset_in, 0);
@@ -272,6 +285,7 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 	struct fm_port_global_pram *pram;
 	u32 pram_page_offset;
 	void *tx_bd_ring_base;
+	u32 bd_ring_base_lo, bd_ring_base_hi;
 	struct fm_port_bd *txbd;
 	struct fm_port_qd *txqd;
 	struct fm_bmi_tx_port *bmi_tx_port = fm_eth->tx_port;
@@ -280,10 +294,14 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 	/* alloc global parameter ram at MURAM */
 	pram = (struct fm_port_global_pram *)fm_muram_alloc(fm_eth->fm_index,
 		FM_PRAM_SIZE, FM_PRAM_ALIGN);
+	if (!pram) {
+		printf("%s: No muram for Tx global parameter\n", __func__);
+		return 0;
+	}
 	fm_eth->tx_pram = pram;
 
 	/* parameter page offset to MURAM */
-	pram_page_offset = (u32)pram - fm_muram_base(fm_eth->fm_index);
+	pram_page_offset = (void *)pram - fm_muram_base(fm_eth->fm_index);
 
 	/* enable global mode- snooping data buffers and BDs */
 	out_be32(&pram->mode, PRAM_MODE_GLOBAL);
@@ -314,8 +332,10 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 
 	/* set the Tx queue decriptor */
 	txqd = &pram->txqd;
-	muram_writew(&txqd->bd_ring_base_hi, 0);
-	out_be32(&txqd->bd_ring_base_lo, (u32)tx_bd_ring_base);
+	bd_ring_base_hi = upper_32_bits(virt_to_phys(tx_bd_ring_base));
+	bd_ring_base_lo = lower_32_bits(virt_to_phys(tx_bd_ring_base));
+	muram_writew(&txqd->bd_ring_base_hi, (u16)bd_ring_base_hi);
+	out_be32(&txqd->bd_ring_base_lo, bd_ring_base_lo);
 	muram_writew(&txqd->bd_ring_size, sizeof(struct fm_port_bd)
 			* TX_BD_RING_SIZE);
 	muram_writew(&txqd->offset_in, 0);
@@ -480,8 +500,8 @@ static int fm_eth_send(struct eth_device *dev, void *buf, int len)
 		}
 	}
 	/* setup TxBD */
-	muram_writew(&txbd->buf_ptr_hi, 0);
-	out_be32(&txbd->buf_ptr_lo, (u32)buf);
+	muram_writew(&txbd->buf_ptr_hi, (u16)upper_32_bits(virt_to_phys(buf)));
+	out_be32(&txbd->buf_ptr_lo, lower_32_bits(virt_to_phys(buf)));
 	muram_writew(&txbd->len, len);
 	mb();
 	muram_writew(&txbd->status, TxBD_READY | TxBD_LAST);
@@ -522,6 +542,7 @@ static int fm_eth_recv(struct eth_device *dev)
 	struct fm_port_global_pram *pram;
 	struct fm_port_bd *rxbd, *rxbd_base;
 	u16 status, len;
+	u32 buf_lo, buf_hi;
 	u8 *data;
 	u16 offset_out;
 	int ret = 1;
@@ -533,7 +554,9 @@ static int fm_eth_recv(struct eth_device *dev)
 
 	while (!(status & RxBD_EMPTY)) {
 		if (!(status & RxBD_ERROR)) {
-			data = (u8 *)in_be32(&rxbd->buf_ptr_lo);
+			buf_hi = muram_readw(&rxbd->buf_ptr_hi);
+			buf_lo = in_be32(&rxbd->buf_ptr_lo);
+			data = (u8 *)((ulong)(buf_hi << 16) << 16 | buf_lo);
 			len = muram_readw(&rxbd->len);
 			net_process_received_packet(data, len);
 		} else {
drivers/net/fm/fm.c +12 -8
index eb0eb3d..df5db72 100644
@@ -22,21 +22,22 @@
 
 struct fm_muram muram[CONFIG_SYS_NUM_FMAN];
 
-u32 fm_muram_base(int fm_idx)
+void *fm_muram_base(int fm_idx)
 {
 	return muram[fm_idx].base;
 }
 
-u32 fm_muram_alloc(int fm_idx, u32 size, u32 align)
+void *fm_muram_alloc(int fm_idx, size_t size, ulong align)
 {
-	u32 ret;
-	u32 align_mask, off;
-	u32 save;
+	void *ret;
+	ulong align_mask;
+	size_t off;
+	void *save;
 
 	align_mask = align - 1;
 	save = muram[fm_idx].alloc;
 
-	off = save & align_mask;
+	off = (ulong)save & align_mask;
 	if (off != 0)
 		muram[fm_idx].alloc += (align - off);
 	off = size & align_mask;
@@ -45,6 +46,7 @@ u32 fm_muram_alloc(int fm_idx, u32 size, u32 align)
 	if ((muram[fm_idx].alloc + size) >= muram[fm_idx].top) {
 		muram[fm_idx].alloc = save;
 		printf("%s: run out of ram.\n", __func__);
+		return NULL;
 	}
 
 	ret = muram[fm_idx].alloc;
@@ -56,7 +58,7 @@ u32 fm_muram_alloc(int fm_idx, u32 size, u32 align)
 
 static void fm_init_muram(int fm_idx, void *reg)
 {
-	u32 base = (u32)reg;
+	void *base = reg;
 
 	muram[fm_idx].base = base;
 	muram[fm_idx].size = CONFIG_SYS_FM_MURAM_SIZE;
@@ -256,7 +258,9 @@ static void fm_init_fpm(struct fm_fpm *fpm)
 static int fm_init_bmi(int fm_idx, struct fm_bmi_common *bmi)
 {
 	int blk, i, port_id;
-	u32 val, offset, base;
+	u32 val;
+	size_t offset;
+	void *base;
 
 	/* alloc free buffer pool in MURAM */
 	base = fm_muram_alloc(fm_idx, FM_FREE_POOL_SIZE, FM_FREE_POOL_ALIGN);
drivers/net/fm/fm.h +6 -6
index a9691c6..73c525e 100644
@@ -26,10 +26,10 @@
 #define MIIM_TIMEOUT    0xFFFF
 
 struct fm_muram {
-	u32 base;
-	u32 top;
-	u32 size;
-	u32 alloc;
+	void *base;
+	void *top;
+	size_t size;
+	void *alloc;
 };
 #define FM_MURAM_RES_SIZE	0x01000
 
@@ -95,8 +95,8 @@ struct fm_port_global_pram {
 #endif
 #define FM_FREE_POOL_ALIGN	256
 
-u32 fm_muram_alloc(int fm_idx, u32 size, u32 align);
-u32 fm_muram_base(int fm_idx);
+void *fm_muram_alloc(int fm_idx, size_t size, ulong align);
+void *fm_muram_base(int fm_idx);
 int fm_init_common(int index, struct ccsr_fman *reg);
 int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info);
 phy_interface_t fman_port_enet_if(enum fm_port port);
Signature · 1 line
2.1.0.27.g96db324
#8 lore raw

PATCH v5 6/17 net/fm: Make the return value logic consistent with convention

In reply to Gong Qianyu

From: Hou Zhiqiang <[email protected]>

In convention, the '0' is a normal return value indicating there isn't an error. While some functions of FMan IM driver treat '0' as an error return value.

---
V5:
- No change.
V4:
- No change.
V3:
- New patch.

 drivers/net/fm/eth.c | 60 +++++++++++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 24 deletions(-)
drivers/net/fm/eth.c +36 -24
index 6451dce..d7d064b 100644
@@ -211,7 +211,7 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 		FM_PRAM_SIZE, FM_PRAM_ALIGN);
 	if (!pram) {
 		printf("%s: No muram for Rx global parameter\n", __func__);
-		return 0;
+		return -ENOMEM;
 	}
 
 	fm_eth->rx_pram = pram;
@@ -232,14 +232,16 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	rx_bd_ring_base = malloc(sizeof(struct fm_port_bd)
 			* RX_BD_RING_SIZE);
 	if (!rx_bd_ring_base)
-		return 0;
+		return -ENOMEM;
+
 	memset(rx_bd_ring_base, 0, sizeof(struct fm_port_bd)
 			* RX_BD_RING_SIZE);
 
 	/* alloc Rx buffer from main memory */
 	rx_buf_pool = malloc(MAX_RXBUF_LEN * RX_BD_RING_SIZE);
 	if (!rx_buf_pool)
-		return 0;
+		return -ENOMEM;
+
 	memset(rx_buf_pool, 0, MAX_RXBUF_LEN * RX_BD_RING_SIZE);
 	debug("%s: rx_buf_pool = %p\n", __func__, rx_buf_pool);
 
@@ -277,7 +279,7 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 	/* set IM parameter ram pointer to Rx Frame Queue ID */
 	out_be32(&bmi_rx_port->fmbm_rfqid, pram_page_offset);
 
-	return 1;
+	return 0;
 }
 
 static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
@@ -296,7 +298,7 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 		FM_PRAM_SIZE, FM_PRAM_ALIGN);
 	if (!pram) {
 		printf("%s: No muram for Tx global parameter\n", __func__);
-		return 0;
+		return -ENOMEM;
 	}
 	fm_eth->tx_pram = pram;
 
@@ -313,7 +315,8 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 	tx_bd_ring_base = malloc(sizeof(struct fm_port_bd)
 			* TX_BD_RING_SIZE);
 	if (!tx_bd_ring_base)
-		return 0;
+		return -ENOMEM;
+
 	memset(tx_bd_ring_base, 0, sizeof(struct fm_port_bd)
 			* TX_BD_RING_SIZE);
 	/* save it to fm_eth */
@@ -344,29 +347,35 @@ static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth)
 	/* set IM parameter ram pointer to Tx Confirmation Frame Queue ID */
 	out_be32(&bmi_tx_port->fmbm_tcfqid, pram_page_offset);
 
-	return 1;
+	return 0;
 }
 
 static int fm_eth_init(struct fm_eth *fm_eth)
 {
+	int ret;
 
-	if (!fm_eth_rx_port_parameter_init(fm_eth))
-		return 0;
+	ret = fm_eth_rx_port_parameter_init(fm_eth);
+	if (ret)
+		return ret;
 
-	if (!fm_eth_tx_port_parameter_init(fm_eth))
-		return 0;
+	ret = fm_eth_tx_port_parameter_init(fm_eth);
+	if (ret)
+		return ret;
 
-	return 1;
+	return 0;
 }
 
 static int fm_eth_startup(struct fm_eth *fm_eth)
 {
 	struct fsl_enet_mac *mac;
+	int ret;
+
 	mac = fm_eth->mac;
 
 	/* Rx/TxBDs, Rx/TxQDs, Rx buff and parameter ram init */
-	if (!fm_eth_init(fm_eth))
-		return 0;
+	ret = fm_eth_init(fm_eth);
+	if (ret)
+		return ret;
 	/* setup the MAC controller */
 	mac->init_mac(mac);
 
@@ -381,7 +390,7 @@ static int fm_eth_startup(struct fm_eth *fm_eth)
 	/* init bmi tx port, IM mode and disable */
 	bmi_tx_port_init(fm_eth->tx_port);
 
-	return 1;
+	return 0;
 }
 
 static void fmc_tx_port_graceful_stop_enable(struct fm_eth *fm_eth)
@@ -628,7 +637,7 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
 	/* alloc mac controller */
 	mac = malloc(sizeof(struct fsl_enet_mac));
 	if (!mac)
-		return 0;
+		return -ENOMEM;
 	memset(mac, 0, sizeof(struct fsl_enet_mac));
 
 	/* save the mac to fm_eth struct */
@@ -643,7 +652,7 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
 		init_tgec(mac, base, phyregs, MAX_RXBUF_LEN);
 #endif
 
-	return 1;
+	return 0;
 }
 
 static int init_phy(struct eth_device *dev)
@@ -696,17 +705,18 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
 	struct eth_device *dev;
 	struct fm_eth *fm_eth;
 	int i, num = info->num;
+	int ret;
 
 	/* alloc eth device */
 	dev = (struct eth_device *)malloc(sizeof(struct eth_device));
 	if (!dev)
-		return 0;
+		return -ENOMEM;
 	memset(dev, 0, sizeof(struct eth_device));
 
 	/* alloc the FMan ethernet private struct */
 	fm_eth = (struct fm_eth *)malloc(sizeof(struct fm_eth));
 	if (!fm_eth)
-		return 0;
+		return -ENOMEM;
 	memset(fm_eth, 0, sizeof(struct fm_eth));
 
 	/* save off some things we need from the info struct */
@@ -721,8 +731,9 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
 	fm_eth->max_rx_len = MAX_RXBUF_LEN;
 
 	/* init global mac structure */
-	if (!fm_eth_init_mac(fm_eth, reg))
-		return 0;
+	ret = fm_eth_init_mac(fm_eth, reg);
+	if (ret)
+		return ret;
 
 	/* keep same as the manual, we call FMAN1, FMAN2, DTSEC1, DTSEC2, etc */
 	if (fm_eth->type == FM_ETH_1G_E)
@@ -743,8 +754,9 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
 	fm_eth->enet_if = info->enet_if;
 
 	/* startup the FM im */
-	if (!fm_eth_startup(fm_eth))
-		return 0;
+	ret = fm_eth_startup(fm_eth);
+	if (ret)
+		return ret;
 
 	init_phy(dev);
 
@@ -753,5 +765,5 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
 		dev->enetaddr[i] = 0;
 	eth_register(dev);
 
-	return 1;
+	return 0;
 }
Signature · 1 line
2.1.0.27.g96db324
#9 lore raw

PATCH v5 7/17 net/fm: bug fix when CONFIG_PHYLIB not defined

In reply to Gong Qianyu

From: Shaohui Xie <[email protected]>

phy_shutdown should be wrapped by CONFIG_PHYLIB.

---
V5:
- No change.
V4:
- No change.
V3:
- New patch.

 drivers/net/fm/eth.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/fm/eth.c +2 -0
index d7d064b..1b62fd8 100644
@@ -483,8 +483,10 @@ static void fm_eth_halt(struct eth_device *dev)
 	/* disable bmi Rx port */
 	bmi_rx_port_disable(fm_eth->rx_port);
 
+#ifdef CONFIG_PHYLIB
 	if (fm_eth->phydev)
 		phy_shutdown(fm_eth->phydev);
+#endif
 }
 
 static int fm_eth_send(struct eth_device *dev, void *buf, int len)
Signature · 1 line
2.1.0.27.g96db324
#10 lore raw

PATCH v5 7/17 net/fm: bug fix when CONFIG_PHYLIB not defined

Quoted 37 lines

-----Original Message-----
From: Gong Qianyu [mailto:Qianyu.Gong at freescale.com]
Sent: Thursday, October 15, 2015 6:33 PM
To: u-boot at lists.denx.de
Cc: Hu Mingkai-B21284 <[email protected]>; Sun York-R58495 <[email protected]>; Hou Zhiqiang-B48286 <[email protected]>; Xie Shaohui-B21989 <[email protected]>; Song Wenbin-B53747 <[email protected]>; Wood Scott-B07421 <[email protected]>; Kushwaha Prabhakar-B32579 <[email protected]>; Wang Huan-B18965 <[email protected]>; Gong Qianyu-B52263 <[email protected]>
Subject: [Patch V5 07/17] net/fm: bug fix when CONFIG_PHYLIB not defined

From: Shaohui Xie <[email protected]>

phy_shutdown should be wrapped by CONFIG_PHYLIB.

---
V5:
- No change.
V4:
- No change.
V3:
- New patch.

 drivers/net/fm/eth.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/fm/eth.c index renamed from drivers/net/fm/eth.c +0 -0

d7d064b..1b62fd8 100644

drivers/net/fm/eth.c static void fm_eth_halt(struct eth_device *dev) · line 492

Quoted 10 lines
drivers/net/fm/eth.c +2 -0
@@ -483,8 +483,10 @@ static void fm_eth_halt(struct eth_device *dev)
 	/* disable bmi Rx port */
 	bmi_rx_port_disable(fm_eth->rx_port);
 
+#ifdef CONFIG_PHYLIB
 	if (fm_eth->phydev)
 		phy_shutdown(fm_eth->phydev);
+#endif
 }
 
 static int fm_eth_send(struct eth_device *dev, void *buf, int len)

Thanks for fixing the bug.

I tried by #undef CONFIG_PHYLIB in drivers/net/fm/eth.c and got following warnings for B4860QDS_defconfig. I guess similar warning will be there for LS1043 also. Can you please check and if required fix it.

drivers/net/fm/eth.c: In function 'init_phy':
drivers/net/fm/eth.c:627:6: warning: unused variable 'supported' [-Wunused-variable]

  u32 supported;
      ^
drivers/net/fm/eth.c:626:21: warning: unused variable 'phydev' [-Wunused-variable]
  struct phy_device *phydev = NULL;
                     ^
drivers/net/fm/eth.c:625:17: warning: unused variable 'fm_eth' [-Wunused-variable]
  struct fm_eth *fm_eth = dev->priv;
                 ^
drivers/net/fm/eth.c: At top level:
drivers/net/fm/eth.c:84:13: warning: 'dtsec_init_phy' defined but not used [-Wunused-function]
 static void dtsec_init_phy(struct eth_device *dev)
             ^

drivers/net/fm/eth.c:99:12: warning: 'tgec_is_fibre' defined but not used [-Wunused-function]
static int tgec_is_fibre(struct eth_device *dev)

--prabhakar

#11 lore raw

PATCH v5 8/17 net: Move some header files to include/

In reply to Gong Qianyu

From: Shaohui Xie <[email protected]>

The fsl_dtsec.h & fsl_tgec.h & fsl_fman.h can be shared on both ARM and PPC, move it out of ppc to include/, and change the path in drivers accordingly.

---
V5:
- No change.
V4:
- No change.
V3:
- No change.
V2:
- No change.

 arch/powerpc/include/asm/immap_85xx.h             | 2 +-
 board/freescale/b4860qds/eth_b4860qds.c           | 2 +-
 board/freescale/corenet_ds/eth_hydra.c            | 2 +-
 board/freescale/corenet_ds/eth_p4080.c            | 2 +-
 board/freescale/corenet_ds/eth_superhydra.c       | 2 +-
 board/freescale/p1023rdb/p1023rdb.c               | 2 +-
 board/freescale/p2041rdb/eth.c                    | 2 +-
 board/freescale/t102xqds/eth_t102xqds.c           | 2 +-
 board/freescale/t102xrdb/eth_t102xrdb.c           | 2 +-
 board/freescale/t1040qds/eth.c                    | 2 +-
 board/freescale/t104xrdb/eth.c                    | 2 +-
 board/freescale/t208xqds/eth_t208xqds.c           | 2 +-
 board/freescale/t208xrdb/eth_t208xrdb.c           | 2 +-
 board/freescale/t4qds/eth.c                       | 2 +-
 board/freescale/t4rdb/eth.c                       | 2 +-
 drivers/net/fm/dtsec.c                            | 2 +-
 drivers/net/fm/eth.c                              | 4 ++--
 drivers/net/fm/fm.h                               | 2 +-
 drivers/net/fm/tgec.c                             | 2 +-
 drivers/net/fm/tgec_phy.c                         | 2 +-
 {arch/powerpc/include/asm => include}/fsl_dtsec.h | 0
 {arch/powerpc/include/asm => include}/fsl_fman.h  | 0
 {arch/powerpc/include/asm => include}/fsl_tgec.h  | 0
 23 files changed, 21 insertions(+), 21 deletions(-)
arch/powerpc/include/asm/immap_85xx.h +1 -1
index 0c9d85e..101b8db 100644
@@ -19,7 +19,7 @@
 #include <fsl_sec.h>
 #include <fsl_sfp.h>
 #include <asm/fsl_lbc.h>
-#include <asm/fsl_fman.h>
+#include <fsl_fman.h>
 #include <fsl_immap.h>
 
 typedef struct ccsr_local {
board/freescale/b4860qds/eth_b4860qds.c +1 -1
index 501d4b3..df90476 100644
@@ -26,7 +26,7 @@
 #include <fsl_mdio.h>
 #include <malloc.h>
 #include <fdt_support.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 
 #include "../common/ngpixis.h"
 #include "../common/fman.h"
board/freescale/corenet_ds/eth_hydra.c +1 -1
index 396103f..172a55b 100644
@@ -55,7 +55,7 @@
 #include <fsl_mdio.h>
 #include <malloc.h>
 #include <fdt_support.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 
 #include "../common/ngpixis.h"
 #include "../common/fman.h"
board/freescale/corenet_ds/eth_p4080.c +1 -1
index 5cbec7f..c68dc2c 100644
@@ -24,7 +24,7 @@
 
 #include "../common/ngpixis.h"
 #include "../common/fman.h"
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 
 #define EMI_NONE	0xffffffff
 #define EMI_MASK	0xf0000000
board/freescale/corenet_ds/eth_superhydra.c +1 -1
index ad1bffd..62b1635 100644
@@ -55,7 +55,7 @@
 #include <fsl_mdio.h>
 #include <malloc.h>
 #include <fdt_support.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 
 #include "../common/ngpixis.h"
 #include "../common/fman.h"
board/freescale/p1023rdb/p1023rdb.c +1 -1
index 56f561a..074b713 100644
@@ -26,7 +26,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
board/freescale/p2041rdb/eth.c +1 -1
index 532eeac..95fe85b 100644
@@ -19,7 +19,7 @@
 #include <fm_eth.h>
 #include <fsl_mdio.h>
 #include <malloc.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 
 #include "cpld.h"
 #include "../common/fman.h"
board/freescale/t102xqds/eth_t102xqds.c +1 -1
index 441d6a3..99c23f7 100644
@@ -21,7 +21,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <asm/fsl_serdes.h>
 #include "../common/qixis.h"
 #include "../common/fman.h"
board/freescale/t102xrdb/eth_t102xrdb.c +1 -1
index 856ec6e..02b283d 100644
@@ -21,7 +21,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <asm/fsl_serdes.h>
 #include "../common/fman.h"
 
board/freescale/t1040qds/eth.c +1 -1
index 8c82934..8bf34fa 100644
@@ -17,7 +17,7 @@
 #include <fm_eth.h>
 #include <fsl_mdio.h>
 #include <malloc.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <vsc9953.h>
 
 #include "../common/fman.h"
board/freescale/t104xrdb/eth.c +1 -1
index 71d0457..52cd112 100644
@@ -11,7 +11,7 @@
 #include <fm_eth.h>
 #include <fsl_mdio.h>
 #include <malloc.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <vsc9953.h>
 
 #include "../common/fman.h"
board/freescale/t208xqds/eth_t208xqds.c +1 -1
index b82e9e7..1c0ce24 100644
@@ -21,7 +21,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <asm/fsl_serdes.h>
 #include <hwconfig.h>
 #include "../common/qixis.h"
board/freescale/t208xrdb/eth_t208xrdb.c +1 -1
index cbbc625..ea51195 100644
@@ -21,7 +21,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <asm/fsl_serdes.h>
 
 int board_eth_init(bd_t *bis)
board/freescale/t4qds/eth.c +1 -1
index 9b416b1..2dfdcbb 100644
@@ -21,7 +21,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <asm/fsl_serdes.h>
 #include <hwconfig.h>
 #include "../common/qixis.h"
board/freescale/t4rdb/eth.c +1 -1
index 879bd1a..e563a61 100644
@@ -23,7 +23,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <asm/fsl_serdes.h>
 #include <hwconfig.h>
 
drivers/net/fm/dtsec.c +1 -1
index 8d3dc0e..b339a84 100644
@@ -7,7 +7,7 @@
 #include <common.h>
 #include <asm/types.h>
 #include <asm/io.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 #include <fsl_mdio.h>
 #include <phy.h>
 
drivers/net/fm/eth.c +2 -2
index 1b62fd8..38828c8 100644
@@ -13,8 +13,8 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
-#include <asm/fsl_dtsec.h>
-#include <asm/fsl_tgec.h>
+#include <fsl_dtsec.h>
+#include <fsl_tgec.h>
 #include <fsl_memac.h>
 
 #include "fm.h"
drivers/net/fm/fm.h +1 -1
index 73c525e..fa9bc9f 100644
@@ -10,7 +10,7 @@
 #include <common.h>
 #include <phy.h>
 #include <fm_eth.h>
-#include <asm/fsl_fman.h>
+#include <fsl_fman.h>
 
 /* Port ID */
 #define OH_PORT_ID_BASE		0x01
drivers/net/fm/tgec.c +1 -1
index 5017123..8d4622f 100644
@@ -12,7 +12,7 @@
 #include <phy.h>
 #include <asm/types.h>
 #include <asm/io.h>
-#include <asm/fsl_tgec.h>
+#include <fsl_tgec.h>
 
 #include "fm.h"
 
drivers/net/fm/tgec_phy.c +1 -1
index 095f00c..24cb17b 100644
@@ -9,7 +9,7 @@
 #include <miiphy.h>
 #include <phy.h>
 #include <asm/io.h>
-#include <asm/fsl_tgec.h>
+#include <fsl_tgec.h>
 #include <fm_eth.h>
 
 /*
include/fsl_dtsec.h renamed from arch/powerpc/include/asm/fsl_dtsec.h +0 -0
similarity index 100%
rename from arch/powerpc/include/asm/fsl_dtsec.h
rename to include/fsl_dtsec.h
include/fsl_fman.h renamed from arch/powerpc/include/asm/fsl_fman.h +0 -0
similarity index 100%
rename from arch/powerpc/include/asm/fsl_fman.h
rename to include/fsl_fman.h
include/fsl_tgec.h renamed from arch/powerpc/include/asm/fsl_tgec.h +0 -0
similarity index 100%
rename from arch/powerpc/include/asm/fsl_tgec.h
rename to include/fsl_tgec.h
Signature · 1 line
2.1.0.27.g96db324
#12 lore raw

PATCH v5 9/17 net/fm: Add QSGMII PCS init

In reply to Gong Qianyu

From: Shaohui Xie <[email protected]>

QSGMII PCS needed to be programmed same as SGMII PCS, and there are four ports in QSGMII PCS, port 0, 1, 2, 3, all the four ports shared port 0's MDIO controller, so when programming port 0, we continue to program other three ports.

---
V5:
- No change.
V4:
- Remove the "if(priv->phyaddr%4 != 0)" condition in qsgmii_loop.
V3:
- No change.
V2:
- No change.

 drivers/net/fm/eth.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/net/fm/eth.c +13 -5
index 38828c8..3220ae6 100644
@@ -41,28 +41,35 @@ static void dtsec_configure_serdes(struct fm_eth *priv)
 	bus.priv = priv->mac->phyregs;
 	bool sgmii_2500 = (priv->enet_if ==
 			PHY_INTERFACE_MODE_SGMII_2500) ? true : false;
+	int i = 0;
 
+qsgmii_loop:
 	/* SGMII IF mode + AN enable only for 1G SGMII, not for 2.5G */
 	value = PHY_SGMII_IF_MODE_SGMII;
 	if (!sgmii_2500)
 		value |= PHY_SGMII_IF_MODE_AN;
 
-	memac_mdio_write(&bus, 0, MDIO_DEVAD_NONE, 0x14, value);
+	memac_mdio_write(&bus, i, MDIO_DEVAD_NONE, 0x14, value);
 
 	/* Dev ability according to SGMII specification */
 	value = PHY_SGMII_DEV_ABILITY_SGMII;
-	memac_mdio_write(&bus, 0, MDIO_DEVAD_NONE, 0x4, value);
+	memac_mdio_write(&bus, i, MDIO_DEVAD_NONE, 0x4, value);
 
 	/* Adjust link timer for SGMII  -
 	1.6 ms in units of 8 ns = 2 * 10^5 = 0x30d40 */
-	memac_mdio_write(&bus, 0, MDIO_DEVAD_NONE, 0x13, 0x3);
-	memac_mdio_write(&bus, 0, MDIO_DEVAD_NONE, 0x12, 0xd40);
+	memac_mdio_write(&bus, i, MDIO_DEVAD_NONE, 0x13, 0x3);
+	memac_mdio_write(&bus, i, MDIO_DEVAD_NONE, 0x12, 0xd40);
 
 	/* Restart AN */
 	value = PHY_SGMII_CR_DEF_VAL;
 	if (!sgmii_2500)
 		value |= PHY_SGMII_CR_RESET_AN;
-	memac_mdio_write(&bus, 0, MDIO_DEVAD_NONE, 0, value);
+	memac_mdio_write(&bus, i, MDIO_DEVAD_NONE, 0, value);
+
+	if ((priv->enet_if == PHY_INTERFACE_MODE_QSGMII) && (i < 3)) {
+		i++;
+		goto qsgmii_loop;
+	}
 #else
 	struct dtsec *regs = priv->mac->base;
 	struct tsec_mii_mng *phyregs = priv->mac->phyregs;
@@ -91,6 +98,7 @@ static void dtsec_init_phy(struct eth_device *dev)
 #endif
 
 	if (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII ||
+	    fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII ||
 	    fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500)
 		dtsec_configure_serdes(fm_eth);
 }
Signature · 1 line
2.1.0.27.g96db324
#13 lore raw

PATCH v5 10/17 net/fm: fix MDIO controller base on FMAN2

In reply to Gong Qianyu

From: Shaohui Xie <[email protected]>

MDIO controller base on FMAN2 was defined as CONFIG_SYS_FSL_FM2_ADDR plus offset, but CONFIG_SYS_FSL_FM2_ADDR only defined when there are two FMANs, so we should only define MDIO controller base on FMAN2 when there is FMAN2.

---
V5:
- No change.
V4:
- No change.
V3:
- No change.
V2:
- No change.

 include/fm_eth.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
include/fm_eth.h +17 -0
index 3e1b9f4..d43f801 100644
@@ -45,8 +45,10 @@ enum fm_eth_type {
 #ifdef CONFIG_SYS_FMAN_V3
 #define CONFIG_SYS_FM1_DTSEC_MDIO_ADDR	(CONFIG_SYS_FSL_FM1_ADDR + 0xfc000)
 #define CONFIG_SYS_FM1_TGEC_MDIO_ADDR	(CONFIG_SYS_FSL_FM1_ADDR + 0xfd000)
+#if (CONFIG_SYS_NUM_FMAN == 2)
 #define CONFIG_SYS_FM2_DTSEC_MDIO_ADDR	(CONFIG_SYS_FSL_FM2_ADDR + 0xfc000)
 #define CONFIG_SYS_FM2_TGEC_MDIO_ADDR	(CONFIG_SYS_FSL_FM2_ADDR + 0xfd000)
+#endif
 #else
 #define CONFIG_SYS_FM1_DTSEC1_MDIO_ADDR	(CONFIG_SYS_FSL_FM1_ADDR + 0xe1120)
 #define CONFIG_SYS_FM1_TGEC_MDIO_ADDR	(CONFIG_SYS_FSL_FM1_ADDR + 0xf1000)
@@ -89,6 +91,7 @@ enum fm_eth_type {
 				 offsetof(struct ccsr_fman, memac[n-1]),\
 }
 #else
+#if (CONFIG_SYS_NUM_FMAN == 2)
 #define FM_TGEC_INFO_INITIALIZER(idx, n) \
 {									\
 	FM_ETH_INFO_INITIALIZER(idx, CONFIG_SYS_FM2_TGEC_MDIO_ADDR)	\
@@ -101,6 +104,20 @@ enum fm_eth_type {
 	.compat_offset	= CONFIG_SYS_FSL_FM##idx##_OFFSET +		\
 				offsetof(struct ccsr_fman, memac[n-1+8]),\
 }
+#else
+#define FM_TGEC_INFO_INITIALIZER(idx, n) \
+{									\
+	FM_ETH_INFO_INITIALIZER(idx, CONFIG_SYS_FM1_TGEC_MDIO_ADDR)	\
+	.index		= idx,						\
+	.num		= n - 1,					\
+	.type		= FM_ETH_10G_E,					\
+	.port		= FM##idx##_10GEC##n,				\
+	.rx_port_id	= RX_PORT_10G_BASE + n - 1,			\
+	.tx_port_id	= TX_PORT_10G_BASE + n - 1,			\
+	.compat_offset	= CONFIG_SYS_FSL_FM##idx##_OFFSET +		\
+				offsetof(struct ccsr_fman, memac[n-1+8]),\
+}
+#endif
 #endif
 
 #if (CONFIG_SYS_NUM_FM1_10GEC >= 3)
Signature · 1 line
2.1.0.27.g96db324
#14 lore raw

PATCH v5 11/17 armv8/fsl_lsch3: Change arch to fsl-layerscape

In reply to Gong Qianyu

From: Mingkai Hu <[email protected]>

There are two LS series processors are built on ARMv8 Layersacpe architecture currently, LS2085A and LS1043A. They are based on ARMv8 core although use different chassis, so create fsl-layerscape to refactor the common code for the LS series processors which also paves the way for adding LS1043A platform.

---
V5:
- Move LS2085A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in soc.h
- Modify fsl-layerscape/Makefile.
V4:
- New patch.

 arch/arm/cpu/armv8/Makefile                        |   2 +-
 arch/arm/cpu/armv8/fsl-layerscape/Makefile         |  21 ++
 .../README => fsl-layerscape/README.lsch3}         |   0
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.c  | 249 ++++++---------------
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.h  |   2 +-
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/fdt.c  |  17 +-
 .../fsl_lsch3_serdes.c                             |   8 +-
 .../speed.c => fsl-layerscape/fsl_lsch3_speed.c}   |  12 +-
 .../armv8/{fsl-lsch3 => fsl-layerscape}/lowlevel.S |  14 +-
 .../{fsl-lsch3 => fsl-layerscape}/ls2085a_serdes.c |   3 +-
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/mp.c   |  15 +-
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/soc.c  |  35 +--
 arch/arm/cpu/armv8/fsl-layerscape/spl.c            |  76 +++++++
 arch/arm/cpu/armv8/fsl-lsch3/Makefile              |  13 --
 arch/arm/cpu/armv8/fsl-lsch3/speed.h               |   7 -
 .../clock.h                                        |   8 +-
 arch/arm/include/asm/arch-fsl-layerscape/config.h  |  59 +++++
 arch/arm/include/asm/arch-fsl-layerscape/cpu.h     | 165 ++++++++++++++
 .../{arch-fsl-lsch3 => arch-fsl-layerscape}/fdt.h  |   4 +
 .../fsl_serdes.h                                   |  11 +-
 .../immap_lsch3.h                                  | 119 ++++++++--
 .../arm/include/asm/arch-fsl-layerscape/imx-regs.h |  55 +++++
 .../ls2085a_stream_id.h                            |   0
 arch/arm/include/asm/arch-fsl-layerscape/mmu.h     |  10 +
 .../asm/arch-fsl-layerscape}/mp.h                  |  10 +-
 .../{arch-fsl-lsch3 => arch-fsl-layerscape}/soc.h  |  21 +-
 arch/arm/include/asm/arch-fsl-layerscape/speed.h   |  10 +
 arch/arm/include/asm/arch-fsl-lsch3/config.h       | 185 ---------------
 arch/arm/include/asm/arch-fsl-lsch3/gpio.h         |   9 -
 arch/arm/include/asm/arch-fsl-lsch3/imx-regs.h     |  13 --
 arch/arm/include/asm/config.h                      |   7 +-
 arch/arm/include/asm/global_data.h                 |   2 +-
 board/freescale/ls2085aqds/Kconfig                 |   2 +-
 board/freescale/ls2085aqds/eth.c                   |   1 -
 board/freescale/ls2085aqds/ls2085aqds.c            |   2 +-
 board/freescale/ls2085ardb/Kconfig                 |   2 +-
 board/freescale/ls2085ardb/eth_ls2085rdb.c         |   1 -
 board/freescale/ls2085ardb/ls2085ardb.c            |   2 +-
 drivers/i2c/mxc_i2c.c                              |   4 +-
 drivers/misc/fsl_debug_server.c                    |   1 -
 drivers/net/ldpaa_eth/ls2085a.c                    |   2 -
 drivers/pci/pcie_layerscape.c                      |   4 +-
 include/common.h                                   |   3 +
 include/configs/ls2085a_common.h                   |  47 +++-
 44 files changed, 712 insertions(+), 521 deletions(-)
arch/arm/cpu/armv8/Makefile +1 -1
index adb11b3..48c041b 100644
@@ -15,6 +15,6 @@ obj-y	+= cache.o
 obj-y	+= tlb.o
 obj-y	+= transition.o
 
-obj-$(CONFIG_FSL_LSCH3) += fsl-lsch3/
+obj-$(CONFIG_FSL_LAYERSCAPE) += fsl-layerscape/
 obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/
 obj-$(CONFIG_TARGET_HIKEY) += hisilicon/
arch/arm/cpu/armv8/fsl-layerscape/Makefile new file +21 -0
new file mode 100644
index 0000000..ccb3aa5
@@ -0,0 +1,21 @@
+#
+# Copyright 2014-2015, Freescale Semiconductor
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += cpu.o
+obj-y += lowlevel.o
+obj-y += soc.o
+obj-$(CONFIG_MP) += mp.o
+obj-$(CONFIG_OF_LIBFDT) += fdt.o
+obj-$(CONFIG_SPL) += spl.o
+
+ifneq ($(CONFIG_FSL_LSCH3),)
+obj-y += fsl_lsch3_speed.o
+obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch3_serdes.o
+endif
+
+ifneq ($(CONFIG_LS2085A),)
+obj-$(CONFIG_SYS_HAS_SERDES) += ls2085a_serdes.o
+endif
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 renamed from arch/arm/cpu/armv8/fsl-lsch3/README +0 -0
similarity index 100%
rename from arch/arm/cpu/armv8/fsl-lsch3/README
rename to arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
arch/arm/cpu/armv8/fsl-layerscape/cpu.c renamed from arch/arm/cpu/armv8/fsl-lsch3/cpu.c +63 -186

441 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-layerscape/cpu.h renamed from arch/arm/cpu/armv8/fsl-lsch3/cpu.h +1 -1
similarity index 71%
rename from arch/arm/cpu/armv8/fsl-lsch3/cpu.h
rename to arch/arm/cpu/armv8/fsl-layerscape/cpu.h
index 2e3312b..8072f3c 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014, Freescale Semiconductor
+ * Copyright 2014-2015, Freescale Semiconductor
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +13 -4
similarity index 94%
rename from arch/arm/cpu/armv8/fsl-lsch3/fdt.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 567c419..aa88d34 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -7,11 +7,16 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
-#include <asm/arch-fsl-lsch3/fdt.h>
+#include <phy.h>
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/fdt.h>
+#endif
 #ifdef CONFIG_FSL_ESDHC
 #include <fsl_esdhc.h>
 #endif
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
 #ifdef CONFIG_MP
 void ft_fixup_cpu(void *blob)
@@ -150,6 +155,7 @@ void append_mmu_masters(void *blob, const char *smmu_path,
  *      for all DPAA2 devices.
  *
  */
+#ifdef CONFIG_FSL_LSCH3
 static void fdt_fixup_smmu(void *blob)
 {
 	int nodeoffset;
@@ -165,6 +171,7 @@ static void fdt_fixup_smmu(void *blob)
 	fdt_fixup_smmu_pcie(blob);
 #endif
 }
+#endif
 
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
@@ -181,9 +188,11 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	ft_pci_setup(blob, bd);
 #endif
 
-#if defined(CONFIG_FSL_ESDHC)
+#ifdef CONFIG_FSL_ESDHC
 	fdt_fixup_esdhc(blob, bd);
 #endif
 
+#ifdef CONFIG_FSL_LSCH3
 	fdt_fixup_smmu(blob);
+#endif
 }
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fsl_lsch3_serdes.c +4 -4
similarity index 95%
rename from arch/arm/cpu/armv8/fsl-lsch3/fsl_lsch3_serdes.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
index ae08343..2ab8da6 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -8,7 +8,7 @@
 #include <asm/io.h>
 #include <asm/errno.h>
 #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
+#include <asm/arch/soc.h>
 #include <fsl-mc/ldpaa_wriop.h>
 
 #ifdef CONFIG_SYS_FSL_SRDS_1
@@ -35,7 +35,7 @@ int is_serdes_configured(enum srds_prtcl device)
 int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
 {
 	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-	u32 cfg = in_le32(&gur->rcwsr[28]);
+	u32 cfg = gur_in32(&gur->rcwsr[28]);
 	int i;
 
 	switch (sd) {
@@ -76,7 +76,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
 
 	memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map));
 
-	cfg = in_le32(&gur->rcwsr[28]) & sd_prctl_mask;
+	cfg = gur_in32(&gur->rcwsr[28]) & sd_prctl_mask;
 	cfg >>= sd_prctl_shift;
 	printf("Using SERDES%d Protocol: %d (0x%x)\n", sd + 1, cfg, cfg);
 
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c renamed from arch/arm/cpu/armv8/fsl-lsch3/speed.c +6 -6
similarity index 93%
rename from arch/arm/cpu/armv8/fsl-lsch3/speed.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
index d9f137c..4054c3c 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014, Freescale Semiconductor, Inc.
+ * Copyright 2014-2015, Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  *
@@ -11,8 +11,8 @@
 #include <fsl_ifc.h>
 #include <asm/processor.h>
 #include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/soc.h>
 #include "cpu.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -83,15 +83,15 @@ void get_sys_info(struct sys_info *sys_info)
 	sys_info->freq_ddrbus2 = sysclk;
 #endif
 
-	sys_info->freq_systembus *= (in_le32(&gur->rcwsr[0]) >>
+	sys_info->freq_systembus *= (gur_in32(&gur->rcwsr[0]) >>
 			FSL_CHASSIS3_RCWSR0_SYS_PLL_RAT_SHIFT) &
 			FSL_CHASSIS3_RCWSR0_SYS_PLL_RAT_MASK;
 	/* Platform clock is half of platform PLL */
 	sys_info->freq_systembus /= 2;
-	sys_info->freq_ddrbus *= (in_le32(&gur->rcwsr[0]) >>
+	sys_info->freq_ddrbus *= (gur_in32(&gur->rcwsr[0]) >>
 			FSL_CHASSIS3_RCWSR0_MEM_PLL_RAT_SHIFT) &
 			FSL_CHASSIS3_RCWSR0_MEM_PLL_RAT_MASK;
-	sys_info->freq_ddrbus2 *= (in_le32(&gur->rcwsr[0]) >>
+	sys_info->freq_ddrbus2 *= (gur_in32(&gur->rcwsr[0]) >>
 			FSL_CHASSIS3_RCWSR0_MEM2_PLL_RAT_SHIFT) &
 			FSL_CHASSIS3_RCWSR0_MEM2_PLL_RAT_MASK;
 
@@ -118,7 +118,7 @@ void get_sys_info(struct sys_info *sys_info)
 	}
 
 #if defined(CONFIG_FSL_IFC)
-	ccr = in_le32(&ifc_regs.gregs->ifc_ccr);
+	ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
 	ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
 
 	sys_info->freq_localbus = sys_info->freq_systembus / ccr;
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +11 -3
similarity index 97%
rename from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
rename to arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
index 6b19d36..2158a8b 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2014 Freescale Semiconductor
+ * (C) Copyright 2014-2015 Freescale Semiconductor
  *
  * SPDX-License-Identifier:	GPL-2.0+
  *
@@ -10,11 +10,14 @@
 #include <linux/linkage.h>
 #include <asm/gic.h>
 #include <asm/macro.h>
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
 ENTRY(lowlevel_init)
 	mov	x29, lr			/* Save LR */
 
+#ifdef CONFIG_FSL_LSCH3
 	/* Add fully-coherent masters to DVM domain */
 	ldr	x0, =CCI_MN_BASE
 	ldr	x1, =CCI_MN_RNF_NODEID_LIST
@@ -81,6 +84,7 @@ ENTRY(lowlevel_init)
 	ldr	x0, =CCI_S2_QOS_CONTROL_BASE(20)
 	ldr	x1, =0x00FF000C
 	bl	ccn504_set_qos
+#endif
 
 	/* Set the SMMU page size in the sACR register */
 	ldr	x1, =SMMU_BASE
@@ -106,10 +110,12 @@ ENTRY(lowlevel_init)
 
 	branch_if_master x0, x1, 2f
 
+#ifdef CONFIG_MP
 	ldr	x0, =secondary_boot_func
 	blr	x0
-2:
+#endif
 
+2:
 #ifdef CONFIG_FSL_TZPC_BP147
 	/* Set Non Secure access for all devices protected via TZPC */
 	ldr	x1, =TZPCDECPROT_0_SET_BASE /* Decode Protection-0 Set Reg */
@@ -245,6 +251,7 @@ ENTRY(__asm_flush_l3_cache)
 	ret
 ENDPROC(__asm_flush_l3_cache)
 
+#ifdef CONFIG_MP
 	/* Keep literals not used by the secondary boot code outside it */
 	.ltorg
 
@@ -353,3 +360,4 @@ __real_cntfrq:
 	/* Secondary Boot Code ends here */
 __secondary_boot_code_size:
 	.quad .-secondary_boot_code
+#endif
arch/arm/cpu/armv8/fsl-layerscape/ls2085a_serdes.c renamed from arch/arm/cpu/armv8/fsl-lsch3/ls2085a_serdes.c +1 -2
similarity index 97%
rename from arch/arm/cpu/armv8/fsl-lsch3/ls2085a_serdes.c
rename to arch/arm/cpu/armv8/fsl-layerscape/ls2085a_serdes.c
index 0b79a50..ea3114c 100644
@@ -1,12 +1,11 @@
 /*
- * Copyright 2015 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
 #include <common.h>
 #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 
 struct serdes_config {
 	u8 protocol;
arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +8 -7
similarity index 93%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.c
rename to arch/arm/cpu/armv8/fsl-layerscape/mp.c
index da7853a..04eaad6 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -7,9 +7,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/system.h>
-#include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
-#include "mp.h"
+#include <asm/arch/mp.h>
+#include <asm/arch/soc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -23,6 +22,7 @@ phys_addr_t determine_mp_bootpg(void)
 	return (phys_addr_t)&secondary_boot_code;
 }
 
+#ifdef CONFIG_LS2085A
 int fsl_lsch3_wake_seconday_cores(void)
 {
 	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
@@ -48,9 +48,9 @@ int fsl_lsch3_wake_seconday_cores(void)
 			   (CONFIG_MAX_CPUS*SPIN_TABLE_ELEM_SIZE));
 
 	printf("Waking secondary cores to start from %lx\n", gd->relocaddr);
-	out_le32(&gur->bootlocptrh, (u32)(gd->relocaddr >> 32));
-	out_le32(&gur->bootlocptrl, (u32)gd->relocaddr);
-	out_le32(&gur->scratchrw[6], 1);
+	gur_out32(&gur->bootlocptrh, (u32)(gd->relocaddr >> 32));
+	gur_out32(&gur->bootlocptrl, (u32)gd->relocaddr);
+	gur_out32(&gur->scratchrw[6], 1);
 	asm volatile("dsb st" : : : "memory");
 	rst->brrl = cores;
 	asm volatile("dsb st" : : : "memory");
@@ -84,6 +84,7 @@ int fsl_lsch3_wake_seconday_cores(void)
 
 	return 0;
 }
+#endif
 
 int is_core_valid(unsigned int core)
 {
arch/arm/cpu/armv8/fsl-layerscape/soc.c renamed from arch/arm/cpu/armv8/fsl-lsch3/soc.c +7 -28
similarity index 73%
rename from arch/arm/cpu/armv8/fsl-lsch3/soc.c
rename to arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 2538001..73e48a7 100644
@@ -1,19 +1,18 @@
 /*
- * Copyright 2015 Freescale Semiconductor
+ * Copyright 2014-2015 Freescale Semiconductor
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
 #include <common.h>
 #include <fsl_ifc.h>
-#include <nand.h>
-#include <spl.h>
-#include <asm/arch-fsl-lsch3/soc.h>
+#include <asm/arch/soc.h>
 #include <asm/io.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_LS2085A
 static void erratum_a008751(void)
 {
 #ifdef CONFIG_SYS_FSL_ERRATUM_A008751
@@ -77,31 +76,11 @@ void fsl_lsch3_early_init_f(void)
 	init_early_memctl_regs();	/* tighten IFC timing */
 	erratum_a009203();
 }
+#endif
 
-#ifdef CONFIG_SPL_BUILD
-void board_init_f(ulong dummy)
-{
-	/* Clear global data */
-	memset((void *)gd, 0, sizeof(gd_t));
-
-	arch_cpu_init();
-	board_early_init_f();
-	timer_init();
-	env_init();
-	gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
-
-	serial_init();
-	console_init_f();
-	dram_init();
-
-	/* Clear the BSS. */
-	memset(__bss_start, 0, __bss_end - __bss_start);
-
-	board_init_r(NULL, 0);
-}
-
-u32 spl_boot_device(void)
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
 {
-	return BOOT_DEVICE_NAND;
+	return 0;
 }
 #endif
arch/arm/cpu/armv8/fsl-layerscape/spl.c new file +76 -0

76 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-lsch3/Makefile deleted +0 -13
deleted file mode 100644
index 9f7815b..0000000
@@ -1,13 +0,0 @@
-#
-# Copyright 2014, Freescale Semiconductor
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-obj-y += cpu.o
-obj-y += lowlevel.o
-obj-y += soc.o
-obj-y += speed.o
-obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch3_serdes.o ls2085a_serdes.o
-obj-$(CONFIG_MP) += mp.o
-obj-$(CONFIG_OF_LIBFDT) += fdt.o
arch/arm/cpu/armv8/fsl-lsch3/speed.h deleted +0 -7
deleted file mode 100644
index 15af5b9..0000000
@@ -1,7 +0,0 @@
-/*
- * 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-layerscape/clock.h renamed from arch/arm/include/asm/arch-fsl-lsch3/clock.h +4 -4
similarity index 56%
rename from arch/arm/include/asm/arch-fsl-lsch3/clock.h
rename to arch/arm/include/asm/arch-fsl-layerscape/clock.h
index 62bc53c..6935913 100644
@@ -1,12 +1,12 @@
 /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2015 Freescale Semiconductor, Inc.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  *
  */
 
-#ifndef __ASM_ARCH_FSL_LSCH3_CLOCK_H_
-#define __ASM_ARCH_FSL_LSCH3_CLOCK_H_
+#ifndef __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_
+#define __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_
 
 #include <common.h>
 
@@ -21,4 +21,4 @@ enum mxc_clock {
 
 unsigned int mxc_get_clock(enum mxc_clock clk);
 
-#endif /* __ASM_ARCH_FSL_LSCH3_CLOCK_H_ */
+#endif /* __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_ */
arch/arm/include/asm/arch-fsl-layerscape/config.h new file +59 -0

59 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/cpu.h new file +165 -0

165 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/fdt.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fdt.h +4 -0
similarity index 71%
rename from arch/arm/include/asm/arch-fsl-lsch3/fdt.h
rename to arch/arm/include/asm/arch-fsl-layerscape/fdt.h
index 21d20fb..4da73ab 100644
@@ -4,7 +4,11 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_FDT_H_
+#define _ASM_ARMV8_FSL_LAYERSCAPE_FDT_H_
+
 void alloc_stream_ids(int start_id, int count, u32 *stream_ids, int max_cnt);
 void append_mmu_masters(void *blob, const char *smmu_path,
 			const char *master_name, u32 *stream_ids, int count);
 void fdt_fixup_smmu_pcie(void *blob);
+#endif	/* _ASM_ARMV8_FSL_LAYERSCAPE_FDT_H_ */
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +5 -6
similarity index 88%
rename from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h
rename to arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h
index 2810f3f..730c2b2 100644
@@ -4,13 +4,12 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#ifndef __FSL_SERDES_H
-#define __FSL_SERDES_H
+#ifndef __FSL_SERDES_H__
+#define __FSL_SERDES_H__
 
 #include <config.h>
 
-#define	SRDS_MAX_LANES	8
-
+#if defined(CONFIG_LS2085A)
 enum srds_prtcl {
 	NONE = 0,
 	PCIE1,
@@ -56,12 +55,12 @@ enum srds {
 	FSL_SRDS_1  = 0,
 	FSL_SRDS_2  = 1,
 };
+#endif
 
 int is_serdes_configured(enum srds_prtcl device);
 void fsl_serdes_init(void);
-
 int serdes_get_first_lane(u32 sd, enum srds_prtcl device);
 enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane);
 int is_serdes_prtcl_valid(int serdes, u32 prtcl);
 
-#endif /* __FSL_SERDES_H */
+#endif /* __FSL_SERDES_H__ */
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h renamed from arch/arm/include/asm/arch-fsl-lsch3/immap_lsch3.h +102 -17

136 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/imx-regs.h new file +55 -0

55 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/ls2085a_stream_id.h renamed from arch/arm/include/asm/arch-fsl-lsch3/ls2085a_stream_id.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/arch-fsl-lsch3/ls2085a_stream_id.h
rename to arch/arm/include/asm/arch-fsl-layerscape/ls2085a_stream_id.h
arch/arm/include/asm/arch-fsl-layerscape/mmu.h new file +10 -0
new file mode 100644
index 0000000..d54eacd
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2015, Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_
+#define _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_
+#include <asm/arch-armv8/mmu.h>
+#endif /* _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_ */
arch/arm/include/asm/arch-fsl-layerscape/mp.h renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.h +6 -4
similarity index 83%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.h
rename to arch/arm/include/asm/arch-fsl-layerscape/mp.h
index c985d6a..eb75117 100644
@@ -1,11 +1,11 @@
 /*
- * Copyright 2014, Freescale Semiconductor
+ * Copyright 2014-2015, Freescale Semiconductor
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#ifndef _FSL_CH3_MP_H
-#define _FSL_CH3_MP_H
+#ifndef _FSL_LAYERSCAPE_MP_H
+#define _FSL_LAYERSCAPE_MP_H
 
 /*
 * Each spin table element is defined as
@@ -29,10 +29,12 @@ extern u64 __spin_table[];
 extern u64 __real_cntfrq;
 extern u64 *secondary_boot_code;
 extern size_t __secondary_boot_code_size;
+#ifdef CONFIG_FSL_LSCH3
 int fsl_lsch3_wake_seconday_cores(void);
+#endif
 void *get_spin_tbl_addr(void);
 phys_addr_t determine_mp_bootpg(void);
 void secondary_boot_func(void);
 int is_core_online(u64 cpu_id);
 #endif
-#endif /* _FSL_CH3_MP_H */
+#endif /* _FSL_LAYERSCAPE_MP_H */
arch/arm/include/asm/arch-fsl-layerscape/soc.h renamed from arch/arm/include/asm/arch-fsl-lsch3/soc.h +20 -1
similarity index 50%
rename from arch/arm/include/asm/arch-fsl-lsch3/soc.h
rename to arch/arm/include/asm/arch-fsl-layerscape/soc.h
index 9a29272..f131f57 100644
@@ -4,6 +4,25 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
+#define _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
+
+#ifdef CONFIG_SYS_FSL_CCSR_GUR_LE
+#define gur_in32(a)       in_le32(a)
+#define gur_out32(a, v)   out_le32(a, v)
+#elif defined(CONFIG_SYS_FSL_CCSR_GUR_BE)
+#define gur_in32(a)       in_be32(a)
+#define gur_out32(a, v)   out_be32(a, v)
+#endif
+
+#ifdef CONFIG_SYS_FSL_CCSR_SCFG_LE
+#define scfg_in32(a)       in_le32(a)
+#define scfg_out32(a, v)   out_le32(a, v)
+#elif defined(CONFIG_SYS_FSL_CCSR_SCFG_BE)
+#define scfg_in32(a)       in_be32(a)
+#define scfg_out32(a, v)   out_be32(a, v)
+#endif
+
 struct cpu_type {
 	char name[15];
 	u32 soc_ver;
@@ -25,4 +44,4 @@ struct cpu_type {
 
 void fsl_lsch3_early_init_f(void);
 void cpu_name(char *name);
-
+#endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ */
arch/arm/include/asm/arch-fsl-layerscape/speed.h new file +10 -0
new file mode 100644
index 0000000..de795f6
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2014-2015, Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _FSL_LAYERSCAPE_SPEED_H
+#define _FSL_LAYERSCAPE_SPEED_H
+void get_sys_info(struct sys_info *sys_info);
+#endif /* _FSL_LAYERSCAPE_SPEED_H */
arch/arm/include/asm/arch-fsl-lsch3/config.h deleted +0 -185

185 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-lsch3/gpio.h deleted +0 -9
deleted file mode 100644
index f23a78c..0000000
@@ -1,9 +0,0 @@
-/*
- * Copyright 2014, Freescale Semiconductor
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef _ASM_ARMV8_FSL_LSCH3_GPIO_H_
-#define _ASM_ARMV8_FSL_LSCH3_GPIO_H_
-#endif	/* _ASM_ARMV8_FSL_LSCH3_GPIO_H_ */
arch/arm/include/asm/arch-fsl-lsch3/imx-regs.h deleted +0 -13
deleted file mode 100644
index 8f00535..0000000
@@ -1,13 +0,0 @@
-/*
- * Copyright 2014 Freescale Semiconductor, Inc.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- *
- */
-
-#ifndef __ASM_ARCH_FSL_LSCH3_IMX_REGS_H_
-#define __ASM_ARCH_FSL_LSCH3_IMX_REGS_H_
-
-#define I2C_QUIRK_REG	/* enable 8-bit driver */
-
-#endif /* __ASM_ARCH_FSL_LSCH3_IMX_REGS_H_ */
arch/arm/include/asm/config.h +2 -5
index 22fff02..435fc45 100644
@@ -15,14 +15,11 @@
 #define CONFIG_STATIC_RELA
 #endif
 
-#ifdef CONFIG_FSL_LSCH3
-#include <asm/arch-fsl-lsch3/config.h>
-#endif
-
 #if defined(CONFIG_LS102XA) || \
 	defined(CONFIG_CPU_PXA27X) || \
 	defined(CONFIG_CPU_MONAHANS) || \
-	defined(CONFIG_CPU_PXA25X)
+	defined(CONFIG_CPU_PXA25X) || \
+	defined(CONFIG_FSL_LAYERSCAPE)
 #include <asm/arch/config.h>
 #endif
 
arch/arm/include/asm/global_data.h +1 -1
index 4e3ea55..e7f21c6 100644
@@ -46,7 +46,7 @@ struct arch_global_data {
 	u32 omap_boot_mode;
 	u8 omap_ch_flags;
 #endif
-#ifdef CONFIG_FSL_LSCH3
+#ifdef CONFIG_FSL_LAYERSCAPE
 	unsigned long mem2_clk;
 #endif
 };
board/freescale/ls2085aqds/Kconfig +1 -1
index deb640d..8d6acba 100644
@@ -8,7 +8,7 @@ config SYS_VENDOR
 	default "freescale"
 
 config SYS_SOC
-	default "fsl-lsch3"
+	default "fsl-layerscape"
 
 config SYS_CONFIG_NAME
 	default "ls2085aqds"
board/freescale/ls2085aqds/eth.c +0 -1
index 007b433..b8a2bf4 100644
@@ -8,7 +8,6 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 #include <hwconfig.h>
 #include <fsl_mdio.h>
 #include <malloc.h>
board/freescale/ls2085aqds/ls2085aqds.c +1 -1
index 2315bdb..b02d6e8 100644
@@ -17,7 +17,7 @@
 #include <environment.h>
 #include <i2c.h>
 #include <rtc.h>
-#include <asm/arch-fsl-lsch3/soc.h>
+#include <asm/arch/soc.h>
 #include <hwconfig.h>
 
 #include "../common/qixis.h"
board/freescale/ls2085ardb/Kconfig +1 -1
index 85a3dcd..cb40db9 100644
@@ -8,7 +8,7 @@ config SYS_VENDOR
 	default "freescale"
 
 config SYS_SOC
-	default "fsl-lsch3"
+	default "fsl-layerscape"
 
 config SYS_CONFIG_NAME
 	default "ls2085ardb"
board/freescale/ls2085ardb/eth_ls2085rdb.c +0 -1
index 0a1163a..d578757 100644
@@ -16,7 +16,6 @@
 #include <asm/io.h>
 #include <exports.h>
 #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 #include <fsl-mc/ldpaa_wriop.h>
 
 DECLARE_GLOBAL_DATA_PTR;
board/freescale/ls2085ardb/ls2085ardb.c +1 -1
index 5e7997c..18953b8 100644
@@ -17,7 +17,7 @@
 #include <fsl-mc/fsl_mc.h>
 #include <environment.h>
 #include <i2c.h>
-#include <asm/arch-fsl-lsch3/soc.h>
+#include <asm/arch/soc.h>
 
 #include "../common/qixis.h"
 #include "ls2085ardb_qixis.h"
drivers/i2c/mxc_i2c.c +2 -2
index 0f977d7..fa4c82f 100644
@@ -523,8 +523,8 @@ static int bus_i2c_write(struct mxc_i2c_bus *i2c_bus, u8 chip, u32 addr,
 #endif
 
 static struct mxc_i2c_bus mxc_i2c_buses[] = {
-#if defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LSCH3) || \
-		defined(CONFIG_VF610)
+#if defined(CONFIG_LS102XA) || defined(CONFIG_VF610) || \
+	defined(CONFIG_FSL_LAYERSCAPE)
 	{ 0, I2C1_BASE_ADDR, I2C_QUIRK_FLAG },
 	{ 1, I2C2_BASE_ADDR, I2C_QUIRK_FLAG },
 	{ 2, I2C3_BASE_ADDR, I2C_QUIRK_FLAG },
drivers/misc/fsl_debug_server.c +0 -1
index a592891..98d9fbe 100644
@@ -8,7 +8,6 @@
 #include <errno.h>
 #include <asm/io.h>
 #include <asm/system.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 
 #include <fsl-mc/fsl_mc.h>
 #include <fsl_debug_server.h>
drivers/net/ldpaa_eth/ls2085a.c +0 -2
index 6b7960a..93ed4f1 100644
@@ -7,9 +7,7 @@
 #include <phy.h>
 #include <fsl-mc/ldpaa_wriop.h>
 #include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 #include <asm/arch/fsl_serdes.h>
-#include <fsl-mc/ldpaa_wriop.h>
 
 u32 dpmac_to_devdisr[] = {
 	[WRIOP1_DPMAC1] = FSL_CHASSIS3_DEVDISR2_DPMAC1,
drivers/pci/pcie_layerscape.c +3 -1
index 2f24a6a..4cee038 100644
@@ -11,7 +11,9 @@
 #include <asm/io.h>
 #include <errno.h>
 #include <malloc.h>
-#include <asm/arch-fsl-lsch3/fdt.h>
+#ifdef CONFIG_FSL_LAYERSCAPE
+#include <asm/arch/fdt.h>
+#endif
 
 #ifndef CONFIG_SYS_PCI_MEMORY_BUS
 #define CONFIG_SYS_PCI_MEMORY_BUS CONFIG_SYS_SDRAM_BASE
include/common.h +3 -0
index ecb1f06..142936b 100644
@@ -76,6 +76,9 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_SOC_DA8XX
 #include <asm/arch/hardware.h>
 #endif
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
include/configs/ls2085a_common.h +45 -2

72 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324
#15 lore raw

PATCH v5 11/17 armv8/fsl_lsch3: Change arch to fsl-layerscape

Quoted 56 lines · Gong Qianyu

From: Mingkai Hu <[email protected]>

There are two LS series processors are built on ARMv8 Layersacpe architecture currently, LS2085A and LS1043A. They are based on ARMv8 core although use different chassis, so create fsl-layerscape to refactor the common code for the LS series processors which also paves the way for adding LS1043A platform.

---
V5:
- Move LS2085A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in soc.h
- Modify fsl-layerscape/Makefile.
V4:
- New patch.

 arch/arm/cpu/armv8/Makefile                        |   2 +-
 arch/arm/cpu/armv8/fsl-layerscape/Makefile         |  21 ++
 .../README => fsl-layerscape/README.lsch3}         |   0
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.c  | 249 ++++++---------------
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.h  |   2 +-
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/fdt.c  |  17 +-
 .../fsl_lsch3_serdes.c                             |   8 +-
 .../speed.c => fsl-layerscape/fsl_lsch3_speed.c}   |  12 +-
 .../armv8/{fsl-lsch3 => fsl-layerscape}/lowlevel.S |  14 +-
 .../{fsl-lsch3 => fsl-layerscape}/ls2085a_serdes.c |   3 +-
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/mp.c   |  15 +-
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/soc.c  |  35 +--
 arch/arm/cpu/armv8/fsl-layerscape/spl.c            |  76 +++++++
 arch/arm/cpu/armv8/fsl-lsch3/Makefile              |  13 --
 arch/arm/cpu/armv8/fsl-lsch3/speed.h               |   7 -
 .../clock.h                                        |   8 +-
 arch/arm/include/asm/arch-fsl-layerscape/config.h  |  59 +++++
 arch/arm/include/asm/arch-fsl-layerscape/cpu.h     | 165 ++++++++++++++
 .../{arch-fsl-lsch3 => arch-fsl-layerscape}/fdt.h  |   4 +
 .../fsl_serdes.h                                   |  11 +-
 .../immap_lsch3.h                                  | 119 ++++++++--
 .../arm/include/asm/arch-fsl-layerscape/imx-regs.h |  55 +++++
 .../ls2085a_stream_id.h                            |   0
 arch/arm/include/asm/arch-fsl-layerscape/mmu.h     |  10 +
 .../asm/arch-fsl-layerscape}/mp.h                  |  10 +-
 .../{arch-fsl-lsch3 => arch-fsl-layerscape}/soc.h  |  21 +-
 arch/arm/include/asm/arch-fsl-layerscape/speed.h   |  10 +
 arch/arm/include/asm/arch-fsl-lsch3/config.h       | 185 ---------------
 arch/arm/include/asm/arch-fsl-lsch3/gpio.h         |   9 -
 arch/arm/include/asm/arch-fsl-lsch3/imx-regs.h     |  13 --
 arch/arm/include/asm/config.h                      |   7 +-
 arch/arm/include/asm/global_data.h                 |   2 +-
 board/freescale/ls2085aqds/Kconfig                 |   2 +-
 board/freescale/ls2085aqds/eth.c                   |   1 -
 board/freescale/ls2085aqds/ls2085aqds.c            |   2 +-
 board/freescale/ls2085ardb/Kconfig                 |   2 +-
 board/freescale/ls2085ardb/eth_ls2085rdb.c         |   1 -
Quoted 9 lines
 board/freescale/ls2085ardb/ls2085ardb.c            |   2 +-
 drivers/i2c/mxc_i2c.c                              |   4 +-
 drivers/misc/fsl_debug_server.c                    |   1 -
 drivers/net/ldpaa_eth/ls2085a.c                    |   2 -
 drivers/pci/pcie_layerscape.c                      |   4 +-
 include/common.h                                   |   3 +
 include/configs/ls2085a_common.h                   |  47 +++-
 44 files changed, 712 insertions(+), 521 deletions(-)

You missed board/freescale/ls2085a/Kconfig and board/freescale/ls2085a/ls2085a.c.

York

#16 lore raw

PATCH v5 11/17 armv8/fsl_lsch3: Change arch to fsl-layerscape

In reply to Gong Qianyu
Quoted 635 lines · Gong Qianyu

From: Mingkai Hu <[email protected]>

There are two LS series processors are built on ARMv8 Layersacpe architecture currently, LS2085A and LS1043A. They are based on ARMv8 core although use different chassis, so create fsl-layerscape to refactor the common code for the LS series processors which also paves the way for adding LS1043A platform.

---
V5:
- Move LS2085A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in soc.h
- Modify fsl-layerscape/Makefile.
V4:
- New patch.

  arch/arm/cpu/armv8/Makefile                        |   2 +-
  arch/arm/cpu/armv8/fsl-layerscape/Makefile         |  21 ++
  .../README => fsl-layerscape/README.lsch3}         |   0
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.c  | 249 ++++++---------------
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.h  |   2 +-
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/fdt.c  |  17 +-
  .../fsl_lsch3_serdes.c                             |   8 +-
  .../speed.c => fsl-layerscape/fsl_lsch3_speed.c}   |  12 +-
  .../armv8/{fsl-lsch3 => fsl-layerscape}/lowlevel.S |  14 +-
  .../{fsl-lsch3 => fsl-layerscape}/ls2085a_serdes.c |   3 +-
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/mp.c   |  15 +-
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/soc.c  |  35 +--
  arch/arm/cpu/armv8/fsl-layerscape/spl.c            |  76 +++++++
  arch/arm/cpu/armv8/fsl-lsch3/Makefile              |  13 --
  arch/arm/cpu/armv8/fsl-lsch3/speed.h               |   7 -
  .../clock.h                                        |   8 +-
  arch/arm/include/asm/arch-fsl-layerscape/config.h  |  59 +++++
  arch/arm/include/asm/arch-fsl-layerscape/cpu.h     | 165 ++++++++++++++
  .../{arch-fsl-lsch3 => arch-fsl-layerscape}/fdt.h  |   4 +
  .../fsl_serdes.h                                   |  11 +-
  .../immap_lsch3.h                                  | 119 ++++++++--
  .../arm/include/asm/arch-fsl-layerscape/imx-regs.h |  55 +++++
  .../ls2085a_stream_id.h                            |   0
  arch/arm/include/asm/arch-fsl-layerscape/mmu.h     |  10 +
  .../asm/arch-fsl-layerscape}/mp.h                  |  10 +-
  .../{arch-fsl-lsch3 => arch-fsl-layerscape}/soc.h  |  21 +-
  arch/arm/include/asm/arch-fsl-layerscape/speed.h   |  10 +
  arch/arm/include/asm/arch-fsl-lsch3/config.h       | 185 ---------------
  arch/arm/include/asm/arch-fsl-lsch3/gpio.h         |   9 -
  arch/arm/include/asm/arch-fsl-lsch3/imx-regs.h     |  13 --
  arch/arm/include/asm/config.h                      |   7 +-
  arch/arm/include/asm/global_data.h                 |   2 +-
  board/freescale/ls2085aqds/Kconfig                 |   2 +-
  board/freescale/ls2085aqds/eth.c                   |   1 -
  board/freescale/ls2085aqds/ls2085aqds.c            |   2 +-
  board/freescale/ls2085ardb/Kconfig                 |   2 +-
  board/freescale/ls2085ardb/eth_ls2085rdb.c         |   1 -
  board/freescale/ls2085ardb/ls2085ardb.c            |   2 +-
  drivers/i2c/mxc_i2c.c                              |   4 +-
  drivers/misc/fsl_debug_server.c                    |   1 -
  drivers/net/ldpaa_eth/ls2085a.c                    |   2 -
  drivers/pci/pcie_layerscape.c                      |   4 +-
  include/common.h                                   |   3 +
  include/configs/ls2085a_common.h                   |  47 +++-
  44 files changed, 712 insertions(+), 521 deletions(-)
arch/arm/cpu/armv8/Makefile +1 -1
index adb11b3..48c041b 100644
@@ -15,6 +15,6 @@ obj-y	+= cache.o
  obj-y	+= tlb.o
  obj-y	+= transition.o
 
-obj-$(CONFIG_FSL_LSCH3) += fsl-lsch3/
+obj-$(CONFIG_FSL_LAYERSCAPE) += fsl-layerscape/
  obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/
  obj-$(CONFIG_TARGET_HIKEY) += hisilicon/
arch/arm/cpu/armv8/fsl-layerscape/Makefile new file +21 -0
new file mode 100644
index 0000000..ccb3aa5
@@ -0,0 +1,21 @@
+#
+# Copyright 2014-2015, Freescale Semiconductor
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += cpu.o
+obj-y += lowlevel.o
+obj-y += soc.o
+obj-$(CONFIG_MP) += mp.o
+obj-$(CONFIG_OF_LIBFDT) += fdt.o
+obj-$(CONFIG_SPL) += spl.o
+
+ifneq ($(CONFIG_FSL_LSCH3),)
+obj-y += fsl_lsch3_speed.o
+obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch3_serdes.o
+endif
+
+ifneq ($(CONFIG_LS2085A),)
+obj-$(CONFIG_SYS_HAS_SERDES) += ls2085a_serdes.o
+endif
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 renamed from arch/arm/cpu/armv8/fsl-lsch3/README +0 -0
similarity index 100%
rename from arch/arm/cpu/armv8/fsl-lsch3/README
rename to arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
arch/arm/cpu/armv8/fsl-layerscape/cpu.c renamed from arch/arm/cpu/armv8/fsl-lsch3/cpu.c +63 -186
similarity index 59%
rename from arch/arm/cpu/armv8/fsl-lsch3/cpu.c
rename to arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index eb1213e..c847a7b 100644
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -10,34 +10,28 @@
  #include <asm/system.h>
  #include <asm/armv8/mmu.h>
  #include <asm/io.h>
-#include <asm/arch-fsl-lsch3/soc.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
+#include <asm/arch/fsl_serdes.h>
+#include <asm/arch/soc.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/speed.h>
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
+#include <fm_eth.h>
  #include <fsl_debug_server.h>
  #include <fsl-mc/fsl_mc.h>
-#include <asm/arch/fsl_serdes.h>
  #ifdef CONFIG_FSL_ESDHC
  #include <fsl_esdhc.h>
  #endif
-#include "cpu.h"
-#include "mp.h"
-#include "speed.h"
 
  DECLARE_GLOBAL_DATA_PTR;
 
-static struct cpu_type cpu_type_list[] = {
-#ifdef CONFIG_LS2085A
-	CPU_TYPE_ENTRY(LS2085, LS2085, 8),
-	CPU_TYPE_ENTRY(LS2080, LS2080, 8),
-	CPU_TYPE_ENTRY(LS2045, LS2045, 4),
-#endif
-};
-
  void cpu_name(char *name)
  {
  	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
  	unsigned int i, svr, ver;
 
-	svr = in_le32(&gur->svr);
+	svr = gur_in32(&gur->svr);
  	ver = SVR_SOC_VER(svr);
 
  	for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
@@ -54,146 +48,6 @@ void cpu_name(char *name)
  }
 
  #ifndef CONFIG_SYS_DCACHE_OFF
-
-#define SECTION_SHIFT_L0		39UL
-#define SECTION_SHIFT_L1		30UL
-#define SECTION_SHIFT_L2		21UL
-#define BLOCK_SIZE_L0			0x8000000000
-#define BLOCK_SIZE_L1			0x40000000
-#define BLOCK_SIZE_L2			0x200000
-
-#define NUM_OF_ENTRY		512
-
-#define TCR_EL2_PS_40BIT	(2 << 16)
-#define LSCH3_VA_BITS		(40)
-#define LSCH3_TCR	(TCR_TG0_4K		| \
-			TCR_EL2_PS_40BIT	| \
-			TCR_SHARED_NON		| \
-			TCR_ORGN_NC		| \
-			TCR_IRGN_NC		| \
-			TCR_T0SZ(LSCH3_VA_BITS))
-#define LSCH3_TCR_FINAL	(TCR_TG0_4K		| \
-			TCR_EL2_PS_40BIT	| \
-			TCR_SHARED_OUTER	| \
-			TCR_ORGN_WBWA		| \
-			TCR_IRGN_WBWA		| \
-			TCR_T0SZ(LSCH3_VA_BITS))
-
-#define CONFIG_SYS_FSL_CCSR_BASE	0x00000000
-#define CONFIG_SYS_FSL_CCSR_SIZE	0x10000000
-#define CONFIG_SYS_FSL_QSPI_BASE1	0x20000000
-#define CONFIG_SYS_FSL_QSPI_SIZE1	0x10000000
-#define CONFIG_SYS_FSL_IFC_BASE1	0x30000000
-#define CONFIG_SYS_FSL_IFC_SIZE1	0x10000000
-#define CONFIG_SYS_FSL_IFC_SIZE1_1	0x400000
-#define CONFIG_SYS_FSL_DRAM_BASE1	0x80000000
-#define CONFIG_SYS_FSL_DRAM_SIZE1	0x80000000
-#define CONFIG_SYS_FSL_QSPI_BASE2	0x400000000
-#define CONFIG_SYS_FSL_QSPI_SIZE2	0x100000000
-#define CONFIG_SYS_FSL_IFC_BASE2	0x500000000
-#define CONFIG_SYS_FSL_IFC_SIZE2	0x100000000
-#define CONFIG_SYS_FSL_DCSR_BASE	0x700000000
-#define CONFIG_SYS_FSL_DCSR_SIZE	0x40000000
-#define CONFIG_SYS_FSL_MC_BASE		0x80c000000
-#define CONFIG_SYS_FSL_MC_SIZE		0x4000000
-#define CONFIG_SYS_FSL_NI_BASE		0x810000000
-#define CONFIG_SYS_FSL_NI_SIZE		0x8000000
-#define CONFIG_SYS_FSL_QBMAN_BASE	0x818000000
-#define CONFIG_SYS_FSL_QBMAN_SIZE	0x8000000
-#define CONFIG_SYS_FSL_QBMAN_SIZE_1	0x4000000
-#define CONFIG_SYS_PCIE1_PHYS_SIZE	0x200000000
-#define CONFIG_SYS_PCIE2_PHYS_SIZE	0x200000000
-#define CONFIG_SYS_PCIE3_PHYS_SIZE	0x200000000
-#define CONFIG_SYS_PCIE4_PHYS_SIZE	0x200000000
-#define CONFIG_SYS_FSL_WRIOP1_BASE	0x4300000000
-#define CONFIG_SYS_FSL_WRIOP1_SIZE	0x100000000
-#define CONFIG_SYS_FSL_AIOP1_BASE	0x4b00000000
-#define CONFIG_SYS_FSL_AIOP1_SIZE	0x100000000
-#define CONFIG_SYS_FSL_PEBUF_BASE	0x4c00000000
-#define CONFIG_SYS_FSL_PEBUF_SIZE	0x400000000
-#define CONFIG_SYS_FSL_DRAM_BASE2	0x8080000000
-#define CONFIG_SYS_FSL_DRAM_SIZE2	0x7F80000000
-
-struct sys_mmu_table {
-	u64 virt_addr;
-	u64 phys_addr;
-	u64 size;
-	u64 memory_type;
-	u64 share;
-};
-
-static const struct sys_mmu_table lsch3_early_mmu_table[] = {
-	{ CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
-	  CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
-	  CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
-	/* For IFC Region #1, only the first 4MB is cache-enabled */
-	{ CONFIG_SYS_FSL_IFC_BASE1, CONFIG_SYS_FSL_IFC_BASE1,
-	  CONFIG_SYS_FSL_IFC_SIZE1_1, MT_NORMAL, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_IFC_BASE1 + CONFIG_SYS_FSL_IFC_SIZE1_1,
-	  CONFIG_SYS_FSL_IFC_BASE1 + CONFIG_SYS_FSL_IFC_SIZE1_1,
-	  CONFIG_SYS_FSL_IFC_SIZE1 - CONFIG_SYS_FSL_IFC_SIZE1_1,
-	  MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FSL_IFC_BASE1,
-	  CONFIG_SYS_FSL_IFC_SIZE1, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
-	  CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL, PMD_SECT_OUTER_SHARE },
-	{ CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
-	  CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
-	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
-};
-
-static const struct sys_mmu_table lsch3_final_mmu_table[] = {
-	{ CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
-	  CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
-	  CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
-	  CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL, PMD_SECT_OUTER_SHARE },
-	{ CONFIG_SYS_FSL_QSPI_BASE2, CONFIG_SYS_FSL_QSPI_BASE2,
-	  CONFIG_SYS_FSL_QSPI_SIZE2, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_IFC_BASE2, CONFIG_SYS_FSL_IFC_BASE2,
-	  CONFIG_SYS_FSL_IFC_SIZE2, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
-	  CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_MC_BASE, CONFIG_SYS_FSL_MC_BASE,
-	  CONFIG_SYS_FSL_MC_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_NI_BASE, CONFIG_SYS_FSL_NI_BASE,
-	  CONFIG_SYS_FSL_NI_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	/* For QBMAN portal, only the first 64MB is cache-enabled */
-	{ CONFIG_SYS_FSL_QBMAN_BASE, CONFIG_SYS_FSL_QBMAN_BASE,
-	  CONFIG_SYS_FSL_QBMAN_SIZE_1, MT_NORMAL, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_QBMAN_BASE + CONFIG_SYS_FSL_QBMAN_SIZE_1,
-	  CONFIG_SYS_FSL_QBMAN_BASE + CONFIG_SYS_FSL_QBMAN_SIZE_1,
-	  CONFIG_SYS_FSL_QBMAN_SIZE - CONFIG_SYS_FSL_QBMAN_SIZE_1,
-	  MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_PCIE1_PHYS_ADDR, CONFIG_SYS_PCIE1_PHYS_ADDR,
-	  CONFIG_SYS_PCIE1_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_PCIE2_PHYS_ADDR, CONFIG_SYS_PCIE2_PHYS_ADDR,
-	  CONFIG_SYS_PCIE2_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_PCIE3_PHYS_ADDR, CONFIG_SYS_PCIE3_PHYS_ADDR,
-	  CONFIG_SYS_PCIE3_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-#ifdef CONFIG_LS2085A
-	{ CONFIG_SYS_PCIE4_PHYS_ADDR, CONFIG_SYS_PCIE4_PHYS_ADDR,
-	  CONFIG_SYS_PCIE4_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-#endif
-	{ CONFIG_SYS_FSL_WRIOP1_BASE, CONFIG_SYS_FSL_WRIOP1_BASE,
-	  CONFIG_SYS_FSL_WRIOP1_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_AIOP1_BASE, CONFIG_SYS_FSL_AIOP1_BASE,
-	  CONFIG_SYS_FSL_AIOP1_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_PEBUF_BASE, CONFIG_SYS_FSL_PEBUF_BASE,
-	  CONFIG_SYS_FSL_PEBUF_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
-	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
-	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
-};
-
-struct table_info {
-	u64 *ptr;
-	u64 table_base;
-	u64 entry_size;
-};
-
  /*
   * Set the block entries according to the information of the table.
   */
@@ -311,6 +165,7 @@ static inline void early_mmu_setup(void)
  	u64 *level1_table1 = (u64 *)(CONFIG_SYS_FSL_OCRAM_BASE + 0x2000);
  	u64 *level2_table0 = (u64 *)(CONFIG_SYS_FSL_OCRAM_BASE + 0x3000);
  	u64 *level2_table1 = (u64 *)(CONFIG_SYS_FSL_OCRAM_BASE + 0x4000);
+
  	struct table_info table = {level0_table, 0, BLOCK_SIZE_L0};
 
  	/* Invalidate all table entries */
@@ -320,19 +175,21 @@ static inline void early_mmu_setup(void)
  	set_pgtable_table(level0_table, 0, level1_table0);
  	set_pgtable_table(level0_table, 1, level1_table1);
  	set_pgtable_table(level1_table0, 0, level2_table0);
+
+#ifdef CONFIG_FSL_LSCH3
  	set_pgtable_table(level1_table0,
  			  CONFIG_SYS_FLASH_BASE >> SECTION_SHIFT_L1,
  			  level2_table1);
-
+#endif
  	/* Find the table and fill in the block entries */
-	for (i = 0; i < ARRAY_SIZE(lsch3_early_mmu_table); i++) {
-		if (find_table(&lsch3_early_mmu_table[i],
+	for (i = 0; i < ARRAY_SIZE(early_mmu_table); i++) {
+		if (find_table(&early_mmu_table[i],
  			       &table, level0_table) == 0) {
  			/*
  			 * If find_table() returns error, it cannot be dealt
  			 * with here. Breakpoint can be added for debugging.
  			 */
-			set_block_entry(&lsch3_early_mmu_table[i], &table);
+			set_block_entry(&early_mmu_table[i], &table);
  			/*
  			 * If set_block_entry() returns error, it cannot be
  			 * dealt with here too.
@@ -341,7 +198,9 @@ static inline void early_mmu_setup(void)
  	}
 
  	el = current_el();
-	set_ttbr_tcr_mair(el, (u64)level0_table, LSCH3_TCR, MEMORY_ATTRIBUTES);
+
+	set_ttbr_tcr_mair(el, (u64)level0_table, LAYERSCAPE_TCR,
+			  MEMORY_ATTRIBUTES);
  	set_sctlr(get_sctlr() | CR_M);
  }
 
@@ -353,6 +212,8 @@ static inline void early_mmu_setup(void)
   * Level 1 table 0 contains 512 entries for each 1GB from 0 to 512GB.
   * Level 1 table 1 contains 512 entries for each 1GB from 512GB to 1TB.
   * Level 2 table 0 contains 512 entries for each 2MB from 0 to 1GB.
+ *
+ * For LSCH3:
   * Level 2 table 1 contains 512 entries for each 2MB from 32GB to 33GB.
   */
  static inline void final_mmu_setup(void)
@@ -362,7 +223,9 @@ static inline void final_mmu_setup(void)
  	u64 *level1_table0 = (u64 *)(gd->arch.tlb_addr + 0x1000);
  	u64 *level1_table1 = (u64 *)(gd->arch.tlb_addr + 0x2000);
  	u64 *level2_table0 = (u64 *)(gd->arch.tlb_addr + 0x3000);
+#ifdef CONFIG_FSL_LSCH3
  	u64 *level2_table1 = (u64 *)(gd->arch.tlb_addr + 0x4000);
+#endif
  	struct table_info table = {level0_table, 0, BLOCK_SIZE_L0};
 
  	/* Invalidate all table entries */
@@ -372,23 +235,25 @@ static inline void final_mmu_setup(void)
  	set_pgtable_table(level0_table, 0, level1_table0);
  	set_pgtable_table(level0_table, 1, level1_table1);
  	set_pgtable_table(level1_table0, 0, level2_table0);
+#ifdef CONFIG_FSL_LSCH3
  	set_pgtable_table(level1_table0,
  			  CONFIG_SYS_FSL_QBMAN_BASE >> SECTION_SHIFT_L1,
  			  level2_table1);
+#endif
 
  	/* Find the table and fill in the block entries */
-	for (i = 0; i < ARRAY_SIZE(lsch3_final_mmu_table); i++) {
-		if (find_table(&lsch3_final_mmu_table[i],
+	for (i = 0; i < ARRAY_SIZE(final_mmu_table); i++) {
+		if (find_table(&final_mmu_table[i],
  			       &table, level0_table) == 0) {
-			if (set_block_entry(&lsch3_final_mmu_table[i],
+			if (set_block_entry(&final_mmu_table[i],
  					    &table) != 0) {
  				printf("MMU error: could not set block entry for %p\n",
-				       &lsch3_final_mmu_table[i]);
+				       &final_mmu_table[i]);
  			}
 
  		} else {
  			printf("MMU error: could not find the table for %p\n",
-			       &lsch3_final_mmu_table[i]);
+			       &final_mmu_table[i]);
  		}
  	}
 
@@ -398,7 +263,8 @@ static inline void final_mmu_setup(void)
 
  	/* point TTBR to the new table */
  	el = current_el();
-	set_ttbr_tcr_mair(el, (u64)level0_table, LSCH3_TCR_FINAL,
+
+	set_ttbr_tcr_mair(el, (u64)level0_table, LAYERSCAPE_TCR_FINAL,
  			  MEMORY_ATTRIBUTES);
  	/*
  	 * MMU is already enabled, just need to invalidate TLB to load the
@@ -434,8 +300,9 @@ static inline u32 initiator_type(u32 cluster, int init_id)
  {
  	struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
  	u32 idx = (cluster >> (init_id * 8)) & TP_CLUSTER_INIT_MASK;
-	u32 type = in_le32(&gur->tp_ityp[idx]);
+	u32 type = 0;
 
+	type = gur_in32(&gur->tp_ityp[idx]);
  	if (type & TP_ITYP_AV)
  		return type;
 
@@ -450,7 +317,8 @@ u32 cpu_mask(void)
 
  	do {
  		int j;
-		cluster = in_le32(&gur->tp_cluster[i].lower);
+
+		cluster = gur_in32(&gur->tp_cluster[i].lower);
  		for (j = 0; j < TP_INIT_PER_CLUSTER; j++) {
  			type = initiator_type(cluster, j);
  			if (type) {
@@ -460,7 +328,7 @@ u32 cpu_mask(void)
  			}
  		}
  		i++;
-	} while ((cluster & TP_CLUSTER_EOC) != TP_CLUSTER_EOC);
+	} while ((cluster & TP_CLUSTER_EOC) == 0x0);
 
  	return mask;
  }
@@ -482,7 +350,8 @@ int fsl_qoriq_core_to_cluster(unsigned int core)
 
  	do {
  		int j;
-		cluster = in_le32(&gur->tp_cluster[i].lower);
+
+		cluster = gur_in32(&gur->tp_cluster[i].lower);
  		for (j = 0; j < TP_INIT_PER_CLUSTER; j++) {
  			if (initiator_type(cluster, j)) {
  				if (count == core)
@@ -491,7 +360,7 @@ int fsl_qoriq_core_to_cluster(unsigned int core)
  			}
  		}
  		i++;
-	} while ((cluster & TP_CLUSTER_EOC) != TP_CLUSTER_EOC);
+	} while ((cluster & TP_CLUSTER_EOC) == 0x0);
 
  	return -1;      /* cannot identify the cluster */
  }
@@ -505,7 +374,8 @@ u32 fsl_qoriq_core_to_type(unsigned int core)
 
  	do {
  		int j;
-		cluster = in_le32(&gur->tp_cluster[i].lower);
+
+		cluster = gur_in32(&gur->tp_cluster[i].lower);
  		for (j = 0; j < TP_INIT_PER_CLUSTER; j++) {
  			type = initiator_type(cluster, j);
  			if (type) {
@@ -515,7 +385,7 @@ u32 fsl_qoriq_core_to_type(unsigned int core)
  			}
  		}
  		i++;
-	} while ((cluster & TP_CLUSTER_EOC) != TP_CLUSTER_EOC);
+	} while ((cluster & TP_CLUSTER_EOC) == 0x0);
 
  	return -1;      /* cannot identify the cluster */
  }
@@ -527,15 +397,13 @@ int print_cpuinfo(void)
  	struct sys_info sysinfo;
  	char buf[32];
  	unsigned int i, core;
-	u32 type;
+	u32 type, rcw;
 
  	puts("SoC: ");
 
  	cpu_name(buf);
-	printf(" %s (0x%x)\n", buf, in_le32(&gur->svr));
-
+	printf(" %s (0x%x)\n", buf, gur_in32(&gur->svr));
  	memset((u8 *)buf, 0x00, ARRAY_SIZE(buf));
-
  	get_sys_info(&sysinfo);
  	puts("Clock Configuration:");
  	for_each_cpu(i, core, cpu_numcores(), cpu_mask()) {
@@ -551,18 +419,20 @@ 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_FSL_LSCH3
  	printf("     DP-DDR:   %-4s MT/s", strmhz(buf, sysinfo.freq_ddrbus2));
+#endif
  	puts("\n");
 
-	/* Display the RCW, so that no one gets confused as to what RCW
+	/*
+	 * Display the RCW, so that no one gets confused as to what RCW
  	 * we're actually using for this boot.
  	 */
  	puts("Reset Configuration Word (RCW):");
  	for (i = 0; i < ARRAY_SIZE(gur->rcwsr); i++) {
-		u32 rcw = in_le32(&gur->rcwsr[i]);
-
+		rcw = gur_in32(&gur->rcwsr[i]);
  		if ((i % 4) == 0)
-			printf("\n       %02x:", i * 4);
+			printf("\n       %08x:", i * 4);
  		printf(" %08x", rcw);
  	}
  	puts("\n");
@@ -590,11 +460,14 @@ int cpu_eth_init(bd_t *bis)
 
  int arch_early_init_r(void)
  {
-	int rv;
+#ifdef CONFIG_MP
+	int rv = 1;
+#ifdef CONFIG_FSL_LSCH3
  	rv = fsl_lsch3_wake_seconday_cores();
-
+#endif
  	if (rv)
  		printf("Did not wake secondary cores\n");
+#endif
 
  #ifdef CONFIG_SYS_HAS_SERDES
  	fsl_serdes_init();
@@ -605,7 +478,9 @@ int arch_early_init_r(void)
  int timer_init(void)
  {
  	u32 __iomem *cntcr = (u32 *)CONFIG_SYS_FSL_TIMER_ADDR;
+#ifdef CONFIG_FSL_LSCH3
  	u32 __iomem *cltbenr = (u32 *)CONFIG_SYS_FSL_PMU_CLTBENR;
+#endif
  #ifdef COUNTER_FREQUENCY_REAL
  	unsigned long cntfrq = COUNTER_FREQUENCY_REAL;
 
@@ -613,10 +488,12 @@ int timer_init(void)
  	asm volatile("msr cntfrq_el0, %0" : : "r" (cntfrq) : "memory");
  #endif
 
+#ifdef CONFIG_FSL_LSCH3
  	/* Enable timebase for all clusters.
  	 * It is safe to do so even some clusters are not enabled.
  	 */
  	out_le32(cltbenr, 0xf);
+#endif
 
  	/* Enable clock for timer
  	 * This is a global setting.
@@ -632,7 +509,7 @@ void reset_cpu(ulong addr)
  	u32 val;
 
  	/* Raise RESET_REQ_B */
-	val = in_le32(rstcr);
+	val = scfg_in32(rstcr);
  	val |= 0x02;
-	out_le32(rstcr, val);
+	scfg_out32(rstcr, val);
  }
arch/arm/cpu/armv8/fsl-layerscape/cpu.h renamed from arch/arm/cpu/armv8/fsl-lsch3/cpu.h +1 -1
similarity index 71%
rename from arch/arm/cpu/armv8/fsl-lsch3/cpu.h
rename to arch/arm/cpu/armv8/fsl-layerscape/cpu.h
index 2e3312b..8072f3c 100644
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014, Freescale Semiconductor
+ * Copyright 2014-2015, Freescale Semiconductor
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +9 -3
similarity index 94%
rename from arch/arm/cpu/armv8/fsl-lsch3/fdt.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 567c419..aa88d34 100644
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -7,11 +7,16 @@
  #include <common.h>
  #include <libfdt.h>
  #include <fdt_support.h>
-#include <asm/arch-fsl-lsch3/fdt.h>
+#include <phy.h>
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/fdt.h>
+#endif
  #ifdef CONFIG_FSL_ESDHC
  #include <fsl_esdhc.h>
  #endif
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
  #ifdef CONFIG_MP
  void ft_fixup_cpu(void *blob)
@@ -150,6 +155,7 @@ void append_mmu_masters(void *blob, const char *smmu_path,
   *      for all DPAA2 devices.
   *
   */
+#ifdef CONFIG_FSL_LSCH3
  static void fdt_fixup_smmu(void *blob)
  {
  	int nodeoffset;

arch/arm/cpu/armv8/fsl-layerscape/fdt.c static void fdt_fixup_smmu(void *blob) · line 175

Quoted 5 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +1 -0
@@ -165,6 +171,7 @@ static void fdt_fixup_smmu(void *blob)
  	fdt_fixup_smmu_pcie(blob);
  #endif
  }
+#endif
 

SMMU fixup should be independent of chassis-generation

Quoted 4 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +0 -0
  void ft_cpu_setup(void *blob, bd_t *bd)
  {
@@ -181,9 +188,11 @@ void ft_cpu_setup(void *blob, bd_t *bd)
  	ft_pci_setup(blob, bd);

arch/arm/cpu/armv8/fsl-layerscape/fdt.c void ft_cpu_setup(void *blob, bd_t *bd) · line 197

Quoted 10 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +3 -1
  #endif
 
-#if defined(CONFIG_FSL_ESDHC)
+#ifdef CONFIG_FSL_ESDHC
  	fdt_fixup_esdhc(blob, bd);
  #endif
 
+#ifdef CONFIG_FSL_LSCH3
  	fdt_fixup_smmu(blob);
+#endif

SMMU fixup should be independent of chassis-generation

Quoted 133 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +0 -0
  }
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fsl_lsch3_serdes.c +4 -4
similarity index 95%
rename from arch/arm/cpu/armv8/fsl-lsch3/fsl_lsch3_serdes.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
index ae08343..2ab8da6 100644
@@ -1,5 +1,5 @@
  /*
- * Copyright 2015 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -8,7 +8,7 @@
  #include <asm/io.h>
  #include <asm/errno.h>
  #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
+#include <asm/arch/soc.h>
  #include <fsl-mc/ldpaa_wriop.h>
 
  #ifdef CONFIG_SYS_FSL_SRDS_1
@@ -35,7 +35,7 @@ int is_serdes_configured(enum srds_prtcl device)
  int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
  {
  	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-	u32 cfg = in_le32(&gur->rcwsr[28]);
+	u32 cfg = gur_in32(&gur->rcwsr[28]);
  	int i;
 
  	switch (sd) {
@@ -76,7 +76,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
 
  	memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map));
 
-	cfg = in_le32(&gur->rcwsr[28]) & sd_prctl_mask;
+	cfg = gur_in32(&gur->rcwsr[28]) & sd_prctl_mask;
  	cfg >>= sd_prctl_shift;
  	printf("Using SERDES%d Protocol: %d (0x%x)\n", sd + 1, cfg, cfg);
 
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c renamed from arch/arm/cpu/armv8/fsl-lsch3/speed.c +6 -6
similarity index 93%
rename from arch/arm/cpu/armv8/fsl-lsch3/speed.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
index d9f137c..4054c3c 100644
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014, Freescale Semiconductor, Inc.
+ * Copyright 2014-2015, Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   *
@@ -11,8 +11,8 @@
  #include <fsl_ifc.h>
  #include <asm/processor.h>
  #include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
  #include <asm/arch/clock.h>
+#include <asm/arch/soc.h>
  #include "cpu.h"
 
  DECLARE_GLOBAL_DATA_PTR;
@@ -83,15 +83,15 @@ void get_sys_info(struct sys_info *sys_info)
  	sys_info->freq_ddrbus2 = sysclk;
  #endif
 
-	sys_info->freq_systembus *= (in_le32(&gur->rcwsr[0]) >>
+	sys_info->freq_systembus *= (gur_in32(&gur->rcwsr[0]) >>
  			FSL_CHASSIS3_RCWSR0_SYS_PLL_RAT_SHIFT) &
  			FSL_CHASSIS3_RCWSR0_SYS_PLL_RAT_MASK;
  	/* Platform clock is half of platform PLL */
  	sys_info->freq_systembus /= 2;
-	sys_info->freq_ddrbus *= (in_le32(&gur->rcwsr[0]) >>
+	sys_info->freq_ddrbus *= (gur_in32(&gur->rcwsr[0]) >>
  			FSL_CHASSIS3_RCWSR0_MEM_PLL_RAT_SHIFT) &
  			FSL_CHASSIS3_RCWSR0_MEM_PLL_RAT_MASK;
-	sys_info->freq_ddrbus2 *= (in_le32(&gur->rcwsr[0]) >>
+	sys_info->freq_ddrbus2 *= (gur_in32(&gur->rcwsr[0]) >>
  			FSL_CHASSIS3_RCWSR0_MEM2_PLL_RAT_SHIFT) &
  			FSL_CHASSIS3_RCWSR0_MEM2_PLL_RAT_MASK;
 
@@ -118,7 +118,7 @@ void get_sys_info(struct sys_info *sys_info)
  	}
 
  #if defined(CONFIG_FSL_IFC)
-	ccr = in_le32(&ifc_regs.gregs->ifc_ccr);
+	ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
  	ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
 
  	sys_info->freq_localbus = sys_info->freq_systembus / ccr;
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +6 -2
similarity index 97%
rename from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S
rename to arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S
index 6b19d36..2158a8b 100644
@@ -1,5 +1,5 @@
  /*
- * (C) Copyright 2014 Freescale Semiconductor
+ * (C) Copyright 2014-2015 Freescale Semiconductor
   *
   * SPDX-License-Identifier:	GPL-2.0+
   *
@@ -10,11 +10,14 @@
  #include <linux/linkage.h>
  #include <asm/gic.h>
  #include <asm/macro.h>
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
  ENTRY(lowlevel_init)
  	mov	x29, lr			/* Save LR */
 
+#ifdef CONFIG_FSL_LSCH3
  	/* Add fully-coherent masters to DVM domain */
  	ldr	x0, =CCI_MN_BASE
  	ldr	x1, =CCI_MN_RNF_NODEID_LIST
@@ -81,6 +84,7 @@ ENTRY(lowlevel_init)
  	ldr	x0, =CCI_S2_QOS_CONTROL_BASE(20)
  	ldr	x1, =0x00FF000C
  	bl	ccn504_set_qos
+#endif
 
  	/* Set the SMMU page size in the sACR register */
  	ldr	x1, =SMMU_BASE

arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S ENTRY(lowlevel_init) · line 113

Quoted 4 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +1 -0
@@ -106,10 +110,12 @@ ENTRY(lowlevel_init)
 
  	branch_if_master x0, x1, 2f
 
+#ifdef CONFIG_MP

it should be CONFIG_MP && CONFIG_ARMV8_MULTIENTRY

Quoted 70 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +4 -1
  	ldr	x0, =secondary_boot_func
  	blr	x0
-2:
+#endif
 
+2:
  #ifdef CONFIG_FSL_TZPC_BP147
  	/* Set Non Secure access for all devices protected via TZPC */
  	ldr	x1, =TZPCDECPROT_0_SET_BASE /* Decode Protection-0 Set Reg */
@@ -245,6 +251,7 @@ ENTRY(__asm_flush_l3_cache)
  	ret
  ENDPROC(__asm_flush_l3_cache)
 
+#ifdef CONFIG_MP
  	/* Keep literals not used by the secondary boot code outside it */
  	.ltorg
 
@@ -353,3 +360,4 @@ __real_cntfrq:
  	/* Secondary Boot Code ends here */
  __secondary_boot_code_size:
  	.quad .-secondary_boot_code
+#endif
arch/arm/cpu/armv8/fsl-layerscape/ls2085a_serdes.c renamed from arch/arm/cpu/armv8/fsl-lsch3/ls2085a_serdes.c +1 -2
similarity index 97%
rename from arch/arm/cpu/armv8/fsl-lsch3/ls2085a_serdes.c
rename to arch/arm/cpu/armv8/fsl-layerscape/ls2085a_serdes.c
index 0b79a50..ea3114c 100644
@@ -1,12 +1,11 @@
  /*
- * Copyright 2015 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
  #include <common.h>
  #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 
  struct serdes_config {
  	u8 protocol;
arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +3 -4
similarity index 93%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.c
rename to arch/arm/cpu/armv8/fsl-layerscape/mp.c
index da7853a..04eaad6 100644
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -7,9 +7,8 @@
  #include <common.h>
  #include <asm/io.h>
  #include <asm/system.h>
-#include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
-#include "mp.h"
+#include <asm/arch/mp.h>
+#include <asm/arch/soc.h>
 
  DECLARE_GLOBAL_DATA_PTR;
 

arch/arm/cpu/armv8/fsl-layerscape/mp.c phys_addr_t determine_mp_bootpg(void) · line 25

Quoted 4 lines
arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +1 -0
@@ -23,6 +22,7 @@ phys_addr_t determine_mp_bootpg(void)
  	return (phys_addr_t)&secondary_boot_code;
  }
 
+#ifdef CONFIG_LS2085A

Please use CONFIG_FSL_LSCH3

Quoted 500 lines
arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +4 -3
  int fsl_lsch3_wake_seconday_cores(void)
  {
  	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
@@ -48,9 +48,9 @@ int fsl_lsch3_wake_seconday_cores(void)
  			   (CONFIG_MAX_CPUS*SPIN_TABLE_ELEM_SIZE));
 
  	printf("Waking secondary cores to start from %lx\n", gd->relocaddr);
-	out_le32(&gur->bootlocptrh, (u32)(gd->relocaddr >> 32));
-	out_le32(&gur->bootlocptrl, (u32)gd->relocaddr);
-	out_le32(&gur->scratchrw[6], 1);
+	gur_out32(&gur->bootlocptrh, (u32)(gd->relocaddr >> 32));
+	gur_out32(&gur->bootlocptrl, (u32)gd->relocaddr);
+	gur_out32(&gur->scratchrw[6], 1);
  	asm volatile("dsb st" : : : "memory");
  	rst->brrl = cores;
  	asm volatile("dsb st" : : : "memory");
@@ -84,6 +84,7 @@ int fsl_lsch3_wake_seconday_cores(void)
 
  	return 0;
  }
+#endif
 
  int is_core_valid(unsigned int core)
  {
arch/arm/cpu/armv8/fsl-layerscape/soc.c renamed from arch/arm/cpu/armv8/fsl-lsch3/soc.c +7 -28
similarity index 73%
rename from arch/arm/cpu/armv8/fsl-lsch3/soc.c
rename to arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 2538001..73e48a7 100644
@@ -1,19 +1,18 @@
  /*
- * Copyright 2015 Freescale Semiconductor
+ * Copyright 2014-2015 Freescale Semiconductor
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
  #include <common.h>
  #include <fsl_ifc.h>
-#include <nand.h>
-#include <spl.h>
-#include <asm/arch-fsl-lsch3/soc.h>
+#include <asm/arch/soc.h>
  #include <asm/io.h>
  #include <asm/global_data.h>
 
  DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_LS2085A
  static void erratum_a008751(void)
  {
  #ifdef CONFIG_SYS_FSL_ERRATUM_A008751
@@ -77,31 +76,11 @@ void fsl_lsch3_early_init_f(void)
  	init_early_memctl_regs();	/* tighten IFC timing */
  	erratum_a009203();
  }
+#endif
 
-#ifdef CONFIG_SPL_BUILD
-void board_init_f(ulong dummy)
-{
-	/* Clear global data */
-	memset((void *)gd, 0, sizeof(gd_t));
-
-	arch_cpu_init();
-	board_early_init_f();
-	timer_init();
-	env_init();
-	gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
-
-	serial_init();
-	console_init_f();
-	dram_init();
-
-	/* Clear the BSS. */
-	memset(__bss_start, 0, __bss_end - __bss_start);
-
-	board_init_r(NULL, 0);
-}
-
-u32 spl_boot_device(void)
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
  {
-	return BOOT_DEVICE_NAND;
+	return 0;
  }
  #endif
arch/arm/cpu/armv8/fsl-layerscape/spl.c new file +76 -0
new file mode 100644
index 0000000..2f30d4b
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <fsl_ifc.h>
+#include <fsl_csu.h>
+#include <i2c.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+u32 spl_boot_device(void)
+{
+#ifdef CONFIG_SPL_MMC_SUPPORT
+	return BOOT_DEVICE_MMC1;
+#endif
+#ifdef CONFIG_SPL_NAND_SUPPORT
+	return BOOT_DEVICE_NAND;
+#endif
+	return 0;
+}
+
+u32 spl_boot_mode(void)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FAT;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong dummy)
+{
+	/* Set global data pointer */
+	gd = &gdata;
+	/* Clear global data */
+	memset((void *)gd, 0, sizeof(gd_t));
+#ifdef CONFIG_LS2085A
+	arch_cpu_init();
+#endif
+#ifdef CONFIG_FSL_IFC
+	init_early_memctl_regs();
+#endif
+	board_early_init_f();
+	timer_init();
+#ifdef CONFIG_LS2085A
+	env_init();
+#endif
+	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);
+
+	board_init_r(NULL, 0);
+}
+#endif
arch/arm/cpu/armv8/fsl-lsch3/Makefile deleted +0 -13
deleted file mode 100644
index 9f7815b..0000000
@@ -1,13 +0,0 @@
-#
-# Copyright 2014, Freescale Semiconductor
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-obj-y += cpu.o
-obj-y += lowlevel.o
-obj-y += soc.o
-obj-y += speed.o
-obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch3_serdes.o ls2085a_serdes.o
-obj-$(CONFIG_MP) += mp.o
-obj-$(CONFIG_OF_LIBFDT) += fdt.o
arch/arm/cpu/armv8/fsl-lsch3/speed.h deleted +0 -7
deleted file mode 100644
index 15af5b9..0000000
@@ -1,7 +0,0 @@
-/*
- * 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-layerscape/clock.h renamed from arch/arm/include/asm/arch-fsl-lsch3/clock.h +4 -4
similarity index 56%
rename from arch/arm/include/asm/arch-fsl-lsch3/clock.h
rename to arch/arm/include/asm/arch-fsl-layerscape/clock.h
index 62bc53c..6935913 100644
@@ -1,12 +1,12 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   *
   */
 
-#ifndef __ASM_ARCH_FSL_LSCH3_CLOCK_H_
-#define __ASM_ARCH_FSL_LSCH3_CLOCK_H_
+#ifndef __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_
+#define __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_
 
  #include <common.h>
 
@@ -21,4 +21,4 @@ enum mxc_clock {
 
  unsigned int mxc_get_clock(enum mxc_clock clk);
 
-#endif /* __ASM_ARCH_FSL_LSCH3_CLOCK_H_ */
+#endif /* __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_ */
arch/arm/include/asm/arch-fsl-layerscape/config.h new file +59 -0
new file mode 100644
index 0000000..69dd6b6
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2015, Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_CONFIG_H_
+#define _ASM_ARMV8_FSL_LAYERSCAPE_CONFIG_H_
+
+#include <fsl_ddrc_version.h>
+
+#ifdef CONFIG_SYS_FSL_DDR4
+#define CONFIG_SYS_FSL_DDRC_GEN4
+#else
+#define CONFIG_SYS_FSL_DDRC_ARM_GEN3	/* Enable Freescale ARM DDR3 driver */
+#endif
+#define CONFIG_SYS_FSL_DDR		/* Freescale DDR driver */
+#define CONFIG_SYS_FSL_DDR_VER		FSL_DDR_VER_5_0
+
+#if defined(CONFIG_LS2085A)
+#define CONFIG_MAX_CPUS				16
+#define CONFIG_SYS_FSL_IFC_BANK_COUNT		8
+#define CONFIG_NUM_DDR_CONTROLLERS		3
+#define CONFIG_SYS_FSL_CLUSTER_CLOCKS		{ 1, 1, 4, 4 }
+#define	SRDS_MAX_LANES	8
+#define CONFIG_SYS_FSL_SRDS_1
+#define CONFIG_SYS_FSL_SRDS_2
+#define CONFIG_SYS_PAGE_SIZE		0x10000
+#define CONFIG_SYS_CACHELINE_SIZE	64
+#ifndef L1_CACHE_BYTES
+#define L1_CACHE_SHIFT		6
+#define L1_CACHE_BYTES		BIT(L1_CACHE_SHIFT)
+#endif
+
+#define CONFIG_SYS_FSL_OCRAM_BASE	0x18000000	/* initial RAM */
+#define CONFIG_SYS_FSL_OCRAM_SIZE	0x00200000	/* 2M */
+
+/* DDR */
+#define CONFIG_SYS_FSL_DDR_LE
+#define CONFIG_SYS_LS2_DDR_BLOCK1_SIZE	((phys_size_t)2 << 30)
+#define CONFIG_MAX_MEM_MAPPED		CONFIG_SYS_LS2_DDR_BLOCK1_SIZE
+
+#define CONFIG_SYS_FSL_CCSR_GUR_LE
+#define CONFIG_SYS_FSL_CCSR_SCFG_LE
+#define CONFIG_SYS_FSL_ESDHC_LE
+#define CONFIG_SYS_FSL_IFC_LE
+
 
+#define CONFIG_SYS_MEMAC_LITTLE_ENDIAN
+
+#define CONFIG_SYS_FSL_ERRATUM_A008336
+#define CONFIG_SYS_FSL_ERRATUM_A008511
+#define CONFIG_SYS_FSL_ERRATUM_A008514
+#define CONFIG_SYS_FSL_ERRATUM_A008585
+#define CONFIG_SYS_FSL_ERRATUM_A008751
+#else
+#error SoC not defined
+#endif
+
+#endif /* _ASM_ARMV8_FSL_LAYERSCAPE_CONFIG_H_ */
arch/arm/include/asm/arch-fsl-layerscape/cpu.h new file +165 -0
new file mode 100644
index 0000000..b7b8e5d
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2014-2015, Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _FSL_LAYERSCAPE_CPU_H
+#define _FSL_LAYERSCAPE_CPU_H
+
+static struct cpu_type cpu_type_list[] = {
+	CPU_TYPE_ENTRY(LS2085, LS2085, 8),
+	CPU_TYPE_ENTRY(LS2080, LS2080, 8),
+	CPU_TYPE_ENTRY(LS2045, LS2045, 4),
+};
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+
+#define SECTION_SHIFT_L0		39UL
+#define SECTION_SHIFT_L1		30UL
+#define SECTION_SHIFT_L2		21UL
+#define BLOCK_SIZE_L0			0x8000000000
+#define BLOCK_SIZE_L1			0x40000000
+#define BLOCK_SIZE_L2			0x200000
+#define NUM_OF_ENTRY			512
+#define TCR_EL2_PS_40BIT		(2 << 16)
+
+#define LAYERSCAPE_VA_BITS		(40)
+#define LAYERSCAPE_TCR		(TCR_TG0_4K		| \
+				TCR_EL2_PS_40BIT	| \
+				TCR_SHARED_NON		| \
+				TCR_ORGN_NC		| \
+				TCR_IRGN_NC		| \
+				TCR_T0SZ(LAYERSCAPE_VA_BITS))
+#define LAYERSCAPE_TCR_FINAL	(TCR_TG0_4K		| \
+				TCR_EL2_PS_40BIT	| \
+				TCR_SHARED_OUTER	| \
+				TCR_ORGN_WBWA		| \
+				TCR_IRGN_WBWA		| \
+				TCR_T0SZ(LAYERSCAPE_VA_BITS))
+
+#ifdef CONFIG_FSL_LSCH3
+#define CONFIG_SYS_FSL_CCSR_BASE	0x00000000
+#define CONFIG_SYS_FSL_CCSR_SIZE	0x10000000
+#define CONFIG_SYS_FSL_QSPI_BASE1	0x20000000
+#define CONFIG_SYS_FSL_QSPI_SIZE1	0x10000000
+#define CONFIG_SYS_FSL_IFC_BASE1	0x30000000
+#define CONFIG_SYS_FSL_IFC_SIZE1	0x10000000
+#define CONFIG_SYS_FSL_IFC_SIZE1_1	0x400000
+#define CONFIG_SYS_FSL_DRAM_BASE1	0x80000000
+#define CONFIG_SYS_FSL_DRAM_SIZE1	0x80000000
+#define CONFIG_SYS_FSL_QSPI_BASE2	0x400000000
+#define CONFIG_SYS_FSL_QSPI_SIZE2	0x100000000
+#define CONFIG_SYS_FSL_IFC_BASE2	0x500000000
+#define CONFIG_SYS_FSL_IFC_SIZE2	0x100000000
+#define CONFIG_SYS_FSL_DCSR_BASE	0x700000000
+#define CONFIG_SYS_FSL_DCSR_SIZE	0x40000000
+#define CONFIG_SYS_FSL_MC_BASE		0x80c000000
+#define CONFIG_SYS_FSL_MC_SIZE		0x4000000
+#define CONFIG_SYS_FSL_NI_BASE		0x810000000
+#define CONFIG_SYS_FSL_NI_SIZE		0x8000000
+#define CONFIG_SYS_FSL_QBMAN_BASE	0x818000000
+#define CONFIG_SYS_FSL_QBMAN_SIZE	0x8000000
+#define CONFIG_SYS_FSL_QBMAN_SIZE_1	0x4000000
+#define CONFIG_SYS_PCIE1_PHYS_SIZE	0x200000000
+#define CONFIG_SYS_PCIE2_PHYS_SIZE	0x200000000
+#define CONFIG_SYS_PCIE3_PHYS_SIZE	0x200000000
+#define CONFIG_SYS_PCIE4_PHYS_SIZE	0x200000000
+#define CONFIG_SYS_FSL_WRIOP1_BASE	0x4300000000
+#define CONFIG_SYS_FSL_WRIOP1_SIZE	0x100000000
+#define CONFIG_SYS_FSL_AIOP1_BASE	0x4b00000000
+#define CONFIG_SYS_FSL_AIOP1_SIZE	0x100000000
+#define CONFIG_SYS_FSL_PEBUF_BASE	0x4c00000000
+#define CONFIG_SYS_FSL_PEBUF_SIZE	0x400000000
+#define CONFIG_SYS_FSL_DRAM_BASE2	0x8080000000
+#define CONFIG_SYS_FSL_DRAM_SIZE2	0x7F80000000
+#endif
+
+struct sys_mmu_table {
+	u64 virt_addr;
+	u64 phys_addr;
+	u64 size;
+	u64 memory_type;
+	u64 share;
+};
+
+struct table_info {
+	u64 *ptr;
+	u64 table_base;
+	u64 entry_size;
+};
+
+static const struct sys_mmu_table early_mmu_table[] = {
+#ifdef CONFIG_FSL_LSCH3
+	{ CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
+	  CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
+	  CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
+	/* For IFC Region #1, only the first 4MB is cache-enabled */
+	{ CONFIG_SYS_FSL_IFC_BASE1, CONFIG_SYS_FSL_IFC_BASE1,
+	  CONFIG_SYS_FSL_IFC_SIZE1_1, MT_NORMAL, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_IFC_BASE1 + CONFIG_SYS_FSL_IFC_SIZE1_1,
+	  CONFIG_SYS_FSL_IFC_BASE1 + CONFIG_SYS_FSL_IFC_SIZE1_1,
+	  CONFIG_SYS_FSL_IFC_SIZE1 - CONFIG_SYS_FSL_IFC_SIZE1_1,
+	  MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FSL_IFC_BASE1,
+	  CONFIG_SYS_FSL_IFC_SIZE1, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
+	  CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+	{ CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
+	  CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
+	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+#endif
+};
+
+static const struct sys_mmu_table final_mmu_table[] = {
+#ifdef CONFIG_FSL_LSCH3
+	{ CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
+	  CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
+	  CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
+	  CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+	{ CONFIG_SYS_FSL_QSPI_BASE2, CONFIG_SYS_FSL_QSPI_BASE2,
+	  CONFIG_SYS_FSL_QSPI_SIZE2, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_IFC_BASE2, CONFIG_SYS_FSL_IFC_BASE2,
+	  CONFIG_SYS_FSL_IFC_SIZE2, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
+	  CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_MC_BASE, CONFIG_SYS_FSL_MC_BASE,
+	  CONFIG_SYS_FSL_MC_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_NI_BASE, CONFIG_SYS_FSL_NI_BASE,
+	  CONFIG_SYS_FSL_NI_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	/* For QBMAN portal, only the first 64MB is cache-enabled */
+	{ CONFIG_SYS_FSL_QBMAN_BASE, CONFIG_SYS_FSL_QBMAN_BASE,
+	  CONFIG_SYS_FSL_QBMAN_SIZE_1, MT_NORMAL, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_QBMAN_BASE + CONFIG_SYS_FSL_QBMAN_SIZE_1,
+	  CONFIG_SYS_FSL_QBMAN_BASE + CONFIG_SYS_FSL_QBMAN_SIZE_1,
+	  CONFIG_SYS_FSL_QBMAN_SIZE - CONFIG_SYS_FSL_QBMAN_SIZE_1,
+	  MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_PCIE1_PHYS_ADDR, CONFIG_SYS_PCIE1_PHYS_ADDR,
+	  CONFIG_SYS_PCIE1_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_PCIE2_PHYS_ADDR, CONFIG_SYS_PCIE2_PHYS_ADDR,
+	  CONFIG_SYS_PCIE2_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_PCIE3_PHYS_ADDR, CONFIG_SYS_PCIE3_PHYS_ADDR,
+	  CONFIG_SYS_PCIE3_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+#ifdef CONFIG_LS2085A
+	{ CONFIG_SYS_PCIE4_PHYS_ADDR, CONFIG_SYS_PCIE4_PHYS_ADDR,
+	  CONFIG_SYS_PCIE4_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+#endif
+	{ CONFIG_SYS_FSL_WRIOP1_BASE, CONFIG_SYS_FSL_WRIOP1_BASE,
+	  CONFIG_SYS_FSL_WRIOP1_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_AIOP1_BASE, CONFIG_SYS_FSL_AIOP1_BASE,
+	  CONFIG_SYS_FSL_AIOP1_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_PEBUF_BASE, CONFIG_SYS_FSL_PEBUF_BASE,
+	  CONFIG_SYS_FSL_PEBUF_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
+	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+#endif
+};
+#endif
+
+int fsl_qoriq_core_to_cluster(unsigned int core);
+u32 cpu_mask(void);
+#endif /* _FSL_LAYERSCAPE_CPU_H */
arch/arm/include/asm/arch-fsl-layerscape/fdt.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fdt.h +4 -0
similarity index 71%
rename from arch/arm/include/asm/arch-fsl-lsch3/fdt.h
rename to arch/arm/include/asm/arch-fsl-layerscape/fdt.h
index 21d20fb..4da73ab 100644
@@ -4,7 +4,11 @@
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
+#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_FDT_H_
+#define _ASM_ARMV8_FSL_LAYERSCAPE_FDT_H_
+
  void alloc_stream_ids(int start_id, int count, u32 *stream_ids, int max_cnt);
  void append_mmu_masters(void *blob, const char *smmu_path,
  			const char *master_name, u32 *stream_ids, int count);
  void fdt_fixup_smmu_pcie(void *blob);
+#endif	/* _ASM_ARMV8_FSL_LAYERSCAPE_FDT_H_ */
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +0 -0
similarity index 88%
rename from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h
rename to arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h
index 2810f3f..730c2b2 100644
@@ -4,13 +4,12 @@
   * SPDX-License-Identifier:	GPL-2.0+
   */
 

arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h line 12

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +3 -4
-#ifndef __FSL_SERDES_H
-#define __FSL_SERDES_H
+#ifndef __FSL_SERDES_H__
+#define __FSL_SERDES_H__
 
  #include <config.h>
 
-#define	SRDS_MAX_LANES	8
-
+#if defined(CONFIG_LS2085A)

Please avoid putting this code in any #ifdef

Quoted 587 lines
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +2 -2
  enum srds_prtcl {
  	NONE = 0,
  	PCIE1,
@@ -56,12 +55,12 @@ enum srds {
  	FSL_SRDS_1  = 0,
  	FSL_SRDS_2  = 1,
  };
+#endif
 
  int is_serdes_configured(enum srds_prtcl device);
  void fsl_serdes_init(void);
-
  int serdes_get_first_lane(u32 sd, enum srds_prtcl device);
  enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane);
  int is_serdes_prtcl_valid(int serdes, u32 prtcl);
 
-#endif /* __FSL_SERDES_H */
+#endif /* __FSL_SERDES_H__ */
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h renamed from arch/arm/include/asm/arch-fsl-lsch3/immap_lsch3.h +102 -17
similarity index 58%
rename from arch/arm/include/asm/arch-fsl-lsch3/immap_lsch3.h
rename to arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
index d6bee60..6a70d44 100644
@@ -6,9 +6,109 @@
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
-#ifndef __ARCH_FSL_LSCH3_IMMAP_H
+#ifndef __ARCH_FSL_LSCH3_IMMAP_H_
  #define __ARCH_FSL_LSCH3_IMMAP_H_
 
+#define CONFIG_SYS_IMMR				0x01000000
+#define CONFIG_SYS_FSL_DDR_ADDR			(CONFIG_SYS_IMMR + 0x00080000)
+#define CONFIG_SYS_FSL_DDR2_ADDR		(CONFIG_SYS_IMMR + 0x00090000)
+#define CONFIG_SYS_FSL_DDR3_ADDR		0x08210000
+#define CONFIG_SYS_FSL_GUTS_ADDR		(CONFIG_SYS_IMMR + 0x00E00000)
+#define CONFIG_SYS_FSL_PMU_ADDR			(CONFIG_SYS_IMMR + 0x00E30000)
+#define CONFIG_SYS_FSL_RST_ADDR			(CONFIG_SYS_IMMR + 0x00E60000)
+#define CONFIG_SYS_FSL_CH3_CLK_GRPA_ADDR	(CONFIG_SYS_IMMR + 0x00300000)
+#define CONFIG_SYS_FSL_CH3_CLK_GRPB_ADDR	(CONFIG_SYS_IMMR + 0x00310000)
+#define CONFIG_SYS_FSL_CH3_CLK_CTRL_ADDR	(CONFIG_SYS_IMMR + 0x00370000)
+#define CONFIG_SYS_FSL_ESDHC_ADDR		(CONFIG_SYS_IMMR + 0x01140000)
+#define CONFIG_SYS_IFC_ADDR			(CONFIG_SYS_IMMR + 0x01240000)
+#define CONFIG_SYS_NS16550_COM1			(CONFIG_SYS_IMMR + 0x011C0500)
+#define CONFIG_SYS_NS16550_COM2			(CONFIG_SYS_IMMR + 0x011C0600)
+#define CONFIG_SYS_FSL_TIMER_ADDR		0x023d0000
+#define CONFIG_SYS_FSL_PMU_CLTBENR		(CONFIG_SYS_FSL_PMU_ADDR + \
+						 0x18A0)
+
+#define CONFIG_SYS_FSL_WRIOP1_ADDR		(CONFIG_SYS_IMMR + 0x7B80000)
+#define CONFIG_SYS_FSL_WRIOP1_MDIO1	(CONFIG_SYS_FSL_WRIOP1_ADDR + 0x16000)
+#define CONFIG_SYS_FSL_WRIOP1_MDIO2	(CONFIG_SYS_FSL_WRIOP1_ADDR + 0x17000)
+#define CONFIG_SYS_FSL_LSCH3_SERDES_ADDR	(CONFIG_SYS_IMMR + 0xEA0000)
+
+/* SP (Cortex-A5) related */
+#define CONFIG_SYS_FSL_SP_ADDR			(CONFIG_SYS_IMMR + 0x00F00000)
+#define CONFIG_SYS_FSL_SP_VSG_GIC_ADDR		(CONFIG_SYS_FSL_SP_ADDR)
+#define CONFIG_SYS_FSL_SP_VSG_GIC_VIGR1		(CONFIG_SYS_FSL_SP_ADDR)
+#define CONFIG_SYS_FSL_SP_VSG_GIC_VIGR2		\
+					(CONFIG_SYS_FSL_SP_ADDR + 0x0008)
+#define CONFIG_SYS_FSL_SP_LOOPBACK_DUART	\
+					(CONFIG_SYS_FSL_SP_ADDR + 0x1000)
+
+#define CONFIG_SYS_FSL_DCSR_DDR_ADDR		0x70012c000ULL
+#define CONFIG_SYS_FSL_DCSR_DDR2_ADDR		0x70012d000ULL
+#define CONFIG_SYS_FSL_DCSR_DDR3_ADDR		0x700132000ULL
+#define CONFIG_SYS_FSL_DCSR_DDR4_ADDR		0x700133000ULL
+
+#define I2C1_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01000000)
+#define I2C2_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01010000)
+#define I2C3_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01020000)
+#define I2C4_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01030000)
+
+#define CONFIG_SYS_LS2085A_XHCI_USB1_ADDR	(CONFIG_SYS_IMMR + 0x02100000)
+#define CONFIG_SYS_LS2085A_XHCI_USB2_ADDR	(CONFIG_SYS_IMMR + 0x02110000)
+
+/* TZ Address Space Controller Definitions */
+#define TZASC1_BASE			0x01100000	/* as per CCSR map. */
+#define TZASC2_BASE			0x01110000	/* as per CCSR map. */
+#define TZASC3_BASE			0x01120000	/* as per CCSR map. */
+#define TZASC4_BASE			0x01130000	/* as per CCSR map. */
+#define TZASC_BUILD_CONFIG_REG(x)	((TZASC1_BASE + (x * 0x10000)))
+#define TZASC_ACTION_REG(x)		((TZASC1_BASE + (x * 0x10000)) + 0x004)
+#define TZASC_GATE_KEEPER(x)		((TZASC1_BASE + (x * 0x10000)) + 0x008)
+#define TZASC_REGION_BASE_LOW_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x100)
+#define TZASC_REGION_BASE_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x104)
+#define TZASC_REGION_TOP_LOW_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x108)
+#define TZASC_REGION_TOP_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x10C)
+#define TZASC_REGION_ATTRIBUTES_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x110)
+#define TZASC_REGION_ID_ACCESS_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x114)
+
+/* PCIe */
+#define CONFIG_SYS_PCIE1_ADDR			(CONFIG_SYS_IMMR + 0x2400000)
+#define CONFIG_SYS_PCIE2_ADDR			(CONFIG_SYS_IMMR + 0x2500000)
+#define CONFIG_SYS_PCIE3_ADDR			(CONFIG_SYS_IMMR + 0x2600000)
+#define CONFIG_SYS_PCIE4_ADDR			(CONFIG_SYS_IMMR + 0x2700000)
+#define CONFIG_SYS_PCIE1_PHYS_ADDR		0x1000000000ULL
+#define CONFIG_SYS_PCIE2_PHYS_ADDR		0x1200000000ULL
+#define CONFIG_SYS_PCIE3_PHYS_ADDR		0x1400000000ULL
+#define CONFIG_SYS_PCIE4_PHYS_ADDR		0x1600000000ULL
+
+/* Device Configuration */
+#define DCFG_BASE		0x01e00000
+#define DCFG_PORSR1			0x000
+#define DCFG_PORSR1_RCW_SRC		0xff800000
+#define DCFG_PORSR1_RCW_SRC_NOR		0x12f00000
+#define DCFG_RCWSR13			0x130
+#define DCFG_RCWSR13_DSPI		(0 << 8)
+
+#define DCFG_DCSR_BASE		0X700100000ULL
+#define DCFG_DCSR_PORCR1		0x000
+
+/* Supplemental Configuration */
+#define SCFG_BASE		0x01fc0000
+#define SCFG_USB3PRM1CR			0x000
+
+#define TP_ITYP_AV		0x00000001	/* Initiator available */
+#define TP_ITYP_TYPE(x)	(((x) & 0x6) >> 1)	/* Initiator Type */
+#define TP_ITYP_TYPE_ARM	0x0
+#define TP_ITYP_TYPE_PPC	0x1		/* PowerPC */
+#define TP_ITYP_TYPE_OTHER	0x2		/* StarCore DSP */
+#define TP_ITYP_TYPE_HA		0x3		/* HW Accelerator */
+#define TP_ITYP_THDS(x)	(((x) & 0x18) >> 3)	/* # threads */
+#define TP_ITYP_VER(x)	(((x) & 0xe0) >> 5)	/* Initiator Version */
+#define TY_ITYP_VER_A7		0x1
+#define TY_ITYP_VER_A53		0x2
+#define TY_ITYP_VER_A57		0x3
+
+#define TP_CLUSTER_EOC		0x80000000	/* end of clusters */
+#define TP_CLUSTER_INIT_MASK	0x0000003f	/* initiator mask */
+#define TP_INIT_PER_CLUSTER     4
  /* This is chassis generation 3 */
 
  struct sys_info {
@@ -109,21 +209,6 @@ struct ccsr_gur {
  	u8	res_858[0x1000-0x858];
  };
 
-#define TP_ITYP_AV		0x00000001	/* Initiator available */
-#define TP_ITYP_TYPE(x)	(((x) & 0x6) >> 1)	/* Initiator Type */
-#define TP_ITYP_TYPE_ARM	0x0
-#define TP_ITYP_TYPE_PPC	0x1		/* PowerPC */
-#define TP_ITYP_TYPE_OTHER	0x2		/* StarCore DSP */
-#define TP_ITYP_TYPE_HA		0x3		/* HW Accelerator */
-#define TP_ITYP_THDS(x)	(((x) & 0x18) >> 3)	/* # threads */
-#define TP_ITYP_VER(x)	(((x) & 0xe0) >> 5)	/* Initiator Version */
-#define TY_ITYP_VER_A7		0x1
-#define TY_ITYP_VER_A53		0x2
-#define TY_ITYP_VER_A57		0x3
-
-#define TP_CLUSTER_EOC		0x80000000	/* end of clusters */
-#define TP_CLUSTER_INIT_MASK	0x0000003f	/* initiator mask */
-#define TP_INIT_PER_CLUSTER     4
 
  struct ccsr_clk_cluster_group {
  	struct {
@@ -180,4 +265,4 @@ struct ccsr_reset {
  	u32 ip_rev1;			/* 0xbf8 */
  	u32 ip_rev2;			/* 0xbfc */
  };
-#endif /* __ARCH_FSL_LSCH3_IMMAP_H */
+#endif /* __ARCH_FSL_LSCH3_IMMAP_H_ */
arch/arm/include/asm/arch-fsl-layerscape/imx-regs.h new file +55 -0
new file mode 100644
index 0000000..57e417b
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ */
+
+#ifndef __ASM_ARCH_FSL_LAYERSCAPE_IMX_REGS_H__
+#define __ASM_ARCH_FSL_LAYERSCAPE_IMX_REGS_H__
+
+#define I2C_QUIRK_REG	/* enable 8-bit driver */
+
+#ifdef CONFIG_FSL_LPUART
+#ifdef CONFIG_LPUART_32B_REG
+struct lpuart_fsl {
+	u32 baud;
+	u32 stat;
+	u32 ctrl;
+	u32 data;
+	u32 match;
+	u32 modir;
+	u32 fifo;
+	u32 water;
+};
+#else
+struct lpuart_fsl {
+	u8 ubdh;
+	u8 ubdl;
+	u8 uc1;
+	u8 uc2;
+	u8 us1;
+	u8 us2;
+	u8 uc3;
+	u8 ud;
+	u8 uma1;
+	u8 uma2;
+	u8 uc4;
+	u8 uc5;
+	u8 ued;
+	u8 umodem;
+	u8 uir;
+	u8 reserved;
+	u8 upfifo;
+	u8 ucfifo;
+	u8 usfifo;
+	u8 utwfifo;
+	u8 utcfifo;
+	u8 urwfifo;
+	u8 urcfifo;
+	u8 rsvd[28];
+};
+#endif
+#endif	/* CONFIG_FSL_LPUART */
+
+#endif /* __ASM_ARCH_FSL_LAYERSCAPE_IMX_REGS_H__ */
arch/arm/include/asm/arch-fsl-layerscape/ls2085a_stream_id.h renamed from arch/arm/include/asm/arch-fsl-lsch3/ls2085a_stream_id.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/arch-fsl-lsch3/ls2085a_stream_id.h
rename to arch/arm/include/asm/arch-fsl-layerscape/ls2085a_stream_id.h
arch/arm/include/asm/arch-fsl-layerscape/mmu.h new file +10 -0
new file mode 100644
index 0000000..d54eacd
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2015, Freescale Semiconductor
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_
+#define _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_
+#include <asm/arch-armv8/mmu.h>
+#endif /* _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_ */
arch/arm/include/asm/arch-fsl-layerscape/mp.h renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.h +6 -4
similarity index 83%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.h
rename to arch/arm/include/asm/arch-fsl-layerscape/mp.h
index c985d6a..eb75117 100644
@@ -1,11 +1,11 @@
  /*
- * Copyright 2014, Freescale Semiconductor
+ * Copyright 2014-2015, Freescale Semiconductor
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
-#ifndef _FSL_CH3_MP_H
-#define _FSL_CH3_MP_H
+#ifndef _FSL_LAYERSCAPE_MP_H
+#define _FSL_LAYERSCAPE_MP_H
 
  /*
  * Each spin table element is defined as
@@ -29,10 +29,12 @@ extern u64 __spin_table[];
  extern u64 __real_cntfrq;
  extern u64 *secondary_boot_code;
  extern size_t __secondary_boot_code_size;
+#ifdef CONFIG_FSL_LSCH3
  int fsl_lsch3_wake_seconday_cores(void);
+#endif
  void *get_spin_tbl_addr(void);
  phys_addr_t determine_mp_bootpg(void);
  void secondary_boot_func(void);
  int is_core_online(u64 cpu_id);
  #endif
-#endif /* _FSL_CH3_MP_H */
+#endif /* _FSL_LAYERSCAPE_MP_H */
arch/arm/include/asm/arch-fsl-layerscape/soc.h renamed from arch/arm/include/asm/arch-fsl-lsch3/soc.h +20 -1
similarity index 50%
rename from arch/arm/include/asm/arch-fsl-lsch3/soc.h
rename to arch/arm/include/asm/arch-fsl-layerscape/soc.h
index 9a29272..f131f57 100644
@@ -4,6 +4,25 @@
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
+#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
+#define _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
+
+#ifdef CONFIG_SYS_FSL_CCSR_GUR_LE
+#define gur_in32(a)       in_le32(a)
+#define gur_out32(a, v)   out_le32(a, v)
+#elif defined(CONFIG_SYS_FSL_CCSR_GUR_BE)
+#define gur_in32(a)       in_be32(a)
+#define gur_out32(a, v)   out_be32(a, v)
+#endif
+
+#ifdef CONFIG_SYS_FSL_CCSR_SCFG_LE
+#define scfg_in32(a)       in_le32(a)
+#define scfg_out32(a, v)   out_le32(a, v)
+#elif defined(CONFIG_SYS_FSL_CCSR_SCFG_BE)
+#define scfg_in32(a)       in_be32(a)
+#define scfg_out32(a, v)   out_be32(a, v)
+#endif
+
  struct cpu_type {
  	char name[15];
  	u32 soc_ver;
@@ -25,4 +44,4 @@ struct cpu_type {
 
  void fsl_lsch3_early_init_f(void);
  void cpu_name(char *name);
-
+#endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ */
arch/arm/include/asm/arch-fsl-layerscape/speed.h new file +10 -0
new file mode 100644
index 0000000..de795f6
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2014-2015, Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _FSL_LAYERSCAPE_SPEED_H
+#define _FSL_LAYERSCAPE_SPEED_H
+void get_sys_info(struct sys_info *sys_info);
+#endif /* _FSL_LAYERSCAPE_SPEED_H */
arch/arm/include/asm/arch-fsl-lsch3/config.h deleted +0 -185
deleted file mode 100644
index 96d6c98..0000000
@@ -1,185 +0,0 @@
-/*
- * Copyright 2014, Freescale Semiconductor
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef _ASM_ARMV8_FSL_LSCH3_CONFIG_
-#define _ASM_ARMV8_FSL_LSCH3_CONFIG_
-
-#include <fsl_ddrc_version.h>
-
-#define CONFIG_SYS_PAGE_SIZE		0x10000
-#define CONFIG_SYS_CACHELINE_SIZE	64
-
-#ifndef L1_CACHE_BYTES
-#define L1_CACHE_SHIFT		6
-#define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
-#endif
-
-#define CONFIG_MP
-#define CONFIG_SYS_FSL_OCRAM_BASE	0x18000000	/* initial RAM */
-#define CONFIG_SYS_FSL_OCRAM_SIZE	0x00200000	/* 2M */
-/* Link Definitions */
-#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_FSL_OCRAM_BASE + 0xfff0)
-
-#define CONFIG_SYS_IMMR				0x01000000
-#define CONFIG_SYS_FSL_DDR_ADDR			(CONFIG_SYS_IMMR + 0x00080000)
-#define CONFIG_SYS_FSL_DDR2_ADDR		(CONFIG_SYS_IMMR + 0x00090000)
-#define CONFIG_SYS_FSL_DDR3_ADDR		0x08210000
-#define CONFIG_SYS_FSL_GUTS_ADDR		(CONFIG_SYS_IMMR + 0x00E00000)
-#define CONFIG_SYS_FSL_PMU_ADDR			(CONFIG_SYS_IMMR + 0x00E30000)
-#define CONFIG_SYS_FSL_RST_ADDR			(CONFIG_SYS_IMMR + 0x00E60000)
-#define CONFIG_SYS_FSL_CH3_CLK_GRPA_ADDR	(CONFIG_SYS_IMMR + 0x00300000)
-#define CONFIG_SYS_FSL_CH3_CLK_GRPB_ADDR	(CONFIG_SYS_IMMR + 0x00310000)
-#define CONFIG_SYS_FSL_CH3_CLK_CTRL_ADDR	(CONFIG_SYS_IMMR + 0x00370000)
-#define CONFIG_SYS_FSL_ESDHC_ADDR		(CONFIG_SYS_IMMR + 0x01140000)
-#define CONFIG_SYS_IFC_ADDR			(CONFIG_SYS_IMMR + 0x01240000)
-#define CONFIG_SYS_NS16550_COM1			(CONFIG_SYS_IMMR + 0x011C0500)
-#define CONFIG_SYS_NS16550_COM2			(CONFIG_SYS_IMMR + 0x011C0600)
-#define CONFIG_SYS_FSL_TIMER_ADDR		0x023d0000
-#define CONFIG_SYS_FSL_PMU_CLTBENR		(CONFIG_SYS_FSL_PMU_ADDR + \
-						 0x18A0)
-
-#define CONFIG_SYS_FSL_WRIOP1_ADDR		(CONFIG_SYS_IMMR + 0x7B80000)
-#define CONFIG_SYS_FSL_WRIOP1_MDIO1	(CONFIG_SYS_FSL_WRIOP1_ADDR + 0x16000)
-#define CONFIG_SYS_FSL_WRIOP1_MDIO2	(CONFIG_SYS_FSL_WRIOP1_ADDR + 0x17000)
-#define CONFIG_SYS_FSL_LSCH3_SERDES_ADDR	(CONFIG_SYS_IMMR + 0xEA0000)
-
-/* SP (Cortex-A5) related */
-#define CONFIG_SYS_FSL_SP_ADDR			(CONFIG_SYS_IMMR + 0x00F00000)
-#define CONFIG_SYS_FSL_SP_VSG_GIC_ADDR		(CONFIG_SYS_FSL_SP_ADDR)
-#define CONFIG_SYS_FSL_SP_VSG_GIC_VIGR1		(CONFIG_SYS_FSL_SP_ADDR)
-#define CONFIG_SYS_FSL_SP_VSG_GIC_VIGR2		\
-					(CONFIG_SYS_FSL_SP_ADDR + 0x0008)
-#define CONFIG_SYS_FSL_SP_LOOPBACK_DUART	\
-					(CONFIG_SYS_FSL_SP_ADDR + 0x1000)
-
-#define CONFIG_SYS_FSL_DCSR_DDR_ADDR		0x70012c000ULL
-#define CONFIG_SYS_FSL_DCSR_DDR2_ADDR		0x70012d000ULL
-#define CONFIG_SYS_FSL_DCSR_DDR3_ADDR		0x700132000ULL
-#define CONFIG_SYS_FSL_DCSR_DDR4_ADDR		0x700133000ULL
-
-#define I2C1_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01000000)
-#define I2C2_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01010000)
-#define I2C3_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01020000)
-#define I2C4_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01030000)
-
-#define CONFIG_SYS_LS2085A_XHCI_USB1_ADDR	(CONFIG_SYS_IMMR + 0x02100000)
-#define CONFIG_SYS_LS2085A_XHCI_USB2_ADDR	(CONFIG_SYS_IMMR + 0x02110000)
-
-/* TZ Protection Controller Definitions */
-#define TZPC_BASE				0x02200000
-#define TZPCR0SIZE_BASE				(TZPC_BASE)
-#define TZPCDECPROT_0_STAT_BASE			(TZPC_BASE + 0x800)
-#define TZPCDECPROT_0_SET_BASE			(TZPC_BASE + 0x804)
-#define TZPCDECPROT_0_CLR_BASE			(TZPC_BASE + 0x808)
-#define TZPCDECPROT_1_STAT_BASE			(TZPC_BASE + 0x80C)
-#define TZPCDECPROT_1_SET_BASE			(TZPC_BASE + 0x810)
-#define TZPCDECPROT_1_CLR_BASE			(TZPC_BASE + 0x814)
-#define TZPCDECPROT_2_STAT_BASE			(TZPC_BASE + 0x818)
-#define TZPCDECPROT_2_SET_BASE			(TZPC_BASE + 0x81C)
-#define TZPCDECPROT_2_CLR_BASE			(TZPC_BASE + 0x820)
-
-/* TZ Address Space Controller Definitions */
-#define TZASC1_BASE			0x01100000	/* as per CCSR map. */
-#define TZASC2_BASE			0x01110000	/* as per CCSR map. */
-#define TZASC3_BASE			0x01120000	/* as per CCSR map. */
-#define TZASC4_BASE			0x01130000	/* as per CCSR map. */
-#define TZASC_BUILD_CONFIG_REG(x)	((TZASC1_BASE + (x * 0x10000)))
-#define TZASC_ACTION_REG(x)		((TZASC1_BASE + (x * 0x10000)) + 0x004)
-#define TZASC_GATE_KEEPER(x)		((TZASC1_BASE + (x * 0x10000)) + 0x008)
-#define TZASC_REGION_BASE_LOW_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x100)
-#define TZASC_REGION_BASE_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x104)
-#define TZASC_REGION_TOP_LOW_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x108)
-#define TZASC_REGION_TOP_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x10C)
-#define TZASC_REGION_ATTRIBUTES_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x110)
-#define TZASC_REGION_ID_ACCESS_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x114)
-
-/* Generic Interrupt Controller Definitions */
-#define GICD_BASE		0x06000000
-#define GICR_BASE		0x06100000
-
-/* SMMU Defintions */
-#define SMMU_BASE		0x05000000 /* GR0 Base */
-
-/* DDR */
-#define CONFIG_SYS_FSL_DDR_LE
-#define CONFIG_VERY_BIG_RAM
-#ifdef CONFIG_SYS_FSL_DDR4
-#define CONFIG_SYS_FSL_DDRC_GEN4
-#else
-#define CONFIG_SYS_FSL_DDRC_ARM_GEN3	/* Enable Freescale ARM DDR3 driver */
-#endif
-#define CONFIG_SYS_FSL_DDR		/* Freescale DDR driver */
-#define CONFIG_SYS_LS2_DDR_BLOCK1_SIZE	((phys_size_t)2 << 30)
-#define CONFIG_MAX_MEM_MAPPED		CONFIG_SYS_LS2_DDR_BLOCK1_SIZE
-#define CONFIG_SYS_FSL_DDR_VER		FSL_DDR_VER_5_0
-
-#define CONFIG_SYS_FSL_ESDHC_LE
-/* IFC */
-#define CONFIG_SYS_FSL_IFC_LE
-#define CONFIG_SYS_MEMAC_LITTLE_ENDIAN
-
-/* PCIe */
-#define CONFIG_SYS_PCIE1_ADDR			(CONFIG_SYS_IMMR + 0x2400000)
-#define CONFIG_SYS_PCIE2_ADDR			(CONFIG_SYS_IMMR + 0x2500000)
-#define CONFIG_SYS_PCIE3_ADDR			(CONFIG_SYS_IMMR + 0x2600000)
-#define CONFIG_SYS_PCIE4_ADDR			(CONFIG_SYS_IMMR + 0x2700000)
-#define CONFIG_SYS_PCIE1_PHYS_ADDR		0x1000000000ULL
-#define CONFIG_SYS_PCIE2_PHYS_ADDR		0x1200000000ULL
-#define CONFIG_SYS_PCIE3_PHYS_ADDR		0x1400000000ULL
-#define CONFIG_SYS_PCIE4_PHYS_ADDR		0x1600000000ULL
-
-/* Cache Coherent Interconnect */
-#define CCI_MN_BASE		0x04000000
-#define CCI_MN_RNF_NODEID_LIST		0x180
-#define CCI_MN_DVM_DOMAIN_CTL		0x200
-#define CCI_MN_DVM_DOMAIN_CTL_SET	0x210
-
-#define CCI_RN_I_0_BASE			(CCI_MN_BASE + 0x800000)
-#define CCI_RN_I_2_BASE			(CCI_MN_BASE + 0x820000)
-#define CCI_RN_I_6_BASE			(CCI_MN_BASE + 0x860000)
-#define CCI_RN_I_12_BASE		(CCI_MN_BASE + 0x8C0000)
-#define CCI_RN_I_16_BASE		(CCI_MN_BASE + 0x900000)
-#define CCI_RN_I_20_BASE		(CCI_MN_BASE + 0x940000)
-
-#define CCI_S0_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000)) + 0x10)
-#define CCI_S1_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000)) + 0x110)
-#define CCI_S2_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000)) + 0x210)
-
-/* Device Configuration */
-#define DCFG_BASE		0x01e00000
-#define DCFG_PORSR1			0x000
-#define DCFG_PORSR1_RCW_SRC		0xff800000
-#define DCFG_PORSR1_RCW_SRC_NOR		0x12f00000
-#define DCFG_RCWSR13			0x130
-#define DCFG_RCWSR13_DSPI		(0 << 8)
-
-#define DCFG_DCSR_BASE		0X700100000ULL
-#define DCFG_DCSR_PORCR1		0x000
-
-/* Supplemental Configuration */
-#define SCFG_BASE		0x01fc0000
-#define SCFG_USB3PRM1CR			0x000
-
-#ifdef CONFIG_LS2085A
-#define CONFIG_MAX_CPUS				16
-#define CONFIG_SYS_FSL_IFC_BANK_COUNT		8
-#define CONFIG_NUM_DDR_CONTROLLERS		3
-#define CONFIG_SYS_FSL_CLUSTER_CLOCKS		{ 1, 1, 4, 4 }
-#define CONFIG_SYS_FSL_SRDS_1
-#define CONFIG_SYS_FSL_SRDS_2
-#else
-#error SoC not defined
-#endif
-
-#ifdef CONFIG_LS2085A
-#define CONFIG_SYS_FSL_ERRATUM_A008336
-#define CONFIG_SYS_FSL_ERRATUM_A008511
-#define CONFIG_SYS_FSL_ERRATUM_A008514
-#define CONFIG_SYS_FSL_ERRATUM_A008585
-#define CONFIG_SYS_FSL_ERRATUM_A008751
-#endif
-
-#endif /* _ASM_ARMV8_FSL_LSCH3_CONFIG_ */
arch/arm/include/asm/arch-fsl-lsch3/gpio.h deleted +0 -9
deleted file mode 100644
index f23a78c..0000000
@@ -1,9 +0,0 @@
-/*
- * Copyright 2014, Freescale Semiconductor
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef _ASM_ARMV8_FSL_LSCH3_GPIO_H_
-#define _ASM_ARMV8_FSL_LSCH3_GPIO_H_
-#endif	/* _ASM_ARMV8_FSL_LSCH3_GPIO_H_ */
arch/arm/include/asm/arch-fsl-lsch3/imx-regs.h deleted +0 -13
deleted file mode 100644
index 8f00535..0000000
@@ -1,13 +0,0 @@
-/*
- * Copyright 2014 Freescale Semiconductor, Inc.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- *
- */
-
-#ifndef __ASM_ARCH_FSL_LSCH3_IMX_REGS_H_
-#define __ASM_ARCH_FSL_LSCH3_IMX_REGS_H_
-
-#define I2C_QUIRK_REG	/* enable 8-bit driver */
-
-#endif /* __ASM_ARCH_FSL_LSCH3_IMX_REGS_H_ */
arch/arm/include/asm/config.h +2 -5
index 22fff02..435fc45 100644
@@ -15,14 +15,11 @@
  #define CONFIG_STATIC_RELA
  #endif
 
-#ifdef CONFIG_FSL_LSCH3
-#include <asm/arch-fsl-lsch3/config.h>
-#endif
-
  #if defined(CONFIG_LS102XA) || \
  	defined(CONFIG_CPU_PXA27X) || \
  	defined(CONFIG_CPU_MONAHANS) || \
-	defined(CONFIG_CPU_PXA25X)
+	defined(CONFIG_CPU_PXA25X) || \
+	defined(CONFIG_FSL_LAYERSCAPE)
  #include <asm/arch/config.h>
  #endif
 
arch/arm/include/asm/global_data.h +0 -0
index 4e3ea55..e7f21c6 100644

arch/arm/include/asm/global_data.h struct arch_global_data { · line 49

Quoted 5 lines
arch/arm/include/asm/global_data.h +1 -1
@@ -46,7 +46,7 @@ struct arch_global_data {
  	u32 omap_boot_mode;
  	u8 omap_ch_flags;
  #endif
-#ifdef CONFIG_FSL_LSCH3
+#ifdef CONFIG_FSL_LAYERSCAPE

mem2_clk uses sys_info.freq_ddrbus2,
in cpu.c sys_info.freq_ddrbus2 related code is under CONFIG_FSL_LSCH3 .

Use CONFIG_FSL_LSCH3 here also

Quoted 191 lines
arch/arm/include/asm/global_data.h +0 -0
  	unsigned long mem2_clk;
  #endif
  };
board/freescale/ls2085aqds/Kconfig +1 -1
index deb640d..8d6acba 100644
@@ -8,7 +8,7 @@ config SYS_VENDOR
  	default "freescale"
 
  config SYS_SOC
-	default "fsl-lsch3"
+	default "fsl-layerscape"
 
  config SYS_CONFIG_NAME
  	default "ls2085aqds"
board/freescale/ls2085aqds/eth.c +0 -1
index 007b433..b8a2bf4 100644
@@ -8,7 +8,6 @@
  #include <netdev.h>
  #include <asm/io.h>
  #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
  #include <hwconfig.h>
  #include <fsl_mdio.h>
  #include <malloc.h>
board/freescale/ls2085aqds/ls2085aqds.c +1 -1
index 2315bdb..b02d6e8 100644
@@ -17,7 +17,7 @@
  #include <environment.h>
  #include <i2c.h>
  #include <rtc.h>
-#include <asm/arch-fsl-lsch3/soc.h>
+#include <asm/arch/soc.h>
  #include <hwconfig.h>
 
  #include "../common/qixis.h"
board/freescale/ls2085ardb/Kconfig +1 -1
index 85a3dcd..cb40db9 100644
@@ -8,7 +8,7 @@ config SYS_VENDOR
  	default "freescale"
 
  config SYS_SOC
-	default "fsl-lsch3"
+	default "fsl-layerscape"
 
  config SYS_CONFIG_NAME
  	default "ls2085ardb"
board/freescale/ls2085ardb/eth_ls2085rdb.c +0 -1
index 0a1163a..d578757 100644
@@ -16,7 +16,6 @@
  #include <asm/io.h>
  #include <exports.h>
  #include <asm/arch/fsl_serdes.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
  #include <fsl-mc/ldpaa_wriop.h>
 
  DECLARE_GLOBAL_DATA_PTR;
board/freescale/ls2085ardb/ls2085ardb.c +1 -1
index 5e7997c..18953b8 100644
@@ -17,7 +17,7 @@
  #include <fsl-mc/fsl_mc.h>
  #include <environment.h>
  #include <i2c.h>
-#include <asm/arch-fsl-lsch3/soc.h>
+#include <asm/arch/soc.h>
 
  #include "../common/qixis.h"
  #include "ls2085ardb_qixis.h"
drivers/i2c/mxc_i2c.c +2 -2
index 0f977d7..fa4c82f 100644
@@ -523,8 +523,8 @@ static int bus_i2c_write(struct mxc_i2c_bus *i2c_bus, u8 chip, u32 addr,
  #endif
 
  static struct mxc_i2c_bus mxc_i2c_buses[] = {
-#if defined(CONFIG_LS102XA) || defined(CONFIG_FSL_LSCH3) || \
-		defined(CONFIG_VF610)
+#if defined(CONFIG_LS102XA) || defined(CONFIG_VF610) || \
+	defined(CONFIG_FSL_LAYERSCAPE)
  	{ 0, I2C1_BASE_ADDR, I2C_QUIRK_FLAG },
  	{ 1, I2C2_BASE_ADDR, I2C_QUIRK_FLAG },
  	{ 2, I2C3_BASE_ADDR, I2C_QUIRK_FLAG },
drivers/misc/fsl_debug_server.c +0 -1
index a592891..98d9fbe 100644
@@ -8,7 +8,6 @@
  #include <errno.h>
  #include <asm/io.h>
  #include <asm/system.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
 
  #include <fsl-mc/fsl_mc.h>
  #include <fsl_debug_server.h>
drivers/net/ldpaa_eth/ls2085a.c +0 -2
index 6b7960a..93ed4f1 100644
@@ -7,9 +7,7 @@
  #include <phy.h>
  #include <fsl-mc/ldpaa_wriop.h>
  #include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
  #include <asm/arch/fsl_serdes.h>
-#include <fsl-mc/ldpaa_wriop.h>
 
  u32 dpmac_to_devdisr[] = {
  	[WRIOP1_DPMAC1] = FSL_CHASSIS3_DEVDISR2_DPMAC1,
drivers/pci/pcie_layerscape.c +3 -1
index 2f24a6a..4cee038 100644
@@ -11,7 +11,9 @@
  #include <asm/io.h>
  #include <errno.h>
  #include <malloc.h>
-#include <asm/arch-fsl-lsch3/fdt.h>
+#ifdef CONFIG_FSL_LAYERSCAPE
+#include <asm/arch/fdt.h>
+#endif
 
  #ifndef CONFIG_SYS_PCI_MEMORY_BUS
  #define CONFIG_SYS_PCI_MEMORY_BUS CONFIG_SYS_SDRAM_BASE
include/common.h +3 -0
index ecb1f06..142936b 100644
@@ -76,6 +76,9 @@ typedef volatile unsigned char	vu_char;
  #ifdef CONFIG_SOC_DA8XX
  #include <asm/arch/hardware.h>
  #endif
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#endif
 
  #include <part.h>
  #include <flash.h>
include/configs/ls2085a_common.h +29 -0
index 55b909c..5674227 100644
@@ -10,21 +10,63 @@
  #define CONFIG_SYS_GENERIC_BOARD
 
  #define CONFIG_REMAKE_ELF
+#define CONFIG_FSL_LAYERSCAPE
  #define CONFIG_FSL_LSCH3
  #define CONFIG_LS2085A
+#define CONFIG_MP
  #define CONFIG_GICV3
  #define CONFIG_FSL_TZPC_BP147
 
+/* Generic Interrupt Controller Definitions */
+#define GICD_BASE		0x06000000
+#define GICR_BASE		0x06100000
+
+/* SMMU Defintions */
+#define SMMU_BASE		0x05000000 /* GR0 Base */
+
+/* Cache Coherent Interconnect */
+#define CCI_MN_BASE		0x04000000
+#define CCI_MN_RNF_NODEID_LIST		0x180
+#define CCI_MN_DVM_DOMAIN_CTL		0x200
+#define CCI_MN_DVM_DOMAIN_CTL_SET	0x210
+
+#define CCI_RN_I_0_BASE			(CCI_MN_BASE + 0x800000)
+#define CCI_RN_I_2_BASE			(CCI_MN_BASE + 0x820000)
+#define CCI_RN_I_6_BASE			(CCI_MN_BASE + 0x860000)
+#define CCI_RN_I_12_BASE		(CCI_MN_BASE + 0x8C0000)
+#define CCI_RN_I_16_BASE		(CCI_MN_BASE + 0x900000)
+#define CCI_RN_I_20_BASE		(CCI_MN_BASE + 0x940000)
+
+#define CCI_S0_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000)) + 0x10)
+#define CCI_S1_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000)) + 0x110)
+#define CCI_S2_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000)) + 0x210)
+
+/* TZ Protection Controller Definitions */
+#define TZPC_BASE				0x02200000
+#define TZPCR0SIZE_BASE				(TZPC_BASE)

include/configs/ls2085a_common.h line 56

Quoted 10 lines
include/configs/ls2085a_common.h +10 -0
+#define TZPCDECPROT_0_STAT_BASE			(TZPC_BASE + 0x800)
+#define TZPCDECPROT_0_SET_BASE			(TZPC_BASE + 0x804)
+#define TZPCDECPROT_0_CLR_BASE			(TZPC_BASE + 0x808)
+#define TZPCDECPROT_1_STAT_BASE			(TZPC_BASE + 0x80C)
+#define TZPCDECPROT_1_SET_BASE			(TZPC_BASE + 0x810)
+#define TZPCDECPROT_1_CLR_BASE			(TZPC_BASE + 0x814)
+#define TZPCDECPROT_2_STAT_BASE			(TZPC_BASE + 0x818)
+#define TZPCDECPROT_2_SET_BASE			(TZPC_BASE + 0x81C)
+#define TZPCDECPROT_2_CLR_BASE			(TZPC_BASE + 0x820)
+

not sure, are the address of GIC, SMMU, TZPC, RN SoC specific?

Quoted 26 lines
include/configs/ls2085a_common.h +6 -2
  /* Errata fixes */
  #define CONFIG_ARM_ERRATA_828024
  #define CONFIG_ARM_ERRATA_826974
 
-#include <asm/arch-fsl-lsch3/ls2085a_stream_id.h>
-#include <asm/arch-fsl-lsch3/config.h>
+#include <asm/arch/ls2085a_stream_id.h>
+#include <asm/arch/config.h>
  #if (defined(CONFIG_SYS_FSL_SRDS_1) || defined(CONFIG_SYS_FSL_SRDS_2))
  #define	CONFIG_SYS_HAS_SERDES
  #endif
 
+/* Link Definitions */
+#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_FSL_OCRAM_BASE + 0xfff0)
+
  /* We need architecture specific misc initializations */
  #define CONFIG_ARCH_MISC_INIT
 
@@ -62,6 +104,7 @@
 
  #define CONFIG_SYS_FSL_DDR_INTLV_256B	/* force 256 byte interleaving */
 
+#define CONFIG_VERY_BIG_RAM
  #define CONFIG_SYS_DDR_SDRAM_BASE	0x80000000UL
  #define CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY	0
  #define CONFIG_SYS_SDRAM_BASE		CONFIG_SYS_DDR_SDRAM_BASE
author
#17 lore raw

PATCH v5 11/17 armv8/fsl_lsch3: Change arch to fsl-layerscape

Quoted 145 lines

-----Original Message-----
From: Prabhakar [mailto:prabhakar at freescale.com]
Sent: Friday, October 16, 2015 2:20 PM
To: Gong Qianyu-B52263; u-boot at lists.denx.de
Cc: Hu Mingkai-B21284; Sun York-R58495; Hou Zhiqiang-B48286; Xie Shaohui- B21989; Song Wenbin-B53747; Wood Scott-B07421; Wang Huan-B18965
Subject: Re: [Patch V5 11/17] armv8/fsl_lsch3: Change arch to fsl- layerscape

Quoted 8 lines · Gong Qianyu

From: Mingkai Hu <[email protected]>

There are two LS series processors are built on ARMv8 Layersacpe architecture currently, LS2085A and LS1043A. They are based on ARMv8 core although use different chassis, so create fsl-layerscape to refactor the common code for the LS series processors which also paves the way for adding LS1043A platform.

Quoted 7 lines

---
V5:
- Move LS2085A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in

soc.h

Quoted 8 lines

- Modify fsl-layerscape/Makefile.
V4:
- New patch.

  arch/arm/cpu/armv8/Makefile                        |   2 +-
  arch/arm/cpu/armv8/fsl-layerscape/Makefile         |  21 ++
  .../README => fsl-layerscape/README.lsch3}         |   0
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.c  | 249 ++++++------

---------

Quoted 6 lines
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.h  |   2 +-
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/fdt.c  |  17 +-
  .../fsl_lsch3_serdes.c                             |   8 +-
  .../speed.c => fsl-layerscape/fsl_lsch3_speed.c}   |  12 +-
  .../armv8/{fsl-lsch3 => fsl-layerscape}/lowlevel.S |  14 +-
  .../{fsl-lsch3 => fsl-layerscape}/ls2085a_serdes.c |   3 +-
Quoted 8 lines
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/mp.c   |  15 +-
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/soc.c  |  35 +--
  arch/arm/cpu/armv8/fsl-layerscape/spl.c            |  76 +++++++
  arch/arm/cpu/armv8/fsl-lsch3/Makefile              |  13 --
  arch/arm/cpu/armv8/fsl-lsch3/speed.h               |   7 -
  .../clock.h                                        |   8 +-
  arch/arm/include/asm/arch-fsl-layerscape/config.h  |  59 +++++
  arch/arm/include/asm/arch-fsl-layerscape/cpu.h     | 165

++++++++++++++

Quoted 10 lines
  .../{arch-fsl-lsch3 => arch-fsl-layerscape}/fdt.h  |   4 +
  .../fsl_serdes.h                                   |  11 +-
  .../immap_lsch3.h                                  | 119 ++++++++--
  .../arm/include/asm/arch-fsl-layerscape/imx-regs.h |  55 +++++
  .../ls2085a_stream_id.h                            |   0
  arch/arm/include/asm/arch-fsl-layerscape/mmu.h     |  10 +
  .../asm/arch-fsl-layerscape}/mp.h                  |  10 +-
  .../{arch-fsl-lsch3 => arch-fsl-layerscape}/soc.h  |  21 +-
  arch/arm/include/asm/arch-fsl-layerscape/speed.h   |  10 +
  arch/arm/include/asm/arch-fsl-lsch3/config.h       | 185 ------------

---

Quoted 18 lines
  arch/arm/include/asm/arch-fsl-lsch3/gpio.h         |   9 -
  arch/arm/include/asm/arch-fsl-lsch3/imx-regs.h     |  13 --
  arch/arm/include/asm/config.h                      |   7 +-
  arch/arm/include/asm/global_data.h                 |   2 +-
  board/freescale/ls2085aqds/Kconfig                 |   2 +-
  board/freescale/ls2085aqds/eth.c                   |   1 -
  board/freescale/ls2085aqds/ls2085aqds.c            |   2 +-
  board/freescale/ls2085ardb/Kconfig                 |   2 +-
  board/freescale/ls2085ardb/eth_ls2085rdb.c         |   1 -
  board/freescale/ls2085ardb/ls2085ardb.c            |   2 +-
  drivers/i2c/mxc_i2c.c                              |   4 +-
  drivers/misc/fsl_debug_server.c                    |   1 -
  drivers/net/ldpaa_eth/ls2085a.c                    |   2 -
  drivers/pci/pcie_layerscape.c                      |   4 +-
  include/common.h                                   |   3 +
  include/configs/ls2085a_common.h                   |  47 +++-
  44 files changed, 712 insertions(+), 521 deletions(-)

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c

arch/arm/cpu/armv8/fsl-layerscape/fdt.c void append_mmu_masters(void *blob, const char

Quoted 33 lines

similarity index 94%
rename from arch/arm/cpu/armv8/fsl-lsch3/fdt.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 567c419..aa88d34 100644

arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +8 -3
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -7,11 +7,16 @@
  #include <common.h>
  #include <libfdt.h>
  #include <fdt_support.h>
-#include <asm/arch-fsl-lsch3/fdt.h>
+#include <phy.h>
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/fdt.h>
+#endif
  #ifdef CONFIG_FSL_ESDHC
  #include <fsl_esdhc.h>
  #endif
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
  #ifdef CONFIG_MP
  void ft_fixup_cpu(void *blob)
@@ -150,6 +155,7 @@ void append_mmu_masters(void *blob, const char

*smmu_path,

arch/arm/cpu/armv8/fsl-layerscape/fdt.c static void fdt_fixup_smmu(void *blob) · line 175

Quoted 13 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +2 -0
   *      for all DPAA2 devices.
   *
   */
+#ifdef CONFIG_FSL_LSCH3
  static void fdt_fixup_smmu(void *blob)
  {
  	int nodeoffset;
@@ -165,6 +171,7 @@ static void fdt_fixup_smmu(void *blob)
  	fdt_fixup_smmu_pcie(blob);
  #endif
  }
+#endif
 

SMMU fixup should be independent of chassis-generation

Quoted 11 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +1 -1
  void ft_cpu_setup(void *blob, bd_t *bd)
  {
@@ -181,9 +188,11 @@ void ft_cpu_setup(void *blob, bd_t *bd)
  	ft_pci_setup(blob, bd);
  #endif
 
-#if defined(CONFIG_FSL_ESDHC)
+#ifdef CONFIG_FSL_ESDHC
  	fdt_fixup_esdhc(blob, bd);
  #endif
 
Quoted 6 lines

arch/arm/cpu/armv8/fsl-layerscape/fdt.c void ft_cpu_setup(void *blob, bd_t *bd) · line 197

Quoted 3 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +2 -0
+#ifdef CONFIG_FSL_LSCH3
  	fdt_fixup_smmu(blob);
+#endif

SMMU fixup should be independent of chassis-generation

Quoted 1 line
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +0 -0
  }

I agree. But currently LS1043A hasn't implemented the SMMU and pcie fixup.

We will remove the lsch3 limitation once we add the fixup in the near future.

Quoted 41 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S

Quoted 39 lines

similarity index 97%
rename from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S rename to arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S index 6b19d36..2158a8b 100644

arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +6 -2
@@ -1,5 +1,5 @@
  /*
- * (C) Copyright 2014 Freescale Semiconductor
+ * (C) Copyright 2014-2015 Freescale Semiconductor
   *
   * SPDX-License-Identifier:	GPL-2.0+
   *
@@ -10,11 +10,14 @@
  #include <linux/linkage.h>
  #include <asm/gic.h>
  #include <asm/macro.h>
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
  ENTRY(lowlevel_init)
  	mov	x29, lr			/* Save LR */
 
+#ifdef CONFIG_FSL_LSCH3
  	/* Add fully-coherent masters to DVM domain */
  	ldr	x0, =CCI_MN_BASE
  	ldr	x1, =CCI_MN_RNF_NODEID_LIST
@@ -81,6 +84,7 @@ ENTRY(lowlevel_init)
  	ldr	x0, =CCI_S2_QOS_CONTROL_BASE(20)
  	ldr	x1, =0x00FF000C
  	bl	ccn504_set_qos
+#endif
 
  	/* Set the SMMU page size in the sACR register */
  	ldr	x1, =SMMU_BASE
@@ -106,10 +110,12 @@ ENTRY(lowlevel_init)
 
Quoted 6 lines

arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S ENTRY(lowlevel_init) · line 113

Quoted 3 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +1 -0
  	branch_if_master x0, x1, 2f
 
+#ifdef CONFIG_MP

it should be CONFIG_MP && CONFIG_ARMV8_MULTIENTRY

What's the difference between them?

Most of the current code uses CONFIG_MP alone instead of adding CONFIG_ARMV8_MULTIENTRY.

Quoted 49 lines

Review

Quoted 23 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +4 -1
  	ldr	x0, =secondary_boot_func
  	blr	x0
-2:
+#endif
 
+2:
  #ifdef CONFIG_FSL_TZPC_BP147
  	/* Set Non Secure access for all devices protected via TZPC */
  	ldr	x1, =TZPCDECPROT_0_SET_BASE /* Decode Protection-0 Set Reg */
@@ -245,6 +251,7 @@ ENTRY(__asm_flush_l3_cache)
  	ret
  ENDPROC(__asm_flush_l3_cache)
 
+#ifdef CONFIG_MP
  	/* Keep literals not used by the secondary boot code outside it */
  	.ltorg
 
@@ -353,3 +360,4 @@ __real_cntfrq:
  	/* Secondary Boot Code ends here */
  __secondary_boot_code_size:
  	.quad .-secondary_boot_code
+#endif
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/mp.c

Quoted 25 lines

similarity index 93%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.c
rename to arch/arm/cpu/armv8/fsl-layerscape/mp.c
index da7853a..04eaad6 100644

arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +3 -4
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -7,9 +7,8 @@
  #include <common.h>
  #include <asm/io.h>
  #include <asm/system.h>
-#include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
-#include "mp.h"
+#include <asm/arch/mp.h>
+#include <asm/arch/soc.h>
 
  DECLARE_GLOBAL_DATA_PTR;
 
Quoted 7 lines

arch/arm/cpu/armv8/fsl-layerscape/mp.c phys_addr_t determine_mp_bootpg(void) · line 25

Quoted 5 lines
arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +1 -0
@@ -23,6 +22,7 @@ phys_addr_t determine_mp_bootpg(void)
  	return (phys_addr_t)&secondary_boot_code;
  }
 
+#ifdef CONFIG_LS2085A

Please use CONFIG_FSL_LSCH3

Ok.

Quoted 17 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h

Quoted 15 lines

similarity index 88%
rename from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h rename to arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h index 2810f3f..730c2b2 100644

arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +2 -2
@@ -4,13 +4,12 @@
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
-#ifndef __FSL_SERDES_H
-#define __FSL_SERDES_H
+#ifndef __FSL_SERDES_H__
+#define __FSL_SERDES_H__
 
Quoted 8 lines

arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h line 12

Quoted 5 lines
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +1 -2
  #include <config.h>
 
-#define	SRDS_MAX_LANES	8
-
+#if defined(CONFIG_LS2085A)

Please avoid putting this code in any #ifdef

The LS1043A and LS2085A use different enum srds_prtcl and enum srds.

So we use SOC macros to wrap them up temporarily. This will be revised in the future.

Now we are trying to catch up with the upstream merge window next week.

Quoted 74 lines

Review

Quoted 33 lines
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +2 -2
  enum srds_prtcl {
  	NONE = 0,
  	PCIE1,
@@ -56,12 +55,12 @@ enum srds {
  	FSL_SRDS_1  = 0,
  	FSL_SRDS_2  = 1,
  };
+#endif
 
  int is_serdes_configured(enum srds_prtcl device);
  void fsl_serdes_init(void);
-
  int serdes_get_first_lane(u32 sd, enum srds_prtcl device);
  enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane);
  int is_serdes_prtcl_valid(int serdes, u32 prtcl);
 
-#endif /* __FSL_SERDES_H */
+#endif /* __FSL_SERDES_H__ */
include/common.h +3 -0
index ecb1f06..142936b 100644
@@ -76,6 +76,9 @@ typedef volatile unsigned char	vu_char;
  #ifdef CONFIG_SOC_DA8XX
  #include <asm/arch/hardware.h>
  #endif
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#endif
 
  #include <part.h>
  #include <flash.h>
(quoted diff) +0 -0

b/include/configs/ls2085a_common.h

Quoted 25 lines

index 55b909c..5674227 100644

include/configs/ls2085a_common.h +13 -0
@@ -10,21 +10,63 @@
  #define CONFIG_SYS_GENERIC_BOARD
 
  #define CONFIG_REMAKE_ELF
+#define CONFIG_FSL_LAYERSCAPE
  #define CONFIG_FSL_LSCH3
  #define CONFIG_LS2085A
+#define CONFIG_MP
  #define CONFIG_GICV3
  #define CONFIG_FSL_TZPC_BP147
 
+/* Generic Interrupt Controller Definitions */
+#define GICD_BASE		0x06000000
+#define GICR_BASE		0x06100000
+
+/* SMMU Defintions */
+#define SMMU_BASE		0x05000000 /* GR0 Base */
+
+/* Cache Coherent Interconnect */
+#define CCI_MN_BASE		0x04000000
+#define CCI_MN_RNF_NODEID_LIST		0x180
+#define CCI_MN_DVM_DOMAIN_CTL		0x200

include/configs/ls2085a_common.h line 40

Quoted 10 lines
include/configs/ls2085a_common.h +10 -0
+#define CCI_MN_DVM_DOMAIN_CTL_SET	0x210
+
+#define CCI_RN_I_0_BASE			(CCI_MN_BASE + 0x800000)
+#define CCI_RN_I_2_BASE			(CCI_MN_BASE + 0x820000)
+#define CCI_RN_I_6_BASE			(CCI_MN_BASE + 0x860000)
+#define CCI_RN_I_12_BASE		(CCI_MN_BASE + 0x8C0000)
+#define CCI_RN_I_16_BASE		(CCI_MN_BASE + 0x900000)
+#define CCI_RN_I_20_BASE		(CCI_MN_BASE + 0x940000)
+
+#define CCI_S0_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000))

+ 0x10)

include/configs/ls2085a_common.h line 41

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define CCI_S1_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000))

+ 0x110)

include/configs/ls2085a_common.h line 42

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define CCI_S2_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x * 0x10000))

+ 0x210)

Quoted 17 lines
Quoted 4 lines
include/configs/ls2085a_common.h +4 -0
+
+/* TZ Protection Controller Definitions */
+#define TZPC_BASE				0x02200000
+#define TZPCR0SIZE_BASE				(TZPC_BASE)

include/configs/ls2085a_common.h line 56

Quoted 10 lines
include/configs/ls2085a_common.h +10 -0
+#define TZPCDECPROT_0_STAT_BASE			(TZPC_BASE + 0x800)
+#define TZPCDECPROT_0_SET_BASE			(TZPC_BASE + 0x804)
+#define TZPCDECPROT_0_CLR_BASE			(TZPC_BASE + 0x808)
+#define TZPCDECPROT_1_STAT_BASE			(TZPC_BASE + 0x80C)
+#define TZPCDECPROT_1_SET_BASE			(TZPC_BASE + 0x810)
+#define TZPCDECPROT_1_CLR_BASE			(TZPC_BASE + 0x814)
+#define TZPCDECPROT_2_STAT_BASE			(TZPC_BASE + 0x818)
+#define TZPCDECPROT_2_SET_BASE			(TZPC_BASE + 0x81C)
+#define TZPCDECPROT_2_CLR_BASE			(TZPC_BASE + 0x820)
+

not sure, are the address of GIC, SMMU, TZPC, RN SoC specific?

The GIC, CCI and TZPC macros were ever put in config.h and we decided to move them to immap_lsch3.h.

But we met a lot of header files' mutual #include problems if put in immap_lsch3.h.

So finally we move them to ls2085a_common.h after discussion.

Quoted 29 lines
Quoted 4 lines
include/configs/ls2085a_common.h +0 -0
  /* Errata fixes */
  #define CONFIG_ARM_ERRATA_828024
  #define CONFIG_ARM_ERRATA_826974
 

include/configs/ls2085a_common.h

Quoted 10 lines
include/configs/ls2085a_common.h +4 -2
-#include <asm/arch-fsl-lsch3/ls2085a_stream_id.h>
-#include <asm/arch-fsl-lsch3/config.h>
+#include <asm/arch/ls2085a_stream_id.h>
+#include <asm/arch/config.h>
  #if (defined(CONFIG_SYS_FSL_SRDS_1) || defined(CONFIG_SYS_FSL_SRDS_2))
  #define	CONFIG_SYS_HAS_SERDES
  #endif
 
+/* Link Definitions */
+#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_FSL_OCRAM_BASE +

0xfff0)

include/configs/ls2085a_common.h line 105

Quoted 7 lines
include/configs/ls2085a_common.h +1 -0
+
  /* We need architecture specific misc initializations */
  #define CONFIG_ARCH_MISC_INIT
 
@@ -62,6 +104,7 @@
 
  #define CONFIG_SYS_FSL_DDR_INTLV_256B	/* force 256 byte interleaving

*/

Quoted 5 lines
include/configs/ls2085a_common.h +1 -0
+#define CONFIG_VERY_BIG_RAM
  #define CONFIG_SYS_DDR_SDRAM_BASE	0x80000000UL
  #define CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY	0
  #define CONFIG_SYS_SDRAM_BASE		CONFIG_SYS_DDR_SDRAM_BASE
#18 lore raw

PATCH v5 11/17 armv8/fsl_lsch3: Change arch to fsl-layerscape

Quoted 223 lines

-----Original Message-----
From: Gong Qianyu-B52263
Sent: Friday, October 16, 2015 2:15 PM
To: Kushwaha Prabhakar-B32579 <[email protected]>; u-
boot at lists.denx.de
Cc: Hu Mingkai-B21284 <[email protected]>; Sun York-R58495 <[email protected]>; Hou Zhiqiang-B48286 <[email protected]>; Xie Shaohui-B21989 <[email protected]>; Song Wenbin-B53747 <[email protected]>; Wood Scott-B07421 <[email protected]>; Wang Huan-B18965 <[email protected]>
Subject: RE: [Patch V5 11/17] armv8/fsl_lsch3: Change arch to fsl-layerscape

Quoted 115 lines

-----Original Message-----
From: Prabhakar [mailto:prabhakar at freescale.com]
Sent: Friday, October 16, 2015 2:20 PM
To: Gong Qianyu-B52263; u-boot at lists.denx.de
Cc: Hu Mingkai-B21284; Sun York-R58495; Hou Zhiqiang-B48286; Xie Shaohui- B21989; Song Wenbin-B53747; Wood Scott-B07421; Wang Huan-B18965
Subject: Re: [Patch V5 11/17] armv8/fsl_lsch3: Change arch to fsl- layerscape

Quoted 8 lines · Gong Qianyu

From: Mingkai Hu <[email protected]>

There are two LS series processors are built on ARMv8 Layersacpe architecture currently, LS2085A and LS1043A. They are based on ARMv8 core although use different chassis, so create fsl-layerscape to refactor the common code for the LS series processors which also paves the way for adding LS1043A platform.

Quoted 7 lines

---
V5:
- Move LS2085A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in

soc.h

Quoted 9 lines

- Modify fsl-layerscape/Makefile.
V4:
- New patch.

  arch/arm/cpu/armv8/Makefile                        |   2 +-
  arch/arm/cpu/armv8/fsl-layerscape/Makefile         |  21 ++
  .../README => fsl-layerscape/README.lsch3}         |   0
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.c  | 249

++++++------

---------

Quoted 6 lines
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.h  |   2 +-
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/fdt.c  |  17 +-
  .../fsl_lsch3_serdes.c                             |   8 +-
  .../speed.c => fsl-layerscape/fsl_lsch3_speed.c}   |  12 +-
  .../armv8/{fsl-lsch3 => fsl-layerscape}/lowlevel.S |  14 +-
  .../{fsl-lsch3 => fsl-layerscape}/ls2085a_serdes.c |   3 +-
Quoted 8 lines
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/mp.c   |  15 +-
  .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/soc.c  |  35 +--
  arch/arm/cpu/armv8/fsl-layerscape/spl.c            |  76 +++++++
  arch/arm/cpu/armv8/fsl-lsch3/Makefile              |  13 --
  arch/arm/cpu/armv8/fsl-lsch3/speed.h               |   7 -
  .../clock.h                                        |   8 +-
  arch/arm/include/asm/arch-fsl-layerscape/config.h  |  59 +++++
  arch/arm/include/asm/arch-fsl-layerscape/cpu.h     | 165

++++++++++++++

Quoted 10 lines
  .../{arch-fsl-lsch3 => arch-fsl-layerscape}/fdt.h  |   4 +
  .../fsl_serdes.h                                   |  11 +-
  .../immap_lsch3.h                                  | 119 ++++++++--
  .../arm/include/asm/arch-fsl-layerscape/imx-regs.h |  55 +++++
  .../ls2085a_stream_id.h                            |   0
  arch/arm/include/asm/arch-fsl-layerscape/mmu.h     |  10 +
  .../asm/arch-fsl-layerscape}/mp.h                  |  10 +-
  .../{arch-fsl-lsch3 => arch-fsl-layerscape}/soc.h  |  21 +-
  arch/arm/include/asm/arch-fsl-layerscape/speed.h   |  10 +
  arch/arm/include/asm/arch-fsl-lsch3/config.h       | 185 ------------

---

Quoted 18 lines
  arch/arm/include/asm/arch-fsl-lsch3/gpio.h         |   9 -
  arch/arm/include/asm/arch-fsl-lsch3/imx-regs.h     |  13 --
  arch/arm/include/asm/config.h                      |   7 +-
  arch/arm/include/asm/global_data.h                 |   2 +-
  board/freescale/ls2085aqds/Kconfig                 |   2 +-
  board/freescale/ls2085aqds/eth.c                   |   1 -
  board/freescale/ls2085aqds/ls2085aqds.c            |   2 +-
  board/freescale/ls2085ardb/Kconfig                 |   2 +-
  board/freescale/ls2085ardb/eth_ls2085rdb.c         |   1 -
  board/freescale/ls2085ardb/ls2085ardb.c            |   2 +-
  drivers/i2c/mxc_i2c.c                              |   4 +-
  drivers/misc/fsl_debug_server.c                    |   1 -
  drivers/net/ldpaa_eth/ls2085a.c                    |   2 -
  drivers/pci/pcie_layerscape.c                      |   4 +-
  include/common.h                                   |   3 +
  include/configs/ls2085a_common.h                   |  47 +++-
  44 files changed, 712 insertions(+), 521 deletions(-)

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c

Quoted 30 lines

similarity index 94%
rename from arch/arm/cpu/armv8/fsl-lsch3/fdt.c
rename to arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 567c419..aa88d34 100644

arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +8 -3
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -7,11 +7,16 @@
  #include <common.h>
  #include <libfdt.h>
  #include <fdt_support.h>
-#include <asm/arch-fsl-lsch3/fdt.h>
+#include <phy.h>
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/fdt.h>
+#endif
  #ifdef CONFIG_FSL_ESDHC
  #include <fsl_esdhc.h>
  #endif
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
Quoted 3 lines

arch/arm/cpu/armv8/fsl-layerscape/fdt.c void append_mmu_masters(void *blob, const

Quoted 3 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +0 -0
  #ifdef CONFIG_MP
  void ft_fixup_cpu(void *blob)
@@ -150,6 +155,7 @@ void append_mmu_masters(void *blob, const

char

Quoted 28 lines

*smmu_path,

arch/arm/cpu/armv8/fsl-layerscape/fdt.c static void fdt_fixup_smmu(void *blob) · line 175

Quoted 13 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +2 -0
   *      for all DPAA2 devices.
   *
   */
+#ifdef CONFIG_FSL_LSCH3
  static void fdt_fixup_smmu(void *blob)
  {
  	int nodeoffset;
@@ -165,6 +171,7 @@ static void fdt_fixup_smmu(void *blob)
  	fdt_fixup_smmu_pcie(blob);
  #endif
  }
+#endif
 

SMMU fixup should be independent of chassis-generation

Quoted 11 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +1 -1
  void ft_cpu_setup(void *blob, bd_t *bd)
  {
@@ -181,9 +188,11 @@ void ft_cpu_setup(void *blob, bd_t *bd)
  	ft_pci_setup(blob, bd);
  #endif
 
-#if defined(CONFIG_FSL_ESDHC)
+#ifdef CONFIG_FSL_ESDHC
  	fdt_fixup_esdhc(blob, bd);
  #endif
 
Quoted 6 lines

arch/arm/cpu/armv8/fsl-layerscape/fdt.c void ft_cpu_setup(void *blob, bd_t *bd) · line 197

Quoted 3 lines
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +2 -0
+#ifdef CONFIG_FSL_LSCH3
  	fdt_fixup_smmu(blob);
+#endif

SMMU fixup should be independent of chassis-generation

Quoted 1 line
arch/arm/cpu/armv8/fsl-layerscape/fdt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +0 -0
  }

I agree. But currently LS1043A hasn't implemented the SMMU and pcie
fixup.

We will remove the lsch3 limitation once we add the fixup in the near future.

Quoted 41 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S

Quoted 39 lines

similarity index 97%
rename from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S rename to arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S index 6b19d36..2158a8b 100644

arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +6 -2
@@ -1,5 +1,5 @@
  /*
- * (C) Copyright 2014 Freescale Semiconductor
+ * (C) Copyright 2014-2015 Freescale Semiconductor
   *
   * SPDX-License-Identifier:	GPL-2.0+
   *
@@ -10,11 +10,14 @@
  #include <linux/linkage.h>
  #include <asm/gic.h>
  #include <asm/macro.h>
-#include "mp.h"
+#ifdef CONFIG_MP
+#include <asm/arch/mp.h>
+#endif
 
  ENTRY(lowlevel_init)
  	mov	x29, lr			/* Save LR */
 
+#ifdef CONFIG_FSL_LSCH3
  	/* Add fully-coherent masters to DVM domain */
  	ldr	x0, =CCI_MN_BASE
  	ldr	x1, =CCI_MN_RNF_NODEID_LIST
@@ -81,6 +84,7 @@ ENTRY(lowlevel_init)
  	ldr	x0, =CCI_S2_QOS_CONTROL_BASE(20)
  	ldr	x1, =0x00FF000C
  	bl	ccn504_set_qos
+#endif
 
  	/* Set the SMMU page size in the sACR register */
  	ldr	x1, =SMMU_BASE
@@ -106,10 +110,12 @@ ENTRY(lowlevel_init)
 
Quoted 6 lines

arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S ENTRY(lowlevel_init) · line 113

Quoted 3 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +1 -0
  	branch_if_master x0, x1, 2f
 
+#ifdef CONFIG_MP

it should be CONFIG_MP && CONFIG_ARMV8_MULTIENTRY

Quoted 5 lines

What's the difference between them?

Most of the current code uses CONFIG_MP alone instead of adding CONFIG_ARMV8_MULTIENTRY.

IIUC,

CONFIG_MP is being used to enable secondary cores
and

CONFIG_ARMV8_MULTIENTRY used for secondary core to execute in spin-loop for Linux after initial configuration.

Quoted 87 lines
Quoted 10 lines

arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S ENTRY(lowlevel_init)

Quoted 10 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +2 -1
  	ldr	x0, =secondary_boot_func
  	blr	x0
-2:
+#endif
 
+2:
  #ifdef CONFIG_FSL_TZPC_BP147
  	/* Set Non Secure access for all devices protected via TZPC */
  	ldr	x1, =TZPCDECPROT_0_SET_BASE /* Decode Protection-0 Set

Reg */

Quoted 40 lines

Review

Quoted 14 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S renamed from arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S +2 -0
@@ -245,6 +251,7 @@ ENTRY(__asm_flush_l3_cache)
  	ret
  ENDPROC(__asm_flush_l3_cache)
 
+#ifdef CONFIG_MP
  	/* Keep literals not used by the secondary boot code outside it */
  	.ltorg
 
@@ -353,3 +360,4 @@ __real_cntfrq:
  	/* Secondary Boot Code ends here */
  __secondary_boot_code_size:
  	.quad .-secondary_boot_code
+#endif
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/mp.c

Quoted 25 lines

similarity index 93%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.c rename to arch/arm/cpu/armv8/fsl-layerscape/mp.c
index da7853a..04eaad6 100644

arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +3 -4
@@ -1,5 +1,5 @@
  /*
- * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
@@ -7,9 +7,8 @@
  #include <common.h>
  #include <asm/io.h>
  #include <asm/system.h>
-#include <asm/io.h>
-#include <asm/arch-fsl-lsch3/immap_lsch3.h>
-#include "mp.h"
+#include <asm/arch/mp.h>
+#include <asm/arch/soc.h>
 
  DECLARE_GLOBAL_DATA_PTR;
 
Quoted 7 lines

arch/arm/cpu/armv8/fsl-layerscape/mp.c phys_addr_t determine_mp_bootpg(void) · line 25

Quoted 5 lines
arch/arm/cpu/armv8/fsl-layerscape/mp.c renamed from arch/arm/cpu/armv8/fsl-lsch3/mp.c +1 -0
@@ -23,6 +22,7 @@ phys_addr_t determine_mp_bootpg(void)
  	return (phys_addr_t)&secondary_boot_code;
  }
 
+#ifdef CONFIG_LS2085A

Please use CONFIG_FSL_LSCH3

Ok.

Quoted 17 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h

Quoted 15 lines

similarity index 88%
rename from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h rename to arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h index 2810f3f..730c2b2 100644

arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +2 -2
@@ -4,13 +4,12 @@
   * SPDX-License-Identifier:	GPL-2.0+
   */
 
-#ifndef __FSL_SERDES_H
-#define __FSL_SERDES_H
+#ifndef __FSL_SERDES_H__
+#define __FSL_SERDES_H__
 
Quoted 8 lines

arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h line 12

Quoted 5 lines
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +1 -2
  #include <config.h>
 
-#define	SRDS_MAX_LANES	8
-
+#if defined(CONFIG_LS2085A)

Please avoid putting this code in any #ifdef

Quoted 7 lines

The LS1043A and LS2085A use different enum srds_prtcl and enum srds.

So we use SOC macros to wrap them up temporarily. This will be revised in the future.

Now we are trying to catch up with the upstream merge window next week.

Got it.

Quoted 107 lines
Quoted 48 lines

Review

Quoted 33 lines
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h renamed from arch/arm/include/asm/arch-fsl-lsch3/fsl_serdes.h +2 -2
  enum srds_prtcl {
  	NONE = 0,
  	PCIE1,
@@ -56,12 +55,12 @@ enum srds {
  	FSL_SRDS_1  = 0,
  	FSL_SRDS_2  = 1,
  };
+#endif
 
  int is_serdes_configured(enum srds_prtcl device);
  void fsl_serdes_init(void);
-
  int serdes_get_first_lane(u32 sd, enum srds_prtcl device);
  enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane);
  int is_serdes_prtcl_valid(int serdes, u32 prtcl);
 
-#endif /* __FSL_SERDES_H */
+#endif /* __FSL_SERDES_H__ */
include/common.h index renamed from include/common.h +0 -0

ecb1f06..142936b 100644

include/common.h +3 -0
@@ -76,6 +76,9 @@ typedef volatile unsigned char	vu_char;
  #ifdef CONFIG_SOC_DA8XX
  #include <asm/arch/hardware.h>
  #endif
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#endif
 
  #include <part.h>
  #include <flash.h>
(quoted diff) +0 -0

b/include/configs/ls2085a_common.h

Quoted 14 lines

index 55b909c..5674227 100644

include/configs/ls2085a_common.h +2 -0
@@ -10,21 +10,63 @@
  #define CONFIG_SYS_GENERIC_BOARD
 
  #define CONFIG_REMAKE_ELF
+#define CONFIG_FSL_LAYERSCAPE
  #define CONFIG_FSL_LSCH3
  #define CONFIG_LS2085A
+#define CONFIG_MP
  #define CONFIG_GICV3
  #define CONFIG_FSL_TZPC_BP147
 
Quoted 14 lines
Quoted 4 lines
include/configs/ls2085a_common.h +4 -0
+/* Generic Interrupt Controller Definitions */
+#define GICD_BASE		0x06000000
+#define GICR_BASE		0x06100000
+

include/configs/ls2085a_common.h

Quoted 10 lines
include/configs/ls2085a_common.h +10 -0
+/* SMMU Defintions */
+#define SMMU_BASE		0x05000000 /* GR0 Base */
+
+/* Cache Coherent Interconnect */
+#define CCI_MN_BASE		0x04000000
+#define CCI_MN_RNF_NODEID_LIST		0x180
+#define CCI_MN_DVM_DOMAIN_CTL		0x200
+#define CCI_MN_DVM_DOMAIN_CTL_SET	0x210
+
+#define CCI_RN_I_0_BASE			(CCI_MN_BASE +

0x800000)

Quoted 1 line

include/configs/ls2085a_common.h line 34

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define CCI_RN_I_2_BASE			(CCI_MN_BASE +

0x820000)

Quoted 1 line

include/configs/ls2085a_common.h line 35

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define CCI_RN_I_6_BASE			(CCI_MN_BASE +

0x860000)

Quoted 10 lines

include/configs/ls2085a_common.h

Quoted 6 lines
include/configs/ls2085a_common.h +6 -0
+#define CCI_RN_I_12_BASE		(CCI_MN_BASE + 0x8C0000)
+#define CCI_RN_I_16_BASE		(CCI_MN_BASE + 0x900000)
+#define CCI_RN_I_20_BASE		(CCI_MN_BASE + 0x940000)
+
+#define CCI_S0_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x *
+0x10000))

+ 0x10)

include/configs/ls2085a_common.h line 43

Quoted 2 lines
include/configs/ls2085a_common.h +2 -0
+#define CCI_S1_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x *
+0x10000))

+ 0x110)

Quoted 8 lines

include/configs/ls2085a_common.h line 45

Quoted 2 lines
include/configs/ls2085a_common.h +2 -0
+#define CCI_S2_QOS_CONTROL_BASE(x) ((CCI_RN_I_0_BASE + (x *
+0x10000))

+ 0x210)

include/configs/ls2085a_common.h

Quoted 5 lines
include/configs/ls2085a_common.h +5 -0
+
+/* TZ Protection Controller Definitions */
+#define TZPC_BASE				0x02200000
+#define TZPCR0SIZE_BASE				(TZPC_BASE)
+#define TZPCDECPROT_0_STAT_BASE			(TZPC_BASE +

0x800)

Quoted 1 line

include/configs/ls2085a_common.h line 51

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_0_SET_BASE			(TZPC_BASE +

0x804)

Quoted 1 line

include/configs/ls2085a_common.h line 52

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_0_CLR_BASE			(TZPC_BASE +

0x808)

Quoted 1 line

include/configs/ls2085a_common.h line 53

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_1_STAT_BASE			(TZPC_BASE +

0x80C)

Quoted 1 line

include/configs/ls2085a_common.h line 54

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_1_SET_BASE			(TZPC_BASE +

0x810)

Quoted 1 line

include/configs/ls2085a_common.h line 55

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_1_CLR_BASE			(TZPC_BASE +

0x814)

Quoted 1 line

include/configs/ls2085a_common.h line 56

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_2_STAT_BASE			(TZPC_BASE +

0x818)

Quoted 1 line

include/configs/ls2085a_common.h line 57

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_2_SET_BASE			(TZPC_BASE +

0x81C)

Quoted 1 line

include/configs/ls2085a_common.h line 58

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+#define TZPCDECPROT_2_CLR_BASE			(TZPC_BASE +

0x820)

Quoted 4 lines

include/configs/ls2085a_common.h line 59

Quoted 1 line
include/configs/ls2085a_common.h +1 -0
+

not sure, are the address of GIC, SMMU, TZPC, RN SoC specific?

Quoted 8 lines

The GIC, CCI and TZPC macros were ever put in config.h and we decided to move them to immap_lsch3.h.

But we met a lot of header files' mutual #include problems if put in immap_lsch3.h.

So finally we move them to ls2085a_common.h after discussion.

Ok.

But this not a good place. We never want to put SoC related code in board configs.

--prabhakar

#19 lore raw

PATCH v5 12/17 armv8/fsl_lsch2: Add fsl_lsch2 SoC

In reply to Gong Qianyu

From: Mingkai Hu <[email protected]>

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

---
V5:
- Move LS1043A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in soc.h
- Modify fsl-layerscape/Makefile.
V4:
- Add fsl_lsch2 to fsl-layerscape framework.
V3:
- Update MMU table initialization to match the latest code.
- Remove some dead code
- Rename #include<asm/arch-fsl-lsch2/xxx> to #include<asm/arch/xxx>
V2:
- remove FSL_LS102xA_DEVDISR3_PCIE from immap_lsch2.h

 arch/arm/cpu/armv8/fsl-layerscape/Makefile         |   5 +
 arch/arm/cpu/armv8/fsl-layerscape/README.lsch2     |  10 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c            |  13 +
 .../cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c    | 117 +++++
 .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 137 +++++
 arch/arm/cpu/armv8/fsl-layerscape/soc.c            |  17 +
 arch/arm/include/asm/arch-fsl-layerscape/config.h  |  40 ++
 arch/arm/include/asm/arch-fsl-layerscape/cpu.h     |  64 +++
 .../include/asm/arch-fsl-layerscape/fsl_serdes.h   |  91 ++++
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  | 555 +++++++++++++++++++++
 .../include/asm/arch-fsl-layerscape/ns_access.h    | 158 ++++++
 arch/arm/include/asm/arch-fsl-layerscape/soc.h     |   6 +
 arch/arm/include/asm/armv8/mmu.h                   |   1 +
 include/common.h                                   |   3 +
 14 files changed, 1217 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/Makefile +5 -0
index ccb3aa5..4754e59 100644
@@ -14,6 +14,11 @@ obj-$(CONFIG_SPL) += spl.o
 ifneq ($(CONFIG_FSL_LSCH3),)
 obj-y += fsl_lsch3_speed.o
 obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch3_serdes.o
+else
+ifneq ($(CONFIG_FSL_LSCH2),)
+obj-y += fsl_lsch2_speed.o
+obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o
+endif
 endif
 
 ifneq ($(CONFIG_LS2085A),)
arch/arm/cpu/armv8/fsl-layerscape/README.lsch2 new file +10 -0
new file mode 100644
index 0000000..a6ef830
@@ -0,0 +1,10 @@
+#
+# Copyright 2015 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-layerscape/cpu.c +13 -0
index c847a7b..5a2d40f 100644
@@ -180,6 +180,8 @@ static inline void early_mmu_setup(void)
 	set_pgtable_table(level1_table0,
 			  CONFIG_SYS_FLASH_BASE >> SECTION_SHIFT_L1,
 			  level2_table1);
+#elif defined(CONFIG_FSL_LSCH2)
+	set_pgtable_table(level1_table0, 1, level2_table1);
 #endif
 	/* Find the table and fill in the block entries */
 	for (i = 0; i < ARRAY_SIZE(early_mmu_table); i++) {
@@ -215,6 +217,9 @@ static inline void early_mmu_setup(void)
  *
  * For LSCH3:
  * Level 2 table 1 contains 512 entries for each 2MB from 32GB to 33GB.
+ * For LSCH2:
+ * Level 2 table 1 contains 512 entries for each 2MB from 1GB to 2GB.
+ * Level 2 table 2 contains 512 entries for each 2MB from 20GB to 21GB.
  */
 static inline void final_mmu_setup(void)
 {
@@ -225,6 +230,9 @@ static inline void final_mmu_setup(void)
 	u64 *level2_table0 = (u64 *)(gd->arch.tlb_addr + 0x3000);
 #ifdef CONFIG_FSL_LSCH3
 	u64 *level2_table1 = (u64 *)(gd->arch.tlb_addr + 0x4000);
+#elif defined(CONFIG_FSL_LSCH2)
+	u64 *level2_table1 = (u64 *)(gd->arch.tlb_addr + 0x4000);
+	u64 *level2_table2 = (u64 *)(gd->arch.tlb_addr + 0x5000);
 #endif
 	struct table_info table = {level0_table, 0, BLOCK_SIZE_L0};
 
@@ -239,6 +247,11 @@ static inline void final_mmu_setup(void)
 	set_pgtable_table(level1_table0,
 			  CONFIG_SYS_FSL_QBMAN_BASE >> SECTION_SHIFT_L1,
 			  level2_table1);
+#elif defined(CONFIG_FSL_LSCH2)
+	set_pgtable_table(level1_table0, 1, level2_table1);
+	set_pgtable_table(level1_table0,
+			  CONFIG_SYS_FSL_QBMAN_BASE >> SECTION_SHIFT_L1,
+			  level2_table2);
 #endif
 
 	/* Find the table and fill in the block entries */
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c new file +117 -0

117 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c new file +137 -0

137 lines not on this page · raw message

arch/arm/cpu/armv8/fsl-layerscape/soc.c +17 -0
index 73e48a7..637853d 100644
@@ -76,6 +76,23 @@ void fsl_lsch3_early_init_f(void)
 	init_early_memctl_regs();	/* tighten IFC timing */
 	erratum_a009203();
 }
+
+#elif defined(CONFIG_LS1043A)
+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);
+}
 #endif
 
 #ifdef CONFIG_BOARD_LATE_INIT
arch/arm/include/asm/arch-fsl-layerscape/config.h +40 -0
index 69dd6b6..74e0b8d 100644
@@ -52,6 +52,46 @@
 #define CONFIG_SYS_FSL_ERRATUM_A008514
 #define CONFIG_SYS_FSL_ERRATUM_A008585
 #define CONFIG_SYS_FSL_ERRATUM_A008751
+#elif defined(CONFIG_LS1043A)
+#define CONFIG_MAX_CPUS				4
+#define CONFIG_SYS_CACHELINE_SIZE		64
+#define CONFIG_SYS_FMAN_V3
+#define CONFIG_SYS_NUM_FMAN			1
+#define CONFIG_SYS_NUM_FM1_DTSEC		7
+#define CONFIG_SYS_NUM_FM1_10GEC		1
+#define CONFIG_SYS_FSL_IFC_BANK_COUNT		4
+#define CONFIG_NUM_DDR_CONTROLLERS		1
+#define CONFIG_SYS_CCSRBAR_DEFAULT		0x01000000
+#define CONFIG_SYS_FSL_SEC_COMPAT		5
+#define CONFIG_SYS_FSL_OCRAM_BASE		0x10000000 /* initial RAM */
+#define CONFIG_SYS_FSL_OCRAM_SIZE		0x200000 /* 2 MiB */
+#define CONFIG_SYS_FSL_DDR_BE
+#define CONFIG_SYS_LS1_DDR_BLOCK1_SIZE  ((phys_size_t)2 << 30)
+#define CONFIG_MAX_MEM_MAPPED           CONFIG_SYS_LS1_DDR_BLOCK1_SIZE
+
+#define CONFIG_SYS_FSL_CCSR_GUR_BE
+#define CONFIG_SYS_FSL_CCSR_SCFG_BE
+#define CONFIG_SYS_FSL_IFC_BE
+#define CONFIG_SYS_FSL_ESDHC_BE
+#define CONFIG_SYS_FSL_WDOG_BE
+#define CONFIG_SYS_FSL_DSPI_BE
+#define CONFIG_SYS_FSL_QSPI_BE
+
+#define QE_MURAM_SIZE          0x6000UL
+#define MAX_QE_RISC            1
+#define QE_NUM_OF_SNUM         28
+
+#define	SRDS_MAX_LANES	4
+#define CONFIG_SYS_FSL_SRDS_1
+#define CONFIG_SYS_FSL_PCIE_COMPAT		"fsl,qoriq-pcie-v2.4"
+
+#define CONFIG_SYS_FSL_SFP_VER_3_2
+#define CONFIG_SYS_FSL_SNVS_LE
+#define CONFIG_SYS_FSL_SEC_LE
+#define CONFIG_SYS_FSL_SFP_BE
+#define CONFIG_SYS_FSL_SRK_LE
+#define CONFIG_KEY_REVOCATION
+
 #else
 #error SoC not defined
 #endif
arch/arm/include/asm/arch-fsl-layerscape/cpu.h +64 -0

88 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h +91 -0

101 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +555 -0

555 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/ns_access.h new file +158 -0

158 lines not on this page · raw message

arch/arm/include/asm/arch-fsl-layerscape/soc.h +6 -0
index f131f57..5ed456e 100644
@@ -33,6 +33,7 @@ struct cpu_type {
 	{ .name = #n, .soc_ver = SVR_##v, .num_cores = (nc)}
 
 #define SVR_WO_E		0xFFFFFE
+#define SVR_LS1043		0x879204
 #define SVR_LS2045		0x870120
 #define SVR_LS2080		0x870110
 #define SVR_LS2085		0x870100
@@ -42,6 +43,11 @@ struct cpu_type {
 #define SVR_SOC_VER(svr)	(((svr) >> 8) & SVR_WO_E)
 #define IS_E_PROCESSOR(svr)	(!((svr >> 8) & 0x1))
 
+#ifdef CONFIG_FSL_LSCH3
 void fsl_lsch3_early_init_f(void);
+#elif defined(CONFIG_FSL_LSCH2)
+void fsl_lsch2_early_init_f(void);
+#endif
+
 void cpu_name(char *name);
 #endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_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)
include/common.h +3 -0
index 142936b..09a131d 100644
@@ -79,6 +79,9 @@ typedef volatile unsigned char	vu_char;
 #ifdef CONFIG_FSL_LSCH3
 #include <asm/arch/immap_lsch3.h>
 #endif
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch/immap_lsch2.h>
+#endif
 
 #include <part.h>
 #include <flash.h>
Signature · 1 line
2.1.0.27.g96db324
#20 lore raw

PATCH v5 12/17 armv8/fsl_lsch2: Add fsl_lsch2 SoC

Quoted 388 lines · Gong Qianyu

From: Mingkai Hu <[email protected]>

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

---
V5:
- Move LS1043A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in soc.h
- Modify fsl-layerscape/Makefile.
V4:
- Add fsl_lsch2 to fsl-layerscape framework.
V3:
- Update MMU table initialization to match the latest code.
- Remove some dead code
- Rename #include<asm/arch-fsl-lsch2/xxx> to #include<asm/arch/xxx>
V2:
- remove FSL_LS102xA_DEVDISR3_PCIE from immap_lsch2.h

  arch/arm/cpu/armv8/fsl-layerscape/Makefile         |   5 +
  arch/arm/cpu/armv8/fsl-layerscape/README.lsch2     |  10 +
  arch/arm/cpu/armv8/fsl-layerscape/cpu.c            |  13 +
  .../cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c    | 117 +++++
  .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 137 +++++
  arch/arm/cpu/armv8/fsl-layerscape/soc.c            |  17 +
  arch/arm/include/asm/arch-fsl-layerscape/config.h  |  40 ++
  arch/arm/include/asm/arch-fsl-layerscape/cpu.h     |  64 +++
  .../include/asm/arch-fsl-layerscape/fsl_serdes.h   |  91 ++++
  .../include/asm/arch-fsl-layerscape/immap_lsch2.h  | 555 +++++++++++++++++++++
  .../include/asm/arch-fsl-layerscape/ns_access.h    | 158 ++++++
  arch/arm/include/asm/arch-fsl-layerscape/soc.h     |   6 +
  arch/arm/include/asm/armv8/mmu.h                   |   1 +
  include/common.h                                   |   3 +
  14 files changed, 1217 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/Makefile +5 -0
index ccb3aa5..4754e59 100644
@@ -14,6 +14,11 @@ obj-$(CONFIG_SPL) += spl.o
  ifneq ($(CONFIG_FSL_LSCH3),)
  obj-y += fsl_lsch3_speed.o
  obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch3_serdes.o
+else
+ifneq ($(CONFIG_FSL_LSCH2),)
+obj-y += fsl_lsch2_speed.o
+obj-$(CONFIG_SYS_HAS_SERDES) += fsl_lsch2_serdes.o
+endif
  endif
 
  ifneq ($(CONFIG_LS2085A),)
arch/arm/cpu/armv8/fsl-layerscape/README.lsch2 new file +10 -0
new file mode 100644
index 0000000..a6ef830
@@ -0,0 +1,10 @@
+#
+# Copyright 2015 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-layerscape/cpu.c +13 -0
index c847a7b..5a2d40f 100644
@@ -180,6 +180,8 @@ static inline void early_mmu_setup(void)
  	set_pgtable_table(level1_table0,
  			  CONFIG_SYS_FLASH_BASE >> SECTION_SHIFT_L1,
  			  level2_table1);
+#elif defined(CONFIG_FSL_LSCH2)
+	set_pgtable_table(level1_table0, 1, level2_table1);
  #endif
  	/* Find the table and fill in the block entries */
  	for (i = 0; i < ARRAY_SIZE(early_mmu_table); i++) {
@@ -215,6 +217,9 @@ static inline void early_mmu_setup(void)
   *
   * For LSCH3:
   * Level 2 table 1 contains 512 entries for each 2MB from 32GB to 33GB.
+ * For LSCH2:
+ * Level 2 table 1 contains 512 entries for each 2MB from 1GB to 2GB.
+ * Level 2 table 2 contains 512 entries for each 2MB from 20GB to 21GB.
   */
  static inline void final_mmu_setup(void)
  {
@@ -225,6 +230,9 @@ static inline void final_mmu_setup(void)
  	u64 *level2_table0 = (u64 *)(gd->arch.tlb_addr + 0x3000);
  #ifdef CONFIG_FSL_LSCH3
  	u64 *level2_table1 = (u64 *)(gd->arch.tlb_addr + 0x4000);
+#elif defined(CONFIG_FSL_LSCH2)
+	u64 *level2_table1 = (u64 *)(gd->arch.tlb_addr + 0x4000);
+	u64 *level2_table2 = (u64 *)(gd->arch.tlb_addr + 0x5000);
  #endif
  	struct table_info table = {level0_table, 0, BLOCK_SIZE_L0};
 
@@ -239,6 +247,11 @@ static inline void final_mmu_setup(void)
  	set_pgtable_table(level1_table0,
  			  CONFIG_SYS_FSL_QBMAN_BASE >> SECTION_SHIFT_L1,
  			  level2_table1);
+#elif defined(CONFIG_FSL_LSCH2)
+	set_pgtable_table(level1_table0, 1, level2_table1);
+	set_pgtable_table(level1_table0,
+			  CONFIG_SYS_FSL_QBMAN_BASE >> SECTION_SHIFT_L1,
+			  level2_table2);
  #endif
 
  	/* Find the table and fill in the block entries */
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c new file +117 -0
new file mode 100644
index 0000000..f7178d1
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/errno.h>
+#include <asm/arch/fsl_serdes.h>
+#include <asm/arch/soc.h>
+
+#ifdef CONFIG_SYS_FSL_SRDS_1
+static u8 serdes1_prtcl_map[SERDES_PRCTL_COUNT];
+#endif
+
+int is_serdes_configured(enum srds_prtcl device)
+{
+	int ret = 0;
+
+#ifdef CONFIG_SYS_FSL_SRDS_1
+	ret |= serdes1_prtcl_map[device];
+#endif
+
+	return !!ret;
+}
+
+int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
+{
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+	u32 cfg = gur_in32(&gur->rcwsr[4]);
+	int i;
+
+	switch (sd) {
+#ifdef CONFIG_SYS_FSL_SRDS_1
+	case FSL_SRDS_1:
+		cfg &= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
+		cfg >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
+		break;
+#endif
+	default:
+		printf("invalid SerDes%d\n", sd);
+		break;
+	}
+
+	/* Is serdes enabled at all? */
+	if (unlikely(cfg == 0))
+		return -ENODEV;
+
+	for (i = 0; i < SRDS_MAX_LANES; i++) {
+		if (serdes_get_prtcl(sd, cfg, i) == device)
+			return i;
+	}
+
+	return -ENODEV;
+}
+
+int get_serdes_protocol(void)
+{
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+	u32 cfg = gur_in32(&gur->rcwsr[4]) &
+			  FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
+	cfg >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
+
+	return cfg;
+}
+
+const char *serdes_clock_to_string(u32 clock)
+{
+	switch (clock) {
+	case SRDS_PLLCR0_RFCK_SEL_100:
+		return "100";
+	case SRDS_PLLCR0_RFCK_SEL_125:
+		return "125";
+	case SRDS_PLLCR0_RFCK_SEL_156_25:
+		return "156.25";
+	default:
+		return "100";
+	}
+}
+
+void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
+		 u8 serdes_prtcl_map[SERDES_PRCTL_COUNT])
+{
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+	u32 cfg;
+	int lane;
+
+	memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map));
+
+	cfg = gur_in32(&gur->rcwsr[4]) & sd_prctl_mask;
+	cfg >>= sd_prctl_shift;
+	printf("Using SERDES%d Protocol: %d (0x%x)\n", sd + 1, cfg, cfg);
+
+	if (!is_serdes_prtcl_valid(sd, cfg))
+		printf("SERDES%d[PRTCL] = 0x%x is not valid\n", sd + 1, cfg);
+
+	for (lane = 0; lane < SRDS_MAX_LANES; lane++) {
+		enum srds_prtcl lane_prtcl = serdes_get_prtcl(sd, cfg, lane);
+
+		if (unlikely(lane_prtcl >= SERDES_PRCTL_COUNT))
+			debug("Unknown SerDes lane protocol %d\n", lane_prtcl);
+		else
+			serdes_prtcl_map[lane_prtcl] = 1;
+	}
+}
+
+void fsl_serdes_init(void)
+{
+#ifdef CONFIG_SYS_FSL_SRDS_1
+	serdes_init(FSL_SRDS_1,
+		    CONFIG_SYS_FSL_SERDES_ADDR,
+		    FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK,
+		    FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT,
+		    serdes1_prtcl_map);
+#endif
+}
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c new file +137 -0
new file mode 100644
index 0000000..ea3723f
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <linux/compiler.h>
+#include <asm/io.h>
+#include <asm/processor.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/soc.h>
+#include <fsl_ifc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_SYS_FSL_NUM_CC_PLLS
+#define CONFIG_SYS_FSL_NUM_CC_PLLS      2
+#endif
+
+void get_sys_info(struct sys_info *sys_info)
+{
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+#ifdef CONFIG_FSL_IFC
+	struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
+	u32 ccr;
+#endif
+	struct ccsr_clk *clk = (void *)(CONFIG_SYS_FSL_CLK_ADDR);
+	unsigned int cpu;
+	const u8 core_cplx_pll[8] = {
+		[0] = 0,	/* CC1 PPL / 1 */
+		[1] = 0,	/* CC1 PPL / 2 */
+		[4] = 1,	/* CC2 PPL / 1 */
+		[5] = 1,	/* CC2 PPL / 2 */
+	};
+
+	const u8 core_cplx_pll_div[8] = {
+		[0] = 1,	/* CC1 PPL / 1 */
+		[1] = 2,	/* CC1 PPL / 2 */
+		[4] = 1,	/* CC2 PPL / 1 */
+		[5] = 2,	/* CC2 PPL / 2 */
+	};
+
+	uint i;
+	uint freq_c_pll[CONFIG_SYS_FSL_NUM_CC_PLLS];
+	uint ratio[CONFIG_SYS_FSL_NUM_CC_PLLS];
+	unsigned long sysclk = CONFIG_SYS_CLK_FREQ;
+
+	sys_info->freq_systembus = sysclk;
+#ifdef CONFIG_DDR_CLK_FREQ
+	sys_info->freq_ddrbus = CONFIG_DDR_CLK_FREQ;
+#else
+	sys_info->freq_ddrbus = sysclk;
+#endif
+
+	sys_info->freq_systembus *= (gur_in32(&gur->rcwsr[0]) >>
+			FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_SHIFT) &
+			FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_MASK;
+	sys_info->freq_ddrbus *= (gur_in32(&gur->rcwsr[0]) >>
+			FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_SHIFT) &
+			FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK;
+
+	for (i = 0; i < CONFIG_SYS_FSL_NUM_CC_PLLS; i++) {
+		ratio[i] = (in_be32(&clk->pllcgsr[i].pllcngsr) >> 1) & 0xff;
+		if (ratio[i] > 4)
+			freq_c_pll[i] = sysclk * ratio[i];
+		else
+			freq_c_pll[i] = sys_info->freq_systembus * ratio[i];
+	}
+
+	for (cpu = 0; cpu < CONFIG_MAX_CPUS; cpu++) {
+		u32 c_pll_sel = (in_be32(&clk->clkcsr[cpu].clkcncsr) >> 27)
+				& 0xf;
+		u32 cplx_pll = core_cplx_pll[c_pll_sel];
+
+		sys_info->freq_processor[cpu] =
+			freq_c_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel];
+	}
+
+#define HWA_CGA_M1_CLK_SEL	0xe0000000
+#define HWA_CGA_M1_CLK_SHIFT	29
+
+#define HWA_CGA_M2_CLK_SEL	0x00000007
+#define HWA_CGA_M2_CLK_SHIFT	0
+
+#if defined(CONFIG_FSL_IFC)
+	ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
+	ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
+
+	sys_info->freq_localbus = sys_info->freq_systembus / ccr;
+#endif
+}
+
+int get_clocks(void)
+{
+	struct sys_info sys_info;
+
+	get_sys_info(&sys_info);
+	gd->cpu_clk = sys_info.freq_processor[0];
+	gd->bus_clk = sys_info.freq_systembus;
+	gd->mem_clk = sys_info.freq_ddrbus;
+
+	if (gd->cpu_clk != 0)
+		return 0;
+	else
+		return 1;
+}
+
+ulong get_bus_freq(ulong dummy)
+{
+	return gd->bus_clk;
+}
+
+ulong get_ddr_freq(ulong dummy)
+{
+	return gd->mem_clk;
+}
+
+int get_serial_clock(void)
+{
+	return gd->bus_clk;
+}
+
+unsigned int mxc_get_clock(enum mxc_clock clk)
+{
+	switch (clk) {
+	case MXC_I2C_CLK:
+		return get_bus_freq(0);
+	case MXC_DSPI_CLK:
+		return get_bus_freq(0);
+	case MXC_UART_CLK:
+		return get_bus_freq(0);
+	default:
+		printf("Unsupported clock\n");
+	}
+	return 0;
+}
arch/arm/cpu/armv8/fsl-layerscape/soc.c +0 -0
index 73e48a7..637853d 100644

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch3_early_init_f(void) · line 84

Quoted 9 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +6 -0
@@ -76,6 +76,23 @@ void fsl_lsch3_early_init_f(void)
  	init_early_memctl_regs();	/* tighten IFC timing */
  	erratum_a009203();
  }
+
+#elif defined(CONFIG_LS1043A)
+void fsl_lsch2_early_init_f(void)
+{
+	struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
+

LS1088A CCI-400, will it be possible to have this code out of chassis code

Quoted 420 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +11 -0
+#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);
+}
  #endif
 
  #ifdef CONFIG_BOARD_LATE_INIT
arch/arm/include/asm/arch-fsl-layerscape/config.h +40 -0
index 69dd6b6..74e0b8d 100644
@@ -52,6 +52,46 @@
  #define CONFIG_SYS_FSL_ERRATUM_A008514
  #define CONFIG_SYS_FSL_ERRATUM_A008585
  #define CONFIG_SYS_FSL_ERRATUM_A008751
+#elif defined(CONFIG_LS1043A)
+#define CONFIG_MAX_CPUS				4
+#define CONFIG_SYS_CACHELINE_SIZE		64
+#define CONFIG_SYS_FMAN_V3
+#define CONFIG_SYS_NUM_FMAN			1
+#define CONFIG_SYS_NUM_FM1_DTSEC		7
+#define CONFIG_SYS_NUM_FM1_10GEC		1
+#define CONFIG_SYS_FSL_IFC_BANK_COUNT		4
+#define CONFIG_NUM_DDR_CONTROLLERS		1
+#define CONFIG_SYS_CCSRBAR_DEFAULT		0x01000000
+#define CONFIG_SYS_FSL_SEC_COMPAT		5
+#define CONFIG_SYS_FSL_OCRAM_BASE		0x10000000 /* initial RAM */
+#define CONFIG_SYS_FSL_OCRAM_SIZE		0x200000 /* 2 MiB */
+#define CONFIG_SYS_FSL_DDR_BE
+#define CONFIG_SYS_LS1_DDR_BLOCK1_SIZE  ((phys_size_t)2 << 30)
+#define CONFIG_MAX_MEM_MAPPED           CONFIG_SYS_LS1_DDR_BLOCK1_SIZE
+
+#define CONFIG_SYS_FSL_CCSR_GUR_BE
+#define CONFIG_SYS_FSL_CCSR_SCFG_BE
+#define CONFIG_SYS_FSL_IFC_BE
+#define CONFIG_SYS_FSL_ESDHC_BE
+#define CONFIG_SYS_FSL_WDOG_BE
+#define CONFIG_SYS_FSL_DSPI_BE
+#define CONFIG_SYS_FSL_QSPI_BE
+
+#define QE_MURAM_SIZE          0x6000UL
+#define MAX_QE_RISC            1
+#define QE_NUM_OF_SNUM         28
+
+#define	SRDS_MAX_LANES	4
+#define CONFIG_SYS_FSL_SRDS_1
+#define CONFIG_SYS_FSL_PCIE_COMPAT		"fsl,qoriq-pcie-v2.4"
+
+#define CONFIG_SYS_FSL_SFP_VER_3_2
+#define CONFIG_SYS_FSL_SNVS_LE
+#define CONFIG_SYS_FSL_SEC_LE
+#define CONFIG_SYS_FSL_SFP_BE
+#define CONFIG_SYS_FSL_SRK_LE
+#define CONFIG_KEY_REVOCATION
+
  #else
  #error SoC not defined
  #endif
arch/arm/include/asm/arch-fsl-layerscape/cpu.h +64 -0
index b7b8e5d..2903996 100644
@@ -11,6 +11,7 @@ static struct cpu_type cpu_type_list[] = {
  	CPU_TYPE_ENTRY(LS2085, LS2085, 8),
  	CPU_TYPE_ENTRY(LS2080, LS2080, 8),
  	CPU_TYPE_ENTRY(LS2045, LS2045, 4),
+	CPU_TYPE_ENTRY(LS1043, LS1043, 4),
  };
 
  #ifndef CONFIG_SYS_DCACHE_OFF
@@ -73,6 +74,28 @@ static struct cpu_type cpu_type_list[] = {
  #define CONFIG_SYS_FSL_PEBUF_SIZE	0x400000000
  #define CONFIG_SYS_FSL_DRAM_BASE2	0x8080000000
  #define CONFIG_SYS_FSL_DRAM_SIZE2	0x7F80000000
+#elif defined(CONFIG_FSL_LSCH2)
+#define CONFIG_SYS_FSL_BOOTROM_BASE	0x0
+#define CONFIG_SYS_FSL_BOOTROM_SIZE	0x1000000
+#define CONFIG_SYS_FSL_CCSR_BASE	0x1000000
+#define CONFIG_SYS_FSL_CCSR_SIZE	0xf000000
+#define CONFIG_SYS_FSL_DCSR_BASE	0x20000000
+#define CONFIG_SYS_FSL_DCSR_SIZE	0x4000000
+#define CONFIG_SYS_FSL_QSPI_BASE	0x40000000
+#define CONFIG_SYS_FSL_QSPI_SIZE	0x20000000
+#define CONFIG_SYS_FSL_IFC_BASE		0x60000000
+#define CONFIG_SYS_FSL_IFC_SIZE		0x20000000
+#define CONFIG_SYS_FSL_DRAM_BASE1	0x80000000
+#define CONFIG_SYS_FSL_DRAM_SIZE1	0x80000000
+#define CONFIG_SYS_FSL_QBMAN_BASE	0x500000000
+#define CONFIG_SYS_FSL_QBMAN_SIZE	0x10000000
+#define CONFIG_SYS_FSL_DRAM_BASE2	0x880000000
+#define CONFIG_SYS_FSL_DRAM_SIZE2	0x780000000	/* 30GB */
+#define CONFIG_SYS_PCIE1_PHYS_SIZE	0x800000000
+#define CONFIG_SYS_PCIE2_PHYS_SIZE	0x800000000
+#define CONFIG_SYS_PCIE3_PHYS_SIZE	0x800000000
+#define CONFIG_SYS_FSL_DRAM_BASE3	0x8800000000
+#define CONFIG_SYS_FSL_DRAM_SIZE3	0x7800000000	/* 480GB */
  #endif
 
  struct sys_mmu_table {
@@ -110,6 +133,19 @@ static const struct sys_mmu_table early_mmu_table[] = {
  	  CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
  	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
  	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+#elif defined(CONFIG_FSL_LSCH2)
+	{ CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
+	  CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
+	  CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
+	  CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_IFC_BASE, CONFIG_SYS_FSL_IFC_BASE,
+	  CONFIG_SYS_FSL_IFC_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
+	  CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
+	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
  #endif
  };
 
@@ -156,6 +192,34 @@ static const struct sys_mmu_table final_mmu_table[] = {
  	  CONFIG_SYS_FSL_PEBUF_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
  	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
  	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+#elif defined(CONFIG_FSL_LSCH2)
+	{ CONFIG_SYS_FSL_BOOTROM_BASE, CONFIG_SYS_FSL_BOOTROM_BASE,
+	  CONFIG_SYS_FSL_BOOTROM_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_CCSR_BASE, CONFIG_SYS_FSL_CCSR_BASE,
+	  CONFIG_SYS_FSL_CCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_OCRAM_BASE, CONFIG_SYS_FSL_OCRAM_BASE,
+	  CONFIG_SYS_FSL_OCRAM_SIZE, MT_NORMAL, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DCSR_BASE, CONFIG_SYS_FSL_DCSR_BASE,
+	  CONFIG_SYS_FSL_DCSR_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_QSPI_BASE, CONFIG_SYS_FSL_QSPI_BASE,
+	  CONFIG_SYS_FSL_QSPI_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_IFC_BASE, CONFIG_SYS_FSL_IFC_BASE,
+	  CONFIG_SYS_FSL_IFC_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
+	  CONFIG_SYS_FSL_DRAM_SIZE1, MT_NORMAL,
+	  PMD_SECT_OUTER_SHARE | PMD_SECT_NS },
+	{ CONFIG_SYS_FSL_QBMAN_BASE, CONFIG_SYS_FSL_QBMAN_BASE,
+	  CONFIG_SYS_FSL_QBMAN_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
+	  CONFIG_SYS_FSL_DRAM_SIZE2, MT_NORMAL, PMD_SECT_OUTER_SHARE },
+	{ CONFIG_SYS_PCIE1_PHYS_ADDR, CONFIG_SYS_PCIE1_PHYS_ADDR,
+	  CONFIG_SYS_PCIE1_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_PCIE2_PHYS_ADDR, CONFIG_SYS_PCIE2_PHYS_ADDR,
+	  CONFIG_SYS_PCIE2_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_PCIE3_PHYS_ADDR, CONFIG_SYS_PCIE3_PHYS_ADDR,
+	  CONFIG_SYS_PCIE3_PHYS_SIZE, MT_DEVICE_NGNRNE, PMD_SECT_NON_SHARE },
+	{ CONFIG_SYS_FSL_DRAM_BASE3, CONFIG_SYS_FSL_DRAM_BASE3,
+	  CONFIG_SYS_FSL_DRAM_SIZE3, MT_NORMAL, PMD_SECT_OUTER_SHARE },
  #endif
  };
  #endif
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h +91 -0
index 730c2b2..e1043b5 100644
@@ -55,6 +55,92 @@ enum srds {
  	FSL_SRDS_1  = 0,
  	FSL_SRDS_2  = 1,
  };
+#elif defined(CONFIG_LS1043A)
+enum srds_prtcl {
+	NONE = 0,
+	PCIE1,
+	PCIE2,
+	PCIE3,
+	PCIE4,
+	SATA1,
+	SATA2,
+	SRIO1,
+	SRIO2,
+	SGMII_FM1_DTSEC1,
+	SGMII_FM1_DTSEC2,
+	SGMII_FM1_DTSEC3,
+	SGMII_FM1_DTSEC4,
+	SGMII_FM1_DTSEC5,
+	SGMII_FM1_DTSEC6,
+	SGMII_FM1_DTSEC9,
+	SGMII_FM1_DTSEC10,
+	SGMII_FM2_DTSEC1,
+	SGMII_FM2_DTSEC2,
+	SGMII_FM2_DTSEC3,
+	SGMII_FM2_DTSEC4,
+	SGMII_FM2_DTSEC5,
+	SGMII_FM2_DTSEC6,
+	SGMII_FM2_DTSEC9,
+	SGMII_FM2_DTSEC10,
+	SGMII_TSEC1,
+	SGMII_TSEC2,
+	SGMII_TSEC3,
+	SGMII_TSEC4,
+	XAUI_FM1,
+	XAUI_FM2,
+	AURORA,
+	CPRI1,
+	CPRI2,
+	CPRI3,
+	CPRI4,
+	CPRI5,
+	CPRI6,
+	CPRI7,
+	CPRI8,
+	XAUI_FM1_MAC9,
+	XAUI_FM1_MAC10,
+	XAUI_FM2_MAC9,
+	XAUI_FM2_MAC10,
+	HIGIG_FM1_MAC9,
+	HIGIG_FM1_MAC10,
+	HIGIG_FM2_MAC9,
+	HIGIG_FM2_MAC10,
+	QSGMII_FM1_A,		/* A indicates MACs 1,2,5,6 */
+	QSGMII_FM1_B,		/* B indicates MACs 5,6,9,10 */
+	QSGMII_FM2_A,
+	QSGMII_FM2_B,
+	XFI_FM1_MAC1,
+	XFI_FM1_MAC2,
+	XFI_FM1_MAC9,
+	XFI_FM1_MAC10,
+	XFI_FM2_MAC9,
+	XFI_FM2_MAC10,
+	INTERLAKEN,
+	QSGMII_SW1_A,		/* Indicates ports on L2 Switch */
+	QSGMII_SW1_B,
+	SGMII_2500_FM1_DTSEC1,
+	SGMII_2500_FM1_DTSEC2,
+	SGMII_2500_FM1_DTSEC3,
+	SGMII_2500_FM1_DTSEC4,
+	SGMII_2500_FM1_DTSEC5,
+	SGMII_2500_FM1_DTSEC6,
+	SGMII_2500_FM1_DTSEC9,
+	SGMII_2500_FM1_DTSEC10,
+	SGMII_2500_FM2_DTSEC1,
+	SGMII_2500_FM2_DTSEC2,
+	SGMII_2500_FM2_DTSEC3,
+	SGMII_2500_FM2_DTSEC4,
+	SGMII_2500_FM2_DTSEC5,
+	SGMII_2500_FM2_DTSEC6,
+	SGMII_2500_FM2_DTSEC9,
+	SGMII_2500_FM2_DTSEC10,
+	SERDES_PRCTL_COUNT
+};
+
+enum srds {
+	FSL_SRDS_1  = 0,
+};
+
  #endif
 
  int is_serdes_configured(enum srds_prtcl device);
@@ -63,4 +149,9 @@ int serdes_get_first_lane(u32 sd, enum srds_prtcl device);
  enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane);
  int is_serdes_prtcl_valid(int serdes, u32 prtcl);
 
+#ifdef	CONFIG_LS1043A
+const char *serdes_clock_to_string(u32 clock);
+int get_serdes_protocol(void);
+#endif
+
  #endif /* __FSL_SERDES_H__ */
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +146 -0
new file mode 100644
index 0000000..d941437
@@ -0,0 +1,555 @@
+/*
+ * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __ARCH_FSL_LSCH2_IMMAP_H__
+#define __ARCH_FSL_LSCH2_IMMAP_H__
+
+#include <fsl_immap.h>
+
+#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)
+#define CONFIG_SYS_GIC400_ADDR			(CONFIG_SYS_IMMR + 0x00400000)
+#define CONFIG_SYS_IFC_ADDR			(CONFIG_SYS_IMMR + 0x00530000)
+#define CONFIG_SYS_FSL_ESDHC_ADDR		(CONFIG_SYS_IMMR + 0x00560000)
+#define CONFIG_SYS_FSL_CSU_ADDR			(CONFIG_SYS_IMMR + 0x00510000)
+#define CONFIG_SYS_FSL_GUTS_ADDR		(CONFIG_SYS_IMMR + 0x00ee0000)
+#define CONFIG_SYS_FSL_RST_ADDR			(CONFIG_SYS_IMMR + 0x00ee00b0)
+#define CONFIG_SYS_FSL_SCFG_ADDR		(CONFIG_SYS_IMMR + 0x00570000)
+#define CONFIG_SYS_FSL_FMAN_ADDR		(CONFIG_SYS_IMMR + 0x00a00000)
+#define CONFIG_SYS_FSL_SERDES_ADDR		(CONFIG_SYS_IMMR + 0x00ea0000)
+#define CONFIG_SYS_FSL_DCFG_ADDR		(CONFIG_SYS_IMMR + 0x00ee0000)
+#define CONFIG_SYS_FSL_CLK_ADDR			(CONFIG_SYS_IMMR + 0x00ee1000)
+#define CONFIG_SYS_NS16550_COM1			(CONFIG_SYS_IMMR + 0x011c0500)
+#define CONFIG_SYS_NS16550_COM2			(CONFIG_SYS_IMMR + 0x011c0600)
+#define CONFIG_SYS_NS16550_COM3			(CONFIG_SYS_IMMR + 0x011d0500)
+#define CONFIG_SYS_NS16550_COM4			(CONFIG_SYS_IMMR + 0x011d0600)
+#define CONFIG_SYS_FSL_XHCI_USB1_ADDR		(CONFIG_SYS_IMMR + 0x01f00000)
+#define CONFIG_SYS_FSL_XHCI_USB2_ADDR		(CONFIG_SYS_IMMR + 0x02000000)
+#define CONFIG_SYS_FSL_XHCI_USB3_ADDR		(CONFIG_SYS_IMMR + 0x02100000)
+#define CONFIG_SYS_PCIE1_ADDR			(CONFIG_SYS_IMMR + 0x2400000)
+#define CONFIG_SYS_PCIE2_ADDR			(CONFIG_SYS_IMMR + 0x2500000)
+#define CONFIG_SYS_PCIE3_ADDR			(CONFIG_SYS_IMMR + 0x2600000)
+#define CONFIG_SYS_FSL_SEC_ADDR			(CONFIG_SYS_IMMR + 0x700000)
+#define CONFIG_SYS_FSL_JR0_ADDR			(CONFIG_SYS_IMMR + 0x710000)
+#define CONFIG_SYS_SNVS_ADDR			(CONFIG_SYS_IMMR + 0xe90000)
+#define CONFIG_SYS_SFP_ADDR			(CONFIG_SYS_IMMR + 0xe80200)
+
+#define CONFIG_SYS_FSL_TIMER_ADDR		0x02b00000
+
+#define I2C1_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01180000)
+#define I2C2_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01190000)
+#define I2C3_BASE_ADDR				(CONFIG_SYS_IMMR + 0x011a0000)
+#define I2C4_BASE_ADDR				(CONFIG_SYS_IMMR + 0x011b0000)
+
+#define WDOG1_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01ad0000)
+
+#define QSPI0_BASE_ADDR				(CONFIG_SYS_IMMR + 0x00550000)
+#define DSPI1_BASE_ADDR				(CONFIG_SYS_IMMR + 0x01100000)
+
+#define LPUART_BASE				(CONFIG_SYS_IMMR + 0x01950000)
+
+#define AHCI_BASE_ADDR				(CONFIG_SYS_IMMR + 0x02200000)
+
+#define CONFIG_SYS_PCIE1_PHYS_ADDR		0x4000000000ULL
+#define CONFIG_SYS_PCIE2_PHYS_ADDR		0x4800000000ULL
+#define CONFIG_SYS_PCIE3_PHYS_ADDR		0x5000000000ULL
+
+/* TZ Address Space Controller Definitions */
+#define TZASC1_BASE			0x01100000	/* as per CCSR map. */
+#define TZASC2_BASE			0x01110000	/* as per CCSR map. */
+#define TZASC3_BASE			0x01120000	/* as per CCSR map. */
+#define TZASC4_BASE			0x01130000	/* as per CCSR map. */
+#define TZASC_BUILD_CONFIG_REG(x)	((TZASC1_BASE + (x * 0x10000)))
+#define TZASC_ACTION_REG(x)		((TZASC1_BASE + (x * 0x10000)) + 0x004)
+#define TZASC_GATE_KEEPER(x)		((TZASC1_BASE + (x * 0x10000)) + 0x008)
+#define TZASC_REGION_BASE_LOW_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x100)
+#define TZASC_REGION_BASE_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x104)
+#define TZASC_REGION_TOP_LOW_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x108)
+#define TZASC_REGION_TOP_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x10C)
+#define TZASC_REGION_ATTRIBUTES_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x110)
+#define TZASC_REGION_ID_ACCESS_0(x)	((TZASC1_BASE + (x * 0x10000)) + 0x114)
+
+#define TP_ITYP_AV              0x00000001      /* Initiator available */
+#define TP_ITYP_TYPE(x) (((x) & 0x6) >> 1)      /* Initiator Type */
+#define TP_ITYP_TYPE_ARM        0x0
+#define TP_ITYP_TYPE_PPC        0x1             /* PowerPC */
+#define TP_ITYP_TYPE_OTHER      0x2             /* StarCore DSP */
+#define TP_ITYP_TYPE_HA         0x3             /* HW Accelerator */
+#define TP_ITYP_THDS(x) (((x) & 0x18) >> 3)     /* # threads */
+#define TP_ITYP_VER(x)  (((x) & 0xe0) >> 5)     /* Initiator Version */
+#define TY_ITYP_VER_A7          0x1
+#define TY_ITYP_VER_A53         0x2
+#define TY_ITYP_VER_A57         0x3
+
+#define TP_CLUSTER_EOC		0xc0000000      /* end of clusters */
+#define TP_CLUSTER_INIT_MASK    0x0000003f      /* initiator mask */
+#define TP_INIT_PER_CLUSTER     4
+
+/*
+ * Define default values for some CCSR macros to make header files cleaner*
+ *
+ * To completely disable CCSR relocation in a board header file, define
+ * CONFIG_SYS_CCSR_DO_NOT_RELOCATE.  This will force CONFIG_SYS_CCSRBAR_PHYS
+ * to a value that is the same as CONFIG_SYS_CCSRBAR.
+ */
+
+#ifdef CONFIG_SYS_CCSRBAR_PHYS
+#error "Do not define CONFIG_SYS_CCSRBAR_PHYS directly.  Use \
+CONFIG_SYS_CCSRBAR_PHYS_LOW and/or CONFIG_SYS_CCSRBAR_PHYS_HIGH instead."
+#endif
+
+#ifdef CONFIG_SYS_CCSR_DO_NOT_RELOCATE
+#undef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#undef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR
+#define CONFIG_SYS_CCSRBAR		CONFIG_SYS_CCSRBAR_DEFAULT
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR_DEFAULT
+#endif
+
+#define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH * 1ull) << 32 | \
+				 CONFIG_SYS_CCSRBAR_PHYS_LOW)
+
+struct sys_info {
+	unsigned long freq_processor[CONFIG_MAX_CPUS];
+	unsigned long freq_systembus;
+	unsigned long freq_ddrbus;
+	unsigned long freq_localbus;
+	unsigned long freq_sdhc;
+#ifdef CONFIG_SYS_DPAA_FMAN
+	unsigned long freq_fman[CONFIG_SYS_NUM_FMAN];
+#endif
+	unsigned long freq_qman;
+};
+
+#define CONFIG_SYS_FSL_FM1_OFFSET		0xa00000
+#define CONFIG_SYS_FSL_FM1_RX0_1G_OFFSET	0xa88000
+#define CONFIG_SYS_FSL_FM1_RX1_1G_OFFSET	0xa89000
+#define CONFIG_SYS_FSL_FM1_RX2_1G_OFFSET	0xa8a000
+#define CONFIG_SYS_FSL_FM1_RX3_1G_OFFSET	0xa8b000
+#define CONFIG_SYS_FSL_FM1_RX4_1G_OFFSET	0xa8c000

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 156

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+#define CONFIG_SYS_FSL_FM1_RX5_1G_OFFSET	0xa8d000
+
+#define CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET	0xae0000
+#define CONFIG_SYS_FSL_FM1_ADDR			\
+		(CONFIG_SYS_IMMR + CONFIG_SYS_FSL_FM1_OFFSET)
+#define CONFIG_SYS_FSL_FM1_DTSEC1_ADDR		\
+		(CONFIG_SYS_IMMR + CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET)
+
+/* Device Configuration and Pin Control */
+struct ccsr_gur {

i will suggest to compare ccsr, scfg, etc registers between chassis2 & chassis3. Try to factor out the common code.

Quoted 373 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +373 -0
+	u32     porsr1;         /* POR status 1 */
+#define FSL_CHASSIS2_CCSR_PORSR1_RCW_MASK	0xFF800000
+	u32     porsr2;         /* POR status 2 */
+	u8      res_008[0x20-0x8];
+	u32     gpporcr1;       /* General-purpose POR configuration */
+	u32	gpporcr2;
+#define FSL_CHASSIS2_DCFG_FUSESR_VID_SHIFT	25
+#define FSL_CHASSIS2_DCFG_FUSESR_VID_MASK	0x1F
+#define FSL_CHASSIS2_DCFG_FUSESR_ALTVID_SHIFT	20
+#define FSL_CHASSIS2_DCFG_FUSESR_ALTVID_MASK	0x1F
+	u32     dcfg_fusesr;    /* Fuse status register */
+	u8      res_02c[0x70-0x2c];
+	u32     devdisr;        /* Device disable control */
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_1	0x80000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_2	0x40000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_3	0x20000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_4	0x10000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_5	0x08000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_6	0x04000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_9	0x00800000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_10	0x00400000
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_1	0x00800000
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_2	0x00400000
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_3	0x80000000
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_4	0x40000000
+	u32     devdisr2;       /* Device disable control 2 */
+	u32     devdisr3;       /* Device disable control 3 */
+	u32     devdisr4;       /* Device disable control 4 */
+	u32     devdisr5;       /* Device disable control 5 */
+	u32     devdisr6;       /* Device disable control 6 */
+	u32     devdisr7;       /* Device disable control 7 */
+	u8      res_08c[0x94-0x8c];
+	u32     coredisru;      /* uppper portion for support of 64 cores */
+	u32     coredisrl;      /* lower portion for support of 64 cores */
+	u8      res_09c[0xa0-0x9c];
+	u32     pvr;            /* Processor version */
+	u32     svr;            /* System version */
+	u32     mvr;            /* Manufacturing version */
+	u8	res_0ac[0xb0-0xac];
+	u32	rstcr;		/* Reset control */
+	u32	rstrqpblsr;	/* Reset request preboot loader status */
+	u8	res_0b8[0xc0-0xb8];
+	u32	rstrqmr1;	/* Reset request mask */
+	u8	res_0c4[0xc8-0xc4];
+	u32	rstrqsr1;	/* Reset request status */
+	u8	res_0cc[0xd4-0xcc];
+	u32	rstrqwdtmrl;	/* Reset request WDT mask */
+	u8	res_0d8[0xdc-0xd8];
+	u32	rstrqwdtsrl;	/* Reset request WDT status */
+	u8	res_0e0[0xe4-0xe0];
+	u32	brrl;		/* Boot release */
+	u8      res_0e8[0x100-0xe8];
+	u32     rcwsr[16];      /* Reset control word status */
+#define FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_SHIFT	25
+#define FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_MASK	0x1f
+#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_SHIFT	16
+#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK	0x3f
+#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK	0xffff0000
+#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT	16
+	u8      res_140[0x200-0x140];
+	u32     scratchrw[4];  /* Scratch Read/Write */
+	u8      res_210[0x300-0x210];
+	u32     scratchw1r[4];  /* Scratch Read (Write once) */
+	u8      res_310[0x400-0x310];
+	u32	crstsr[12];
+	u8	res_430[0x500-0x430];
+
+	/* PCI Express n Logical I/O Device Number register */
+	u32 dcfg_ccsr_pex1liodnr;
+	u32 dcfg_ccsr_pex2liodnr;
+	u32 dcfg_ccsr_pex3liodnr;
+	u32 dcfg_ccsr_pex4liodnr;
+	/* RIO n Logical I/O Device Number register */
+	u32 dcfg_ccsr_rio1liodnr;
+	u32 dcfg_ccsr_rio2liodnr;
+	u32 dcfg_ccsr_rio3liodnr;
+	u32 dcfg_ccsr_rio4liodnr;
+	/* USB Logical I/O Device Number register */
+	u32 dcfg_ccsr_usb1liodnr;
+	u32 dcfg_ccsr_usb2liodnr;
+	u32 dcfg_ccsr_usb3liodnr;
+	u32 dcfg_ccsr_usb4liodnr;
+	/* SD/MMC Logical I/O Device Number register */
+	u32 dcfg_ccsr_sdmmc1liodnr;
+	u32 dcfg_ccsr_sdmmc2liodnr;
+	u32 dcfg_ccsr_sdmmc3liodnr;
+	u32 dcfg_ccsr_sdmmc4liodnr;
+	/* RIO Message Unit Logical I/O Device Number register */
+	u32 dcfg_ccsr_riomaintliodnr;
+
+	u8      res_544[0x550-0x544];
+	u32	sataliodnr[4];
+	u8	res_560[0x570-0x560];
+
+	u32 dcfg_ccsr_misc1liodnr;
+	u32 dcfg_ccsr_misc2liodnr;
+	u32 dcfg_ccsr_misc3liodnr;
+	u32 dcfg_ccsr_misc4liodnr;
+	u32 dcfg_ccsr_dma1liodnr;
+	u32 dcfg_ccsr_dma2liodnr;
+	u32 dcfg_ccsr_dma3liodnr;
+	u32 dcfg_ccsr_dma4liodnr;
+	u32 dcfg_ccsr_spare1liodnr;
+	u32 dcfg_ccsr_spare2liodnr;
+	u32 dcfg_ccsr_spare3liodnr;
+	u32 dcfg_ccsr_spare4liodnr;
+	u8	res_5a0[0x600-0x5a0];
+	u32 dcfg_ccsr_pblsr;
+
+	u32	pamubypenr;
+	u32	dmacr1;
+
+	u8	res_60c[0x610-0x60c];
+	u32 dcfg_ccsr_gensr1;
+	u32 dcfg_ccsr_gensr2;
+	u32 dcfg_ccsr_gensr3;
+	u32 dcfg_ccsr_gensr4;
+	u32 dcfg_ccsr_gencr1;
+	u32 dcfg_ccsr_gencr2;
+	u32 dcfg_ccsr_gencr3;
+	u32 dcfg_ccsr_gencr4;
+	u32 dcfg_ccsr_gencr5;
+	u32 dcfg_ccsr_gencr6;
+	u32 dcfg_ccsr_gencr7;
+	u8	res_63c[0x658-0x63c];
+	u32 dcfg_ccsr_cgensr1;
+	u32 dcfg_ccsr_cgensr0;
+	u8	res_660[0x678-0x660];
+	u32 dcfg_ccsr_cgencr1;
+
+	u32 dcfg_ccsr_cgencr0;
+	u8	res_680[0x700-0x680];
+	u32 dcfg_ccsr_sriopstecr;
+	u32 dcfg_ccsr_dcsrcr;
+
+	u8      res_708[0x740-0x708];   /* add more registers when needed */
+	u32     tp_ityp[64];    /* Topology Initiator Type Register */
+	struct {
+		u32     upper;
+		u32     lower;
+	} tp_cluster[16];
+	u8      res_8c0[0xa00-0x8c0];   /* add more registers when needed */
+	u32 dcfg_ccsr_qmbm_warmrst;
+	u8      res_a04[0xa20-0xa04];   /* add more registers when needed */
+	u32 dcfg_ccsr_reserved0;
+	u32 dcfg_ccsr_reserved1;
+};
+
+#define SCFG_QSPI_CLKSEL		0x40100000
+#define SCFG_USBDRVVBUS_SELCR_USB1	0x00000000
+#define SCFG_USBDRVVBUS_SELCR_USB2	0x00000001
+#define SCFG_USBDRVVBUS_SELCR_USB3	0x00000002
+#define SCFG_USBPWRFAULT_INACTIVE	0x00000000
+#define SCFG_USBPWRFAULT_SHARED		0x00000001
+#define SCFG_USBPWRFAULT_DEDICATED	0x00000002
+#define SCFG_USBPWRFAULT_USB3_SHIFT	4
+#define SCFG_USBPWRFAULT_USB2_SHIFT	2
+#define SCFG_USBPWRFAULT_USB1_SHIFT	0
+
+#define SCFG_SNPCNFGCR_SECRDSNP		0x80000000
+#define SCFG_SNPCNFGCR_SECWRSNP		0x40000000
+
+/* Supplemental Configuration Unit */
+struct ccsr_scfg {
+	u8 res_000[0x100-0x000];
+	u32 usb2_icid;
+	u32 usb3_icid;
+	u8 res_108[0x114-0x108];
+	u32 dma_icid;
+	u32 sata_icid;
+	u32 usb1_icid;
+	u32 qe_icid;
+	u32 sdhc_icid;
+	u32 edma_icid;
+	u32 etr_icid;
+	u32 core_sft_rst[4];
+	u8 res_140[0x158-0x140];
+	u32 altcbar;
+	u32 qspi_cfg;
+	u8 res_160[0x180-0x160];
+	u32 dmamcr;
+	u8 res_184[0x18c-0x184];
+	u32 debug_icid;
+	u8 res_190[0x1a4-0x190];
+	u32 snpcnfgcr;
+	u8 res_1a8[0x1ac-0x1a8];
+	u32 intpcr;
+	u8 res_1b0[0x204-0x1b0];
+	u32 coresrencr;
+	u8 res_208[0x220-0x208];
+	u32 rvbar0_0;
+	u32 rvbar0_1;
+	u32 rvbar1_0;
+	u32 rvbar1_1;
+	u32 rvbar2_0;
+	u32 rvbar2_1;
+	u32 rvbar3_0;
+	u32 rvbar3_1;
+	u32 lpmcsr;
+	u8 res_244[0x400-0x244];
+	u32 qspidqscr;
+	u32 ecgtxcmcr;
+	u32 sdhciovselcr;
+	u32 rcwpmuxcr0;
+	u32 usbdrvvbus_selcr;
+	u32 usbpwrfault_selcr;
+	u32 usb_refclk_selcr1;
+	u32 usb_refclk_selcr2;
+	u32 usb_refclk_selcr3;
+	u8 res_424[0x600-0x424];
+	u32 scratchrw[4];
+	u8 res_610[0x680-0x610];
+	u32 corebcr;
+	u8 res_684[0x1000-0x684];
+	u32 pex1msiir;
+	u32 pex1msir;
+	u8 res_1008[0x2000-0x1008];
+	u32 pex2;
+	u32 pex2msir;
+	u8 res_2008[0x3000-0x2008];
+	u32 pex3msiir;
+	u32 pex3msir;
+};
+
+/* Clocking */
+struct ccsr_clk {
+	struct {
+		u32 clkcncsr;	/* core cluster n clock control status */
+		u8  res_004[0x0c];
+		u32 clkcghwacsr; /* Clock generator n hardware accelerator */
+		u8  res_014[0x0c];
+	} clkcsr[4];
+	u8	res_040[0x780]; /* 0x100 */
+	struct {
+		u32 pllcngsr;
+		u8 res_804[0x1c];
+	} pllcgsr[2];
+	u8	res_840[0x1c0];
+	u32	clkpcsr;	/* 0xa00 Platform clock domain control/status */
+	u8	res_a04[0x1fc];
+	u32	pllpgsr;	/* 0xc00 Platform PLL General Status */
+	u8	res_c04[0x1c];
+	u32	plldgsr;	/* 0xc20 DDR PLL General Status */
+	u8	res_c24[0x3dc];
+};
+
+/* System Counter */
+struct sctr_regs {
+	u32 cntcr;
+	u32 cntsr;
+	u32 cntcv1;
+	u32 cntcv2;
+	u32 resv1[4];
+	u32 cntfid0;
+	u32 cntfid1;
+	u32 resv2[1002];
+	u32 counterid[12];
+};
+
+#define SRDS_MAX_LANES		4
+struct ccsr_serdes {
+	struct {
+		u32	rstctl;	/* Reset Control Register */
+#define SRDS_RSTCTL_RST		0x80000000
+#define SRDS_RSTCTL_RSTDONE	0x40000000
+#define SRDS_RSTCTL_RSTERR	0x20000000
+#define SRDS_RSTCTL_SWRST	0x10000000
+#define SRDS_RSTCTL_SDEN	0x00000020
+#define SRDS_RSTCTL_SDRST_B	0x00000040
+#define SRDS_RSTCTL_PLLRST_B	0x00000080
+		u32	pllcr0; /* PLL Control Register 0 */
+#define SRDS_PLLCR0_POFF		0x80000000
+#define SRDS_PLLCR0_RFCK_SEL_MASK	0x70000000
+#define SRDS_PLLCR0_RFCK_SEL_100	0x00000000
+#define SRDS_PLLCR0_RFCK_SEL_125	0x10000000
+#define SRDS_PLLCR0_RFCK_SEL_156_25	0x20000000
+#define SRDS_PLLCR0_RFCK_SEL_150	0x30000000
+#define SRDS_PLLCR0_RFCK_SEL_161_13	0x40000000
+#define SRDS_PLLCR0_RFCK_SEL_122_88	0x50000000
+#define SRDS_PLLCR0_PLL_LCK		0x00800000
+#define SRDS_PLLCR0_FRATE_SEL_MASK	0x000f0000
+#define SRDS_PLLCR0_FRATE_SEL_5		0x00000000
+#define SRDS_PLLCR0_FRATE_SEL_3_75	0x00050000
+#define SRDS_PLLCR0_FRATE_SEL_5_15	0x00060000
+#define SRDS_PLLCR0_FRATE_SEL_4		0x00070000
+#define SRDS_PLLCR0_FRATE_SEL_3_12	0x00090000
+#define SRDS_PLLCR0_FRATE_SEL_3		0x000a0000
+		u32	pllcr1; /* PLL Control Register 1 */
+#define SRDS_PLLCR1_PLL_BWSEL	0x08000000
+		u32	res_0c;	/* 0x00c */
+		u32	pllcr3;
+		u32	pllcr4;
+		u8	res_18[0x20-0x18];
+	} bank[2];
+	u8	res_40[0x90-0x40];
+	u32	srdstcalcr;	/* 0x90 TX Calibration Control */
+	u8	res_94[0xa0-0x94];
+	u32	srdsrcalcr;	/* 0xa0 RX Calibration Control */
+	u8	res_a4[0xb0-0xa4];
+	u32	srdsgr0;	/* 0xb0 General Register 0 */
+	u8	res_b4[0xe0-0xb4];
+	u32	srdspccr0;	/* 0xe0 Protocol Converter Config 0 */
+	u32	srdspccr1;	/* 0xe4 Protocol Converter Config 1 */
+	u32	srdspccr2;	/* 0xe8 Protocol Converter Config 2 */
+	u32	srdspccr3;	/* 0xec Protocol Converter Config 3 */
+	u32	srdspccr4;	/* 0xf0 Protocol Converter Config 4 */
+	u8	res_f4[0x100-0xf4];
+	struct {
+		u32	lnpssr;	/* 0x100, 0x120, ..., 0x1e0 */
+		u8	res_104[0x120-0x104];
+	} srdslnpssr[4];
+	u8	res_180[0x300-0x180];
+	u32	srdspexeqcr;
+	u32	srdspexeqpcr[11];
+	u8	res_330[0x400-0x330];
+	u32	srdspexapcr;
+	u8	res_404[0x440-0x404];
+	u32	srdspexbpcr;
+	u8	res_444[0x800-0x444];
+	struct {
+		u32	gcr0;	/* 0x800 General Control Register 0 */
+		u32	gcr1;	/* 0x804 General Control Register 1 */
+		u32	gcr2;	/* 0x808 General Control Register 2 */
+		u32	sscr0;
+		u32	recr0;	/* 0x810 Receive Equalization Control */
+		u32	recr1;
+		u32	tecr0;	/* 0x818 Transmit Equalization Control */
+		u32	sscr1;
+		u32	ttlcr0;	/* 0x820 Transition Tracking Loop Ctrl 0 */
+		u8	res_824[0x83c-0x824];
+		u32	tcsr3;
+	} lane[4];	/* Lane A, B, C, D, E, F, G, H */
+	u8	res_a00[0x1000-0xa00];	/* from 0xa00 to 0xfff */
+};
+
+#define CCI400_CTRLORD_TERM_BARRIER	0x00000008
+#define CCI400_CTRLORD_EN_BARRIER	0
+#define CCI400_SHAORD_NON_SHAREABLE	0x00000002
+#define CCI400_DVM_MESSAGE_REQ_EN	0x00000002
+#define CCI400_SNOOP_REQ_EN		0x00000001
+
+/* CCI-400 registers */
+struct ccsr_cci400 {
+	u32 ctrl_ord;			/* Control Override */
+	u32 spec_ctrl;			/* Speculation Control */
+	u32 secure_access;		/* Secure Access */
+	u32 status;			/* Status */
+	u32 impr_err;			/* Imprecise Error */
+	u8 res_14[0x100 - 0x14];
+	u32 pmcr;			/* Performance Monitor Control */
+	u8 res_104[0xfd0 - 0x104];
+	u32 pid[8];			/* Peripheral ID */
+	u32 cid[4];			/* Component ID */
+	struct {
+		u32 snoop_ctrl;		/* Snoop Control */
+		u32 sha_ord;		/* Shareable Override */
+		u8 res_1008[0x1100 - 0x1008];
+		u32 rc_qos_ord;		/* read channel QoS Value Override */
+		u32 wc_qos_ord;		/* read channel QoS Value Override */
+		u8 res_1108[0x110c - 0x1108];
+		u32 qos_ctrl;		/* QoS Control */
+		u32 max_ot;		/* Max OT */
+		u8 res_1114[0x1130 - 0x1114];
+		u32 target_lat;		/* Target Latency */
+		u32 latency_regu;	/* Latency Regulation */
+		u32 qos_range;		/* QoS Range */
+		u8 res_113c[0x2000 - 0x113c];
+	} slave[5];			/* Slave Interface */
+	u8 res_6000[0x9004 - 0x6000];
+	u32 cycle_counter;		/* Cycle counter */
+	u32 count_ctrl;			/* Count Control */
+	u32 overflow_status;		/* Overflow Flag Status */
+	u8 res_9010[0xa000 - 0x9010];

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 539

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+	struct {
+		u32 event_select;	/* Event Select */
+		u32 event_count;	/* Event Count */
+		u32 counter_ctrl;	/* Counter Control */
+		u32 overflow_status;	/* Overflow Flag Status */
+		u8 res_a010[0xb000 - 0xa010];
+	} pcounter[4];			/* Performance Counter */
+	u8 res_e004[0x10000 - 0xe004];
+};
+

LS1088A has CCI-400. This piece of code and define should be outside of chassis file

arch/arm/include/asm/arch-fsl-layerscape/ns_access.h

Quoted 21 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +16 -0
+/* MMU 500 */
+#define SMMU_SCR0			(SMMU_BASE + 0x0)
+#define SMMU_SCR1			(SMMU_BASE + 0x4)
+#define SMMU_SCR2			(SMMU_BASE + 0x8)
+#define SMMU_SACR			(SMMU_BASE + 0x10)
+#define SMMU_IDR0			(SMMU_BASE + 0x20)
+#define SMMU_IDR1			(SMMU_BASE + 0x24)
+
+#define SMMU_NSCR0			(SMMU_BASE + 0x400)
+#define SMMU_NSCR2			(SMMU_BASE + 0x408)
+#define SMMU_NSACR			(SMMU_BASE + 0x410)
+
+#define SCR0_CLIENTPD_MASK		0x00000001
+#define SCR0_USFCFG_MASK		0x00000400
+
+#endif	/* __ARCH_FSL_LSCH2_IMMAP_H__*/
arch/arm/include/asm/arch-fsl-layerscape/ns_access.h new file +0 -0
new file mode 100644
index 0000000..a3ccdb0

not sure, will LS1088A also use below code?

Quoted 200 lines
arch/arm/include/asm/arch-fsl-layerscape/ns_access.h new file +158 -0
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __FSL_NS_ACCESS_H_
+#define __FSL_NS_ACCESS_H_
+
+enum csu_cslx_ind {
+	CSU_CSLX_PCIE2_IO = 0,
+	CSU_CSLX_PCIE1_IO,
+	CSU_CSLX_MG2TPR_IP,
+	CSU_CSLX_IFC_MEM,
+	CSU_CSLX_OCRAM,
+	CSU_CSLX_GIC,
+	CSU_CSLX_PCIE1,
+	CSU_CSLX_OCRAM2,
+	CSU_CSLX_QSPI_MEM,
+	CSU_CSLX_PCIE2,
+	CSU_CSLX_SATA,
+	CSU_CSLX_USB1,
+	CSU_CSLX_QM_BM_SWPORTAL,
+	CSU_CSLX_PCIE3 = 16,
+	CSU_CSLX_PCIE3_IO,
+	CSU_CSLX_USB3 = 20,
+	CSU_CSLX_USB2,
+	CSU_CSLX_SERDES = 32,
+	CSU_CSLX_QDMA,
+	CSU_CSLX_LPUART2,
+	CSU_CSLX_LPUART1,
+	CSU_CSLX_LPUART4,
+	CSU_CSLX_LPUART3,
+	CSU_CSLX_LPUART6,
+	CSU_CSLX_LPUART5,
+	CSU_CSLX_DSPI1 = 41,
+	CSU_CSLX_QSPI,
+	CSU_CSLX_ESDHC,
+	CSU_CSLX_IFC = 45,
+	CSU_CSLX_I2C1,
+	CSU_CSLX_I2C3 = 48,
+	CSU_CSLX_I2C2,
+	CSU_CSLX_DUART2 = 50,
+	CSU_CSLX_DUART1,
+	CSU_CSLX_WDT2,
+	CSU_CSLX_WDT1,
+	CSU_CSLX_EDMA,
+	CSU_CSLX_SYS_CNT,
+	CSU_CSLX_DMA_MUX2,
+	CSU_CSLX_DMA_MUX1,
+	CSU_CSLX_DDR,
+	CSU_CSLX_QUICC,
+	CSU_CSLX_DCFG_CCU_RCPM = 60,
+	CSU_CSLX_SECURE_BOOTROM,
+	CSU_CSLX_SFP,
+	CSU_CSLX_TMU,
+	CSU_CSLX_SECURE_MONITOR,
+	CSU_CSLX_SCFG,
+	CSU_CSLX_FM = 66,
+	CSU_CSLX_SEC5_5,
+	CSU_CSLX_BM,
+	CSU_CSLX_QM,
+	CSU_CSLX_GPIO2 = 70,
+	CSU_CSLX_GPIO1,
+	CSU_CSLX_GPIO4,
+	CSU_CSLX_GPIO3,
+	CSU_CSLX_PLATFORM_CONT,
+	CSU_CSLX_CSU,
+	CSU_CSLX_IIC4 = 77,
+	CSU_CSLX_WDT4,
+	CSU_CSLX_WDT3,
+	CSU_CSLX_WDT5 = 81,
+	CSU_CSLX_FTM2 = 86,
+	CSU_CSLX_FTM1,
+	CSU_CSLX_FTM4,
+	CSU_CSLX_FTM3,
+	CSU_CSLX_FTM6 = 90,
+	CSU_CSLX_FTM5,
+	CSU_CSLX_FTM8,
+	CSU_CSLX_FTM7,
+	CSU_CSLX_DSCR = 121,
+};
+
+static struct csu_ns_dev ns_dev[] = {
+	 {CSU_CSLX_PCIE2_IO, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE1_IO, CSU_ALL_RW},
+	 {CSU_CSLX_MG2TPR_IP, CSU_ALL_RW},
+	 {CSU_CSLX_IFC_MEM, CSU_ALL_RW},
+	 {CSU_CSLX_OCRAM, CSU_ALL_RW},
+	 {CSU_CSLX_GIC, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE1, CSU_ALL_RW},
+	 {CSU_CSLX_OCRAM2, CSU_ALL_RW},
+	 {CSU_CSLX_QSPI_MEM, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE2, CSU_ALL_RW},
+	 {CSU_CSLX_SATA, CSU_ALL_RW},
+	 {CSU_CSLX_USB1, CSU_ALL_RW},
+	 {CSU_CSLX_QM_BM_SWPORTAL, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE3, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE3_IO, CSU_ALL_RW},
+	 {CSU_CSLX_USB3, CSU_ALL_RW},
+	 {CSU_CSLX_USB2, CSU_ALL_RW},
+	 {CSU_CSLX_SERDES, CSU_ALL_RW},
+	 {CSU_CSLX_QDMA, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART2, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART1, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART4, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART3, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART6, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART5, CSU_ALL_RW},
+	 {CSU_CSLX_DSPI1, CSU_ALL_RW},
+	 {CSU_CSLX_QSPI, CSU_ALL_RW},
+	 {CSU_CSLX_ESDHC, CSU_ALL_RW},
+	 {CSU_CSLX_IFC, CSU_ALL_RW},
+	 {CSU_CSLX_I2C1, CSU_ALL_RW},
+	 {CSU_CSLX_I2C3, CSU_ALL_RW},
+	 {CSU_CSLX_I2C2, CSU_ALL_RW},
+	 {CSU_CSLX_DUART2, CSU_ALL_RW},
+	 {CSU_CSLX_DUART1, CSU_ALL_RW},
+	 {CSU_CSLX_WDT2, CSU_ALL_RW},
+	 {CSU_CSLX_WDT1, CSU_ALL_RW},
+	 {CSU_CSLX_EDMA, CSU_ALL_RW},
+	 {CSU_CSLX_SYS_CNT, CSU_ALL_RW},
+	 {CSU_CSLX_DMA_MUX2, CSU_ALL_RW},
+	 {CSU_CSLX_DMA_MUX1, CSU_ALL_RW},
+	 {CSU_CSLX_DDR, CSU_ALL_RW},
+	 {CSU_CSLX_QUICC, CSU_ALL_RW},
+	 {CSU_CSLX_DCFG_CCU_RCPM, CSU_ALL_RW},
+	 {CSU_CSLX_SECURE_BOOTROM, CSU_ALL_RW},
+	 {CSU_CSLX_SFP, CSU_ALL_RW},
+	 {CSU_CSLX_TMU, CSU_ALL_RW},
+	 {CSU_CSLX_SECURE_MONITOR, CSU_ALL_RW},
+	 {CSU_CSLX_SCFG, CSU_ALL_RW},
+	 {CSU_CSLX_FM, CSU_ALL_RW},
+	 {CSU_CSLX_SEC5_5, CSU_ALL_RW},
+	 {CSU_CSLX_BM, CSU_ALL_RW},
+	 {CSU_CSLX_QM, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO2, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO1, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO4, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO3, CSU_ALL_RW},
+	 {CSU_CSLX_PLATFORM_CONT, CSU_ALL_RW},
+	 {CSU_CSLX_CSU, CSU_ALL_RW},
+	 {CSU_CSLX_IIC4, CSU_ALL_RW},
+	 {CSU_CSLX_WDT4, CSU_ALL_RW},
+	 {CSU_CSLX_WDT3, CSU_ALL_RW},
+	 {CSU_CSLX_WDT5, CSU_ALL_RW},
+	 {CSU_CSLX_FTM2, CSU_ALL_RW},
+	 {CSU_CSLX_FTM1, CSU_ALL_RW},
+	 {CSU_CSLX_FTM4, CSU_ALL_RW},
+	 {CSU_CSLX_FTM3, CSU_ALL_RW},
+	 {CSU_CSLX_FTM6, CSU_ALL_RW},
+	 {CSU_CSLX_FTM5, CSU_ALL_RW},
+	 {CSU_CSLX_FTM8, CSU_ALL_RW},
+	 {CSU_CSLX_FTM7, CSU_ALL_RW},
+	 {CSU_CSLX_DSCR, CSU_ALL_RW},
+};
+
+#endif
arch/arm/include/asm/arch-fsl-layerscape/soc.h +6 -0
index f131f57..5ed456e 100644
@@ -33,6 +33,7 @@ struct cpu_type {
  	{ .name = #n, .soc_ver = SVR_##v, .num_cores = (nc)}
 
  #define SVR_WO_E		0xFFFFFE
+#define SVR_LS1043		0x879204
  #define SVR_LS2045		0x870120
  #define SVR_LS2080		0x870110
  #define SVR_LS2085		0x870100
@@ -42,6 +43,11 @@ struct cpu_type {
  #define SVR_SOC_VER(svr)	(((svr) >> 8) & SVR_WO_E)
  #define IS_E_PROCESSOR(svr)	(!((svr >> 8) & 0x1))
 
+#ifdef CONFIG_FSL_LSCH3
  void fsl_lsch3_early_init_f(void);
+#elif defined(CONFIG_FSL_LSCH2)
+void fsl_lsch2_early_init_f(void);
+#endif
+
  void cpu_name(char *name);
  #endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_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)
include/common.h +0 -0
index 142936b..09a131d 100644

include/common.h typedef volatile unsigned char vu_char; · line 87

Quoted 9 lines
include/common.h +3 -0
@@ -79,6 +79,9 @@ typedef volatile unsigned char	vu_char;
  #ifdef CONFIG_FSL_LSCH3
  #include <asm/arch/immap_lsch3.h>
  #endif
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch/immap_lsch2.h>
+#endif
 
  #include <part.h>
  #include <flash.h>

--prabhakar

author
#21 lore raw

PATCH v5 12/17 armv8/fsl_lsch2: Add fsl_lsch2 SoC

Quoted 65 lines

-----Original Message-----
From: Prabhakar [mailto:prabhakar at freescale.com]
Sent: Friday, October 16, 2015 2:28 PM
To: Gong Qianyu-B52263; u-boot at lists.denx.de
Cc: Hu Mingkai-B21284; Sun York-R58495; Hou Zhiqiang-B48286; Xie Shaohui- B21989; Song Wenbin-B53747; Wood Scott-B07421; Wang Huan-B18965; Li Yang- Leo-R58472
Subject: Re: [Patch V5 12/17] armv8/fsl_lsch2: Add fsl_lsch2 SoC

Quoted 9 lines · Gong Qianyu

From: Mingkai Hu <[email protected]>

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

Quoted 5 lines

---
V5:
- Move LS1043A ddr macros out of soc #ifdef.
- Move macros and structs from cpu.c to cpu.h.
- Wrap le32 and be32 functions for ccsr gur and scfg. Defined in

soc.h

Quoted 10 lines

- Modify fsl-layerscape/Makefile.
V4:
- Add fsl_lsch2 to fsl-layerscape framework.
V3:
- Update MMU table initialization to match the latest code.
- Remove some dead code
- Rename #include<asm/arch-fsl-lsch2/xxx> to #include<asm/arch/xxx>
V2:
- remove FSL_LS102xA_DEVDISR3_PCIE from immap_lsch2.h

Quoted 10 lines
  arch/arm/cpu/armv8/fsl-layerscape/Makefile         |   5 +
  arch/arm/cpu/armv8/fsl-layerscape/README.lsch2     |  10 +
  arch/arm/cpu/armv8/fsl-layerscape/cpu.c            |  13 +
  .../cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c    | 117 +++++
  .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 137 +++++
  arch/arm/cpu/armv8/fsl-layerscape/soc.c            |  17 +
  arch/arm/include/asm/arch-fsl-layerscape/config.h  |  40 ++
  arch/arm/include/asm/arch-fsl-layerscape/cpu.h     |  64 +++
  .../include/asm/arch-fsl-layerscape/fsl_serdes.h   |  91 ++++
  .../include/asm/arch-fsl-layerscape/immap_lsch2.h  | 555

+++++++++++++++++++++

Quoted 16 lines
  .../include/asm/arch-fsl-layerscape/ns_access.h    | 158 ++++++
  arch/arm/include/asm/arch-fsl-layerscape/soc.h     |   6 +
  arch/arm/include/asm/armv8/mmu.h                   |   1 +
  include/common.h                                   |   3 +
  14 files changed, 1217 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +1 -0
index 73e48a7..637853d 100644
@@ -76,6 +76,23 @@ void fsl_lsch3_early_init_f(void)
  	init_early_memctl_regs();	/* tighten IFC timing */
  	erratum_a009203();
  }
+
Quoted 9 lines

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch3_early_init_f(void) · line 84

Quoted 6 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +6 -0
+#elif defined(CONFIG_LS1043A)
+void fsl_lsch2_early_init_f(void)
+{
+	struct ccsr_cci400 *cci = (struct ccsr_cci400
+*)CONFIG_SYS_CCI400_ADDR;
+

LS1088A CCI-400, will it be possible to have this code out of chassis code

Maybe reconsolidate the code after LS1088A joins us.

Create a cci_400.c or something to contain the common code.

For the moment, we have no plan to fix it.

Quoted 215 lines
Quoted 24 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +10 -0
+#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); }
  #endif
 
  #ifdef CONFIG_BOARD_LATE_INIT
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +4 -0
new file mode 100644
index 0000000..d941437
@@ -0,0 +1,555 @@
+/*
+ * Copyright 2013-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 14

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+ */
+
+#ifndef __ARCH_FSL_LSCH2_IMMAP_H__
+#define __ARCH_FSL_LSCH2_IMMAP_H__
+
+#include <fsl_immap.h>
+
+#define CONFIG_SYS_IMMR				0x01000000
+#define CONFIG_SYS_DCSRBAR			0x20000000
+#define CONFIG_SYS_DCSR_DCFG_ADDR	(CONFIG_SYS_DCSRBAR +

0x00220000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 16

Quoted 2 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +2 -0
+
+#define CONFIG_SYS_FSL_DDR_ADDR			(CONFIG_SYS_IMMR +

0x00080000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 17

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_CCI400_ADDR			(CONFIG_SYS_IMMR +

0x00180000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 18

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_GIC400_ADDR			(CONFIG_SYS_IMMR +

0x00400000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 19

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_IFC_ADDR			(CONFIG_SYS_IMMR +

0x00530000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 20

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_FSL_ESDHC_ADDR		(CONFIG_SYS_IMMR +

0x00560000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 21

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_FSL_CSU_ADDR			(CONFIG_SYS_IMMR +

0x00510000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 23

Quoted 2 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +2 -0
+#define CONFIG_SYS_FSL_GUTS_ADDR		(CONFIG_SYS_IMMR + 0x00ee0000)
+#define CONFIG_SYS_FSL_RST_ADDR			(CONFIG_SYS_IMMR +

0x00ee00b0)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 3 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +3 -0
+#define CONFIG_SYS_FSL_SCFG_ADDR		(CONFIG_SYS_IMMR + 0x00570000)
+#define CONFIG_SYS_FSL_FMAN_ADDR		(CONFIG_SYS_IMMR + 0x00a00000)
+#define CONFIG_SYS_FSL_SERDES_ADDR		(CONFIG_SYS_IMMR +

0x00ea0000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 28

Quoted 2 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +2 -0
+#define CONFIG_SYS_FSL_DCFG_ADDR		(CONFIG_SYS_IMMR + 0x00ee0000)
+#define CONFIG_SYS_FSL_CLK_ADDR			(CONFIG_SYS_IMMR +

0x00ee1000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 29

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_NS16550_COM1			(CONFIG_SYS_IMMR +

0x011c0500)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 30

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_NS16550_COM2			(CONFIG_SYS_IMMR +

0x011c0600)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 31

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_NS16550_COM3			(CONFIG_SYS_IMMR +

0x011d0500)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 32

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_NS16550_COM4			(CONFIG_SYS_IMMR +

0x011d0600)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 33

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_FSL_XHCI_USB1_ADDR		(CONFIG_SYS_IMMR +

0x01f00000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 34

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_FSL_XHCI_USB2_ADDR		(CONFIG_SYS_IMMR +

0x02000000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 35

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_FSL_XHCI_USB3_ADDR		(CONFIG_SYS_IMMR +

0x02100000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 36

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_PCIE1_ADDR			(CONFIG_SYS_IMMR +

0x2400000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 37

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_PCIE2_ADDR			(CONFIG_SYS_IMMR +

0x2500000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 38

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_PCIE3_ADDR			(CONFIG_SYS_IMMR +

0x2600000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 39

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_FSL_SEC_ADDR			(CONFIG_SYS_IMMR +

0x700000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 40

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_FSL_JR0_ADDR			(CONFIG_SYS_IMMR +

0x710000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 41

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_SNVS_ADDR			(CONFIG_SYS_IMMR +

0xe90000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 42

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define CONFIG_SYS_SFP_ADDR			(CONFIG_SYS_IMMR +

0xe80200)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 4 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +4 -0
+
+#define CONFIG_SYS_FSL_TIMER_ADDR		0x02b00000
+
+#define I2C1_BASE_ADDR				(CONFIG_SYS_IMMR +

0x01180000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 47

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define I2C2_BASE_ADDR				(CONFIG_SYS_IMMR +

0x01190000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 48

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define I2C3_BASE_ADDR				(CONFIG_SYS_IMMR +

0x011a0000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 49

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define I2C4_BASE_ADDR				(CONFIG_SYS_IMMR +

0x011b0000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 51

Quoted 2 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +2 -0
+
+#define WDOG1_BASE_ADDR				(CONFIG_SYS_IMMR +

0x01ad0000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 53

Quoted 2 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +2 -0
+
+#define QSPI0_BASE_ADDR				(CONFIG_SYS_IMMR +

0x00550000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 54

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define DSPI1_BASE_ADDR				(CONFIG_SYS_IMMR +

0x01100000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 4 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +4 -0
+
+#define LPUART_BASE				(CONFIG_SYS_IMMR + 0x01950000)
+
+#define AHCI_BASE_ADDR				(CONFIG_SYS_IMMR +

0x02200000)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 12 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +12 -0
+
+#define CONFIG_SYS_PCIE1_PHYS_ADDR		0x4000000000ULL
+#define CONFIG_SYS_PCIE2_PHYS_ADDR		0x4800000000ULL
+#define CONFIG_SYS_PCIE3_PHYS_ADDR		0x5000000000ULL
+
+/* TZ Address Space Controller Definitions */
+#define TZASC1_BASE			0x01100000	/* as per CCSR map. */
+#define TZASC2_BASE			0x01110000	/* as per CCSR map. */
+#define TZASC3_BASE			0x01120000	/* as per CCSR map. */
+#define TZASC4_BASE			0x01130000	/* as per CCSR map. */
+#define TZASC_BUILD_CONFIG_REG(x)	((TZASC1_BASE + (x * 0x10000)))
+#define TZASC_ACTION_REG(x)		((TZASC1_BASE + (x * 0x10000))

+ 0x004)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 71

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define TZASC_GATE_KEEPER(x)		((TZASC1_BASE + (x * 0x10000))

+ 0x008)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 72

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define TZASC_REGION_BASE_LOW_0(x)	((TZASC1_BASE + (x * 0x10000))

+ 0x100)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 73

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define TZASC_REGION_BASE_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000))

+ 0x104)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 74

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define TZASC_REGION_TOP_LOW_0(x)	((TZASC1_BASE + (x * 0x10000))

+ 0x108)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 75

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define TZASC_REGION_TOP_HIGH_0(x)	((TZASC1_BASE + (x * 0x10000))

+ 0x10C)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 76

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define TZASC_REGION_ATTRIBUTES_0(x)	((TZASC1_BASE + (x * 0x10000))

+ 0x110)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 77

Quoted 1 line
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +1 -0
+#define TZASC_REGION_ID_ACCESS_0(x)	((TZASC1_BASE + (x * 0x10000))

+ 0x114)

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 79

Quoted 2 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +2 -0
+
+#define TP_ITYP_AV              0x00000001      /* Initiator available

*/

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 7 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +7 -0
+#define TP_ITYP_TYPE(x) (((x) & 0x6) >> 1)      /* Initiator Type */
+#define TP_ITYP_TYPE_ARM        0x0
+#define TP_ITYP_TYPE_PPC        0x1             /* PowerPC */
+#define TP_ITYP_TYPE_OTHER      0x2             /* StarCore DSP */
+#define TP_ITYP_TYPE_HA         0x3             /* HW Accelerator */
+#define TP_ITYP_THDS(x) (((x) & 0x18) >> 3)     /* # threads */
+#define TP_ITYP_VER(x)  (((x) & 0xe0) >> 5)     /* Initiator Version

*/

Quoted 12 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +12 -0
+#define TY_ITYP_VER_A7          0x1
+#define TY_ITYP_VER_A53         0x2
+#define TY_ITYP_VER_A57         0x3
+
+#define TP_CLUSTER_EOC		0xc0000000      /* end of clusters */
+#define TP_CLUSTER_INIT_MASK    0x0000003f      /* initiator mask */
+#define TP_INIT_PER_CLUSTER     4
+
+/*
+ * Define default values for some CCSR macros to make header files
+cleaner*
+ *

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+ * To completely disable CCSR relocation in a board header file,
+define
+ * CONFIG_SYS_CCSR_DO_NOT_RELOCATE.  This will force
+CONFIG_SYS_CCSRBAR_PHYS
+ * to a value that is the same as CONFIG_SYS_CCSRBAR.
+ */
+
+#ifdef CONFIG_SYS_CCSRBAR_PHYS
+#error "Do not define CONFIG_SYS_CCSRBAR_PHYS directly.  Use \
+CONFIG_SYS_CCSRBAR_PHYS_LOW and/or CONFIG_SYS_CCSRBAR_PHYS_HIGH

instead."

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+#endif
+
+#ifdef CONFIG_SYS_CCSR_DO_NOT_RELOCATE #undef
+CONFIG_SYS_CCSRBAR_PHYS_HIGH #undef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR
+#define CONFIG_SYS_CCSRBAR		CONFIG_SYS_CCSRBAR_DEFAULT
+#endif

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_CCSRBAR_DEFAULT
+#endif
+
+#define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH * 1ull)

<< 32 | \

Quoted 23 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +23 -0
+				 CONFIG_SYS_CCSRBAR_PHYS_LOW)
+
+struct sys_info {
+	unsigned long freq_processor[CONFIG_MAX_CPUS];
+	unsigned long freq_systembus;
+	unsigned long freq_ddrbus;
+	unsigned long freq_localbus;
+	unsigned long freq_sdhc;
+#ifdef CONFIG_SYS_DPAA_FMAN
+	unsigned long freq_fman[CONFIG_SYS_NUM_FMAN]; #endif
+	unsigned long freq_qman;
+};
+
+#define CONFIG_SYS_FSL_FM1_OFFSET		0xa00000
+#define CONFIG_SYS_FSL_FM1_RX0_1G_OFFSET	0xa88000
+#define CONFIG_SYS_FSL_FM1_RX1_1G_OFFSET	0xa89000
+#define CONFIG_SYS_FSL_FM1_RX2_1G_OFFSET	0xa8a000
+#define CONFIG_SYS_FSL_FM1_RX3_1G_OFFSET	0xa8b000
+#define CONFIG_SYS_FSL_FM1_RX4_1G_OFFSET	0xa8c000
+#define CONFIG_SYS_FSL_FM1_RX5_1G_OFFSET	0xa8d000
+
+#define CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET	0xae0000
+#define CONFIG_SYS_FSL_FM1_ADDR			\
Quoted 9 lines

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 5 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +5 -0
+		(CONFIG_SYS_IMMR + CONFIG_SYS_FSL_FM1_OFFSET)
+#define CONFIG_SYS_FSL_FM1_DTSEC1_ADDR		\
+		(CONFIG_SYS_IMMR + CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET)
+
+/* Device Configuration and Pin Control */ struct ccsr_gur {

i will suggest to compare ccsr, scfg, etc registers between chassis2 & chassis3. Try to factor out the common code.

There seem to be lots of differences between them at the first sight,

but we still can review the code in the future.

Quoted 406 lines
Quoted 23 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +23 -0
+	u32     porsr1;         /* POR status 1 */
+#define FSL_CHASSIS2_CCSR_PORSR1_RCW_MASK	0xFF800000
+	u32     porsr2;         /* POR status 2 */
+	u8      res_008[0x20-0x8];
+	u32     gpporcr1;       /* General-purpose POR configuration */
+	u32	gpporcr2;
+#define FSL_CHASSIS2_DCFG_FUSESR_VID_SHIFT	25
+#define FSL_CHASSIS2_DCFG_FUSESR_VID_MASK	0x1F
+#define FSL_CHASSIS2_DCFG_FUSESR_ALTVID_SHIFT	20
+#define FSL_CHASSIS2_DCFG_FUSESR_ALTVID_MASK	0x1F
+	u32     dcfg_fusesr;    /* Fuse status register */
+	u8      res_02c[0x70-0x2c];
+	u32     devdisr;        /* Device disable control */
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_1	0x80000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_2	0x40000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_3	0x20000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_4	0x10000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_5	0x08000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_6	0x04000000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_9	0x00800000
+#define FSL_CHASSIS2_DEVDISR2_DTSEC1_10	0x00400000
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_1	0x00800000
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_2	0x00400000

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_3	0x80000000
+#define FSL_CHASSIS2_DEVDISR2_10GEC1_4	0x40000000
+	u32     devdisr2;       /* Device disable control 2 */
+	u32     devdisr3;       /* Device disable control 3 */
+	u32     devdisr4;       /* Device disable control 4 */
+	u32     devdisr5;       /* Device disable control 5 */
+	u32     devdisr6;       /* Device disable control 6 */
+	u32     devdisr7;       /* Device disable control 7 */
+	u8      res_08c[0x94-0x8c];
+	u32     coredisru;      /* uppper portion for support of 64 cores

*/

Quoted 93 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +93 -0
+	u32     coredisrl;      /* lower portion for support of 64 cores */
+	u8      res_09c[0xa0-0x9c];
+	u32     pvr;            /* Processor version */
+	u32     svr;            /* System version */
+	u32     mvr;            /* Manufacturing version */
+	u8	res_0ac[0xb0-0xac];
+	u32	rstcr;		/* Reset control */
+	u32	rstrqpblsr;	/* Reset request preboot loader status */
+	u8	res_0b8[0xc0-0xb8];
+	u32	rstrqmr1;	/* Reset request mask */
+	u8	res_0c4[0xc8-0xc4];
+	u32	rstrqsr1;	/* Reset request status */
+	u8	res_0cc[0xd4-0xcc];
+	u32	rstrqwdtmrl;	/* Reset request WDT mask */
+	u8	res_0d8[0xdc-0xd8];
+	u32	rstrqwdtsrl;	/* Reset request WDT status */
+	u8	res_0e0[0xe4-0xe0];
+	u32	brrl;		/* Boot release */
+	u8      res_0e8[0x100-0xe8];
+	u32     rcwsr[16];      /* Reset control word status */
+#define FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_SHIFT	25
+#define FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_MASK	0x1f
+#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_SHIFT	16
+#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK	0x3f
+#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK	0xffff0000
+#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT	16
+	u8      res_140[0x200-0x140];
+	u32     scratchrw[4];  /* Scratch Read/Write */
+	u8      res_210[0x300-0x210];
+	u32     scratchw1r[4];  /* Scratch Read (Write once) */
+	u8      res_310[0x400-0x310];
+	u32	crstsr[12];
+	u8	res_430[0x500-0x430];
+
+	/* PCI Express n Logical I/O Device Number register */
+	u32 dcfg_ccsr_pex1liodnr;
+	u32 dcfg_ccsr_pex2liodnr;
+	u32 dcfg_ccsr_pex3liodnr;
+	u32 dcfg_ccsr_pex4liodnr;
+	/* RIO n Logical I/O Device Number register */
+	u32 dcfg_ccsr_rio1liodnr;
+	u32 dcfg_ccsr_rio2liodnr;
+	u32 dcfg_ccsr_rio3liodnr;
+	u32 dcfg_ccsr_rio4liodnr;
+	/* USB Logical I/O Device Number register */
+	u32 dcfg_ccsr_usb1liodnr;
+	u32 dcfg_ccsr_usb2liodnr;
+	u32 dcfg_ccsr_usb3liodnr;
+	u32 dcfg_ccsr_usb4liodnr;
+	/* SD/MMC Logical I/O Device Number register */
+	u32 dcfg_ccsr_sdmmc1liodnr;
+	u32 dcfg_ccsr_sdmmc2liodnr;
+	u32 dcfg_ccsr_sdmmc3liodnr;
+	u32 dcfg_ccsr_sdmmc4liodnr;
+	/* RIO Message Unit Logical I/O Device Number register */
+	u32 dcfg_ccsr_riomaintliodnr;
+
+	u8      res_544[0x550-0x544];
+	u32	sataliodnr[4];
+	u8	res_560[0x570-0x560];
+
+	u32 dcfg_ccsr_misc1liodnr;
+	u32 dcfg_ccsr_misc2liodnr;
+	u32 dcfg_ccsr_misc3liodnr;
+	u32 dcfg_ccsr_misc4liodnr;
+	u32 dcfg_ccsr_dma1liodnr;
+	u32 dcfg_ccsr_dma2liodnr;
+	u32 dcfg_ccsr_dma3liodnr;
+	u32 dcfg_ccsr_dma4liodnr;
+	u32 dcfg_ccsr_spare1liodnr;
+	u32 dcfg_ccsr_spare2liodnr;
+	u32 dcfg_ccsr_spare3liodnr;
+	u32 dcfg_ccsr_spare4liodnr;
+	u8	res_5a0[0x600-0x5a0];
+	u32 dcfg_ccsr_pblsr;
+
+	u32	pamubypenr;
+	u32	dmacr1;
+
+	u8	res_60c[0x610-0x60c];
+	u32 dcfg_ccsr_gensr1;
+	u32 dcfg_ccsr_gensr2;
+	u32 dcfg_ccsr_gensr3;
+	u32 dcfg_ccsr_gensr4;
+	u32 dcfg_ccsr_gencr1;
+	u32 dcfg_ccsr_gencr2;
+	u32 dcfg_ccsr_gencr3;
+	u32 dcfg_ccsr_gencr4;
+	u32 dcfg_ccsr_gencr5;
+	u32 dcfg_ccsr_gencr6;
+	u32 dcfg_ccsr_gencr7;
+	u8	res_63c[0x658-0x63c];
+	u32 dcfg_ccsr_cgensr1;

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+	u32 dcfg_ccsr_cgensr0;
+	u8	res_660[0x678-0x660];
+	u32 dcfg_ccsr_cgencr1;
+
+	u32 dcfg_ccsr_cgencr0;
+	u8	res_680[0x700-0x680];
+	u32 dcfg_ccsr_sriopstecr;
+	u32 dcfg_ccsr_dcsrcr;
+
+	u8      res_708[0x740-0x708];   /* add more registers when needed

*/

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h

Quoted 6 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +6 -0
+	u32     tp_ityp[64];    /* Topology Initiator Type Register */
+	struct {
+		u32     upper;
+		u32     lower;
+	} tp_cluster[16];
+	u8      res_8c0[0xa00-0x8c0];   /* add more registers when needed

*/

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 300

Quoted 2 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +2 -0
+	u32 dcfg_ccsr_qmbm_warmrst;
+	u8      res_a04[0xa20-0xa04];   /* add more registers when needed

*/

Quoted 228 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +228 -0
+	u32 dcfg_ccsr_reserved0;
+	u32 dcfg_ccsr_reserved1;
+};
+
+#define SCFG_QSPI_CLKSEL		0x40100000
+#define SCFG_USBDRVVBUS_SELCR_USB1	0x00000000
+#define SCFG_USBDRVVBUS_SELCR_USB2	0x00000001
+#define SCFG_USBDRVVBUS_SELCR_USB3	0x00000002
+#define SCFG_USBPWRFAULT_INACTIVE	0x00000000
+#define SCFG_USBPWRFAULT_SHARED		0x00000001
+#define SCFG_USBPWRFAULT_DEDICATED	0x00000002
+#define SCFG_USBPWRFAULT_USB3_SHIFT	4
+#define SCFG_USBPWRFAULT_USB2_SHIFT	2
+#define SCFG_USBPWRFAULT_USB1_SHIFT	0
+
+#define SCFG_SNPCNFGCR_SECRDSNP		0x80000000
+#define SCFG_SNPCNFGCR_SECWRSNP		0x40000000
+
+/* Supplemental Configuration Unit */ struct ccsr_scfg {
+	u8 res_000[0x100-0x000];
+	u32 usb2_icid;
+	u32 usb3_icid;
+	u8 res_108[0x114-0x108];
+	u32 dma_icid;
+	u32 sata_icid;
+	u32 usb1_icid;
+	u32 qe_icid;
+	u32 sdhc_icid;
+	u32 edma_icid;
+	u32 etr_icid;
+	u32 core_sft_rst[4];
+	u8 res_140[0x158-0x140];
+	u32 altcbar;
+	u32 qspi_cfg;
+	u8 res_160[0x180-0x160];
+	u32 dmamcr;
+	u8 res_184[0x18c-0x184];
+	u32 debug_icid;
+	u8 res_190[0x1a4-0x190];
+	u32 snpcnfgcr;
+	u8 res_1a8[0x1ac-0x1a8];
+	u32 intpcr;
+	u8 res_1b0[0x204-0x1b0];
+	u32 coresrencr;
+	u8 res_208[0x220-0x208];
+	u32 rvbar0_0;
+	u32 rvbar0_1;
+	u32 rvbar1_0;
+	u32 rvbar1_1;
+	u32 rvbar2_0;
+	u32 rvbar2_1;
+	u32 rvbar3_0;
+	u32 rvbar3_1;
+	u32 lpmcsr;
+	u8 res_244[0x400-0x244];
+	u32 qspidqscr;
+	u32 ecgtxcmcr;
+	u32 sdhciovselcr;
+	u32 rcwpmuxcr0;
+	u32 usbdrvvbus_selcr;
+	u32 usbpwrfault_selcr;
+	u32 usb_refclk_selcr1;
+	u32 usb_refclk_selcr2;
+	u32 usb_refclk_selcr3;
+	u8 res_424[0x600-0x424];
+	u32 scratchrw[4];
+	u8 res_610[0x680-0x610];
+	u32 corebcr;
+	u8 res_684[0x1000-0x684];
+	u32 pex1msiir;
+	u32 pex1msir;
+	u8 res_1008[0x2000-0x1008];
+	u32 pex2;
+	u32 pex2msir;
+	u8 res_2008[0x3000-0x2008];
+	u32 pex3msiir;
+	u32 pex3msir;
+};
+
+/* Clocking */
+struct ccsr_clk {
+	struct {
+		u32 clkcncsr;	/* core cluster n clock control status */
+		u8  res_004[0x0c];
+		u32 clkcghwacsr; /* Clock generator n hardware accelerator */
+		u8  res_014[0x0c];
+	} clkcsr[4];
+	u8	res_040[0x780]; /* 0x100 */
+	struct {
+		u32 pllcngsr;
+		u8 res_804[0x1c];
+	} pllcgsr[2];
+	u8	res_840[0x1c0];
+	u32	clkpcsr;	/* 0xa00 Platform clock domain control/status */
+	u8	res_a04[0x1fc];
+	u32	pllpgsr;	/* 0xc00 Platform PLL General Status */
+	u8	res_c04[0x1c];
+	u32	plldgsr;	/* 0xc20 DDR PLL General Status */
+	u8	res_c24[0x3dc];
+};
+
+/* System Counter */
+struct sctr_regs {
+	u32 cntcr;
+	u32 cntsr;
+	u32 cntcv1;
+	u32 cntcv2;
+	u32 resv1[4];
+	u32 cntfid0;
+	u32 cntfid1;
+	u32 resv2[1002];
+	u32 counterid[12];
+};
+
+#define SRDS_MAX_LANES		4
+struct ccsr_serdes {
+	struct {
+		u32	rstctl;	/* Reset Control Register */
+#define SRDS_RSTCTL_RST		0x80000000
+#define SRDS_RSTCTL_RSTDONE	0x40000000
+#define SRDS_RSTCTL_RSTERR	0x20000000
+#define SRDS_RSTCTL_SWRST	0x10000000
+#define SRDS_RSTCTL_SDEN	0x00000020
+#define SRDS_RSTCTL_SDRST_B	0x00000040
+#define SRDS_RSTCTL_PLLRST_B	0x00000080
+		u32	pllcr0; /* PLL Control Register 0 */
+#define SRDS_PLLCR0_POFF		0x80000000
+#define SRDS_PLLCR0_RFCK_SEL_MASK	0x70000000
+#define SRDS_PLLCR0_RFCK_SEL_100	0x00000000
+#define SRDS_PLLCR0_RFCK_SEL_125	0x10000000
+#define SRDS_PLLCR0_RFCK_SEL_156_25	0x20000000
+#define SRDS_PLLCR0_RFCK_SEL_150	0x30000000
+#define SRDS_PLLCR0_RFCK_SEL_161_13	0x40000000
+#define SRDS_PLLCR0_RFCK_SEL_122_88	0x50000000
+#define SRDS_PLLCR0_PLL_LCK		0x00800000
+#define SRDS_PLLCR0_FRATE_SEL_MASK	0x000f0000
+#define SRDS_PLLCR0_FRATE_SEL_5		0x00000000
+#define SRDS_PLLCR0_FRATE_SEL_3_75	0x00050000
+#define SRDS_PLLCR0_FRATE_SEL_5_15	0x00060000
+#define SRDS_PLLCR0_FRATE_SEL_4		0x00070000
+#define SRDS_PLLCR0_FRATE_SEL_3_12	0x00090000
+#define SRDS_PLLCR0_FRATE_SEL_3		0x000a0000
+		u32	pllcr1; /* PLL Control Register 1 */
+#define SRDS_PLLCR1_PLL_BWSEL	0x08000000
+		u32	res_0c;	/* 0x00c */
+		u32	pllcr3;
+		u32	pllcr4;
+		u8	res_18[0x20-0x18];
+	} bank[2];
+	u8	res_40[0x90-0x40];
+	u32	srdstcalcr;	/* 0x90 TX Calibration Control */
+	u8	res_94[0xa0-0x94];
+	u32	srdsrcalcr;	/* 0xa0 RX Calibration Control */
+	u8	res_a4[0xb0-0xa4];
+	u32	srdsgr0;	/* 0xb0 General Register 0 */
+	u8	res_b4[0xe0-0xb4];
+	u32	srdspccr0;	/* 0xe0 Protocol Converter Config 0 */
+	u32	srdspccr1;	/* 0xe4 Protocol Converter Config 1 */
+	u32	srdspccr2;	/* 0xe8 Protocol Converter Config 2 */
+	u32	srdspccr3;	/* 0xec Protocol Converter Config 3 */
+	u32	srdspccr4;	/* 0xf0 Protocol Converter Config 4 */
+	u8	res_f4[0x100-0xf4];
+	struct {
+		u32	lnpssr;	/* 0x100, 0x120, ..., 0x1e0 */
+		u8	res_104[0x120-0x104];
+	} srdslnpssr[4];
+	u8	res_180[0x300-0x180];
+	u32	srdspexeqcr;
+	u32	srdspexeqpcr[11];
+	u8	res_330[0x400-0x330];
+	u32	srdspexapcr;
+	u8	res_404[0x440-0x404];
+	u32	srdspexbpcr;
+	u8	res_444[0x800-0x444];
+	struct {
+		u32	gcr0;	/* 0x800 General Control Register 0 */
+		u32	gcr1;	/* 0x804 General Control Register 1 */
+		u32	gcr2;	/* 0x808 General Control Register 2 */
+		u32	sscr0;
+		u32	recr0;	/* 0x810 Receive Equalization Control */
+		u32	recr1;
+		u32	tecr0;	/* 0x818 Transmit Equalization Control */
+		u32	sscr1;
+		u32	ttlcr0;	/* 0x820 Transition Tracking Loop Ctrl 0 */
+		u8	res_824[0x83c-0x824];
+		u32	tcsr3;
+	} lane[4];	/* Lane A, B, C, D, E, F, G, H */
+	u8	res_a00[0x1000-0xa00];	/* from 0xa00 to 0xfff */
+};
+
+#define CCI400_CTRLORD_TERM_BARRIER	0x00000008
+#define CCI400_CTRLORD_EN_BARRIER	0
+#define CCI400_SHAORD_NON_SHAREABLE	0x00000002
+#define CCI400_DVM_MESSAGE_REQ_EN	0x00000002
+#define CCI400_SNOOP_REQ_EN		0x00000001
+
+/* CCI-400 registers */
+struct ccsr_cci400 {
+	u32 ctrl_ord;			/* Control Override */
+	u32 spec_ctrl;			/* Speculation Control */
+	u32 secure_access;		/* Secure Access */
+	u32 status;			/* Status */
+	u32 impr_err;			/* Imprecise Error */
+	u8 res_14[0x100 - 0x14];
+	u32 pmcr;			/* Performance Monitor Control */
+	u8 res_104[0xfd0 - 0x104];
+	u32 pid[8];			/* Peripheral ID */
+	u32 cid[4];			/* Component ID */
+	struct {
+		u32 snoop_ctrl;		/* Snoop Control */
+		u32 sha_ord;		/* Shareable Override */
+		u8 res_1008[0x1100 - 0x1008];
+		u32 rc_qos_ord;		/* read channel QoS Value Override */
+		u32 wc_qos_ord;		/* read channel QoS Value Override */
+		u8 res_1108[0x110c - 0x1108];
+		u32 qos_ctrl;		/* QoS Control */
+		u32 max_ot;		/* Max OT */
+		u8 res_1114[0x1130 - 0x1114];
+		u32 target_lat;		/* Target Latency */
+		u32 latency_regu;	/* Latency Regulation */
+		u32 qos_range;		/* QoS Range */
+		u8 res_113c[0x2000 - 0x113c];
+	} slave[5];			/* Slave Interface */
+	u8 res_6000[0x9004 - 0x6000];
+	u32 cycle_counter;		/* Cycle counter */
+	u32 count_ctrl;			/* Count Control */
+	u32 overflow_status;		/* Overflow Flag Status */
+	u8 res_9010[0xa000 - 0x9010];

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h line 539

Quoted 10 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +10 -0
+	struct {
+		u32 event_select;	/* Event Select */
+		u32 event_count;	/* Event Count */
+		u32 counter_ctrl;	/* Counter Control */
+		u32 overflow_status;	/* Overflow Flag Status */
+		u8 res_a010[0xb000 - 0xa010];
+	} pcounter[4];			/* Performance Counter */
+	u8 res_e004[0x10000 - 0xe004];
+};
+

LS1088A has CCI-400. This piece of code and define should be outside of chassis file

Quoted 16 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h new file +16 -0
+/* MMU 500 */
+#define SMMU_SCR0			(SMMU_BASE + 0x0)
+#define SMMU_SCR1			(SMMU_BASE + 0x4)
+#define SMMU_SCR2			(SMMU_BASE + 0x8)
+#define SMMU_SACR			(SMMU_BASE + 0x10)
+#define SMMU_IDR0			(SMMU_BASE + 0x20)
+#define SMMU_IDR1			(SMMU_BASE + 0x24)
+
+#define SMMU_NSCR0			(SMMU_BASE + 0x400)
+#define SMMU_NSCR2			(SMMU_BASE + 0x408)
+#define SMMU_NSACR			(SMMU_BASE + 0x410)
+
+#define SCR0_CLIENTPD_MASK		0x00000001
+#define SCR0_USFCFG_MASK		0x00000400
+
+#endif	/* __ARCH_FSL_LSCH2_IMMAP_H__*/
Quoted 10 lines

arch/arm/include/asm/arch-fsl-layerscape/ns_access.h

Quoted 6 lines
arch/arm/include/asm/arch-fsl-layerscape/ns_access.h new file +0 -0
new file mode 100644
index 0000000..a3ccdb0

not sure, will LS1088A also use below code?

This is enabled by CONFIG_LAYERSCAPE_NS_ACCESS.

It won't include it if there is no need.

Quoted 154 lines
Quoted 154 lines
arch/arm/include/asm/arch-fsl-layerscape/ns_access.h new file +153 -0
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __FSL_NS_ACCESS_H_
+#define __FSL_NS_ACCESS_H_
+
+enum csu_cslx_ind {
+	CSU_CSLX_PCIE2_IO = 0,
+	CSU_CSLX_PCIE1_IO,
+	CSU_CSLX_MG2TPR_IP,
+	CSU_CSLX_IFC_MEM,
+	CSU_CSLX_OCRAM,
+	CSU_CSLX_GIC,
+	CSU_CSLX_PCIE1,
+	CSU_CSLX_OCRAM2,
+	CSU_CSLX_QSPI_MEM,
+	CSU_CSLX_PCIE2,
+	CSU_CSLX_SATA,
+	CSU_CSLX_USB1,
+	CSU_CSLX_QM_BM_SWPORTAL,
+	CSU_CSLX_PCIE3 = 16,
+	CSU_CSLX_PCIE3_IO,
+	CSU_CSLX_USB3 = 20,
+	CSU_CSLX_USB2,
+	CSU_CSLX_SERDES = 32,
+	CSU_CSLX_QDMA,
+	CSU_CSLX_LPUART2,
+	CSU_CSLX_LPUART1,
+	CSU_CSLX_LPUART4,
+	CSU_CSLX_LPUART3,
+	CSU_CSLX_LPUART6,
+	CSU_CSLX_LPUART5,
+	CSU_CSLX_DSPI1 = 41,
+	CSU_CSLX_QSPI,
+	CSU_CSLX_ESDHC,
+	CSU_CSLX_IFC = 45,
+	CSU_CSLX_I2C1,
+	CSU_CSLX_I2C3 = 48,
+	CSU_CSLX_I2C2,
+	CSU_CSLX_DUART2 = 50,
+	CSU_CSLX_DUART1,
+	CSU_CSLX_WDT2,
+	CSU_CSLX_WDT1,
+	CSU_CSLX_EDMA,
+	CSU_CSLX_SYS_CNT,
+	CSU_CSLX_DMA_MUX2,
+	CSU_CSLX_DMA_MUX1,
+	CSU_CSLX_DDR,
+	CSU_CSLX_QUICC,
+	CSU_CSLX_DCFG_CCU_RCPM = 60,
+	CSU_CSLX_SECURE_BOOTROM,
+	CSU_CSLX_SFP,
+	CSU_CSLX_TMU,
+	CSU_CSLX_SECURE_MONITOR,
+	CSU_CSLX_SCFG,
+	CSU_CSLX_FM = 66,
+	CSU_CSLX_SEC5_5,
+	CSU_CSLX_BM,
+	CSU_CSLX_QM,
+	CSU_CSLX_GPIO2 = 70,
+	CSU_CSLX_GPIO1,
+	CSU_CSLX_GPIO4,
+	CSU_CSLX_GPIO3,
+	CSU_CSLX_PLATFORM_CONT,
+	CSU_CSLX_CSU,
+	CSU_CSLX_IIC4 = 77,
+	CSU_CSLX_WDT4,
+	CSU_CSLX_WDT3,
+	CSU_CSLX_WDT5 = 81,
+	CSU_CSLX_FTM2 = 86,
+	CSU_CSLX_FTM1,
+	CSU_CSLX_FTM4,
+	CSU_CSLX_FTM3,
+	CSU_CSLX_FTM6 = 90,
+	CSU_CSLX_FTM5,
+	CSU_CSLX_FTM8,
+	CSU_CSLX_FTM7,
+	CSU_CSLX_DSCR = 121,
+};
+
+static struct csu_ns_dev ns_dev[] = {
+	 {CSU_CSLX_PCIE2_IO, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE1_IO, CSU_ALL_RW},
+	 {CSU_CSLX_MG2TPR_IP, CSU_ALL_RW},
+	 {CSU_CSLX_IFC_MEM, CSU_ALL_RW},
+	 {CSU_CSLX_OCRAM, CSU_ALL_RW},
+	 {CSU_CSLX_GIC, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE1, CSU_ALL_RW},
+	 {CSU_CSLX_OCRAM2, CSU_ALL_RW},
+	 {CSU_CSLX_QSPI_MEM, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE2, CSU_ALL_RW},
+	 {CSU_CSLX_SATA, CSU_ALL_RW},
+	 {CSU_CSLX_USB1, CSU_ALL_RW},
+	 {CSU_CSLX_QM_BM_SWPORTAL, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE3, CSU_ALL_RW},
+	 {CSU_CSLX_PCIE3_IO, CSU_ALL_RW},
+	 {CSU_CSLX_USB3, CSU_ALL_RW},
+	 {CSU_CSLX_USB2, CSU_ALL_RW},
+	 {CSU_CSLX_SERDES, CSU_ALL_RW},
+	 {CSU_CSLX_QDMA, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART2, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART1, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART4, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART3, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART6, CSU_ALL_RW},
+	 {CSU_CSLX_LPUART5, CSU_ALL_RW},
+	 {CSU_CSLX_DSPI1, CSU_ALL_RW},
+	 {CSU_CSLX_QSPI, CSU_ALL_RW},
+	 {CSU_CSLX_ESDHC, CSU_ALL_RW},
+	 {CSU_CSLX_IFC, CSU_ALL_RW},
+	 {CSU_CSLX_I2C1, CSU_ALL_RW},
+	 {CSU_CSLX_I2C3, CSU_ALL_RW},
+	 {CSU_CSLX_I2C2, CSU_ALL_RW},
+	 {CSU_CSLX_DUART2, CSU_ALL_RW},
+	 {CSU_CSLX_DUART1, CSU_ALL_RW},
+	 {CSU_CSLX_WDT2, CSU_ALL_RW},
+	 {CSU_CSLX_WDT1, CSU_ALL_RW},
+	 {CSU_CSLX_EDMA, CSU_ALL_RW},
+	 {CSU_CSLX_SYS_CNT, CSU_ALL_RW},
+	 {CSU_CSLX_DMA_MUX2, CSU_ALL_RW},
+	 {CSU_CSLX_DMA_MUX1, CSU_ALL_RW},
+	 {CSU_CSLX_DDR, CSU_ALL_RW},
+	 {CSU_CSLX_QUICC, CSU_ALL_RW},
+	 {CSU_CSLX_DCFG_CCU_RCPM, CSU_ALL_RW},
+	 {CSU_CSLX_SECURE_BOOTROM, CSU_ALL_RW},
+	 {CSU_CSLX_SFP, CSU_ALL_RW},
+	 {CSU_CSLX_TMU, CSU_ALL_RW},
+	 {CSU_CSLX_SECURE_MONITOR, CSU_ALL_RW},
+	 {CSU_CSLX_SCFG, CSU_ALL_RW},
+	 {CSU_CSLX_FM, CSU_ALL_RW},
+	 {CSU_CSLX_SEC5_5, CSU_ALL_RW},
+	 {CSU_CSLX_BM, CSU_ALL_RW},
+	 {CSU_CSLX_QM, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO2, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO1, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO4, CSU_ALL_RW},
+	 {CSU_CSLX_GPIO3, CSU_ALL_RW},
+	 {CSU_CSLX_PLATFORM_CONT, CSU_ALL_RW},
+	 {CSU_CSLX_CSU, CSU_ALL_RW},
+	 {CSU_CSLX_IIC4, CSU_ALL_RW},
+	 {CSU_CSLX_WDT4, CSU_ALL_RW},
+	 {CSU_CSLX_WDT3, CSU_ALL_RW},
+	 {CSU_CSLX_WDT5, CSU_ALL_RW},
+	 {CSU_CSLX_FTM2, CSU_ALL_RW},
+	 {CSU_CSLX_FTM1, CSU_ALL_RW},
+	 {CSU_CSLX_FTM4, CSU_ALL_RW},
+	 {CSU_CSLX_FTM3, CSU_ALL_RW},
+	 {CSU_CSLX_FTM6, CSU_ALL_RW},
+	 {CSU_CSLX_FTM5, CSU_ALL_RW},
+	 {CSU_CSLX_FTM8, CSU_ALL_RW},
Quoted 10 lines

arch/arm/include/asm/arch-fsl-layerscape/ns_access.h line 158

Quoted 5 lines
arch/arm/include/asm/arch-fsl-layerscape/ns_access.h new file +5 -0
+	 {CSU_CSLX_FTM7, CSU_ALL_RW},
+	 {CSU_CSLX_DSCR, CSU_ALL_RW},
+};
+
+#endif

--prabhakar

Regards,
Qianyu

#22 lore raw

PATCH v5 13/17 armv8/ls1043ardb: Add LS1043ARDB board support

In reply to Gong Qianyu

From: Mingkai Hu <[email protected]>

LS1043ARDB Specification:
-------------------------
Memory subsystem:
* 2GByte DDR4 SDRAM (32bit bus)
* 128 Mbyte NOR flash single-chip memory
* 512 Mbyte NAND flash
* 16 Mbyte high-speed SPI flash
* 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

---
V5:
- No change.
V4:
- Change arch to layerscape.
- Add PCIe support.
- Move SMMU_BASE, GICC_BASE, GICD_BASE to ls1043a_common.h.
V3:
- Fix message typos.
- Add ddr model number in comments.
- Fix boot options in README.
- Remove some dead code.
V2:
- Replaced ns_access.h with fsl_csu.h.

 arch/arm/Kconfig                                   |   7 +
 arch/arm/cpu/armv8/fsl-layerscape/Makefile         |   4 +
 arch/arm/cpu/armv8/fsl-layerscape/ls1043a_serdes.c |  86 ++++++++++
 board/freescale/ls1043ardb/Kconfig                 |  16 ++
 board/freescale/ls1043ardb/MAINTAINERS             |   7 +
 board/freescale/ls1043ardb/Makefile                |   9 +
 board/freescale/ls1043ardb/README                  |  85 +++++++++
 board/freescale/ls1043ardb/cpld.c                  | 115 +++++++++++++
 board/freescale/ls1043ardb/cpld.h                  |  43 +++++
 board/freescale/ls1043ardb/ddr.c                   | 191 +++++++++++++++++++++
 board/freescale/ls1043ardb/ddr.h                   |  45 +++++
 board/freescale/ls1043ardb/ls1043ardb.c            | 131 ++++++++++++++
 configs/ls1043ardb_defconfig                       |   4 +
 include/configs/ls1043a_common.h                   | 181 +++++++++++++++++++
 include/configs/ls1043ardb.h                       | 191 +++++++++++++++++++++
 15 files changed, 1115 insertions(+)
arch/arm/Kconfig +7 -0
index 7981355..bd99bfb 100644
@@ -631,6 +631,12 @@ config TARGET_LS1021ATWR
 	select CPU_V7
 	select SUPPORT_SPL
 
+config TARGET_LS1043ARDB
+	bool "Support ls1043ardb"
+	select ARM64
+	help
+	  Support for Freescale LS1043ARDB platform.
+
 config TARGET_H2200
 	bool "Support h2200"
 	select CPU_PXA
@@ -745,6 +751,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"
arch/arm/cpu/armv8/fsl-layerscape/Makefile +4 -0
index 4754e59..6fa08c8 100644
@@ -23,4 +23,8 @@ endif
 
 ifneq ($(CONFIG_LS2085A),)
 obj-$(CONFIG_SYS_HAS_SERDES) += ls2085a_serdes.o
+else
+ifneq ($(CONFIG_LS1043A),)
+obj-$(CONFIG_SYS_HAS_SERDES) += ls1043a_serdes.o
+endif
 endif
arch/arm/cpu/armv8/fsl-layerscape/ls1043a_serdes.c new file +86 -0

86 lines not on this page · raw message

board/freescale/ls1043ardb/Kconfig new file +16 -0
new file mode 100644
index 0000000..51818ec
@@ -0,0 +1,16 @@
+
+if TARGET_LS1043ARDB
+
+config SYS_BOARD
+	default "ls1043ardb"
+
+config SYS_VENDOR
+	default "freescale"
+
+config SYS_SOC
+	default "fsl-layerscape"
+
+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 +85 -0

85 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 +191 -0

191 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 +131 -0

131 lines not on this page · raw message

configs/ls1043ardb_defconfig new file +4 -0
new file mode 100644
index 0000000..ae84d2e
@@ -0,0 +1,4 @@
+CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4"
+CONFIG_ARM=y
+CONFIG_TARGET_LS1043ARDB=y
+CONFIG_FSL_LAYERSCAPE=y
include/configs/ls1043a_common.h new file +181 -0

181 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
#23 lore raw

PATCH v5 14/17 armv8/ls1043ardb: Add nand boot support

In reply to Gong Qianyu

---
V5:
- No change.
V4:
- Add enable_layerscape_ns_access() in fsl-layerscape/spl.c
V3:
- No change.
V2:
- Removed unecessary NAND_PAGE_SIZE in ls1043a_common.h.
- Fixed "select SUPPORT_SPL" in arch/arm/Kconfig.
- Used CONFIG_FSL_IFC instead of SPL_NAND_SUPPORT for init_early_memctl_regs()
- Replaced ns_access.h with fsl_csu.h.

 arch/arm/Kconfig                                   |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/spl.c            |  3 ++
 board/freescale/ls1043ardb/README                  |  1 +
 board/freescale/ls1043ardb/cpld.c                  | 19 +++++++++
 board/freescale/ls1043ardb/cpld.h                  |  1 +
 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                   | 27 +++++++++++++
 include/configs/ls1043ardb.h                       | 46 ++++++++++++++++++++++
 10 files changed, 123 insertions(+)
arch/arm/Kconfig +1 -0
index bd99bfb..6584e85 100644
@@ -634,6 +634,7 @@ config TARGET_LS1021ATWR
 config TARGET_LS1043ARDB
 	bool "Support ls1043ardb"
 	select ARM64
+	select SUPPORT_SPL
 	help
 	  Support for Freescale LS1043ARDB platform.
 
arch/arm/cpu/armv8/fsl-layerscape/spl.c +3 -0
index 2f30d4b..ba551aa 100644
@@ -71,6 +71,9 @@ void board_init_f(ulong dummy)
 	/* 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);
 }
 #endif
board/freescale/ls1043ardb/README +1 -0
index d5925a9..4f15557 100644
@@ -83,3 +83,4 @@ Start Address	End Address	Description		Size
 Booting Options
 ---------------
 a) NOR boot
+b) NAND boot
board/freescale/ls1043ardb/cpld.c +19 -0
index 3f1101e..f29383d 100644
@@ -45,6 +45,22 @@ 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 +107,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 +127,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
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 +27 -0
index 89721a2..beedcb3 100644
@@ -69,6 +69,33 @@
 #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_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 +46 -0

86 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324
#24 lore raw

PATCH v5 15/17 armv8/ls1043a: Add Fman support

In reply to Gong Qianyu

From: Shaohui Xie <[email protected]>

---
V5:
- No change.
V4:
- Change arch to layerscape.
V3:
- No change.
V2:
- No change.

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c            |  12 +++
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c            |   6 ++
 .../arm/cpu/armv8/fsl-layerscape/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 +
 doc/README.fsl-dpaa                                |   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 +++++
 13 files changed, 295 insertions(+), 5 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +12 -0
index 5a2d40f..d8c01a8 100644
@@ -274,6 +274,9 @@ static inline void final_mmu_setup(void)
 	flush_dcache_range(gd->arch.tlb_addr,
 			   gd->arch.tlb_addr + gd->arch.tlb_size);
 
+#ifdef CONFIG_SYS_DPAA_FMAN
+	flush_dcache_all();
+#endif
 	/* point TTBR to the new table */
 	el = current_el();
 
@@ -432,6 +435,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
 #ifdef CONFIG_FSL_LSCH3
 	printf("     DP-DDR:   %-4s MT/s", strmhz(buf, sysinfo.freq_ddrbus2));
 #endif
@@ -468,6 +474,9 @@ int cpu_eth_init(bd_t *bis)
 #ifdef CONFIG_FSL_MC_ENET
 	error = fsl_mc_ldpaa_init(bis);
 #endif
+#ifdef CONFIG_FMAN_ENET
+	fm_standard_init(bis);
+#endif
 	return error;
 }
 
@@ -485,6 +494,9 @@ 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-layerscape/fdt.c +6 -0
index aa88d34..9c841c2 100644
@@ -18,6 +18,12 @@
 #include <asm/arch/mp.h>
 #endif
 
+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));
+}
+
 #ifdef CONFIG_MP
 void ft_fixup_cpu(void *blob)
 {
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c +23 -0
index ea3723f..9d5bbe7 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..26cf517 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_LAYERSCAPE
+#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 5b7f814..6c0dd3f 100644
@@ -13,6 +13,7 @@
 #include <hwconfig.h>
 #include <ahci.h>
 #include <scsi.h>
+#include <fm_eth.h>
 #include <fsl_csu.h>
 #include <fsl_esdhc.h>
 #include <fsl_ifc.h>
@@ -108,6 +109,9 @@ int ft_board_setup(void *blob, bd_t *bd)
 {
 	ft_cpu_setup(blob, bd);
 
+#ifdef CONFIG_SYS_DPAA_FMAN
+	fdt_fixup_fman_ethernet(blob);
+#endif
 	return 0;
 }
 
doc/README.fsl-dpaa +2 -2
index 0d8d4f6..3ef5eeb 100644
@@ -2,9 +2,9 @@ This file documents Freescale DPAA-specific options.
 
 FMan (Frame Manager)
   - CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
-	on SoCs earlier(e.g. T4240, T2080), the notation between 10GEC and MAC as below:
+	on SoCs T4240, T2080, LS1043A, etc, the notation between 10GEC and MAC as below:
 		10GEC1->MAC9, 10GEC2->MAC10, 10GEC3->MAC1, 10GEC4->MAC2
-	on SoCs later(e.g. T1024, etc), the notation between 10GEC and MAC as below:
+	on SoCs T1024, etc, the notation between 10GEC and MAC as below:
 		10GEC1->MAC1, 10GEC2->MAC2
 	so we introduce CONFIG_FSL_FM_10GEC_REGULAR_NOTATION to identify the new SoCs on
 	which 10GEC enumeration is consistent with MAC enumeration.
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..3a1de59 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_LAYERSCAPE
+#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 beedcb3..146eed1 100644
@@ -162,6 +162,18 @@
 #define CONFIG_CMD_ENV
 #define CONFIG_CMD_PING
 
+/* 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 8ac752e..c776640 100644
@@ -234,4 +234,29 @@
 #define CONFIG_ENV_SIZE			0x20000
 #endif
 
+/* FMan */
+#ifdef CONFIG_SYS_DPAA_FMAN
+#define CONFIG_FMAN_ENET
+#define CONFIG_CMD_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
#25 lore raw

PATCH v5 16/17 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.

---
V5:
- No change.
V4:
- Use CONFIG_FSL_ESDHC to enable get_sdhc_freq().
- Merge lsch2 and lsch3 into layerscape.
V3:
- No change.
V2:
- No change.

 .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 22 +++++++++++++++++++++-
 board/freescale/ls1043ardb/ls1043ardb.c            |  1 +
 drivers/mmc/fsl_esdhc.c                            | 12 ++++++------
 include/configs/ls1043a_common.h                   | 11 +++++++++++
 include/fsl_esdhc.h                                |  2 +-
 5 files changed, 40 insertions(+), 8 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c +21 -1
index 9d5bbe7..6f6a588 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
+#ifdef 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 = ifc_in32(&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;
 
+#ifdef CONFIG_FSL_ESDHC
+	gd->arch.sdhc_clk = sys_info.freq_sdhc;
+#endif
+
 	if (gd->cpu_clk != 0)
 		return 0;
 	else
@@ -139,6 +148,13 @@ ulong get_ddr_freq(ulong dummy)
 	return gd->mem_clk;
 }
 
+#ifdef CONFIG_FSL_ESDHC
+int get_sdhc_freq(ulong dummy)
+{
+	return gd->arch.sdhc_clk;
+}
+#endif
+
 int get_serial_clock(void)
 {
 	return gd->bus_clk;
@@ -149,6 +165,10 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
 	switch (clk) {
 	case MXC_I2C_CLK:
 		return get_bus_freq(0);
+#if defined(CONFIG_FSL_ESDHC)
+	case MXC_ESDHC_CLK:
+		return get_sdhc_freq(0);
+#endif
 	case MXC_DSPI_CLK:
 		return get_bus_freq(0);
 	case MXC_UART_CLK:
board/freescale/ls1043ardb/ls1043ardb.c +1 -0
index 6c0dd3f..461a195 100644
@@ -12,6 +12,7 @@
 #include <asm/arch/soc.h>
 #include <hwconfig.h>
 #include <ahci.h>
+#include <mmc.h>
 #include <scsi.h>
 #include <fm_eth.h>
 #include <fsl_csu.h>
drivers/mmc/fsl_esdhc.c +6 -6
index 0b37002..471d6ee 100644
@@ -106,7 +106,7 @@ 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_FSL_LAYERSCAPE)
 	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
 		xfertyp |= XFERTYP_CMDTYP_ABORT;
 #endif
@@ -184,7 +184,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
+#ifdef CONFIG_FSL_LAYERSCAPE
 	dma_addr_t addr;
 #endif
 	uint wml_value;
@@ -197,7 +197,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
+#ifdef CONFIG_FSL_LAYERSCAPE
 		addr = virt_to_phys((void *)(data->dest));
 		if (upper_32_bits(addr))
 			printf("Error found for upper 32 bits\n");
@@ -223,7 +223,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
+#ifdef CONFIG_FSL_LAYERSCAPE
 		addr = virt_to_phys((void *)(data->src));
 		if (upper_32_bits(addr))
 			printf("Error found for upper 32 bits\n");
@@ -277,7 +277,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
+#ifdef CONFIG_FSL_LAYERSCAPE
 	unsigned start = 0;
 #else
 	unsigned start = (unsigned)data->dest ;
@@ -285,7 +285,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
+#ifdef CONFIG_FSL_LAYERSCAPE
 	dma_addr_t addr;
 
 	addr = virt_to_phys((void *)(data->dest));
include/configs/ls1043a_common.h +11 -0
index 146eed1..bdd852d 100644
@@ -162,6 +162,17 @@
 #define CONFIG_CMD_ENV
 #define CONFIG_CMD_PING
 
+/*  MMC  */
+#define CONFIG_MMC
+#ifdef CONFIG_MMC
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_FAT
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
+#define CONFIG_GENERIC_MMC
+#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..aa1b4cf 100644
@@ -166,7 +166,7 @@
 #define ESDHC_VENDORSPEC_VSELECT 0x00000002 /* Use 1.8V */
 
 struct fsl_esdhc_cfg {
-#ifdef CONFIG_LS2085A
+#ifdef CONFIG_FSL_LAYERSCAPE
 	u64	esdhc_base;
 #else
 	u32	esdhc_base;
Signature · 1 line
2.1.0.27.g96db324
#26 lore raw

PATCH v5 17/17 armv8/ls1043ardb: Add sd boot support

In reply to Gong Qianyu

---
V5:
- No change.
V4:
- No change.
V3:
- Squash the add cpld command patch to it.
V2:
- No change.

 board/freescale/ls1043ardb/README                |  1 +
 board/freescale/ls1043ardb/cpld.c                | 18 ++++++++++++++
 board/freescale/ls1043ardb/cpld.h                |  1 +
 board/freescale/ls1043ardb/ls1043ardb.c          |  6 +++++
 board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg |  7 ++++++
 configs/ls1043ardb_sdcard_defconfig              |  4 ++++
 include/configs/ls1043a_common.h                 | 30 ++++++++++++++++++++++++
 include/configs/ls1043ardb.h                     | 11 ++++++++-
 8 files changed, 77 insertions(+), 1 deletion(-)
board/freescale/ls1043ardb/README +1 -0
index 4f15557..0556e73 100644
@@ -84,3 +84,4 @@ Booting Options
 ---------------
 a) NOR boot
 b) NAND boot
+c) SD boot
board/freescale/ls1043ardb/cpld.c +18 -0
index f29383d..78c2824 100644
@@ -61,6 +61,21 @@ 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)
 {
@@ -109,6 +124,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
@@ -128,6 +145,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
board/freescale/ls1043ardb/ls1043ardb.c +6 -0
index b0bdebb..8b6181f 100644
@@ -25,12 +25,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 +48,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 bdd852d..7c78403 100644
@@ -69,6 +69,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 +10 -1
index c776640..307d947 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
  */
@@ -227,6 +231,11 @@
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_SIZE			0x2000
 #define CONFIG_ENV_OFFSET		(10 * CONFIG_SYS_NAND_BLOCK_SIZE)
+#elif 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
 #else
 #define CONFIG_ENV_IS_IN_FLASH
 #define CONFIG_ENV_ADDR			(CONFIG_SYS_FLASH_BASE + 0x200000)
Signature · 1 line
2.1.0.27.g96db324