From: Dylan Hung <dylan_hung@aspeedtech.com>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH v2 2/3] net: mdio: add reset control for Aspeed MDIO
Date: Mon, 21 Mar 2022 17:56:47 +0800 [thread overview]
Message-ID: <20220321095648.4760-3-dylan_hung@aspeedtech.com> (raw)
In-Reply-To: <20220321095648.4760-1-dylan_hung@aspeedtech.com>
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 <dylan_hung@aspeedtech.com>
Cc: stable at vger.kernel.org
---
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
WARNING: multiple messages have this Message-ID (diff)
From: Dylan Hung <dylan_hung@aspeedtech.com>
To: <robh+dt@kernel.org>, <joel@jms.id.au>, <andrew@aj.id.au>,
<andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<p.zabel@pengutronix.de>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>
Cc: <BMC-SW@aspeedtech.com>, <stable@vger.kernel.org>
Subject: [PATCH v2 2/3] net: mdio: add reset control for Aspeed MDIO
Date: Mon, 21 Mar 2022 17:56:47 +0800 [thread overview]
Message-ID: <20220321095648.4760-3-dylan_hung@aspeedtech.com> (raw)
In-Reply-To: <20220321095648.4760-1-dylan_hung@aspeedtech.com>
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 <dylan_hung@aspeedtech.com>
Cc: stable@vger.kernel.org
---
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Dylan Hung <dylan_hung@aspeedtech.com>
To: <robh+dt@kernel.org>, <joel@jms.id.au>, <andrew@aj.id.au>,
<andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<p.zabel@pengutronix.de>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>
Cc: <BMC-SW@aspeedtech.com>, <stable@vger.kernel.org>
Subject: [PATCH v2 2/3] net: mdio: add reset control for Aspeed MDIO
Date: Mon, 21 Mar 2022 17:56:47 +0800 [thread overview]
Message-ID: <20220321095648.4760-3-dylan_hung@aspeedtech.com> (raw)
In-Reply-To: <20220321095648.4760-1-dylan_hung@aspeedtech.com>
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 <dylan_hung@aspeedtech.com>
Cc: stable@vger.kernel.org
---
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
next prev parent reply other threads:[~2022-03-21 9:56 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 9:56 [PATCH v2 0/3] Add reset deassertion for Aspeed MDIO Dylan Hung
2022-03-21 9:56 ` Dylan Hung
2022-03-21 9:56 ` Dylan Hung
2022-03-21 9:56 ` [PATCH v2 1/3] dt-bindings: net: add reset property for aspeed, ast2600-mdio binding Dylan Hung
2022-03-21 9:56 ` Dylan Hung
2022-03-21 9:56 ` Dylan Hung
2022-03-21 12:48 ` Andrew Lunn
2022-03-21 12:48 ` Andrew Lunn
2022-03-21 12:48 ` Andrew Lunn
2022-03-21 13:35 ` Rob Herring
2022-03-21 13:35 ` Rob Herring
2022-03-21 13:35 ` Rob Herring
2022-03-21 15:51 ` Krzysztof Kozlowski
2022-03-21 15:51 ` Krzysztof Kozlowski
2022-03-21 15:51 ` Krzysztof Kozlowski
2022-03-21 9:56 ` Dylan Hung [this message]
2022-03-21 9:56 ` [PATCH v2 2/3] net: mdio: add reset control for Aspeed MDIO Dylan Hung
2022-03-21 9:56 ` Dylan Hung
2022-03-21 10:15 ` Philipp Zabel
2022-03-21 10:15 ` Philipp Zabel
2022-03-21 10:15 ` Philipp Zabel
2022-03-21 9:56 ` [PATCH v2 3/3] ARM: dts: aspeed: add reset properties into MDIO nodes Dylan Hung
2022-03-21 9:56 ` Dylan Hung
2022-03-21 9:56 ` Dylan Hung
2022-03-21 15:53 ` Krzysztof Kozlowski
2022-03-21 15:53 ` Krzysztof Kozlowski
2022-03-21 15:53 ` Krzysztof Kozlowski
2022-03-22 2:32 ` Dylan Hung
2022-03-22 2:32 ` Dylan Hung
2022-03-22 2:32 ` Dylan Hung
2022-03-22 3:00 ` Andrew Lunn
2022-03-22 3:00 ` Andrew Lunn
2022-03-22 3:00 ` Andrew Lunn
2022-03-22 3:22 ` Dylan Hung
2022-03-22 3:22 ` Dylan Hung
2022-03-22 3:22 ` Dylan Hung
2022-03-22 9:08 ` Philipp Zabel
2022-03-22 9:08 ` Philipp Zabel
2022-03-22 9:08 ` Philipp Zabel
2022-03-22 8:40 ` Krzysztof Kozlowski
2022-03-22 8:40 ` Krzysztof Kozlowski
2022-03-22 8:40 ` Krzysztof Kozlowski
2022-03-22 8:44 ` Dylan Hung
2022-03-22 8:44 ` Dylan Hung
2022-03-22 8:44 ` Dylan Hung
2022-03-21 12:45 ` [PATCH v2 0/3] Add reset deassertion for Aspeed MDIO Andrew Lunn
2022-03-21 12:45 ` Andrew Lunn
2022-03-21 12:45 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220321095648.4760-3-dylan_hung@aspeedtech.com \
--to=dylan_hung@aspeedtech.com \
--cc=linux-aspeed@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.