linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases
@ 2021-11-24 18:45 John Keeping
  2021-11-24 18:45 ` [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps John Keeping
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: John Keeping @ 2021-11-24 18:45 UTC (permalink / raw)
  To: linux-mmc
  Cc: John Keeping, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc, Ulf Hansson

This series is prompted by discussion on a previous patch set [1] but is
a totally different approach and only a partial solution.

With these patches, the dependency on the mshcN alias is totally removed
from dw_mmc-hi3798cv200 and dw_mmc-rockchip and dw_mmc-exynos moves
towards being able to consider the mshcN aliases deprecated.

I haven't changed dw_mci_hi6220_caps here, although it looks like it's
possible to apply MMC_CAP_CMD23 to all controllers there with no change
in behaviour as the final entry is SDIO for which CMD23 is not
applicable IIUC.  But I'm not familiar with that hardware and don't feel
confident making that change.

[1] https://lore.kernel.org/all/20211116190244.1417591-1-john@metanate.com/

John Keeping (4):
  mmc: dw_mmc: add common capabilities to replace caps
  mmc: dw_mmc: hi3798cv200: use common_caps
  mmc: dw_mmc: rockchip: use common_caps
  mmc: dw_mmc: exynos: use common_caps

 drivers/mmc/host/dw_mmc-exynos.c      |  9 +++++----
 drivers/mmc/host/dw_mmc-hi3798cv200.c |  9 +--------
 drivers/mmc/host/dw_mmc-rockchip.c    | 11 +----------
 drivers/mmc/host/dw_mmc.c             |  3 +++
 drivers/mmc/host/dw_mmc.h             |  3 +++
 5 files changed, 13 insertions(+), 22 deletions(-)

-- 
2.34.0


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

* [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps
  2021-11-24 18:45 [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases John Keeping
@ 2021-11-24 18:45 ` John Keeping
  2021-11-25 23:37   ` Jaehoon Chung
  2021-11-24 18:46 ` [PATCH 2/4] mmc: dw_mmc: hi3798cv200: use common_caps John Keeping
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: John Keeping @ 2021-11-24 18:45 UTC (permalink / raw)
  To: linux-mmc
  Cc: John Keeping, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc, Ulf Hansson

The caps field depends on the mshcN alias ID but for some devices this
is unnecessary as the capabilities are the same for all instances
sharing the same compatible.

Add a common_caps field for this case which updates the host's
capabilities without needing the mshcN alias ID.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/mmc/host/dw_mmc.c | 3 +++
 drivers/mmc/host/dw_mmc.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 195f2b2434b0..f2a14a434bef 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2856,6 +2856,9 @@ static int dw_mci_init_slot_caps(struct dw_mci_slot *slot)
 	if (host->pdata->pm_caps)
 		mmc->pm_caps = host->pdata->pm_caps;
 
