Skip to contentSkip to conversation

arm: ls1021x: Add support for initializing CAAM's stream id

PATCH Superseded Alison Wang 3 participants 3 messages Jan 9, 2015 – Jan 16, 2015 Arm (32-bit)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: ls1021x: Add support for initializing CAAM's stream id

There 4 JRs, 4 RTICs and 8 DECOs, and set them the same stream id for using the same SMMU3 on LS1021A.

---
 arch/arm/include/asm/arch-ls102xa/config.h         |  1 +
 arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h  | 37 ++++++++++++++
 .../include/asm/arch-ls102xa/ls102xa_stream_id.h   | 57 ++++++++++++++++++++++
 board/freescale/common/ls102xa_stream_id.c         | 15 ++++++
 board/freescale/ls1021aqds/ls1021aqds.c            | 21 ++++++++
 board/freescale/ls1021atwr/ls1021atwr.c            | 21 ++++++++
 6 files changed, 152 insertions(+)
arch/arm/include/asm/arch-ls102xa/config.h +1 -0
index 5e934da..f200bc8 100644
@@ -36,6 +36,7 @@
 #define CONFIG_SYS_LS102XA_USB1_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_LS102XA_USB1_OFFSET)
 
+#define CONFIG_SYS_FSL_SEC_OFFSET		0x00700000
 #define CONFIG_SYS_LS102XA_USB1_OFFSET		0x07600000
 #define CONFIG_SYS_TSEC1_OFFSET			0x01d10000
 #define CONFIG_SYS_TSEC2_OFFSET			0x01d50000
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +37 -0
index 697d4ca..a73ef2e 100644
@@ -37,6 +37,43 @@
 
 #define DCFG_DCSR_PORCR1		0
 
+/*
+ * Define default values for some CCSR macros to make header files cleaner*
+ *
+ * To completely disable CCSR relocation in a board header file, define
+ * CONFIG_SYS_CCSR_DO_NOT_RELOCATE.  This will force CONFIG_SYS_CCSRBAR_PHYS
+ * to a value that is the same as CONFIG_SYS_CCSRBAR.
+ */
+
+#ifdef CONFIG_SYS_CCSRBAR_PHYS
+#error "Do not define CONFIG_SYS_CCSRBAR_PHYS directly."
+#endif
+
+#ifdef CONFIG_SYS_CCSR_DO_NOT_RELOCATE
+#undef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#undef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR
+#define CONFIG_SYS_CCSRBAR		CONFIG_SYS_IMMR
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#ifdef CONFIG_PHYS_64BIT
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0xf
+#else
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_IMMR
+#endif
+
+#define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH * 1ull) << 32 | \
+				 CONFIG_SYS_CCSRBAR_PHYS_LOW)
+
 struct sys_info {
 	unsigned long freq_processor[CONFIG_MAX_CPUS];
 	unsigned long freq_systembus;
arch/arm/include/asm/arch-ls102xa/ls102xa_stream_id.h +57 -0

68 lines not on this page · raw message

board/freescale/common/ls102xa_stream_id.c +15 -0
index 6154c9c..f434269 100644
@@ -16,3 +16,18 @@ void ls102xa_config_smmu_stream_id(struct smmu_stream_id *id, uint32_t num)
 	for (i = 0; i < num; i++)
 		out_be32(scfg + id[i].offset, id[i].stream_id);
 }
+
+void ls1021x_config_caam_stream_id(struct liodn_id_table *tbl, int size)
+{
+	int i;
+	u32 liodn;
+
+	for (i = 0; i < size; i++) {
+		if (tbl[i].num_ids == 2)
+			liodn = (tbl[i].id[0] << 16) | tbl[i].id[1];
+		else
+			liodn = tbl[i].id[0];
+
+		out_le32((uint32_t *)(tbl[i].reg_offset), liodn);
+	}
+}
board/freescale/ls1021aqds/ls1021aqds.c +21 -0
index f08e54f..a578ba7 100644
@@ -450,6 +450,25 @@ static struct csu_ns_dev ns_dev[] = {
 };
 #endif
 
