[PATCH] net: ravb: Fix NULL pointer access

Marek Vasut marek.vasut at gmail.com
Sat Sep 19 21:12:07 CEST 2020


On 9/19/20 8:14 PM, Biju Das wrote:

Hi,

[...]

>>>>> By looking at [1], only this driver is using writeext.
>>>>> [1]https://elixir.bootlin.com/u-boot/v2020.10-rc4/A/ident/writeext
>>>>
>>>> git grep indicates a couple more sites where the writeext is called.
>>>> But look into the KSZ9031 datasheet, that particular writeext call
>>>> seems to be setting up RGMII Clock Pad Skew (MMD Address 2, Register
>>>> 8), and I think there is a matching DT binding to set those up too,
>>>> rxc-skew-ps and txc- skew-ps I think.
>>>
>>> Thanks for the pointers.  I checked the configs[2] which uses renesas
>>> ravb driver and found that we are defining only rxc-skew-ps in all dts.
>>>
>>> since CONFIG DM_ETH is defined it is already picking the value
>> corresponding to "rxc-skew-ps".
>>>
>>> For txc-skew-ps anyway the value is default one. So we don't care.
>>
>> Are you sure (0xf << 5) | 0x19 is the same as the default value of the clock
>> pad skew register ?
> 
> No.
> As per [1] & [2], the default values for this registers are 0xf

So the combined value of the MMD 2-8 register is (0xf << 5) | (0xf << 0)
, right.

> [1] https://elixir.bootlin.com/u-boot/v2020.10-rc4/source/drivers/net/phy/micrel_ksz90x1.c#L105
> [2] http://ww1.microchip.com/downloads/en/devicedoc/00002117f.pdf
> 
> if we remove writephyext, by looking the code at [1], rxc-skew-ps will be taken from the device tree[3] and "txc-skew-pc" will be the default value(0xf).
> [3]https://elixir.bootlin.com/u-boot/v2020.10-rc4/source/arch/arm/dts/salvator-common.dtsi#L331

So you want to check whether each RCar3 DT contains a PHY node and that
PHY node has rxc-skew-ps and txc-skew-ps , which combined then results
into a register value (0xf << 5) | (0x19 << 0) .

> I will check this and let you know the results after checking on RCar board. Unfortunately currently I don't have RCar board.

It's enough to just check the DTs and verify that they set the matching
correct values of rxc-skew-ps/txc-skew-ps . I can test it on the real
hardware.

If you want, you can add the txc-skew-ps into the Linux R-Car3 DTs too.

btw unrelated, you seem to have rxc-skew-ps in your hihope-rzg2-ex.dtsi,
but I think you don't have KSZ9031 PHY, so maybe you want to remove it
form your DT too.

Thanks


More information about the U-Boot mailing list