/* This function will return the internal Vref setting for the given channel, byte_lane.  */
uint32_t get_vref(uint8_t channel, uint8_t byte_lane)
/* This function will return the internal Vref setting for the given channel, byte_lane.  */
uint32_t get_vref(uint8_t channel, uint8_t byte_lane)
{
	uint8_t j;
	uint32_t ret_val = sizeof(vref_codes) / 2;
	uint32_t reg = (byte_lane & 0x1) ? B1VREFCTL : B0VREFCTL;
	uint32_t temp;
	ENTERFN();
	temp = msg_port_alt_read(DDRPHY, reg + channel * DDRIODQ_CH_OFFSET +
		(byte_lane >> 1) * DDRIODQ_BL_OFFSET);
	temp >>= 2;
	temp &= 0x3f;
	for (j = 0; j < sizeof(vref_codes); j++) {
		if (vref_codes[j] == temp) {
			ret_val = j;
			break;
		}
	}
	LEAVEFN();
	return ret_val;
}