Re: [PATCH net 1/2] net: ravb: Wait for operation mode to be applied

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



resetOn 12/14/23 2:31 PM, Claudiu wrote:

> From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
> 
> 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...

> 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...

> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
> ---
>  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.

[...]
> @@ -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...

[...]

MBR, Sergey




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux