Skip to contentSkip to conversation

sunxi: Convert sun5i boards to use auto dram configuration

PATCH New Hans de Goede 2 participants 9 messages Jan 25, 2015 – Jan 28, 2015

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

PATCH 1/4 sunxi: Convert sun5i boards to use auto dram configuration

Currently we've separate detailed dram settings for all sun5i boards, this moves them over to using auto dram configuration so that we can get rid of all the per board dram_foo.c files.

This has been tested on a A10s-Olinuxino, A13-Olinuxino, A13-OlinuxinoM, mk802-a10s and r7-tv-dongle board.

---
 board/sunxi/Kconfig                 |  9 +++------
 board/sunxi/Makefile                |  8 +-------
 board/sunxi/dram_a10s_olinuxino_m.c | 31 -------------------------------
 board/sunxi/dram_a13_oli_micro.c    | 32 --------------------------------
 board/sunxi/dram_a13_olinuxino.c    | 31 -------------------------------
 board/sunxi/dram_bananapi.c         | 31 -------------------------------
 board/sunxi/dram_r7dongle.c         | 31 -------------------------------
 configs/A10s-OLinuXino-M_defconfig  |  3 +++
 configs/A13-OLinuXinoM_defconfig    |  3 +++
 configs/A13-OLinuXino_defconfig     |  3 +++
 configs/Auxtek-T004_defconfig       |  3 +++
 configs/r7-tv-dongle_defconfig      |  3 +++
 12 files changed, 19 insertions(+), 169 deletions(-)
 delete mode 100644 board/sunxi/dram_a10s_olinuxino_m.c
 delete mode 100644 board/sunxi/dram_a13_oli_micro.c
 delete mode 100644 board/sunxi/dram_a13_olinuxino.c
 delete mode 100644 board/sunxi/dram_bananapi.c
 delete mode 100644 board/sunxi/dram_r7dongle.c
board/sunxi/Kconfig +3 -6
index 11da4ef..648516e 100644
@@ -43,16 +43,14 @@ config DRAM_CLK
 	default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
 	---help---
 	Set the dram clock speed, valid range 240 - 480, must be a multiple
-	of 24. Note on sun4i / sun5i / sun7i this is only used by boards
-	which use dram autoconfig.
+	of 24.
 
 config DRAM_ZQ
 	int "sunxi dram zq value"
 	default 123 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I
 	default 127 if MACH_SUN7I
 	---help---
-	Set the dram zq value. Note on sun4i / sun5i / sun7i this is only
-	used by boards which use dram autoconfig.
+	Set the dram zq value.
 
 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
 config DRAM_EMR1
@@ -60,8 +58,7 @@ config DRAM_EMR1
 	default 0 if MACH_SUN4I
 	default 4 if MACH_SUN5I || MACH_SUN7I
 	---help---
-	Set the dram controller emr1 value. Note this is only used by boards
-	which use dram autoconfig.
+	Set the dram controller emr1 value.
 endif
 
 config SYS_CONFIG_NAME
board/sunxi/Makefile +1 -7
index 71edb83..43766e0 100644
@@ -12,11 +12,5 @@ obj-y	+= board.o
 obj-$(CONFIG_SUNXI_GMAC)	+= gmac.o
 obj-$(CONFIG_SUNXI_AHCI)	+= ahci.o
 obj-$(CONFIG_MACH_SUN4I)	+= dram_sun4i_auto.o
+obj-$(CONFIG_MACH_SUN5I)	+= dram_sun5i_auto.o
 obj-$(CONFIG_MACH_SUN7I)	+= dram_sun5i_auto.o
