xref: /rk3399_rockchip-uboot/arch/arm/mach-socfpga/wrap_iocsr_config.c (revision ca62d2e1fca4e89b1e15e6bdc634f6ef39a7360d)
1 /*
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 #include <asm/arch/clock_manager.h>
10 /*
11  * Yes, dear reader, we're including a C file here, this is no mistake :-)
12  */
13 #include <qts/iocsr_config.c>
14 
15 int iocsr_get_config_table(const unsigned int chain_id,
16 			   const unsigned long **table,
17 			   unsigned int *table_len)
18 {
19 	switch (chain_id) {
20 	case 0:
21 		*table = iocsr_scan_chain0_table;
22 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH;
23 		break;
24 	case 1:
25 		*table = iocsr_scan_chain1_table;
26 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH;
27 		break;
28 	case 2:
29 		*table = iocsr_scan_chain2_table;
30 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH;
31 		break;
32 	case 3:
33 		*table = iocsr_scan_chain3_table;
34 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH;
35 		break;
36 	default:
37 		return -EINVAL;
38 	}
39 
40 	return 0;
41 }
42