Skip to contentSkip to conversation

sun6i: Update Colombus defconfig settings

PATCH New Hans de Goede 2 participants 8 messages Dec 7, 2014 – Dec 9, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sun6i: Update Colombus defconfig settings

The Colombus defconfig settings are missing a number of settings for recently added features, because we did not know exactly how things were hooked up.

Maxime Ripard has run various tests to get us the necessary details, this commit updates the defconfig with this info.

This commit also updates the dram clk and zq values with values verified by Maxime to be the ones used by the original firmware for this board.

---
 configs/Colombus_defconfig | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
configs/Colombus_defconfig +10 -3
index 9b4968f..b8c5400 100644
@@ -1,9 +1,16 @@
 CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
 CONFIG_FDTFILE="sun6i-a31-colombus.dtb"
-CONFIG_USB_KEYBOARD=n
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN6I=y
 +S:CONFIG_TARGET_COLOMBUS=y
-+S:CONFIG_DRAM_CLK=288
-+S:CONFIG_DRAM_ZQ=379
++S:CONFIG_DRAM_CLK=240
++S:CONFIG_DRAM_ZQ=251
+# Wifi power
++S:CONFIG_AXP221_ALDO1_VOLT=3300
+# HDMI power ?
++S:CONFIG_AXP221_ALDO2_VOLT=1800
++S:CONFIG_AXP221_ALDO3_VOLT=3000
+# No Vbus gpio for usb1
++S:CONFIG_USB1_VBUS_PIN=""
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/2 sunxi: mmc: Properly setup mod-clk and clock sampling phases

The sunxi mmc controller has both an internal clock divider, as well as the divider in the mod0-clk for the mmc controller.

The internal divider cannot be used, as it conflicts with the setting of clock sampling phases which is done in the mod0-clk, so it must be set to 0 (divide by 1).

For some reason while the kernel has had this correct from day one, the u-boot sunxi mmc code has been using a fixed mod0-clk and setting its internal divider depending on the desired speed. This is something which we've inherited from the original Allwinner u-boot sources, but while this has been fixed in Allwinner's own u-boot code at least for the A23 and later upstream u-boot was still doing this wrong.

This commit fixes this, thereby also fixing mmc support not working reliable on the A23 (which seems more sensitive to this) and possible also fixes some other sunxi mmc issues.

---
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 13 ++--
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 11 ++--
 drivers/mmc/sunxi_mmc.c                       | 95 +++++++++++++++++++--------
 3 files changed, 83 insertions(+), 36 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun4i.h +8 -5