-obj-$(CONFIG_TARGET_A10S_OLINUXINO_M)	+= dram_a10s_olinuxino_m.o
-obj-$(CONFIG_TARGET_A13_OLINUXINO)	+= dram_a13_olinuxino.o
-obj-$(CONFIG_TARGET_A13_OLINUXINOM)	+= dram_a13_oli_micro.o
-# This is not a typo, uses the same mem settings as the a10s-olinuxino-m
-obj-$(CONFIG_TARGET_AUXTEK_T004)	+= dram_a10s_olinuxino_m.o
-obj-$(CONFIG_TARGET_MK802_A10S)		+= dram_sun5i_auto.o
-obj-$(CONFIG_TARGET_R7DONGLE)		+= dram_r7dongle.o
board/sunxi/dram_a10s_olinuxino_m.c deleted +0 -31
deleted file mode 100644
index 8900539..0000000
@@ -1,31 +0,0 @@
-/* this file is generated, don't edit it yourself */
-
-#include <common.h>
-#include <asm/arch/dram.h>
-
-static struct dram_para dram_para = {
-	.clock = 432,
-	.type = 3,
-	.rank_num = 1,
-	.density = 4096,
-	.io_width = 16,
-	.bus_width = 16,
-	.cas = 9,
-	.zq = 123,
-	.odt_en = 0,
-	.size = 512,
-	.tpr0 = 0x42d899b7,
-	.tpr1 = 0xa090,
-	.tpr2 = 0x22a00,
-	.tpr3 = 0,
-	.tpr4 = 0,
-	.tpr5 = 0,
-	.emr1 = 0x4,
-	.emr2 = 0x10,
-	.emr3 = 0,
-};
-
-unsigned long sunxi_dram_init(void)
-{
-	return dramc_init(&dram_para);
-}
board/sunxi/dram_a13_oli_micro.c deleted +0 -32
deleted file mode 100644
index 8154ea2..0000000
@@ -1,32 +0,0 @@
-/* this file is generated, don't edit it yourself */
-
-#include <common.h>
-#include <asm/arch/dram.h>
-
-static struct dram_para dram_para = {
-	.clock = 408,
-	.type = 3,
-	.rank_num = 1,
-	.density = 2048,
-	.io_width = 16,
-	.bus_width = 16,
-	.cas = 9,
-	.zq = 123,
-	.odt_en = 0,
-	.size = 256,
-	.tpr0 = 0x42d899b7,
-	.tpr1 = 0xa090,
-	.tpr2 = 0x22a00,
-	.tpr3 = 0,
-	.tpr4 = 0,
-	.tpr5 = 0,
-	.emr1 = 0,
-	.emr2 = 0x10,
-	.emr3 = 0,
-
-};
-
-unsigned long sunxi_dram_init(void)
-{
-	return dramc_init(&dram_para);
-}
board/sunxi/dram_a13_olinuxino.c deleted +0 -31
deleted file mode 100644
index ca96260..0000000
@@ -1,31 +0,0 @@
-/* this file is generated, don't edit it yourself */
-
-#include <common.h>
-#include <asm/arch/dram.h>
-
-static struct dram_para dram_para = {
-	.clock = 408,
-	.type = 3,
-	.rank_num = 1,
-	.density = 2048,
-	.io_width = 8,
-	.bus_width = 16,
-	.cas = 9,
-	.zq = 123,
-	.odt_en = 0,
-	.size = 512,
-	.tpr0 = 0x42d899b7,
-	.tpr1 = 0xa090,
-	.tpr2 = 0x22a00,
-	.tpr3 = 0,
-	.tpr4 = 0,
-	.tpr5 = 0,
-	.emr1 = 0,
-	.emr2 = 0x10,
-	.emr3 = 0,
-};
-
-unsigned long sunxi_dram_init(void)
-{
-	return dramc_init(&dram_para);
-}
board/sunxi/dram_bananapi.c deleted +0 -31
deleted file mode 100644
index 0ed7943..0000000
@@ -1,31 +0,0 @@
-/* this file is generated, don't edit it yourself */
-
-#include <common.h>
-#include <asm/arch/dram.h>
-
-static struct dram_para dram_para = {
-	.clock = 432,
-	.type = 3,
-	.rank_num = 1,
-	.density = 4096,
-	.io_width = 16,
-	.bus_width = 32,
-	.cas = 9,
-	.zq = 0x7f,
-	.odt_en = 0,
-	.size = 1024,
-	.tpr0 = 0x42d899b7,
-	.tpr1 = 0xa090,
-	.tpr2 = 0x22a00,
-	.tpr3 = 0x0,
-	.tpr4 = 0x1,
-	.tpr5 = 0x0,
-	.emr1 = 0x4,
-	.emr2 = 0x10,
-	.emr3 = 0x0,
-};
-
-unsigned long sunxi_dram_init(void)
-{
-	return dramc_init(&dram_para);
-}
board/sunxi/dram_r7dongle.c deleted +0 -31
deleted file mode 100644
index 59343cb..0000000
@@ -1,31 +0,0 @@
-/* this file is generated, don't edit it yourself */
-
-#include <common.h>
-#include <asm/arch/dram.h>
-
-static struct dram_para dram_para = {
-	.clock = 384,
-	.type = 3,
-	.rank_num = 1,
-	.density = 2048,
-	.io_width = 8,
-	.bus_width = 32,
-	.cas = 9,
-	.zq = 123,
-	.odt_en = 0,
-	.size = 1024,
-	.tpr0 = 0x42d899b7,
-	.tpr1 = 0xa090,
-	.tpr2 = 0x22a00,
-	.tpr3 = 0,
-	.tpr4 = 0,
-	.tpr5 = 0,
-	.emr1 = 0x04,
-	.emr2 = 0x10,
-	.emr3 = 0,
-};
-
-unsigned long sunxi_dram_init(void)
-{
-	return dramc_init(&dram_para);
-}
configs/A10s-OLinuXino-M_defconfig +3 -0
index 94fafa6..79a27db 100644
@@ -9,3 +9,6 @@ CONFIG_USB1_VBUS_PIN="PB10"
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
 +S:CONFIG_TARGET_A10S_OLINUXINO_M=y
