Skip to contentSkip to conversation

add LS1043A platform support

PATCH New Gong Qianyu 3 participants 23 messages Oct 19, 2015 – Oct 22, 2015

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

v6 cover add LS1043A platform support

Hi All,

Here are the changes for version 6 patchset. Please kindly help to review the patchset.

- Added secondary core support
- Added ls2085a simulator/emulator into the arch-fsl-layerscape framework
- Moved some SoC related macors from board header file into config.h

- serdes_prtl enum is not merged between ls2085a platform and ls1043a platform due to the fact that they are using different DPAA implementation.

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

Thanks,
Qianyu

#1 lore raw

PATCH v6 1/18 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.

---
V6:
- No change.
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 v6 2/18 common/board_f.c: modify the macro to use get_clocks() more common

From: Gong Qianyu <[email protected]>

get_clocks() should not be limited by ESDHC.

---
V6:
- No change.
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 7f4260a..7b17ac9 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 v6 3/18 net/fm: Fix the endian issue to support both endianness platforms

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.

---
V6:
- No change.
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
#4 lore raw

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

From: Shaohui Xie <[email protected]>

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

---
V6:
- No change.
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
#5 lore raw

PATCH v6 5/18 net/fm: Add support for 64-bit platforms

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.

---
V6:
- No change.
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
#6 lore raw

PATCH v6 6/18 net/fm: Make the return value logic consistent with convention

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.

---
V6:
- No change.
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
#7 lore raw

PATCH v6 7/18 net: fm: bug fix when CONFIG_PHYLIB not defined

From: Shaohui Xie <[email protected]>

codes related to phylib operations should be wrapped by CONFIG_PHYLIB.

---
V6:
- Fix all codes related to phylib to be wrapped by CONFIG_PHYLIB.
V5:
- No change.
V4:
- No change.
V3:
- New patch.

 drivers/net/fm/eth.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/fm/eth.c +7 -1
index d7d064b..e262859 100644
@@ -95,6 +95,7 @@ static void dtsec_init_phy(struct eth_device *dev)
 		dtsec_configure_serdes(fm_eth);
 }
 
+#ifdef CONFIG_PHYLIB
 static int tgec_is_fibre(struct eth_device *dev)
 {
 	struct fm_eth *fm = dev->priv;
@@ -105,6 +106,7 @@ static int tgec_is_fibre(struct eth_device *dev)
 	return hwconfig_arg_cmp(phyopt, "xfi");
 }
 #endif
+#endif
 
 static u16 muram_readw(u16 *addr)
 {
@@ -483,8 +485,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)
@@ -658,13 +662,15 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
 static int init_phy(struct eth_device *dev)
 {
 	struct fm_eth *fm_eth = dev->priv;
+#ifdef CONFIG_PHYLIB
 	struct phy_device *phydev = NULL;
 	u32 supported;
+#endif
 
-#ifdef CONFIG_PHYLIB
 	if (fm_eth->type == FM_ETH_1G_E)
 		dtsec_init_phy(dev);
 
+#ifdef CONFIG_PHYLIB
 	if (fm_eth->bus) {
 		phydev = phy_connect(fm_eth->bus, fm_eth->phyaddr, dev,
 					fm_eth->enet_if);
Signature · 1 line
2.1.0.27.g96db324
#8 lore raw

PATCH v6 8/18 net: Move some header files to include/

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.

---
V6:
- No change.
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 e262859..bf16101 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
#9 lore raw

PATCH v6 9/18 net/fm: Add QSGMII PCS init

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.

---
V6:
- No change.
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 bf16101..1cb1f7a 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
#10 lore raw

PATCH v6 10/18 net/fm: fix MDIO controller base on FMAN2

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.

---
V6:
- No change.
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
#11 lore raw

PATCH v6 11/18 armv8/fsl_lsch3: Change arch to fsl-layerscape

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.

---
V6:
- Remove GIC SMMU TZPC macros from ls2085a_common.h to config.h.
- Modify fsl_lsch3_wake_secondary_cores() to fsl_layerscape_wake_seconday_cores()
- Fix lsch3->layerscape changes for ls2085a emu and simu.
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}         |   2 +-
 .../cpu/armv8/{fsl-lsch3 => fsl-layerscape}/cpu.c  | 248 ++++++---------------
 .../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   |  16 +-
 .../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  |  96 ++++++++
 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 +-
 board/freescale/ls2085a/Kconfig                    |   4 +-
 board/freescale/ls2085a/ls2085a.c                  |   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                   |  10 +-
 45 files changed, 713 insertions(+), 526 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 +1 -1
similarity index 99%
rename from arch/arm/cpu/armv8/fsl-lsch3/README
rename to arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
index 08da7e4..03e18f6 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/cpu.c renamed from arch/arm/cpu/armv8/fsl-lsch3/cpu.c +62 -186

440 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..41e1704 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
 
+#if defined(CONFIG_MP) && defined(CONFIG_ARMV8_MULTIENTRY)
 	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 -8
similarity index 92%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.c
rename to arch/arm/cpu/armv8/fsl-layerscape/mp.c
index da7853a..1b13d32 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,7 +22,7 @@ phys_addr_t determine_mp_bootpg(void)
 	return (phys_addr_t)&secondary_boot_code;
 }
 
