mmc: fsl_esdhc: add esdhc_imx flag
PATCH 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 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 added an esdhc_imx flag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.
--- 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 (!fdt_node_check_compatible (fdt, node,"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 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.
--- 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 2/3 mmc: fsl_esdhc: clean up register definition
Quoted 24 lines
-----Original Message-----
From: Y.b. Lu
Sent: 2019年2月14日 16:21
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: [PATCH 2/3] mmc:fsl_esdhc: clean up register definitionThe
fsl_esdhcdriver 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.
Quoted 4 lines
This patch is to clean up register definition. Besides the QorIQ eSDHC register definition, the i.MX eSDHC specific registers should be clarified.
Signed-off-by Yangbo Lu <[email protected]>
Quoted 473 lines
--- drivers/mmc/fsl_esdhc.c | 66 ++++++------- include/fsl_esdhc.h | 208 ++++++++++++++++++++++------------------ 2 files changed, 149 insertions(+), 125 deletions(-)drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0
-0
787a13a8a9..63f922382f100644drivers/mmc/fsl_esdhc.c +13
-13@@ -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 );drivers/mmc/fsl_esdhc.c +8
-9printf ("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 ;drivers/mmc/fsl_esdhc.c +2
-2return -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 ;drivers/mmc/fsl_esdhc.c +0
-0return -EAGAIN ;@@ -952,7 +952,7 @@ static int esdhc_set_ios_common(struct
fsl_esdhc_priv*priv, struct mmc *mmc) #ifdefCONFIG_FSL_ESDHC_USE_PERIPHERAL_CLKdrivers/mmc/fsl_esdhc.c +3
-3/* 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_USDHCdrivers/mmc/fsl_esdhc.c +1
-1@@ -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);drivers/mmc/fsl_esdhc.c +4
-4cfg = &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); }drivers/mmc/fsl_esdhc.c +2
-2}@@ -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")) { diff --gita/include/fsl_esdhc.hb/include/fsl_esdhc.hindex8dbd5249a7..e693a6244e100644include/fsl_esdhc.h +12
-1@@ -20,27 +20,87 @@#include "../board/freescale/common/qixis.h" #endif -/* FSL eSDHC-specific constants */ +/* +* eSDHC register definition +*/ + +/* SDMA system address register */ +#define DSADDR 0x2e000 + +/* Block attributes register */ +#define BLKATTR 0x2e004 +#define BLKATTR_CNT (x) ((x & 0xffff) << 16) +#define BLKATTR_SIZE (x) (x & 0x1fff) +#define MAX_BLK_CNT 0x7fff/* so malloc will have enough room with 32M */
include/fsl_esdhc.h +67
-68+ +/* Command argument register */ +#define CMDARG 0x0002e008 + +/* Transfer type register */ +#define XFERTYP 0x0002e00c +#define XFERTYP_CMD (x) ((x & 0x3f) << 24) +#define XFERTYP_CMDTYP_NORMAL 0x0 +#define XFERTYP_CMDTYP_SUSPEND 0x00400000 +#define XFERTYP_CMDTYP_RESUME 0x00800000 +#define XFERTYP_CMDTYP_ABORT 0x00c00000 +#define XFERTYP_DPSEL 0x00200000 +#define XFERTYP_CICEN 0x00100000 +#define XFERTYP_CCCEN 0x00080000 +#define XFERTYP_RSPTYP_NONE 0 +#define XFERTYP_RSPTYP_136 0x00010000 +#define XFERTYP_RSPTYP_48 0x00020000 +#define XFERTYP_RSPTYP_48_BUSY 0x00030000 +#define XFERTYP_MSBSEL 0x00000020 +#define XFERTYP_DTDSEL 0x00000010 +#define XFERTYP_DDREN 0x00000008 +#define XFERTYP_AC12EN 0x00000004 +#define XFERTYP_BCEN 0x00000002 +#define XFERTYP_DMAEN 0x00000001 + +/* Command response 0/1/2/3 register */ +#define CMDRSP0 0x2e010 +#define CMDRSP1 0x2e014 +#define CMDRSP2 0x2e018 +#define CMDRSP3 0x2e01c + +/* Buffer data port register */ +#define DATPORT 0x2e020 + +/* Present state register */ +#define PRSSTAT 0x0002e024 +#define PRSSTAT_DAT0 (0x01000000) +#define PRSSTAT_CLSL (0x00800000) +#define PRSSTAT_WPSPL (0x00080000) +#define PRSSTAT_CDPL (0x00040000) +#define PRSSTAT_CINS (0x00010000) +#define PRSSTAT_BREN (0x00000800) +#define PRSSTAT_BWEN (0x00000400) +#define PRSSTAT_SDSTB (0X00000008) +#define PRSSTAT_DLA (0x00000004) +#define PRSSTAT_CICHB (0x00000002) +#define PRSSTAT_CIDHB (0x00000001) + +/* Protocol control register */ +#define PROCTL 0x0002e028 +#define PROCTL_INIT 0x00000020 +#define PROCTL_DTW_4 0x00000002 +#define PROCTL_DTW_8 0x00000004 +#define PROCTL_D3CD 0x00000008 + +/* Syetem control register */ #define SYSCTL 0x0002e02c#define SYSCTL_INITA 0x08000000#define SYSCTL_TIMEOUT_MASK 0x000f0000#define SYSCTL_CLOCK_MASK 0x0000fff0 -#if !defined(CONFIG_FSL_USDHC )#define SYSCTL_CKEN 0x00000008#define SYSCTL_PEREN 0x00000004#define SYSCTL_HCKEN 0x00000002#define SYSCTL_IPGEN 0x00000001 -#endif #define SYSCTL_RSTA 0x01000000#define SYSCTL_RSTC 0x02000000#define SYSCTL_RSTD 0x04000000 -#define VENDORSPEC_CKEN 0x00004000 -#define VENDORSPEC_PEREN 0x00002000 -#define VENDORSPEC_HCKEN 0x00001000 -#define VENDORSPEC_IPGEN 0x00000800 -#define VENDORSPEC_INIT 0x20007809 - +/* Interrupt status register */ #define IRQSTAT 0x0002e030#define IRQSTAT_DMAE (0x10000000)#define IRQSTAT_AC12E (0x01000000)@@ -63,9 +123,10 @@#define CMD_ERR (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE)#define DATA_ERR (IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \ - IRQSTAT_DMAE) + IRQSTAT_DMAE)#define DATA_COMPLETE (IRQSTAT_TC | IRQSTAT_DINT) +/* Interrupt status enable register */ #define IRQSTATEN 0x0002e034#define IRQSTATEN_DMAE (0x10000000)#define IRQSTATEN_AC12E (0x01000000)@@ -86,62 +147,15 @@#define IRQSTATEN_TC (0x00000002)#define IRQSTATEN_CC (0x00000001) -#define ESDHCCTL 0x0002e40c -#define ESDHCCTL_PCS (0x00080000) - -#define PRSSTAT 0x0002e024 -#define PRSSTAT_DAT0 (0x01000000) -#define PRSSTAT_CLSL (0x00800000) -#define PRSSTAT_WPSPL (0x00080000) -#define PRSSTAT_CDPL (0x00040000) -#define PRSSTAT_CINS (0x00010000) -#define PRSSTAT_BREN (0x00000800) -#define PRSSTAT_BWEN (0x00000400) -#define PRSSTAT_SDSTB (0X00000008) -#define PRSSTAT_DLA (0x00000004) -#define PRSSTAT_CICHB (0x00000002) -#define PRSSTAT_CIDHB (0x00000001) - -#define PROCTL 0x0002e028 -#define PROCTL_INIT 0x00000020 -#define PROCTL_DTW_4 0x00000002 -#define PROCTL_DTW_8 0x00000004 -#define PROCTL_D3CD 0x00000008 - -#define CMDARG 0x0002e008 - -#define XFERTYP 0x0002e00c -#define XFERTYP_CMD (x) ((x & 0x3f) << 24) -#define XFERTYP_CMDTYP_NORMAL 0x0 -#define XFERTYP_CMDTYP_SUSPEND 0x00400000 -#define XFERTYP_CMDTYP_RESUME 0x00800000 -#define XFERTYP_CMDTYP_ABORT 0x00c00000 -#define XFERTYP_DPSEL 0x00200000 -#define XFERTYP_CICEN 0x00100000 -#define XFERTYP_CCCEN 0x00080000 -#define XFERTYP_RSPTYP_NONE 0 -#define XFERTYP_RSPTYP_136 0x00010000 -#define XFERTYP_RSPTYP_48 0x00020000 -#define XFERTYP_RSPTYP_48_BUSY 0x00030000 -#define XFERTYP_MSBSEL 0x00000020 -#define XFERTYP_DTDSEL 0x00000010 -#define XFERTYP_DDREN 0x00000008 -#define XFERTYP_AC12EN 0x00000004 -#define XFERTYP_BCEN 0x00000002 -#define XFERTYP_DMAEN 0x00000001 - -#define CINS_TIMEOUT 1000 -#define PIO_TIMEOUT 500 - -#define DSADDR 0x2e004 - -#define CMDRSP0 0x2e010 -#define CMDRSP1 0x2e014 -#define CMDRSP2 0x2e018 -#define CMDRSP3 0x2e01c - -#define DATPORT 0x2e020 +/* Host controller capabilities register */ +#define ESDHC_HOSTCAPBLT_VS18 0x04000000 +#define ESDHC_HOSTCAPBLT_VS30 0x02000000 +#define ESDHC_HOSTCAPBLT_VS33 0x01000000 +#define ESDHC_HOSTCAPBLT_SRS 0x00800000 +#define ESDHC_HOSTCAPBLT_DMAS 0x00400000 +#define ESDHC_HOSTCAPBLT_HSS 0x00200000 +/* Watermark level register */ #define WML 0x2e044#define WML_WRITE 0x00010000#ifdef CONFIG_FSL_SDHC_V2_3 @@ -160,21 +174,23 @@#define WML_WR_WML_MASK 0xff0000#endif -#define BLKATTR 0x2e004 -#define BLKATTR_CNT (x) ((x & 0xffff) << 16) -#define BLKATTR_SIZE (x) (x & 0x1fff) -#define MAX_BLK_CNT 0x7fff/* so malloc will have enough room with 32M */
include/fsl_esdhc.h +36
-24+/* eSDHC control register */ +#define ESDHCCTL 0x0002e40c +#define ESDHCCTL_PCS (0x00080000) -#define ESDHC_HOSTCAPBLT_VS18 0x04000000 -#define ESDHC_HOSTCAPBLT_VS30 0x02000000 -#define ESDHC_HOSTCAPBLT_VS33 0x01000000 -#define ESDHC_HOSTCAPBLT_SRS 0x00800000 -#define ESDHC_HOSTCAPBLT_DMAS 0x00400000 -#define ESDHC_HOSTCAPBLT_HSS 0x00200000 +/* +* i.MX eSDHC specific register definition */ -#define ESDHC_VENDORSPEC_VSELECT 0x00000002/* Use 1.8V */ +/* Vendor specific register */ +#define VENDORSPEC_CKEN 0x00004000 +#define VENDORSPEC_PEREN 0x00002000 +#define VENDORSPEC_HCKEN 0x00001000 +#define VENDORSPEC_IPGEN 0x00000800 +#define VENDORSPEC_INIT 0x20007809 +#define VENDORSPEC_VSELECT 0x00000002/* Use 1.8V */ -/* Imported from Linux Kernel drivers/mmc/host/sdhci-esdhc-imx.c */ +/* Mixer control register */ #define MIX_CTRL_DDREN BIT(3)#define MIX_CTRL_DTDSEL_READ BIT(4)#define MIX_CTRL_AC23EN BIT(7)@@ -189,24 +205,30 @@/* Tuning bits */ #define MIX_CTRL_TUNING_MASK 0x03c00000 -/* strobe dll register */ -#define ESDHC_STROBE_DLL_CTRL 0x70 -#define ESDHC_STROBE_DLL_CTRL_ENABLE BIT(0) -#define ESDHC_STROBE_DLL_CTRL_RESET BIT(1) -#define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT 0x7 -#define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT 3 +/* Strobe dll control register */ +#define STROBE_DLL_CTRL 0x70 +#define STROBE_DLL_CTRL_ENABLE BIT(0) +#define STROBE_DLL_CTRL_RESET BIT(1) +#define STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT 0x7 +#define STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT 3 -#define ESDHC_STROBE_DLL_STATUS 0x74 -#define ESDHC_STROBE_DLL_STS_REF_LOCK BIT(1) -#define ESDHC_STROBE_DLL_STS_SLV_LOCK 0x1 -#define ESDHC_STROBE_DLL_CLK_FREQ 100000000 +/* Strobe dll status register */ +#define STROBE_DLL_STATUS 0x74 +#define STROBE_DLL_STS_REF_LOCK BIT(1) +#define STROBE_DLL_STS_SLV_LOCK 0x1 +#define STROBE_DLL_CLK_FREQ 100000000 -#define ESDHC_STD_TUNING_EN BIT(24) +/* Tuning control register */ +#define STD_TUNING_EN BIT(24)/* NOTE: the minimum valid tuning start tap for mx6sl is 1 */ -#define ESDHC_TUNING_START_TAP_DEFAULT 0x1 -#define ESDHC_TUNING_START_TAP_MASK 0xff -#define ESDHC_TUNING_STEP_MASK 0x00070000 -#define ESDHC_TUNING_STEP_SHIFT 16 +#define TUNING_START_TAP_DEFAULT 0x1 +#define TUNING_START_TAP_MASK 0xff +#define TUNING_STEP_MASK 0x00070000 +#define TUNING_STEP_SHIFT 16 + +/* +* Other definition +*/ #define ESDHC_FLAG_MULTIBLK_NO_INT BIT(1)#define ESDHC_FLAG_ENGCM07207 BIT(2)@@ -220,6 +242,8 @@#define ESDHC_FLAG_ERR010450 BIT(10)#define ESDHC_FLAG_HS400_ES BIT(11) +#define PIO_TIMEOUT 500 +struct fsl_esdhc_cfg {phys_addr_t esdhc_base;u32 sdhc_clk; --2.17.1
PATCH 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.
--- 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 3/3 mmc: fsl_esdhc: clarify i.MX eSDHC specific functions
Quoted 15 lines
-----Original Message-----
From: Y.b. Lu
Sent: 2019年2月14日 16:21
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: [PATCH 3/3] mmc:fsl_esdhc: clarify i.MX eSDHC specific functionsA 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.
Quoted 6 lines
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.
Fixes 51313b49f2b8 (mmc: fsl_esdhc: support SDR104 and HS200)Signed-off-by Yangbo Lu <[email protected]>
Quoted 179 lines
--- drivers/mmc/fsl_esdhc.c | 79 +++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 38 deletions(-)drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0
-0
63f922382f..44c040eb8d100644drivers/mmc/fsl_esdhc.c +2
-2@@ -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
voidesdhc_reset_tuning(struct mmc *mmc)drivers/mmc/fsl_esdhc.c +1
-1} } -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 @@ staticvoid
esdhc_set_strobe_dll(struct mmc *mmc)drivers/mmc/fsl_esdhc.c +1
-1} } -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)drivers/mmc/fsl_esdhc.c +4
-5switch (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) #endifdrivers/mmc/fsl_esdhc.c +30
-26} -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_datausdhc_imx7d_data= {drivers/mmc/fsl_esdhc.c +3
-4- .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, }; --2.17.1
PATCH 1/3 mmc: fsl_esdhc: add esdhc_imx flag
In reply to Y.b. LuQuoted 47 lines
-----Original Message-----
From: Y.b. Lu
Sent: 2019年2月14日 16:21
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: [PATCH 1/3] mmc:fsl_esdhc: addesdhc_imxflagThe
fsl_esdhcdriver 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 added an
esdhc_imxflag for the development of i.MX eSDHC, to distinguish it with QoriQ eSDHC.Signed-off-by Yangbo Lu <[email protected]>--- 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..787a13a8a9100644drivers/mmc/fsl_esdhc.c +1
-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; }
drivers/mmc/fsl_esdhc.c struct fsl_esdhc_priv { · line 1474
Quoted 10 lines
drivers/mmc/fsl_esdhc.c +9
-0+/* +* 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 (!fdt_node_check_compatible (fdt, node,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false;
Suggest use device_is_compatible(dev, "fsl,esdhc")
Regards,
Peng.
Quoted 6 lines
drivers/mmc/fsl_esdhc.c +1
-1+ val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ; --2.17.1
PATCH 1/3 mmc: fsl_esdhc: add esdhc_imx flag
Quoted 21 lines
-----Original Message-----
From: Peng Fan
Sent: Thursday, February 14, 2019 5:11 PM
To: Y.b. Lu <[email protected]>; u-boot at lists.denx.de
Cc: Jaehoon Chung <[email protected]>; Prabhakar Kushwaha <[email protected]>
Subject: RE: [PATCH 1/3] mmc:fsl_esdhc: addesdhc_imxflagQuoted 9 lines
-----Original Message-----
From: Y.b. Lu
Sent: 2019年2月14日 16:21
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: [PATCH 1/3] mmc:fsl_esdhc: addesdhc_imxflag
[...]
Quoted 12 lines
drivers/mmc/fsl_esdhc.c static int fsl_esdhc_probe(struct udevice *dev) · line 1474
Quoted 9 lines
drivers/mmc/fsl_esdhc.c +9
-0+/* +* 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 (!fdt_node_check_compatible (fdt, node,"fsl,esdhc" )) + priv->esdhc_imx = true; +else + priv->esdhc_imx = false;Suggest use
device_is_compatible(dev, "fsl,esdhc")
Quoted 3 lines
Regards,
Peng.
[Y.b. Lu] Sent out v2, and converted to use device_is_compatible(). Thanks a lot.
Quoted 6 lines
Quoted 6 lines
drivers/mmc/fsl_esdhc.c +1
-1+ val =dev_read_u32_default (dev,"bus-width" ,-1 );if (val ==8 ) priv->bus_width =8 ; --2.17.1