++S:CONFIG_DRAM_CLK=432
++S:CONFIG_DRAM_ZQ=123
++S:CONFIG_DRAM_EMR1=4
configs/A13-OLinuXinoM_defconfig +3 -0
index 1a99418..d392ec4 100644
@@ -13,3 +13,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
 +S:CONFIG_TARGET_A13_OLINUXINOM=y
++S:CONFIG_DRAM_CLK=408
++S:CONFIG_DRAM_ZQ=123
++S:CONFIG_DRAM_EMR1=0
configs/A13-OLinuXino_defconfig +3 -0
index 7df6951..cf205a7 100644
@@ -13,3 +13,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
 +S:CONFIG_TARGET_A13_OLINUXINO=y
++S:CONFIG_DRAM_CLK=408
++S:CONFIG_DRAM_ZQ=123
++S:CONFIG_DRAM_EMR1=0
configs/Auxtek-T004_defconfig +3 -0
index 7fe9059..eb1d003 100644
@@ -6,3 +6,6 @@ CONFIG_USB1_VBUS_PIN="PG13"
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
 +S:CONFIG_TARGET_AUXTEK_T004=y
++S:CONFIG_DRAM_CLK=432
++S:CONFIG_DRAM_ZQ=123
++S:CONFIG_DRAM_EMR1=4
configs/r7-tv-dongle_defconfig +3 -0
index b9fd59c..f467d6c 100644
@@ -6,3 +6,6 @@ CONFIG_USB1_VBUS_PIN="PG13"
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
 +S:CONFIG_TARGET_R7DONGLE=y
++S:CONFIG_DRAM_CLK=384
++S:CONFIG_DRAM_ZQ=123
++S:CONFIG_DRAM_EMR1=4
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/4 sunxi: Add a GMAC Transmit Clock Delay Chain Kconfig option

And use this to set the GMAC Transmit Clock Delay Chain value on Banana boards, rather then keying of CONFIG_TARGET_FOO.

