Message ID | 20210502230710.30676-1-ansuelsmth@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [RFC,net-next,v2,01/17] net: mdio: ipq8064: clean whitespaces in define | expand |
On Mon, May 03, 2021 at 01:06:54AM +0200, Ansuel Smith wrote: > Use readl/writel function instead of regmap function to make sure no > value is cached and align to other similar mdio driver. regmap is O.K. to use, so long as you tell it not to cache. Look at how to use volatile in regmap. You might be able to follow what lan9303_mdio.c is doing. Andrew
On Mon, May 03, 2021 at 02:49:34PM +0200, Andrew Lunn wrote: > On Mon, May 03, 2021 at 01:06:54AM +0200, Ansuel Smith wrote: > > Use readl/writel function instead of regmap function to make sure no > > value is cached and align to other similar mdio driver. > > regmap is O.K. to use, so long as you tell it not to cache. Look at > how to use volatile in regmap. > > You might be able to follow what lan9303_mdio.c is doing. > > Andrew Was thinking more about the overhead of using regmap instead of plain writel. Or is it minimal?
On Mon, May 03, 2021 at 04:24:15PM +0200, Ansuel Smith wrote: > On Mon, May 03, 2021 at 02:49:34PM +0200, Andrew Lunn wrote: > > On Mon, May 03, 2021 at 01:06:54AM +0200, Ansuel Smith wrote: > > > Use readl/writel function instead of regmap function to make sure no > > > value is cached and align to other similar mdio driver. > > > > regmap is O.K. to use, so long as you tell it not to cache. Look at > > how to use volatile in regmap. > > > > You might be able to follow what lan9303_mdio.c is doing. > > > > Andrew > > Was thinking more about the overhead of using regmap instead of plain > writel. Or is it minimal? It is likely other parts of the system are using regmap. So it will not be adding much overhead. Andrew
diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c index 1bd18857e1c5..fb1614242e13 100644 --- a/drivers/net/mdio/mdio-ipq8064.c +++ b/drivers/net/mdio/mdio-ipq8064.c @@ -15,25 +15,26 @@ #include <linux/mfd/syscon.h> /* MII address register definitions */ -#define MII_ADDR_REG_ADDR 0x10 -#define MII_BUSY BIT(0) -#define MII_WRITE BIT(1) -#define MII_CLKRANGE_60_100M (0 << 2) -#define MII_CLKRANGE_100_150M (1 << 2) -#define MII_CLKRANGE_20_35M (2 << 2) -#define MII_CLKRANGE_35_60M (3 << 2) -#define MII_CLKRANGE_150_250M (4 << 2) -#define MII_CLKRANGE_250_300M (5 << 2) +#define MII_ADDR_REG_ADDR 0x10 +#define MII_BUSY BIT(0) +#define MII_WRITE BIT(1) +#define MII_CLKRANGE(x) ((x) << 2) +#define MII_CLKRANGE_60_100M MII_CLKRANGE(0) +#define MII_CLKRANGE_100_150M MII_CLKRANGE(1) +#define MII_CLKRANGE_20_35M MII_CLKRANGE(2) +#define MII_CLKRANGE_35_60M MII_CLKRANGE(3) +#define MII_CLKRANGE_150_250M MII_CLKRANGE(4) +#define MII_CLKRANGE_250_300M MII_CLKRANGE(5) #define MII_CLKRANGE_MASK GENMASK(4, 2) #define MII_REG_SHIFT 6 #define MII_REG_MASK GENMASK(10, 6) #define MII_ADDR_SHIFT 11 #define MII_ADDR_MASK GENMASK(15, 11) -#define MII_DATA_REG_ADDR 0x14 +#define MII_DATA_REG_ADDR 0x14 -#define MII_MDIO_DELAY_USEC (1000) -#define MII_MDIO_RETRY_MSEC (10) +#define MII_MDIO_DELAY_USEC (1000) +#define MII_MDIO_RETRY_MSEC (10) struct ipq8064_mdio { struct regmap *base; /* NSS_GMAC0_BASE */
Fix mixed whitespace and tab for define spacing. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> --- drivers/net/mdio/mdio-ipq8064.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)