[PATCH 2/2] mmc: sdhci-of-aspeed: Add ast2700 support

Ryan Chen posted 2 patches 3 weeks, 4 days ago
There is a newer version of this series
[PATCH 2/2] mmc: sdhci-of-aspeed: Add ast2700 support
Posted by Ryan Chen 3 weeks, 4 days ago
Add support for the AST2700 SOC in the sd controller driver. AST2700 sd
controller requires an reset line, so hook up the optional reset control
and deassert it during probe.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
 drivers/mmc/host/sdhci-of-aspeed.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index ca97b01996b1..91c36245e506 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -520,6 +520,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 +530,15 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
 
 	spin_lock_init(&sdc->lock);
 
+	reset = reset_control_get_optional_exclusive(&pdev->dev, NULL);
+	if (IS_ERR(reset))
+		return dev_err_probe(&pdev->dev, PTR_ERR(reset),
+				     "unable to acquire reset\n");
+	ret = reset_control_deassert(sdc->rst);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "reset deassert failed\n");
+
 	sdc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(sdc->clk))
 		return PTR_ERR(sdc->clk);
@@ -577,6 +587,7 @@ static const struct of_device_id aspeed_sdc_of_match[] = {
 	{ .compatible = "aspeed,ast2400-sd-controller", },
 	{ .compatible = "aspeed,ast2500-sd-controller", },
 	{ .compatible = "aspeed,ast2600-sd-controller", },
+	{ .compatible = "aspeed,ast2700-sd-controller", },
 	{ }
 };
 

-- 
2.34.1
Re: [PATCH 2/2] mmc: sdhci-of-aspeed: Add ast2700 support
Posted by kernel test robot 3 weeks, 2 days ago
Hi Ryan,

kernel test robot noticed the following build errors:

[auto build test ERROR on 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f]

url:    https://github.com/intel-lab-lkp/linux/commits/Ryan-Chen/dt-bindings-mmc-sdhci-of-aspeed-Add-ast2700-support/20260314-132323
base:   6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
patch link:    https://lore.kernel.org/r/20260313-sdhci-v1-2-91cea19c8a67%40aspeedtech.com
patch subject: [PATCH 2/2] mmc: sdhci-of-aspeed: Add ast2700 support
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20260315/202603150439.FM8mt7EG-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260315/202603150439.FM8mt7EG-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603150439.FM8mt7EG-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/mmc/host/sdhci-of-aspeed.c: In function 'aspeed_sdc_probe':
>> drivers/mmc/host/sdhci-of-aspeed.c:533:17: error: implicit declaration of function 'reset_control_get_optional_exclusive' [-Wimplicit-function-declaration]
     533 |         reset = reset_control_get_optional_exclusive(&pdev->dev, NULL);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mmc/host/sdhci-of-aspeed.c:533:15: error: assignment to 'struct reset_control *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     533 |         reset = reset_control_get_optional_exclusive(&pdev->dev, NULL);
         |               ^
>> drivers/mmc/host/sdhci-of-aspeed.c:537:15: error: implicit declaration of function 'reset_control_deassert' [-Wimplicit-function-declaration]
     537 |         ret = reset_control_deassert(sdc->rst);
         |               ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/mmc/host/sdhci-of-aspeed.c:537:41: error: 'struct aspeed_sdc' has no member named 'rst'
     537 |         ret = reset_control_deassert(sdc->rst);
         |                                         ^~