---
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |  2 ++
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h |  2 ++
 board/sunxi/Kconfig                           |  6 ++++++
 board/sunxi/gmac.c                            | 11 ++---------
 configs/Bananapi_defconfig                    |  1 +
 configs/Bananapro_defconfig                   |  1 +
 6 files changed, 14 insertions(+), 9 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun4i.h +2 -0
index 05fbad3..d297ed0 100644
@@ -305,6 +305,8 @@ struct sunxi_ccm_reg {
 #define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
 #define CCM_GMAC_CTRL_GPIT_MII (0x0 << 2)
 #define CCM_GMAC_CTRL_GPIT_RGMII (0x1 << 2)
+#define CCM_GMAC_CTRL_RX_CLK_DELAY(x)	((x) << 5)
+#define CCM_GMAC_CTRL_TX_CLK_DELAY(x)	((x) << 10)
 
 #define CCM_USB_CTRL_PHY0_RST (0x1 << 0)
 #define CCM_USB_CTRL_PHY1_RST (0x1 << 1)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +2 -0
index e101c54..8a80385 100644
@@ -243,6 +243,8 @@ struct sunxi_ccm_reg {
 #define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
 #define CCM_GMAC_CTRL_GPIT_MII		(0x0 << 2)
 #define CCM_GMAC_CTRL_GPIT_RGMII	(0x1 << 2)
+#define CCM_GMAC_CTRL_RX_CLK_DELAY(x)	((x) << 5)
+#define CCM_GMAC_CTRL_TX_CLK_DELAY(x)	((x) << 10)
 
 #define MDFS_CLK_DEFAULT		0x81000002 /* PLL6 / 3 */
 
board/sunxi/Kconfig +6 -0
index 648516e..561fd6b 100644
@@ -385,4 +385,10 @@ config USB_KEYBOARD
 	Say Y here to add support for using a USB keyboard (typically used
 	in combination with a graphical console).
 
+config GMAC_TX_DELAY
+	int "GMAC Transmit Clock Delay Chain"
+	default 0
+	---help---
+	Set the GMAC Transmit Clock Delay Chain value.
+
 endif
board/sunxi/gmac.c +2 -9
index 4e4615e..8849132 100644
@@ -24,20 +24,13 @@ int sunxi_gmac_initialize(bd_t *bis)
 #ifdef CONFIG_RGMII
 	setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
 		CCM_GMAC_CTRL_GPIT_RGMII);
+	setbits_le32(&ccm->gmac_clk_cfg,
+		     CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY));
 #else
 	setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_MII |
 		CCM_GMAC_CTRL_GPIT_MII);
 #endif
 
-	/*
-	 * In order for the gmac nic to work reliable on the Bananapi, we
-	 * need to set bits 10-12 GTXDC "GMAC Transmit Clock Delay Chain"
-	 * of the GMAC clk register to 3.
-	 */
-#if defined CONFIG_TARGET_BANANAPI || defined CONFIG_TARGET_BANANAPRO
-	setbits_le32(&ccm->gmac_clk_cfg, 0x3 << 10);
-#endif
-
 #ifndef CONFIG_MACH_SUN6I
 	/* Configure pin mux settings for GMAC */
 	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
configs/Bananapi_defconfig +1 -0
index d94e08e..4cff573 100644
@@ -1,6 +1,7 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,USB_EHCI"
 CONFIG_FDTFILE="sun7i-a20-bananapi.dtb"
+CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
configs/Bananapro_defconfig +1 -0
index 02e4f3e..0512019 100644
@@ -3,6 +3,7 @@ CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 CONFIG_FDTFILE="sun7i-a20-bananapro.dtb"
 CONFIG_USB1_VBUS_PIN="PH0"
 CONFIG_USB2_VBUS_PIN="PH1"
+CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/4 sunxi: Add a GMAC Transmit Clock Delay Chain Kconfig option

Quoted 4 lines · Hans de Goede

And use this to set the GMAC Transmit Clock Delay Chain value on Banana boards, rather then keying of CONFIG_TARGET_FOO.

