sunxi: i2c and pmic support
Subsystems (4)
v2 cover sunxi: i2c and pmic support
Hi Albert, Heiko,
Here is v2 of my standalone i2c and pmic support for sunxi series.
I think it would be best for this series to go upstream through the u-boot-arm tree, since most changes are sunxi specific.
Note patch 5/5 is an unrelated sunxi bugfix for a bug I found while testing the i2c + pmic support.
Changes since v1:
-"mvtwsi: convert to CONFIG_SYS_I2C framework"
Use CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE when instantiating the controller with the U_BOOT_I2C_ADAP_COMPLETE macro
-Add Acked-by tags from Ian / Heiko / Prafulla to all patches
Regards,
Hans
PATCH v2 1/5 mvtwsi: convert to CONFIG_SYS_I2C framework
Note this has only been tested on Allwinner sunxi devices (support for which gets introduced by a later patch).
The kirkwood changes have been compile tested using the wireless_space board config, the orion5x changes have been compile tested using the edminiv2 board config.
--- arch/arm/include/asm/arch-kirkwood/config.h | 3 +- drivers/i2c/Makefile | 2 +- drivers/i2c/mvtwsi.c | 70 +++++++++++++---------------- include/configs/edminiv2.h | 3 +- 4 files changed, 37 insertions(+), 41 deletions(-)
arch/arm/include/asm/arch-kirkwood/config.h +2 -1
@@ -129,7 +129,8 @@*/ #ifdef CONFIG_CMD_I2C #ifndef CONFIG_SYS_I2C_SOFT -#define CONFIG_I2C_MVTWSI +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MVTWSI #endif #define CONFIG_SYS_I2C_SLAVE 0x0#define CONFIG_SYS_I2C_SPEED 100000
drivers/i2c/Makefile +1 -1
@@ -7,7 +7,6 @@ obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o obj-$(CONFIG_DW_I2C) += designware_i2c.o -obj-$(CONFIG_I2C_MVTWSI) += mvtwsi.o obj-$(CONFIG_I2C_MV) += mv_i2c.o obj-$(CONFIG_I2C_MXS) += mxs_i2c.o obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o
@@ -19,6 +18,7 @@ obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o +obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o obj-$(CONFIG_SYS_I2C_OMAP24XX) += omap24xx_i2c.o obj-$(CONFIG_SYS_I2C_OMAP34XX) += omap24xx_i2c.o
drivers/i2c/mvtwsi.c +32 -38
133 lines not on this page · raw message
include/configs/edminiv2.h +2 -1
@@ -187,7 +187,8 @@* I2C related stuff */ #ifdef CONFIG_CMD_I2C -#define CONFIG_I2C_MVTWSI +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MVTWSI #define CONFIG_I2C_MVTWSI_BASE ORION5X_TWSI_BASE#define CONFIG_SYS_I2C_SLAVE 0x0#define CONFIG_SYS_I2C_SPEED 100000
Signature · 1 line
2.0.0
PATCH v2 1/5 mvtwsi: convert to CONFIG_SYS_I2C framework
Hi Heiko,
Quoted 9 lines · Hans de Goede
Note this has only been tested on Allwinner sunxi devices (support for which gets introduced by a later patch).
The kirkwood changes have been compile tested using the
wireless_spaceboard config, the orion5x changes have been compile tested using the edminiv2 board config.Signed-off-by Hans de Goede <[email protected]>Acked-by Heiko Schocher <[email protected]>
Do you plan to take this via u-boot-i2c.git or would you like us to take it via the sunxi tree along with the rest of the series?
Cheers,
Ian.
PATCH v2 2/5 sunxi: Add i2c support
In reply to Hans de GoedeAdd support for the i2c controller found on all Allwinner sunxi SoCs, this is the same controller as found on the Marvell orion5x and kirkwood SoC families, with a slightly different register layout, so this patch uses the existing mvtwsi code.
--- arch/arm/cpu/armv7/sunxi/board.c | 6 ++++++ arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 5 +++++ arch/arm/include/asm/arch-sunxi/i2c.h | 15 +++++++++++++++ board/sunxi/board.c | 7 +++++++ drivers/i2c/mvtwsi.c | 18 ++++++++++++++++++ include/configs/sunxi-common.h | 8 ++++++++ 6 files changed, 59 insertions(+) create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
arch/arm/cpu/armv7/sunxi/board.c +6 -0
@@ -11,6 +11,7 @@*/ #include <common.h> +#include <i2c.h> #include <netdev.h> #include <miiphy.h> #include <serial.h>
@@ -91,11 +92,16 @@ void s_init(void)clock_init ();timer_init ();gpio_init (); +i2c_init_board ();#ifdef CONFIG_SPL_BUILD 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/cpu/armv7/sunxi/u-boot-spl.lds +5 -0
@@ -39,6 +39,11 @@ SECTIONS .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram . = ALIGN(4); + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } > .sram + + . = ALIGN(4); __image_copy_end = .; _end = .;
arch/arm/include/asm/arch-sunxi/i2c.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright 2014 - Hans de Goede <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef _SUNXI_I2C_H_ +#define _SUNXI_I2C_H_ + +#include <asm/arch/cpu.h> + +#define CONFIG_I2C_MVTWSI_BASE SUNXI_TWI0_BASE +/* This is abp0-clk on sun4i/5i/7i / abp1-clk on sun6i/sun8i which is 24MHz */ +#define CONFIG_SYS_TCLK 24000000 + +#endif
board/sunxi/board.c +7 -0
@@ -106,6 +106,13 @@ int board_mmc_init(bd_t *bis) }#endif +void i2c_init_board (void ) +{ +sunxi_gpio_set_cfgpin (SUNXI_GPB (0 ),SUNXI_GPB0_TWI0 ); +sunxi_gpio_set_cfgpin (SUNXI_GPB (1 ),SUNXI_GPB0_TWI0 ); +clock_twi_onoff (0 ,1 ); +} +#ifdef CONFIG_SPL_BUILD void sunxi_board_init (void ) {
drivers/i2c/mvtwsi.c +18 -0
@@ -22,6 +22,8 @@#include <asm/arch/orion5x.h> #elif defined(CONFIG_KIRKWOOD )#include <asm/arch/kirkwood.h> +#elif defined(CONFIG_SUNXI ) +#include <asm/arch/i2c.h> #else #error Driver mvtwsi not supported by SoC or board#endif
@@ -30,6 +32,20 @@* TWSI register structure */ +#ifdef CONFIG_SUNXI + +struct mvtwsi_registers { + u32 slave_address; + u32 xtnd_slave_addr; + u32 data; + u32 control; + u32 status; + u32 baudrate; + u32 soft_reset; +}; + +#else + struct mvtwsi_registers { u32 slave_address; u32 data;
@@ -43,6 +59,8 @@ struct mvtwsi_registers { u32 soft_reset; }; +#endif +/* * Control register fields */
include/configs/sunxi-common.h +8 -0
@@ -161,6 +161,14 @@#undef CONFIG_CMD_NET#undef CONFIG_CMD_NFS +/* I2C */ +#define CONFIG_SPL_I2C_SUPPORT +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MVTWSI +#define CONFIG_SYS_I2C_SPEED 400000 +#define CONFIG_SYS_I2C_SLAVE 0x7f +#define CONFIG_CMD_I2C +#ifndef CONFIG_CONS_INDEX #define CONFIG_CONS_INDEX 1/* UART0 */ #endif
Signature · 1 line
2.0.0
PATCH v2 3/5 sunxi: Add axp209 pmic support
In reply to Hans de GoedeFrom: Henrik Nordstrom <[email protected]>
Add support for the x-powers axp209 pmic which is found on most A10, A13 and A20 boards.
And enable AXP209 support for the Cubietruck and Cubieboard boards.
While changing the boards.cfg lines for the Cubietruck, add Ian and me as board maintainers for the Cubietruck.
--- board/sunxi/board.c | 22 ++++++ boards.cfg | 6 +- drivers/power/Makefile | 1 + drivers/power/axp209.c | 167 +++++++++++++++++++++++++++++++++++++++++ include/axp209.h | 14 ++++ include/configs/sun4i.h | 1 + include/configs/sun5i.h | 1 + include/configs/sun7i.h | 1 + include/configs/sunxi-common.h | 5 ++ 9 files changed, 215 insertions(+), 3 deletions(-) create mode 100644 drivers/power/axp209.c create mode 100644 include/axp209.h
board/sunxi/board.c +22 -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/gpio.h>
@@ -116,12 +119,31 @@ void i2c_init_board(void)#ifdef CONFIG_SPL_BUILD void sunxi_board_init (void ) { +int power_failed =0 ;unsigned long ramsize; +#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 +printf ("DRAM:" ); ramsize =sunxi_dram_init ();printf (" %lu MiB\n" , ramsize >>20 );if (!ramsize)hang (); + +/* +* Only clock up the CPU to full speed if we are reasonably +* assured it's being powered with suitable core voltage +*/ +if (!power_failed) +clock_set_pll1 (CONFIG_CLK_FULL_SPEED ); +else +printf ("Failed to set core voltage! Can't set CPU frequency\n" ); }#endif
boards.cfg +3 -3
@@ -375,9 +375,9 @@ 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 A13-OLinuXinoM sun5i:A13_OLINUXINOM,SPL,CONS_INDEX=2 Hans de Goede <[email protected]> -Active arm armv7 sunxi - sunxi Cubieboard sun4i:CUBIEBOARD,SPL,SUNXI_EMAC Hans de Goede <[email protected]> -Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,SPL,SUNXI_GMAC,RGMII Ian Campbell <[email protected]>:Hans de Goede <[email protected]> -Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL,SUNXI_GMAC,RGMII Ian Campbell <[email protected]>:Hans de Goede <[email protected]> +Active arm armv7 sunxi - sunxi Cubieboard sun4i:CUBIEBOARD,SPL,AXP209_POWER,SUNXI_EMAC Hans de Goede <[email protected]> +Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,SPL,AXP209_POWER,SUNXI_GMAC,RGMII Ian Campbell <[email protected]>:Hans de Goede <[email protected]> +Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL,AXP209_POWER,SUNXI_GMAC,RGMII Ian Campbell <[email protected]>:Hans de Goede <[email protected]> Active arm armv7 sunxi - sunxi r7-tv-dongle sun5i:R7DONGLE,SPL Hans de Goede <[email protected]> Active arm armv7 u8500 st-ericsson snowball snowball - Mathieu Poirier <[email protected]> Active arm armv7 u8500 st-ericsson u8500 u8500_href - -
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 +167 -0
167 lines not on this page · raw message
include/axp209.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* (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 int axp209_init (void ); +extern int axp209_poweron_by_dc (void ); +extern int axp209_power_button (void );
include/configs/sun4i.h +1 -0
@@ -12,6 +12,7 @@* A10 specific configuration */ #define CONFIG_SUN4I /* sun4i SoC generation */ +#define CONFIG_CLK_FULL_SPEED 1008000000#define CONFIG_SYS_PROMPT "sun4i# "
include/configs/sun5i.h +1 -0
@@ -12,6 +12,7 @@* High Level Configuration Options */ #define CONFIG_SUN5I /* sun5i SoC generation */ +#define CONFIG_CLK_FULL_SPEED 1008000000#define CONFIG_SYS_PROMPT "sun5i# "
include/configs/sun7i.h +1 -0
@@ -13,6 +13,7 @@* A20 specific configuration */ #define CONFIG_SUN7I /* sun7i SoC generation */ +#define CONFIG_CLK_FULL_SPEED 912000000#define CONFIG_SYS_PROMPT "sun7i# "
include/configs/sunxi-common.h +5 -0
@@ -169,6 +169,11 @@#define CONFIG_SYS_I2C_SLAVE 0x7f#define CONFIG_CMD_I2C +/* PMU */ +#if definedCONFIG_AXP152_POWER || definedCONFIG_AXP209_POWER || definedCONFIG_AXP221_POWER +#define CONFIG_SPL_POWER_SUPPORT +#endif +#ifndef CONFIG_CONS_INDEX #define CONFIG_CONS_INDEX 1/* UART0 */ #endif
Signature · 1 line
2.0.0
PATCH v2 3/5 sunxi: Add axp209 pmic support
Quoted 6 lines · Hans de Goede
From: Henrik Nordstrom <[email protected]>
Add support for the x-powers axp209 pmic which is found on most A10, A13 and A20 boards.
And enable AXP209 support for the Cubietruck and Cubieboard boards.
Something about this breaks booting on my Cubietruck in FEL mode. I get:
U-Boot SPL 2014.07-rc4-00122-g624959a (Jul 16 2014 - 22:34:59) Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible
And then nothing.
Non-FEL mode is unaffected.
I've pushed my wip branch to:
git://gitorious.org/ijc/u-boot.git wip/sunxi-20140716
I was hoping to merge something like this set of patches upstream shortly.
Quoted 2 lines
While changing the boards.cfg lines for the Cubietruck, add Ian and me as board maintainers for the Cubietruck.
You actually factored that bit out in v2...
Ian.
PATCH v2 3/5 sunxi: Add axp209 pmic support
Hi,
Quoted 8 lines · Ian Campbell
Quoted 6 lines · Hans de Goede
From: Henrik Nordstrom <[email protected]>
Add support for the x-powers axp209 pmic which is found on most A10, A13 and A20 boards.
And enable AXP209 support for the Cubietruck and Cubieboard boards.
Quoted 7 lines
Something about this breaks booting on my Cubietruck in FEL mode. I get:
U-Boot SPL 2014.07-rc4-00122-g624959a (Jul 16 2014 - 22:34:59) Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possibleAnd then nothing.
If you look at the patch adding support for the i2c controller I needed to make some changes to the link script, I probably forgot to make the same changes to the fel link script...
Quoted 6 lines
Non-FEL mode is unaffected.
I've pushed my wip branch to:
git://gitorious.org/ijc/u-boot.git wip/sunxi-20140716
Quoted 7 lines
I was hoping to merge something like this set of patches upstream shortly.
Quoted 2 lines
While changing the boards.cfg lines for the Cubietruck, add Ian and me as board maintainers for the Cubietruck.
You actually factored that bit out in v2...
True, feel free to amend the commit msg, or let me know if you want a v3.
And thanks for looking into merging this into sunxi -next. I was planning to drop you a mail about coordinating getting this added vs getting your ahci patches added. I assume you ahci patches are good to go too, or ... ?
Next I want to start adding support for more boards. For starters I would like to add all boards which also have a dts file in the upstream kernel. Ideally I would start working on that once you're done with adding this series + your ahci patches so that we don't get in each others way. Can you send me a mail when you're done (for a while at least) then I'll try to get a set of patches for this to the list based on top of your latest work.
Except for sun4i-a10-hackberry.dts and sun4i-a10-inet97fv2.dts I've hardware to test on for all sun4i, sun5i and sun7i models which have a dts file, not sure what to do with the 2 I cannot test.
Regards,
Hans
PATCH v2 3/5 sunxi: Add axp209 pmic support
Quoted 17 lines · Hans de Goede
Hi,
Quoted 14 lines · Ian Campbell
Quoted 6 lines · Hans de Goede
From: Henrik Nordstrom <[email protected]>
Add support for the x-powers axp209 pmic which is found on most A10, A13 and A20 boards.
And enable AXP209 support for the Cubietruck and Cubieboard boards.
Something about this breaks booting on my Cubietruck in FEL mode. I get:
U-Boot SPL 2014.07-rc4-00122-g624959a (Jul 16 2014 - 22:34:59) Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible
Quoted 5 lines
Quoted 1 line
And then nothing.
If you look at the patch adding support for the i2c controller I needed to make some changes to the link script, I probably forgot to make the same changes to the fel link script...
That was indeed it. With your ACK I'd like to fold in this change:
- - a/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
+ + b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
@@ -27,6 +27,11 @@ SECTIONS
}
. = ALIGN(4);
+ .u_boot_list : {
+ KEEP(*(SORT(.u_boot_list*)));
+ }
+
+ . = ALIGN(4);
. = .;
. = ALIGN(4);
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
While changing the boards.cfg lines for the Cubietruck, add Ian and me as board maintainers for the Cubietruck.
You actually factored that bit out in v2...
True, feel free to amend the commit msg, or let me know if you want a v3.
I'll amend while I'm there.
Quoted 3 lines
And thanks for looking into merging this into sunxi -next. I was planning to drop you a mail about coordinating getting this added vs getting your ahci patches added. I assume you ahci patches are good to go too, or ... ?
I've picked up the non-AHCI bits of that series now but not the common bits which I'm assuming Albert will pick up when he gets back, the actual driver then depends on those. So I've picked up and intend to include in the first PR:
[U-Boot,3/6] sunxi: add Cubieboard2 support
[U-Boot,4/6] sunxi: add gpio driver
[U-Boot,5/6] sunxi: use setbits_le32 to enable the DMA clock
These I am expecting to come via Albert (or for him to ask me to merge):
[U-Boot,1/6] AHCI: Increase link timeout to 200ms [U-Boot,2/6] board_r: run scsi init() on ARM too
and then the last one
[U-Boot,6/6] ahci: provide sunxi SATA driver using AHCI platform framework either Albert can pick up or it can come in a subsequent PR.
Other than those there are Roman's USB patch which are still under review.
Quoted 6 lines
Next I want to start adding support for more boards. For starters I would like to add all boards which also have a dts file in the upstream kernel. Ideally I would start working on that once you're done with adding this series + your ahci patches so that we don't get in each others way. Can you send me a mail when you're done (for a while at least) then I'll try to get a set of patches for this to the list based on top of your latest work.
Sure, I'll drop you a line.
Quoted 3 lines
Except for
sun4i-a10-hackberry.dtsandsun4i-a10-inet97fv2.dtsI've hardware to test on for all sun4i, sun5i and sun7i models which have a dts file, not sure what to do with the 2 I cannot test.
Either leave them out or approach the person who wrote the dts (who presumably has one, or isthat asking too much) to test?
Ian
PATCH v2 3/5 sunxi: Add axp209 pmic support
Hi,
Quoted 31 lines · Ian Campbell
Quoted 17 lines · Hans de Goede
Hi,
Quoted 14 lines · Ian Campbell
Quoted 6 lines · Hans de Goede
From: Henrik Nordstrom <[email protected]>
Add support for the x-powers axp209 pmic which is found on most A10, A13 and A20 boards.
And enable AXP209 support for the Cubietruck and Cubieboard boards.
Something about this breaks booting on my Cubietruck in FEL mode. I get:
U-Boot SPL 2014.07-rc4-00122-g624959a (Jul 16 2014 - 22:34:59) Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possibleQuoted 5 lines
Quoted 1 line
And then nothing.
If you look at the patch adding support for the i2c controller I needed to make some changes to the link script, I probably forgot to make the same changes to the fel link script...
That was indeed it. With your ACK I'd like to fold in this change:
- -
a/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
+ +b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds(quoted diff) +0
-0@@ -27,6 +27,11 @@ SECTIONS }
Review SECTIONS · line 37
Quoted 10 lines
(quoted diff) +5
-0. = ALIGN(4); + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } + + . = ALIGN(4); . = .; . = ALIGN(4);
Looks good, ACK.
Quoted 21 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
While changing the boards.cfg lines for the Cubietruck, add Ian and me as board maintainers for the Cubietruck.
You actually factored that bit out in v2...
True, feel free to amend the commit msg, or let me know if you want a v3.
I'll amend while I'm there.
Quoted 3 lines
And thanks for looking into merging this into sunxi -next. I was planning to drop you a mail about coordinating getting this added vs getting your ahci patches added. I assume you ahci patches are good to go too, or ... ?
I've picked up the non-AHCI bits of that series now but not the common bits which I'm assuming Albert will pick up when he gets back, the actual driver then depends on those. So I've picked up and intend to include in the first PR:
[U-Boot,3/6] sunxi: add Cubieboard2 support
[U-Boot,4/6] sunxi: add gpio driver
[U-Boot,5/6] sunxi: usesetbits_le32to enable the DMA clock
Quoted 7 lines
These I am expecting to come via Albert (or for him to ask me to merge):
[U-Boot,1/6] AHCI: Increase link timeout to 200ms [U-Boot,2/6]board_r: run scsiinit()on ARM tooand then the last one
[U-Boot,6/6] ahci: provide sunxi SATA driver using AHCI platform framework either Albert can pick up or it can come in a subsequent PR.
Ok.
Quoted 10 lines
Other than those there are Roman's USB patch which are still under review.
Quoted 6 lines
Next I want to start adding support for more boards. For starters I would like to add all boards which also have a dts file in the upstream kernel. Ideally I would start working on that once you're done with adding this series + your ahci patches so that we don't get in each others way. Can you send me a mail when you're done (for a while at least) then I'll try to get a set of patches for this to the list based on top of your latest work.
Quoted 8 lines
Sure, I'll drop you a line.
Quoted 3 lines
Except for
sun4i-a10-hackberry.dtsandsun4i-a10-inet97fv2.dtsI've hardware to test on for all sun4i, sun5i and sun7i models which have a dts file, not sure what to do with the 2 I cannot test.Either leave them out or approach the person who wrote the dts (who presumably has one, or isthat asking too much) to test?
I can ask some people to test yes, but what do we then put in the MAINTAINER column of boards.cfg ? I think it would be best to ask people to step us as board maintainer for these, instead of just test. Do you agree ?
Regards,
Hans
PATCH v2 3/5 sunxi: Add axp209 pmic support
Quoted 1 line · Hans de Goede
Looks good, ACK.
Thanks, will prep the PR ASAP.
Quoted 6 lines
Quoted 2 lines
Either leave them out or approach the person who wrote the dts (who presumably has one, or isthat asking too much) to test?
I can ask some people to test yes, but what do we then put in the MAINTAINER column of boards.cfg ? I think it would be best to ask people to step us as board maintainer for these, instead of just test. Do you agree ?
That seem reasonable to me.
Ian.
PATCH v2 3/5 sunxi: Add axp209 pmic support
In reply to Hans de GoedeQuoted 13 lines · On Fri, 13 Jun 2014 22:55:50 +0200 Hans de Goede <[email protected]> wrote:
From: Henrik Nordstrom <[email protected]>
Add support for the x-powers axp209 pmic which is found on most A10, A13 and A20 boards.
And enable AXP209 support for the Cubietruck and Cubieboard boards.
While changing the boards.cfg lines for the Cubietruck, add Ian and me as board maintainers for the Cubietruck.
Signed-off-by Henrik Nordstrom <[email protected]>Signed-off-by Hans de Goede <[email protected]>Acked-by Ian Campbell <[email protected]>
Quoted 13 lines
--- board/sunxi/board.c | 22 ++++++ boards.cfg | 6 +- drivers/power/Makefile | 1 + drivers/power/axp209.c | 167 +++++++++++++++++++++++++++++++++++++++++ include/axp209.h | 14 ++++ include/configs/sun4i.h | 1 + include/configs/sun5i.h | 1 + include/configs/sun7i.h | 1 + include/configs/sunxi-common.h | 5 ++ 9 files changed, 215 insertions(+), 3 deletions(-) create mode 100644 drivers/power/axp209.c create mode 100644 include/axp209.h
The support for AXP209 is needed to provide sufficient dcdc3 voltage at least for the DRAM controller. The default voltage after reset (1.2V on the Cubietruck) is too low for operating the DRAM controller at reasonably high clock speeds. In this sense, the initial Cubietruck support in u-boot v2014.07 is already buggy, because of the missing PMIC configuration code. And this explanation in the commit message would be very nice to have (otherwise one may wonder, why do we even need the PMIC code in u-boot in the first place?).
The addition of the AXP PMIC support should be perhaps moved to the beginning of the patch series instead of fixing the voltage problems after the fact.
And again, this patch is currently rather cherry-picking unfriendly. So even if I wanted to reorder the patches to trivially address the problem, the interdependencies via the dreaded 'boards.cfg' get in the way.
Signature · 2 lines
Best regards, Siarhei Siamashka
PATCH v2 4/5 sunxi: Add axp152 pmic support
In reply to Hans de GoedeAdd support for the x-powers axp152 pmic which is found on most A10s boards and enable it for the r7-tv-dongle board.
--- board/sunxi/board.c | 10 ++++++ boards.cfg | 2 +- drivers/power/Makefile | 1 + drivers/power/axp152.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/axp152.h | 10 ++++++ 5 files changed, 119 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
@@ -122,6 +125,13 @@ void sunxi_board_init(void)int power_failed =0 ;unsigned long ramsize; +#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
@@ -378,7 +378,7 @@ Active arm armv7 sunxi - sunxi Active arm armv7 sunxi - sunxi Cubieboard sun4i:CUBIEBOARD,SPL,AXP209_POWER,SUNXI_EMAC Hans de Goede <[email protected]> Active arm armv7 sunxi - sunxi Cubietruck sun7i:CUBIETRUCK,SPL,AXP209_POWER,SUNXI_GMAC,RGMII Ian Campbell <[email protected]>:Hans de Goede <[email protected]> Active arm armv7 sunxi - sunxi Cubietruck_FEL sun7i:CUBIETRUCK,SPL_FEL,AXP209_POWER,SUNXI_GMAC,RGMII Ian Campbell <[email protected]>:Hans de Goede <[email protected]> -Active arm armv7 sunxi - sunxi r7-tv-dongle sun5i:R7DONGLE,SPL Hans de Goede <[email protected]> +Active arm armv7 sunxi - sunxi r7-tv-dongle sun5i:R7DONGLE,SPL,AXP152_POWER Hans de Goede <[email protected]> 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_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 +97 -0
97 lines not on this page · raw message
include/axp152.h new file +10 -0
@@ -0,0 +1,10 @@ +/* +* (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); +int axp152_init (void );
Signature · 1 line
2.0.0
PATCH v2 5/5 sunxi: Fix reset hang on sun5i
In reply to Hans de GoedeDo the same as the Linux kernel does, this fixes the SoC hanging on reset about 50% of the time.
--- arch/arm/cpu/armv7/sunxi/board.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/board.c +5 -1
@@ -75,7 +75,11 @@ void reset_cpu(ulong addr)/* Set the watchdog for its shortest interval (.5s) and wait */ writel (WDT_MODE_RESET_EN |WDT_MODE_EN , &wdog->mode);writel (WDT_CTRL_KEY |WDT_CTRL_RESTART , &wdog->ctl); -while (1 ); + +while (1 ) { +/* sun5i sometimes gets stuck without this */ +writel (WDT_MODE_RESET_EN |WDT_MODE_EN , &wdog->mode); + } }/* do some early init */
Signature · 1 line
2.0.0
PATCH v2 5/5 sunxi: Fix reset hang on sun5i
Quoted 16 lines · On Fri, 13 Jun 2014 22:55:52 +0200 Hans de Goede <[email protected]> wrote:
Do the same as the Linux kernel does, this fixes the SoC hanging on reset about 50% of the time.
Signed-off-by Hans de Goede <[email protected]>Acked-by Ian Campbell <[email protected]>--- arch/arm/cpu/armv7/sunxi/board.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)arch/arm/cpu/armv7/sunxi/board.c +0
-0@@ -75,7 +75,11 @@ void reset_cpu(ulong addr)/* Set the watchdog for its shortest interval (.5s) and wait */ writel (WDT_MODE_RESET_EN |WDT_MODE_EN , &wdog->mode);
arch/arm/cpu/armv7/sunxi/board.c void reset_cpu(ulong addr) · line 85
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/board.c +5
-1writel (WDT_CTRL_KEY |WDT_CTRL_RESTART , &wdog->ctl); -while (1 ); + +while (1 ) { +/* sun5i sometimes gets stuck without this */ +writel (WDT_MODE_RESET_EN |WDT_MODE_EN , &wdog->mode); + } }/* do some early init */
This should be perhaps combined with
http://patchwork.ozlabs.org/patch/357363/ (probably the best place)
or
http://patchwork.ozlabs.org/patch/357365/ (ugh, too much code there)
in order to have bug free code after every commit instead of fixing the problem after the fact.
Signature · 2 lines
Best regards, Siarhei Siamashka