/* This function is used when programming the IO chains to submit the instruction followed by variable length payload.  */
static int scan_mgr_jtag_insn_data(const u8 iarg, const unsigned long *data, const unsigned int dlen)
/* This function is used when programming the IO chains to submit the instruction followed by variable length payload.  */
static int scan_mgr_jtag_insn_data(const u8 iarg, const unsigned long *data, const unsigned int dlen)
{
	int i, j;
	scan_mgr_jtag_io(JTAG_BP_INSN | JTAG_BP_2BYTE, iarg, dlen - 1);
	for (i = 0; i < dlen / 32; i++)
		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, data[i]);
	if ((dlen % 32) > 24) {
		scan_mgr_jtag_io(JTAG_BP_4BYTE, 0x0, data[i]);
	} else if (dlen % 32) {
		for (j = 0; j < dlen % 32; j += 8)
			scan_mgr_jtag_io(0, 0x0, data[i] >> j);
	}
	return scan_chain_engine_is_idle(SCANMGR_MAX_DELAY);
}