Although:

board/sunxi/gmac.c int sunxi_gmac_initialize(bd_t *bis) · line 28

Quoted 6 lines
board/sunxi/gmac.c +2 -0
@@ -24,20 +24,13 @@ int sunxi_gmac_initialize(bd_t *bis)
 #ifdef CONFIG_RGMII
 	setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
 		CCM_GMAC_CTRL_GPIT_RGMII);
+	setbits_le32(&ccm->gmac_clk_cfg,
+		     CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY));

You could have added
| CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY)
to the existing setbits I think. Ack to that change too if you prefer it.

Ian.

#3 lore raw

PATCH 3/4 sunxi: Remove CONFIG_TARGET_FOO for sun5i and sun7i boards

In reply to Hans de Goede

CONFIG_TARGET_FOO was only used in board/sunxi/Makefile to select the dram config for sun5i and sun7i boards and in board/sunxi/gmac.c for some special handling of the bananapi/bananapro (both sun7i), all sun5i and sun7i boards have been moved over to using a single dram_sun5i_autoconfig file, and the tx clk delay handling for the Banana boards now has its own Kconfig.

IOW nothing is using CONFIG_TARGET_FOO anymore, so remove it.

---
 board/sunxi/Kconfig                       | 82 -------------------------------
 configs/A10s-OLinuXino-M_defconfig        |  1 -
 configs/A13-OLinuXinoM_defconfig          |  1 -
 configs/A13-OLinuXino_defconfig           |  1 -
 configs/A20-OLinuXino-Lime2_defconfig     |  1 -
 configs/A20-OLinuXino-Lime_defconfig      |  1 -
 configs/A20-OLinuXino_MICRO_defconfig     |  1 -
 configs/Auxtek-T004_defconfig             |  1 -
 configs/Bananapi_defconfig                |  1 -
 configs/Bananapro_defconfig               |  1 -
 configs/Cubieboard2_defconfig             |  1 -
 configs/Cubietruck_defconfig              |  1 -
 configs/Ippo_q8h_v5_defconfig             |  1 -
 configs/Linksprite_pcDuino3_defconfig     |  1 -
 configs/Linksprite_pcDuino3_fdt_defconfig |  1 -
 configs/MSI_Primo73_defconfig             |  9 +++-
 configs/Mele_M3_defconfig                 |  1 -
 configs/i12-tvbox_defconfig               |  1 -
 configs/mk802_a10s_defconfig              |  1 -
 configs/r7-tv-dongle_defconfig            |  1 -
 20 files changed, 8 insertions(+), 101 deletions(-)
board/sunxi/Kconfig +0 -82
index 561fd6b..8b94311 100644
@@ -69,88 +69,6 @@ config SYS_CONFIG_NAME
 	default "sun8i" if MACH_SUN8I
 	default "sun9i" if MACH_SUN9I
 
