public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc
@ 2026-01-23 12:24 Shawn Lin
  2026-01-23 12:24 ` [PATCH v2 1/3] arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias Shawn Lin
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Shawn Lin @ 2026-01-23 12:24 UTC (permalink / raw)
  To: Ulf Hansson, Wei Xu
  Cc: linux-mmc, devicetree, linux-arm-kernel, Jaehoon Chung, Shawn Lin


The support for the mshc alias has long been deprecated[1], as the mmc core
already provides standard alias support for obtaining the controller ID[2].
With mshc aliases removed from the last Rk3036 plaform[3], the only remaining
users are the HiSilicon hi3660-hikey960 and hi3670-hikey970 boards. This patch
series removes support for mshc from the dwmmc driver and updates the DTS files
for the hi3660-hikey960 and hi3670-hikey970 to use the standard mmc alias instead.
Considering that the hikey960 and hikey970 are open development boards, users are
expected to use newer kernels, and the need to adapt old DTBs to new kernels is
relatively low. Therefore, backward compatibility of DTBs is likely not a major
concern here.

[1] https://lore.kernel.org/linux-rockchip/20211124184603.3897245-1-john@metanate.com/
[2] Documentation/devicetree/bindings/mmc/mmc-controller.yaml
[3] https://lore.kernel.org/linux-rockchip/c6feab79-5b73-413b-a94f-9d1b2fa6df43@gmail.com/


Changes in v2:
- Fix a warning(lkp)
- reorder patch sequence

Shawn Lin (3):
  arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias
  mmc: dw_mmc-k3: Remove mshc alias support
  mmc: dw_mmc: Remove mshc alias support

 arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |  4 ++--
 arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts |  4 ++--
 drivers/mmc/host/dw_mmc-k3.c                      | 23 ++++++++---------------
 drivers/mmc/host/dw_mmc.c                         |  9 +++------
 4 files changed, 15 insertions(+), 25 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias
  2026-01-23 12:24 [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Shawn Lin
@ 2026-01-23 12:24 ` Shawn Lin
  2026-01-26 12:08   ` Wei Xu
  2026-01-23 12:24 ` [PATCH v2 2/3] mmc: dw_mmc-k3: Remove mshc alias support Shawn Lin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Shawn Lin @ 2026-01-23 12:24 UTC (permalink / raw)
  To: Ulf Hansson, Wei Xu
  Cc: linux-mmc, devicetree, linux-arm-kernel, Jaehoon Chung, Shawn Lin

Convert the long-deprecated mshc alias to standard mmc alias.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

Changes in v2: None

 arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 4 ++--
 arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
