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 /* Board-specific header. */
12 #include <qts/iocsr_config.h>
13 
14 int iocsr_get_config_table(const unsigned int chain_id,
15 			   const unsigned long **table,
16 			   unsigned int *table_len)
17 {
18 	switch (chain_id) {
19 	case 0:
20 		*table = iocsr_scan_chain0_table;
21 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH;
22 		break;
23 	case 1:
24 		*table = iocsr_scan_chain1_table;
25 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH;
26 		break;
27 	case 2:
28 		*table = iocsr_scan_chain2_table;
29 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH;
30 		break;
31 	case 3:
32 		*table = iocsr_scan_chain3_table;
33 		*table_len = CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH;
34 		break;
35 	default:
36 		return -EINVAL;
37 	}
38 
39 	return 0;
40 }
41