-choice
-	prompt "Board"
-
-config TARGET_A10S_OLINUXINO_M
-	bool "A10S_OLINUXINO_M"
-	depends on MACH_SUN5I
-
-config TARGET_A13_OLINUXINOM
-	bool "A13_OLINUXINOM"
-	depends on MACH_SUN5I
-
-config TARGET_A13_OLINUXINO
-	bool "A13_OLINUXINO"
-	depends on MACH_SUN5I
-
-config TARGET_A20_OLINUXINO_L2
-	bool "A20_OLINUXINO_L2"
-	depends on MACH_SUN7I
-
-config TARGET_A20_OLINUXINO_L
-	bool "A20_OLINUXINO_L"
-	depends on MACH_SUN7I
-
-config TARGET_A20_OLINUXINO_M
-	bool "A20_OLINUXINO_M"
-	depends on MACH_SUN7I
-
-config TARGET_AUXTEK_T004
-	bool "AUXTEK_T004"
-	depends on MACH_SUN5I
-
-config TARGET_BANANAPI
-	bool "BANANAPI"
-	depends on MACH_SUN7I
-
-config TARGET_BANANAPRO
-	bool "BANANAPRO"
-	depends on MACH_SUN7I
-
-config TARGET_CUBIEBOARD2
-	bool "CUBIEBOARD2"
-	depends on MACH_SUN7I
-
-config TARGET_CUBIETRUCK
-	bool "CUBIETRUCK"
-	depends on MACH_SUN7I
-
-config TARGET_PCDUINO3
-	bool "PCDUINO3"
-	depends on MACH_SUN7I
-
-config TARGET_MELE_M3
-	bool "MELE_M3"
-	depends on MACH_SUN7I
-
-config TARGET_MK802_A10S
-	bool "MK802_A10S"
-	depends on MACH_SUN5I
-
-config TARGET_MSI_PRIMO73
-	bool "MSI Primo73 (7\" tablet)"
-	depends on MACH_SUN7I
-	---help---
-	The MSI Primo73 is an A20 based tablet, with 1G RAM, 16G NAND,
-	1024x600 TN LCD display, mono speaker, 0.3 MP front camera, 2.0 MP
-	rear camera, 3000 mAh battery, gt911 touchscreen, mma8452 accelerometer
-	and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons
-	(both volume buttons are also connected to the UBOOT_SEL pin). The
-	external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB
-	OTG and 3.5mm headphone jack. More details are available at
-	    http://linux-sunxi.org/MSI_Primo73
-
-config TARGET_I12_TVBOX
-	bool "I12_TVBOX"
-	depends on MACH_SUN7I
-
-config TARGET_R7DONGLE
-	bool "R7DONGLE"
-	depends on MACH_SUN5I
-
-endchoice
-
 config SYS_BOARD
 	default "sunxi"
 
configs/A10s-OLinuXino-M_defconfig +0 -1
index 79a27db..b5f0a0f 100644
@@ -8,7 +8,6 @@ CONFIG_USB1_VBUS_PIN="PB10"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_A10S_OLINUXINO_M=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=4
configs/A13-OLinuXinoM_defconfig +0 -1
index d392ec4..1c3fc3a 100644
@@ -12,7 +12,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_A13_OLINUXINOM=y
 +S:CONFIG_DRAM_CLK=408
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=0
configs/A13-OLinuXino_defconfig +0 -1
index cf205a7..0daaaae 100644
@@ -12,7 +12,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_A13_OLINUXINO=y
 +S:CONFIG_DRAM_CLK=408
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=0
configs/A20-OLinuXino-Lime2_defconfig +0 -1
index 17fd19d..ff94e77 100644
@@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun7i-a20-olinuxino-lime2.dtb"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_A20_OLINUXINO_L2=y
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/A20-OLinuXino-Lime_defconfig +0 -1
index c8243a4..5442f64 100644
@@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun7i-a20-olinuxino-lime.dtb"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_A20_OLINUXINO_L=y
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/A20-OLinuXino_MICRO_defconfig +0 -1
index ac94c79..97a21ee 100644
@@ -8,7 +8,6 @@ CONFIG_VIDEO_VGA=y
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_A20_OLINUXINO_M=y
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/Auxtek-T004_defconfig +0 -1
index eb1d003..03ec3db 100644
@@ -5,7 +5,6 @@ CONFIG_USB1_VBUS_PIN="PG13"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_AUXTEK_T004=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=4
configs/Bananapi_defconfig +0 -1
index 4cff573..5aba938 100644
@@ -5,7 +5,6 @@ CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_BANANAPI=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/Bananapro_defconfig +0 -1
index 0512019..e501b5c 100644
@@ -7,7 +7,6 @@ CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_BANANAPRO=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/Cubieboard2_defconfig +0 -1
index ef5b43a..7704a0e 100644
@@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun7i-a20-cubieboard2.dtb"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_CUBIEBOARD2=y
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/Cubietruck_defconfig +0 -1
index f51c491..b64f84f 100644
@@ -5,7 +5,6 @@ CONFIG_VIDEO_VGA=y
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_CUBIETRUCK=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/Ippo_q8h_v5_defconfig +0 -1
index c894948..4786202 100644
@@ -11,7 +11,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PH0"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN8I=y
-+S:CONFIG_TARGET_IPPO_Q8H_V5=y
 +S:CONFIG_DRAM_CLK=480
 # zq = 0xf777
 +S:CONFIG_DRAM_ZQ=63351
