Add missing reset deassertion for Aspeed MDIO. There are 4 MDIOs embedded
in Aspeed AST2600 and share one reset control bit SCU50[3].
Dylan Hung (3):
dt-bindings: net: add reset property for aspeed, ast2600-mdio binding
net: mdio: add reset control for Aspeed MDIO
ARM: dts: aspeed: add reset properties into MDIO nodes
.../bindings/net/aspeed,ast2600-mdio.yaml | 4 ++++
arch/arm/boot/dts/aspeed-g6.dtsi | 4 ++++
drivers/net/mdio/mdio-aspeed.c | 15 ++++++++++++++-
3 files changed, 22 insertions(+), 1 deletion(-)
--
2.25.1
Add reset assertion/deassertion for Aspeed MDIO. There are 4 MDIO
controllers embedded in Aspeed AST2600 SOC and share one reset control
register SCU50[3]. So devm_reset_control_get_shared is used in this
change.
Signed-off-by: Dylan Hung <[email protected]>
Cc: [email protected]
---
drivers/net/mdio/mdio-aspeed.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c
index e2273588c75b..5bda48d7071d 100644
--- a/drivers/net/mdio/mdio-aspeed.c
+++ b/drivers/net/mdio/mdio-aspeed.c
@@ -3,6 +3,7 @@
#include <linux/bitfield.h>
#include <linux/delay.h>
+#include <linux/reset.h>
#include <linux/iopoll.h>
#include <linux/mdio.h>
#include <linux/module.h>
@@ -37,6 +38,7 @@
struct aspeed_mdio {
void __iomem *base;
+ struct reset_control *reset;
};
static int aspeed_mdio_read(struct mii_bus *bus, int addr, int regnum)
@@ -120,6 +122,12 @@ static int aspeed_mdio_probe(struct platform_device *pdev)
if (IS_ERR(ctx->base))
return PTR_ERR(ctx->base);
+ ctx->reset = devm_reset_control_get_shared(&pdev->dev, NULL);
+ if (IS_ERR(ctx->reset))
+ return PTR_ERR(ctx->reset);
+
+ reset_control_deassert(ctx->reset);
+
bus->name = DRV_NAME;
snprintf(bus->id, MII_BUS_ID_SIZE, "%s%d", pdev->name, pdev->id);
bus->parent = &pdev->dev;
@@ -129,6 +137,7 @@ static int aspeed_mdio_probe(struct platform_device *pdev)
rc = of_mdiobus_register(bus, pdev->dev.of_node);
if (rc) {
dev_err(&pdev->dev, "Cannot register MDIO bus!\n");
+ reset_control_assert(ctx->reset);
return rc;
}
@@ -139,7 +148,11 @@ static int aspeed_mdio_probe(struct platform_device *pdev)
static int aspeed_mdio_remove(struct platform_device *pdev)
{
- mdiobus_unregister(platform_get_drvdata(pdev));
+ struct mii_bus *bus = (struct mii_bus *)platform_get_drvdata(pdev);
+ struct aspeed_mdio *ctx = bus->priv;
+
+ reset_control_assert(ctx->reset);
+ mdiobus_unregister(bus);
return 0;
}
--
2.25.1
On Mon, Mar 21, 2022 at 05:56:45PM +0800, Dylan Hung wrote:
> Add missing reset deassertion for Aspeed MDIO. There are 4 MDIOs embedded
> in Aspeed AST2600 and share one reset control bit SCU50[3].
Hi Dylan
Please wait at least 24 hours between posting versions, to give other
people times to comment.
The danger here is that my comments on the previous version are going
to get ignored, and this version merged containing the issues i
pointed out.
Andrew