-int fsl_lsch3_wake_seconday_cores(void)
+int fsl_layerscape_wake_seconday_cores(void)
 {
 	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
 	struct ccsr_reset __iomem *rst = (void *)(CONFIG_SYS_FSL_RST_ADDR);
@@ -48,9 +47,10 @@ 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");
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 +96 -0

96 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 +5 -5
similarity index 82%
rename from arch/arm/cpu/armv8/fsl-lsch3/mp.h
rename to arch/arm/include/asm/arch-fsl-layerscape/mp.h
index c985d6a..e46e076 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,10 @@ extern u64 __spin_table[];
 extern u64 __real_cntfrq;
 extern u64 *secondary_boot_code;
 extern size_t __secondary_boot_code_size;
-int fsl_lsch3_wake_seconday_cores(void);
+int fsl_layerscape_wake_seconday_cores(void);
 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
 
board/freescale/ls2085a/Kconfig +2 -2
index f51afc8..042f85b 100644
@@ -7,7 +7,7 @@ config SYS_VENDOR
 	default "freescale"
 
 config SYS_SOC
-	default "fsl-lsch3"
+	default "fsl-layerscape"
 
 config SYS_CONFIG_NAME
 	default "ls2085a_emu"
@@ -23,7 +23,7 @@ config SYS_VENDOR
 	default "freescale"
 
 config SYS_SOC
-	default "fsl-lsch3"
+	default "fsl-layerscape"
 
 config SYS_CONFIG_NAME
 	default "ls2085a_simu"
board/freescale/ls2085a/ls2085a.c +1 -1
index 73c4410..27481e2 100644
@@ -15,7 +15,7 @@
 #include <fsl_debug_server.h>
 #include <fsl-mc/fsl_mc.h>
 #include <environment.h>
-#include <asm/arch-fsl-lsch3/soc.h>
+#include <asm/arch/soc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
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 +8 -2
index 55b909c..9f02af0 100644
@@ -10,8 +10,10 @@
 #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
 
@@ -19,12 +21,15 @@
 #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 +67,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
Signature · 1 line
2.1.0.27.g96db324
#12 lore raw

PATCH v6 12/18 armv8/fsl_lsch2: Add fsl_lsch2 SoC

From: Mingkai Hu <[email protected]>

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

---
V6:
- Remove GIC SMMU macros back to config.h.
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  |  47 ++
 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, 1224 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 be7442d..fe9d982 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 +47 -0

53 lines not on this page · raw message

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 587ee39..d8d9af4 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
#13 lore raw

PATCH v6 13/18 armv8/ls1043ardb: Add LS1043ARDB board support

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

---
V6:
- Move GIC SMMU macros out of ls1043a_common.h.
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                   | 174 +++++++++++++++++++
 include/configs/ls1043ardb.h                       | 191 +++++++++++++++++++++
 15 files changed, 1108 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 +174 -0

174 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
#14 lore raw

PATCH v6 14/18 armv8/ls1043ardb: Add nand boot support

From: Gong Qianyu <[email protected]>

---
V6:
- No change.
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 a4577b0..222cb43 100644
@@ -62,6 +62,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
#15 lore raw

PATCH v6 15/18 armv8/ls1043a: Add Fman support

From: Shaohui Xie <[email protected]>

---
V6:
- No change.
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 fe9d982..0cb0afa 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;
 }
 
@@ -484,6 +493,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 222cb43..557b19c 100644
@@ -155,6 +155,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
#16 lore raw

PATCH v6 16/18 armv8/ls1043ardb: esdhc: Add esdhc support for ls1043ardb

From: Yangbo Lu <[email protected]>

This patch adds esdhc support for ls1043ardb.

---
V6:
- No change.
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 557b19c..f1fc685 100644
@@ -155,6 +155,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
#17 lore raw

PATCH v6 17/18 armv8/ls1043ardb: Add sd boot support

From: Gong Qianyu <[email protected]>

---
V6:
- No change.
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 461a195..9032ed3 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 f1fc685..5b61fcc 100644
@@ -62,6 +62,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
#18 lore raw

PATCH v6 18/18 armv8/ls1043a: Enable secondary cores

From: Hou Zhiqiang <[email protected]>

After the secondary cores enter U-Boot, use CONFIG_ARMV8_MULTIENTRY to make secondary cores to excute in spin loop.

---
V6:
- New patch.

 arch/arm/Kconfig                       |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/mp.c | 14 ++++++++++++++
 include/configs/ls1043a_common.h       |  3 +++
 3 files changed, 18 insertions(+)
arch/arm/Kconfig +1 -0
index 6584e85..6e30a5d 100644
@@ -634,6 +634,7 @@ config TARGET_LS1021ATWR
 config TARGET_LS1043ARDB
 	bool "Support ls1043ardb"
 	select ARM64
+	select ARMV8_MULTIENTRY
 	select SUPPORT_SPL
 	help
 	  Support for Freescale LS1043ARDB platform.
