* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
@ 2018-06-06 4:56 Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 1/3] sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option Vasily Khoruzhick
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Vasily Khoruzhick @ 2018-06-06 4:56 UTC (permalink / raw)
To: u-boot
eMMC seems to require new clocking mode and calibration on A64,
otherwise it is pretty unstable on some boards (e.g. Pinebook)
with some eMMCs.
v2: - improve comment about calibration for eMMC on A64
- simplify ifdef-s around configuring delays
v3: - fix fallout due to ifdef simplification in v2
v4: - really fix ifdefs this time
v5: - add new option for SoCs without new mode switch in CCM
Vasily Khoruzhick (3):
sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option
sunxi-mmc: use new mode on A64
mmc: sunxi: run calibration on A64
arch/arm/include/asm/arch-sunxi/mmc.h | 6 +++++-
arch/arm/mach-sunxi/Kconfig | 2 ++
drivers/mmc/Kconfig | 4 ++++
drivers/mmc/sunxi_mmc.c | 13 +++++++++++++
4 files changed, 24 insertions(+), 1 deletion(-)
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 1/3] sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option
2018-06-06 4:56 [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64 Vasily Khoruzhick
@ 2018-06-06 4:56 ` Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 2/3] sunxi-mmc: use new mode on A64 Vasily Khoruzhick
` (3 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Vasily Khoruzhick @ 2018-06-06 4:56 UTC (permalink / raw)
To: u-boot
A64 doesn't have a mode switch in CCM, so introduce new
MMC_SUNXI_HAS_NEW_MODE_SWITCH option to support new mode on A64
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
arch/arm/mach-sunxi/Kconfig | 1 +
drivers/mmc/Kconfig | 4 ++++
drivers/mmc/sunxi_mmc.c | 2 ++
3 files changed, 7 insertions(+)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index b9f778dd24..c4dc0f7672 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -213,6 +213,7 @@ config MACH_SUN8I_A83T
select PHY_SUN4I_USB
select SUNXI_GEN_SUN6I
select MMC_SUNXI_HAS_NEW_MODE
+ select MMC_SUNXI_HAS_NEW_MODE_SWITCH
select SUPPORT_SPL
config MACH_SUN8I_H3
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 693b3ceaf0..f8e435a2a2 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -536,6 +536,10 @@ config MMC_SUNXI_HAS_NEW_MODE
bool
depends on MMC_SUNXI
+config MMC_SUNXI_HAS_NEW_MODE_SWITCH
+ bool
+ depends on MMC_SUNXI
+
config GENERIC_ATMEL_MCI
bool "Atmel Multimedia Card Interface support"
depends on DM_MMC && BLK && ARCH_AT91
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index fe6d82c7b4..43c6d7c346 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -166,7 +166,9 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
if (new_mode) {
#ifdef CONFIG_MMC_SUNXI_HAS_NEW_MODE
+#ifdef CONFIG_MMC_SUNXI_HAS_NEW_MODE_SWITCH
val = CCM_MMC_CTRL_MODE_SEL_NEW;
+#endif
setbits_le32(&priv->reg->ntsr, SUNXI_MMC_NTSR_MODE_SEL_NEW);
#endif
} else {
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 2/3] sunxi-mmc: use new mode on A64
2018-06-06 4:56 [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64 Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 1/3] sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option Vasily Khoruzhick
@ 2018-06-06 4:56 ` Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 3/3] mmc: sunxi: run calibration " Vasily Khoruzhick
` (2 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Vasily Khoruzhick @ 2018-06-06 4:56 UTC (permalink / raw)
To: u-boot
That is necessary for using automatic calibration on A64 eMMC.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
arch/arm/mach-sunxi/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index c4dc0f7672..fbba20ce10 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -267,6 +267,7 @@ config MACH_SUN50I
select SUNXI_GEN_SUN6I
select SUN6I_PRCM
select SUNXI_HIGH_SRAM
+ select MMC_SUNXI_HAS_NEW_MODE
select SUPPORT_SPL
select SUNXI_DRAM_DW
select SUNXI_DRAM_DW_32BIT
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 3/3] mmc: sunxi: run calibration on A64
2018-06-06 4:56 [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64 Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 1/3] sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 2/3] sunxi-mmc: use new mode on A64 Vasily Khoruzhick
@ 2018-06-06 4:56 ` Vasily Khoruzhick
2018-06-06 6:59 ` [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues " Maxime Ripard
2018-06-16 9:47 ` Jagan Teki
4 siblings, 0 replies; 13+ messages in thread
From: Vasily Khoruzhick @ 2018-06-06 4:56 UTC (permalink / raw)
To: u-boot
Along with using new mode it fixes eMMC instability on Pinebook
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
arch/arm/include/asm/arch-sunxi/mmc.h | 6 +++++-
drivers/mmc/sunxi_mmc.c | 11 +++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h
index 1574b8e8fe..d6664a01f2 100644
--- a/arch/arm/include/asm/arch-sunxi/mmc.h
+++ b/arch/arm/include/asm/arch-sunxi/mmc.h
@@ -46,7 +46,9 @@ struct sunxi_mmc {
u32 cbda; /* 0x94 */
u32 res2[26];
#ifdef CONFIG_SUNXI_GEN_SUN6I
- u32 res3[64];
+ u32 res3[17];
+ u32 samp_dl;
+ u32 res4[46];
#endif
u32 fifo; /* 0x100 / 0x200 FIFO access address */
};
@@ -130,5 +132,7 @@ struct sunxi_mmc {
#define SUNXI_MMC_COMMON_CLK_GATE (1 << 16)
#define SUNXI_MMC_COMMON_RESET (1 << 18)
+#define SUNXI_MMC_CAL_DL_SW_EN (0x1 << 7)
+
struct mmc *sunxi_mmc_init(int sdc_no);
#endif /* _SUNXI_MMC_H */
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 43c6d7c346..624c907154 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -225,6 +225,17 @@ static int mmc_config_clock(struct sunxi_mmc_priv *priv, struct mmc *mmc)
rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK;
writel(rval, &priv->reg->clkcr);
+#ifdef CONFIG_MACH_SUN50I
+ /* A64 needs to run calibration on eMMC controller and we
+ * have to set delay of zero before starting calibration.
+ * Allwinner BSP driver sets a delay only in the case of
+ * using HS400 which is not supported by mainline U-Boot or
+ * Linux at the moment
+ */
+ if (priv->mmc_no == 2)
+ writel(SUNXI_MMC_CAL_DL_SW_EN, &priv->reg->samp_dl);
+#endif
+
/* Re-enable Clock */
rval |= SUNXI_MMC_CLK_ENABLE;
writel(rval, &priv->reg->clkcr);
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-06 4:56 [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64 Vasily Khoruzhick
` (2 preceding siblings ...)
2018-06-06 4:56 ` [U-Boot] [PATCH v5 3/3] mmc: sunxi: run calibration " Vasily Khoruzhick
@ 2018-06-06 6:59 ` Maxime Ripard
2018-06-16 9:47 ` Jagan Teki
4 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-06-06 6:59 UTC (permalink / raw)
To: u-boot
On Tue, Jun 05, 2018 at 09:56:26PM -0700, Vasily Khoruzhick wrote:
> eMMC seems to require new clocking mode and calibration on A64,
> otherwise it is pretty unstable on some boards (e.g. Pinebook)
> with some eMMCs.
>
> v2: - improve comment about calibration for eMMC on A64
> - simplify ifdef-s around configuring delays
> v3: - fix fallout due to ifdef simplification in v2
> v4: - really fix ifdefs this time
> v5: - add new option for SoCs without new mode switch in CCM
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Thanks!
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180606/c63a7d4c/attachment.sig>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-06 4:56 [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64 Vasily Khoruzhick
` (3 preceding siblings ...)
2018-06-06 6:59 ` [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues " Maxime Ripard
@ 2018-06-16 9:47 ` Jagan Teki
2018-06-16 17:45 ` Vasily Khoruzhick
4 siblings, 1 reply; 13+ messages in thread
From: Jagan Teki @ 2018-06-16 9:47 UTC (permalink / raw)
To: u-boot
On Wed, Jun 6, 2018 at 10:26 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> eMMC seems to require new clocking mode and calibration on A64,
> otherwise it is pretty unstable on some boards (e.g. Pinebook)
> with some eMMCs.
>
> v2: - improve comment about calibration for eMMC on A64
> - simplify ifdef-s around configuring delays
> v3: - fix fallout due to ifdef simplification in v2
> v4: - really fix ifdefs this time
> v5: - add new option for SoCs without new mode switch in CCM
>
> Vasily Khoruzhick (3):
> sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option
> sunxi-mmc: use new mode on A64
> mmc: sunxi: run calibration on A64
I have still observing eMMC boot issue, this need to debug further
U-Boot SPL 2018.07-rc1-00164-g117d5917d2 (Jun 16 2018 - 15:12:28 +0530)
DRAM: 1024 MiB
Trying to boot from MMC2
unable to select a mode
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
Jagan.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-16 9:47 ` Jagan Teki
@ 2018-06-16 17:45 ` Vasily Khoruzhick
2018-06-18 7:43 ` Jagan Teki
0 siblings, 1 reply; 13+ messages in thread
From: Vasily Khoruzhick @ 2018-06-16 17:45 UTC (permalink / raw)
To: u-boot
On Sat, Jun 16, 2018 at 2:47 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> On Wed, Jun 6, 2018 at 10:26 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>> eMMC seems to require new clocking mode and calibration on A64,
>> otherwise it is pretty unstable on some boards (e.g. Pinebook)
>> with some eMMCs.
>>
>> v2: - improve comment about calibration for eMMC on A64
>> - simplify ifdef-s around configuring delays
>> v3: - fix fallout due to ifdef simplification in v2
>> v4: - really fix ifdefs this time
>> v5: - add new option for SoCs without new mode switch in CCM
>>
>> Vasily Khoruzhick (3):
>> sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option
>> sunxi-mmc: use new mode on A64
>> mmc: sunxi: run calibration on A64
>
> I have still observing eMMC boot issue, this need to debug further
It boots for me from eMMC on Pinebook and Pine64-LTS, thus I have no
hardware to debug it further.
Moreover, Linux also does calibration on A64 for eMMC, do you
experience any issues with eMMC in Linux?
> U-Boot SPL 2018.07-rc1-00164-g117d5917d2 (Jun 16 2018 - 15:12:28 +0530)
> DRAM: 1024 MiB
> Trying to boot from MMC2
> unable to select a mode
> mmc_load_image_raw_sector: mmc block read error
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
>
> Jagan.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-16 17:45 ` Vasily Khoruzhick
@ 2018-06-18 7:43 ` Jagan Teki
2018-06-19 6:25 ` Vasily Khoruzhick
0 siblings, 1 reply; 13+ messages in thread
From: Jagan Teki @ 2018-06-18 7:43 UTC (permalink / raw)
To: u-boot
On Sat, Jun 16, 2018 at 11:15 PM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> On Sat, Jun 16, 2018 at 2:47 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>> On Wed, Jun 6, 2018 at 10:26 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>>> eMMC seems to require new clocking mode and calibration on A64,
>>> otherwise it is pretty unstable on some boards (e.g. Pinebook)
>>> with some eMMCs.
>>>
>>> v2: - improve comment about calibration for eMMC on A64
>>> - simplify ifdef-s around configuring delays
>>> v3: - fix fallout due to ifdef simplification in v2
>>> v4: - really fix ifdefs this time
>>> v5: - add new option for SoCs without new mode switch in CCM
>>>
>>> Vasily Khoruzhick (3):
>>> sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option
>>> sunxi-mmc: use new mode on A64
>>> mmc: sunxi: run calibration on A64
>>
>> I have still observing eMMC boot issue, this need to debug further
>
> It boots for me from eMMC on Pinebook and Pine64-LTS, thus I have no
> hardware to debug it further.
Don't have these hardware with me.
>
> Moreover, Linux also does calibration on A64 for eMMC, do you
> experience any issues with eMMC in Linux?
Yes I'm able to detect eMMC in Linux.
So we need to investigate what makes failing mode.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-18 7:43 ` Jagan Teki
@ 2018-06-19 6:25 ` Vasily Khoruzhick
2018-06-19 6:33 ` Jagan Teki
0 siblings, 1 reply; 13+ messages in thread
From: Vasily Khoruzhick @ 2018-06-19 6:25 UTC (permalink / raw)
To: u-boot
On Mon, Jun 18, 2018 at 12:43 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>
> Don't have these hardware with me.
Could you test this patch on your hardware when you get some time?
https://github.com/anarsoul/u-boot-pine64/commit/a3f5d175a5ed0ece7a7720f1e665809c9f140850.patch
It uses calibration without using new clock mode and it fixes eMMC on
Pinebook for me as well.
Also works fine on Pine64-LTS.
If it works for you I'll clean it up and send it out.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-19 6:25 ` Vasily Khoruzhick
@ 2018-06-19 6:33 ` Jagan Teki
2018-06-19 6:56 ` Jagan Teki
0 siblings, 1 reply; 13+ messages in thread
From: Jagan Teki @ 2018-06-19 6:33 UTC (permalink / raw)
To: u-boot
On Tue, Jun 19, 2018 at 11:55 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> On Mon, Jun 18, 2018 at 12:43 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>>
>> Don't have these hardware with me.
>
> Could you test this patch on your hardware when you get some time?
>
> https://github.com/anarsoul/u-boot-pine64/commit/a3f5d175a5ed0ece7a7720f1e665809c9f140850.patch
On top of your changes or separately?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-19 6:33 ` Jagan Teki
@ 2018-06-19 6:56 ` Jagan Teki
2018-06-19 15:03 ` Vasily Khoruzhick
0 siblings, 1 reply; 13+ messages in thread
From: Jagan Teki @ 2018-06-19 6:56 UTC (permalink / raw)
To: u-boot
On Tue, Jun 19, 2018 at 12:03 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> On Tue, Jun 19, 2018 at 11:55 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>> On Mon, Jun 18, 2018 at 12:43 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>>>
>>> Don't have these hardware with me.
>>
>> Could you test this patch on your hardware when you get some time?
>>
>> https://github.com/anarsoul/u-boot-pine64/commit/a3f5d175a5ed0ece7a7720f1e665809c9f140850.patch
>
> On top of your changes or separately?
This what[1] I changed on top of your changes, same issue.
[1] https://paste.ubuntu.com/p/NjYyMk68P6/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-19 6:56 ` Jagan Teki
@ 2018-06-19 15:03 ` Vasily Khoruzhick
2018-06-20 11:38 ` Jagan Teki
0 siblings, 1 reply; 13+ messages in thread
From: Vasily Khoruzhick @ 2018-06-19 15:03 UTC (permalink / raw)
To: u-boot
On Mon, Jun 18, 2018 at 11:56 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>
> This what[1] I changed on top of your changes, same issue.
>
> [1] https://paste.ubuntu.com/p/NjYyMk68P6/
It should be tested separately.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64
2018-06-19 15:03 ` Vasily Khoruzhick
@ 2018-06-20 11:38 ` Jagan Teki
0 siblings, 0 replies; 13+ messages in thread
From: Jagan Teki @ 2018-06-20 11:38 UTC (permalink / raw)
To: u-boot
On Tue, Jun 19, 2018 at 8:33 PM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> On Mon, Jun 18, 2018 at 11:56 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>>
>> This what[1] I changed on top of your changes, same issue.
>>
>> [1] https://paste.ubuntu.com/p/NjYyMk68P6/
>
> It should be tested separately.
Works for me, with md 0x01c11144 value as 00000080
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2018-06-20 11:38 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-06 4:56 [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues on A64 Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 1/3] sunxi-mmc: introduce new MMC_SUNXI_HAS_NEW_MODE_SWITCH option Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 2/3] sunxi-mmc: use new mode on A64 Vasily Khoruzhick
2018-06-06 4:56 ` [U-Boot] [PATCH v5 3/3] mmc: sunxi: run calibration " Vasily Khoruzhick
2018-06-06 6:59 ` [U-Boot] [PATCH v5 0/3] sunxi: fix eMMC stability issues " Maxime Ripard
2018-06-16 9:47 ` Jagan Teki
2018-06-16 17:45 ` Vasily Khoruzhick
2018-06-18 7:43 ` Jagan Teki
2018-06-19 6:25 ` Vasily Khoruzhick
2018-06-19 6:33 ` Jagan Teki
2018-06-19 6:56 ` Jagan Teki
2018-06-19 15:03 ` Vasily Khoruzhick
2018-06-20 11:38 ` Jagan Teki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.