configs/Linksprite_pcDuino3_defconfig +0 -1
index 64e01c8..45d88f3 100644
@@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_PCDUINO3=y
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=122
 +S:CONFIG_DRAM_EMR1=4
configs/Linksprite_pcDuino3_fdt_defconfig +0 -1
index 49718c7..3b6dfa6 100644
@@ -8,7 +8,6 @@ CONFIG_OF_SEPARATE=y
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_PCDUINO3=y
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=122
 +S:CONFIG_DRAM_EMR1=4
configs/MSI_Primo73_defconfig +8 -1
index 6628184..c6fb7e6 100644
@@ -1,3 +1,11 @@
+# The MSI Primo73 is an A20 based tablet, with 1G RAM, 16G NAND,
+# 1024x600 TN LCD display, mono speaker, 0.3 MP front camera, 2.0 MP
+# rear camera, 3000 mAh battery, gt911 touchscreen, mma8452 accelerometer
+# and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons
+# (both volume buttons are also connected to the UBOOT_SEL pin). The
+# external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB
+# OTG and 3.5mm headphone jack. More details are available at
+#    http://linux-sunxi.org/MSI_Primo73
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 CONFIG_FDTFILE="sun7i-a20-primo73.dtb"
@@ -10,7 +18,6 @@ CONFIG_USB_KEYBOARD=n
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_MSI_PRIMO73=y
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/Mele_M3_defconfig +0 -1
index 7f1710a..723a72a 100644
@@ -7,7 +7,6 @@ CONFIG_VIDEO_VGA=y
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_MELE_M3=y
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/i12-tvbox_defconfig +0 -1
index 65791b7..41192fc 100644
@@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun7i-a20-i12-tvbox.dtb"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_TARGET_I12_TVBOX=y
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
configs/mk802_a10s_defconfig +0 -1
index 086e1e4..cafcbaa 100644
@@ -5,7 +5,6 @@ CONFIG_USB1_VBUS_PIN="PB10"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_MK802_A10S=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=0
configs/r7-tv-dongle_defconfig +0 -1
index f467d6c..e99e57d 100644
@@ -5,7 +5,6 @@ CONFIG_USB1_VBUS_PIN="PG13"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_R7DONGLE=y
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=4
Signature · 1 line
2.1.0
#4 lore raw

PATCH 3/4 sunxi: Remove CONFIG_TARGET_FOO for sun5i and sun7i boards

Quoted 9 lines · Hans de Goede

CONFIG_TARGET_FOO was only used in board/sunxi/Makefile to select the dram config for sun5i and sun7i boards and in board/sunxi/gmac.c for some special handling of the bananapi/bananapro (both sun7i), all sun5i and sun7i boards have been moved over to using a single dram_sun5i_autoconfig file, and the tx clk delay handling for the Banana boards now has its own Kconfig.

IOW nothing is using CONFIG_TARGET_FOO anymore, so remove it.

#5 lore raw

PATCH 4/4 sunxi: video: Force h/vsync active high when using ext. vga dac

In reply to Hans de Goede

On both my A13-OLinuxIno and my A13-OLinuxIno-Micro, the vga output gives an unstable image when active low v or hsync is used, so when an external vga dac is used force v and hsync active high independent of what the modeline says.

This fixes the unstable image.

---
 drivers/video/sunxi_display.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/video/sunxi_display.c +9 -3
index af728b5..6b8845f 100644
@@ -645,7 +645,8 @@ static int sunxi_lcdc_get_clk_delay(const struct ctfb_res_modes *mode)
 	return (delay > 30) ? 30 : delay;
 }
 