index ed84ab9..c6056a8 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
@@ -20,8 +20,8 @@
 	compatible = "hisilicon,hi3660-hikey960", "hisilicon,hi3660";
 
 	aliases {
-		mshc1 = &dwmmc1;
-		mshc2 = &dwmmc2;
+		mmc1 = &dwmmc1;
+		mmc2 = &dwmmc2;
 		serial0 = &uart0;
 		serial1 = &uart1;
 		serial2 = &uart2;
diff --git a/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts b/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
index 7c32f5f..65764b3 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
@@ -19,8 +19,8 @@
 	compatible = "hisilicon,hi3670-hikey970", "hisilicon,hi3670";
 
 	aliases {
-		mshc1 = &dwmmc1;
-		mshc2 = &dwmmc2;
+		mmc1 = &dwmmc1;
+		mmc2 = &dwmmc2;
 		serial0 = &uart0;
 		serial1 = &uart1;
 		serial2 = &uart2;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] mmc: dw_mmc-k3: Remove mshc alias support
  2026-01-23 12:24 [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Shawn Lin
  2026-01-23 12:24 ` [PATCH v2 1/3] arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias Shawn Lin
@ 2026-01-23 12:24 ` Shawn Lin
  2026-01-23 12:24 ` [PATCH v2 3/3] mmc: dw_mmc: " Shawn Lin
  2026-01-27 11:01 ` [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Ulf Hansson
  3 siblings, 0 replies; 6+ messages in thread
From: Shawn Lin @ 2026-01-23 12:24 UTC (permalink / raw)
  To: Ulf Hansson, Wei Xu
  Cc: linux-mmc, devicetree, linux-arm-kernel, Jaehoon Chung, Shawn Lin

Remove the long-deprecated mshc alias support, as the mmc core already
provides alias functionality through the standard mmc alias. This eliminates
the redundant dual-alias system. The driver now obtains the controller ID
from struct mmc_host::index(supplied by mmc alias) instead of the legacy mshc
alias.

dw_mci_hi6220_parse_dt() which parse mshc alias is used for hi6220, hi3660 and
hi3670. Given hi6220 never assigned mshc alias on the DTS files, and hi3360
and hi3670 share the same code, so with it removed, add a return value to
dw_mci_hs_set_timing() and let dw_mci_hi3660_init() check if index exceeds
TIMING_MODE in the firs place to bail out early, the same as before.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

Changes in v2:
- Fix a warning(lkp)

 drivers/mmc/host/dw_mmc-k3.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c
index 23c3031..e7b3613 100644
--- a/drivers/mmc/host/dw_mmc-k3.c
+++ b/drivers/mmc/host/dw_mmc-k3.c
@@ -53,7 +53,6 @@
 #define USE_DLY_MAX_SMPL (14)
 
 struct k3_priv {
-	int ctrl_id;
 	u32 cur_speed;
 	struct regmap	*reg;
 };
@@ -127,13 +126,6 @@ static int dw_mci_hi6220_parse_dt(struct dw_mci *host)
 	if (IS_ERR(priv->reg))
 		priv->reg = NULL;
 
-	priv->ctrl_id = of_alias_get_id(host->dev->of_node, "mshc");
-	if (priv->ctrl_id < 0)
-		priv->ctrl_id = 0;
-
-	if (priv->ctrl_id >= TIMING_MODE)
-		return -EINVAL;
-
 	host->priv = priv;
 	return 0;
 }
@@ -211,7 +203,7 @@ static const struct dw_mci_drv_data hi6220_data = {
 	.execute_tuning		= dw_mci_hi6220_execute_tuning,
 };
 
-static void dw_mci_hs_set_timing(struct dw_mci *host, int timing,
+static int dw_mci_hs_set_timing(struct dw_mci *host, int timing,
 				     int smpl_phase)
 {
 	u32 drv_phase;
@@ -220,10 +212,10 @@ static void dw_mci_hs_set_timing(struct dw_mci *host, int timing,
 	u32 enable_shift = 0;
 	u32 reg_value;
 	int ctrl_id;
-	struct k3_priv *priv;
 
-	priv = host->priv;
-	ctrl_id = priv->ctrl_id;
+	ctrl_id = host->mmc->index;
+	if (ctrl_id >= TIMING_MODE)
+		return -EINVAL;
 
 	drv_phase = hs_timing_cfg[ctrl_id][timing].drv_phase;
 	smpl_dly   = hs_timing_cfg[ctrl_id][timing].smpl_dly;
@@ -260,6 +252,8 @@ static void dw_mci_hs_set_timing(struct dw_mci *host, int timing,
 
 	/* We should delay 1ms wait for timing setting finished. */
 	usleep_range(1000, 2000);
+
+	return 0;
 }
 
 static int dw_mci_hi3660_init(struct dw_mci *host)
@@ -267,10 +261,9 @@ static int dw_mci_hi3660_init(struct dw_mci *host)
 	mci_writel(host, CDTHRCTL, SDMMC_SET_THLD(SDCARD_RD_THRESHOLD,
 		    SDMMC_CARD_RD_THR_EN));
 
-	dw_mci_hs_set_timing(host, MMC_TIMING_LEGACY, -1);
 	host->bus_hz /= (GENCLK_DIV + 1);
 
-	return 0;
+	return dw_mci_hs_set_timing(host, MMC_TIMING_LEGACY, -1);
 }
 
 static int dw_mci_set_sel18(struct dw_mci *host, bool set)
@@ -407,7 +400,7 @@ static int dw_mci_hi3660_switch_voltage(struct dw_mci *host,
 	if (!priv || !priv->reg)
 		return 0;
 
-	if (priv->ctrl_id == DWMMC_SDIO_ID)
+	if (mmc->index == DWMMC_SDIO_ID)
 		return 0;
 
 	if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] mmc: dw_mmc: Remove mshc alias support
  2026-01-23 12:24 [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Shawn Lin
  2026-01-23 12:24 ` [PATCH v2 1/3] arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias Shawn Lin
  2026-01-23 12:24 ` [PATCH v2 2/3] mmc: dw_mmc-k3: Remove mshc alias support Shawn Lin
@ 2026-01-23 12:24 ` Shawn Lin
  2026-01-27 11:01 ` [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Ulf Hansson
  3 siblings, 0 replies; 6+ messages in thread
From: Shawn Lin @ 2026-01-23 12:24 UTC (permalink / raw)
  To: Ulf Hansson, Wei Xu
  Cc: linux-mmc, devicetree, linux-arm-kernel, Jaehoon Chung, Shawn Lin

Remove the long-deprecated mshc alias support, as the mmc core already
provides alias functionality through the standard mmc alias. This eliminates
the redundant dual-alias system. The driver now obtains the controller ID
from struct mmc_host::index(supplied by mmc alias) instead of the legacy mshc
alias.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

Changes in v2: None

 drivers/mmc/host/dw_mmc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index a328a36..8cbaa9e 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2846,13 +2846,10 @@ static int dw_mci_init_host_caps(struct dw_mci *host)
 	if (drv_data)
 		mmc->caps |= drv_data->common_caps;
 
-	if (host->dev->of_node) {
-		ctrl_id = of_alias_get_id(host->dev->of_node, "mshc");
-		if (ctrl_id < 0)
-			ctrl_id = 0;
-	} else {
+	if (host->dev->of_node)
+		ctrl_id = mmc->index;
+	else
 		ctrl_id = to_platform_device(host->dev)->id;
-	}
 
 	if (drv_data && drv_data->caps) {
 		if (ctrl_id >= drv_data->num_caps) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/3] arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias
  2026-01-23 12:24 ` [PATCH v2 1/3] arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias Shawn Lin
@ 2026-01-26 12:08   ` Wei Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Xu @ 2026-01-26 12:08 UTC (permalink / raw)
  To: Shawn Lin, Ulf Hansson
  Cc: linux-mmc, devicetree, linux-arm-kernel, Jaehoon Chung, xuwei5

Hi Shawn,

On 2026/1/23 20:24, Shawn Lin wrote:
> Convert the long-deprecated mshc alias to standard mmc alias.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

LGTM,

Reviewed-by: Wei Xu <xuwei5@hisilicon.com>

Thanks!
Best Regards,
Wei

> ---
> 
> Changes in v2: None
> 
>  arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 4 ++--
>  arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
> index ed84ab9..c6056a8 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
> @@ -20,8 +20,8 @@
>  	compatible = "hisilicon,hi3660-hikey960", "hisilicon,hi3660";
>  
>  	aliases {
> -		mshc1 = &dwmmc1;
> -		mshc2 = &dwmmc2;
> +		mmc1 = &dwmmc1;
> +		mmc2 = &dwmmc2;
>  		serial0 = &uart0;
>  		serial1 = &uart1;
>  		serial2 = &uart2;
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts b/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
> index 7c32f5f..65764b3 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
> +++ b/arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
> @@ -19,8 +19,8 @@
>  	compatible = "hisilicon,hi3670-hikey970", "hisilicon,hi3670";
>  
>  	aliases {
> -		mshc1 = &dwmmc1;
> -		mshc2 = &dwmmc2;
> +		mmc1 = &dwmmc1;
> +		mmc2 = &dwmmc2;
>  		serial0 = &uart0;
>  		serial1 = &uart1;
>  		serial2 = &uart2;
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc
  2026-01-23 12:24 [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Shawn Lin
                   ` (2 preceding siblings ...)
  2026-01-23 12:24 ` [PATCH v2 3/3] mmc: dw_mmc: " Shawn Lin
@ 2026-01-27 11:01 ` Ulf Hansson
  3 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2026-01-27 11:01 UTC (permalink / raw)
  To: Shawn Lin; +Cc: Wei Xu, linux-mmc, devicetree, linux-arm-kernel, Jaehoon Chung

On Fri, 23 Jan 2026 at 13:24, Shawn Lin <shawn.lin@rock-chips.com> wrote:
>
>
> The support for the mshc alias has long been deprecated[1], as the mmc core
> already provides standard alias support for obtaining the controller ID[2].
> With mshc aliases removed from the last Rk3036 plaform[3], the only remaining
> users are the HiSilicon hi3660-hikey960 and hi3670-hikey970 boards. This patch
> series removes support for mshc from the dwmmc driver and updates the DTS files
> for the hi3660-hikey960 and hi3670-hikey970 to use the standard mmc alias instead.
> Considering that the hikey960 and hikey970 are open development boards, users are
> expected to use newer kernels, and the need to adapt old DTBs to new kernels is
> relatively low. Therefore, backward compatibility of DTBs is likely not a major
> concern here.
>
> [1] https://lore.kernel.org/linux-rockchip/20211124184603.3897245-1-john@metanate.com/
> [2] Documentation/devicetree/bindings/mmc/mmc-controller.yaml
> [3] https://lore.kernel.org/linux-rockchip/c6feab79-5b73-413b-a94f-9d1b2fa6df43@gmail.com/
>
>
> Changes in v2:
> - Fix a warning(lkp)
> - reorder patch sequence
>
> Shawn Lin (3):
>   arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias
>   mmc: dw_mmc-k3: Remove mshc alias support
>   mmc: dw_mmc: Remove mshc alias support
>
>  arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |  4 ++--
>  arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts |  4 ++--
>  drivers/mmc/host/dw_mmc-k3.c                      | 23 ++++++++---------------
>  drivers/mmc/host/dw_mmc.c                         |  9 +++------
>  4 files changed, 15 insertions(+), 25 deletions(-)
>
> --
> 2.7.4
>

The series applied for next, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-27 11:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 12:24 [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Shawn Lin
2026-01-23 12:24 ` [PATCH v2 1/3] arm64: dts: hisilicon: hikey960/970: Convert to use standard mmc alias Shawn Lin
2026-01-26 12:08   ` Wei Xu
2026-01-23 12:24 ` [PATCH v2 2/3] mmc: dw_mmc-k3: Remove mshc alias support Shawn Lin
2026-01-23 12:24 ` [PATCH v2 3/3] mmc: dw_mmc: " Shawn Lin
2026-01-27 11:01 ` [PATCH v2 0/3] Remove deprecated mshc alias support from dw_mmc Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox