Skip to contentSkip to conversation

mmc: sunxi: Enable DM_MMC

PATCH New Jagan Teki 3 participants 16 messages Jan 11, 2019 – Jan 14, 2019

Subsystems (4)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

cover mmc: sunxi: Enable DM_MMC

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

Add for all Allwinner SoC's and enable at arch/arm/Kconfig.

I shall merge this in comming MW, so early test feel better to go for the release. Request to test respective board takers.

Any inputs,
Jagan.

Jagan Teki (7):
mmc: sunxi: Configure reset support for DM_MMC
mmc: sunxi: Add A83T emmc compatible
mmc: sunxi: Add mmc, emmc H5/A64 compatible
mmc: sunxi: Add DM_MMC support for H6
mmc: sunxi: Add DM_MMC support for A80
arm: sunxi: Enable DM_MMC
arm: dts: sunxi: Enumerate MMC2 as MMC1

 arch/arm/Kconfig                              |  1 +
 arch/arm/dts/sunxi-u-boot.dtsi                |  4 +
 .../include/asm/arch-sunxi/clock_sun50i_h6.h  |  3 +
 arch/arm/mach-sunxi/Kconfig                   |  1 -
 configs/Linksprite_pcDuino3_defconfig         |  1 -
 drivers/mmc/sunxi_mmc.c                       | 73 ++++++++++++++++++-
 6 files changed, 79 insertions(+), 4 deletions(-)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#1 lore raw

PATCH 1/7 mmc: sunxi: Configure reset support for DM_MMC

Start with Allwinner A31, mmc controllers do support reset control bit. This code add support to enable the reset control start from SUN6I even though it share same compatible between SUN4I and SUN6I.

---
 drivers/mmc/sunxi_mmc.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/mmc/sunxi_mmc.c +19 -2
index 302332bf97..0b17e2c391 100644
@@ -21,8 +21,11 @@
 
 #ifdef CONFIG_DM_MMC
 struct sunxi_mmc_variant {
+	bool has_reset;
 	u16 gate_offset;
 	u16 mclk_offset;
+	u16 reset_offset;
+	u8 reset_start_bit;
 };
 #endif
 
@@ -609,7 +612,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
 	struct sunxi_mmc_priv *priv = dev_get_priv(dev);
 	struct mmc_config *cfg = &plat->cfg;
 	struct ofnode_phandle_args args;
-	u32 *gate_reg, *ccu_reg;
+	u32 *gate_reg, *reset_reg, *ccu_reg;
 	int bus_width, ret;
 
 	cfg->name = dev->name;
@@ -644,6 +647,12 @@ static int sunxi_mmc_probe(struct udevice *dev)
 	gate_reg = (void *)ccu_reg + priv->variant->gate_offset;
 	setbits_le32(gate_reg, BIT(AHB_GATE_OFFSET_MMC(priv->mmc_no)));
 
+	if ((!IS_ENABLED(CONFIG_MACH_SUN4I)) && priv->variant->has_reset) {
+		reset_reg = (void *)ccu_reg + priv->variant->reset_offset;
+		setbits_le32(reset_reg, BIT(priv->mmc_no +
+			     priv->variant->reset_start_bit));
+	}
+
 	ret = mmc_set_mod_clk(priv, 24000000);
 	if (ret)
 		return ret;
@@ -680,6 +689,14 @@ static const struct sunxi_mmc_variant sun4i_a10_variant = {
 	.mclk_offset = 0x88,
 };
 