-static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode)
+static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode,
+				      bool for_ext_vga_dac)
 {
 	struct sunxi_lcdc_reg * const lcdc =
 		(struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE;
@@ -719,6 +720,11 @@ static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode)
 		val |= SUNXI_LCDC_TCON_HSYNC_MASK;
 	if (!(mode->sync & FB_SYNC_VERT_HIGH_ACT))
 		val |= SUNXI_LCDC_TCON_VSYNC_MASK;
+
+	/* Some dacs do not work well with active low, so force syncs high */
+	if (for_ext_vga_dac)
+		val = 0;
+
 	writel(val, &lcdc->tcon0_io_polarity);
 
 	writel(0, &lcdc->tcon0_io_tristate);
@@ -1015,7 +1021,7 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode,
 			hitachi_tx18d42vm_init();
 		}
 		sunxi_composer_mode_set(mode, address);
-		sunxi_lcdc_tcon0_mode_set(mode);
+		sunxi_lcdc_tcon0_mode_set(mode, false);
 		sunxi_composer_enable();
 		sunxi_lcdc_enable();
 #ifdef CONFIG_VIDEO_LCD_SSD2828
@@ -1033,7 +1039,7 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode,
 		sunxi_vga_enable();
 #elif defined CONFIG_VIDEO_VGA_VIA_LCD
 		sunxi_composer_mode_set(mode, address);
-		sunxi_lcdc_tcon0_mode_set(mode);
+		sunxi_lcdc_tcon0_mode_set(mode, true);
 		sunxi_composer_enable();
 		sunxi_lcdc_enable();
 		sunxi_vga_external_dac_enable();
Signature · 1 line
2.1.0
#6 lore raw

PATCH 4/4 sunxi: video: Force h/vsync active high when using ext. vga dac

Quoted 3 lines · Hans de Goede

On both my A13-OLinuxIno and my A13-OLinuxIno-Micro, the vga output gives an unstable image when active low v or hsync is used, so when an external vga dac is used force v and hsync active high independent of what the modeline says.

Does this not just mean the modeline is wrong and should be fixed or an alternative provided which is correct for these systems?

In the code comment you say "some dacs", what about ones which don't have this issue or, worse, ones which have the inverse issue and don't work with active high?

At the least I'd say this aught to be controllable via Kconfig.

Ian.

#7 lore raw

PATCH 4/4 sunxi: video: Force h/vsync active high when using ext. vga dac

Hi,

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

On both my A13-OLinuxIno and my A13-OLinuxIno-Micro, the vga output gives an unstable image when active low v or hsync is used, so when an external vga dac is used force v and hsync active high independent of what the modeline says.

Does this not just mean the modeline is wrong and should be fixed or an alternative provided which is correct for these systems?

I would rather not, the modeline uses is a vesa standard timing, so it certainly is correct.

The problem seems to be specific with the OLinuxIno A13 (normal & micro) boards. I've just looked up the schematics and they use an opendrain driver for the vga sync lines, and with sync pulses it is the logical high->low edge of the pulse which counts for the timing, which with an active low sync is being driven by the pull-up, and that simply seems to not drive it hard enough to get a stable image.

Quoted 5 lines

In the code comment you say "some dacs", what about ones which don't have this issue or, worse, ones which have the inverse issue and don't work with active high?

At the least I'd say this aught to be controllable via Kconfig.

I agree this should be a Kconfig and only turned on on the Olinuxino 13 boards. I'll do a v2.

Regards,

Hans

#8 lore raw

PATCH 1/4 sunxi: Convert sun5i boards to use auto dram configuration

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

Currently we've separate detailed dram settings for all sun5i boards, this moves them over to using auto dram configuration so that we can get rid of all the per board dram_foo.c files.

This has been tested on a A10s-Olinuxino, A13-Olinuxino, A13-OlinuxinoM, mk802-a10s and r7-tv-dongle board.