sun4i (v2) + sun5i + pmic + emac support
Subsystems (6)
cover sun4i (v2) + sun5i + pmic + emac support
Hi All,
Here is my continued work on getting various additional sunxi bits ready for upstreaming on top of Ian's sun7i upstreaming work.
As a basis I'm using Ian's v1 series, without GMAC as that is in a bit of flux and with various cleanups which were later added to the u-boot-sunxi repo squashed in, for a full series starting from v2014.01 (for now), see:
https://github.com/jwrdegoede/u-boot-sunxi/tree/v2014.01-sunxi
There are 3 FIXUP patches in here which are intended to be squashed into Ian's work. Ian, can you please pick these up ?
The rest speaks for itself I hope. With this series we're pretty close to feature parity with the u-boot-sunxi branch.
Besides GMAC support the folliwing things are missing:
-uart0 on port F (mmc0 pins) support
-gpio command support
-status-led support
-falcon boot
-boards, boards, boards
-printing of board-name as part of the banner
I plan to fix the last one in the next version of my patch-set, note I've no plans to work on the other ones, they are all nice to have, but not really crucial to have IMHO.
Regards,
Hans
PATCH 1/12 sunxi: Implement reset_cpu
There is no way to reset the cpu, so use the watchdog for this.
--- arch/arm/cpu/armv7/sunxi/board.c | 7 +++++++ arch/arm/include/asm/arch-sunxi/timer.h | 4 ++++ 2 files changed, 11 insertions(+)
arch/arm/cpu/armv7/sunxi/board.c +7 -0
@@ -54,6 +54,13 @@ int gpio_init(void)void reset_cpu (ulong addr) { +static const struct sunxi_wdog *wdog = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->wdog; + +/* Set the watchdog for its shortest interval (.5s) and wait */ +writel (WDT_MODE_RESET_EN |WDT_MODE_EN , &wdog->mode); +writel (WDT_CTRL_RESTART , &wdog->ctl); +while (1 ); }/* do some early init */
arch/arm/include/asm/arch-sunxi/timer.h +4 -0
@@ -11,6 +11,10 @@#ifndef _SUNXI_TIMER_H_#define _SUNXI_TIMER_H_ +#define WDT_CTRL_RESTART (0x1 << 0) +#define WDT_MODE_EN (0x1 << 0) +#define WDT_MODE_RESET_EN (0x1 << 1) +#ifndef __ASSEMBLY__#include <linux/types.h>
Signature · 1 line
1.9.0
PATCH 1/12 sunxi: Implement reset_cpu
Quoted 1 line · Hans de Goede
There is no way to reset the cpu, so use the watchdog for this.
Did you see
https://www.mail-archive.com/u-boot at lists.denx.de/msg134259.html ?
Quoted 40 lines
Signed-off-by Hans de Goede <[email protected]>--- arch/arm/cpu/armv7/sunxi/board.c | 7 +++++++ arch/arm/include/asm/arch-sunxi/timer.h | 4 ++++ 2 files changed, 11 insertions(+)arch/arm/cpu/armv7/sunxi/board.c +7
-0@@ -54,6 +54,13 @@ int gpio_init(void)void reset_cpu (ulong addr) { +static const struct sunxi_wdog *wdog = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->wdog; + +/* Set the watchdog for its shortest interval (.5s) and wait */ +writel (WDT_MODE_RESET_EN |WDT_MODE_EN , &wdog->mode); +writel (WDT_CTRL_RESTART , &wdog->ctl); +while (1 ); }/* do some early init */ arch/arm/include/asm/arch-sunxi/timer.h +4
-0@@ -11,6 +11,10 @@#ifndef _SUNXI_TIMER_H_#define _SUNXI_TIMER_H_ +#define WDT_CTRL_RESTART (0x1 << 0) +#define WDT_MODE_EN (0x1 << 0) +#define WDT_MODE_RESET_EN (0x1 << 1) +#ifndef __ASSEMBLY__#include <linux/types.h>
PATCH 1/12 sunxi: Implement reset_cpu
Hi,
Quoted 5 lines · Ian Campbell
Quoted 1 line · Hans de Goede
There is no way to reset the cpu, so use the watchdog for this.
Did you see
https://www.mail-archive.com/u-boot at lists.denx.de/msg134259.html ?
Ah no, but I've read it now.
I think it would be better to focus on all the other more important bits for now, and then we can look into adding some sort of generic watchdog support later.
In the mean time I would like to carry this patch, since having "reset" work can be quite useful, and it is just 3 lines (not counting the lines which we would still need with the generic watchdog support).
Regards,
Hans
Quoted 43 lines
Quoted 41 lines
Signed-off-by Hans de Goede <[email protected]>--- arch/arm/cpu/armv7/sunxi/board.c | 7 +++++++ arch/arm/include/asm/arch-sunxi/timer.h | 4 ++++ 2 files changed, 11 insertions(+)arch/arm/cpu/armv7/sunxi/board.c +7
-0@@ -54,6 +54,13 @@ int gpio_init(void)void reset_cpu (ulong addr) { +static const struct sunxi_wdog *wdog = + &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE )->wdog; + +/* Set the watchdog for its shortest interval (.5s) and wait */ +writel (WDT_MODE_RESET_EN |WDT_MODE_EN , &wdog->mode); +writel (WDT_CTRL_RESTART , &wdog->ctl); +while (1 ); }/* do some early init */ arch/arm/include/asm/arch-sunxi/timer.h +4
-0@@ -11,6 +11,10 @@#ifndef _SUNXI_TIMER_H_#define _SUNXI_TIMER_H_ +#define WDT_CTRL_RESTART (0x1 << 0) +#define WDT_MODE_EN (0x1 << 0) +#define WDT_MODE_RESET_EN (0x1 << 1) +#ifndef __ASSEMBLY__#include <linux/types.h>
PATCH 1/12 sunxi: Implement reset_cpu
Quoted 6 lines · Hans de Goede
Hi,
Quoted 3 lines · Ian Campbell
Quoted 1 line · Hans de Goede
There is no way to reset the cpu, so use the watchdog for this.
Quoted 8 lines
Quoted 2 lines
Did you see
https://www.mail-archive.com/u-boot at lists.denx.de/msg134259.html ?Ah no, but I've read it now.
I think it would be better to focus on all the other more important bits for now, and then we can look into adding some sort of generic watchdog support later.
OK, I wanted to avoid divergence between the upstreaming effort at u-boot-sunxi.git as much as possible, but in this case I think the impact is small enough to be acceptable.
Quoted 2 lines
In the mean time I would like to carry this patch, since having "reset" work can be quite useful,
Absolutely!
(While I'm here: thanks for applying those other patches)
Ian
PATCH 2/12 sunxi: FIXUP: sunxi: initial generic sun7i cpu, board and start of day support
In reply to Hans de GoedeAdd #ifdef CONFIG_SUN7I were appropriate to make adding sun4i / sun5i support later easier.
--- arch/arm/cpu/armv7/sunxi/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/board.c +1 -1
@@ -66,7 +66,7 @@ void reset_cpu(ulong addr)/* do some early init */ void s_init (void ) { -#if !definedCONFIG_SPL_BUILD +#if !definedCONFIG_SPL_BUILD && definedCONFIG_SUN7I /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"
Signature · 1 line
1.9.0
PATCH 3/12 sunxi: FIXUP: sunxi: initial sun7i clocks and timer support.
In reply to Hans de GoedeAdd #ifdef CONFIG_SUN7I were appropriate to make adding sun4i / sun5i support later easier.
--- arch/arm/cpu/armv7/sunxi/clock.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/cpu/armv7/sunxi/clock.c +2 -0
@@ -33,10 +33,12 @@ static void clock_init_safe(void)APB0_DIV_1 <<APB0_DIV_SHIFT |CPU_CLK_SRC_PLL1 <<CPU_CLK_SRC_SHIFT , &ccm->cpu_ahb_apb0_cfg); +#ifdef CONFIG_SUN7I writel (0x1 <<AHB_GATE_OFFSET_DMA |readl (&ccm->ahb_gate0), &ccm->ahb_gate0);writel (0x1 <<PLL6_ENABLE_OFFSET |readl (&ccm->pll6_cfg), &ccm->pll6_cfg); +#endif }#endif
Signature · 1 line
1.9.0
PATCH 4/12 sunxi: FIXUP: sunxi: initial sun7i dram setup support
In reply to Hans de GoedeAdd #ifdef CONFIG_SUN?I were appropriate to make adding sun4i / sun5i support later easier.
--- arch/arm/cpu/armv7/sunxi/dram.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/dram.c +24 -1
@@ -116,6 +116,7 @@ static void mctl_enable_dllx(u32 phase) } static u32 hpcr_value[32] = { +#ifdef CONFIG_SUN7I 0x0301 ,0x0301 ,0x0301 ,0x0301 ,0x0301 ,0x0301 ,0x0301 ,0x0301 , 0, 0, 0, 0,
@@ -129,6 +130,7 @@ static u32 hpcr_value[32] = {* but boot0 code skips #28 and #30, and sets #29 and #31 to the * value from #28 entry (0x1031) */ +#endif };static void mctl_configure_hostport (void )
@@ -162,11 +164,13 @@ static void mctl_setup_dram_clock(u32 clk)setbits_le32 (&ccm->pll5_cfg,CCM_PLL5_CTRL_DDR_CLK ); +#if defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I )/* reset GPS */ clrbits_le32 (&ccm->gps_clk_cfg,CCM_GPS_CTRL_RESET |CCM_GPS_CTRL_GATE );setbits_le32 (&ccm->ahb_gate0,CCM_AHB_GATE_GPS );udelay (1 );clrbits_le32 (&ccm->ahb_gate0,CCM_AHB_GATE_GPS ); +#endif /* setup MBUS clock */ reg_val = CCM_MBUS_CTRL_GATE |
@@ -193,7 +197,9 @@ static int dramc_scan_readpipe(void)u32 reg_val;/* data training trigger */ +#ifdef CONFIG_SUN7I clrbits_le32 (&dram->csr,DRAM_CSR_FAILED ); +#endif setbits_le32 (&dram->ccr,DRAM_CCR_DATA_TRAINING );/* check whether data training process has completed */
@@ -320,15 +326,17 @@ fail:static void dramc_clock_output_en (u32 on) { +#if defined(CONFIG_SUN5I ) || defined(CONFIG_SUN7I )struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE ;if (on)setbits_le32 (&dram->mcr,DRAM_MCR_DCLK_OUT );else clrbits_le32 (&dram->mcr,DRAM_MCR_DCLK_OUT ); +#endif } - +#if defined(CONFIG_SUN5I ) || defined(CONFIG_SUN7I )static void dramc_set_autorefresh_cycle (u32 clk) {struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE ;
@@ -342,6 +350,7 @@ static void dramc_set_autorefresh_cycle(u32 clk) reg_val |=0x8 <<24 ; writel(reg_val, &dram->drr); } +#endif /* SUN5I */ unsigned long dramc_init (struct dram_para *para) {
@@ -392,24 +401,32 @@ unsigned long dramc_init(struct dram_para *para) reg_val |=DRAM_DCR_MODE (DRAM_DCR_MODE_INTERLEAVE );writel (reg_val, &dram->dcr); +#ifdef CONFIG_SUN7I setbits_le32 (&dram->zqcr1, (0x1 <<24 ) | (0x1 <<1 ));if (para->tpr4 &0x2 )clrsetbits_le32 (&dram->zqcr1, (0x1 <<24 ), (0x1 <<1 ));dramc_clock_output_en (1 ); +#endif +#if (defined(CONFIG_SUN5I ) || defined(CONFIG_SUN7I ))/* set odt impendance divide ratio */ reg_val = ((para->zq) >>8 ) &0xfffff ; reg_val |= ((para->zq) &0xff ) <<20 ; reg_val |= (para->zq) &0xf0000000 ;writel (reg_val, &dram->zqcr0); +#endif +#ifdef CONFIG_SUN7I /* Set CKE Delay to about 1ms */ setbits_le32 (&dram->idcr,0x1ffff ); +#endif +#ifdef CONFIG_SUN7I if ((readl (&dram->ppwrsctl) &0x1 ) !=0x1 )mctl_ddr3_reset ();else setbits_le32 (&dram->mcr,DRAM_MCR_RESET ); +#endif udelay (1 );
@@ -427,7 +444,9 @@ unsigned long dramc_init(struct dram_para *para)if (para->type ==DRAM_MEMORY_TYPE_DDR3 ) { reg_val =DRAM_MR_BURST_LENGTH (0x0 ); +#if (defined(CONFIG_SUN5I ) || defined(CONFIG_SUN7I )) reg_val |=DRAM_MR_POWER_DOWN ; +#endif reg_val |=DRAM_MR_CAS_LAT (para->cas -4 ); reg_val |=DRAM_MR_WRITE_RECOVERY (0x5 ); }else if (para->type ==DRAM_MEMORY_TYPE_DDR2 ) {
@@ -444,13 +463,16 @@ unsigned long dramc_init(struct dram_para *para)/* set DQS window mode */ clrsetbits_le32 (&dram->ccr,DRAM_CCR_DQS_DRIFT_COMP ,DRAM_CCR_DQS_GATE ); +#ifdef CONFIG_SUN7I /* Command rate timing mode 2T & 1T */ if (para->tpr4 &0x1 )setbits_le32 (&dram->ccr,DRAM_CCR_COMMAND_RATE_1T ); +#endif /* reset external DRAM */ setbits_le32 (&dram->ccr,DRAM_CCR_INIT );while (readl (&dram->ccr) &DRAM_CCR_INIT ); +#ifdef CONFIG_SUN7I /* setup zq calibration manual */ reg_val =readl (&dram->ppwrsctl);if ((reg_val &0x1 ) ==1 ) {
@@ -486,6 +508,7 @@ unsigned long dramc_init(struct dram_para *para) udelay(2); } +#endif /* scan read pipe value */ mctl_itm_enable ();
Signature · 1 line
1.9.0
PATCH 5/12 sunxi: Add sun4i support
In reply to Hans de GoedeBased linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
As well as the following signed-off-by the sunxi branch shows commits to the new sun4i dram bits by:
Berg Xing <[email protected]>
Tom Cubie <[email protected]>
--- arch/arm/cpu/armv7/sunxi/cpu_info.c | 7 +++ arch/arm/cpu/armv7/sunxi/dram.c | 108 ++++++++++++++++++++++++++++++++++++ board/sunxi/Makefile | 3 +- board/sunxi/dram_a10_olinuxino_l.c | 31 +++++++++++ boards.cfg | 1 + drivers/mmc/sunxi_mmc.c | 10 ++++ include/configs/sun4i.h | 23 ++++++++ 7 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 board/sunxi/dram_a10_olinuxino_l.c create mode 100644 include/configs/sun4i.h
arch/arm/cpu/armv7/sunxi/cpu_info.c +7 -0
@@ -13,7 +13,14 @@#ifdef CONFIG_DISPLAY_CPUINFO int print_cpuinfo (void ) { +#ifdef CONFIG_SUN4I +puts ("CPU: Allwinner A10 (SUN4I)\n" ); +#elif definedCONFIG_SUN7I puts ("CPU: Allwinner A20 (SUN7I)\n" ); +#else +#warning Please update cpu_info.c with correct CPU information +puts ("CPU: SUNXI Family\n" ); +#endif return 0 ; }#endif
arch/arm/cpu/armv7/sunxi/dram.c +108 -0
185 lines not on this page · raw message
board/sunxi/Makefile +2 -1
@@ -9,4 +9,5 @@ # SPDX-License-Identifier: GPL-2.0+ # obj-y += board.o -obj-y += dram_cubietruck.o +obj-$(CONFIG_A10_OLINUXINO_L) += dram_a10_olinuxino_l.o +obj-$(CONFIG_CUBIETRUCK) += dram_cubietruck.o
board/sunxi/dram_a10_olinuxino_l.c new file +31 -0
@@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */ + +#include <common.h> +#include <asm/arch/dram.h> + +static struct dram_para dram_para = { + .clock =480 , + .type =3 , + .rank_num =1 , + .density =4096 , + .io_width =16 , + .bus_width =16 , + .cas =6 , + .zq =123 , + .odt_en =0 , + .size =512 , + .tpr0 =0x30926692 , + .tpr1 =0x1090 , + .tpr2 =0x1a0c8 , + .tpr3 =0 , + .tpr4 =0 , + .tpr5 =0 , + .emr1 =0x4 , + .emr2 =0 , + .emr3 =0 , +}; + +unsigned long sunxi_dram_init (void ) +{ +return dramc_init (&dram_para); +}
boards.cfg +1 -0
@@ -353,6 +353,7 @@ Active arm armv7 rmobile renesas koelsch Active arm armv7 s5pc1xx samsung goni s5p_goni - Mateusz Zalega <[email protected]> Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - +Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,SPL - Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,SPL - Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]>
drivers/mmc/sunxi_mmc.c +10 -0
@@ -71,10 +71,20 @@ struct sunxi_mmc_des { u32 reserved1_2:24; u32 card_err_sum:1; /* transfer error flag */ u32 own:1; /* des owner:1-idma owns it, 0-host owns it */ +#ifdef CONFIG_SUN4I +#define SDXC_DES_NUM_SHIFT 13 +#define SDXC_DES_BUFFER_MAX_LEN (1 << SDXC_DES_NUM_SHIFT) + u32 data_buf1_sz:13; + u32 data_buf2_sz:13; + u32 reserverd2_1:6; +#elif defined(CONFIG_SUN5I ) || defined(CONFIG_SUN7I )#define SDXC_DES_NUM_SHIFT 16#define SDXC_DES_BUFFER_MAX_LEN (1 << SDXC_DES_NUM_SHIFT) u32 data_buf1_sz:16; u32 data_buf2_sz:16; +#else +#error ">>>> Wrong Platform for MMC <<<<" +#endif u32 buf_addr_ptr1;u32 buf_addr_ptr2; };
include/configs/sun4i.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* (C) Copyright 2012-2013 Henrik Nordstrom <[email protected]> +* +* Configuration settings for the Allwinner A10 (sun4i) CPU +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef __CONFIG_H +#define __CONFIG_H + +/* +* A10 specific configuration +*/ +#define CONFIG_SUN4I /* sun4i SoC generation */ + +#define CONFIG_SYS_PROMPT "sun4i# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
Signature · 1 line
1.9.0
PATCH 6/12 sunxi: Add sun5i support
In reply to Hans de GoedeBased linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
As well as the following signed-off-by the sunxi branch shows commits to the sun5i dram bits by:
Berg Xing <[email protected]>
Tom Cubie <[email protected]>
--- arch/arm/cpu/armv7/sunxi/board.c | 12 ++++++++++++ arch/arm/cpu/armv7/sunxi/clock.c | 5 +++++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 3 +++ arch/arm/cpu/armv7/sunxi/dram.c | 15 +++++++++++++++ arch/arm/include/asm/arch-sunxi/clock.h | 7 +++++++ board/sunxi/Makefile | 1 + board/sunxi/dram_a10s_olinuxino_m.c | 31 +++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/sun5i.h | 23 +++++++++++++++++++++++ include/configs/sunxi-common.h | 2 ++ 10 files changed, 100 insertions(+) create mode 100644 board/sunxi/dram_a10s_olinuxino_m.c create mode 100644 include/configs/sun5i.h
arch/arm/cpu/armv7/sunxi/board.c +12 -0
@@ -45,9 +45,21 @@ u32 spl_boot_mode(void)int gpio_init (void ) { +#if CONFIG_CONS_INDEX ==1 && (defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I ))sunxi_gpio_set_cfgpin (SUNXI_GPB (22 ),SUN4I_GPB22_UART0_TX );sunxi_gpio_set_cfgpin (SUNXI_GPB (23 ),SUN4I_GPB23_UART0_RX );sunxi_gpio_set_pull (SUNXI_GPB (23 ),1 ); +#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_SUN5I ) +sunxi_gpio_set_cfgpin (SUNXI_GPB (19 ),SUN5I_GPB19_UART0_TX ); +sunxi_gpio_set_cfgpin (SUNXI_GPB (20 ),SUN5I_GPB20_UART0_RX ); +sunxi_gpio_set_pull (SUNXI_GPB (20 ),1 ); +#elif CONFIG_CONS_INDEX ==2 && defined(CONFIG_SUN5I ) +sunxi_gpio_set_cfgpin (SUNXI_GPG (3 ),SUN5I_GPG3_UART1_TX ); +sunxi_gpio_set_cfgpin (SUNXI_GPG (4 ),SUN5I_GPG4_UART1_RX ); +sunxi_gpio_set_pull (SUNXI_GPG (4 ),1 ); +#else +#error Unsupported console port number. Please fix pin mux settings in board.c +#endif return 0 ; }
arch/arm/cpu/armv7/sunxi/clock.c +5 -0
@@ -33,6 +33,11 @@ static void clock_init_safe(void)APB0_DIV_1 <<APB0_DIV_SHIFT |CPU_CLK_SRC_PLL1 <<CPU_CLK_SRC_SHIFT , &ccm->cpu_ahb_apb0_cfg); +#ifdef CONFIG_SUN5I +/* Power on reset default for PLL6 is 2400 MHz, which is faster then +* it can reliable do :| Set it to a 600 MHz instead. */ +writel (PLL6_CFG_DEFAULT , &ccm->pll6_cfg); +#endif #ifdef CONFIG_SUN7I writel (0x1 <<AHB_GATE_OFFSET_DMA |readl (&ccm->ahb_gate0), &ccm->ahb_gate0);
arch/arm/cpu/armv7/sunxi/cpu_info.c +3 -0
@@ -15,6 +15,9 @@ int print_cpuinfo(void) {#ifdef CONFIG_SUN4I puts ("CPU: Allwinner A10 (SUN4I)\n" ); +#elif definedCONFIG_SUN5I +/* TODO: Distinguish A13/A10s */ +puts ("CPU: Allwinner A13/A10s (SUN5I)\n" );#elif definedCONFIG_SUN7I puts ("CPU: Allwinner A20 (SUN7I)\n" );#else
arch/arm/cpu/armv7/sunxi/dram.c +15 -0
@@ -139,6 +139,16 @@ static void mctl_enable_dllx(u32 phase) } static u32 hpcr_value[32] = { +#ifdef CONFIG_SUN5I +0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , +0x1031 ,0x1031 ,0x0735 ,0x1035 , +0x1035 ,0x0731 ,0x1031 ,0 , +0x0301 ,0x0301 ,0x0301 ,0x0301 , + 0x0301, 0x0301, 0x0301, 0 +#endif #ifdef CONFIG_SUN4I0x0301 ,0x0301 ,0x0301 ,0x0301 , 0x0301, 0x0301, 0, 0,
@@ -446,6 +456,11 @@ unsigned long dramc_init(struct dram_para *para)/* setup DRAM relative clock */ mctl_setup_dram_clock (para->clock); +#ifdef CONFIG_SUN5I +/* Disable any pad power save control */ +writel (0 , &dram->ppwrsctl); +#endif +/* reset external DRAM */ #ifndef CONFIG_SUN7I mctl_ddr3_reset ();
arch/arm/include/asm/arch-sunxi/clock.h +7 -0
@@ -119,8 +119,15 @@ struct sunxi_ccm_reg {#define PLL1_CFG_DEFAULT 0xa1005000 +#ifdef CONFIG_SUN5I +#define PLL6_CFG_DEFAULT 0x21009911 +#endif #define PLL6_ENABLE_OFFSET 31 +#ifdef CONFIG_SUN5I +#define AHB_CLK_SRC_AXI 0 +#endif +#define CLK_GATE_OPEN 0x1#define CLK_GATE_CLOSE 0x0
board/sunxi/Makefile +1 -0
@@ -10,4 +10,5 @@ # obj-y += board.o obj-$(CONFIG_A10_OLINUXINO_L) += dram_a10_olinuxino_l.o +obj-$(CONFIG_A10S_OLINUXINO_M) += dram_a10s_olinuxino_m.o obj-$(CONFIG_CUBIETRUCK) += dram_cubietruck.o
board/sunxi/dram_a10s_olinuxino_m.c new file +31 -0
@@ -0,0 +1,31 @@ +/* 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); +}
boards.cfg +1 -0
@@ -354,6 +354,7 @@ Active arm armv7 s5pc1xx samsung goni Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,SPL - +Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,SPL - Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,SPL - Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]>
include/configs/sun5i.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* (C) Copyright 2012-2013 Henrik Nordstrom <[email protected]> +* +* Configuration settings for the Allwinner A13 (sun5i) CPU +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef __CONFIG_H +#define __CONFIG_H + +/* +* High Level Configuration Options +*/ +#define CONFIG_SUN5I /* sun5i SoC generation */ + +#define CONFIG_SYS_PROMPT "sun5i# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
include/configs/sunxi-common.h +2 -0
@@ -176,7 +176,9 @@#undef CONFIG_CMD_NET#undef CONFIG_CMD_NFS +#ifndef CONFIG_CONS_INDEX #define CONFIG_CONS_INDEX 1/* UART0 */ +#endif #if !defined CONFIG_ENV_IS_IN_MMC && \ !defined CONFIG_ENV_IS_IN_NAND && \
Signature · 1 line
1.9.0
PATCH 7/12 sunxi: Add i2c support
In reply to Hans de GoedeFrom: Henrik Nordstrom <[email protected]>
Based linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
As well as the following signed-off-by the sunxi branch shows commits to the sunxi_i2c.c file by:
Stefan Roese <[email protected]>
--- arch/arm/cpu/armv7/sunxi/board.c | 6 + arch/arm/include/asm/arch-sunxi/i2c.h | 169 ++++++++++++++++++++++ drivers/i2c/Makefile | 1 + drivers/i2c/sunxi_i2c.c | 260 ++++++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 ++ 5 files changed, 444 insertions(+) create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h create mode 100644 drivers/i2c/sunxi_i2c.c
arch/arm/cpu/armv7/sunxi/board.c +6 -0
@@ -11,6 +11,7 @@*/ #include <common.h> +#include <i2c.h> #include <serial.h> #ifdef CONFIG_SPL_BUILD #include <spl.h>
@@ -94,6 +95,11 @@ void s_init(void) gd = &gdata;preloader_console_init (); +#ifdef CONFIG_SPL_I2C_SUPPORT +/* Needed early by sunxi_board_init if PMU is enabled */ +i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); +#endif +sunxi_board_init ();#endif }
arch/arm/include/asm/arch-sunxi/i2c.h new file +169 -0
169 lines not on this page · raw message
drivers/i2c/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o obj-$(CONFIG_TSI108_I2C) += tsi108_i2c.o obj-$(CONFIG_U8500_I2C) += u8500_i2c.o obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o +obj-$(CONFIG_SUNXI_I2C) += sunxi_i2c.o obj-$(CONFIG_SYS_I2C) += i2c_core.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o
drivers/i2c/sunxi_i2c.c new file +260 -0
260 lines not on this page · raw message
include/configs/sunxi-common.h +8 -0
@@ -176,6 +176,14 @@#undef CONFIG_CMD_NET#undef CONFIG_CMD_NFS +/* I2C */ +#define CONFIG_SPL_I2C_SUPPORT +#define CONFIG_SYS_I2C_SPEED 400000 +#define CONFIG_HARD_I2C +#define CONFIG_SUNXI_I2C +#define CONFIG_SYS_I2C_SLAVE 0x7f +#define CONFIG_CMD_I2C +#ifndef CONFIG_CONS_INDEX #define CONFIG_CONS_INDEX 1/* UART0 */ #endif
Signature · 1 line
1.9.0
Heiko Schocher
NAKPATCH 7/12 sunxi: Add i2c support
Hello Hans,
Am 18.03.2014 00:00, schrieb Hans de Goede:
Quoted 23 lines
From: Henrik Nordstrom<[email protected]>
Based linux-sunxi#sunxi commit
d854c4de2f57"arm: Handle .gnu.hash section in ldscripts" vs v2014.01.As well as the following signed-off-by the sunxi branch shows commits to the
sunxi_i2c.cfile by:Stefan Roese<[email protected]>
Signed-off-by Henrik Nordstrom<[email protected]>Signed-off-by Oliver Schinagl<[email protected]>Signed-off-by Hans de Goede<[email protected]>--- arch/arm/cpu/armv7/sunxi/board.c | 6 + arch/arm/include/asm/arch-sunxi/i2c.h | 169 ++++++++++++++++++++++ drivers/i2c/Makefile | 1 + drivers/i2c/sunxi_i2c.c | 260 ++++++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 ++ 5 files changed, 444 insertions(+)create mode 100644
arch/arm/include/asm/arch-sunxi/i2c.hcreate mode 100644drivers/i2c/sunxi_i2c.c
[...]
drivers/i2c/Makefile obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o · line 18
Quoted 9 lines
drivers/i2c/Makefile +1
-0@@ -15,6 +15,7 @@ obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o obj-$(CONFIG_TSI108_I2C) += tsi108_i2c.o obj-$(CONFIG_U8500_I2C) += u8500_i2c.o obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o +obj-$(CONFIG_SUNXI_I2C) += sunxi_i2c.o
please use:
CONFIG_SYS_I2C_SUNXI
Quoted 15 lines
drivers/i2c/Makefile +0
-0obj-$(CONFIG_SYS_I2C) += i2c_core.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.odrivers/i2c/sunxi_i2c.c new file +6
-0@@ -0,0 +1,260 @@ +/* +* (C) Copyright 2012 Henrik Nordstrom<[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +
drivers/i2c/sunxi_i2c.c line 16
Quoted 10 lines
drivers/i2c/sunxi_i2c.c new file +10
-0+#include <common.h> +#include <i2c.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cpu.h> +#include <asm/arch/gpio.h> +#include <asm/arch/i2c.h> + +static struct i2c __attribute__ ((section (".data" ))) *i2c_base = + (struct i2c *)0x1c2ac00 ;
Please no magic numbers, use a define instead.
Quoted 1 line
drivers/i2c/sunxi_i2c.c new file +1
-0+void i2c_init (int speed,int slaveaddr)
[...]
drivers/i2c/sunxi_i2c.c line 260
Quoted 8 lines
drivers/i2c/sunxi_i2c.c new file +8
-0+int i2c_write (uchar chip,uint addr,int alen,uchar *buffer,int len) +{ +int rc =i2c_do_write (chip, addr, alen, buffer, len); + +i2c_stop (); + +return rc; +}
Please update to the new i2c multibus/multiadpater framework
Dummy question, there is another "twi" driver in drivers/i2c
bfin-twi_i2c.c
are they compatible?
include/configs/sunxi-common.h line 182
Quoted 12 lines
include/configs/sunxi-common.h +4
-0@@ -176,6 +176,14 @@#undef CONFIG_CMD_NET#undef CONFIG_CMD_NFS +/* I2C */ +#define CONFIG_SPL_I2C_SUPPORT +#define CONFIG_SYS_I2C_SPEED 400000 +#define CONFIG_HARD_I2C
NACK, please use no longer HARD_I2C, switch instead to CONFIG_SYS_I2C
include/configs/sunxi-common.h line 189
Quoted 7 lines
include/configs/sunxi-common.h +4
-0+#define CONFIG_SUNXI_I2C +#define CONFIG_SYS_I2C_SLAVE 0x7f +#define CONFIG_CMD_I2C +#ifndef CONFIG_CONS_INDEX #define CONFIG_CONS_INDEX 1/* UART0 */ #endif
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 7/12 sunxi: Add i2c support
Hi,
Quoted 39 lines · Heiko Schocher
Hello Hans,
Am 18.03.2014 00:00, schrieb Hans de Goede:
Quoted 23 lines
From: Henrik Nordstrom<[email protected]>
Based linux-sunxi#sunxi commit
d854c4de2f57"arm: Handle .gnu.hash section in ldscripts" vs v2014.01.As well as the following signed-off-by the sunxi branch shows commits to the
sunxi_i2c.cfile by:Stefan Roese<[email protected]>
Signed-off-by Henrik Nordstrom<[email protected]>Signed-off-by Oliver Schinagl<[email protected]>Signed-off-by Hans de Goede<[email protected]>--- arch/arm/cpu/armv7/sunxi/board.c | 6 + arch/arm/include/asm/arch-sunxi/i2c.h | 169 ++++++++++++++++++++++ drivers/i2c/Makefile | 1 + drivers/i2c/sunxi_i2c.c | 260 ++++++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 ++ 5 files changed, 444 insertions(+)create mode 100644
arch/arm/include/asm/arch-sunxi/i2c.hcreate mode 100644drivers/i2c/sunxi_i2c.c[...]
drivers/i2c/Makefile obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o · line 18
Quoted 9 lines
drivers/i2c/Makefile +1
-0@@ -15,6 +15,7 @@ obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o obj-$(CONFIG_TSI108_I2C) += tsi108_i2c.o obj-$(CONFIG_U8500_I2C) += u8500_i2c.o obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o +obj-$(CONFIG_SUNXI_I2C) += sunxi_i2c.oplease use:
Quoted 1 line
CONFIG_SYS_I2C_SUNXI
Ok.
Quoted 42 lines
Quoted 16 lines
drivers/i2c/Makefile +0
-0obj-$(CONFIG_SYS_I2C) += i2c_core.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.odrivers/i2c/sunxi_i2c.c new file +6
-0@@ -0,0 +1,260 @@ +/* +* (C) Copyright 2012 Henrik Nordstrom<[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +drivers/i2c/sunxi_i2c.c line 16
Quoted 10 lines
drivers/i2c/sunxi_i2c.c new file +10
-0+#include <common.h> +#include <i2c.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cpu.h> +#include <asm/arch/gpio.h> +#include <asm/arch/i2c.h> + +static struct i2c __attribute__ ((section (".data" ))) *i2c_base = + (struct i2c *)0x1c2ac00 ;Please no magic numbers, use a define instead.
Quoted 1 line
drivers/i2c/sunxi_i2c.c new file +1
-0+void i2c_init (int speed,int slaveaddr)[...]
drivers/i2c/sunxi_i2c.c line 260
Quoted 8 lines
drivers/i2c/sunxi_i2c.c new file +8
-0+int i2c_write (uchar chip,uint addr,int alen,uchar *buffer,int len) +{ +int rc =i2c_do_write (chip, addr, alen, buffer, len); + +i2c_stop (); + +return rc; +}Please update to the new i2c multibus/multiadpater framework
Quoted 5 lines
Dummy question, there is another "twi" driver in
drivers/i2c
bfin-twi_i2c.care they compatible?
No, but that is a good point, in the kernel we ended up using the i2c-mv64xxx driver as that is the same controller. I should have thought of doing the same for u-boot instead of just taking Allwinner's driver.
I've just completed writing a patch-set which uses the mvtwsi driver instead of introducing a new driver. While working on this I found 2 issues in the driver, for which I'll be sending patches shortly.
Regards,
Hans
PATCH 8/12 sunxi: Add axp209 pmic support
In reply to Hans de GoedeFrom: Henrik Nordstrom <[email protected]>
Based linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
As well as the following signed-off-by the sunxi branch shows commits to the axp209.c file by:
Stefan Roese <[email protected]>
--- board/sunxi/board.c | 26 ++++++ boards.cfg | 6 +- drivers/power/Makefile | 1 + drivers/power/axp209.c | 199 +++++++++++++++++++++++++++++++++++++++++ include/axp209.h | 15 ++++ include/configs/sunxi-common.h | 5 ++ 6 files changed, 249 insertions(+), 3 deletions(-) create mode 100644 drivers/power/axp209.c create mode 100644 include/axp209.h
board/sunxi/board.c +26 -0
@@ -12,6 +12,9 @@*/ #include <common.h> +#ifdef CONFIG_AXP209_POWER +#include <axp209.h> +#endif #include <asm/arch/clock.h> #include <asm/arch/dram.h> #include <asm/arch/mmc.h>
@@ -59,6 +62,7 @@ int board_mmc_init(bd_t *bis)#ifdef CONFIG_SPL_BUILD void sunxi_board_init (void ) { +int power_failed =0 ;unsigned long ramsize;printf ("DRAM:" );
@@ -66,5 +70,27 @@ void sunxi_board_init(void)printf (" %lu MiB\n" , ramsize >>20 );if (!ramsize)hang (); + +#ifdef CONFIG_AXP209_POWER + power_failed |=axp209_init (); + power_failed |=axp209_set_dcdc2 (1400 ); + power_failed |=axp209_set_dcdc3 (1250 ); + power_failed |=axp209_set_ldo2 (3000 ); + power_failed |=axp209_set_ldo3 (2800 ); + power_failed |=axp209_set_ldo4 (2800 ); +#endif + +/* +* Only clock up the CPU to full speed if we are reasonably +* assured it's being powered with suitable core voltage +*/ + if (!power_failed) +#ifdef CONFIG_SUN7I +clock_set_pll1 (912000000 ); +#else +clock_set_pll1 (1008000000 ); +#endif + else + printf("Failed to set core voltage! Can't set CPU frequency\n"); }#endif
boards.cfg +3 -3
@@ -353,10 +353,10 @@ Active arm armv7 rmobile renesas koelsch Active arm armv7 s5pc1xx samsung goni s5p_goni - Mateusz Zalega <[email protected]> Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - -Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,SPL - +Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,AXP209_POWER,SPL - Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,SPL - -Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,SPL - -Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL - +Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,AXP209_POWER,SPL - +Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,AXP209_POWER,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]> Active arm armv7 u8500 st-ericsson u8500 u8500_href - - Active arm armv7 vf610 freescale vf610twr vf610twr vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg Alison Wang <[email protected]>
drivers/power/Makefile +1 -0
@@ -5,6 +5,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_AXP209_POWER) += axp209.o obj-$(CONFIG_EXYNOS_TMU) += exynos-tmu.o obj-$(CONFIG_FTPMU010_POWER) += ftpmu010.o obj-$(CONFIG_TPS6586X_POWER) += tps6586x.o
drivers/power/axp209.c new file +199 -0
199 lines not on this page · raw message
include/axp209.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* (C) Copyright 2012 Henrik Nordstrom <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +extern int axp209_set_dcdc2 (int mvolt); +extern int axp209_set_dcdc3 (int mvolt); +extern int axp209_set_ldo2 (int mvolt); +extern int axp209_set_ldo3 (int mvolt); +extern int axp209_set_ldo4 (int mvolt); +extern void axp209_poweroff (void ); +extern int axp209_init (void ); +extern int axp209_poweron_by_dc (void ); +extern int axp209_power_button (void );
include/configs/sunxi-common.h +5 -0
@@ -184,6 +184,11 @@#define CONFIG_SYS_I2C_SLAVE 0x7f#define CONFIG_CMD_I2C +/* PMU */ +#if definedCONFIG_AXP152_POWER || definedCONFIG_AXP209_POWER +#define CONFIG_SPL_POWER_SUPPORT +#endif +#ifndef CONFIG_CONS_INDEX #define CONFIG_CONS_INDEX 1/* UART0 */ #endif
Signature · 1 line
1.9.0
PATCH 9/12 sunxi: Add axp152 pmic support
In reply to Hans de GoedeBased linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in ldscripts" vs v2014.01.
As well as the following signed-off-by the sunxi branch shows commits to the axp152.c file by:
Stefan Roese <[email protected]>
Simon "theRat"
--- board/sunxi/board.c | 10 ++++ boards.cfg | 2 +- drivers/power/Makefile | 1 + drivers/power/axp152.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ include/axp152.h | 11 +++++ 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 drivers/power/axp152.c create mode 100644 include/axp152.h
board/sunxi/board.c +10 -0
@@ -12,6 +12,9 @@*/ #include <common.h> +#ifdef CONFIG_AXP152_POWER +#include <axp152.h> +#endif #ifdef CONFIG_AXP209_POWER #include <axp209.h> #endif
@@ -71,6 +74,13 @@ void sunxi_board_init(void)if (!ramsize)hang (); +#ifdef CONFIG_AXP152_POWER + power_failed =axp152_init (); + power_failed |=axp152_set_dcdc2 (1400 ); + power_failed |=axp152_set_dcdc3 (1500 ); + power_failed |=axp152_set_dcdc4 (1250 ); + power_failed |=axp152_set_ldo2 (3000 ); +#endif #ifdef CONFIG_AXP209_POWER power_failed |=axp209_init (); power_failed |=axp209_set_dcdc2 (1400 );
boards.cfg +1 -1
@@ -354,7 +354,7 @@ Active arm armv7 s5pc1xx samsung goni Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,AXP209_POWER,SPL - -Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,SPL - +Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,AXP152_POWER,SPL - Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,AXP209_POWER,SPL - Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,AXP209_POWER,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]>
drivers/power/Makefile +1 -0
@@ -5,6 +5,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_AXP152_POWER) += axp152.o obj-$(CONFIG_AXP209_POWER) += axp209.o obj-$(CONFIG_EXYNOS_TMU) += exynos-tmu.o obj-$(CONFIG_FTPMU010_POWER) += ftpmu010.o
drivers/power/axp152.c new file +122 -0
122 lines not on this page · raw message
include/axp152.h new file +11 -0
@@ -0,0 +1,11 @@ +/* +* (C) Copyright 2012 Henrik Nordstrom <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +int axp152_set_dcdc2 (int mvolt); +int axp152_set_dcdc3 (int mvolt); +int axp152_set_dcdc4 (int mvolt); +int axp152_set_ldo2 (int mvolt); +void axp152_poweroff (void ); +int axp152_init (void );
Signature · 1 line
1.9.0
PATCH 10/12 sunxi: fast MBUS support on sun7i
In reply to Hans de GoedeFrom: Emilio L?pez <[email protected]>
For qualifying hardware, we can run MBUS at 400MHz without risking stability if we raise the DCDC3 voltage to 1.3V .
This is desirable since on A20 the MBUS is a significant bottle-neck for some workloads.
This has been tested on 50 pieces of Cubieboard2 by Cubietech and no issues of any kind were reported.
--- arch/arm/cpu/armv7/sunxi/dram.c | 6 +++++- board/sunxi/board.c | 4 ++++ boards.cfg | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/sunxi/dram.c +5 -1
@@ -217,7 +217,11 @@ static void mctl_setup_dram_clock(u32 clk)/* setup MBUS clock */ reg_val = CCM_MBUS_CTRL_GATE | -#if defined(CONFIG_SUN7I ) +#if defined(CONFIG_SUN7I ) && defined(CONFIG_FAST_MBUS ) +CCM_MBUS_CTRL_CLK_SRC (CCM_MBUS_CTRL_CLK_SRC_PLL6 ) | +CCM_MBUS_CTRL_N (CCM_MBUS_CTRL_N_X (1 )) | +CCM_MBUS_CTRL_M (CCM_MBUS_CTRL_M_X (3 )); +#elif defined(CONFIG_SUN7I ) && !defined(CONFIG_FAST_MBUS )CCM_MBUS_CTRL_CLK_SRC (CCM_MBUS_CTRL_CLK_SRC_PLL6 ) |CCM_MBUS_CTRL_N (CCM_MBUS_CTRL_N_X (2 )) |CCM_MBUS_CTRL_M (CCM_MBUS_CTRL_M_X (2 ));
board/sunxi/board.c +4 -0
@@ -84,7 +84,11 @@ void sunxi_board_init(void)#ifdef CONFIG_AXP209_POWER power_failed |=axp209_init (); power_failed |=axp209_set_dcdc2 (1400 ); +#ifdef CONFIG_FAST_MBUS + power_failed |=axp209_set_dcdc3 (1300 ); +#else power_failed |=axp209_set_dcdc3 (1250 ); +#endif power_failed |=axp209_set_ldo2 (3000 ); power_failed |=axp209_set_ldo3 (2800 ); power_failed |=axp209_set_ldo4 (2800 );
boards.cfg +2 -2
@@ -355,8 +355,8 @@ Active arm armv7 s5pc1xx samsung smdkc100 Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,AXP209_POWER,SPL - Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,AXP152_POWER,SPL - -Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,AXP209_POWER,SPL - -Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,AXP209_POWER,SPL_FEL - +Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL - +Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]> Active arm armv7 u8500 st-ericsson u8500 u8500_href - - Active arm armv7 vf610 freescale vf610twr vf610twr vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg Alison Wang <[email protected]>
Signature · 1 line
1.9.0
PATCH 11/12 net: Rename and cleanup sunxi (Allwinner) emac driver
In reply to Hans de GoedeFrom: Stefan Roese <[email protected]>
There have been 3 versions of the sunxi_emac support patch during its development. Somehow version 2 ended up in upstream u-boot where as the u-boot-sunxi git repo got version 3.
This bumps the version in upstream u-boot to version 3 of the patch:
- Initialize MII clock earlier so mii access to allow independent use
- Name change from WEMAC to EMAC to match mainline kernel & chip manual
- Cosmetic code cleanup
--- drivers/net/Makefile | 2 +- drivers/net/sunxi_emac.c | 521 +++++++++++++++++++++++++++++++++++++++++++++ drivers/net/sunxi_wemac.c | 525 ---------------------------------------------- include/netdev.h | 2 +- 4 files changed, 523 insertions(+), 527 deletions(-) create mode 100644 drivers/net/sunxi_emac.c delete mode 100644 drivers/net/sunxi_wemac.c
drivers/net/Makefile +1 -1
@@ -50,7 +50,7 @@ obj-$(CONFIG_RTL8169) += rtl8169.o obj-$(CONFIG_SH_ETHER) += sh_eth.o obj-$(CONFIG_SMC91111) += smc91111.o obj-$(CONFIG_SMC911X) += smc911x.o -obj-$(CONFIG_SUNXI_WEMAC) += sunxi_wemac.o +obj-$(CONFIG_SUNXI_EMAC) += sunxi_emac.o obj-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o obj-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
drivers/net/sunxi_emac.c new file +521 -0
521 lines not on this page · raw message
drivers/net/sunxi_wemac.c deleted +0 -525
525 lines not on this page · raw message
include/netdev.h +1 -1
@@ -79,7 +79,7 @@ int sh_eth_initialize(bd_t *bis);int skge_initialize (bd_t *bis);int smc91111_initialize (u8 dev_num,int base_addr);int smc911x_initialize (u8 dev_num,int base_addr); -int sunxi_wemac_initialize (bd_t *bis); +int sunxi_emac_initialize (bd_t *bis);int tsi108_eth_initialize (bd_t *bis);int uec_standard_init (bd_t *bis);int uli526x_initialize (bd_t *bis);
Signature · 1 line
1.9.0
PATCH 12/12 sunxi: enable emac for sun4i and sun5i
In reply to Hans de Goede--- arch/arm/cpu/armv7/sunxi/board.c | 17 +++++++++++++++++ boards.cfg | 4 ++-- include/configs/sunxi-common.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/sunxi/board.c +17 -0
@@ -12,6 +12,8 @@#include <common.h> #include <i2c.h> +#include <netdev.h> +#include <miiphy.h> #include <serial.h> #ifdef CONFIG_SPL_BUILD #include <spl.h>
@@ -111,3 +113,18 @@ void enable_caches(void) dcache_enable(); }#endif + +#if defined(CONFIG_SUNXI_EMAC ) || defined(CONFIG_SUNXI_GMAC ) +/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +int cpu_eth_init (bd_t *bis) +{ +#ifdef CONFIG_SUNXI_EMAC +sunxi_emac_initialize (bis); +#endif + +return 0 ; +} +#endif
boards.cfg +2 -2
@@ -353,8 +353,8 @@ Active arm armv7 rmobile renesas koelsch Active arm armv7 s5pc1xx samsung goni s5p_goni - Mateusz Zalega <[email protected]> Active arm armv7 s5pc1xx samsung smdkc100 smdkc100 - Minkyu Kang <[email protected]> Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - -Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,AXP209_POWER,SPL - -Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,AXP152_POWER,SPL - +Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,AXP209_POWER,SUNXI_EMAC,SPL - +Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,AXP152_POWER,SUNXI_EMAC,SPL - Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL - Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]>
include/configs/sunxi-common.h +32 -0
@@ -193,6 +193,38 @@#define CONFIG_CONS_INDEX 1/* UART0 */ #endif +/* Ethernet support */ +#ifdef CONFIG_SUNXI_EMAC +#define CONFIG_MII /* MII PHY management */ +#define CONFIG_CMD_MII +#define CONFIG_CMD_NET +#endif + +#ifdef CONFIG_CMD_NET +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_NFS +#define CONFIG_CMD_SNTP +#define CONFIG_TIMESTAMP /* Needed by SNTP */ +#define CONFIG_CMD_DNS +#define CONFIG_NETCONSOLE +#define CONFIG_BOOTP_SUBNETMASK +#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_HOSTNAME +#define CONFIG_BOOTP_NISDOMAIN +#define CONFIG_BOOTP_BOOTPATH +#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_DNS +#define CONFIG_BOOTP_DNS2 +#define CONFIG_BOOTP_SEND_HOSTNAME +#define CONFIG_BOOTP_NTPSERVER +#define CONFIG_BOOTP_TIMEOFFSET +#define CONFIG_BOOTP_MAY_FAIL +#define CONFIG_BOOTP_SERVERIP +#define CONFIG_BOOTP_DHCP_REQUEST_DELAY 50000 +#define CONFIG_CMD_ELF +#endif + #if !defined CONFIG_ENV_IS_IN_MMC && \ !defined CONFIG_ENV_IS_IN_NAND && \ !defined CONFIG_ENV_IS_IN_FAT && \
Signature · 1 line
1.9.0
cover sun4i (v2) + sun5i + pmic + emac support
In reply to Hans de GoedeQuoted 2 lines · Hans de Goede
There are 3 FIXUP patches in here which are intended to be squashed into Ian's work. Ian, can you please pick these up ?
Consensus seems to be that including these "useless" ifdefs in the initial sun7i series makes future series to add other sun?i, so sure.
I'm hoping to rebase to current sunxi+the cleanups I just sent out towards the end of the week and send out a v2 based on that, hopefully we can do the merge up to v2014.04-rc2 in time for a v3.
I've got a small amount of WIP mmc cleanup going on, but that's looking like the biggest issue so far. I'm doing OK at removing magic numbers using existing comments and the Linux driver etc but some of the timing loops I'm not all that confident in changing -- so at least that bit will likely miss v2.
Ian.
PATCH 1/1 sun5i: Add A13-OLinuXinoM support
In reply to Hans de Goede--- board/sunxi/Makefile | 1 + board/sunxi/dram_a13_oli_micro.c | 32 ++++++++++++++++++++++++++++++++ boards.cfg | 1 + 3 files changed, 34 insertions(+) create mode 100644 board/sunxi/dram_a13_oli_micro.c
board/sunxi/Makefile +1 -0
@@ -11,4 +11,5 @@ obj-y += board.o obj-$(CONFIG_A10_OLINUXINO_L) += dram_a10_olinuxino_l.o obj-$(CONFIG_A10S_OLINUXINO_M) += dram_a10s_olinuxino_m.o +obj-$(CONFIG_A13_OLINUXINOM) += dram_a13_oli_micro.o obj-$(CONFIG_CUBIETRUCK) += dram_cubietruck.o
board/sunxi/dram_a13_oli_micro.c new file +32 -0
@@ -0,0 +1,32 @@ +/* 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); +}
boards.cfg +1 -0
@@ -355,6 +355,7 @@ Active arm armv7 s5pc1xx samsung smdkc100 Active arm armv7 socfpga altera socfpga socfpga_cyclone5 - - Active arm armv7 sunxi - sunxi A10-OLinuXino-Lime sun4i:A10_OLINUXINO_L,AXP209_POWER,SUNXI_EMAC,SPL - Active arm armv7 sunxi - sunxi A10s-OLinuXino-M sun5i:A10S_OLINUXINO_M,AXP152_POWER,SUNXI_EMAC,SPL - +Active arm armv7 sunxi - sunxi A13-OLinuXinoM sun5i:A13_OLINUXINOM,SPL,NO_AXP,STATUSLED=201,CONS_INDEX=2 - Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL - Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL_FEL - Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]>
Signature · 1 line
1.7.9.5
PATCH 1/1 sun5i: Add A13-OLinuXinoM support
Hi Tom,
Quoted 3 lines · Tom Rini
Tested-by Matt Porter <[email protected]>Signed-off-by Tom Rini <[email protected]>---
Where does this patch come from? The source tree it applies to is not that of mainline U-Boot. If this is actually an RFC that I should look into, (as the PW state says), then which repository does it apply to?
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 sun5i: Add A13-OLinuXinoM support
Hi,
Quoted 11 lines · Albert ARIBAUD
Hi Tom,
Quoted 3 lines · Tom Rini
Tested-by Matt Porter <[email protected]>Signed-off-by Tom Rini <[email protected]>---
Where does this patch come from? The source tree it applies to is not that of mainline U-Boot. If this is actually an RFC that I should look into, (as the PW state says), then which repository does it apply to?
This was posted by Tom as an add on patch to my:
"[PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support"
Series, which was a series on top of one of Ian's sun7i support series:
http://lists.denx.de/pipermail/u-boot/2014-March/175656.html
In the mean time (as you know) Ians' series has gone upstream and I've continued working on the series in question, with Ian reviewing it. Actually I've just send you a pull-req with the bits of this series which are ready to go upstream. Which includes support for the A13-OLinuXinoM as part of the
"sunxi: Add sun5i support" patch.
Regards,
Hans
PATCH 1/1 sun5i: Add A13-OLinuXinoM support
Hi Hans,
Quoted 21 lines · Hans de Goede
Hi,
Quoted 11 lines · Albert ARIBAUD
Hi Tom,
Quoted 3 lines · Tom Rini
Tested-by Matt Porter <[email protected]>Signed-off-by Tom Rini <[email protected]>---
Where does this patch come from? The source tree it applies to is not that of mainline U-Boot. If this is actually an RFC that I should look into, (as the PW state says), then which repository does it apply to?
This was posted by Tom as an add on patch to my:
"[PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support"Series, which was a series on top of one of Ian's sun7i support series:
Quoted 8 lines
http://lists.denx.de/pipermail/u-boot/2014-March/175656.html
In the mean time (as you know) Ians' series has gone upstream and I've continued working on the series in question, with Ian reviewing it. Actually I've just send you a pull-req with the bits of this series which are ready to go upstream. Which includes support for the A13-OLinuXinoM as part of the
"sunxi: Add sun5i support" patch.
Thanks. Unfortunately, I had lost track of the dependencies -- which is a live example of why patches with dependencies should mention them explicitly after their commit message (not in it, though, as once applied, the dependency info is not relevant any more), so that folks like me can reconstruct the information. :)
I'll process you patch series -- not "pull request", as I only pull from other (ARM-related only) U-Boot repos :) -- in a few days, then I'll handle Tom's patch.
Quoted 3 lines
Regards,
Hans
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 sun5i: Add A13-OLinuXinoM support
Hi,
Quoted 41 lines · Albert ARIBAUD
Hi Hans,
Quoted 21 lines · Hans de Goede
Hi,
Quoted 11 lines · Albert ARIBAUD
Hi Tom,
Quoted 3 lines · Tom Rini
Tested-by Matt Porter <[email protected]>Signed-off-by Tom Rini <[email protected]>---
Where does this patch come from? The source tree it applies to is not that of mainline U-Boot. If this is actually an RFC that I should look into, (as the PW state says), then which repository does it apply to?
This was posted by Tom as an add on patch to my:
"[PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support"Series, which was a series on top of one of Ian's sun7i support series:
Quoted 8 lines
http://lists.denx.de/pipermail/u-boot/2014-March/175656.html
In the mean time (as you know) Ians' series has gone upstream and I've continued working on the series in question, with Ian reviewing it. Actually I've just send you a pull-req with the bits of this series which are ready to go upstream. Which includes support for the A13-OLinuXinoM as part of the
"sunxi: Add sun5i support" patch.Thanks. Unfortunately, I had lost track of the dependencies -- which is a live example of why patches with dependencies should mention them explicitly after their commit message (not in it, though, as once applied, the dependency info is not relevant any more), so that folks like me can reconstruct the information. :)
Quoted 3 lines
I'll process you patch series -- not "pull request", as I only pull from other (ARM-related only) U-Boot repos :) -- in a few days, then I'll handle Tom's patch.
Adding support for the A13-OLinuXinoM has been integrated into my series, so you can drop Tom's patch.
Note I've a lot more allwinner boards (all olimex variants, various mele devices, various mk802 and mk805 variants), which I plan to add support for (these are already support in the u-boot-sunxi git repository), but I'm trying to upstream things in small batches. Let me know if you want me to speed things up and queue up more patches.
Regards,
Hans
PATCH 1/1 sun5i: Add A13-OLinuXinoM support
Hi Hans,
Quoted 44 lines · Hans de Goede
Hi,
Quoted 41 lines · Albert ARIBAUD
Hi Hans,
Quoted 21 lines · Hans de Goede
Hi,
Quoted 11 lines · Albert ARIBAUD
Hi Tom,
Quoted 3 lines · Tom Rini
Tested-by Matt Porter <[email protected]>Signed-off-by Tom Rini <[email protected]>---
Where does this patch come from? The source tree it applies to is not that of mainline U-Boot. If this is actually an RFC that I should look into, (as the PW state says), then which repository does it apply to?
This was posted by Tom as an add on patch to my:
"[PATCH u-boot sunxi 00/12] sun4i (v2) + sun5i + pmic + emac support"Series, which was a series on top of one of Ian's sun7i support series:
Quoted 8 lines
http://lists.denx.de/pipermail/u-boot/2014-March/175656.html
In the mean time (as you know) Ians' series has gone upstream and I've continued working on the series in question, with Ian reviewing it. Actually I've just send you a pull-req with the bits of this series which are ready to go upstream. Which includes support for the A13-OLinuXinoM as part of the
"sunxi: Add sun5i support" patch.Thanks. Unfortunately, I had lost track of the dependencies -- which is a live example of why patches with dependencies should mention them explicitly after their commit message (not in it, though, as once applied, the dependency info is not relevant any more), so that folks like me can reconstruct the information. :)
Quoted 6 lines
Quoted 3 lines
I'll process you patch series -- not "pull request", as I only pull from other (ARM-related only) U-Boot repos :) -- in a few days, then I'll handle Tom's patch.
Adding support for the A13-OLinuXinoM has been integrated into my series, so you can drop Tom's patch.
Ok.
Quoted 5 lines
Note I've a lot more allwinner boards (all olimex variants, various mele devices, various mk802 and mk805 variants), which I plan to add support for (these are already support in the u-boot-sunxi git repository), but I'm trying to upstream things in small batches. Let me know if you want me to speed things up and queue up more patches.
No need to speed things up right now as any new patch series posted at this time would only be considered for next merge window. Right now, I'd only take a new patch for 2014.07 if it was a bug fix, or maybe a really trivial *and* really useful addition.
Quoted 3 lines
Regards,
Hans
Amicalement,
Signature · 1 line
Albert.