diff options
author | Marek Vasut | 2015-07-25 11:09:11 +0200 |
---|---|---|
committer | Marek Vasut | 2015-08-08 14:14:07 +0200 |
commit | 2d779b39b4e11c4db7a2796af76051e70a556c5f (patch) | |
tree | 3109aa74539f3a8303886bf876e919ef86eecd2f /board/altera | |
parent | 40687b4f468c357d3821454099020949a10d759e (diff) |
arm: socfpga: system: Clean up pinmux_config.c
Implement new accessor, sysmgr_get_pinmux_table(), used to obtain pinmux
table and it's size from the QTS-generated pinmux_config.c. The target
here is again to get rid of poluting global namespace by including the
pinmux_config.h into it.
Furthermore, the pinmux_config.h declares some CONFIG_HPS_* macros,
which are explicitly useless to us in U-Boot. Instead, U-Boot does
use DT to detect exactly these configuration options. This patch
makes sure that while this QTS-generated file can stay in the tree,
these obscure macros do not ooze into the namespace anymore.
Signed-off-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'board/altera')
-rw-r--r-- | board/altera/socfpga/Makefile | 2 | ||||
-rw-r--r-- | board/altera/socfpga/qts/Makefile | 7 | ||||
-rw-r--r-- | board/altera/socfpga/wrap_pinmux_config.c | 35 |
3 files changed, 36 insertions, 8 deletions
diff --git a/board/altera/socfpga/Makefile b/board/altera/socfpga/Makefile index 7cd4ef9b509..640f6298567 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/ wrap_iocsr_config.o +obj-$(CONFIG_SPL_BUILD) += wrap_iocsr_config.o wrap_pinmux_config.o diff --git a/board/altera/socfpga/qts/Makefile b/board/altera/socfpga/qts/Makefile deleted file mode 100644 index cd8fecc0404..00000000000 --- a/board/altera/socfpga/qts/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# (C) Copyright 2015 Marek Vasut <marex@denx.de> -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y += pinmux_config.o diff --git a/board/altera/socfpga/wrap_pinmux_config.c b/board/altera/socfpga/wrap_pinmux_config.c new file mode 100644 index 00000000000..b33e2cab824 --- /dev/null +++ b/board/altera/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); +} |