summaryrefslogtreecommitdiff
path: root/arch/arm/mach-socfpga/wrap_pinmux_config.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2015-08-02 19:12:09 (GMT)
committerMarek Vasut <marex@denx.de>2015-08-23 09:56:19 (GMT)
commitca62d2e1fca4e89b1e15e6bdc634f6ef39a7360d (patch)
tree881c4dc1ee4b28fe1c36cb202d7f197fff7c6f0a /arch/arm/mach-socfpga/wrap_pinmux_config.c
parentc2624240dd9321b0fd86dba5ecf75d7a73974796 (diff)
downloadu-boot-ca62d2e1fca4e89b1e15e6bdc634f6ef39a7360d.tar.xz
arm: socfpga: Move wrappers into platform directory
Move the wrappers for QTS-generated files into platform directory out of the board directory. The trick here is to add -I to CFLAGS such that it points to the board directory in source tree and thus the qts/ directory there is still reachable. Signed-off-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'arch/arm/mach-socfpga/wrap_pinmux_config.c')
-rw-r--r--arch/arm/mach-socfpga/wrap_pinmux_config.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/mach-socfpga/wrap_pinmux_config.c b/arch/arm/mach-socfpga/wrap_pinmux_config.c
new file mode 100644
index 0000000..688f1e4
--- /dev/null
+++ b/arch/arm/mach-socfpga/wrap_pinmux_config.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 Marek Vasut <marex@denx.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <errno.h>
+/*
+ * Yes, dear reader, we're including a C file here, this is no mistake.
+ * But this time around, we do even more perverse hacking here to be
+ * compatible with QTS headers and obtain reasonably nice results too.
+ *
+ * First, we define _PRELOADER_PINMUX_CONFIG_H_, which will neutralise
+ * the pinmux_config.h inclusion in pinmux_config.c . Since we are
+ * probing everything from DT, we do NOT want those macros from the
+ * pinmux_config.h to ooze into our build system, anywhere, ever. So
+ * we nip it at the bud.
+ *
+ * Next, pinmux_config.c needs CONFIG_HPS_PINMUX_NUM and uses it to
+ * specify sized array explicitly. Instead, we want to use ARRAY_SIZE
+ * to figure out the size of the array, so define this macro as an
+ * empty one, so that the preprocessor optimizes things such that the
+ * arrays are not sized by default.
+ */
+#define _PRELOADER_PINMUX_CONFIG_H_
+#define CONFIG_HPS_PINMUX_NUM
+#include <qts/pinmux_config.c>
+
+void sysmgr_get_pinmux_table(const unsigned long **table,
+ unsigned int *table_len)
+{
+ *table = sys_mgr_init_table;
+ *table_len = ARRAY_SIZE(sys_mgr_init_table);
+}