mbox series

[0/4] mmc: dw_mmc: start deprecating mshcN aliases

Message ID 20211124184603.3897245-1-john@metanate.com
Headers show
Series mmc: dw_mmc: start deprecating mshcN aliases | expand

Message

John Keeping Nov. 24, 2021, 6:45 p.m. UTC
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(-)

Comments

Nicolas Frattaroli Nov. 25, 2021, 11:48 a.m. UTC | #1
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
Jaehoon Chung Nov. 25, 2021, 11:37 p.m. UTC | #2
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,
>
Jaehoon Chung Nov. 25, 2021, 11:38 p.m. UTC | #3
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,
>
Ulf Hansson Nov. 26, 2021, 1:31 p.m. UTC | #4
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