Fix issues with phy configurations in am65x MMC driver
Subsystems (3)
v2 cover Fix issues with phy configurations in am65x MMC driver
The following patches fix issues with phy configurations for sdhci_am654 driver.
v2:
1. Split patch 1 into 2 separate patches.
2. Improved patch descriptions.
Faiz Abbas (3):
mmc: sdhci_am654: Improve line wrapping with regmap_*() calls
mmc: sdhci_am654: Print error message if the DLL fails to lock
mmc: sdhci_am654: Fix SLOTTYPE write
drivers/mmc/host/sdhci_am654.c | 37 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 20 deletions(-)
Signature · 1 line
2.19.2
PATCH v2 1/3 mmc: sdhci_am654: Improve line wrapping with regmap_*() calls
Line wrapping with the regmap_*() functions is way more conservative than required by the 80 character rule. Expand the function calls out to use less number of lines.
--- drivers/mmc/host/sdhci_am654.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-)
drivers/mmc/host/sdhci_am654.c +13 -21
@@ -88,8 +88,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)int ret;if (sdhci_am654->dll_on) { -regmap_update_bits (sdhci_am654->base,PHY_CTRL1 , -ENDLL_MASK ,0 ); +regmap_update_bits (sdhci_am654->base,PHY_CTRL1 ,ENDLL_MASK ,0 ); sdhci_am654->dll_on = false; }
@@ -101,8 +100,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock) mask =OTAPDLYENA_MASK |OTAPDLYSEL_MASK ; val = (1 <<OTAPDLYENA_SHIFT ) | (sdhci_am654->otap_del_sel <<OTAPDLYSEL_SHIFT ); -regmap_update_bits (sdhci_am654->base,PHY_CTRL4 , - mask, val); +regmap_update_bits (sdhci_am654->base,PHY_CTRL4 , mask, val);switch (clock) {case 200000000 : sel50 =0 ;
@@ -120,8 +118,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)/* Configure PHY DLL frequency */ mask =SEL50_MASK |SEL100_MASK ; val = (sel50 <<SEL50_SHIFT ) | (sel100 <<SEL100_SHIFT ); -regmap_update_bits (sdhci_am654->base,PHY_CTRL5 , - mask, val); +regmap_update_bits (sdhci_am654->base,PHY_CTRL5 , mask, val);/* Configure DLL TRIM */ mask =DLL_TRIM_ICP_MASK ; val = sdhci_am654->trm_icp <<DLL_TRIM_ICP_SHIFT ;
@@ -129,20 +126,17 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)/* Configure DLL driver strength */ mask |=DR_TY_MASK ; val |= sdhci_am654->drv_strength <<DR_TY_SHIFT ; -regmap_update_bits (sdhci_am654->base,PHY_CTRL1 , - mask, val); +regmap_update_bits (sdhci_am654->base,PHY_CTRL1 , mask, val);/* Enable DLL */ -regmap_update_bits (sdhci_am654->base,PHY_CTRL1 , -ENDLL_MASK ,0x1 <<ENDLL_SHIFT ); +regmap_update_bits (sdhci_am654->base,PHY_CTRL1 ,ENDLL_MASK , +0x1 <<ENDLL_SHIFT );/* * Poll for DLL ready. Use a one second timeout. * Works in all experiments done so far */ - ret =regmap_read_poll_timeout (sdhci_am654->base, -PHY_STAT1 , val, - val &DLLRDY_MASK , -1000 ,1000000 ); - + ret =regmap_read_poll_timeout (sdhci_am654->base,PHY_STAT1 , + val, val &DLLRDY_MASK ,1000 , +1000000 ); sdhci_am654->dll_on = true; } }
@@ -208,8 +202,7 @@ static int sdhci_am654_init(struct sdhci_host *host)/* Reset OTAP to default value */ mask =OTAPDLYENA_MASK |OTAPDLYSEL_MASK ; -regmap_update_bits (sdhci_am654->base,PHY_CTRL4 , - mask,0x0 ); +regmap_update_bits (sdhci_am654->base,PHY_CTRL4 , mask,0x0 );regmap_read (sdhci_am654->base,PHY_STAT1 , &val);if (~val &CALDONE_MASK ) {
@@ -223,15 +216,14 @@ static int sdhci_am654_init(struct sdhci_host *host) }/* Enable pins by setting IO mux to 0 */ -regmap_update_bits (sdhci_am654->base,PHY_CTRL1 , -IOMUX_ENABLE_MASK ,0 ); +regmap_update_bits (sdhci_am654->base,PHY_CTRL1 ,IOMUX_ENABLE_MASK ,0 );/* Set slot type based on SD or eMMC */ if (host->mmc->caps &MMC_CAP_NONREMOVABLE ) ctl_cfg_2 =SLOTTYPE_EMBEDDED ; -regmap_update_bits (sdhci_am654->base,CTL_CFG_2 , - ctl_cfg_2,SLOTTYPE_MASK ); +regmap_update_bits (sdhci_am654->base,CTL_CFG_2 , ctl_cfg_2, +SLOTTYPE_MASK );return sdhci_add_host (host); }
Signature · 1 line
2.19.2
PATCH v2 2/3 mmc: sdhci_am654: Print error message if the DLL fails to lock
In reply to Faiz AbbasPrint an error message and return if DLL fails to lock.
--- drivers/mmc/host/sdhci_am654.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/host/sdhci_am654.c +5 -0
@@ -137,6 +137,11 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock) ret =regmap_read_poll_timeout (sdhci_am654->base,PHY_STAT1 , val, val &DLLRDY_MASK ,1000 ,1000000 ); +if (ret) { +dev_err (mmc_dev (host->mmc),"DLL failed to relock\n" ); +return ; + } + sdhci_am654->dll_on = true; } }
Signature · 1 line
2.19.2
PATCH v2 3/3 mmc: sdhci_am654: Fix SLOTTYPE write
In reply to Faiz AbbasIn the call to regmap_update_bits() for SLOTTYPE, the mask and value fields are exchanged. Fix this. This didn't have any affect on the driver because this was a NOP and it was taking the correct value from the bootloader.
--- drivers/mmc/host/sdhci_am654.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci_am654.c +2 -2
@@ -227,8 +227,8 @@ static int sdhci_am654_init(struct sdhci_host *host)if (host->mmc->caps &MMC_CAP_NONREMOVABLE ) ctl_cfg_2 =SLOTTYPE_EMBEDDED ; -regmap_update_bits (sdhci_am654->base,CTL_CFG_2 , ctl_cfg_2, -SLOTTYPE_MASK ); +regmap_update_bits (sdhci_am654->base,CTL_CFG_2 ,SLOTTYPE_MASK , + ctl_cfg_2);return sdhci_add_host (host); }
Signature · 1 line
2.19.2
Adrian Hunter
maintainerRe: [PATCH v2 3/3] mmc: sdhci_am654: Fix SLOTTYPE write
Quoted 6 lines · Faiz Abbas
In the call to
regmap_update_bits()for SLOTTYPE, the mask and value fields are exchanged. Fix this. This didn't have any affect on the driver because this was a NOP and it was taking the correct value from the bootloader.Cc stable <[email protected]>
Except that it doesn't apply to stable because of patch 1. Maybe make this the first patch.
Quoted 21 lines
Signed-off-by Faiz Abbas <[email protected]>--- drivers/mmc/host/sdhci_am654.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mmc/host/sdhci_am654.c +2
-2@@ -227,8 +227,8 @@ static int sdhci_am654_init(struct sdhci_host *host)if (host->mmc->caps &MMC_CAP_NONREMOVABLE ) ctl_cfg_2 =SLOTTYPE_EMBEDDED ; -regmap_update_bits (sdhci_am654->base,CTL_CFG_2 , ctl_cfg_2, -SLOTTYPE_MASK ); +regmap_update_bits (sdhci_am654->base,CTL_CFG_2 ,SLOTTYPE_MASK , + ctl_cfg_2);return sdhci_add_host (host); }
Re: [PATCH v2 3/3] mmc: sdhci_am654: Fix SLOTTYPE write
Hi Adrian,
Quoted 11 lines · Adrian Hunter
Quoted 6 lines · Faiz Abbas
In the call to
regmap_update_bits()for SLOTTYPE, the mask and value fields are exchanged. Fix this. This didn't have any affect on the driver because this was a NOP and it was taking the correct value from the bootloader.Cc stable <[email protected]>Except that it doesn't apply to stable because of patch 1. Maybe make this the first patch.
Ok. Sending v3 with this as first patch.
Thanks,
Faiz