vim +/reset_control_get_optional_exclusive +533 drivers/mmc/host/sdhci-of-aspeed.c

   520	
   521	{
   522		struct device_node *parent, *child;
   523		struct reset_control *reset;
   524		struct aspeed_sdc *sdc;
   525		int ret;
   526	
   527		sdc = devm_kzalloc(&pdev->dev, sizeof(*sdc), GFP_KERNEL);
   528		if (!sdc)
   529			return -ENOMEM;
   530	
   531		spin_lock_init(&sdc->lock);
   532	
 > 533		reset = reset_control_get_optional_exclusive(&pdev->dev, NULL);
   534		if (IS_ERR(reset))
   535			return dev_err_probe(&pdev->dev, PTR_ERR(reset),
   536					     "unable to acquire reset\n");
 > 537		ret = reset_control_deassert(sdc->rst);
   538		if (ret)
   539			return dev_err_probe(&pdev->dev, ret,
   540					     "reset deassert failed\n");
   541	
   542		sdc->clk = devm_clk_get(&pdev->dev, NULL);
   543		if (IS_ERR(sdc->clk))
   544			return PTR_ERR(sdc->clk);
   545	
   546		ret = clk_prepare_enable(sdc->clk);
   547		if (ret) {
   548			dev_err(&pdev->dev, "Unable to enable SDCLK\n");
   549			return ret;
   550		}
   551	
   552		sdc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &sdc->res);
   553		if (IS_ERR(sdc->regs)) {
   554			ret = PTR_ERR(sdc->regs);
   555			goto err_clk;
   556		}
   557	
   558		dev_set_drvdata(&pdev->dev, sdc);
   559	
   560		parent = pdev->dev.of_node;
   561		for_each_available_child_of_node(parent, child) {
   562			struct platform_device *cpdev;
   563	
   564			cpdev = of_platform_device_create(child, NULL, &pdev->dev);
   565			if (!cpdev) {
   566				of_node_put(child);
   567				ret = -ENODEV;
   568				goto err_clk;
   569			}
   570		}
   571	
   572		return 0;
   573	
   574	err_clk:
   575		clk_disable_unprepare(sdc->clk);
   576		return ret;
   577	}
   578	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH 2/2] mmc: sdhci-of-aspeed: Add ast2700 support
Posted by Krzysztof Kozlowski 3 weeks, 3 days ago
On Fri, Mar 13, 2026 at 01:27:57PM +0800, Ryan Chen wrote:
> Add support for the AST2700 SOC in the sd controller driver. AST2700 sd
> controller requires an reset line, so hook up the optional reset control
> and deassert it during probe.
> 
> Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
> ---
>  drivers/mmc/host/sdhci-of-aspeed.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index ca97b01996b1..91c36245e506 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -520,6 +520,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 +530,15 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
>  
>  	spin_lock_init(&sdc->lock);
>  
> +	reset = reset_control_get_optional_exclusive(&pdev->dev, NULL);
> +	if (IS_ERR(reset))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(reset),
> +				     "unable to acquire reset\n");
> +	ret = reset_control_deassert(sdc->rst);
> +	if (ret)
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "reset deassert failed\n");
> +
>  	sdc->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(sdc->clk))
>  		return PTR_ERR(sdc->clk);
> @@ -577,6 +587,7 @@ static const struct of_device_id aspeed_sdc_of_match[] = {
>  	{ .compatible = "aspeed,ast2400-sd-controller", },
>  	{ .compatible = "aspeed,ast2500-sd-controller", },
>  	{ .compatible = "aspeed,ast2600-sd-controller", },
> +	{ .compatible = "aspeed,ast2700-sd-controller", },

So devices are fully compatible. You must express it in the bindings and
drop this hunk.

Best regards,
Krzysztof
Re: [PATCH 2/2] mmc: sdhci-of-aspeed: Add ast2700 support
Posted by Philipp Zabel 3 weeks, 4 days ago
On Fr, 2026-03-13 at 13:27 +0800, Ryan Chen wrote:
> Add support for the AST2700 SOC in the sd controller driver. AST2700 sd
> controller requires an reset line, so hook up the optional reset control
> and deassert it during probe.
> 
> Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
> ---
>  drivers/mmc/host/sdhci-of-aspeed.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index ca97b01996b1..91c36245e506 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -520,6 +520,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 +530,15 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
>  
>  	spin_lock_init(&sdc->lock);
>  
> +	reset = reset_control_get_optional_exclusive(&pdev->dev, NULL);

This is missing a reset_control_put() in aspeed_sdc_remove(). Or use
devm_reset_control_get_optional_exclusive().

Is it ok to assert this reset control in _remove()? If so, you could
use devm_reset_control_get_optional_exclusive_deasserted().


regards
Philipp