summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2015-07-25 09:36:54 +0200
committerMarek Vasut <marex@denx.de>2015-08-08 14:14:07 +0200
commit03a92b215f0b63e89cbdeab2fcb8badce9f9d2ba (patch)
treec1f21dfe7d273f29fcbc9d272e1009759e9a9f16
parent2df7b2aadf375fc3d2f336fab8eb41556b997567 (diff)
arm: socfpga: scan: Zap redundant params in scan_mgr_io_scan_chain_prg()
It is sufficient to pass in the scan chain ID into the function to determine the remaining two parameters, so drop those params and determine them locally in the function. The big-ish switch in the function is temporary and will be replaced by a proper function call in subsequent patch. Signed-off-by: Marek Vasut <marex@denx.de>
-rw-r--r--arch/arm/mach-socfpga/scan_manager.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/arch/arm/mach-socfpga/scan_manager.c b/arch/arm/mach-socfpga/scan_manager.c
index ab7aaecfb7..135f9f354a 100644
--- a/arch/arm/mach-socfpga/scan_manager.c
+++ b/arch/arm/mach-socfpga/scan_manager.c
@@ -41,12 +41,8 @@ static inline uint32_t scan_chain_engine_is_idle(uint32_t max_iter)
/**
* scan_mgr_io_scan_chain_prg() - Program HPS IO Scan Chain
* @io_scan_chain_id: IO scan chain ID
- * @io_scan_chain_len_in_bits: IO scan chain length in bits
- * @iocsr_scan_chain: IO scan chain table
*/
-static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id,
- uint32_t io_scan_chain_len_in_bits,
- const uint32_t *iocsr_scan_chain)
+static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id)
{
uint16_t tdi_tdo_header;
uint32_t io_program_iter;
@@ -54,6 +50,27 @@ static int scan_mgr_io_scan_chain_prg(const unsigned int io_scan_chain_id,
uint32_t residual;
uint32_t i;
uint32_t index = 0;
+ uint32_t io_scan_chain_len_in_bits,
+ const uint32_t *iocsr_scan_chain;
+
+ switch (io_scan_chain_id) {
+ case 0:
+ io_scan_chain_len_in_bits = CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH;
+ iocsr_scan_chain = iocsr_scan_chain0_table;
+ break;
+ case 1:
+ io_scan_chain_len_in_bits = CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH;
+ iocsr_scan_chain = iocsr_scan_chain1_table;
+ break;
+ case 2:
+ io_scan_chain_len_in_bits = CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH;
+ iocsr_scan_chain = iocsr_scan_chain2_table;
+ break;
+ case 3:
+ io_scan_chain_len_in_bits = CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH;
+ iocsr_scan_chain = iocsr_scan_chain3_table;
+ break;
+ }
/*
* De-assert reinit if the IO scan chain is intended for HIO. In
@@ -201,13 +218,9 @@ int scan_mgr_configure_iocsr(void)
int status = 0;
/* configure the IOCSR through scan chain */
- status |= scan_mgr_io_scan_chain_prg(0,
- CONFIG_HPS_IOCSR_SCANCHAIN0_LENGTH, iocsr_scan_chain0_table);
- status |= scan_mgr_io_scan_chain_prg(1,
- CONFIG_HPS_IOCSR_SCANCHAIN1_LENGTH, iocsr_scan_chain1_table);
- status |= scan_mgr_io_scan_chain_prg(2,
- CONFIG_HPS_IOCSR_SCANCHAIN2_LENGTH, iocsr_scan_chain2_table);
- status |= scan_mgr_io_scan_chain_prg(3,
- CONFIG_HPS_IOCSR_SCANCHAIN3_LENGTH, iocsr_scan_chain3_table);
+ status |= scan_mgr_io_scan_chain_prg(0);
+ status |= scan_mgr_io_scan_chain_prg(1);
+ status |= scan_mgr_io_scan_chain_prg(2);
+ status |= scan_mgr_io_scan_chain_prg(3);
return status;
}