/* This function will program the internal Vref setting in a given byte lane in a given channel.  */
void set_vref(uint8_t channel, uint8_t byte_lane, uint32_t setting)
/* This function will program the internal Vref setting in a given byte lane in a given channel.  */
void set_vref(uint8_t channel, uint8_t byte_lane, uint32_t setting)
{
	uint32_t reg = (byte_lane & 0x1) ? B1VREFCTL : B0VREFCTL;
	ENTERFN();
	DPF(D_TRN, "Vref ch%d ln%d : val=%03X\n",
	    channel, byte_lane, setting);
	mrc_alt_write_mask(DDRPHY, reg + channel * DDRIODQ_CH_OFFSET +
		(byte_lane >> 1) * DDRIODQ_BL_OFFSET,
		vref_codes[setting] << 2, 0xfc);
	delay_n(300);
	LEAVEFN();
}