[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <057a3004-f771-432f-a60b-962c2ebf399a@alliedtelesis.co.nz>
Date: Fri, 20 Dec 2024 09:50:40 +1300
From: Chris Packham <chris.packham@...iedtelesis.co.nz>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>
Cc: lee@...nel.org, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, tsbogend@...ha.franken.de,
hkallweit1@...il.com, linux@...linux.org.uk, markus.stockhausen@....de,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, linux-mips@...r.kernel.org
Subject: Re: [PATCH v2 4/4] net: mdio: Add RTL9300 MDIO driver
On 19/12/2024 17:46, Luiz Angelo Daros de Luca wrote:
>> +#define SMI_GLB_CTRL 0x000
>> +#define GLB_CTRL_INTF_SEL(intf) BIT(16 + (intf))
>> +#define SMI_PORT0_15_POLLING_SEL 0x008
>> +#define SMI_ACCESS_PHY_CTRL_0 0x170
>> +#define SMI_ACCESS_PHY_CTRL_1 0x174
>> +#define PHY_CTRL_RWOP BIT(2)
>> +#define PHY_CTRL_TYPE BIT(1)
>> +#define PHY_CTRL_CMD BIT(0)
>> +#define PHY_CTRL_FAIL BIT(25)
>> +#define SMI_ACCESS_PHY_CTRL_2 0x178
>> +#define SMI_ACCESS_PHY_CTRL_3 0x17c
>> +#define SMI_PORT0_5_ADDR_CTRL 0x180
>> +
>> +#define MAX_PORTS 28
>> +#define MAX_SMI_BUSSES 4
>> +#define MAX_SMI_ADDR 0x1f
>> +
>> +struct realtek_mdio_priv {
>> + struct regmap *regmap;
>> + u8 smi_bus[MAX_PORTS];
>> + u8 smi_addr[MAX_PORTS];
>> + bool smi_bus_isc45[MAX_SMI_BUSSES];
>> + u32 reg_base;
>> +};
>> +
>> +static int realtek_mdio_wait_ready(struct realtek_mdio_priv *priv)
>> +{
>> + struct regmap *regmap = priv->regmap;
>> + u32 reg_base = priv->reg_base;
>> + u32 val;
>> +
>> + return regmap_read_poll_timeout(regmap, reg_base + SMI_ACCESS_PHY_CTRL_1,
> All regmap funcs are adding reg_base to the register address. Isn't a
> remap job to do that sum? It just looks odd but I never worked with
> MFD. It looks like it is missing a subregmap-like variant.
I'm thinking about dropping the base and just using the full 16-bit
address. I've already confused myself between this code and the datasheet.
Powered by blists - more mailing lists