arch/arm/cpu/armv8/fsl-layerscape/mp.c +14 -0
index 1b13d32..0d600db 100644
@@ -25,7 +25,11 @@ phys_addr_t determine_mp_bootpg(void)
 int fsl_layerscape_wake_seconday_cores(void)
 {
 	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+#ifdef CONFIG_FSL_LSCH3
 	struct ccsr_reset __iomem *rst = (void *)(CONFIG_SYS_FSL_RST_ADDR);
+#elif defined(CONFIG_FSL_LSCH2)
+	struct ccsr_scfg __iomem *scfg = (void *)(CONFIG_SYS_FSL_SCFG_ADDR);
+#endif
 	u32 cores, cpu_up_mask = 1;
 	int i, timeout = 10;
 	u64 *table = get_spin_tbl_addr();
@@ -48,13 +52,23 @@ int fsl_layerscape_wake_seconday_cores(void)
 
 	printf("Waking secondary cores to start from %lx\n", gd->relocaddr);
 
+#ifdef CONFIG_FSL_LSCH3
 	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");
+#elif defined(CONFIG_FSL_LSCH2)
+	scfg_out32(&scfg->scratchrw[0], (u32)(gd->relocaddr >> 32));
+	scfg_out32(&scfg->scratchrw[1], (u32)gd->relocaddr);
+	asm volatile("dsb st" : : : "memory");
+	gur_out32(&gur->brrl, cores);
+	asm volatile("dsb st" : : : "memory");
 
+	/* Bootup online cores */
+	scfg_out32(&scfg->corebcr, cores);
+#endif
 	/* This is needed as a precautionary measure.
 	 * If some code before this has accidentally  released the secondary
 	 * cores then the pre-bootloader code will trap them in a "wfe" unless
include/configs/ls1043a_common.h +3 -0
index 5b61fcc..d245fc2 100644
@@ -13,6 +13,7 @@
 #define CONFIG_FSL_LAYERSCAPE
 #define CONFIG_FSL_LSCH2
 #define CONFIG_LS1043A
+#define CONFIG_MP
 #define CONFIG_FSL_CLK
 #define CONFIG_GICV2
 
@@ -46,6 +47,8 @@
 #define CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY	0
 #define CONFIG_SYS_SDRAM_BASE		CONFIG_SYS_DDR_SDRAM_BASE
 
+#define CPU_RELEASE_ADDR               secondary_boot_func
+
 /* Generic Timer Definitions */
 #define COUNTER_FREQUENCY		25000000	/* 25MHz */
 
Signature · 1 line
2.1.0.27.g96db324
#19 lore raw

PATCH v6 11/18 armv8/fsl_lsch3: Change arch to fsl-layerscape

In reply to Gong Qianyu
Quoted 13 lines

-----Original Message-----
From: Gong Qianyu [mailto:b52263 at rhuath.am.freescale.net]
Sent: 2015?10?19? 19:59
To: 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; Kushwaha Prabhakar-B32579; Wang Huan-B18965; Gong Qianyu-B52263
Subject: [Patch V6 11/18] armv8/fsl_lsch3: Change arch to fsl-layerscape

From: Mingkai Hu <[email protected]>

Quoted 8 lines

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.

Qianyu, you lost my Signed-off.

Thanks,
Zhqiang

#20 lore raw

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

In reply to Gong Qianyu
Quoted 43 lines · Gong Qianyu

From: Gong Qianyu <[email protected]>

get_clocks() should not be limited by ESDHC.

---
V6:
- No change.
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 +0 -0
index 613332e..1bb84b3 100644

common/board_f.c static init_fnc_t init_sequence_f[] = { · line 809

Quoted 5 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

Qianyu,

I feel it is more like a hardware requirement to have clocks calculated for the rest to operate. Maybe CONFIG_SYS_FSL_CLK is slightly better fit? Anyway please add it to README to document the usage.

York

#21 lore raw

PATCH v6 1/18 armv7/ls1021a: move ns_access to common file

In reply to Gong Qianyu
Quoted 29 lines · Gong Qianyu

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.

---
V6:
- No change.
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(-)

<snip>

board/freescale/common/Makefile obj-$(CONFIG_P4080DS) += p_corenet/ · line 74

Quoted 10 lines
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

Looks like you missed two #ifdef CONFIG_LS102XA_NS_ACCESS in board/freescale/ls1021atwr/ls1021atwr.c.

York

#22 lore raw

PATCH v6 1/18 armv7/ls1021a: move ns_access to common file

In reply to Gong Qianyu
Quoted 11 lines

-----Original Message-----
From: Gong Qianyu [mailto:b52263 at rhuath.am.freescale.net]
Sent: 2015?10?19? 19:59
To: 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; Kushwaha Prabhakar-B32579; Wang Huan-B18965; Gong Qianyu-B52263
Subject: [Patch V6 01/18] armv7/ls1021a: move ns_access to common file

Quoted 7 lines

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.

Qianyu, you lost my Signed-off.

Thanks,
Zhqiang