Merge branch 'followup-fixes-for-the-dwmac-and-altera-lynx-conversion'
Maxime Chevallier says: ==================== Followup fixes for the dwmac and altera lynx conversion Here's yet another version of the cleanup series for the TSE PCS replacement by PCS Lynx. It includes Kconfig fixups, some missing initialisations and a slight rework suggested by Russell for the dwmac cleanup sequence, along with more explicit zeroing of local structures as per MAciej's review. ==================== Link: https://lore.kernel.org/r/20230607135941.407054-1-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
e06bd5e3ad
@ -4,7 +4,7 @@ config ALTERA_TSE
|
||||
depends on HAS_DMA
|
||||
select PHYLIB
|
||||
select PHYLINK
|
||||
select PCS_ALTERA_TSE
|
||||
select PCS_LYNX
|
||||
select MDIO_REGMAP
|
||||
select REGMAP_MMIO
|
||||
help
|
||||
|
@ -1255,6 +1255,8 @@ static int altera_tse_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto err_free_netdev;
|
||||
|
||||
memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
|
||||
memset(&mrc, 0, sizeof(mrc));
|
||||
/* SGMII PCS address space. The location can vary depending on how the
|
||||
* IP is integrated. We can have a resource dedicated to it at a specific
|
||||
* address space, but if it's not the case, we fallback to the mdiophy0
|
||||
@ -1286,6 +1288,7 @@ static int altera_tse_probe(struct platform_device *pdev)
|
||||
mrc.regmap = pcs_regmap;
|
||||
mrc.parent = &pdev->dev;
|
||||
mrc.valid_addr = 0x0;
|
||||
mrc.autoscan = false;
|
||||
|
||||
/* Rx IRQ */
|
||||
priv->rx_irq = platform_get_irq_byname(pdev, "rx_irq");
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <linux/stmmac.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/pcs/pcs-xpcs.h>
|
||||
#include <linux/pcs-lynx.h>
|
||||
#include <linux/module.h>
|
||||
#if IS_ENABLED(CONFIG_VLAN_8021Q)
|
||||
#define STMMAC_VLAN_TAG_USED
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <linux/phy.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/mdio/mdio-regmap.h>
|
||||
#include <linux/pcs-lynx.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/stmmac.h>
|
||||
|
||||
@ -388,7 +389,6 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
|
||||
struct net_device *ndev;
|
||||
struct stmmac_priv *stpriv;
|
||||
const struct socfpga_dwmac_ops *ops;
|
||||
struct regmap_config pcs_regmap_cfg;
|
||||
|
||||
ops = device_get_match_data(&pdev->dev);
|
||||
if (!ops) {
|
||||
@ -446,19 +446,22 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto err_dvr_remove;
|
||||
|
||||
memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
|
||||
pcs_regmap_cfg.reg_bits = 16;
|
||||
pcs_regmap_cfg.val_bits = 16;
|
||||
pcs_regmap_cfg.reg_shift = REGMAP_UPSHIFT(1);
|
||||
|
||||
/* Create a regmap for the PCS so that it can be used by the PCS driver,
|
||||
* if we have such a PCS
|
||||
*/
|
||||
if (dwmac->tse_pcs_base) {
|
||||
struct regmap_config pcs_regmap_cfg;
|
||||
struct mdio_regmap_config mrc;
|
||||
struct regmap *pcs_regmap;
|
||||
struct mii_bus *pcs_bus;
|
||||
|
||||
memset(&pcs_regmap_cfg, 0, sizeof(pcs_regmap_cfg));
|
||||
memset(&mrc, 0, sizeof(mrc));
|
||||
|
||||
pcs_regmap_cfg.reg_bits = 16;
|
||||
pcs_regmap_cfg.val_bits = 16;
|
||||
pcs_regmap_cfg.reg_shift = REGMAP_UPSHIFT(1);
|
||||
|
||||
pcs_regmap = devm_regmap_init_mmio(&pdev->dev, dwmac->tse_pcs_base,
|
||||
&pcs_regmap_cfg);
|
||||
if (IS_ERR(pcs_regmap)) {
|
||||
@ -469,6 +472,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
|
||||
mrc.regmap = pcs_regmap;
|
||||
mrc.parent = &pdev->dev;
|
||||
mrc.valid_addr = 0x0;
|
||||
mrc.autoscan = false;
|
||||
|
||||
snprintf(mrc.name, MII_BUS_ID_SIZE, "%s-pcs-mii", ndev->name);
|
||||
pcs_bus = devm_mdio_regmap_register(&pdev->dev, &mrc);
|
||||
@ -494,6 +498,17 @@ err_remove_config_dt:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void socfpga_dwmac_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
struct stmmac_priv *priv = netdev_priv(ndev);
|
||||
struct phylink_pcs *pcs = priv->hw->lynx_pcs;
|
||||
|
||||
stmmac_pltfr_remove(pdev);
|
||||
|
||||
lynx_pcs_destroy(pcs);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int socfpga_dwmac_resume(struct device *dev)
|
||||
{
|
||||
@ -565,7 +580,7 @@ MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
|
||||
|
||||
static struct platform_driver socfpga_dwmac_driver = {
|
||||
.probe = socfpga_dwmac_probe,
|
||||
.remove_new = stmmac_pltfr_remove,
|
||||
.remove_new = socfpga_dwmac_remove,
|
||||
.driver = {
|
||||
.name = "socfpga-dwmac",
|
||||
.pm = &socfpga_dwmac_pm_ops,
|
||||
|
@ -665,9 +665,6 @@ int stmmac_mdio_unregister(struct net_device *ndev)
|
||||
if (priv->hw->xpcs)
|
||||
xpcs_destroy(priv->hw->xpcs);
|
||||
|
||||
if (priv->hw->lynx_pcs)
|
||||
lynx_pcs_destroy(priv->hw->lynx_pcs);
|
||||
|
||||
mdiobus_unregister(priv->mii);
|
||||
priv->mii->priv = NULL;
|
||||
mdiobus_free(priv->mii);
|
||||
|
Loading…
x
Reference in New Issue
Block a user