summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2015-07-25 09:53:23 +0200
committerMarek Vasut <marex@denx.de>2015-08-08 14:14:07 +0200
commit575d74151651a3299a2f3ed1980bb24765bbfec9 (patch)
tree12cb4d2e04c467f75cd3f95de6723e28c3571df4 /board
parent03a92b215f0b63e89cbdeab2fcb8badce9f9d2ba (diff)
arm: socfpga: scan: Zap iocsr_scan_chain*_table()
Introduce accessor iocsr_get_config_table() for retrieving IOCSR config tables. This patch is again trimming down the namespace polution. The IOCSR config tables are used only by scan manager, they are generated by qts and are board specific. Before this patch, the approach to use these tables in scan manager was to define an extern variable to silence the compiler and compile board-specific iocsr_config.c into U-Boot which defined those extern variables. Furthermore, since these are tables and the scan manager needs to know the size of those tables, iocsr_config.h is included build-wide. This patch wraps all this into a single accessor which takes the scan chain ID and returns pointer to the table and it's size. All this is wrapped in wrap_iocsr_config.c board-specific file. The file includes the iocsr_config.c (!) to access the original tables and transitively iocsr_config.h . It is thus no longer necessary to include iocsr_config.h build-wide and the namespace polution is trimmed some more. Signed-off-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'board')
-rw-r--r--board/altera/socfpga/Makefile2
-rw-r--r--board/altera/socfpga/qts/Makefile2
-rw-r--r--board/altera/socfpga/wrap_iocsr_config.c41
3 files changed, 43 insertions, 2 deletions
diff --git a/board/altera/socfpga/Makefile b/board/altera/socfpga/Makefile
index f5412270589..7cd4ef9b509 100644
--- a/board/altera/socfpga/Makefile
+++ b/board/altera/socfpga/Makefile
@@ -7,4 +7,4 @@
#
obj-y := socfpga.o wrap_pll_config.o
-obj-$(CONFIG_SPL_BUILD) += qts/
+obj-$(CONFIG_SPL_BUILD) += qts/ wrap_iocsr_config.o
diff --git a/board/altera/socfpga/qts/Makefile b/board/altera/socfpga/qts/Makefile
index dbcedd8c465..cd8fecc0404 100644
--- a/board/altera/socfpga/qts/Makefile
+++ b/board/altera/socfpga/qts/Makefile
@@ -4,4 +4,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += pinmux_config.o iocsr_config.o
+obj-y += pinmux_config.o
diff --git a/board/altera/socfpga/wrap_iocsr_config.c b/board/altera/socfpga/wrap_iocsr_config.c
new file mode 100644
index 00000000000..49e922823f3
--- /dev/null
+++ b/board/altera/socfpga/wrap_iocsr_config.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Marek Vasut <marex@denx.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <asm/arch/clock_manager.h>
+/*
+ * Yes, dear reader, we're including a C file here, this is no mistake :-)
+ */
+#include "qts/iocsr_config.c"
+
+int iocsr_get_config_table(const unsigned int chain_id,
+ const unsigned long **table,
+ unsigned int *table_len)
+{
+ switch (chain_id) {
+ case 0:
+ *table = iocsr_scan_chain0_table;
+ *table_len = CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH;
+ break;
+ case 1:
+ *table = iocsr_scan_chain1_table;
+ *table_len = CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH;
+ break;
+ case 2:
+ *table = iocsr_scan_chain2_table;
+ *table_len = CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH;
+ break;
+ case 3:
+ *table = iocsr_scan_chain3_table;
+ *table_len = CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}