[PATCH u-boot 4/4] eth/r8152: support RTL8153B/RTL8154B

Marek Vasut marex at denx.de
Fri Jun 12 13:52:53 CEST 2020


On 6/12/20 5:50 AM, Hayes Wang wrote:
> Marek Vasut [mailto:marex at denx.de]
>> Sent: Friday, June 12, 2020 8:05 AM
> [...]
>>> The real data (16-bit) would be inserted a dummy bit,
>>> and store the 17-bit to efuse offset 0x7d. Therefore, when
>>> reading the 17-bit data from efuse, we have to remove the
>>> dummy to get the real data.
>>
>> Ah, hmm, then let's use u32 type and be done with it. That solves the
>> typecasts and is safe. Would that work ?
> 
> The unit of PHY data is 2-byte, so I think I have to convert it.
> 
> void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data);

Try this:

	ocp_data = r8152_efuse_read(tp, 0x7d);
	ocp_data = (ocp_data & 0x1fff0) >> 1) | (ocp_data & 0x7);
	if (data != 0xffff)
		ocp_reg_write(tp, OCP_ADC_IOFFSET, data);

That should work, no ? Or does it generate compiler warnings ?

There should be some way to remove that cast I hope, the rest of the
patch is OK.


More information about the U-Boot mailing list