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/[email protected]/
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
On Wed, 24 Nov 2021 at 19:46, John Keeping <[email protected]> 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/[email protected]/
>
> 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
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/[email protected]/
>
> 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 <[email protected]>
Tested on a rk3566 with no obvious issues arising.
Regards,
Nicolas Frattaroli
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 <[email protected]>
Reviewed-by: Jaehoon Chung <[email protected]>
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,
>
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 <[email protected]>
Reviewed-by: Jaehoon Chung <[email protected]>
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,
>
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 <[email protected]>
>
>
> Reviewed-by: Jaehoon Chung <[email protected]>
>
> 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
On Wed, 24 Nov 2021 at 20:24, Ulf Hansson <[email protected]> wrote:
>
> On Wed, 24 Nov 2021 at 19:46, John Keeping <[email protected]> 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/[email protected]/
> >
> > 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