ARM: OMAP5/DRA7: Enable iodelay recalibration to be done from uboot
authorKishon Vijay Abraham I <kishon@ti.com>
Tue, 30 Jan 2018 15:01:39 +0000 (16:01 +0100)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 19 Feb 2018 07:58:55 +0000 (16:58 +0900)
Add a new API to perform iodelay recalibration without isolate
io to be used in uboot.

The data manual of J6/J6 Eco recommends to set different IODELAY values
depending on the mode in which the MMC/SD is enumerated in order to
ensure IO timings are met. The MMC driver can use the new API to
set the IO delay values depending on the MMC mode.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
arch/arm/include/asm/arch-omap5/dra7xx_iodelay.h
arch/arm/mach-omap2/omap5/dra7xx_iodelay.c
include/configs/am57xx_evm.h
include/configs/dra7xx_evm.h

index c99700403914f1edaff63051c5fee653fbd790dc..a8780eeef81c1ee8f7b354b25864064cf0040808 100644 (file)
@@ -83,6 +83,9 @@
 void __recalibrate_iodelay(struct pad_conf_entry const *pad, int npads,
                           struct iodelay_cfg_entry const *iodelay,
                           int niodelays);
+void late_recalibrate_iodelay(struct pad_conf_entry const *pad, int npads,
+                             struct iodelay_cfg_entry const *iodelay,
+                             int niodelays);
 int __recalibrate_iodelay_start(void);
 void __recalibrate_iodelay_end(int ret);
 
index 87987308aced133b88504e3bf27266c90b903753..a9a9f75e6eb84e5d76abacd3b79e242cc66872f8 100644 (file)
@@ -272,3 +272,33 @@ err:
        __recalibrate_iodelay_end(ret);
 
 }
+
+void late_recalibrate_iodelay(struct pad_conf_entry const *pad, int npads,
+                             struct iodelay_cfg_entry const *iodelay,
+                             int niodelays)
+{
+       int ret = 0;
+
+       /* unlock IODELAY CONFIG registers */
+       writel(CFG_IODELAY_UNLOCK_KEY, (*ctrl)->iodelay_config_base +
+              CFG_REG_8_OFFSET);
+
+       ret = calibrate_iodelay((*ctrl)->iodelay_config_base);
+       if (ret)
+               goto err;
+
+       ret = update_delay_mechanism((*ctrl)->iodelay_config_base);
+
+       /* Configure Mux settings */
+       do_set_mux32((*ctrl)->control_padconf_core_base, pad, npads);
+
+       /* Configure Manual IO timing modes */
+       ret = do_set_iodelay((*ctrl)->iodelay_config_base, iodelay, niodelays);
+       if (ret)
+               goto err;
+
+err:
+       /* lock IODELAY CONFIG registers */
+       writel(CFG_IODELAY_LOCK_KEY, (*ctrl)->iodelay_config_base +
+              CFG_REG_8_OFFSET);
+}
index 7546b3f9d049d124710ea1ddffd24442acfffd2c..65465d1f7901800070fefaaa3740d6c9d36a4695 100644 (file)
@@ -15,9 +15,7 @@
 #include <environment/ti/dfu.h>
 #include <linux/sizes.h>
 
-#ifdef CONFIG_SPL_BUILD
 #define CONFIG_IODELAY_RECALIBRATION
-#endif
 
 #define CONFIG_NR_DRAM_BANKS           2
 
index ff90b6df7229a20fbcf6f7a905ee211ebeb31f1b..975e6fdf58b2374b58b897017c852e5fa5aef952 100644 (file)
@@ -14,9 +14,7 @@
 
 #include <environment/ti/dfu.h>
 
-#ifdef CONFIG_SPL_BUILD
 #define CONFIG_IODELAY_RECALIBRATION
-#endif
 
 #define CONFIG_VERY_BIG_RAM
 #define CONFIG_NR_DRAM_BANKS           2