Message ID | 20240624132802.14238-1-fancer.lancer@gmail.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: stmmac: convert stmmac "pcs" to phylink | expand |
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index a66b836996d6..f7661268518f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -580,6 +580,7 @@ struct mii_regs { }; struct mac_device_info { + struct stmmac_priv *priv; const struct stmmac_ops *mac; const struct stmmac_desc_ops *desc; const struct stmmac_dma_ops *dma; diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 29367105df54..84fd57b76fad 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -351,6 +351,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) mac->tc = mac->tc ? : entry->tc; mac->mmc = mac->mmc ? : entry->mmc; mac->est = mac->est ? : entry->est; + mac->priv = priv; priv->hw = mac; priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off;
There is going to be introduced an PCS-specific CSR space pointer defined in the stmmac_priv structure nearby the mmcaddr, estaddr and ptpaddr fields. In order to have that pointer accessible from the PCS-specific callback, let's introduce pointer to stmmac_priv defined in the mac_device_info structure. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> --- Note the better approach would be to convert the mac_device_info instance to being embedded into the stmmac_priv structure. It would have solved many driver problems like non-unified HW abstraction interface, duplicated fields (ioaddr and pcsr, etc) or too many non-runtime parameters passed to the callbacks, etc. But the change also would have been much-much more invasive than this one is. If despite of that you find the mac_device_info embedding into stmmac_priv more appropriate (as I do), then I'll provide the respective patch in place of this one. --- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 1 + 2 files changed, 2 insertions(+)