[PATCH v3 2/2] mmc: sdhci-of-aspeed: Handle optional controller reset

Ryan Chen posted 2 patches 1 week, 4 days ago
There is a newer version of this series
[PATCH v3 2/2] mmc: sdhci-of-aspeed: Handle optional controller reset
Posted by Ryan Chen 1 week, 4 days ago
Get the optional reset line for the ASPEED SD controller during probe by
using devm_reset_control_get_optional_exclusive_deasserted().

This allows platforms such as AST2700, which require the SD controller
to be taken out of reset before use, to work with the existing driver.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
Changes in v2:
- use devm_reset_control_get_optional_exclusive_deasserted replace
  reset_control_get_optional_exclusive.
- add include reset.h
---
 drivers/mmc/host/sdhci-of-aspeed.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index ca97b01996b1..8f638ffb55ae 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -13,6 +13,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 #include <linux/spinlock.h>
 
 #include "sdhci-pltfm.h"
@@ -520,6 +521,7 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
 
 {
 	struct device_node *parent, *child;
+	struct reset_control *reset;
 	struct aspeed_sdc *sdc;
 	int ret;
 
@@ -529,6 +531,10 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
 
 	spin_lock_init(&sdc->lock);
 
+	reset = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);
+	if (IS_ERR(reset))
+		return dev_err_probe(&pdev->dev, PTR_ERR(reset), "unable to acquire reset\n");
+
 	sdc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(sdc->clk))
 		return PTR_ERR(sdc->clk);

-- 
2.34.1
Re: [PATCH v3 2/2] mmc: sdhci-of-aspeed: Handle optional controller reset
Posted by Adrian Hunter 1 week, 4 days ago
On 23/03/2026 04:07, Ryan Chen wrote:
> Get the optional reset line for the ASPEED SD controller during probe by
> using devm_reset_control_get_optional_exclusive_deasserted().
> 
> This allows platforms such as AST2700, which require the SD controller
> to be taken out of reset before use, to work with the existing driver.
> 
> Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>

No longer applies to 'next' branch of:

	git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git

Fix that and add:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> Changes in v2:
> - use devm_reset_control_get_optional_exclusive_deasserted replace
>   reset_control_get_optional_exclusive.
> - add include reset.h
> ---
>  drivers/mmc/host/sdhci-of-aspeed.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index ca97b01996b1..8f638ffb55ae 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -13,6 +13,7 @@
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
>  #include <linux/platform_device.h>
> +#include <linux/reset.h>
>  #include <linux/spinlock.h>
>  
>  #include "sdhci-pltfm.h"
> @@ -520,6 +521,7 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
>  
>  {
>  	struct device_node *parent, *child;
> +	struct reset_control *reset;
>  	struct aspeed_sdc *sdc;
>  	int ret;
>  
> @@ -529,6 +531,10 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
>  
>  	spin_lock_init(&sdc->lock);
>  
> +	reset = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);
> +	if (IS_ERR(reset))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(reset), "unable to acquire reset\n");
> +
>  	sdc->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(sdc->clk))
>  		return PTR_ERR(sdc->clk);
>
Re: [PATCH v3 2/2] mmc: sdhci-of-aspeed: Handle optional controller reset
Posted by Krzysztof Kozlowski 1 week, 4 days ago
On Mon, Mar 23, 2026 at 10:07:08AM +0800, Ryan Chen wrote:
> Get the optional reset line for the ASPEED SD controller during probe by
> using devm_reset_control_get_optional_exclusive_deasserted().
> 
> This allows platforms such as AST2700, which require the SD controller
> to be taken out of reset before use, to work with the existing driver.
> 
> Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
> ---
> Changes in v2:
> - use devm_reset_control_get_optional_exclusive_deasserted replace
>   reset_control_get_optional_exclusive.
> - add include reset.h

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof