mmc: fsl_esdhc: add esdhc_imx flag
PATCH v2 1/3 mmc: fsl_esdhc: add esdhc_imx flag
The fsl_esdhc driver was for Freescale eSDHC on MPC83XX/MPC85XX initially. The later QoriQ series processors (which were evolutions of MPC83XX/MPC85XX) and i.MX series processors were using this driver for their eSDHCs too.
So there are two evolution directions for eSDHC now. For the two series processors, the eSDHCs are becoming more and more different. We should have split it into two drivers, like them (sdhci-of-esdhc.c/sdhci-esdhc-imx.c) in linux kernel. But it seemed to be a lot of work now. So let's keep as it is. Be very careful to change the driver if the changes are not common for all eSDHCs, and clarify i.MX eSDHC specific things to distingush them with QorIQ eSDHC.
This patch is to added an esdhc_imx flag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.
---
Changes for v2:
- Converted to use device_is_compatible().
--- drivers/mmc/fsl_esdhc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/mmc/fsl_esdhc.c +11 -0
@@ -147,6 +147,7 @@ struct fsl_esdhc_priv {struct gpio_desc cd_gpio;struct gpio_desc wp_gpio;#endif +bool esdhc_imx; };/* Return the XFERTYP flags for a given command and data packet */
@@ -1462,6 +1463,16 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->caps = data->caps; } +/* +* This is to specify whether current eSDHC is an i.MX eSDHC, +* since the i.MX eSDHC has been becoming more and more different +* with QorIQ eSDHC and initial MPC83XX/MPC85XX. +*/ +if (!device_is_compatible (dev,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false; + val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ;
Signature · 1 line
2.17.1
PATCH v2 2/3 mmc: fsl_esdhc: clean up register definition
The fsl_esdhc driver was for Freescale eSDHC on MPC83XX/MPC85XX initially. The later QoriQ series processors (which are evolutions of MPC83XX/MPC85XX) and i.MX series processors were using this driver for their eSDHCs too.
So there are two evolution directions for eSDHC now. For the two series processors, the eSDHCs are becoming more and more different. We should have split it into two drivers, like them (sdhci-of-esdhc.c/sdhci-esdhc-imx.c) in linux kernel. But it seemed to be a lot of work now. So let's keep as it is. Be very careful to change the driver if the changes are not common for all eSDHCs, and clarify i.MX eSDHC specific things to distingush them with QorIQ eSDHC.
This patch is to clean up register definition. Besides the QorIQ eSDHC register definition, the i.MX eSDHC specific registers should be clarified.
---
Changes for v2:
- Added "Acked-by: Peng Fan".
--- drivers/mmc/fsl_esdhc.c | 66 ++++++------- include/fsl_esdhc.h | 208 ++++++++++++++++++++++------------------ 2 files changed, 149 insertions(+), 125 deletions(-)
drivers/mmc/fsl_esdhc.c +33 -33
@@ -54,23 +54,23 @@ struct fsl_esdhc {uint autoc12err;/* Auto CMD error status register */ uint hostcapblt;/* Host controller capabilities register */ uint wml;/* Watermark level register */ -uint mixctrl;/* For USDHC */ +uint mixctrl;/* For i.MX USDHC */ char reserved1[4 ];/* reserved */ uint fevt;/* Force event register */ uint admaes;/* ADMA error status register */ uint adsaddr;/* ADMA system address register */ char reserved2[4 ]; -uint dllctrl; -uint dllstat; -uint clktunectrlstatus; +uint dllctrl;/* For i.MX USDHC */ +uint dllstat;/* For i.MX USDHC */ +uint clktunectrlstatus;/* For i.MX USDHC */ char reserved3[4 ]; -uint strobe_dllctrl; -uint strobe_dllstat; +uint strobe_dllctrl;/* For i.MX USDHC */ +uint strobe_dllstat;/* For i.MX USDHC */ char reserved4[72 ]; -uint vendorspec; -uint mmcboot; -uint vendorspec2; -uint tuning_ctrl;/* on i.MX6/7/8 */ +uint vendorspec;/* For i.MX USDHC */ +uint mmcboot;/* For i.MX USDHC */ +uint vendorspec2;/* For i.MX USDHC */ +uint tuning_ctrl;/* For i.MX USDHC, on i.MX6/7/8 */ char reserved5[44 ];uint hostver;/* Host controller version register */ char reserved6[4 ];/* reserved */
@@ -80,11 +80,11 @@ struct fsl_esdhc {char reserved8[4 ];/* reserved */ uint hostcapblt2;/* Host controller capabilities register 2 */ char reserved9[8 ];/* reserved */ -uint tcr;/* Tuning control register */ +uint tbctl;/* Tuning block control register */ char reserved10[28 ];/* reserved */ uint sddirctl;/* SD direction control register */ char reserved11[712 ];/* reserved */ -uint scr;/* eSDHC control register */ +uint esdhcctl;/* eSDHC control register */ };struct fsl_esdhc_plat {
@@ -496,7 +496,7 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,/* Switch voltage to 1.8V if CMD11 succeeded */ if (cmd->cmdidx ==SD_CMD_SWITCH_UHS18V ) { -esdhc_setbits32 (®s->vendorspec,ESDHC_VENDORSPEC_VSELECT ); +esdhc_setbits32 (®s->vendorspec,VENDORSPEC_VSELECT );printf ("Run CMD11 1.8V switch\n" );/* Sleep for 5 ms - max time for card to switch to 1.8V */
@@ -728,23 +728,23 @@ static void esdhc_set_strobe_dll(struct mmc *mmc)struct fsl_esdhc *regs = priv->esdhc_regs;u32 val; -if (priv->clock >ESDHC_STROBE_DLL_CLK_FREQ ) { -writel (ESDHC_STROBE_DLL_CTRL_RESET , ®s->strobe_dllctrl); +if (priv->clock >STROBE_DLL_CLK_FREQ ) { +writel (STROBE_DLL_CTRL_RESET , ®s->strobe_dllctrl);/* * enable strobe dll ctrl and adjust the delay target * for the uSDHC loopback read clock */ - val =ESDHC_STROBE_DLL_CTRL_ENABLE | + val =STROBE_DLL_CTRL_ENABLE | (priv->strobe_dll_delay_target << -ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT ); +STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT );writel (val, ®s->strobe_dllctrl);/* wait 1us to make sure strobe dll status register stable */ mdelay (1 ); val =readl (®s->strobe_dllstat); -if (!(val &ESDHC_STROBE_DLL_STS_REF_LOCK )) +if (!(val &STROBE_DLL_STS_REF_LOCK ))pr_warn ("HS400 strobe DLL status REF not lock!\n" ); -if (!(val &ESDHC_STROBE_DLL_STS_SLV_LOCK )) +if (!(val &STROBE_DLL_STS_SLV_LOCK ))pr_warn ("HS400 strobe DLL status SLV not lock!\n" ); } }
@@ -817,9 +817,9 @@ static int esdhc_set_voltage(struct mmc *mmc) }#endif -esdhc_clrbits32 (®s->vendorspec,ESDHC_VENDORSPEC_VSELECT ); +esdhc_clrbits32 (®s->vendorspec,VENDORSPEC_VSELECT );if (!(esdhc_read32 (®s->vendorspec) & -ESDHC_VENDORSPEC_VSELECT )) +VENDORSPEC_VSELECT ))return 0 ;return -EAGAIN ;
@@ -833,8 +833,8 @@ static int esdhc_set_voltage(struct mmc *mmc) } }#endif -esdhc_setbits32 (®s->vendorspec,ESDHC_VENDORSPEC_VSELECT ); -if (esdhc_read32 (®s->vendorspec) &ESDHC_VENDORSPEC_VSELECT ) +esdhc_setbits32 (®s->vendorspec,VENDORSPEC_VSELECT ); +if (esdhc_read32 (®s->vendorspec) &VENDORSPEC_VSELECT )return 0 ;return -EAGAIN ;
@@ -952,7 +952,7 @@ static int esdhc_set_ios_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)#ifdef CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK /* Select to use peripheral clock */ esdhc_clock_control (priv, false); -esdhc_setbits32 (®s->scr,ESDHCCTL_PCS ); +esdhc_setbits32 (®s->esdhcctl,ESDHCCTL_PCS );esdhc_clock_control (priv, true);#endif /* Set the clock speed */
@@ -1028,7 +1028,7 @@ static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)/* Put VEND_SPEC to default value */ if (priv->vs18_enable)esdhc_write32 (®s->vendorspec, (VENDORSPEC_INIT | -ESDHC_VENDORSPEC_VSELECT )); +VENDORSPEC_VSELECT ));else esdhc_write32 (®s->vendorspec,VENDORSPEC_INIT );
@@ -1038,7 +1038,7 @@ static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)#ifndef ARCH_MXC /* Enable cache snooping */ -esdhc_write32 (®s->scr,0x00000040 ); +esdhc_write32 (®s->esdhcctl,0x00000040 );#endif #ifndef CONFIG_FSL_USDHC
@@ -1184,7 +1184,7 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,#endif if (priv->vs18_enable) -esdhc_setbits32 (®s->vendorspec,ESDHC_VENDORSPEC_VSELECT ); +esdhc_setbits32 (®s->vendorspec,VENDORSPEC_VSELECT );writel (SDHCI_IRQ_EN_BITS , ®s->irqstaten); cfg = &plat->cfg;
@@ -1272,11 +1272,11 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,if (priv->flags &ESDHC_FLAG_STD_TUNING ) {u32 val =readl (®s->tuning_ctrl); - val |=ESDHC_STD_TUNING_EN ; - val &= ~ESDHC_TUNING_START_TAP_MASK ; + val |=STD_TUNING_EN ; + val &= ~TUNING_START_TAP_MASK ; val |= priv->tuning_start_tap; - val &= ~ESDHC_TUNING_STEP_MASK ; - val |= (priv->tuning_step) <<ESDHC_TUNING_STEP_SHIFT ; + val &= ~TUNING_STEP_MASK ; + val |= (priv->tuning_step) <<TUNING_STEP_SHIFT ;writel (val, ®s->tuning_ctrl); } }
@@ -1484,10 +1484,10 @@ static int fsl_esdhc_probe(struct udevice *dev) val =fdtdec_get_int (fdt, node,"fsl,tuning-step" ,1 ); priv->tuning_step = val; val =fdtdec_get_int (fdt, node,"fsl,tuning-start-tap" , -ESDHC_TUNING_START_TAP_DEFAULT ); +TUNING_START_TAP_DEFAULT ); priv->tuning_start_tap = val; val =fdtdec_get_int (fdt, node,"fsl,strobe-dll-delay-target" , -ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT ); +STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT ); priv->strobe_dll_delay_target = val;if (dev_read_bool (dev,"non-removable" )) {
include/fsl_esdhc.h +116 -92
265 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 3/3 mmc: fsl_esdhc: clarify i.MX eSDHC specific functions
In reply to Y.b. LuA previous patch had added SDR104/HS200 support for fsl_esdhc. However this was only for i.MX eSDHC, and QorIQ eSDHC used different registers and method.
This patch is to clarify i.MX eSDHC specific functions defined in that patch, and to use them only for i.MX eSDHC. The QorIQ eSDHC SDR104/HS200 support will be added in the future.
---
Changes for v2:
- Added "Reviewed-by: Peng Fan".
--- drivers/mmc/fsl_esdhc.c | 79 +++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 38 deletions(-)
drivers/mmc/fsl_esdhc.c +41 -38
@@ -682,7 +682,7 @@ static void esdhc_clock_control(struct fsl_esdhc_priv *priv, bool enable)#endif #ifdef MMC_SUPPORTS_TUNING -static int esdhc_change_pinstate (struct udevice *dev) +static int esdhc_imx_change_pinstate (struct udevice *dev) {struct fsl_esdhc_priv *priv =dev_get_priv (dev);int ret;
@@ -708,7 +708,7 @@ static int esdhc_change_pinstate(struct udevice *dev)return ret; } -static void esdhc_reset_tuning (struct mmc *mmc) +static void esdhc_imx_reset_tuning (struct mmc *mmc) {struct fsl_esdhc_priv *priv =dev_get_priv (mmc->dev);struct fsl_esdhc *regs = priv->esdhc_regs;
@@ -722,7 +722,7 @@ static void esdhc_reset_tuning(struct mmc *mmc) } } -static void esdhc_set_strobe_dll (struct mmc *mmc) +static void esdhc_imx_set_strobe_dll (struct mmc *mmc) {struct fsl_esdhc_priv *priv =dev_get_priv (mmc->dev);struct fsl_esdhc *regs = priv->esdhc_regs;
@@ -749,7 +749,7 @@ static void esdhc_set_strobe_dll(struct mmc *mmc) } } -static int esdhc_set_timing (struct mmc *mmc) +static int esdhc_imx_set_timing (struct mmc *mmc) {struct fsl_esdhc_priv *priv =dev_get_priv (mmc->dev);struct fsl_esdhc *regs = priv->esdhc_regs;
@@ -761,13 +761,13 @@ static int esdhc_set_timing(struct mmc *mmc)switch (mmc->selected_mode) {case MMC_LEGACY :case SD_LEGACY : -esdhc_reset_tuning (mmc); +esdhc_imx_reset_tuning (mmc);writel (mixctrl, ®s->mixctrl);break ;case MMC_HS_400 : mixctrl |=MIX_CTRL_DDREN |MIX_CTRL_HS400_EN ;writel (mixctrl, ®s->mixctrl); -esdhc_set_strobe_dll (mmc); +esdhc_imx_set_strobe_dll (mmc);break ;case MMC_HS :case MMC_HS_52 :
@@ -791,14 +791,13 @@ static int esdhc_set_timing(struct mmc *mmc) priv->mode = mmc->selected_mode; -return esdhc_change_pinstate (mmc->dev); +return esdhc_imx_change_pinstate (mmc->dev); } -static int esdhc_set_voltage (struct mmc *mmc) +static int esdhc_imx_set_voltage (struct mmc *mmc) {struct fsl_esdhc_priv *priv =dev_get_priv (mmc->dev);struct fsl_esdhc *regs = priv->esdhc_regs; -int ret; priv->signal_voltage = mmc->signal_voltage;switch (mmc->signal_voltage) {
@@ -975,18 +974,18 @@ static int esdhc_set_ios_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)#endif } -if (priv->mode != mmc->selected_mode) { - ret =esdhc_set_timing (mmc); +if (priv->esdhc_imx && priv->mode != mmc->selected_mode) { + ret =esdhc_imx_set_timing (mmc);if (ret) { -printf ("esdhc_set_timing error %d\n" , ret); +printf ("esdhc_imx_set_timing error %d\n" , ret);return ret; } } -if (priv->signal_voltage != mmc->signal_voltage) { - ret =esdhc_set_voltage (mmc); +if (priv->esdhc_imx && priv->signal_voltage != mmc->signal_voltage) { + ret =esdhc_imx_set_voltage (mmc);if (ret) { -printf ("esdhc_set_voltage error %d\n" , ret); +printf ("esdhc_imx_set_voltage error %d\n" , ret);return ret; } }
@@ -1267,20 +1266,21 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv, cfg->b_max =CONFIG_SYS_MMC_MAX_BLK_COUNT ; -writel (0 , ®s->dllctrl); -if (priv->flags &ESDHC_FLAG_USDHC ) { -if (priv->flags &ESDHC_FLAG_STD_TUNING ) { -u32 val =readl (®s->tuning_ctrl); - - val |=STD_TUNING_EN ; - val &= ~TUNING_START_TAP_MASK ; - val |= priv->tuning_start_tap; - val &= ~TUNING_STEP_MASK ; - val |= (priv->tuning_step) <<TUNING_STEP_SHIFT ; -writel (val, ®s->tuning_ctrl); +if (priv->esdhc_imx) { +writel (0 , ®s->dllctrl); +if (priv->flags &ESDHC_FLAG_USDHC ) { +if (priv->flags &ESDHC_FLAG_STD_TUNING ) { +u32 val =readl (®s->tuning_ctrl); + + val |=STD_TUNING_EN ; + val &= ~TUNING_START_TAP_MASK ; + val |= priv->tuning_start_tap; + val &= ~TUNING_STEP_MASK ; + val |= priv->tuning_step <<TUNING_STEP_SHIFT ; +writel (val, ®s->tuning_ctrl); + } } } -return 0 ; }
@@ -1481,14 +1481,17 @@ static int fsl_esdhc_probe(struct udevice *dev)else priv->bus_width =1 ; - val =fdtdec_get_int (fdt, node,"fsl,tuning-step" ,1 ); - priv->tuning_step = val; - val =fdtdec_get_int (fdt, node,"fsl,tuning-start-tap" , -TUNING_START_TAP_DEFAULT ); - priv->tuning_start_tap = val; - val =fdtdec_get_int (fdt, node,"fsl,strobe-dll-delay-target" , -STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT ); - priv->strobe_dll_delay_target = val; +if (priv->esdhc_imx) { + priv->tuning_step = +fdtdec_get_int (fdt, node,"fsl,tuning-step" ,1 ); + priv->tuning_start_tap = +fdtdec_get_int (fdt, node,"fsl,tuning-start-tap" , +TUNING_START_TAP_DEFAULT ); + priv->strobe_dll_delay_target = +fdtdec_get_int (fdt, node, +"fsl,strobe-dll-delay-target" , +STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT ); + }if (dev_read_bool (dev,"non-removable" )) { priv->non_removable =1 ;
@@ -1628,9 +1631,9 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {#endif static struct esdhc_soc_data usdhc_imx7d_data = { - .flags =ESDHC_FLAG_USDHC |ESDHC_FLAG_STD_TUNING - |ESDHC_FLAG_HAVE_CAP1 |ESDHC_FLAG_HS200 - |ESDHC_FLAG_HS400 , + .flags =ESDHC_FLAG_USDHC |ESDHC_FLAG_STD_TUNING | +ESDHC_FLAG_HAVE_CAP1 |ESDHC_FLAG_HS200 | +ESDHC_FLAG_HS400 , .caps =UHS_CAPS |MMC_MODE_HS200 | MMC_MODE_DDR_52MHz | MMC_MODE_HS_52MHz |MMC_MODE_HS , };
Signature · 1 line
2.17.1
PATCH v2 1/3 mmc: fsl_esdhc: add esdhc_imx flag
In reply to Y.b. LuQuoted 54 lines
-----Original Message-----
From: Y.b. Lu
Sent: 2019年2月15日 10:26
To: u-boot at lists.denx.de
Cc: Jaehoon Chung <[email protected]>; Prabhakar Kushwaha <[email protected]>; Peng Fan <[email protected]>; Y.b. Lu <[email protected]>
Subject: [v2, 1/3] mmc:fsl_esdhc: addesdhc_imxflagThe
fsl_esdhcdriver was for Freescale eSDHC on MPC83XX/MPC85XX initially. The later QoriQ series processors (which were evolutions of MPC83XX/MPC85XX) and i.MX series processors were using this driver for their eSDHCs too.So there are two evolution directions for eSDHC now. For the two series processors, the eSDHCs are becoming more and more different.
We should have split it into two drivers, like them (sdhci-of-esdhc.c/sdhci-esdhc-imx.c) in linux kernel. But it seemed to be a lot of work now. So let's keep as it is. Be very careful to change the driver if the changes are not common for all eSDHCs, and clarify i.MX eSDHC specific things to distingush them with QorIQ eSDHC.This patch is to added an
esdhc_imxflag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- Converted to usedevice_is_compatible().--- drivers/mmc/fsl_esdhc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0
-0
21fa2ab1d4..a647bc7f1c100644drivers/mmc/fsl_esdhc.c +4
-1@@ -147,6 +147,7 @@ struct fsl_esdhc_priv {struct gpio_desc cd_gpio;struct gpio_desc wp_gpio;#endif +bool esdhc_imx; }; /* Return the XFERTYP flags for a given command and data packet */ @@ -1462,6 +1463,16 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->caps = data->caps; } +/* +* This is to specify whether current eSDHC is an i.MX eSDHC, +* since the i.MX eSDHC has been becoming more and more different
drivers/mmc/fsl_esdhc.c struct fsl_esdhc_priv { · line 1478
Quoted 10 lines
drivers/mmc/fsl_esdhc.c +7
-0+* with QorIQ eSDHC and initial MPC83XX/MPC85XX. +*/ +if (!device_is_compatible (dev,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false; + val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ;
Quoted 2 lines
--
2.17.1
PATCH v2 1/3 mmc: fsl_esdhc: add esdhc_imx flag
In reply to Y.b. LuDear "Y.b. Lu",
Quoted 9 lines
The
fsl_esdhcdriver was for Freescale eSDHC on MPC83XX/MPC85XX initially. The later QoriQ series processors (which were evolutions of MPC83XX/MPC85XX) and i.MX series processors were using this driver for their eSDHCs too.So there are two evolution directions for eSDHC now. For the two series processors, the eSDHCs are becoming more and more different. We should have split it into two drivers, like them (
sdhci-of-esdhc.c/sdhci-esdhc-imx.c) in linux kernel.
Why we cannot do it right just from the very beginning?
In the end of the day we will try to mimic Linux kernel anyway, IMHO it is better to start the split now and save some effort on a half-step solution.
Quoted 37 lines
But it seemed
to be a lot of work now. So let's keep as it is. Be very careful to change the driver if the changes are not common for all eSDHCs, and clarify i.MX eSDHC specific things to distingush them with QorIQ eSDHC.This patch is to added an
esdhc_imxflag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- Converted to usedevice_is_compatible().--- drivers/mmc/fsl_esdhc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/mmc/fsl_esdhc.c +4
-0@@ -147,6 +147,7 @@ struct fsl_esdhc_priv {struct gpio_desc cd_gpio;struct gpio_desc wp_gpio;#endif +bool esdhc_imx; };/* Return the XFERTYP flags for a given command and data packet */ @@ -1462,6 +1463,16 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->caps = data->caps; } +/* +* This is to specify whether current eSDHC is an i.MX eSDHC, +* since the i.MX eSDHC has been becoming more and more different
drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 1478
Quoted 10 lines
drivers/mmc/fsl_esdhc.c +7
-0+* with QorIQ eSDHC and initial MPC83XX/MPC85XX. +*/ +if (!device_is_compatible (dev,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false; + val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ;
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190218/9305e354/attachment.sig>
PATCH v2 1/3 mmc: fsl_esdhc: add esdhc_imx flag
Hi Lukasz,
Quoted 19 lines
-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: Monday, February 18, 2019 7:12 AM
To: Y.b. Lu <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [v2, 1/3] mmc:fsl_esdhc: addesdhc_imxflagDear "Y.b. Lu",
Quoted 9 lines
The
fsl_esdhcdriver was for Freescale eSDHC on MPC83XX/MPC85XX initially. The later QoriQ series processors (which were evolutions of MPC83XX/MPC85XX) and i.MX series processors were using this driver for their eSDHCs too.So there are two evolution directions for eSDHC now. For the two series processors, the eSDHCs are becoming more and more different. We should have split it into two drivers, like them (
sdhci-of-esdhc.c/sdhci-esdhc-imx.c) in linux kernel.
Quoted 5 lines
Why we cannot do it right just from the very beginning?
In the end of the day we will try to mimic Linux kernel anyway, IMHO it is better to start the split now and save some effort on a half-step solution.
[Y.b. Lu] I understand. The perfect way is to split them.
However, if you grep 'CONFIG_FSL_ESDHC' in the whole u-boot source, you would find there are 607 results. There will be so many companies boards affected. I just don't know who could make all of these boards tested.
My current patch-set is also to cleaning up the driver waiting for splitting them someday on the other hand.
After you check CONFIG_FSL_ESDHC in u-boot source, if you think it's better we should split them right now, I could work on the driver splitting.
Thanks a lot.
Quoted 61 lines
Quoted 37 lines
But it seemed
to be a lot of work now. So let's keep as it is. Be very careful to change the driver if the changes are not common for all eSDHCs, and clarify i.MX eSDHC specific things to distingush them with QorIQ eSDHC.This patch is to added an
esdhc_imxflag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- Converted to usedevice_is_compatible().--- drivers/mmc/fsl_esdhc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0
-0
21fa2ab1d4..a647bc7f1c100644drivers/mmc/fsl_esdhc.c +4
-1@@ -147,6 +147,7 @@ struct fsl_esdhc_priv {struct gpio_desc cd_gpio;struct gpio_desc wp_gpio;#endif +bool esdhc_imx; }; /* Return the XFERTYP flags for a given command and data packet */ @@ -1462,6 +1463,16 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->caps = data->caps; } +/* +* This is to specify whether current eSDHC is an i.MX eSDHC, +* since the i.MX eSDHC has been becoming more and more different
drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 1478
Quoted 10 lines
drivers/mmc/fsl_esdhc.c +7
-0+* with QorIQ eSDHC and initial MPC83XX/MPC85XX. +*/ +if (!device_is_compatible (dev,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false; + val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ;Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH v2 1/3 mmc: fsl_esdhc: add esdhc_imx flag
Hi "Y.b. Lu",
Quoted 23 lines
Hi Lukasz,
Quoted 21 lines
-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: Monday, February 18, 2019 7:12 AM
To: Y.b. Lu <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [v2, 1/3] mmc:fsl_esdhc: addesdhc_imxflagDear "Y.b. Lu",
Quoted 9 lines
The
fsl_esdhcdriver was for Freescale eSDHC on MPC83XX/MPC85XX initially. The later QoriQ series processors (which were evolutions of MPC83XX/MPC85XX) and i.MX series processors were using this driver for their eSDHCs too.So there are two evolution directions for eSDHC now. For the two series processors, the eSDHCs are becoming more and more different. We should have split it into two drivers, like them (
sdhci-of-esdhc.c/sdhci-esdhc-imx.c) in linux kernel.Why we cannot do it right just from the very beginning?
Quoted 7 lines
Quoted 3 lines
In the end of the day we will try to mimic Linux kernel anyway, IMHO it is better to start the split now and save some effort on a half-step solution.
[Y.b. Lu] I understand. The perfect way is to split them. However, if you grep '
CONFIG_FSL_ESDHC' in the whole u-boot source, you would find there are 607 results.
Those are boards, which use the driver. The modification would be done in one or two files (fsl_esdhc.c|h).
Quoted 2 lines
There will be so many companies
boards affected.
I guess that the task of your patch set is to separate imx6q and ppc specific code for those IP blocks.
Quoted 2 lines
I just don't know who could make all of these boards tested.
Your patch set also makes some changes in the generic driver depending on the priv->esdhc_imx flag. Those changes also need to be tested on all before mentioned boards.
In the end you logically split the driver,
having it in a single file, which IMHO is not proper long-term solution.
Quoted 5 lines
My current patch-set is also to cleaning up the driver waiting for splitting them someday on the other hand. After you check
CONFIG_FSL_ESDHCin u-boot source, if you think it's better we should split them right now, I could work on the driver splitting.
You can think about having common part (in one file - fsl_esdhc.c) and then separate files with code specific to imx and ppc. This would reduce the number of changes needed.
Quoted 65 lines
Thanks a lot.
Quoted 62 lines
Quoted 38 lines
But it seemed
to be a lot of work now. So let's keep as it is. Be very careful to change the driver if the changes are not common for all eSDHCs, and clarify i.MX eSDHC specific things to distingush them with QorIQ eSDHC.This patch is to added an
esdhc_imxflag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- Converted to usedevice_is_compatible().--- drivers/mmc/fsl_esdhc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/mmc/fsl_esdhc.c +1
-0@@ -147,6 +147,7 @@ struct fsl_esdhc_priv {struct gpio_desc cd_gpio;struct gpio_desc wp_gpio;#endif +bool esdhc_imx; };/* Return the XFERTYP flags for a given command and data packet */ @@ -1462,6 +1463,16 @@ static int
fsl_esdhc_probe(struct udevice *dev)priv->caps=data->caps;drivers/mmc/fsl_esdhc.c +2
-0} +/* +* This is to specify whether current eSDHC is an i.MX eSDHC,
drivers/mmc/fsl_esdhc.c +1
-0+* since the i.MX eSDHC has been becoming more and more different
drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 1478
Quoted 10 lines
drivers/mmc/fsl_esdhc.c +7
-0+* with QorIQ eSDHC and initial MPC83XX/MPC85XX. +*/ +if (!device_is_compatible (dev,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false; + val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ;Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190219/4cb801b8/attachment.sig>
PATCH v2 1/3 mmc: fsl_esdhc: add esdhc_imx flag
Hi Lukasz,
Quoted 36 lines
-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: Tuesday, February 19, 2019 2:39 PM
To: Y.b. Lu <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [v2, 1/3] mmc:fsl_esdhc: addesdhc_imxflagHi "Y.b. Lu",
Quoted 27 lines
Hi Lukasz,
Quoted 24 lines
-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: Monday, February 18, 2019 7:12 AM
To: Y.b. Lu <[email protected]>
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [v2, 1/3] mmc:fsl_esdhc: addesdhc_imxflagDear "Y.b. Lu",
Quoted 9 lines
The
fsl_esdhcdriver was for Freescale eSDHC on MPC83XX/MPC85XX initially. The later QoriQ series processors (which were evolutions of MPC83XX/MPC85XX) and i.MX series processors were using this driver for their eSDHCs too.So there are two evolution directions for eSDHC now. For the two series processors, the eSDHCs are becoming more and more different. We should have split it into two drivers, like them (
sdhci-of-esdhc.c/sdhci-esdhc-imx.c) in linux kernel.Why we cannot do it right just from the very beginning?
In the end of the day we will try to mimic Linux kernel anyway, IMHO it is better to start the split now and save some effort on a half-step solution.
Quoted 6 lines
Quoted 3 lines
[Y.b. Lu] I understand. The perfect way is to split them. However, if you grep '
CONFIG_FSL_ESDHC' in the whole u-boot source, you would find there are 607 results.Those are boards, which use the driver. The modification would be done in one or two files (fsl_esdhc.c|h).
[Y.b. Lu] Sorry, I can't get your point.
Since we split fsl_esdhc into fsl_esdhc and fsl_esdhc_imx driver, all i.mx boards files should convert to use new CONFIG_FSL_ESDHC_IMX instead as I understand.
Quoted 4 lines
Quoted 3 lines
There will be so many companies
boards affected.
Quoted 8 lines
I guess that the task of your patch set is to separate imx6q and ppc specific code for those IP blocks.
Quoted 1 line
I just don't know who could make all of these boards tested.
Your patch set also makes some changes in the generic driver depending on the
priv->esdhc_imxflag. Those changes also need to be tested on all before mentioned boards.
[Y.b. Lu] Right...
Quoted 5 lines
In the end you logically split the driver, having it in a single file, which IMHO is not proper long-term solution.
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
My current patch-set is also to cleaning up the driver waiting for splitting them someday on the other hand. After you check
CONFIG_FSL_ESDHCin u-boot source, if you think it's better we should split them right now, I could work on the driver splitting.You can think about having common part (in one file -
fsl_esdhc.c) and then separate files with code specific to imx and ppc. This would reduce the number of changes needed.
[Y.b. Lu] Actually, it's not only imx and ppc.
In linux, esdhc driver is for MPC83XX/MPC85XX, QorIQ PowerPC processors, QoriQ ARM processors (Layerscape). Esdhc-imx driver is for i.MX processors.
Anyway there would be a lot files changed if we split the driver. Let me send out a patch-set to split them for your reviewing. Thanks a lot for your comments.
Quoted 80 lines
Quoted 66 lines
Thanks a lot.
Quoted 62 lines
Quoted 38 lines
But it seemed
to be a lot of work now. So let's keep as it is. Be very careful to change the driver if the changes are not common for all eSDHCs, and clarify i.MX eSDHC specific things to distingush them with QorIQ eSDHC.This patch is to added an
esdhc_imxflag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- Converted to usedevice_is_compatible().--- drivers/mmc/fsl_esdhc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/mmc/fsl_esdhc.c +1
-0@@ -147,6 +147,7 @@ struct fsl_esdhc_priv {struct gpio_desc cd_gpio;struct gpio_desc wp_gpio;#endif +bool esdhc_imx; };/* Return the XFERTYP flags for a given command and data packet */ @@ -1462,6 +1463,16 @@ static int
fsl_esdhc_probe(struct udevice *dev)priv->caps=data->caps;drivers/mmc/fsl_esdhc.c +2
-0} +/* +* This is to specify whether current eSDHC is an i.MX eSDHC,
drivers/mmc/fsl_esdhc.c +1
-0+* since the i.MX eSDHC has been becoming more and more different
drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 1478
Quoted 10 lines
drivers/mmc/fsl_esdhc.c +7
-0+* with QorIQ eSDHC and initial MPC83XX/MPC85XX. +*/ +if (!device_is_compatible (dev,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false; + val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ;Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH v2 1/3 mmc: fsl_esdhc: add esdhc_imx flag
[...]
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
My current patch-set is also to cleaning up the driver waiting for splitting them someday on the other hand. After you check
CONFIG_FSL_ESDHCin u-boot source, if you think it's better we should split them right now, I could work on the driver splitting.You can think about having common part (in one file -
fsl_esdhc.c) and then separate files with code specific to imx and ppc. This would reduce the number of changes needed.
Quoted 9 lines
[Y.b. Lu] Actually, it's not only imx and ppc.
In linux, esdhc driver is for MPC83XX/MPC85XX, QorIQ PowerPC processors, QoriQ ARM processors (Layerscape).
Esdhc-imx driver is for i.MX processors.Anyway there would be a lot files changed if we split the driver. Let me send out a patch-set to split them for your reviewing.
Thanks a lot for your comments.
[Y.b. Lu] Any comments or suggestions on the patch-set. Thanks a lot :)
http://patchwork.ozlabs.org/project/uboot/list/?series=93317&state=*
[...]