+static const struct sunxi_mmc_variant sun7i_a20_variant = {
+	.has_reset = true,
+	.gate_offset = 0x60,
+	.mclk_offset = 0x88,
+	.reset_offset = 0x2c0,
+	.reset_start_bit = 8,
+};
+
 static const struct udevice_id sunxi_mmc_ids[] = {
 	{
 	  .compatible = "allwinner,sun4i-a10-mmc",
@@ -691,7 +708,7 @@ static const struct udevice_id sunxi_mmc_ids[] = {
 	},
 	{
 	  .compatible = "allwinner,sun7i-a20-mmc",
-	  .data = (ulong)&sun4i_a10_variant,
+	  .data = (ulong)&sun7i_a20_variant,
 	},
 	{ /* sentinel */ }
 };
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#2 lore raw

PATCH 2/7 mmc: sunxi: Add A83T emmc compatible

In reply to Jagan Teki

Add emmc compatible for A83T SoC.

---
 drivers/mmc/sunxi_mmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/sunxi_mmc.c +4 -0
index 0b17e2c391..5557111c1f 100644
@@ -710,6 +710,10 @@ static const struct udevice_id sunxi_mmc_ids[] = {
 	  .compatible = "allwinner,sun7i-a20-mmc",
 	  .data = (ulong)&sun7i_a20_variant,
 	},
+	{
+	  .compatible = "allwinner,sun8i-a83t-emmc",
+	  .data = (ulong)&sun7i_a20_variant,
+	},
 	{ /* sentinel */ }
 };
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#3 lore raw

PATCH 3/7 mmc: sunxi: Add mmc, emmc H5/A64 compatible

In reply to Jagan Teki

Added H5, A64 compatible for mmc and emmc.

---
 drivers/mmc/sunxi_mmc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/mmc/sunxi_mmc.c +8 -0
index 5557111c1f..b50d70645a 100644
@@ -714,6 +714,14 @@ static const struct udevice_id sunxi_mmc_ids[] = {
 	  .compatible = "allwinner,sun8i-a83t-emmc",
 	  .data = (ulong)&sun7i_a20_variant,
 	},
+	{
+	  .compatible = "allwinner,sun50i-a64-mmc",
+	  .data = (ulong)&sun7i_a20_variant,
+	},
+	{
+	  .compatible = "allwinner,sun50i-a64-emmc",
+	  .data = (ulong)&sun7i_a20_variant,
+	},
 	{ /* sentinel */ }
 };
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#4 lore raw

PATCH 4/7 mmc: sunxi: Add DM_MMC support for H6

In reply to Jagan Teki

Unlike other Allwinner SoC's, H6 comes with different clock and reset control offset values. So support them via driver data.

---
 .../arm/include/asm/arch-sunxi/clock_sun50i_h6.h |  3 +++
 drivers/mmc/sunxi_mmc.c                          | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)
arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h +3 -0
index e36937059b..baf9b2e6e2 100644
@@ -301,6 +301,9 @@ struct sunxi_ccm_reg {
 #define DRAM_CLK_SRC_PLL5		(0 << 24)
 #define DRAM_CLK_M(m)			(((m)-1) << 0)
 
+/* MMC ahb clock bit field */
+#define AHB_GATE_OFFSET_MMC(n)		((n))
+
 /* MMC clock bit field */
 #define CCM_MMC_CTRL_M(x)		((x) - 1)
 #define CCM_MMC_CTRL_N(x)		((x) << 8)
drivers/mmc/sunxi_mmc.c +16 -0
index b50d70645a..05f15838a8 100644
@@ -697,6 +697,14 @@ static const struct sunxi_mmc_variant sun7i_a20_variant = {
 	.reset_start_bit = 8,
 };
 
+static const struct sunxi_mmc_variant sun50i_h6_variant = {
+	.has_reset = true,
+	.gate_offset = 0x84c,
+	.mclk_offset = 0x830,
+	.reset_offset = 0x84c,
+	.reset_start_bit = 16,
+};
+
 static const struct udevice_id sunxi_mmc_ids[] = {
 	{
 	  .compatible = "allwinner,sun4i-a10-mmc",
@@ -722,6 +730,14 @@ static const struct udevice_id sunxi_mmc_ids[] = {
 	  .compatible = "allwinner,sun50i-a64-emmc",
 	  .data = (ulong)&sun7i_a20_variant,
 	},
+	{
+	  .compatible = "allwinner,sun50i-h6-mmc",
+	  .data = (ulong)&sun50i_h6_variant,
+	},
+	{
+	  .compatible = "allwinner,sun50i-h6-emmc",
+	  .data = (ulong)&sun50i_h6_variant,
+	},
 	{ /* sentinel */ }
 };
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#5 lore raw

PATCH 5/7 mmc: sunxi: Add DM_MMC support for A80

In reply to Jagan Teki

Unlike other Allwinner SoC's, A80 comes with different ahb gate clock offset values and also has mmc common controller. So support them via driver data.

Cc Rask Ingemann Lambertsen <[email protected]>
---
 drivers/mmc/sunxi_mmc.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/mmc/sunxi_mmc.c +24 -0
index 05f15838a8..33f1ec5e5a 100644
@@ -22,6 +22,7 @@
 #ifdef CONFIG_DM_MMC
 struct sunxi_mmc_variant {
 	bool has_reset;
+	bool has_mmc_common;
 	u16 gate_offset;
 	u16 mclk_offset;
 	u16 reset_offset;
@@ -653,6 +654,19 @@ static int sunxi_mmc_probe(struct udevice *dev)
 			     priv->variant->reset_start_bit));
 	}
 
