]> git.sur5r.net Git - u-boot/commitdiff
arm: ls1021x: Add support for initializing CAAM's stream id
authorAlison Wang <b18965@freescale.com>
Fri, 16 Jan 2015 09:21:34 +0000 (17:21 +0800)
committerYork Sun <yorksun@freescale.com>
Tue, 24 Feb 2015 21:11:05 +0000 (13:11 -0800)
There 4 JRs, 4 RTICs and 8 DECOs, and set them the same stream id
for using the same SMMU3 on LS1021A.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Alison Wang <alison.wang@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
arch/arm/include/asm/arch-ls102xa/config.h
arch/arm/include/asm/arch-ls102xa/ls102xa_stream_id.h
board/freescale/common/ls102xa_stream_id.c
board/freescale/ls1021aqds/ls1021aqds.c
board/freescale/ls1021atwr/ls1021atwr.c

index cfabdc605fec00e316d9e9a2eb6c139a3a564588..3b6a1696d849d74c7bac14bbc60517e9a4470c1f 100644 (file)
@@ -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
index abd70fc706999dfcb96ce0f9739d24c7938e03e4..fa571b3a388ec215850eb01e1c974a14eda52473 100644 (file)
@@ -7,11 +7,68 @@
 #ifndef __FSL_LS102XA_STREAM_ID_H_
 #define __FSL_LS102XA_STREAM_ID_H_
 
+#include <fsl_sec.h>
+
+#define SET_LIODN_ENTRY_1(name, idA, off, compatoff) \
+       { .compat = name, \
+         .id = { idA }, .num_ids = 1, \
+         .reg_offset = off + CONFIG_SYS_IMMR, \
+         .compat_offset = compatoff + CONFIG_SYS_CCSRBAR_PHYS, \
+       }
+
+#define SET_LIODN_ENTRY_2(name, idA, idB, off, compatoff) \
+       { .compat = name, \
+         .id = { idA, idB }, .num_ids = 2, \
+         .reg_offset = off + CONFIG_SYS_IMMR, \
+         .compat_offset = compatoff + CONFIG_SYS_CCSRBAR_PHYS, \
+       }
+
+/*
+ * handle both old and new versioned SEC properties:
+ * "fsl,secX.Y" became "fsl,sec-vX.Y" during development
+ */
+#define SET_SEC_JR_LIODN_ENTRY(jrnum, liodnA, liodnB) \
+       SET_LIODN_ENTRY_2("fsl,sec4.0-job-ring", liodnA, liodnB, \
+               offsetof(ccsr_sec_t, jrliodnr[jrnum].ls) + \
+               CONFIG_SYS_FSL_SEC_OFFSET, \
+               CONFIG_SYS_FSL_SEC_OFFSET + 0x1000 + 0x1000 * jrnum), \
+       SET_LIODN_ENTRY_2("fsl,sec-v4.0-job-ring", liodnA, liodnB,\
+               offsetof(ccsr_sec_t, jrliodnr[jrnum].ls) + \
+               CONFIG_SYS_FSL_SEC_OFFSET, \
+               CONFIG_SYS_FSL_SEC_OFFSET + 0x1000 + 0x1000 * jrnum)
+
+/* This is a bit evil since we treat rtic param as both a string & hex value */
+#define SET_SEC_RTIC_LIODN_ENTRY(rtic, liodnA) \
+       SET_LIODN_ENTRY_1("fsl,sec4.0-rtic-memory", \
+               liodnA, \
+               offsetof(ccsr_sec_t, rticliodnr[0x##rtic-0xa].ls) + \
+               CONFIG_SYS_FSL_SEC_OFFSET, \
+               CONFIG_SYS_FSL_SEC_OFFSET + 0x6100 + 0x20 * (0x##rtic-0xa)), \
+       SET_LIODN_ENTRY_1("fsl,sec-v4.0-rtic-memory", \
+               liodnA, \
+               offsetof(ccsr_sec_t, rticliodnr[0x##rtic-0xa].ls) + \
+               CONFIG_SYS_FSL_SEC_OFFSET, \
+               CONFIG_SYS_FSL_SEC_OFFSET + 0x6100 + 0x20 * (0x##rtic-0xa))
+
+#define SET_SEC_DECO_LIODN_ENTRY(num, liodnA, liodnB) \
+       SET_LIODN_ENTRY_2(NULL, liodnA, liodnB, \
+               offsetof(ccsr_sec_t, decoliodnr[num].ls) + \
+               CONFIG_SYS_FSL_SEC_OFFSET, 0)
+
+struct liodn_id_table {
+       const char *compat;
+       u32 id[2];
+       u8 num_ids;
+       phys_addr_t compat_offset;
+       unsigned long reg_offset;
+};
+
 struct smmu_stream_id {
        uint16_t offset;
        uint16_t stream_id;
        char dev_name[32];
 };
 
+void ls1021x_config_caam_stream_id(struct liodn_id_table *tbl, int size);
 void ls102xa_config_smmu_stream_id(struct smmu_stream_id *id, uint32_t num);
 #endif
index 6154c9c45886cb1e2cef93f31c539b7a6d4dfcfb..f43426991b74e0af4f4aba07ad78e59356885066 100644 (file)
@@ -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);
+       }
+}
index 20eade46514114ee6432f0bedf4e10af7c99b060..722b88f1e9f2bc22615dda54ff33d051c39e735d 100644 (file)
@@ -509,6 +509,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" },
@@ -541,6 +560,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));
 
index bc8b00686c7c79831f6cf1ceb6b27ec04458909c..fb8525fe59fcbd47dc6c84588356e86218328a84 100644 (file)
@@ -401,6 +401,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" },
@@ -427,6 +446,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));