ret = mt7530_probe_common(priv); if (ret) return ret;
/* Use medatek,mcm property to distinguish hardware type that would * cause a little bit differences on power-on sequence. * Not MCM that indicates switch works as the remote standalone * integrated circuit so the GPIO pin would be used to complete * the reset, otherwise memory-mapped register accessing used * through syscon provides in the case of MCM.
*/
priv->mcm = of_property_read_bool(dn, "mediatek,mcm"); if (priv->mcm) {
dev_info(&mdiodev->dev, "MT7530 adapts as multi-chip module\n");
priv->rstc = devm_reset_control_get(&mdiodev->dev, "mcm"); if (IS_ERR(priv->rstc)) {
dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); return PTR_ERR(priv->rstc);
}
} else {
priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset",
GPIOD_OUT_LOW); if (IS_ERR(priv->reset)) {
dev_err(&mdiodev->dev, "Couldn't get our reset line\n"); return PTR_ERR(priv->reset);
}
}
if (priv->id == ID_MT7530) {
priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core"); if (IS_ERR(priv->core_pwr)) return PTR_ERR(priv->core_pwr);
priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io"); if (IS_ERR(priv->io_pwr)) return PTR_ERR(priv->io_pwr);
}
priv->regmap = devm_regmap_init(priv->dev, &mt7530_regmap_bus, priv,
®map_config); if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap);
if (priv->id == ID_MT7531)
priv->create_sgmii = mt7531_create_sgmii;
return dsa_register_switch(priv->ds);
}
staticvoid
mt7530_remove(struct mdio_device *mdiodev)
{ struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); int ret = 0, i;
if (!priv) return;
ret = regulator_disable(priv->core_pwr); if (ret < 0)
dev_err(priv->dev, "Failed to disable core power: %d\n", ret);
ret = regulator_disable(priv->io_pwr); if (ret < 0)
dev_err(priv->dev, "Failed to disable io pwr: %d\n",
ret);
mt7530_remove_common(priv);
for (i = 0; i < 2; ++i)
mtk_pcs_lynxi_destroy(priv->ports[5 + i].sgmii_pcs);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.