+	if (priv->variant->has_mmc_common) {
+		u32 *mmc_config_clk, *mmc_common_base;
+
+		ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0,
+					  0, &args);
+		if (ret)
+			return ret;
+		mmc_config_clk = (u32 *)ofnode_get_addr(args.node);
+
+		mmc_common_base = (void *)mmc_config_clk + (priv->mmc_no * 4);
+		setbits_le32(mmc_common_base, BIT(18) | BIT(16));
+	}
+
 	ret = mmc_set_mod_clk(priv, 24000000);
 	if (ret)
 		return ret;
@@ -697,6 +711,12 @@ static const struct sunxi_mmc_variant sun7i_a20_variant = {
 	.reset_start_bit = 8,
 };
 
+static const struct sunxi_mmc_variant sun9i_a80_variant = {
+	.has_mmc_common = true,
+	.gate_offset = 0x580,
+	.mclk_offset = 0x410,
+};
+
 static const struct sunxi_mmc_variant sun50i_h6_variant = {
 	.has_reset = true,
 	.gate_offset = 0x84c,
@@ -722,6 +742,10 @@ static const struct udevice_id sunxi_mmc_ids[] = {
 	  .compatible = "allwinner,sun8i-a83t-emmc",
 	  .data = (ulong)&sun7i_a20_variant,
 	},
+	{
+	  .compatible = "allwinner,sun9i-a80-mmc",
+	  .data = (ulong)&sun9i_a80_variant,
+	},
 	{
 	  .compatible = "allwinner,sun50i-a64-mmc",
 	  .data = (ulong)&sun7i_a20_variant,
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#6 lore raw

PATCH 6/7 arm: sunxi: Enable DM_MMC

In reply to Jagan Teki

Enable DM_MMC for all Allwinner SoCs, this will eventually enable BLK.

Also removed DM_MMC enablement in few parts of sunxi configurations.

---
 arch/arm/Kconfig                      | 1 +
 arch/arm/mach-sunxi/Kconfig           | 1 -
 configs/Linksprite_pcDuino3_defconfig | 1 -
 3 files changed, 1 insertion(+), 2 deletions(-)
arch/arm/Kconfig +1 -0
index 520ea8bed9..d5a35b2b5d 100644
@@ -850,6 +850,7 @@ config ARCH_SUNXI
 	select DM_ETH
 	select DM_GPIO
 	select DM_KEYBOARD
+	select DM_MMC if MMC
 	select DM_SERIAL
 	select DM_USB if DISTRO_DEFAULTS
 	select OF_BOARD_SETUP
arch/arm/mach-sunxi/Kconfig +0 -1
index 3c54f5106d..74e234cded 100644
@@ -154,7 +154,6 @@ config MACH_SUN4I
 	bool "sun4i (Allwinner A10)"
 	select CPU_V7A
 	select ARM_CORTEX_CPU_IS_UP
-	select DM_MMC if MMC
 	select DM_SCSI if SCSI
 	select PHY_SUN4I_USB
 	select DRAM_SUN4I
configs/Linksprite_pcDuino3_defconfig +0 -1
index 00a49d1077..56e8d5398e 100644
@@ -14,7 +14,6 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3"
 CONFIG_SCSI_AHCI=y
-CONFIG_DM_MMC=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_MII=y
 CONFIG_SUN7I_GMAC=y
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#7 lore raw

PATCH 7/7 arm: dts: sunxi: Enumerate MMC2 as MMC1

In reply to Jagan Teki

Environment and fastboot MMC devices are configured based number of mmc slots defined on particular board in sunxi platform.

If number of slots are not more than 1, it assigns 0 which usually mmc device on SD slot. With DM_MMC it is detected as 0 since mmc0 node always be an mmc device.

If number of slots are more than 1, it assigns 1 which assumes 0 is mmc device and 1 is emmc device. But with DM_MMC there is chance of detecting emmc as device 2 since mmc1 is SDIO as per devicetree definition.

So override mmc2 to mmc1 in sunxi dtsi, this will eventually detect mmc2 as mmc 1 device even if the board dts has mmc0, mmc1, mmc2.

Some platforms like A20 has mmc0...mmc3, but there is no usecases now for enabling all mmc controllers in any of A20 board dts files.

---
 arch/arm/dts/sunxi-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/sunxi-u-boot.dtsi +4 -0
index 8a9f2a6417..fdd4c80aa4 100644
@@ -1,6 +1,10 @@
 #include <config.h>
 
 / {
+	aliases {
+		mmc1 = &mmc2;
+	};
+
 	binman {
 		filename = "u-boot-sunxi-with-spl.bin";
 		pad-byte = <0xff>;
Signature · 1 line
2.18.0.321.gffc6fa0e3
#8 lore raw

cover mmc: sunxi: Enable DM_MMC

In reply to Jagan Teki
Quoted 11 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

Add for all Allwinner SoC's and enable at arch/arm/Kconfig.

I shall merge this in comming MW, so early test feel better to go for the release. Request to test respective board takers.

Hi Jagan,

Do you have a branch with all the patches (including clk and reset) that I can use to test the changes on Pine64 and Pinebook?

Regards,
Vasily

Quoted 28 lines

Any inputs,
Jagan.

Jagan Teki (7):
mmc: sunxi: Configure reset support for DM_MMC
mmc: sunxi: Add A83T emmc compatible
mmc: sunxi: Add mmc, emmc H5/A64 compatible
mmc: sunxi: Add DM_MMC support for H6
mmc: sunxi: Add DM_MMC support for A80
arm: sunxi: Enable DM_MMC
arm: dts: sunxi: Enumerate MMC2 as MMC1

 arch/arm/Kconfig                              |  1 +
 arch/arm/dts/sunxi-u-boot.dtsi                |  4 +
 .../include/asm/arch-sunxi/clock_sun50i_h6.h  |  3 +
 arch/arm/mach-sunxi/Kconfig                   |  1 -
 configs/Linksprite_pcDuino3_defconfig         |  1 -
 drivers/mmc/sunxi_mmc.c                       | 73 ++++++++++++++++++-
 6 files changed, 79 insertions(+), 4 deletions(-)

--
2.18.0.321.gffc6fa0e3

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#9 lore raw

cover mmc: sunxi: Enable DM_MMC

Quoted 11 lines · Vasily Khoruzhick
Quoted 9 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

Add for all Allwinner SoC's and enable at arch/arm/Kconfig.

Quoted 7 lines
Quoted 2 lines

I shall merge this in comming MW, so early test feel better to go for the release. Request to test respective board takers.

Hi Jagan,

Do you have a branch with all the patches (including clk and reset) that I can use to test the changes on Pine64 and Pinebook?

Please check it in u-boot-sunxi/next

#10 lore raw

cover mmc: sunxi: Enable DM_MMC

In reply to Jagan Teki
Quoted 5 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

U-Boot 2019.01-rc3-00084-g0ce29380cf (Jan 14 2019 - 11:22:13 +0200) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: Olimex A20-OLinuXino-LIME2-eMMC
I2C:   ready
DRAM:  1 GiB
MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1

Loading Environment from FAT... Card did not respond to voltage select!

eMMC seems to be broken:
=> mmc list
mmc at 1c0f000: 0
mmc at 1c11000: 1
=> mmc dev 1
=> mmc dev 0
MMC: no card present
=> mmc part
MMC: no card present
=> mmc info
MMC: no card present

Setting up a 640x480 dvi console (overscan 0x0)

In:    serial
Out:   vga
Err:   vga

Allwinner mUSB OTG (Peripheral)
SCSI: SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst

Net: sunxi_set_gate: (CLK#66) unhandled
eth0: ethernet at 1c50000

And also CLK#66 message

Quoted 29 lines

Add for all Allwinner SoC's and enable at arch/arm/Kconfig.

I shall merge this in comming MW, so early test feel better to go for the release. Request to test respective board takers.

Any inputs,
Jagan.

Jagan Teki (7):
mmc: sunxi: Configure reset support for DM_MMC
mmc: sunxi: Add A83T emmc compatible
mmc: sunxi: Add mmc, emmc H5/A64 compatible
mmc: sunxi: Add DM_MMC support for H6
mmc: sunxi: Add DM_MMC support for A80
arm: sunxi: Enable DM_MMC
arm: dts: sunxi: Enumerate MMC2 as MMC1

 arch/arm/Kconfig                              |  1 +
 arch/arm/dts/sunxi-u-boot.dtsi                |  4 +
 .../include/asm/arch-sunxi/clock_sun50i_h6.h  |  3 +
 arch/arm/mach-sunxi/Kconfig                   |  1 -
 configs/Linksprite_pcDuino3_defconfig         |  1 -
 drivers/mmc/sunxi_mmc.c                       | 73 ++++++++++++++++++-
 6 files changed, 79 insertions(+), 4 deletions(-)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#11 lore raw

cover mmc: sunxi: Enable DM_MMC

Quoted 17 lines · Priit Laes
Quoted 5 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

U-Boot 2019.01-rc3-00084-g0ce29380cf (Jan 14 2019 - 11:22:13 +0200) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: Olimex A20-OLinuXino-LIME2-eMMC
I2C:   ready
DRAM:  1 GiB
MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1

Loading Environment from FAT... Card did not respond to voltage select!

Quoted 11 lines

eMMC seems to be broken:
=> mmc list
mmc at 1c0f000: 0
mmc at 1c11000: 1
=> mmc dev 1
=> mmc dev 0
MMC: no card present
=> mmc part
MMC: no card present
=> mmc info
MMC: no card present

Can you try this

drivers/mmc/sunxi_mmc.c +1 -1
index 33f1ec5e5a..7fab88c47f 100644
@@ -648,7 +648,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
        gate_reg = (void *)ccu_reg + priv->variant->gate_offset;
        setbits_le32(gate_reg, BIT(AHB_GATE_OFFSET_MMC(priv->mmc_no)));
 
-       if ((!IS_ENABLED(CONFIG_MACH_SUN4I)) && priv->variant->has_reset) {
+       if ((!IS_ENABLED(CONFIG_MACH_SUN7I)) && priv->variant->has_reset) {
                reset_reg = (void *)ccu_reg + priv->variant->reset_offset;
                setbits_le32(reset_reg, BIT(priv->mmc_no +
                             priv->variant->reset_start_bit));
Quoted 10 lines

Setting up a 640x480 dvi console (overscan 0x0)

In:    serial
Out:   vga
Err:   vga

Allwinner mUSB OTG (Peripheral)
SCSI: SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst

Quoted 5 lines

Net: sunxi_set_gate: (CLK#66) unhandled
eth0: ethernet at 1c50000

And also CLK#66 message

This is expected, looking EMAC clock from dw driver, will handle in next series. to be noted we enable print.

#12 lore raw
Quoted 36 lines · Jagan Teki
Quoted 17 lines · Priit Laes
Quoted 5 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

U-Boot 2019.01-rc3-00084-g0ce29380cf (Jan 14 2019 - 11:22:13 +0200) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: Olimex A20-OLinuXino-LIME2-eMMC
I2C:   ready
DRAM:  1 GiB
MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1

Loading Environment from FAT... Card did not respond to voltage select!

Quoted 11 lines

eMMC seems to be broken:
=> mmc list
mmc at 1c0f000: 0
mmc at 1c11000: 1
=> mmc dev 1
=> mmc dev 0
MMC: no card present
=> mmc part
MMC: no card present
=> mmc info
MMC: no card present

Can you try this

drivers/mmc/sunxi_mmc.c +0 -0
index 33f1ec5e5a..7fab88c47f 100644

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 654

Quoted 8 lines
drivers/mmc/sunxi_mmc.c +1 -1
@@ -648,7 +648,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
        gate_reg = (void *)ccu_reg + priv->variant->gate_offset;
        setbits_le32(gate_reg, BIT(AHB_GATE_OFFSET_MMC(priv->mmc_no)));
 
-       if ((!IS_ENABLED(CONFIG_MACH_SUN4I)) && priv->variant->has_reset) {
+       if ((!IS_ENABLED(CONFIG_MACH_SUN7I)) && priv->variant->has_reset) {
                reset_reg = (void *)ccu_reg + priv->variant->reset_offset;
                setbits_le32(reset_reg, BIT(priv->mmc_no +
                             priv->variant->reset_start_bit));

Still fails:

MMC: no card present
scanning bus for devices...
Found 0 device(s).

Device 0: unknown device

Device 0: unknown device

Quoted 23 lines
Quoted 10 lines

Setting up a 640x480 dvi console (overscan 0x0)

In:    serial
Out:   vga
Err:   vga

Allwinner mUSB OTG (Peripheral)
SCSI: SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst

Quoted 5 lines

Net: sunxi_set_gate: (CLK#66) unhandled
eth0: ethernet at 1c50000

And also CLK#66 message

This is expected, looking EMAC clock from dw driver, will handle in next series. to be noted we enable print.

Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
author
#13 lore raw
Quoted 52 lines · On Mon 14 Jan, 2019, 3:53 PM Priit Laes <[email protected] wrote:
Quoted 10 lines · Jagan Teki
Quoted 9 lines · Priit Laes
Quoted 5 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

U-Boot 2019.01-rc3-00084-g0ce29380cf (Jan 14 2019 - 11:22:13 +0200)

Allwinner Technology

Quoted 26 lines
Quoted 8 lines
CPU:   Allwinner A20 (SUN7I)
Model: Olimex A20-OLinuXino-LIME2-eMMC
I2C:   ready
DRAM:  1 GiB
MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1

Loading Environment from FAT... Card did not respond to voltage select!

Quoted 11 lines

eMMC seems to be broken:
=> mmc list
mmc at 1c0f000: 0
mmc at 1c11000: 1
=> mmc dev 1
=> mmc dev 0
MMC: no card present
=> mmc part
MMC: no card present
=> mmc info
MMC: no card present

Can you try this

drivers/mmc/sunxi_mmc.c +0 -0
index 33f1ec5e5a..7fab88c47f 100644

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 651

Quoted 4 lines
drivers/mmc/sunxi_mmc.c +0 -1
@@ -648,7 +648,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
        gate_reg = (void *)ccu_reg + priv->variant->gate_offset;
        setbits_le32(gate_reg, BIT(AHB_GATE_OFFSET_MMC(priv->mmc_no)));
 
-       if ((!IS_ENABLED(CONFIG_MACH_SUN4I)) &&

priv->variant->has_reset) {

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 651

Quoted 1 line
drivers/mmc/sunxi_mmc.c +1 -0
+       if ((!IS_ENABLED(CONFIG_MACH_SUN7I)) &&

priv->variant->has_reset) {

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 652

Quoted 1 line
drivers/mmc/sunxi_mmc.c +0 -0
                reset_reg = (void *)ccu_reg +

priv->variant->reset_offset;

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 654

Quoted 2 lines
drivers/mmc/sunxi_mmc.c +0 -0
                setbits_le32(reset_reg, BIT(priv->mmc_no +
                             priv->variant->reset_start_bit));

Still fails:

Quoted 8 lines

MMC: no card present
scanning bus for devices...
Found 0 device(s).

Device 0: unknown device

Device 0: unknown device

Can you print the reg values mclk and gate_reg. I have Lime2 which is fine but doesn't have eMMC.

#14 lore raw
Quoted 58 lines · Jagan Teki
Quoted 56 lines · On Mon 14 Jan, 2019, 3:53 PM Priit Laes <[email protected] wrote:
Quoted 10 lines · Jagan Teki
Quoted 9 lines · Priit Laes
Quoted 5 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

U-Boot 2019.01-rc3-00084-g0ce29380cf (Jan 14 2019 - 11:22:13 +0200)

Allwinner Technology

Quoted 26 lines
Quoted 8 lines
CPU:   Allwinner A20 (SUN7I)
Model: Olimex A20-OLinuXino-LIME2-eMMC
I2C:   ready
DRAM:  1 GiB
MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1

Loading Environment from FAT... Card did not respond to voltage select!

Quoted 11 lines

eMMC seems to be broken:
=> mmc list
mmc at 1c0f000: 0
mmc at 1c11000: 1
=> mmc dev 1
=> mmc dev 0
MMC: no card present
=> mmc part
MMC: no card present
=> mmc info
MMC: no card present

Can you try this

drivers/mmc/sunxi_mmc.c +0 -0
index 33f1ec5e5a..7fab88c47f 100644

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 651

Quoted 4 lines
drivers/mmc/sunxi_mmc.c +0 -1
@@ -648,7 +648,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
        gate_reg = (void *)ccu_reg + priv->variant->gate_offset;
        setbits_le32(gate_reg, BIT(AHB_GATE_OFFSET_MMC(priv->mmc_no)));
 
-       if ((!IS_ENABLED(CONFIG_MACH_SUN4I)) &&

priv->variant->has_reset) {

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 651

Quoted 1 line
drivers/mmc/sunxi_mmc.c +1 -0
+       if ((!IS_ENABLED(CONFIG_MACH_SUN7I)) &&

priv->variant->has_reset) {

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 652

Quoted 1 line
drivers/mmc/sunxi_mmc.c +0 -0
                reset_reg = (void *)ccu_reg +

priv->variant->reset_offset;

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 654

Quoted 2 lines
drivers/mmc/sunxi_mmc.c +0 -0
                setbits_le32(reset_reg, BIT(priv->mmc_no +
                             priv->variant->reset_start_bit));

Still fails:

MMC: no card present
scanning bus for devices...
Found 0 device(s).

Quoted 7 lines
Quoted 4 lines

Device 0: unknown device

Device 0: unknown device

Can you print the reg values mclk and gate_reg. I have Lime2 which is fine but doesn't have eMMC.

mclk0: 0x0
gate0: 0x200c141
mclk2: 0x0
gate2: 0x200c541

Quoted 5 lines
Signature · 4 lines
-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#15 lore raw
Quoted 64 lines · Priit Laes
Quoted 63 lines · Jagan Teki
Quoted 60 lines · On Mon 14 Jan, 2019, 3:53 PM Priit Laes <[email protected] wrote:
Quoted 10 lines · Jagan Teki
Quoted 9 lines · Priit Laes
Quoted 5 lines · Jagan Teki

I thought of waiting this till CLK framework gets Mainline, but migration deadline for DM_MMC and BLK seems expiring in next release. So instead of doing so huddle and make some last minute changes, I have managed to add CLK, Reset code for mmc driver via driver data.

U-Boot 2019.01-rc3-00084-g0ce29380cf (Jan 14 2019 - 11:22:13 +0200)

Allwinner Technology

Quoted 26 lines
Quoted 8 lines
CPU:   Allwinner A20 (SUN7I)
Model: Olimex A20-OLinuXino-LIME2-eMMC
I2C:   ready
DRAM:  1 GiB
MMC:   mmc at 1c0f000: 0, mmc at 1c11000: 1

Loading Environment from FAT... Card did not respond to voltage select!

Quoted 11 lines

eMMC seems to be broken:
=> mmc list
mmc at 1c0f000: 0
mmc at 1c11000: 1
=> mmc dev 1
=> mmc dev 0
MMC: no card present
=> mmc part
MMC: no card present
=> mmc info
MMC: no card present

Can you try this

drivers/mmc/sunxi_mmc.c +0 -0
index 33f1ec5e5a..7fab88c47f 100644

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 651

Quoted 4 lines
drivers/mmc/sunxi_mmc.c +0 -1
@@ -648,7 +648,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
        gate_reg = (void *)ccu_reg + priv->variant->gate_offset;
        setbits_le32(gate_reg, BIT(AHB_GATE_OFFSET_MMC(priv->mmc_no)));
 
-       if ((!IS_ENABLED(CONFIG_MACH_SUN4I)) &&

priv->variant->has_reset) {

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 651

Quoted 1 line
drivers/mmc/sunxi_mmc.c +1 -0
+       if ((!IS_ENABLED(CONFIG_MACH_SUN7I)) &&

priv->variant->has_reset) {

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 652

Quoted 1 line
drivers/mmc/sunxi_mmc.c +0 -0
                reset_reg = (void *)ccu_reg +

priv->variant->reset_offset;

drivers/mmc/sunxi_mmc.c static int sunxi_mmc_probe(struct udevice *dev) · line 654

Quoted 2 lines
drivers/mmc/sunxi_mmc.c +0 -0
                setbits_le32(reset_reg, BIT(priv->mmc_no +
                             priv->variant->reset_start_bit));

Still fails:

MMC: no card present
scanning bus for devices...
Found 0 device(s).

Device 0: unknown device

Device 0: unknown device

Quoted 7 lines
Quoted 2 lines

Can you print the reg values mclk and gate_reg. I have Lime2 which is fine but doesn't have eMMC.

mclk0: 0x0
gate0: 0x200c141
mclk2: 0x0
gate2: 0x200c541

I managed to mess it up:

XXX: mclk0: 0x80500000
XXX: gate0: 0x200c141

XXX: mclk2: 0x80500000
XXX: gate2: 0x200c541

This is what you want:

drivers/mmc/sunxi_mmc.c +3 -0
index 33f1ec5e5a..ac396d8d89 100644
@@ -684,6 +684,9 @@ static int sunxi_mmc_probe(struct udevice *dev)
 
        upriv->mmc = &plat->mmc;
 
+    printf("XXX: mclk%d: 0x%x\n", priv->mmc_no, *priv->mclkreg);
+    printf("XXX: gate%d: 0x%x\n", priv->mmc_no, *gate_reg);
+
        /* Reset controller */
        writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl);
        udelay(1000);
Quoted 11 lines
Quoted 6 lines
Signature · 4 lines
-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/d/optout.