+	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)
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index ce05d81477d9..771d5afa3136 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -550,6 +550,8 @@ struct dw_mci_slot {
  * dw_mci driver data - dw-mshc implementation specific driver data.
  * @caps: mmc subsystem specified capabilities of the controller(s).
  * @num_caps: number of capabilities specified by @caps.
+ * @common_caps: mmc subsystem specified capabilities applicable to all of
+ *	the controllers
  * @init: early implementation specific initialization.
  * @set_ios: handle bus specific extensions.
  * @parse_dt: parse implementation specific device tree properties.
@@ -562,6 +564,7 @@ struct dw_mci_slot {
 struct dw_mci_drv_data {
 	unsigned long	*caps;
 	u32		num_caps;
+	u32		common_caps;
 	int		(*init)(struct dw_mci *host);
 	void		(*set_ios)(struct dw_mci *host, struct mmc_ios *ios);
 	int		(*parse_dt)(struct dw_mci *host);
-- 
2.34.0


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

* [PATCH 2/4] mmc: dw_mmc: hi3798cv200: use common_caps
  2021-11-24 18:45 [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases John Keeping
  2021-11-24 18:45 ` [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps John Keeping
@ 2021-11-24 18:46 ` John Keeping
  2021-11-25 23:37   ` Jaehoon Chung
  2021-11-24 18:46 ` [PATCH 3/4] mmc: dw_mmc: rockchip: " John Keeping
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: John Keeping @ 2021-11-24 18:46 UTC (permalink / raw)
  To: linux-mmc
  Cc: John Keeping, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc, Ulf Hansson

The capabilities for all instances are the same, so use common_caps
instead of caps/num_caps to remove the dependency on the mshcN device
tree alias.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/mmc/host/dw_mmc-hi3798cv200.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-hi3798cv200.c b/drivers/mmc/host/dw_mmc-hi3798cv200.c
index 39794f93826f..e9437ef8ef19 100644
--- a/drivers/mmc/host/dw_mmc-hi3798cv200.c
+++ b/drivers/mmc/host/dw_mmc-hi3798cv200.c
@@ -23,12 +23,6 @@ struct hi3798cv200_priv {
 	struct clk *drive_clk;
 };
 
-static unsigned long dw_mci_hi3798cv200_caps[] = {
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23
-};
-
 static void dw_mci_hi3798cv200_set_ios(struct dw_mci *host, struct mmc_ios *ios)
 {
 	struct hi3798cv200_priv *priv = host->priv;
@@ -166,8 +160,7 @@ static int dw_mci_hi3798cv200_init(struct dw_mci *host)
 }
 
 static const struct dw_mci_drv_data hi3798cv200_data = {
-	.caps = dw_mci_hi3798cv200_caps,
-	.num_caps = ARRAY_SIZE(dw_mci_hi3798cv200_caps),
+	.common_caps = MMC_CAP_CMD23,
 	.init = dw_mci_hi3798cv200_init,
 	.set_ios = dw_mci_hi3798cv200_set_ios,
 	.execute_tuning = dw_mci_hi3798cv200_execute_tuning,
-- 
2.34.0


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

* [PATCH 3/4] mmc: dw_mmc: rockchip: use common_caps
  2021-11-24 18:45 [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases John Keeping
  2021-11-24 18:45 ` [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps John Keeping
  2021-11-24 18:46 ` [PATCH 2/4] mmc: dw_mmc: hi3798cv200: use common_caps John Keeping
@ 2021-11-24 18:46 ` John Keeping
  2021-11-25 23:37   ` Jaehoon Chung
  2021-11-24 18:46 ` [PATCH 4/4] mmc: dw_mmc: exynos: " John Keeping
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: John Keeping @ 2021-11-24 18:46 UTC (permalink / raw)
  To: linux-mmc
  Cc: John Keeping, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc, Ulf Hansson

The capabilities for all instances are the same, so use common_caps
instead of caps/num_caps to remove the dependency on the mshcN device
tree alias.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/mmc/host/dw_mmc-rockchip.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
index d36991acd6df..95d0ec0f5f3a 100644
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -300,21 +300,12 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
 	return 0;
 }
 
-/* Common capabilities of RK3288 SoC */
-static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-};
-
 static const struct dw_mci_drv_data rk2928_drv_data = {
 	.init			= dw_mci_rockchip_init,
 };
 
 static const struct dw_mci_drv_data rk3288_drv_data = {
-	.caps			= dw_mci_rk3288_dwmmc_caps,
-	.num_caps		= ARRAY_SIZE(dw_mci_rk3288_dwmmc_caps),
+	.common_caps		= MMC_CAP_CMD23,
 	.set_ios		= dw_mci_rk3288_set_ios,
 	.execute_tuning		= dw_mci_rk3288_execute_tuning,
 	.parse_dt		= dw_mci_rk3288_parse_dt,
-- 
2.34.0


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

* [PATCH 4/4] mmc: dw_mmc: exynos: use common_caps
  2021-11-24 18:45 [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases John Keeping
                   ` (2 preceding siblings ...)
  2021-11-24 18:46 ` [PATCH 3/4] mmc: dw_mmc: rockchip: " John Keeping
@ 2021-11-24 18:46 ` John Keeping
  2021-11-25 23:38   ` Jaehoon Chung
  2021-11-24 19:24 ` [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases Ulf Hansson
  2021-11-25 11:48 ` Nicolas Frattaroli
  5 siblings, 1 reply; 13+ messages in thread
From: John Keeping @ 2021-11-24 18:46 UTC (permalink / raw)
  To: linux-mmc
  Cc: John Keeping, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc, Ulf Hansson

Move the common MMC_CAP_CMD23 capability to common_caps so that only the
special case of MMC_CAP_1_8V_DDR and MMC_CAP_8_BIT_DATA are set via
caps/num_caps.  Both of those can, and should, be set via device tree
properties instead, so we can now say that exynos_dwmmc_caps is only
used for backwards compatibility.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/mmc/host/dw_mmc-exynos.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index c2dd29ef45c6..f76eeeb0cc53 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -526,15 +526,16 @@ static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host,
 
 /* Common capabilities of Exynos4/Exynos5 SoC */
 static unsigned long exynos_dwmmc_caps[4] = {
-	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
-	MMC_CAP_CMD23,
+	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA,
+	0,
+	0,
+	0,
 };
 
 static const struct dw_mci_drv_data exynos_drv_data = {
 	.caps			= exynos_dwmmc_caps,
 	.num_caps		= ARRAY_SIZE(exynos_dwmmc_caps),
+	.common_caps		= MMC_CAP_CMD23,
 	.init			= dw_mci_exynos_priv_init,
 	.set_ios		= dw_mci_exynos_set_ios,
 	.parse_dt		= dw_mci_exynos_parse_dt,
-- 
2.34.0


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

* Re: [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases
  2021-11-24 18:45 [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases John Keeping
                   ` (3 preceding siblings ...)
  2021-11-24 18:46 ` [PATCH 4/4] mmc: dw_mmc: exynos: " John Keeping
@ 2021-11-24 19:24 ` Ulf Hansson
  2021-11-26 13:31   ` Ulf Hansson
  2021-11-25 11:48 ` Nicolas Frattaroli
  5 siblings, 1 reply; 13+ messages in thread
From: Ulf Hansson @ 2021-11-24 19:24 UTC (permalink / raw)
  To: John Keeping
  Cc: linux-mmc, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc

On Wed, 24 Nov 2021 at 19:46, John Keeping <john@metanate.com> wrote:
>
> This series is prompted by discussion on a previous patch set [1] but is
> a totally different approach and only a partial solution.
>
> With these patches, the dependency on the mshcN alias is totally removed
> from dw_mmc-hi3798cv200 and dw_mmc-rockchip and dw_mmc-exynos moves
> towards being able to consider the mshcN aliases deprecated.
>
> I haven't changed dw_mci_hi6220_caps here, although it looks like it's
> possible to apply MMC_CAP_CMD23 to all controllers there with no change
> in behaviour as the final entry is SDIO for which CMD23 is not
> applicable IIUC.  But I'm not familiar with that hardware and don't feel
> confident making that change.
>
> [1] https://lore.kernel.org/all/20211116190244.1417591-1-john@metanate.com/
>
> John Keeping (4):
>   mmc: dw_mmc: add common capabilities to replace caps
>   mmc: dw_mmc: hi3798cv200: use common_caps
>   mmc: dw_mmc: rockchip: use common_caps
>   mmc: dw_mmc: exynos: use common_caps
>
>  drivers/mmc/host/dw_mmc-exynos.c      |  9 +++++----
>  drivers/mmc/host/dw_mmc-hi3798cv200.c |  9 +--------
>  drivers/mmc/host/dw_mmc-rockchip.c    | 11 +----------
>  drivers/mmc/host/dw_mmc.c             |  3 +++
>  drivers/mmc/host/dw_mmc.h             |  3 +++
>  5 files changed, 13 insertions(+), 22 deletions(-)
>
> --
> 2.34.0
>

This looks good to me, I intend to apply this later this week, unless
objections of course.

In the meantime, I will continue to look at what we can do to resolve
the exynos/k3 issues around this.

Kind regards
Uffe

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

* Re: [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases
  2021-11-24 18:45 [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases John Keeping
                   ` (4 preceding siblings ...)
  2021-11-24 19:24 ` [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases Ulf Hansson
@ 2021-11-25 11:48 ` Nicolas Frattaroli
  5 siblings, 0 replies; 13+ messages in thread
From: Nicolas Frattaroli @ 2021-11-25 11:48 UTC (permalink / raw)
  To: linux-mmc, linux-rockchip
  Cc: John Keeping, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc, Ulf Hansson, John Keeping

On Mittwoch, 24. November 2021 19:45:58 CET John Keeping wrote:
> This series is prompted by discussion on a previous patch set [1] but is
> a totally different approach and only a partial solution.
> 
> With these patches, the dependency on the mshcN alias is totally removed
> from dw_mmc-hi3798cv200 and dw_mmc-rockchip and dw_mmc-exynos moves
> towards being able to consider the mshcN aliases deprecated.
> 
> I haven't changed dw_mci_hi6220_caps here, although it looks like it's
> possible to apply MMC_CAP_CMD23 to all controllers there with no change
> in behaviour as the final entry is SDIO for which CMD23 is not
> applicable IIUC.  But I'm not familiar with that hardware and don't feel
> confident making that change.
> 
> [1] https://lore.kernel.org/all/20211116190244.1417591-1-john@metanate.com/
> 
> John Keeping (4):
>   mmc: dw_mmc: add common capabilities to replace caps
>   mmc: dw_mmc: hi3798cv200: use common_caps
>   mmc: dw_mmc: rockchip: use common_caps
>   mmc: dw_mmc: exynos: use common_caps
> 
>  drivers/mmc/host/dw_mmc-exynos.c      |  9 +++++----
>  drivers/mmc/host/dw_mmc-hi3798cv200.c |  9 +--------
>  drivers/mmc/host/dw_mmc-rockchip.c    | 11 +----------
>  drivers/mmc/host/dw_mmc.c             |  3 +++
>  drivers/mmc/host/dw_mmc.h             |  3 +++
>  5 files changed, 13 insertions(+), 22 deletions(-)
> 
> 

For rockchip:

Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>

Tested on a rk3566 with no obvious issues arising.

Regards,
Nicolas Frattaroli



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

* Re: [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps
  2021-11-24 18:45 ` [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps John Keeping
@ 2021-11-25 23:37   ` Jaehoon Chung
  0 siblings, 0 replies; 13+ messages in thread
From: Jaehoon Chung @ 2021-11-25 23:37 UTC (permalink / raw)
  To: John Keeping, linux-mmc
  Cc: Heiko Stuebner, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel, linux-rockchip, linux-samsung-soc, Ulf Hansson

On 11/25/21 3:45 AM, John Keeping wrote:
> The caps field depends on the mshcN alias ID but for some devices this
> is unnecessary as the capabilities are the same for all instances
> sharing the same compatible.
> 
> Add a common_caps field for this case which updates the host's
> capabilities without needing the mshcN alias ID.
> 
> Signed-off-by: John Keeping <john@metanate.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/host/dw_mmc.c | 3 +++
>  drivers/mmc/host/dw_mmc.h | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 195f2b2434b0..f2a14a434bef 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -2856,6 +2856,9 @@ static int dw_mci_init_slot_caps(struct dw_mci_slot *slot)
>  	if (host->pdata->pm_caps)
>  		mmc->pm_caps = host->pdata->pm_caps;
>  
> +	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)
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index ce05d81477d9..771d5afa3136 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -550,6 +550,8 @@ struct dw_mci_slot {
>   * dw_mci driver data - dw-mshc implementation specific driver data.
>   * @caps: mmc subsystem specified capabilities of the controller(s).
>   * @num_caps: number of capabilities specified by @caps.
> + * @common_caps: mmc subsystem specified capabilities applicable to all of
> + *	the controllers
>   * @init: early implementation specific initialization.
>   * @set_ios: handle bus specific extensions.
>   * @parse_dt: parse implementation specific device tree properties.
> @@ -562,6 +564,7 @@ struct dw_mci_slot {
>  struct dw_mci_drv_data {
>  	unsigned long	*caps;
>  	u32		num_caps;
> +	u32		common_caps;
>  	int		(*init)(struct dw_mci *host);
>  	void		(*set_ios)(struct dw_mci *host, struct mmc_ios *ios);
>  	int		(*parse_dt)(struct dw_mci *host);
> 


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

* Re: [PATCH 2/4] mmc: dw_mmc: hi3798cv200: use common_caps
  2021-11-24 18:46 ` [PATCH 2/4] mmc: dw_mmc: hi3798cv200: use common_caps John Keeping
@ 2021-11-25 23:37   ` Jaehoon Chung
  0 siblings, 0 replies; 13+ messages in thread
From: Jaehoon Chung @ 2021-11-25 23:37 UTC (permalink / raw)
  To: John Keeping, linux-mmc
  Cc: Heiko Stuebner, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel, linux-rockchip, linux-samsung-soc, Ulf Hansson

On 11/25/21 3:46 AM, John Keeping wrote:
> The capabilities for all instances are the same, so use common_caps
> instead of caps/num_caps to remove the dependency on the mshcN device
> tree alias.
> 
> Signed-off-by: John Keeping <john@metanate.com>


Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/host/dw_mmc-hi3798cv200.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-hi3798cv200.c b/drivers/mmc/host/dw_mmc-hi3798cv200.c
> index 39794f93826f..e9437ef8ef19 100644
> --- a/drivers/mmc/host/dw_mmc-hi3798cv200.c
> +++ b/drivers/mmc/host/dw_mmc-hi3798cv200.c
> @@ -23,12 +23,6 @@ struct hi3798cv200_priv {
>  	struct clk *drive_clk;
>  };
>  
> -static unsigned long dw_mci_hi3798cv200_caps[] = {
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23
> -};
> -
>  static void dw_mci_hi3798cv200_set_ios(struct dw_mci *host, struct mmc_ios *ios)
>  {
>  	struct hi3798cv200_priv *priv = host->priv;
> @@ -166,8 +160,7 @@ static int dw_mci_hi3798cv200_init(struct dw_mci *host)
>  }
>  
>  static const struct dw_mci_drv_data hi3798cv200_data = {
> -	.caps = dw_mci_hi3798cv200_caps,
> -	.num_caps = ARRAY_SIZE(dw_mci_hi3798cv200_caps),
> +	.common_caps = MMC_CAP_CMD23,
>  	.init = dw_mci_hi3798cv200_init,
>  	.set_ios = dw_mci_hi3798cv200_set_ios,
>  	.execute_tuning = dw_mci_hi3798cv200_execute_tuning,
> 


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

* Re: [PATCH 3/4] mmc: dw_mmc: rockchip: use common_caps
  2021-11-24 18:46 ` [PATCH 3/4] mmc: dw_mmc: rockchip: " John Keeping
@ 2021-11-25 23:37   ` Jaehoon Chung
  0 siblings, 0 replies; 13+ messages in thread
From: Jaehoon Chung @ 2021-11-25 23:37 UTC (permalink / raw)
  To: John Keeping, linux-mmc
  Cc: Heiko Stuebner, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel, linux-rockchip, linux-samsung-soc, Ulf Hansson

On 11/25/21 3:46 AM, John Keeping wrote:
> The capabilities for all instances are the same, so use common_caps
> instead of caps/num_caps to remove the dependency on the mshcN device
> tree alias.
> 
> Signed-off-by: John Keeping <john@metanate.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/host/dw_mmc-rockchip.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
> index d36991acd6df..95d0ec0f5f3a 100644
> --- a/drivers/mmc/host/dw_mmc-rockchip.c
> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
> @@ -300,21 +300,12 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>  	return 0;
>  }
>  
> -/* Common capabilities of RK3288 SoC */
> -static unsigned long dw_mci_rk3288_dwmmc_caps[4] = {
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -};
> -
>  static const struct dw_mci_drv_data rk2928_drv_data = {
>  	.init			= dw_mci_rockchip_init,
>  };
>  
>  static const struct dw_mci_drv_data rk3288_drv_data = {
> -	.caps			= dw_mci_rk3288_dwmmc_caps,
> -	.num_caps		= ARRAY_SIZE(dw_mci_rk3288_dwmmc_caps),
> +	.common_caps		= MMC_CAP_CMD23,
>  	.set_ios		= dw_mci_rk3288_set_ios,
>  	.execute_tuning		= dw_mci_rk3288_execute_tuning,
>  	.parse_dt		= dw_mci_rk3288_parse_dt,
> 


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

* Re: [PATCH 4/4] mmc: dw_mmc: exynos: use common_caps
  2021-11-24 18:46 ` [PATCH 4/4] mmc: dw_mmc: exynos: " John Keeping
@ 2021-11-25 23:38   ` Jaehoon Chung
  2021-11-26 12:39     ` John Keeping
  0 siblings, 1 reply; 13+ messages in thread
From: Jaehoon Chung @ 2021-11-25 23:38 UTC (permalink / raw)
  To: John Keeping, linux-mmc
  Cc: Heiko Stuebner, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel, linux-rockchip, linux-samsung-soc, Ulf Hansson

On 11/25/21 3:46 AM, John Keeping wrote:
> Move the common MMC_CAP_CMD23 capability to common_caps so that only the
> special case of MMC_CAP_1_8V_DDR and MMC_CAP_8_BIT_DATA are set via
> caps/num_caps.  Both of those can, and should, be set via device tree
> properties instead, so we can now say that exynos_dwmmc_caps is only
> used for backwards compatibility.
> 
> Signed-off-by: John Keeping <john@metanate.com>


Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Added minor comment..

> ---
>  drivers/mmc/host/dw_mmc-exynos.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> index c2dd29ef45c6..f76eeeb0cc53 100644
> --- a/drivers/mmc/host/dw_mmc-exynos.c
> +++ b/drivers/mmc/host/dw_mmc-exynos.c
> @@ -526,15 +526,16 @@ static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host,
>  
>  /* Common capabilities of Exynos4/Exynos5 SoC */
>  static unsigned long exynos_dwmmc_caps[4] = {
> -	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> -	MMC_CAP_CMD23,
> +	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA,
> +	0,
> +	0,
> +	0,
>  };

It can be removed all things.

Best Regards,
Jaehoon Chung

>  
>  static const struct dw_mci_drv_data exynos_drv_data = {
>  	.caps			= exynos_dwmmc_caps,
>  	.num_caps		= ARRAY_SIZE(exynos_dwmmc_caps),
> +	.common_caps		= MMC_CAP_CMD23,
>  	.init			= dw_mci_exynos_priv_init,
>  	.set_ios		= dw_mci_exynos_set_ios,
>  	.parse_dt		= dw_mci_exynos_parse_dt,
> 


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

* Re: [PATCH 4/4] mmc: dw_mmc: exynos: use common_caps
  2021-11-25 23:38   ` Jaehoon Chung
@ 2021-11-26 12:39     ` John Keeping
  0 siblings, 0 replies; 13+ messages in thread
From: John Keeping @ 2021-11-26 12:39 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc, Heiko Stuebner, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel, linux-rockchip, linux-samsung-soc, Ulf Hansson

On Fri, Nov 26, 2021 at 08:38:20AM +0900, Jaehoon Chung wrote:
> On 11/25/21 3:46 AM, John Keeping wrote:
> > Move the common MMC_CAP_CMD23 capability to common_caps so that only the
> > special case of MMC_CAP_1_8V_DDR and MMC_CAP_8_BIT_DATA are set via
> > caps/num_caps.  Both of those can, and should, be set via device tree
> > properties instead, so we can now say that exynos_dwmmc_caps is only
> > used for backwards compatibility.
> > 
> > Signed-off-by: John Keeping <john@metanate.com>
> 
> 
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
> 
> Added minor comment..
> 
> > ---
> >  drivers/mmc/host/dw_mmc-exynos.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> > index c2dd29ef45c6..f76eeeb0cc53 100644
> > --- a/drivers/mmc/host/dw_mmc-exynos.c
> > +++ b/drivers/mmc/host/dw_mmc-exynos.c
> > @@ -526,15 +526,16 @@ static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host,
> >  
> >  /* Common capabilities of Exynos4/Exynos5 SoC */
> >  static unsigned long exynos_dwmmc_caps[4] = {
> > -	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
> > -	MMC_CAP_CMD23,
> > -	MMC_CAP_CMD23,
> > -	MMC_CAP_CMD23,
> > +	MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA,
> > +	0,
> > +	0,
> > +	0,
> >  };
> 
> It can be removed all things.

Do you mean that the MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA entries are
not needed at all?

I know those can be set via DT but I don't think any Exynos DTs are
currently using mmc-ddr-1_8v, so removing MMC_CAP_1_8V_DDR looks like a
change in behaviour.

MMC_CAP_8_BIT_DATA looks easier to remove, although
exynos4412-p4note.dtsi seems to set the incorrect bus-width for mshc_0
so there would be a change of behaviour on that platform from removing
this.

Maybe it makes sense to add a warning in dw_mci_init_slot_caps() if any
new caps are set by drv_data->caps[ctrl_id], to make it clear that this
is deprecated.


Regards,
John

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

* Re: [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases
  2021-11-24 19:24 ` [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases Ulf Hansson
@ 2021-11-26 13:31   ` Ulf Hansson
  0 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2021-11-26 13:31 UTC (permalink / raw)
  To: John Keeping
  Cc: linux-mmc, Heiko Stuebner, Jaehoon Chung, Krzysztof Kozlowski,
	linux-arm-kernel, linux-kernel, linux-rockchip,
	linux-samsung-soc

On Wed, 24 Nov 2021 at 20:24, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Wed, 24 Nov 2021 at 19:46, John Keeping <john@metanate.com> wrote:
> >
> > This series is prompted by discussion on a previous patch set [1] but is
> > a totally different approach and only a partial solution.
> >
> > With these patches, the dependency on the mshcN alias is totally removed
> > from dw_mmc-hi3798cv200 and dw_mmc-rockchip and dw_mmc-exynos moves
> > towards being able to consider the mshcN aliases deprecated.
> >
> > I haven't changed dw_mci_hi6220_caps here, although it looks like it's
> > possible to apply MMC_CAP_CMD23 to all controllers there with no change
> > in behaviour as the final entry is SDIO for which CMD23 is not
> > applicable IIUC.  But I'm not familiar with that hardware and don't feel
> > confident making that change.
> >
> > [1] https://lore.kernel.org/all/20211116190244.1417591-1-john@metanate.com/
> >
> > John Keeping (4):
> >   mmc: dw_mmc: add common capabilities to replace caps
> >   mmc: dw_mmc: hi3798cv200: use common_caps
> >   mmc: dw_mmc: rockchip: use common_caps
> >   mmc: dw_mmc: exynos: use common_caps
> >
> >  drivers/mmc/host/dw_mmc-exynos.c      |  9 +++++----
> >  drivers/mmc/host/dw_mmc-hi3798cv200.c |  9 +--------
> >  drivers/mmc/host/dw_mmc-rockchip.c    | 11 +----------
> >  drivers/mmc/host/dw_mmc.c             |  3 +++
> >  drivers/mmc/host/dw_mmc.h             |  3 +++
> >  5 files changed, 13 insertions(+), 22 deletions(-)
> >
> > --
> > 2.34.0
> >
>
> This looks good to me, I intend to apply this later this week, unless
> objections of course.
>
> In the meantime, I will continue to look at what we can do to resolve
> the exynos/k3 issues around this.

Let's consider additional changes to be on top of this, as this is
certainly a nice step forward.

So, applied for next, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2021-11-26 14:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 18:45 [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases John Keeping
2021-11-24 18:45 ` [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps John Keeping
2021-11-25 23:37   ` Jaehoon Chung
2021-11-24 18:46 ` [PATCH 2/4] mmc: dw_mmc: hi3798cv200: use common_caps John Keeping
2021-11-25 23:37   ` Jaehoon Chung
2021-11-24 18:46 ` [PATCH 3/4] mmc: dw_mmc: rockchip: " John Keeping
2021-11-25 23:37   ` Jaehoon Chung
2021-11-24 18:46 ` [PATCH 4/4] mmc: dw_mmc: exynos: " John Keeping
2021-11-25 23:38   ` Jaehoon Chung
2021-11-26 12:39     ` John Keeping
2021-11-24 19:24 ` [PATCH 0/4] mmc: dw_mmc: start deprecating mshcN aliases Ulf Hansson
2021-11-26 13:31   ` Ulf Hansson
2021-11-25 11:48 ` Nicolas Frattaroli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).