mmc: dw_mmc: start deprecating mshcN aliases
Subsystems (4)
cover mmc: dw_mmc: start deprecating mshcN aliases
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(-)
Signature · 1 line
2.34.0
PATCH 1/4 mmc: dw_mmc: add common capabilities to replace caps
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.
--- drivers/mmc/host/dw_mmc.c | 3 +++ drivers/mmc/host/dw_mmc.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/mmc/host/dw_mmc.c +3 -0
@@ -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 )
drivers/mmc/host/dw_mmc.h +3 -0
@@ -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);
Signature · 1 line
2.34.0
Re: [PATCH 1/4] mmc: dw_mmc: add common capabilities to replace caps
Quoted 8 lines · John Keeping
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_capsfield for this case which updates the host's capabilities without needing the mshcN alias ID.Signed-off-by John Keeping <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 34 lines
--- drivers/mmc/host/dw_mmc.c | 3 +++ drivers/mmc/host/dw_mmc.h | 3 +++ 2 files changed, 6 insertions(+)drivers/mmc/host/dw_mmc.c +3
-0@@ -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 )drivers/mmc/host/dw_mmc.h +2
-0@@ -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.
drivers/mmc/host/dw_mmc.h struct dw_mci_slot { · line 570
Quoted 7 lines
drivers/mmc/host/dw_mmc.h +1
-0@@ -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);
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH 2/4 mmc: dw_mmc: hi3798cv200: use common_caps
In reply to John KeepingThe 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.
--- drivers/mmc/host/dw_mmc-hi3798cv200.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/mmc/host/dw_mmc-hi3798cv200.c +1 -8
@@ -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,
Signature · 1 line
2.34.0
Re: [PATCH 2/4] mmc: dw_mmc: hi3798cv200: use common_caps
Quoted 5 lines · John Keeping
The capabilities for all instances are the same, so use
common_capsinstead of caps/num_caps to remove the dependency on the mshcN device tree alias.Signed-off-by John Keeping <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 23 lines
--- drivers/mmc/host/dw_mmc-hi3798cv200.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/mmc/host/dw_mmc-hi3798cv200.c +0
-6@@ -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;
drivers/mmc/host/dw_mmc-hi3798cv200.c static int dw_mci_hi3798cv200_init(struct dw_mci *host) · line 166
Quoted 9 lines
drivers/mmc/host/dw_mmc-hi3798cv200.c +1
-2@@ -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,
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH 3/4 mmc: dw_mmc: rockchip: use common_caps
In reply to John KeepingThe 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.
--- drivers/mmc/host/dw_mmc-rockchip.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/mmc/host/dw_mmc-rockchip.c +1 -10
@@ -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,
Signature · 1 line
2.34.0
Re: [PATCH 3/4] mmc: dw_mmc: rockchip: use common_caps
Quoted 5 lines · John Keeping
The capabilities for all instances are the same, so use
common_capsinstead of caps/num_caps to remove the dependency on the mshcN device tree alias.Signed-off-by John Keeping <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 22 lines
--- drivers/mmc/host/dw_mmc-rockchip.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)drivers/mmc/host/dw_mmc-rockchip.c +0
-8@@ -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 = {
drivers/mmc/host/dw_mmc-rockchip.c static int dw_mci_rockchip_init(struct dw_mci *host) · line 311
Quoted 10 lines
drivers/mmc/host/dw_mmc-rockchip.c +1
-2.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,
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH 4/4 mmc: dw_mmc: exynos: use common_caps
In reply to John KeepingMove 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.
--- drivers/mmc/host/dw_mmc-exynos.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/host/dw_mmc-exynos.c +5 -4
@@ -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,
Signature · 1 line
2.34.0
Re: [PATCH 4/4] mmc: dw_mmc: exynos: use common_caps
Quoted 7 lines · John Keeping
Move the common
MMC_CAP_CMD23capability tocommon_capsso that only the special case ofMMC_CAP_1_8V_DDRandMMC_CAP_8_BIT_DATAare set via caps/num_caps. Both of those can, and should, be set via device tree properties instead, so we can now say thatexynos_dwmmc_capsis only used for backwards compatibility.Signed-off-by John Keeping <[email protected]>
Added minor comment..
Quoted 11 lines
--- drivers/mmc/host/dw_mmc-exynos.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/mmc/host/dw_mmc-exynos.c +0
-0@@ -526,15 +526,16 @@ static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host,/* Common capabilities of Exynos4/Exynos5 SoC */
drivers/mmc/host/dw_mmc-exynos.c static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host, · line 533
Quoted 10 lines
drivers/mmc/host/dw_mmc-exynos.c +4
-4static 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
drivers/mmc/host/dw_mmc-exynos.c static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host,
Quoted 9 lines
drivers/mmc/host/dw_mmc-exynos.c +1
-0static 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,
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 4/4] mmc: dw_mmc: exynos: use common_caps
Quoted 24 lines · Jaehoon Chung
Quoted 7 lines · John Keeping
Move the common
MMC_CAP_CMD23capability tocommon_capsso that only the special case ofMMC_CAP_1_8V_DDRandMMC_CAP_8_BIT_DATAare set via caps/num_caps. Both of those can, and should, be set via device tree properties instead, so we can now say thatexynos_dwmmc_capsis only used for backwards compatibility.Signed-off-by John Keeping <[email protected]>Reviewed-by Jaehoon Chung <[email protected]>Added minor comment..
Quoted 10 lines
--- drivers/mmc/host/dw_mmc-exynos.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/mmc/host/dw_mmc-exynos.c +0
-0@@ -526,15 +526,16 @@ static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host,
Quoted 13 lines
drivers/mmc/host/dw_mmc-exynos.c static int dw_mci_exynos_prepare_hs400_tuning(struct dw_mci *host, · line 533
Quoted 11 lines
drivers/mmc/host/dw_mmc-exynos.c +4
-4/* 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
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 29 lines · John Keeping
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_capshere, although it looks like it's possible to applyMMC_CAP_CMD23to 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: usecommon_caps
mmc:dw_mmc: rockchip: usecommon_caps
mmc:dw_mmc: exynos: usecommon_capsdrivers/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(-)
Quoted 3 lines
--
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
Quoted 35 lines · Ulf Hansson
Quoted 29 lines · John Keeping
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_capshere, although it looks like it's possible to applyMMC_CAP_CMD23to 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: usecommon_caps
mmc:dw_mmc: rockchip: usecommon_caps
mmc:dw_mmc: exynos: usecommon_capsdrivers/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(-)Quoted 3 lines
--
2.34.0
Quoted 5 lines
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
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 21 lines · 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_capshere, although it looks like it's possible to applyMMC_CAP_CMD23to 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: usecommon_caps
mmc:dw_mmc: rockchip: usecommon_caps
mmc:dw_mmc: exynos: usecommon_caps
Quoted 8 lines
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 on a rk3566 with no obvious issues arising.
Regards,
Nicolas Frattaroli
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip