From 9d6210f3f1dd67425f4c72b092bef95605afcada Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 18 Mar 2016 12:35:41 +0000 Subject: [PATCH] Add upstream patches to fix some issues on some AllWinner devices --- ...me-revisions-needing-a-different-mag.patch | 58 ++++++++ ...ot-working-due-to-cpu_eth_init-no-lo.patch | 125 ++++++++++++++++++ uboot-tools.spec | 7 +- 3 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 0001-sunxi-A23-Fix-some-revisions-needing-a-different-mag.patch create mode 100644 0002-sunxi-Fix-gmac-not-working-due-to-cpu_eth_init-no-lo.patch diff --git a/0001-sunxi-A23-Fix-some-revisions-needing-a-different-mag.patch b/0001-sunxi-A23-Fix-some-revisions-needing-a-different-mag.patch new file mode 100644 index 0000000..3c9aba7 --- /dev/null +++ b/0001-sunxi-A23-Fix-some-revisions-needing-a-different-mag.patch @@ -0,0 +1,58 @@ +From 22f2f6dd2a0e835f329f87b5349130300fc46e42 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 4 Mar 2016 10:57:34 +0100 +Subject: [PATCH 1/2] sunxi: A23: Fix some revisions needing a different magic + sram poke + +I've had this one a23 tablet which would not boot and I've finally +figured out what the problem is by looking at the released boot0 code, +it seems the magic sram controller poke which we need to do in s_init() +depends on the revision of the a23. + +Specifically this change is needed to get the A23 SoC I have with the +following serial to boot: "E6071AB 26Y7". + +Signed-off-by: Hans de Goede +Acked-by: Ian Campbell +--- + arch/arm/cpu/armv7/sunxi/board.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c +index eb5f4b6..e80785b 100644 +--- a/arch/arm/cpu/armv7/sunxi/board.c ++++ b/arch/arm/cpu/armv7/sunxi/board.c +@@ -113,11 +113,27 @@ int spl_board_load_image(void) + + void s_init(void) + { +-#if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_A23 +- /* Magic (undocmented) value taken from boot0, without this DRAM +- * access gets messed up (seems cache related) */ ++ /* ++ * Undocumented magic taken from boot0, without this DRAM ++ * access gets messed up (seems cache related). ++ * The boot0 sources describe this as: "config ema for cache sram" ++ */ ++#if defined CONFIG_MACH_SUN6I + setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800); ++#elif defined CONFIG_MACH_SUN8I_A23 ++ uint version; ++ ++ /* Unlock sram version info reg, read it, relock */ ++ setbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15)); ++ version = readl(SUNXI_SRAMC_BASE + 0x24); ++ clrbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15)); ++ ++ if ((version & 0xffff0000) == 0x16500000) ++ setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800); ++ else /* 0x1661 ? */ ++ setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0xc0); + #endif ++ + #if defined CONFIG_MACH_SUN6I || \ + defined CONFIG_MACH_SUN7I || \ + defined CONFIG_MACH_SUN8I +-- +2.7.3 + diff --git a/0002-sunxi-Fix-gmac-not-working-due-to-cpu_eth_init-no-lo.patch b/0002-sunxi-Fix-gmac-not-working-due-to-cpu_eth_init-no-lo.patch new file mode 100644 index 0000000..8aaebad --- /dev/null +++ b/0002-sunxi-Fix-gmac-not-working-due-to-cpu_eth_init-no-lo.patch @@ -0,0 +1,125 @@ +From befbbcca23f862a441d8a73f1a1fbe586185576d Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 17 Mar 2016 13:53:03 +0100 +Subject: [PATCH 2/2] sunxi: Fix gmac not working due to cpu_eth_init no longer + being called + +cpu_eth_init is no longer called for dm enabled eth drivers, this +was causing the sunxi gmac eth controller to no longer work in u-boot. + +This commit fixes this by moving the gpio setup to gpio_init() and by +calling the clock, reset and pinmux setup function from s_init(). + +Note that the mdelay is dropped as the phy gets enabled much earlier +now, so it is no longer needed. + +Signed-off-by: Hans de Goede +--- + arch/arm/cpu/armv7/sunxi/board.c | 32 +++++------------------------ + arch/arm/include/asm/arch-sunxi/sys_proto.h | 6 +++++- + board/sunxi/gmac.c | 14 +------------ + 3 files changed, 11 insertions(+), 41 deletions(-) + +diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c +index e80785b..9a97049 100644 +--- a/arch/arm/cpu/armv7/sunxi/board.c ++++ b/arch/arm/cpu/armv7/sunxi/board.c +@@ -100,6 +100,10 @@ static int gpio_init(void) + #error Unsupported console port number. Please fix pin mux settings in board.c + #endif + ++#ifdef CONFIG_MACPWR ++ gpio_request(CONFIG_MACPWR, "macpwr"); ++ gpio_direction_output(CONFIG_MACPWR, 1); ++#endif + return 0; + } + +@@ -152,6 +156,7 @@ void s_init(void) + timer_init(); + gpio_init(); + i2c_init_board(); ++ eth_init_board(); + } + + #ifdef CONFIG_SPL_BUILD +@@ -259,30 +264,3 @@ void enable_caches(void) + dcache_enable(); + } + #endif +- +-#ifdef CONFIG_CMD_NET +-/* +- * Initializes on-chip ethernet controllers. +- * to override, implement board_eth_init() +- */ +-int cpu_eth_init(bd_t *bis) +-{ +- __maybe_unused int rc; +- +-#ifdef CONFIG_MACPWR +- gpio_request(CONFIG_MACPWR, "macpwr"); +- gpio_direction_output(CONFIG_MACPWR, 1); +- mdelay(200); +-#endif +- +-#ifdef CONFIG_SUNXI_GMAC +- rc = sunxi_gmac_initialize(bis); +- if (rc < 0) { +- printf("sunxi: failed to initialize gmac\n"); +- return rc; +- } +-#endif +- +- return 0; +-} +-#endif +diff --git a/arch/arm/include/asm/arch-sunxi/sys_proto.h b/arch/arm/include/asm/arch-sunxi/sys_proto.h +index 9df3744..a373319 100644 +--- a/arch/arm/include/asm/arch-sunxi/sys_proto.h ++++ b/arch/arm/include/asm/arch-sunxi/sys_proto.h +@@ -24,6 +24,10 @@ void sdelay(unsigned long); + void return_to_fel(uint32_t lr, uint32_t sp); + + /* Board / SoC level designware gmac init */ +-int sunxi_gmac_initialize(bd_t *bis); ++#if !defined CONFIG_SPL_BUILD && defined CONFIG_SUNXI_GMAC ++void eth_init_board(void); ++#else ++static inline void eth_init_board(void) {} ++#endif + + #endif +diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c +index 4e222d8..69eb8ff 100644 +--- a/board/sunxi/gmac.c ++++ b/board/sunxi/gmac.c +@@ -6,7 +6,7 @@ + #include + #include + +-int sunxi_gmac_initialize(bd_t *bis) ++void eth_init_board(void) + { + int pin; + struct sunxi_ccm_reg *const ccm = +@@ -79,16 +79,4 @@ int sunxi_gmac_initialize(bd_t *bis) + for (pin = SUNXI_GPA(26); pin <= SUNXI_GPA(27); pin++) + sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_GMAC); + #endif +- +-#ifdef CONFIG_DM_ETH +- return 0; +-#else +-# ifdef CONFIG_RGMII +- return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_RGMII); +-# elif defined CONFIG_GMII +- return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_GMII); +-# else +- return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_MII); +-# endif +-#endif + } +-- +2.7.3 + diff --git a/uboot-tools.spec b/uboot-tools.spec index e6c2cb2..2259fff 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -2,7 +2,7 @@ Name: uboot-tools Version: 2016.03 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Release: 2%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities Group: Development/Tools @@ -18,6 +18,8 @@ Patch4: mvebu-enable-generic-distro-boot-config.patch Patch5: 0001-WIP-RPi-3-32-bit-port.patch Patch6: sunxi-chip-enable-composite-video-out.patch Patch7: sunxi-fix-DCDC2-output-in-CHIP_defconfig.patch +Patch8: 0001-sunxi-A23-Fix-some-revisions-needing-a-different-mag.patch +Patch9: 0002-sunxi-Fix-gmac-not-working-due-to-cpu_eth_init-no-lo.patch BuildRequires: bc BuildRequires: dtc @@ -167,6 +169,9 @@ install -p -m 0644 tools/env/fw_env.config $RPM_BUILD_ROOT%{_sysconfdir} %endif %changelog +* Fri Mar 18 2016 Peter Robinson 2016.03-2 +- Add upstream patches to fix some issues on some AllWinner devices + * Mon Mar 14 2016 Peter Robinson 2016.03-1 - Update to 2016.03 GA