index eb88969..dbc5e58 100644
@@ -255,11 +255,14 @@ struct sunxi_ccm_reg {
 #define CCM_MBUS_CTRL_CLK_SRC_PLL5 0x2
 #define CCM_MBUS_CTRL_GATE (0x1 << 31)
 
-#define CCM_MMC_CTRL_OSCM24 (0x0 << 24)
-#define CCM_MMC_CTRL_PLL6   (0x1 << 24)
-#define CCM_MMC_CTRL_PLL5   (0x2 << 24)
-
-#define CCM_MMC_CTRL_ENABLE (0x1 << 31)
+#define CCM_MMC_CTRL_M(x)		((x) - 1)
+#define CCM_MMC_CTRL_OCLK_DLY(x)	((x) << 8)
+#define CCM_MMC_CTRL_N(x)		((x) << 16)
+#define CCM_MMC_CTRL_SCLK_DLY(x)	((x) << 20)
+#define CCM_MMC_CTRL_OSCM24		(0x0 << 24)
+#define CCM_MMC_CTRL_PLL6		(0x1 << 24)
+#define CCM_MMC_CTRL_PLL5		(0x2 << 24)
+#define CCM_MMC_CTRL_ENABLE		(0x1 << 31)
 
 #define CCM_DRAM_GATE_OFFSET_DE_BE0	26
 
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +7 -4
index 4bdc0de..3d4fcd1 100644
@@ -219,10 +219,13 @@ struct sunxi_ccm_reg {
 #define AHB_GATE_OFFSET_LCD1		5
 #define AHB_GATE_OFFSET_LCD0		4
 
-#define CCM_MMC_CTRL_OSCM24 (0x0 << 24)
-#define CCM_MMC_CTRL_PLL6   (0x1 << 24)
-
-#define CCM_MMC_CTRL_ENABLE (0x1 << 31)
+#define CCM_MMC_CTRL_M(x)		((x) - 1)
+#define CCM_MMC_CTRL_OCLK_DLY(x)	((x) << 8)
+#define CCM_MMC_CTRL_N(x)		((x) << 16)
+#define CCM_MMC_CTRL_SCLK_DLY(x)	((x) << 20)
+#define CCM_MMC_CTRL_OSCM24		(0x0 << 24)
+#define CCM_MMC_CTRL_PLL6		(0x1 << 24)
+#define CCM_MMC_CTRL_ENABLE		(0x1 << 31)
 
 #define CCM_USB_CTRL_PHY1_RST (0x1 << 1)
 #define CCM_USB_CTRL_PHY2_RST (0x1 << 2)
drivers/mmc/sunxi_mmc.c +68 -27

141 lines not on this page · raw message

Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/2 sunxi: mmc: Properly setup mod-clk and clock sampling phases

Quoted 14 lines · Hans de Goede

The sunxi mmc controller has both an internal clock divider, as well as the divider in the mod0-clk for the mmc controller.

The internal divider cannot be used, as it conflicts with the setting of clock sampling phases which is done in the mod0-clk, so it must be set to 0 (divide by 1).

For some reason while the kernel has had this correct from day one, the u-boot sunxi mmc code has been using a fixed mod0-clk and setting its internal divider depending on the desired speed. This is something which we've inherited from the original Allwinner u-boot sources, but while this has been fixed in Allwinner's own u-boot code at least for the A23 and later upstream u-boot was still doing this wrong.

Quoted 5 lines

This commit fixes this, thereby also fixing mmc support not working reliable on the A23 (which seems more sensitive to this) and possible also fixes some other sunxi mmc issues.

#3 lore raw

PATCH 1/2 sun6i: Update Colombus defconfig settings

In reply to Hans de Goede
Quoted 10 lines · Hans de Goede

The Colombus defconfig settings are missing a number of settings for recently added features, because we did not know exactly how things were hooked up.

Maxime Ripard has run various tests to get us the necessary details, this commit updates the defconfig with this info.

This commit also updates the dram clk and zq values with values verified by Maxime to be the ones used by the original firmware for this board.

#4 lore raw

PATCH 1/2 sun6i: Update Colombus defconfig settings

Quoted 7 lines · Ian Campbell
Quoted 6 lines · Hans de Goede

The Colombus defconfig settings are missing a number of settings for recently added features, because we did not know exactly how things were hooked up.

Maxime Ripard has run various tests to get us the necessary details, this commit updates the defconfig with this info.

Quoted 6 lines
Quoted 4 lines

This commit also updates the dram clk and zq values with values verified by Maxime to be the ones used by the original firmware for this board.

Ooops, rather make that ijc at hellion.org.uk, as usual...

Ian.

#5 lore raw

PATCH 1/2 sun6i: Update Colombus defconfig settings

Hi,

Quoted 8 lines · Ian Campbell
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Hans de Goede

The Colombus defconfig settings are missing a number of settings for recently added features, because we did not know exactly how things were hooked up.

Maxime Ripard has run various tests to get us the necessary details, this commit updates the defconfig with this info.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This commit also updates the dram clk and zq values with values verified by Maxime to be the ones used by the original firmware for this board.

Ooops, rather make that ijc at hellion.org.uk, as usual...

Thanks for the reviews, I've queued both of these up in u-boot-sunxi/next (also rebased on latest origin/master, so I've done a forced push).

I would also like to queue these 2 up, if you've some time can you please review them ? :

http://patchwork.ozlabs.org/patch/415109/
http://patchwork.ozlabs.org/patch/415110/

Thanks & Regards,

Hans

#6 lore raw

PATCH 1/2 sun6i: Update Colombus defconfig settings

Quoted 20 lines · Hans de Goede

Hi,

Quoted 8 lines · Ian Campbell
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Hans de Goede

The Colombus defconfig settings are missing a number of settings for recently added features, because we did not know exactly how things were hooked up.

Maxime Ripard has run various tests to get us the necessary details, this commit updates the defconfig with this info.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This commit also updates the dram clk and zq values with values verified by Maxime to be the ones used by the original firmware for this board.

Ooops, rather make that ijc at hellion.org.uk, as usual...

Quoted 8 lines

Thanks for the reviews, I've queued both of these up in u-boot-sunxi/next (also rebased on latest origin/master, so I've done a forced push).

I would also like to queue these 2 up, if you've some time can you please review them ? :

http://patchwork.ozlabs.org/patch/415109/
http://patchwork.ozlabs.org/patch/415110/

Ack to both of those too.

Ian.

#7 lore raw

PATCH 1/2 sun6i: Update Colombus defconfig settings

Hi,

Quoted 24 lines · Ian Campbell
Quoted 23 lines · Hans de Goede

Hi,

Quoted 8 lines · Ian Campbell
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Hans de Goede

The Colombus defconfig settings are missing a number of settings for recently added features, because we did not know exactly how things were hooked up.

Maxime Ripard has run various tests to get us the necessary details, this commit updates the defconfig with this info.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This commit also updates the dram clk and zq values with values verified by Maxime to be the ones used by the original firmware for this board.

Ooops, rather make that ijc at hellion.org.uk, as usual...

Thanks for the reviews, I've queued both of these up in u-boot-sunxi/next (also rebased on latest origin/master, so I've done a forced push).

Quoted 7 lines
Quoted 5 lines

I would also like to queue these 2 up, if you've some time can you please review them ? :

http://patchwork.ozlabs.org/patch/415109/
http://patchwork.ozlabs.org/patch/415110/

Ack to both of those too.

Thanks, I've queued both of them up in u-boot-sunxi/next

(Also rebased on rc3, so I did another forced push)

Regards,

Hans