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.