aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-keystone2
diff options
context:
space:
mode:
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-02-03 02:23:37 +0200
committerIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-02-10 15:37:29 +0200
commit4b2ef32bf3fa7e41de9d63a28c49eced4ba141e2 (patch)
treee0ce07f9ee0112486bf49ae49933667fbfa83c1b /platform/linux-keystone2
parentfddbaf8a25abccb2a3beb63192fac3926603815c (diff)
linux-ks2: mcsdk: add abilitiy to access cpsw registers
At least it's needed to get real MAC address at init. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Diffstat (limited to 'platform/linux-keystone2')
-rw-r--r--platform/linux-keystone2/Makefile.am1
-rw-r--r--platform/linux-keystone2/include/odp/plat/ti_mcsdk.h1
-rw-r--r--platform/linux-keystone2/mcsdk/mcsdk_cpsw.c27
-rw-r--r--platform/linux-keystone2/mcsdk/mcsdk_init.c7
4 files changed, 36 insertions, 0 deletions
diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-keystone2/Makefile.am
index bd52f2d7..5ba62f37 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -161,6 +161,7 @@ __LIB__libodp_la_SOURCES = \
mcsdk/cppi_flow.c \
mcsdk/mcsdk_init.c \
mcsdk/mcsdk_navig.c \
+ mcsdk/mcsdk_cpsw.c \
mcsdk/mcsdk_rmclient.c \
mcsdk/pa_lut_entry.c \
mcsdk/sockutils.c \
diff --git a/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h b/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
index d0bc5afd..e3cada8e 100644
--- a/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
+++ b/platform/linux-keystone2/include/odp/plat/ti_mcsdk.h
@@ -42,6 +42,7 @@ int mcsdk_global_init(void);
int mcsdk_global_term(void);
int mcsdk_local_init(int thread_id);
int mcsdk_cppi_init(void);
+int mcsdk_cpsw_init(void);
int mcsdk_qmss_init(int max_descriptors);
int mcsdk_qmss_start(void);
int mcsdk_qmss_exit(void);
diff --git a/platform/linux-keystone2/mcsdk/mcsdk_cpsw.c b/platform/linux-keystone2/mcsdk/mcsdk_cpsw.c
new file mode 100644
index 00000000..bf1d5463
--- /dev/null
+++ b/platform/linux-keystone2/mcsdk/mcsdk_cpsw.c
@@ -0,0 +1,27 @@
+#include <ti/csl/soc.h>
+#include <ti/csl/csl.h>
+#include <ti/csl/cslr_cpsw.h>
+#include <odp/plat/ti_mcsdk.h>
+
+#define hCpsw5gfRegs_phys (CSL_NETCP_CFG_REGS + 0x00090800)
+
+/*
+ * Holds the base address of ports.
+ */
+void *cpswPortBaseAddr[4];
+
+int mcsdk_cpsw_init(void)
+{
+ CSL_Cpsw_5gfRegs *hCpsw5gfRegs;
+
+ hCpsw5gfRegs =
+ (CSL_Cpsw_5gfRegs *)(void *)((uint8_t *)odp_vm_info.passCfgVaddr +
+ (hCpsw5gfRegs_phys - CSL_NETCP_CFG_REGS));
+
+ cpswPortBaseAddr[0] = &hCpsw5gfRegs->PORT1_INFO;
+ cpswPortBaseAddr[1] = &hCpsw5gfRegs->PORT2_INFO;
+ cpswPortBaseAddr[2] = &hCpsw5gfRegs->PORT3_INFO;
+ cpswPortBaseAddr[3] = &hCpsw5gfRegs->PORT4_INFO;
+
+ return 1;
+}
diff --git a/platform/linux-keystone2/mcsdk/mcsdk_init.c b/platform/linux-keystone2/mcsdk/mcsdk_init.c
index f356643a..2cc328e1 100644
--- a/platform/linux-keystone2/mcsdk/mcsdk_init.c
+++ b/platform/linux-keystone2/mcsdk/mcsdk_init.c
@@ -669,6 +669,13 @@ int mcsdk_global_init(void)
odp_pr_err("PA LUT init failed\n");
return -1;
}
+
+ result = mcsdk_cpsw_init();
+ if (result != 1) {
+ odp_pr_err("CPSW init failed\n");
+ return -1;
+ }
+
odp_pr_dbg("returned from netapip_startNwal\n");
return 0;
}