[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <231ce196-6a68-4f09-8f9a-976c5ce1495d@lunn.ch>
Date: Wed, 24 Apr 2024 02:27:26 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Parthiban Veerasooran <Parthiban.Veerasooran@...rochip.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, horms@...nel.org, saeedm@...dia.com,
anthony.l.nguyen@...el.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, corbet@....net,
linux-doc@...r.kernel.org, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
devicetree@...r.kernel.org, horatiu.vultur@...rochip.com,
ruanjinjie@...wei.com, steen.hegelund@...rochip.com,
vladimir.oltean@....com, UNGLinuxDriver@...rochip.com,
Thorsten.Kummermehr@...rochip.com, Pier.Beruto@...emi.com,
Selvamani.Rajagopal@...emi.com, Nicolas.Ferre@...rochip.com,
benjamin.bigler@...nformulastudent.ch
Subject: Re: [PATCH net-next v4 11/12] microchip: lan865x: add driver support
for Microchip's LAN865X MAC-PHY
> +/* OPEN Alliance Configuration Register #0 */
> +#define OA_TC6_REG_CONFIG0 0x0004
> +#define CONFIG0_ZARFE_ENABLE BIT(12)
If this is a standard register, you should put these defined where
other drivers can use them.
> +static int lan865x_set_mac_address(struct net_device *netdev, void *addr)
> +{
> + struct lan865x_priv *priv = netdev_priv(netdev);
> + struct sockaddr *address = addr;
> + int ret;
> +
> + ret = eth_prepare_mac_addr_change(netdev, addr);
> + if (ret < 0)
> + return ret;
> +
> + if (ether_addr_equal(address->sa_data, netdev->dev_addr))
> + return 0;
> +
> + ret = lan865x_set_hw_macaddr(priv, address->sa_data);
> + if (ret)
> + return ret;
> +
> + eth_hw_addr_set(netdev, address->sa_data);
It seems more normal to call eth_commit_mac_addr_change(), which
better pairs with eth_prepare_mac_addr_change().
> +static int lan865x_set_zarfe(struct lan865x_priv *priv)
> +{
> + u32 regval;
> + int ret;
> +
> + ret = oa_tc6_read_register(priv->tc6, OA_TC6_REG_CONFIG0, ®val);
> + if (ret)
> + return ret;
> +
> + /* Set Zero-Align Receive Frame Enable */
> + regval |= CONFIG0_ZARFE_ENABLE;
> +
> + return oa_tc6_write_register(priv->tc6, OA_TC6_REG_CONFIG0, regval);
> +}
There does not appear to be anything specific to your device here. So
please make this a helper in the shared code, so any driver can use
it.
Andrew
Powered by blists - more mailing lists