+struct liodn_id_table sec_liodn_tbl[] = {
+	SET_SEC_JR_LIODN_ENTRY(0, 0x10, 0x10),
+	SET_SEC_JR_LIODN_ENTRY(1, 0x10, 0x10),
+	SET_SEC_JR_LIODN_ENTRY(2, 0x10, 0x10),
+	SET_SEC_JR_LIODN_ENTRY(3, 0x10, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(a, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(b, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(c, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(d, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(0, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(1, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(2, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(3, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(4, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(5, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(6, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(7, 0x10, 0x10),
+};
+
 struct smmu_stream_id dev_stream_id[] = {
 	{ 0x100, 0x01, "ETSEC MAC1" },
 	{ 0x104, 0x02, "ETSEC MAC2" },
@@ -489,6 +508,8 @@ int board_init(void)
 	config_serdes_mux();
 #endif
 
+	ls1021x_config_caam_stream_id(sec_liodn_tbl,
+				      ARRAY_SIZE(sec_liodn_tbl));
 	ls102xa_config_smmu_stream_id(dev_stream_id,
 				      ARRAY_SIZE(dev_stream_id));
 
board/freescale/ls1021atwr/ls1021atwr.c +21 -0
index 8ab229d..8b73172 100644
@@ -389,6 +389,25 @@ static struct csu_ns_dev ns_dev[] = {
 };
 #endif
 
+struct liodn_id_table sec_liodn_tbl[] = {
+	SET_SEC_JR_LIODN_ENTRY(0, 0x10, 0x10),
+	SET_SEC_JR_LIODN_ENTRY(1, 0x10, 0x10),
+	SET_SEC_JR_LIODN_ENTRY(2, 0x10, 0x10),
+	SET_SEC_JR_LIODN_ENTRY(3, 0x10, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(a, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(b, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(c, 0x10),
+	SET_SEC_RTIC_LIODN_ENTRY(d, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(0, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(1, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(2, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(3, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(4, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(5, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(6, 0x10, 0x10),
+	SET_SEC_DECO_LIODN_ENTRY(7, 0x10, 0x10),
+};
+
 struct smmu_stream_id dev_stream_id[] = {
 	{ 0x100, 0x01, "ETSEC MAC1" },
 	{ 0x104, 0x02, "ETSEC MAC2" },
@@ -425,6 +444,8 @@ int board_init(void)
 #endif
 #endif
 
+	ls1021x_config_caam_stream_id(sec_liodn_tbl,
+				      ARRAY_SIZE(sec_liodn_tbl));
 	ls102xa_config_smmu_stream_id(dev_stream_id,
 				      ARRAY_SIZE(dev_stream_id));
 
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH 1/1 arm: ls1021x: Add support for initializing CAAM's stream id

Quoted 31 lines · Alison Wang

There 4 JRs, 4 RTICs and 8 DECOs, and set them the same stream id for using the same SMMU3 on LS1021A.

---
 arch/arm/include/asm/arch-ls102xa/config.h         |  1 +
 arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h  | 37 ++++++++++++++
 .../include/asm/arch-ls102xa/ls102xa_stream_id.h   | 57 ++++++++++++++++++++++
 board/freescale/common/ls102xa_stream_id.c         | 15 ++++++
 board/freescale/ls1021aqds/ls1021aqds.c            | 21 ++++++++
 board/freescale/ls1021atwr/ls1021atwr.c            | 21 ++++++++
 6 files changed, 152 insertions(+)
arch/arm/include/asm/arch-ls102xa/config.h +1 -0
index 5e934da..f200bc8 100644
@@ -36,6 +36,7 @@
 #define CONFIG_SYS_LS102XA_USB1_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_LS102XA_USB1_OFFSET)
 
+#define CONFIG_SYS_FSL_SEC_OFFSET		0x00700000
 #define CONFIG_SYS_LS102XA_USB1_OFFSET		0x07600000
 #define CONFIG_SYS_TSEC1_OFFSET			0x01d10000
 #define CONFIG_SYS_TSEC2_OFFSET			0x01d50000
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +0 -0
index 697d4ca..a73ef2e 100644

arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h line 41

Quoted 5 lines
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +2 -0
@@ -37,6 +37,43 @@
 
 #define DCFG_DCSR_PORCR1		0
 
+/*
+ * Define default values for some CCSR macros to make header files cleaner*

You have a trailing * here

Quoted 25 lines
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +25 -0
+ *
+ * To completely disable CCSR relocation in a board header file, define
+ * CONFIG_SYS_CCSR_DO_NOT_RELOCATE.  This will force CONFIG_SYS_CCSRBAR_PHYS
+ * to a value that is the same as CONFIG_SYS_CCSRBAR.
+ */
+
+#ifdef CONFIG_SYS_CCSRBAR_PHYS
+#error "Do not define CONFIG_SYS_CCSRBAR_PHYS directly."
+#endif
+
+#ifdef CONFIG_SYS_CCSR_DO_NOT_RELOCATE
+#undef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#undef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR
+#define CONFIG_SYS_CCSRBAR		CONFIG_SYS_IMMR
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#ifdef CONFIG_PHYS_64BIT
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0xf
+#else
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0

arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h line 76

Quoted 10 lines
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +10 -0
+#endif
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_IMMR
+#endif
+
+#define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH * 1ull) << 32 | \
+				 CONFIG_SYS_CCSRBAR_PHYS_LOW)
+

Changing CCSR macros should be in a separated patch.

York

#2 lore raw

PATCH 1/1 arm: ls1021x: Add support for initializing CAAM's stream id

York,

Quoted 37 lines · Alison Wang
Quoted 8 lines

There 4 JRs, 4 RTICs and 8 DECOs, and set them the same stream id for using the same SMMU3 on LS1021A.

---
 arch/arm/include/asm/arch-ls102xa/config.h         |  1 +
 arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h  | 37

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

Quoted 1 line
 .../include/asm/arch-ls102xa/ls102xa_stream_id.h   | 57

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

Quoted 25 lines
 board/freescale/common/ls102xa_stream_id.c         | 15 ++++++
 board/freescale/ls1021aqds/ls1021aqds.c            | 21 ++++++++
 board/freescale/ls1021atwr/ls1021atwr.c            | 21 ++++++++
 6 files changed, 152 insertions(+)
arch/arm/include/asm/arch-ls102xa/config.h +1 -0
index 5e934da..f200bc8 100644
@@ -36,6 +36,7 @@
 #define CONFIG_SYS_LS102XA_USB1_ADDR \
 	(CONFIG_SYS_IMMR + CONFIG_SYS_LS102XA_USB1_OFFSET)
 
+#define CONFIG_SYS_FSL_SEC_OFFSET		0x00700000
 #define CONFIG_SYS_LS102XA_USB1_OFFSET		0x07600000
 #define CONFIG_SYS_TSEC1_OFFSET			0x01d10000
 #define CONFIG_SYS_TSEC2_OFFSET			0x01d50000
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +0 -0
index 697d4ca..a73ef2e 100644
@@ -37,6 +37,43 @@
 
Quoted 7 lines

arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h

Quoted 5 lines
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +3 -0
 #define DCFG_DCSR_PORCR1		0
 
+/*
+ * Define default values for some CCSR macros to make header files
+cleaner*

You have a trailing * here

[Alison Wang] I will remove it in v2.

Quoted 36 lines
Quoted 25 lines
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +24 -0
+ *
+ * To completely disable CCSR relocation in a board header file,
+ define
+ * CONFIG_SYS_CCSR_DO_NOT_RELOCATE.  This will force
+ CONFIG_SYS_CCSRBAR_PHYS
+ * to a value that is the same as CONFIG_SYS_CCSRBAR.
+ */
+
+#ifdef CONFIG_SYS_CCSRBAR_PHYS
+#error "Do not define CONFIG_SYS_CCSRBAR_PHYS directly."
+#endif
+
+#ifdef CONFIG_SYS_CCSR_DO_NOT_RELOCATE #undef
+CONFIG_SYS_CCSRBAR_PHYS_HIGH #undef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR
+#define CONFIG_SYS_CCSRBAR		CONFIG_SYS_IMMR
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_HIGH
+#ifdef CONFIG_PHYS_64BIT
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0xf

arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h

Quoted 10 lines
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +10 -0
+#else
+#define CONFIG_SYS_CCSRBAR_PHYS_HIGH	0
+#endif
+#endif
+
+#ifndef CONFIG_SYS_CCSRBAR_PHYS_LOW
+#define CONFIG_SYS_CCSRBAR_PHYS_LOW	CONFIG_SYS_IMMR
+#endif
+
+#define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH *

1ull) << 32 | \

Quoted 5 lines

arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h line 76

Quoted 2 lines
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +2 -0
+				 CONFIG_SYS_CCSRBAR_PHYS_LOW)
+

Changing CCSR macros should be in a separated patch.

[Alison Wang] Ok.

Thanks.

Best Regards,
Alison Wang