blob: b33e2cab824861116c48629f6853d1004006b178 [file] [log] [blame]
Marek Vasut1100e342015-07-25 11:09:11 +02001/*
2 * Copyright (C) 2015 Marek Vasut <marex@denx.de>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <errno.h>
9/*
10 * Yes, dear reader, we're including a C file here, this is no mistake.
11 * But this time around, we do even more perverse hacking here to be
12 * compatible with QTS headers and obtain reasonably nice results too.
13 *
14 * First, we define _PRELOADER_PINMUX_CONFIG_H_, which will neutralise
15 * the pinmux_config.h inclusion in pinmux_config.c . Since we are
16 * probing everything from DT, we do NOT want those macros from the
17 * pinmux_config.h to ooze into our build system, anywhere, ever. So
18 * we nip it at the bud.
19 *
20 * Next, pinmux_config.c needs CONFIG_HPS_PINMUX_NUM and uses it to
21 * specify sized array explicitly. Instead, we want to use ARRAY_SIZE
22 * to figure out the size of the array, so define this macro as an
23 * empty one, so that the preprocessor optimizes things such that the
24 * arrays are not sized by default.
25 */
26#define _PRELOADER_PINMUX_CONFIG_H_
27#define CONFIG_HPS_PINMUX_NUM
28#include "qts/pinmux_config.c"
29
30void sysmgr_get_pinmux_table(const unsigned long **table,
31 unsigned int *table_len)
32{
33 *table = sys_mgr_init_table;
34 *table_len = ARRAY_SIZE(sys_mgr_init_table);
35}