[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b807496-f387-4aef-8650-a43a9249468f@tuxon.dev>
Date: Fri, 15 Dec 2023 12:04:49 +0200
From: claudiu beznea <claudiu.beznea@...on.dev>
To: Sergey Shtylyov <s.shtylyov@....ru>, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
claudiu.beznea.uj@...renesas.com, yoshihiro.shimoda.uh@...esas.com,
wsa+renesas@...g-engineering.com, niklas.soderlund+renesas@...natech.se,
biju.das.jz@...renesas.com, prabhakar.mahadev-lad.rj@...renesas.com,
mitsuhiro.kimura.kc@...esas.com, geert+renesas@...der.be
Cc: netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net 1/2] net: ravb: Wait for operation mode to be applied
On 14.12.2023 21:41, Sergey Shtylyov wrote:
> resetOn 12/14/23 2:31 PM, Claudiu wrote:
>
>> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
>>
>> CSR.OPS bits specify the current operating mode and (according to
>> documentation) they are updated when the operating mode change request
>> is processed. Thus, check CSR.OPS before proceeding.
>
> The manuals I have indeed say we need to check CSR.OPS... But we only
> need to wait iff we transfer from the operation mode to the config mode...
RZ/G3S manual say about CSR.OPS "These bits are updated when an operating
mode changes is processed". From this I get we need to check it for any mode.
Also, on configuration procedure (of RZ/G3S) it say CSR.OPS need to be
checked when switching from reset -> config.
>
>> Fixes: 568b3ce7a8ef ("ravb: factor out register bit twiddling code")
>> Fixes: 0184165b2f42 ("ravb: add sleep PM suspend/resume support")
>> Fixes: 7e09a052dc4e ("ravb: Exclude gPTP feature support for RZ/G2L")
>> Fixes: 3e3d647715d4 ("ravb: add wake-on-lan support via magic packet")
>> Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
>
> Hm, that long list does look weird...
OK, then I'll limit it to only c156633f1353 ("Renesas Ethernet AVB driver
proper"). Niklas also suggested this.
>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
>> ---
>> drivers/net/ethernet/renesas/ravb_main.c | 47 ++++++++++++++++++++----
>> 1 file changed, 39 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
>> index 9178f6d60e74..ce95eb5af354 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>> @@ -683,8 +683,11 @@ static int ravb_dmac_init(struct net_device *ndev)
>>
>> /* Setting the control will start the AVB-DMAC process. */
>> ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_OPERATION);
>> + error = ravb_wait(ndev, CSR, CSR_OPS, CSR_OPS_OPERATION);
>> + if (error)
>> + netdev_err(ndev, "failed to switch device to operation mode\n");
>
> It doesn't look like ravb_wait() is needed here...
> And besides, this pattern seems repetitive and worth factoring out into
> a single function.
In the final version of the driver proposed by RPM series it is gone. I
tried to keep the fixes simple. I'll update it as Niklas also suggested this.
>
> [...]
>> @@ -1744,6 +1747,18 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler,
>> return error;
>> }
>>
>> +static int ravb_set_reset_mode(struct net_device *ndev)
>> +{
>> + int error;
>> +
>> + ravb_write(ndev, CCC_OPC_RESET, CCC);
>> + error = ravb_wait(ndev, CSR, CSR_OPS, CSR_OPS_RESET);
>> + if (error)
>> + netdev_err(ndev, "failed to switch device to reset mode\n");
>> +
>> + return error;
>> +}
>> +
>
> Again, ravb_wait() call doesn't seem necessary here...
Ok. I followed the guideline from the description of CSR.OPS. Let me know
if you want to keep it or not. I think I haven't saw any issues w/o this.
>
> [...]
>
> MBR, Sergey
Powered by blists - more mailing lists