All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER
@ 2015-10-03 14:26 Hans de Goede
  2015-10-03 14:26 ` [U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig Hans de Goede
                   ` (6 more replies)
  0 siblings, 7 replies; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 14:26 UTC (permalink / raw)
  To: u-boot

Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER settings, removing
them from CONFIG_SYS_EXTRA_OPTIONS.

Note that sun5i boards can have either an AXP209 or an AXP152 pmic, so
there is no default for these in Kconfig, and the board-defconfig must
always select one (except on the rare pmic-less board).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 configs/A10-OLinuXino-Lime_defconfig       |  2 +-
 configs/A10s-OLinuXino-M_defconfig         |  3 ++-
 configs/A13-OLinuXino_defconfig            |  3 ++-
 configs/A20-OLinuXino-Lime2_defconfig      |  2 +-
 configs/A20-OLinuXino-Lime_defconfig       |  2 +-
 configs/A20-OLinuXino_MICRO_defconfig      |  2 +-
 configs/A20-Olimex-SOM-EVB_defconfig       |  2 +-
 configs/Ainol_AW1_defconfig                |  1 -
 configs/Ampe_A76_defconfig                 |  3 ++-
 configs/Auxtek-T003_defconfig              |  2 +-
 configs/Auxtek-T004_defconfig              |  2 +-
 configs/Bananapi_defconfig                 |  2 +-
 configs/Bananapro_defconfig                |  2 +-
 configs/Chuwi_V7_CW0825_defconfig          |  1 -
 configs/Cubieboard2_defconfig              |  2 +-
 configs/Cubieboard_defconfig               |  2 +-
 configs/Cubietruck_defconfig               |  2 +-
 configs/Hyundai_A7HD_defconfig             |  1 -
 configs/Linksprite_pcDuino3_Nano_defconfig |  2 +-
 configs/Linksprite_pcDuino3_defconfig      |  2 +-
 configs/Linksprite_pcDuino_defconfig       |  2 +-
 configs/MK808C_defconfig                   |  1 -
 configs/MSI_Primo73_defconfig              |  1 -
 configs/Mele_A1000_defconfig               |  2 +-
 configs/Mele_M3_defconfig                  |  2 +-
 configs/Mini-X_defconfig                   |  1 -
 configs/Orangepi_defconfig                 |  2 +-
 configs/Orangepi_mini_defconfig            |  2 +-
 configs/UTOO_P66_defconfig                 |  2 +-
 configs/Wexler_TAB7200_defconfig           |  1 -
 configs/Wits_Pro_A20_DKT_defconfig         |  2 +-
 configs/Wobo_i5_defconfig                  |  2 +-
 configs/Yones_Toptech_BD1078_defconfig     |  1 -
 configs/ba10_tv_box_defconfig              |  2 +-
 configs/i12-tvbox_defconfig                |  2 +-
 configs/iNet_3F_defconfig                  |  1 -
 configs/iNet_3W_defconfig                  |  1 -
 configs/iNet_86VS_defconfig                |  2 +-
 configs/inet1_defconfig                    |  1 -
 configs/inet97fv2_defconfig                |  1 -
 configs/inet98v_rev2_defconfig             |  3 ++-
 configs/inet9f_rev03_defconfig             |  1 -
 configs/jesurun_q5_defconfig               |  2 +-
 configs/mk802_a10s_defconfig               |  2 +-
 configs/mk802_defconfig                    |  1 +
 configs/mk802ii_defconfig                  |  1 -
 configs/pov_protab2_ips9_defconfig         |  1 -
 configs/q8_a13_tablet_defconfig            |  3 ++-
 configs/r7-tv-dongle_defconfig             |  2 +-
 configs/sunxi_Gemei_G9_defconfig           |  1 -
 drivers/power/Kconfig                      | 15 +++++++++++++++
 51 files changed, 54 insertions(+), 49 deletions(-)

diff --git a/configs/A10-OLinuXino-Lime_defconfig b/configs/A10-OLinuXino-Lime_defconfig
index f4ff7c5..b22fdb3 100644
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -8,7 +8,7 @@ CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-olinuxino-lime"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/A10s-OLinuXino-M_defconfig b/configs/A10s-OLinuXino-M_defconfig
index 7783c7d..d9add78 100644
--- a/configs/A10s-OLinuXino-M_defconfig
+++ b/configs/A10s-OLinuXino-M_defconfig
@@ -9,8 +9,9 @@ CONFIG_USB1_VBUS_PIN="PB10"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-olinuxino-micro"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,SUNXI_EMAC"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_AXP152_POWER=y
diff --git a/configs/A13-OLinuXino_defconfig b/configs/A13-OLinuXino_defconfig
index 0645716..2edc0d2 100644
--- a/configs/A13-OLinuXino_defconfig
+++ b/configs/A13-OLinuXino_defconfig
@@ -14,9 +14,10 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_NAND_SUNXI=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/A20-OLinuXino-Lime2_defconfig b/configs/A20-OLinuXino-Lime2_defconfig
index c9d0f47..678132c 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -8,7 +8,7 @@ CONFIG_USB0_VBUS_DET="PH5"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-lime2"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/A20-OLinuXino-Lime_defconfig b/configs/A20-OLinuXino-Lime_defconfig
index 4a257b3..ffcdf29 100644
--- a/configs/A20-OLinuXino-Lime_defconfig
+++ b/configs/A20-OLinuXino-Lime_defconfig
@@ -6,7 +6,7 @@ CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-lime"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPC(3)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/A20-OLinuXino_MICRO_defconfig b/configs/A20-OLinuXino_MICRO_defconfig
index a7f1395..9507b87 100644
--- a/configs/A20-OLinuXino_MICRO_defconfig
+++ b/configs/A20-OLinuXino_MICRO_defconfig
@@ -9,7 +9,7 @@ CONFIG_VIDEO_VGA=y
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-micro"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/A20-Olimex-SOM-EVB_defconfig b/configs/A20-Olimex-SOM-EVB_defconfig
index e8c3d18..0b7ab62 100644
--- a/configs/A20-Olimex-SOM-EVB_defconfig
+++ b/configs/A20-Olimex-SOM-EVB_defconfig
@@ -8,7 +8,7 @@ CONFIG_USB0_VBUS_DET="PH5"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olimex-som-evb"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Ainol_AW1_defconfig b/configs/Ainol_AW1_defconfig
index 7c41aa8..fc1be7d 100644
--- a/configs/Ainol_AW1_defconfig
+++ b/configs/Ainol_AW1_defconfig
@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ainol-aw1"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Ampe_A76_defconfig b/configs/Ampe_A76_defconfig
index 57ff52d..8b718bd 100644
--- a/configs/Ampe_A76_defconfig
+++ b/configs/Ampe_A76_defconfig
@@ -15,8 +15,9 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-ampe-a76"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/Auxtek-T003_defconfig b/configs/Auxtek-T003_defconfig
index b9692dc..5dd9a16 100644
--- a/configs/Auxtek-T003_defconfig
+++ b/configs/Auxtek-T003_defconfig
@@ -8,8 +8,8 @@ CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-auxtek-t003"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_AXP152_POWER=y
diff --git a/configs/Auxtek-T004_defconfig b/configs/Auxtek-T004_defconfig
index c019176..c1a58d8 100644
--- a/configs/Auxtek-T004_defconfig
+++ b/configs/Auxtek-T004_defconfig
@@ -6,8 +6,8 @@ CONFIG_USB1_VBUS_PIN="PG13"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-auxtek-t004"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_AXP152_POWER=y
diff --git a/configs/Bananapi_defconfig b/configs/Bananapi_defconfig
index 898631d..d9b1bd6 100644
--- a/configs/Bananapi_defconfig
+++ b/configs/Bananapi_defconfig
@@ -7,7 +7,7 @@ CONFIG_GMAC_TX_DELAY=3
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-bananapi"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Bananapro_defconfig b/configs/Bananapro_defconfig
index e9909d9..9226df5 100644
--- a/configs/Bananapro_defconfig
+++ b/configs/Bananapro_defconfig
@@ -9,7 +9,7 @@ CONFIG_GMAC_TX_DELAY=3
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-bananapro"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Chuwi_V7_CW0825_defconfig b/configs/Chuwi_V7_CW0825_defconfig
index 1725f65..3257aae 100644
--- a/configs/Chuwi_V7_CW0825_defconfig
+++ b/configs/Chuwi_V7_CW0825_defconfig
@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-chuwi-v7-cw0825"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Cubieboard2_defconfig b/configs/Cubieboard2_defconfig
index 9bcaed1..4b9d722 100644
--- a/configs/Cubieboard2_defconfig
+++ b/configs/Cubieboard2_defconfig
@@ -6,7 +6,7 @@ CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-cubieboard2"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Cubieboard_defconfig b/configs/Cubieboard_defconfig
index 2f26848..1f60208 100644
--- a/configs/Cubieboard_defconfig
+++ b/configs/Cubieboard_defconfig
@@ -6,7 +6,7 @@ CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-cubieboard"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Cubietruck_defconfig b/configs/Cubietruck_defconfig
index 6bcd68c..7437766 100644
--- a/configs/Cubietruck_defconfig
+++ b/configs/Cubietruck_defconfig
@@ -8,7 +8,7 @@ CONFIG_GMAC_TX_DELAY=1
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-cubietruck"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(12)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(12)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Hyundai_A7HD_defconfig b/configs/Hyundai_A7HD_defconfig
index 9ef06a7..fef3685 100644
--- a/configs/Hyundai_A7HD_defconfig
+++ b/configs/Hyundai_A7HD_defconfig
@@ -15,7 +15,6 @@ CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-hyundai-a7hd"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Linksprite_pcDuino3_Nano_defconfig b/configs/Linksprite_pcDuino3_Nano_defconfig
index 0b64b60..378abce 100644
--- a/configs/Linksprite_pcDuino3_Nano_defconfig
+++ b/configs/Linksprite_pcDuino3_Nano_defconfig
@@ -8,7 +8,7 @@ CONFIG_GMAC_TX_DELAY=3
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3-nano"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(2)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(2)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Linksprite_pcDuino3_defconfig b/configs/Linksprite_pcDuino3_defconfig
index cced032..c3f0421 100644
--- a/configs/Linksprite_pcDuino3_defconfig
+++ b/configs/Linksprite_pcDuino3_defconfig
@@ -6,7 +6,7 @@ CONFIG_DRAM_ZQ=122
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Linksprite_pcDuino_defconfig b/configs/Linksprite_pcDuino_defconfig
index de44890..d8b6bcd 100644
--- a/configs/Linksprite_pcDuino_defconfig
+++ b/configs/Linksprite_pcDuino_defconfig
@@ -5,7 +5,7 @@ CONFIG_DRAM_CLK=408
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-pcduino"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/MK808C_defconfig b/configs/MK808C_defconfig
index 5e37485..49bb26a 100644
--- a/configs/MK808C_defconfig
+++ b/configs/MK808C_defconfig
@@ -5,7 +5,6 @@ CONFIG_DRAM_CLK=384
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-mk808c"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/MSI_Primo73_defconfig b/configs/MSI_Primo73_defconfig
index a60ce34..5559444 100644
--- a/configs/MSI_Primo73_defconfig
+++ b/configs/MSI_Primo73_defconfig
@@ -10,7 +10,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-primo73"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Mele_A1000_defconfig b/configs/Mele_A1000_defconfig
index b983c8c..f076e30 100644
--- a/configs/Mele_A1000_defconfig
+++ b/configs/Mele_A1000_defconfig
@@ -6,7 +6,7 @@ CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-a1000"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(15),AHCI"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,MACPWR=SUNXI_GPH(15),AHCI"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Mele_M3_defconfig b/configs/Mele_M3_defconfig
index 5c9796a..d72dcc0 100644
--- a/configs/Mele_M3_defconfig
+++ b/configs/Mele_M3_defconfig
@@ -9,7 +9,7 @@ CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-m3"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Mini-X_defconfig b/configs/Mini-X_defconfig
index 314f97b..53f9bfe 100644
--- a/configs/Mini-X_defconfig
+++ b/configs/Mini-X_defconfig
@@ -6,7 +6,6 @@ CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-mini-xplus"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Orangepi_defconfig b/configs/Orangepi_defconfig
index d67bb90..00c671b 100644
--- a/configs/Orangepi_defconfig
+++ b/configs/Orangepi_defconfig
@@ -10,7 +10,7 @@ CONFIG_GMAC_TX_DELAY=3
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-orangepi"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Orangepi_mini_defconfig b/configs/Orangepi_mini_defconfig
index 71d236b..a8652554 100644
--- a/configs/Orangepi_mini_defconfig
+++ b/configs/Orangepi_mini_defconfig
@@ -12,7 +12,7 @@ CONFIG_GMAC_TX_DELAY=3
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-orangepi-mini"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/UTOO_P66_defconfig b/configs/UTOO_P66_defconfig
index 5417814..9dfd956 100644
--- a/configs/UTOO_P66_defconfig
+++ b/configs/UTOO_P66_defconfig
@@ -20,9 +20,9 @@ CONFIG_VIDEO_LCD_TL059WV5C0=y
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-utoo-p66"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 # CONFIG_REQUIRE_SERIAL_CONSOLE is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/Wexler_TAB7200_defconfig b/configs/Wexler_TAB7200_defconfig
index a54ad4f..5f3d624 100644
--- a/configs/Wexler_TAB7200_defconfig
+++ b/configs/Wexler_TAB7200_defconfig
@@ -13,7 +13,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-wexler-tab7200"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Wits_Pro_A20_DKT_defconfig b/configs/Wits_Pro_A20_DKT_defconfig
index 66b51bc..bfc8cba 100644
--- a/configs/Wits_Pro_A20_DKT_defconfig
+++ b/configs/Wits_Pro_A20_DKT_defconfig
@@ -11,7 +11,7 @@ CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-wits-pro-a20-dkt"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/Wobo_i5_defconfig b/configs/Wobo_i5_defconfig
index 206fd48..acb5ff6 100644
--- a/configs/Wobo_i5_defconfig
+++ b/configs/Wobo_i5_defconfig
@@ -7,8 +7,8 @@ CONFIG_USB1_VBUS_PIN="PG12"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-wobo-i5"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/Yones_Toptech_BD1078_defconfig b/configs/Yones_Toptech_BD1078_defconfig
index e26816c..65c1d8e 100644
--- a/configs/Yones_Toptech_BD1078_defconfig
+++ b/configs/Yones_Toptech_BD1078_defconfig
@@ -19,7 +19,6 @@ CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-yones-toptech-bd1078"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/ba10_tv_box_defconfig b/configs/ba10_tv_box_defconfig
index 104d53d..1cfb380 100644
--- a/configs/ba10_tv_box_defconfig
+++ b/configs/ba10_tv_box_defconfig
@@ -9,7 +9,7 @@ CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-ba10-tvbox"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/i12-tvbox_defconfig b/configs/i12-tvbox_defconfig
index d4d9524..54fa819 100644
--- a/configs/i12-tvbox_defconfig
+++ b/configs/i12-tvbox_defconfig
@@ -6,7 +6,7 @@ CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-i12-tvbox"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,MACPWR=SUNXI_GPH(21)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,MACPWR=SUNXI_GPH(21)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/iNet_3F_defconfig b/configs/iNet_3F_defconfig
index 211cb86..7ec54a7 100644
--- a/configs/iNet_3F_defconfig
+++ b/configs/iNet_3F_defconfig
@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-inet-3f"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/iNet_3W_defconfig b/configs/iNet_3W_defconfig
index 35f08e5..5e68769 100644
--- a/configs/iNet_3W_defconfig
+++ b/configs/iNet_3W_defconfig
@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-inet-3w"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/iNet_86VS_defconfig b/configs/iNet_86VS_defconfig
index bb8d080..5599d94 100644
--- a/configs/iNet_86VS_defconfig
+++ b/configs/iNet_86VS_defconfig
@@ -13,8 +13,8 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-inet-86vs"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/inet1_defconfig b/configs/inet1_defconfig
index b2ba497..a8b32cb 100644
--- a/configs/inet1_defconfig
+++ b/configs/inet1_defconfig
@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-inet1"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/inet97fv2_defconfig b/configs/inet97fv2_defconfig
index 71f9d4f..0b03e16 100644
--- a/configs/inet97fv2_defconfig
+++ b/configs/inet97fv2_defconfig
@@ -13,7 +13,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-inet97fv2"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/inet98v_rev2_defconfig b/configs/inet98v_rev2_defconfig
index 4760047..d038f78 100644
--- a/configs/inet98v_rev2_defconfig
+++ b/configs/inet98v_rev2_defconfig
@@ -15,8 +15,9 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-inet-98v-rev2"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/inet9f_rev03_defconfig b/configs/inet9f_rev03_defconfig
index b51c367..153450f 100644
--- a/configs/inet9f_rev03_defconfig
+++ b/configs/inet9f_rev03_defconfig
@@ -13,7 +13,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-inet9f-rev03"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/jesurun_q5_defconfig b/configs/jesurun_q5_defconfig
index cedf63d..9cb8b1d 100644
--- a/configs/jesurun_q5_defconfig
+++ b/configs/jesurun_q5_defconfig
@@ -7,7 +7,7 @@ CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-jesurun-q5"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(19)"
+CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,MACPWR=SUNXI_GPH(19)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/mk802_a10s_defconfig b/configs/mk802_a10s_defconfig
index db437f0..aff8dfc 100644
--- a/configs/mk802_a10s_defconfig
+++ b/configs/mk802_a10s_defconfig
@@ -7,8 +7,8 @@ CONFIG_USB1_VBUS_PIN="PB10"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-mk802"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_AXP152_POWER=y
diff --git a/configs/mk802_defconfig b/configs/mk802_defconfig
index 68b2c5e..9670fbd 100644
--- a/configs/mk802_defconfig
+++ b/configs/mk802_defconfig
@@ -10,3 +10,4 @@ CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+# CONFIG_AXP209_POWER is not set
diff --git a/configs/mk802ii_defconfig b/configs/mk802ii_defconfig
index d3cb664..de1b73f 100644
--- a/configs/mk802ii_defconfig
+++ b/configs/mk802ii_defconfig
@@ -4,7 +4,6 @@ CONFIG_MACH_SUN4I=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-mk802ii"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/pov_protab2_ips9_defconfig b/configs/pov_protab2_ips9_defconfig
index c5249d6..9aa5280 100644
--- a/configs/pov_protab2_ips9_defconfig
+++ b/configs/pov_protab2_ips9_defconfig
@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-pov-protab2-ips9"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/configs/q8_a13_tablet_defconfig b/configs/q8_a13_tablet_defconfig
index 2c61f51..992d95c 100644
--- a/configs/q8_a13_tablet_defconfig
+++ b/configs/q8_a13_tablet_defconfig
@@ -15,8 +15,9 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-q8-tablet"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_MUSB_HOST=y
+CONFIG_AXP209_POWER=y
diff --git a/configs/r7-tv-dongle_defconfig b/configs/r7-tv-dongle_defconfig
index 62c58fc..fcc681f 100644
--- a/configs/r7-tv-dongle_defconfig
+++ b/configs/r7-tv-dongle_defconfig
@@ -6,8 +6,8 @@ CONFIG_USB1_VBUS_PIN="PG13"
 CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-r7-tv-dongle"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_AXP152_POWER=y
diff --git a/configs/sunxi_Gemei_G9_defconfig b/configs/sunxi_Gemei_G9_defconfig
index d0f987c..6d39dec 100644
--- a/configs/sunxi_Gemei_G9_defconfig
+++ b/configs/sunxi_Gemei_G9_defconfig
@@ -11,7 +11,6 @@ CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-gemei-g9"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index df5e373..c669aa1 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -4,6 +4,21 @@ source "drivers/power/pmic/Kconfig"
 
 source "drivers/power/regulator/Kconfig"
 
+config AXP152_POWER
+	boolean "axp152 pmic support"
+	depends on MACH_SUN5I
+	---help---
+	Say y here to enable support for the axp152 pmic found on most A10s
+	boards.
+
+config AXP209_POWER
+	boolean "axp209 pmic support"
+	depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
+	default y if MACH_SUN4I || MACH_SUN7I
+	---help---
+	Say y here to enable support for the axp209 pmic found on most
+	A10, A13 and A20 boards.
+
 config AXP221_POWER
 	boolean "axp221 / axp223 pmic support"
 	depends on MACH_SUN6I || MACH_SUN8I
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig
  2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
@ 2015-10-03 14:26 ` Hans de Goede
  2015-10-09  6:56   ` Ian Campbell
  2015-10-03 14:26 ` [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names Hans de Goede
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 14:26 UTC (permalink / raw)
  To: u-boot

On boards with axp221/223 pmic-s we already allow configuring most
voltages. Make the Kconfig options for these also apply to boards with
axp152 / axp209 pmic-s and extend them to configure all voltages.

The Kconfig defaults are chosen so that this commit does not introduce any
functional changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/board.c                      |  48 ++++-----
 configs/CSQ_CS908_defconfig              |   4 +-
 configs/Colombus_defconfig               |   4 +-
 configs/Hummingbird_A31_defconfig        |   2 +-
 configs/MSI_Primo81_defconfig            |   2 +-
 configs/Mele_A1000G_quad_defconfig       |   8 +-
 configs/Mele_I7_defconfig                |   8 +-
 configs/Mele_M9_defconfig                |   8 +-
 configs/Sinlinx_SinA33_defconfig         |   2 +-
 configs/ga10h_v1_1_defconfig             |   4 +-
 configs/gt90h_v4_defconfig               |   6 +-
 configs/mixtile_loftq_defconfig          |   2 +-
 configs/q8_a23_tablet_800x480_defconfig  |   4 +-
 configs/q8_a33_tablet_1024x600_defconfig |   4 +-
 configs/q8_a33_tablet_800x480_defconfig  |   4 +-
 drivers/power/Kconfig                    | 174 +++++++++++++++++++++++--------
 16 files changed, 185 insertions(+), 99 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 1b90678..bc0376b 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -444,36 +444,36 @@ void sunxi_board_init(void)
 
 #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);
+	power_failed |= axp152_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+	power_failed |= axp152_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+	power_failed |= axp152_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
+	power_failed |= axp152_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
 #endif
 #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);
+	power_failed |= axp209_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+	power_failed |= axp209_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+	power_failed |= axp209_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
+	power_failed |= axp209_set_ldo3(CONFIG_AXP_ALDO3_VOLT);
+	power_failed |= axp209_set_ldo4(CONFIG_AXP_ALDO4_VOLT);
 #endif
 #ifdef CONFIG_AXP221_POWER
 	power_failed = axp221_init();
-	power_failed |= axp221_set_dcdc1(CONFIG_AXP221_DCDC1_VOLT);
-	power_failed |= axp221_set_dcdc2(CONFIG_AXP221_DCDC2_VOLT);
-	power_failed |= axp221_set_dcdc3(1200); /* VDD-CPU */
-#ifdef CONFIG_MACH_SUN6I
-	power_failed |= axp221_set_dcdc4(1200); /* A31:VDD-SYS */
-#else
-	power_failed |= axp221_set_dcdc4(0);    /* A23:unused */
-#endif
-	power_failed |= axp221_set_dcdc5(1500); /* VCC-DRAM */
-	power_failed |= axp221_set_dldo1(CONFIG_AXP221_DLDO1_VOLT);
-	power_failed |= axp221_set_dldo4(CONFIG_AXP221_DLDO4_VOLT);
-	power_failed |= axp221_set_aldo1(CONFIG_AXP221_ALDO1_VOLT);
-	power_failed |= axp221_set_aldo2(CONFIG_AXP221_ALDO2_VOLT);
-	power_failed |= axp221_set_aldo3(CONFIG_AXP221_ALDO3_VOLT);
-	power_failed |= axp221_set_eldo(3, CONFIG_AXP221_ELDO3_VOLT);
+	power_failed |= axp221_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
+	power_failed |= axp221_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+	power_failed |= axp221_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+	power_failed |= axp221_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
+	power_failed |= axp221_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
+	power_failed |= axp221_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
+	power_failed |= axp221_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
+	power_failed |= axp221_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
+	power_failed |= axp221_set_dldo1(CONFIG_AXP_DLDO1_VOLT);
+	power_failed |= axp221_set_dldo2(CONFIG_AXP_DLDO2_VOLT);
+	power_failed |= axp221_set_dldo3(CONFIG_AXP_DLDO3_VOLT);
+	power_failed |= axp221_set_dldo4(CONFIG_AXP_DLDO4_VOLT);
+	power_failed |= axp221_set_eldo(1, CONFIG_AXP_ELDO1_VOLT);
+	power_failed |= axp221_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
+	power_failed |= axp221_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
 #endif
 
 	printf("DRAM:");
diff --git a/configs/CSQ_CS908_defconfig b/configs/CSQ_CS908_defconfig
index 7c8eca8..3ffd34e 100644
--- a/configs/CSQ_CS908_defconfig
+++ b/configs/CSQ_CS908_defconfig
@@ -12,7 +12,7 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/Colombus_defconfig b/configs/Colombus_defconfig
index 35f644a..d680df1 100644
--- a/configs/Colombus_defconfig
+++ b/configs/Colombus_defconfig
@@ -22,6 +22,6 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_ALDO1_VOLT=3300
-CONFIG_AXP221_ELDO3_VOLT=1800
+CONFIG_AXP_ALDO1_VOLT=3300
+CONFIG_AXP_ELDO3_VOLT=1800
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/Hummingbird_A31_defconfig b/configs/Hummingbird_A31_defconfig
index 35c746c..02bcdbf 100644
--- a/configs/Hummingbird_A31_defconfig
+++ b/configs/Hummingbird_A31_defconfig
@@ -14,5 +14,5 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/MSI_Primo81_defconfig b/configs/MSI_Primo81_defconfig
index 9d667b7..3d71bf5 100644
--- a/configs/MSI_Primo81_defconfig
+++ b/configs/MSI_Primo81_defconfig
@@ -16,7 +16,7 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP221_DLDO1_VOLT=3300
+CONFIG_AXP_DLDO1_VOLT=3300
 CONFIG_USB_MUSB_HOST=y
 CONFIG_VIDEO_LCD_SSD2828_TX_CLK=27
 CONFIG_VIDEO_LCD_SSD2828_RESET="PA26"
diff --git a/configs/Mele_A1000G_quad_defconfig b/configs/Mele_A1000G_quad_defconfig
index 5e31ef6..e81e6b6 100644
--- a/configs/Mele_A1000G_quad_defconfig
+++ b/configs/Mele_A1000G_quad_defconfig
@@ -12,9 +12,9 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_DCDC1_VOLT=3300
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_DLDO4_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_AXP_DCDC1_VOLT=3300
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_DLDO4_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/Mele_I7_defconfig b/configs/Mele_I7_defconfig
index 774a92f..38cd845 100644
--- a/configs/Mele_I7_defconfig
+++ b/configs/Mele_I7_defconfig
@@ -12,8 +12,8 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_DCDC1_VOLT=3300
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_DLDO4_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_AXP_DCDC1_VOLT=3300
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_DLDO4_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/Mele_M9_defconfig b/configs/Mele_M9_defconfig
index b52e3c2..93a28a6 100644
--- a/configs/Mele_M9_defconfig
+++ b/configs/Mele_M9_defconfig
@@ -12,8 +12,8 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_DCDC1_VOLT=3300
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_DLDO4_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_AXP_DCDC1_VOLT=3300
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_DLDO4_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/Sinlinx_SinA33_defconfig b/configs/Sinlinx_SinA33_defconfig
index 720f3dc..79fa5bc 100644
--- a/configs/Sinlinx_SinA33_defconfig
+++ b/configs/Sinlinx_SinA33_defconfig
@@ -9,4 +9,4 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_AXP_ALDO1_VOLT=3000
diff --git a/configs/ga10h_v1_1_defconfig b/configs/ga10h_v1_1_defconfig
index 417a89c..b288e82 100644
--- a/configs/ga10h_v1_1_defconfig
+++ b/configs/ga10h_v1_1_defconfig
@@ -21,7 +21,7 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/gt90h_v4_defconfig b/configs/gt90h_v4_defconfig
index e9aecc3..e6be718 100644
--- a/configs/gt90h_v4_defconfig
+++ b/configs/gt90h_v4_defconfig
@@ -20,7 +20,7 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP221_DCDC2_VOLT=1100
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_AXP_DCDC2_VOLT=1100
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/mixtile_loftq_defconfig b/configs/mixtile_loftq_defconfig
index 26fc4ce..ce81309 100644
--- a/configs/mixtile_loftq_defconfig
+++ b/configs/mixtile_loftq_defconfig
@@ -13,5 +13,5 @@ CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3300
 CONFIG_USB_EHCI_HCD=y
diff --git a/configs/q8_a23_tablet_800x480_defconfig b/configs/q8_a23_tablet_800x480_defconfig
index 3a3afa5..4993fa9 100644
--- a/configs/q8_a23_tablet_800x480_defconfig
+++ b/configs/q8_a23_tablet_800x480_defconfig
@@ -20,6 +20,6 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a33_tablet_1024x600_defconfig b/configs/q8_a33_tablet_1024x600_defconfig
index fbbf128..d427966 100644
--- a/configs/q8_a33_tablet_1024x600_defconfig
+++ b/configs/q8_a33_tablet_1024x600_defconfig
@@ -20,6 +20,6 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a33_tablet_800x480_defconfig b/configs/q8_a33_tablet_800x480_defconfig
index 8e8aa92..7f5cc47 100644
--- a/configs/q8_a33_tablet_800x480_defconfig
+++ b/configs/q8_a33_tablet_800x480_defconfig
@@ -20,6 +20,6 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP221_DLDO1_VOLT=3300
-CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_AXP_DLDO1_VOLT=3300
+CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index c669aa1..3a7b3f9 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -27,79 +27,165 @@ config AXP221_POWER
 	Say y here to enable support for the axp221 / axp223 pmic found on most
 	sun6i (A31) / sun8i (A23) boards.
 
-config AXP221_DCDC1_VOLT
-	int "axp221 dcdc1 voltage"
+config AXP_DCDC1_VOLT
+	int "axp pmic dcdc1 voltage"
 	depends on AXP221_POWER
-	default 3000
+	default 3000 if MACH_SUN6I || MACH_SUN8I
 	---help---
-	Set the voltage (mV) to program the axp221 dcdc1 at, set to 0 to
-	disable dcdc1. This is typically used as generic 3.3V IO voltage for
-	things like GPIO-s, sdcard interfaces, etc. On most boards this is
-	undervolted to 3.0V to safe battery.
+	Set the voltage (mV) to program the axp pmic dcdc1 at, set to 0 to
+	disable dcdc1. On A23 / A31 / A33 (axp221) boards dcdc1 is used for
+	generic 3.3V IO voltage for external devices like the lcd-panal and
+	sdcard interfaces, etc. On most boards dcdc1 is undervolted to 3.0V to
+	safe battery. On A31 devices dcdc1 is also used for VCC-IO.
 
-config AXP221_DCDC2_VOLT
-	int "axp221 dcdc2 voltage"
+config AXP_DCDC2_VOLT
+	int "axp pmic dcdc2 voltage"
+	depends on AXP152_POWER || AXP209_POWER || AXP221_POWER
+	default 1400 if AXP152_POWER || AXP209_POWER
+	default 1200 if MACH_SUN6I || MACH_SUN8I
+	---help---
+	Set the voltage (mV) to program the axp pmic dcdc2 at, set to 0 to
+	disable dcdc2.
+	On A10(s) / A13 / A20 boards dcdc2 is VDD-CPU and should be 1.4V.
+	On A31 boards dcdc2 is used for VDD-GPU and should be 1.2V.
+	On A23/A33 boards dcdc2 is used for VDD-SYS and should be 1.2V.
+
+config AXP_DCDC3_VOLT
+	int "axp pmic dcdc3 voltage"
+	depends on AXP152_POWER || AXP209_POWER || AXP221_POWER
+	default 1500 if AXP152_POWER
+	default 1250 if AXP209_POWER
+	default 1200 if MACH_SUN6I || MACH_SUN8I
+	---help---
+	Set the voltage (mV) to program the axp pmic dcdc3 at, set to 0 to
+	disable dcdc3.
+	On A10(s) / A13 / A20 boards with an axp209 dcdc3 is VDD-INT-DLL and
+	should be 1.25V.
+	On A10s boards with an axp152 dcdc3 is VCC-DRAM and should be 1.5V.
+	On A23 / A31 / A33 boards dcdc3 is VDD-CPU and should be 1.2V.
+
+config AXP_DCDC4_VOLT
+	int "axp pmic dcdc4 voltage"
+	depends on AXP152_POWER || AXP221_POWER
+	default 1250 if AXP152_POWER
+	default 1200 if MACH_SUN6I
+	default 0 if MACH_SUN8I
+	---help---
+	Set the voltage (mV) to program the axp pmic dcdc4 at, set to 0 to
+	disable dcdc4.
+	On A10s boards with an axp152 dcdc4 is VDD-INT-DLL and should be 1.25V.
+	On A31 boards dcdc4 is used for VDD-SYS and should be 1.2V.
+	On A23 / A33 boards dcdc4 is unused and should be disabled.
+
+config AXP_DCDC5_VOLT
+	int "axp pmic dcdc5 voltage"
+	depends on AXP221_POWER
+	default 1500 if MACH_SUN6I || MACH_SUN8I
+	---help---
+	Set the voltage (mV) to program the axp pmic dcdc5 at, set to 0 to
+	disable dcdc5.
+	On A23 / A31 / A33 boards dcdc5 is VCC-DRAM and should be 1.5V.
+
+config AXP_ALDO1_VOLT
+	int "axp pmic (a)ldo1 voltage"
 	depends on AXP221_POWER
-	default 1200
+	default 0
+	---help---
+	Set the voltage (mV) to program the axp pmic aldo1 at, set to 0 to
+	disable aldo1.
+	On A31 boards aldo1 is often used to power the wifi module.
+	On A23 / A33 boards aldo1 is used for VCC-IO and should be 3.0V.
+
+config AXP_ALDO2_VOLT
+	int "axp pmic (a)ldo2 voltage"
+	depends on AXP152_POWER || AXP209_POWER || AXP221_POWER
+	default 3000 if AXP152_POWER || AXP209_POWER
+	default 0 if MACH_SUN6I
+	default 2500 if MACH_SUN8I
 	---help---
-	Set the voltage (mV) to program the axp221 dcdc2 at, set to 0 to
-	disable dcdc2. On A31 boards this is typically used for VDD-GPU,
-	on A23/A33 for VDD-SYS, this should normally be set to 1.2V.
+	Set the voltage (mV) to program the axp pmic aldo2 at, set to 0 to
+	disable aldo2.
+	On A10(s) / A13 / A20 boards aldo2 is AVCC and should be 3.0V.
+	On A31 boards aldo2 is typically unused and should be disabled.
+	On A31 boards aldo2 may be used for LPDDR2 then it should be 1.8V.
+	On A23 / A33 boards aldo2 is used for VDD-DLL and should be 2.5V.
 
-config AXP221_DLDO1_VOLT
-	int "axp221 dldo1 voltage"
+config AXP_ALDO3_VOLT
+	int "axp pmic (a)ldo3 voltage"
+	depends on AXP209_POWER || AXP221_POWER
+	default 2800 if AXP209_POWER
+	default 3000 if MACH_SUN6I || MACH_SUN8I
+	---help---
+	Set the voltage (mV) to program the axp pmic aldo3 at, set to 0 to
+	disable aldo3.
+	On A10(s) / A13 / A20 boards aldo3 should be 2.8V.
+	On A23 / A31 / A33 boards aldo3 is VCC-PLL and AVCC and should be 3.0V.
+
+config AXP_ALDO4_VOLT
+	int "axp pmic (a)ldo4 voltage"
+	depends on AXP209_POWER
+	default 2800 if AXP209_POWER
+	---help---
+	Set the voltage (mV) to program the axp pmic aldo4 at, set to 0 to
+	disable aldo4.
+	On A10(s) / A13 / A20 boards aldo4 should be 2.8V.
+
+config AXP_DLDO1_VOLT
+	int "axp pmic dldo1 voltage"
 	depends on AXP221_POWER
 	default 0
 	---help---
-	Set the voltage (mV) to program the axp221 dldo1 at, set to 0 to
-	disable dldo1. On sun6i (A31) boards with ethernet this is often used
+	Set the voltage (mV) to program the axp pmic dldo1 at, set to 0 to
+	disable dldo1. On sun6i (A31) boards with ethernet dldo1 is often used
 	to power the ethernet phy. On sun8i (A23) boards this is often used to
 	power the wifi.
 
-config AXP221_DLDO4_VOLT
-	int "axp221 dldo4 voltage"
+config AXP_DLDO2_VOLT
+	int "axp pmic dldo2 voltage"
 	depends on AXP221_POWER
 	default 0
 	---help---
-	Set the voltage (mV) to program the axp221 dldo4 at, set to 0 to
-	disable dldo4.
+	Set the voltage (mV) to program the axp pmic dldo2 at, set to 0 to
+	disable dldo2.
 
-config AXP221_ALDO1_VOLT
-	int "axp221 aldo1 voltage"
+config AXP_DLDO3_VOLT
+	int "axp pmic dldo3 voltage"
 	depends on AXP221_POWER
 	default 0
 	---help---
-	Set the voltage (mV) to program the axp221 aldo1 at, set to 0 to
-	disable aldo1. On sun6i (A31) boards which have a wifi module this is
-	often used to power the wifi module.
+	Set the voltage (mV) to program the axp pmic dldo3 at, set to 0 to
+	disable dldo3.
 
-config AXP221_ALDO2_VOLT
-	int "axp221 aldo2 voltage"
+config AXP_DLDO4_VOLT
+	int "axp pmic dldo4 voltage"
 	depends on AXP221_POWER
-	default 0 if MACH_SUN6I
-	default 2500 if MACH_SUN8I
+	default 0
 	---help---
-	Set the voltage (mV) to program the axp221 aldo2 at, set to 0 to
-	disable aldo2. On sun6i (A31) boards this is typically unused and
-	should be disabled, if it is used for LPDDR2 it should be set to 1.8V.
-	On sun8i (A23) this is typically connected to VDD-DLL and must be set
-	to 2.5V.
+	Set the voltage (mV) to program the axp pmic dldo4 at, set to 0 to
+	disable dldo4.
 
-config AXP221_ALDO3_VOLT
-	int "axp221 aldo3 voltage"
+config AXP_ELDO1_VOLT
+	int "axp pmic eldo1 voltage"
 	depends on AXP221_POWER
-	default 3000
+	default 0
+	---help---
+	Set the voltage (mV) to program the axp pmic eldo1 at, set to 0 to
+	disable eldo1.
+
+config AXP_ELDO2_VOLT
+	int "axp pmic eldo2 voltage"
+	depends on AXP221_POWER
+	default 0
 	---help---
-	Set the voltage (mV) to program the axp221 aldo3 at, set to 0 to
-	disable aldo3. This is typically connected to VCC-PLL and AVCC and
-	must be set to 3V.
+	Set the voltage (mV) to program the axp pmic eldo2 at, set to 0 to
+	disable eldo2.
 
-config AXP221_ELDO3_VOLT
-	int "axp221 eldo3 voltage"
+config AXP_ELDO3_VOLT
+	int "axp pmic eldo3 voltage"
 	depends on AXP221_POWER
 	default 0
 	---help---
-	Set the voltage (mV) to program the axp221 eldo3 at, set to 0 to
+	Set the voltage (mV) to program the axp pmic eldo3 at, set to 0 to
 	disable eldo3. On some A31(s) tablets it might be used to supply
 	1.2V for the SSD2828 chip (converter of parallel LCD interface
 	into MIPI DSI).
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
  2015-10-03 14:26 ` [U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig Hans de Goede
@ 2015-10-03 14:26 ` Hans de Goede
  2015-10-03 14:32   ` Chen-Yu Tsai
  2015-10-11 11:14   ` Ian Campbell
  2015-10-03 14:26 ` [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V Hans de Goede
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 14:26 UTC (permalink / raw)
  To: u-boot

Stop prefixing the axp functions for setting voltages, etc. with the
model number, there ever is only one pmic driver built into u-boot,
this allows simplifying the callers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/cpu/armv7/sunxi/cpu_info.c |  4 +--
 arch/arm/cpu/armv7/sunxi/usb_phy.c  |  9 -----
 board/sunxi/board.c                 | 70 +++++++++++++++++--------------------
 drivers/gpio/axp_gpio.c             | 11 +-----
 drivers/power/axp152.c              | 12 +++----
 drivers/power/axp209.c              | 39 +++++----------------
 drivers/power/axp221.c              | 35 +++++++++----------
 drivers/video/sunxi_display.c       |  6 ++--
 include/axp152.h                    |  6 ----
 include/axp209.h                    |  9 -----
 include/axp221.h                    | 16 ---------
 include/axp_pmic.h                  | 37 ++++++++++++++++++++
 12 files changed, 106 insertions(+), 148 deletions(-)
 create mode 100644 include/axp_pmic.h

diff --git a/arch/arm/cpu/armv7/sunxi/cpu_info.c b/arch/arm/cpu/armv7/sunxi/cpu_info.c
index a276fad..05fef32 100644
--- a/arch/arm/cpu/armv7/sunxi/cpu_info.c
+++ b/arch/arm/cpu/armv7/sunxi/cpu_info.c
@@ -10,7 +10,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clock.h>
-#include <axp221.h>
+#include <axp_pmic.h>
 #include <errno.h>
 
 #ifdef CONFIG_MACH_SUN6I
@@ -82,7 +82,7 @@ int print_cpuinfo(void)
 int sunxi_get_sid(unsigned int *sid)
 {
 #ifdef CONFIG_AXP221_POWER
-	return axp221_get_sid(sid);
+	return axp_get_sid(sid);
 #elif defined SUNXI_SID_BASE
 	int i;
 
diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c b/arch/arm/cpu/armv7/sunxi/usb_phy.c
index b7ca5d4..19bb5a1 100644
--- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
+++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
@@ -17,15 +17,6 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <errno.h>
-#ifdef CONFIG_AXP152_POWER
-#include <axp152.h>
-#endif
-#ifdef CONFIG_AXP209_POWER
-#include <axp209.h>
-#endif
-#ifdef CONFIG_AXP221_POWER
-#include <axp221.h>
-#endif
 
 #define SUNXI_USB_PMU_IRQ_ENABLE	0x800
 #ifdef CONFIG_MACH_SUN8I_A33
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index bc0376b..e99b2ba 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -13,15 +13,7 @@
 
 #include <common.h>
 #include <mmc.h>
-#ifdef CONFIG_AXP152_POWER
-#include <axp152.h>
-#endif
-#ifdef CONFIG_AXP209_POWER
-#include <axp209.h>
-#endif
-#ifdef CONFIG_AXP221_POWER
-#include <axp221.h>
-#endif
+#include <axp_pmic.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/display.h>
@@ -442,40 +434,42 @@ 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(CONFIG_AXP_DCDC2_VOLT);
-	power_failed |= axp152_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
-	power_failed |= axp152_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
-	power_failed |= axp152_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
+#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER
+	power_failed = axp_init();
+
+#ifdef CONFIG_AXP221_POWER
+	power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
 #endif
-#ifdef CONFIG_AXP209_POWER
-	power_failed |= axp209_init();
-	power_failed |= axp209_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
-	power_failed |= axp209_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
-	power_failed |= axp209_set_ldo2(CONFIG_AXP_ALDO2_VOLT);
-	power_failed |= axp209_set_ldo3(CONFIG_AXP_ALDO3_VOLT);
-	power_failed |= axp209_set_ldo4(CONFIG_AXP_ALDO4_VOLT);
+	power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
+	power_failed |= axp_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
+#ifndef CONFIG_AXP209_POWER
+	power_failed |= axp_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
 #endif
 #ifdef CONFIG_AXP221_POWER
-	power_failed = axp221_init();
-	power_failed |= axp221_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
-	power_failed |= axp221_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
-	power_failed |= axp221_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
-	power_failed |= axp221_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
-	power_failed |= axp221_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
-	power_failed |= axp221_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
-	power_failed |= axp221_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
-	power_failed |= axp221_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
-	power_failed |= axp221_set_dldo1(CONFIG_AXP_DLDO1_VOLT);
-	power_failed |= axp221_set_dldo2(CONFIG_AXP_DLDO2_VOLT);
-	power_failed |= axp221_set_dldo3(CONFIG_AXP_DLDO3_VOLT);
-	power_failed |= axp221_set_dldo4(CONFIG_AXP_DLDO4_VOLT);
-	power_failed |= axp221_set_eldo(1, CONFIG_AXP_ELDO1_VOLT);
-	power_failed |= axp221_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
-	power_failed |= axp221_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
+	power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
 #endif
 
+#ifdef CONFIG_AXP221_POWER
+	power_failed |= axp_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
+#endif
+	power_failed |= axp_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
+#ifndef CONFIG_AXP152_POWER
+	power_failed |= axp_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
+#endif
+#ifdef CONFIG_AXP209_POWER
+	power_failed |= axp_set_aldo4(CONFIG_AXP_ALDO4_VOLT);
+#endif
+
+#ifdef CONFIG_AXP221_POWER
+	power_failed |= axp_set_dldo1(CONFIG_AXP_DLDO1_VOLT);
+	power_failed |= axp_set_dldo2(CONFIG_AXP_DLDO2_VOLT);
+	power_failed |= axp_set_dldo3(CONFIG_AXP_DLDO3_VOLT);
+	power_failed |= axp_set_dldo4(CONFIG_AXP_DLDO4_VOLT);
+	power_failed |= axp_set_eldo(1, CONFIG_AXP_ELDO1_VOLT);
+	power_failed |= axp_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
+	power_failed |= axp_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
+#endif
+#endif
 	printf("DRAM:");
 	ramsize = sunxi_dram_init();
 	printf(" %lu MiB\n", ramsize >> 20);
diff --git a/drivers/gpio/axp_gpio.c b/drivers/gpio/axp_gpio.c
index 2e97cc3..bd2ac89 100644
--- a/drivers/gpio/axp_gpio.c
+++ b/drivers/gpio/axp_gpio.c
@@ -10,22 +10,13 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/pmic_bus.h>
 #include <asm/gpio.h>
+#include <axp_pmic.h>
 #include <dm.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/root.h>
 #include <errno.h>
 
-#ifdef CONFIG_AXP152_POWER
-#include <axp152.h>
-#elif defined CONFIG_AXP209_POWER
-#include <axp209.h>
-#elif defined CONFIG_AXP221_POWER
-#include <axp221.h>
-#else
-#error Unknown AXP model
-#endif
-
 static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val);
 
 static u8 axp_get_gpio_ctrl_reg(unsigned pin)
diff --git a/drivers/power/axp152.c b/drivers/power/axp152.c
index 740a3b4..c60e4d3 100644
--- a/drivers/power/axp152.c
+++ b/drivers/power/axp152.c
@@ -6,7 +6,7 @@
  */
 #include <common.h>
 #include <i2c.h>
-#include <axp152.h>
+#include <axp_pmic.h>
 
 static int axp152_write(enum axp152_reg reg, u8 val)
 {
@@ -28,7 +28,7 @@ static u8 axp152_mvolt_to_target(int mvolt, int min, int max, int div)
 	return (mvolt - min) / div;
 }
 
-int axp152_set_dcdc2(int mvolt)
+int axp_set_dcdc2(unsigned int mvolt)
 {
 	int rc;
 	u8 current, target;
@@ -49,28 +49,28 @@ int axp152_set_dcdc2(int mvolt)
 	return rc;
 }
 
-int axp152_set_dcdc3(int mvolt)
+int axp_set_dcdc3(unsigned int mvolt)
 {
 	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 50);
 
 	return axp152_write(AXP152_DCDC3_VOLTAGE, target);
 }
 
-int axp152_set_dcdc4(int mvolt)
+int axp_set_dcdc4(unsigned int mvolt)
 {
 	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 25);
 
 	return axp152_write(AXP152_DCDC4_VOLTAGE, target);
 }
 
-int axp152_set_ldo2(int mvolt)
+int axp_set_aldo2(unsigned int mvolt)
 {
 	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 100);
 
 	return axp152_write(AXP152_LDO2_VOLTAGE, target);
 }
 
-int axp152_init(void)
+int axp_init(void)
 {
 	u8 ver;
 	int rc;
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
index 5161bc1..91c35fa 100644
--- a/drivers/power/axp209.c
+++ b/drivers/power/axp209.c
@@ -7,8 +7,7 @@
 
 #include <common.h>
 #include <i2c.h>
-#include <asm/arch/gpio.h>
-#include <axp209.h>
+#include <axp_pmic.h>
 
 static int axp209_write(enum axp209_reg reg, u8 val)
 {
@@ -30,7 +29,7 @@ static u8 axp209_mvolt_to_cfg(int mvolt, int min, int max, int div)
 	return (mvolt - min) / div;
 }
 
-int axp209_set_dcdc2(int mvolt)
+int axp_set_dcdc2(unsigned int mvolt)
 {
 	int rc;
 	u8 cfg, current;
@@ -53,14 +52,14 @@ int axp209_set_dcdc2(int mvolt)
 	return rc;
 }
 
-int axp209_set_dcdc3(int mvolt)
+int axp_set_dcdc3(unsigned int mvolt)
 {
 	u8 cfg = axp209_mvolt_to_cfg(mvolt, 700, 3500, 25);
 
 	return axp209_write(AXP209_DCDC3_VOLTAGE, cfg);
 }
 
-int axp209_set_ldo2(int mvolt)
+int axp_set_aldo2(unsigned int mvolt)
 {
 	int rc;
 	u8 cfg, reg;
@@ -76,7 +75,7 @@ int axp209_set_ldo2(int mvolt)
 	return axp209_write(AXP209_LDO24_VOLTAGE, reg);
 }
 
-int axp209_set_ldo3(int mvolt)
+int axp_set_aldo3(unsigned int mvolt)
 {
 	u8 cfg;
 
@@ -88,10 +87,10 @@ int axp209_set_ldo3(int mvolt)
 	return axp209_write(AXP209_LDO3_VOLTAGE, cfg);
 }
 
-int axp209_set_ldo4(int mvolt)
+int axp_set_aldo4(unsigned int mvolt)
 {
 	int rc;
-	static const int vindex[] = {
+	static const unsigned int vindex[] = {
 		1250, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2500,
 		2700, 2800, 3000, 3100, 3200, 3300
 	};
@@ -109,7 +108,7 @@ int axp209_set_ldo4(int mvolt)
 	return axp209_write(AXP209_LDO24_VOLTAGE, reg);
 }
 
-int axp209_init(void)
+int axp_init(void)
 {
 	u8 ver;
 	int i, rc;
@@ -133,25 +132,3 @@ int axp209_init(void)
 
 	return 0;
 }
-
-int axp209_poweron_by_dc(void)
-{
-	u8 v;
-
-	if (axp209_read(AXP209_POWER_STATUS, &v))
-		return 0;
-
-	return (v & AXP209_POWER_STATUS_ON_BY_DC);
-}
-
-int axp209_power_button(void)
-{
-	u8 v;
-
-	if (axp209_read(AXP209_IRQ_STATUS5, &v))
-		return 0;
-
-	axp209_write(AXP209_IRQ_STATUS5, AXP209_IRQ5_PEK_DOWN);
-
-	return v & AXP209_IRQ5_PEK_DOWN;
-}
diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index 7bbaec8..d621f2a 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -12,9 +12,8 @@
 
 #include <common.h>
 #include <errno.h>
-#include <asm/arch/gpio.h>
 #include <asm/arch/pmic_bus.h>
-#include <axp221.h>
+#include <axp_pmic.h>
 
 static u8 axp221_mvolt_to_cfg(int mvolt, int min, int max, int div)
 {
@@ -26,7 +25,7 @@ static u8 axp221_mvolt_to_cfg(int mvolt, int min, int max, int div)
 	return (mvolt - min) / div;
 }
 
-int axp221_set_dcdc1(unsigned int mvolt)
+int axp_set_dcdc1(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 1600, 3400, 100);
@@ -48,7 +47,7 @@ int axp221_set_dcdc1(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL1_DCDC1_EN);
 }
 
-int axp221_set_dcdc2(unsigned int mvolt)
+int axp_set_dcdc2(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 600, 1540, 20);
@@ -65,7 +64,7 @@ int axp221_set_dcdc2(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL1_DCDC2_EN);
 }
 
-int axp221_set_dcdc3(unsigned int mvolt)
+int axp_set_dcdc3(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 600, 1860, 20);
@@ -82,7 +81,7 @@ int axp221_set_dcdc3(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL1_DCDC3_EN);
 }
 
-int axp221_set_dcdc4(unsigned int mvolt)
+int axp_set_dcdc4(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 600, 1540, 20);
@@ -99,7 +98,7 @@ int axp221_set_dcdc4(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL1_DCDC4_EN);
 }
 
-int axp221_set_dcdc5(unsigned int mvolt)
+int axp_set_dcdc5(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 1000, 2550, 50);
@@ -116,7 +115,7 @@ int axp221_set_dcdc5(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL1_DCDC5_EN);
 }
 
-int axp221_set_dldo1(unsigned int mvolt)
+int axp_set_dldo1(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -133,7 +132,7 @@ int axp221_set_dldo1(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL2_DLDO1_EN);
 }
 
-int axp221_set_dldo2(unsigned int mvolt)
+int axp_set_dldo2(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -150,7 +149,7 @@ int axp221_set_dldo2(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL2_DLDO2_EN);
 }
 
-int axp221_set_dldo3(unsigned int mvolt)
+int axp_set_dldo3(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -167,7 +166,7 @@ int axp221_set_dldo3(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL2_DLDO3_EN);
 }
 
-int axp221_set_dldo4(unsigned int mvolt)
+int axp_set_dldo4(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -184,7 +183,7 @@ int axp221_set_dldo4(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL2_DLDO4_EN);
 }
 
-int axp221_set_aldo1(unsigned int mvolt)
+int axp_set_aldo1(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -201,7 +200,7 @@ int axp221_set_aldo1(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL1_ALDO1_EN);
 }
 
-int axp221_set_aldo2(unsigned int mvolt)
+int axp_set_aldo2(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -218,7 +217,7 @@ int axp221_set_aldo2(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL1_ALDO2_EN);
 }
 
-int axp221_set_aldo3(unsigned int mvolt)
+int axp_set_aldo3(unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -235,7 +234,7 @@ int axp221_set_aldo3(unsigned int mvolt)
 				AXP221_OUTPUT_CTRL3_ALDO3_EN);
 }
 
-int axp221_set_eldo(int eldo_num, unsigned int mvolt)
+int axp_set_eldo(int eldo_num, unsigned int mvolt)
 {
 	int ret;
 	u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
@@ -268,7 +267,7 @@ int axp221_set_eldo(int eldo_num, unsigned int mvolt)
 	return pmic_bus_setbits(AXP221_OUTPUT_CTRL2, bits);
 }
 
-int axp221_init(void)
+int axp_init(void)
 {
 	/* This cannot be 0 because it is used in SPL before BSS is ready */
 	static int needs_init = 1;
@@ -293,12 +292,12 @@ int axp221_init(void)
 	return 0;
 }
 
-int axp221_get_sid(unsigned int *sid)
+int axp_get_sid(unsigned int *sid)
 {
 	u8 *dest = (u8 *)sid;
 	int i, ret;
 
-	ret = axp221_init();
+	ret = pmic_bus_init();
 	if (ret)
 		return ret;
 
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index fc1aea3..9fee66a 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -15,7 +15,7 @@
 #include <asm/global_data.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
-#include <axp221.h>
+#include <axp_pmic.h>
 #include <errno.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
@@ -1217,10 +1217,10 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode,
 		if (IS_ENABLED(CONFIG_VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804)) {
 			/*
 			 * The anx9804 needs 1.8V from eldo3, we do this here
-			 * and not via CONFIG_AXP221_ELDO3 from board_init()
+			 * and not via CONFIG_AXP_ELDO3_VOLT from board_init()
 			 * to avoid turning this on when using hdmi output.
 			 */
-			axp221_set_eldo(3, 1800);
+			axp_set_eldo(3, 1800);
 			anx9804_init(CONFIG_VIDEO_LCD_I2C_BUS, 4,
 				     ANX9804_DATA_RATE_1620M,
 				     sunxi_display.depth);
diff --git a/include/axp152.h b/include/axp152.h
index c3aef77..1643266 100644
--- a/include/axp152.h
+++ b/include/axp152.h
@@ -25,9 +25,3 @@ enum axp152_reg {
 #define AXP_GPIO_CTRL_INPUT			0x02 /* Input */
 #define AXP_GPIO_STATE			0x97
 #define AXP_GPIO_STATE_OFFSET			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);
diff --git a/include/axp209.h b/include/axp209.h
index 6170202..13aa66c 100644
--- a/include/axp209.h
+++ b/include/axp209.h
@@ -39,12 +39,3 @@ enum axp209_reg {
 #define AXP_GPIO_CTRL_INPUT			0x02 /* Input */
 #define AXP_GPIO_STATE			0x94
 #define AXP_GPIO_STATE_OFFSET			4
-
-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);
diff --git a/include/axp221.h b/include/axp221.h
index 9c87162..0ee21b6 100644
--- a/include/axp221.h
+++ b/include/axp221.h
@@ -62,19 +62,3 @@
 #define AXP_GPIO_CTRL_INPUT			0x02 /* Input */
 #define AXP_GPIO_STATE			0x94
 #define AXP_GPIO_STATE_OFFSET			0
-
-int axp221_set_dcdc1(unsigned int mvolt);
-int axp221_set_dcdc2(unsigned int mvolt);
-int axp221_set_dcdc3(unsigned int mvolt);
-int axp221_set_dcdc4(unsigned int mvolt);
-int axp221_set_dcdc5(unsigned int mvolt);
-int axp221_set_dldo1(unsigned int mvolt);
-int axp221_set_dldo2(unsigned int mvolt);
-int axp221_set_dldo3(unsigned int mvolt);
-int axp221_set_dldo4(unsigned int mvolt);
-int axp221_set_aldo1(unsigned int mvolt);
-int axp221_set_aldo2(unsigned int mvolt);
-int axp221_set_aldo3(unsigned int mvolt);
-int axp221_set_eldo(int eldo_num, unsigned int mvolt);
-int axp221_init(void);
-int axp221_get_sid(unsigned int *sid);
diff --git a/include/axp_pmic.h b/include/axp_pmic.h
new file mode 100644
index 0000000..ef339c4
--- /dev/null
+++ b/include/axp_pmic.h
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com>
+ *
+ * X-Powers AX Power Management IC support header
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef _AXP_PMIC_H_
+
+#ifdef CONFIG_AXP152_POWER
+#include <axp152.h>
+#endif
+#ifdef CONFIG_AXP209_POWER
+#include <axp209.h>
+#endif
+#ifdef CONFIG_AXP221_POWER
+#include <axp221.h>
+#endif
+
+int axp_set_dcdc1(unsigned int mvolt);
+int axp_set_dcdc2(unsigned int mvolt);
+int axp_set_dcdc3(unsigned int mvolt);
+int axp_set_dcdc4(unsigned int mvolt);
+int axp_set_dcdc5(unsigned int mvolt);
+int axp_set_aldo1(unsigned int mvolt);
+int axp_set_aldo2(unsigned int mvolt);
+int axp_set_aldo3(unsigned int mvolt);
+int axp_set_aldo4(unsigned int mvolt);
+int axp_set_dldo1(unsigned int mvolt);
+int axp_set_dldo2(unsigned int mvolt);
+int axp_set_dldo3(unsigned int mvolt);
+int axp_set_dldo4(unsigned int mvolt);
+int axp_set_eldo(int eldo_num, unsigned int mvolt);
+int axp_init(void);
+int axp_get_sid(unsigned int *sid);
+
+#endif
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V
  2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
  2015-10-03 14:26 ` [U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig Hans de Goede
  2015-10-03 14:26 ` [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names Hans de Goede
@ 2015-10-03 14:26 ` Hans de Goede
  2015-10-09  8:33   ` Ian Campbell
  2015-10-10 14:13   ` Chen-Yu Tsai
  2015-10-03 14:26 ` [U-Boot] [PATCH 5/7] sunxi: power: Change A23/A33 aldo1 default voltage to 3.0V Hans de Goede
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 14:26 UTC (permalink / raw)
  To: u-boot

Change the axp223 dcdc2 / VDD-SYS default from 1.2V to 1.1V, 1.1V is the
value recommended by Allwinner and is what most fex files specify.

This has been tested on a number of A23/A33 tablets including on an
A23 Ippo-q8h-v1.2 PCB tablet which has a fex file which specifies 1.2V
(which is where our original 1.2V default comes from).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 configs/gt90h_v4_defconfig | 1 -
 drivers/power/Kconfig      | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configs/gt90h_v4_defconfig b/configs/gt90h_v4_defconfig
index e6be718..e7347d8 100644
--- a/configs/gt90h_v4_defconfig
+++ b/configs/gt90h_v4_defconfig
@@ -20,7 +20,6 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP_DCDC2_VOLT=1100
 CONFIG_AXP_DLDO1_VOLT=3300
 CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 3a7b3f9..cedc36a 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -42,13 +42,14 @@ config AXP_DCDC2_VOLT
 	int "axp pmic dcdc2 voltage"
 	depends on AXP152_POWER || AXP209_POWER || AXP221_POWER
 	default 1400 if AXP152_POWER || AXP209_POWER
-	default 1200 if MACH_SUN6I || MACH_SUN8I
+	default 1200 if MACH_SUN6I
+	default 1100 if MACH_SUN8I
 	---help---
 	Set the voltage (mV) to program the axp pmic dcdc2 at, set to 0 to
 	disable dcdc2.
 	On A10(s) / A13 / A20 boards dcdc2 is VDD-CPU and should be 1.4V.
 	On A31 boards dcdc2 is used for VDD-GPU and should be 1.2V.
-	On A23/A33 boards dcdc2 is used for VDD-SYS and should be 1.2V.
+	On A23/A33 boards dcdc2 is used for VDD-SYS and should be 1.1V.
 
 config AXP_DCDC3_VOLT
 	int "axp pmic dcdc3 voltage"
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 5/7] sunxi: power: Change A23/A33 aldo1 default voltage to 3.0V
  2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
                   ` (2 preceding siblings ...)
  2015-10-03 14:26 ` [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V Hans de Goede
@ 2015-10-03 14:26 ` Hans de Goede
  2015-10-09  8:34   ` Ian Campbell
  2015-10-03 14:26 ` [U-Boot] [PATCH 6/7] sunxi: power: Use pmic_bus functions for axp152 / axp209 driver Hans de Goede
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 14:26 UTC (permalink / raw)
  To: u-boot

On A23 / A33 boards aldo1 is used for VCC-IO and should be 3.0V, make this
the default.

Note that this does not cause any functional changes since all sun8i
board defconfig-s already contained: CONFIG_AXP_ALDO1_VOLT=3000 .

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 configs/Sinlinx_SinA33_defconfig         | 1 -
 configs/ga10h_v1_1_defconfig             | 1 -
 configs/gt90h_v4_defconfig               | 1 -
 configs/q8_a23_tablet_800x480_defconfig  | 1 -
 configs/q8_a33_tablet_1024x600_defconfig | 1 -
 configs/q8_a33_tablet_800x480_defconfig  | 1 -
 drivers/power/Kconfig                    | 3 ++-
 7 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/configs/Sinlinx_SinA33_defconfig b/configs/Sinlinx_SinA33_defconfig
index 79fa5bc..013c35e 100644
--- a/configs/Sinlinx_SinA33_defconfig
+++ b/configs/Sinlinx_SinA33_defconfig
@@ -9,4 +9,3 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP_ALDO1_VOLT=3000
diff --git a/configs/ga10h_v1_1_defconfig b/configs/ga10h_v1_1_defconfig
index b288e82..34e74af 100644
--- a/configs/ga10h_v1_1_defconfig
+++ b/configs/ga10h_v1_1_defconfig
@@ -22,6 +22,5 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/gt90h_v4_defconfig b/configs/gt90h_v4_defconfig
index e7347d8..a14de0d 100644
--- a/configs/gt90h_v4_defconfig
+++ b/configs/gt90h_v4_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a23_tablet_800x480_defconfig b/configs/q8_a23_tablet_800x480_defconfig
index 4993fa9..7391464 100644
--- a/configs/q8_a23_tablet_800x480_defconfig
+++ b/configs/q8_a23_tablet_800x480_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a33_tablet_1024x600_defconfig b/configs/q8_a33_tablet_1024x600_defconfig
index d427966..16f8600 100644
--- a/configs/q8_a33_tablet_1024x600_defconfig
+++ b/configs/q8_a33_tablet_1024x600_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a33_tablet_800x480_defconfig b/configs/q8_a33_tablet_800x480_defconfig
index 7f5cc47..6378918 100644
--- a/configs/q8_a33_tablet_800x480_defconfig
+++ b/configs/q8_a33_tablet_800x480_defconfig
@@ -21,5 +21,4 @@ CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO1_VOLT=3300
-CONFIG_AXP_ALDO1_VOLT=3000
 CONFIG_USB_MUSB_HOST=y
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index cedc36a..ba1af6c 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -90,7 +90,8 @@ config AXP_DCDC5_VOLT
 config AXP_ALDO1_VOLT
 	int "axp pmic (a)ldo1 voltage"
 	depends on AXP221_POWER
-	default 0
+	default 0 if MACH_SUN6I
+	default 3000 if MACH_SUN8I
 	---help---
 	Set the voltage (mV) to program the axp pmic aldo1 at, set to 0 to
 	disable aldo1.
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 6/7] sunxi: power: Use pmic_bus functions for axp152 / axp209 driver
  2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
                   ` (3 preceding siblings ...)
  2015-10-03 14:26 ` [U-Boot] [PATCH 5/7] sunxi: power: Change A23/A33 aldo1 default voltage to 3.0V Hans de Goede
@ 2015-10-03 14:26 ` Hans de Goede
  2015-10-09  8:36   ` Ian Campbell
  2015-10-03 14:26 ` [U-Boot] [PATCH 7/7] sunxi: power: Drop protection against multiple calls from axp221 axp_init() Hans de Goede
  2015-10-09  6:49 ` [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Ian Campbell
  6 siblings, 1 reply; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 14:26 UTC (permalink / raw)
  To: u-boot

Use the generic pmic_bus helpers for the axp152 / axp209 drivers,
rather then having them define their own register read / write
functions.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/power/axp152.c | 28 +++++++++++-----------------
 drivers/power/axp209.c | 36 +++++++++++++++---------------------
 2 files changed, 26 insertions(+), 38 deletions(-)

diff --git a/drivers/power/axp152.c b/drivers/power/axp152.c
index c60e4d3..2972586 100644
--- a/drivers/power/axp152.c
+++ b/drivers/power/axp152.c
@@ -5,19 +5,9 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 #include <common.h>
-#include <i2c.h>
+#include <asm/arch/pmic_bus.h>
 #include <axp_pmic.h>
 
-static int axp152_write(enum axp152_reg reg, u8 val)
-{
-	return i2c_write(0x30, reg, 1, &val, 1);
-}
-
-static int axp152_read(enum axp152_reg reg, u8 *val)
-{
-	return i2c_read(0x30, reg, 1, val, 1);
-}
-
 static u8 axp152_mvolt_to_target(int mvolt, int min, int max, int div)
 {
 	if (mvolt < min)
@@ -36,13 +26,13 @@ int axp_set_dcdc2(unsigned int mvolt)
 	target = axp152_mvolt_to_target(mvolt, 700, 2275, 25);
 
 	/* Do we really need to be this gentle? It has built-in voltage slope */
-	while ((rc = axp152_read(AXP152_DCDC2_VOLTAGE, &current)) == 0 &&
+	while ((rc = pmic_bus_read(AXP152_DCDC2_VOLTAGE, &current)) == 0 &&
 	       current != target) {
 		if (current < target)
 			current++;
 		else
 			current--;
-		rc = axp152_write(AXP152_DCDC2_VOLTAGE, current);
+		rc = pmic_bus_write(AXP152_DCDC2_VOLTAGE, current);
 		if (rc)
 			break;
 	}
@@ -53,21 +43,21 @@ int axp_set_dcdc3(unsigned int mvolt)
 {
 	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 50);
 
-	return axp152_write(AXP152_DCDC3_VOLTAGE, target);
+	return pmic_bus_write(AXP152_DCDC3_VOLTAGE, target);
 }
 
 int axp_set_dcdc4(unsigned int mvolt)
 {
 	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 25);
 
-	return axp152_write(AXP152_DCDC4_VOLTAGE, target);
+	return pmic_bus_write(AXP152_DCDC4_VOLTAGE, target);
 }
 
 int axp_set_aldo2(unsigned int mvolt)
 {
 	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 100);
 
-	return axp152_write(AXP152_LDO2_VOLTAGE, target);
+	return pmic_bus_write(AXP152_LDO2_VOLTAGE, target);
 }
 
 int axp_init(void)
@@ -75,7 +65,11 @@ int axp_init(void)
 	u8 ver;
 	int rc;
 
-	rc = axp152_read(AXP152_CHIP_VERSION, &ver);
+	rc = pmic_bus_init();
+	if (rc)
+		return rc;
+
+	rc = pmic_bus_read(AXP152_CHIP_VERSION, &ver);
 	if (rc)
 		return rc;
 
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
index 91c35fa..bb5d08b 100644
--- a/drivers/power/axp209.c
+++ b/drivers/power/axp209.c
@@ -6,19 +6,9 @@
  */
 
 #include <common.h>
-#include <i2c.h>
+#include <asm/arch/pmic_bus.h>
 #include <axp_pmic.h>
 
-static int axp209_write(enum axp209_reg reg, u8 val)
-{
-	return i2c_write(0x34, reg, 1, &val, 1);
-}
-
-static int axp209_read(enum axp209_reg reg, u8 *val)
-{
-	return i2c_read(0x34, reg, 1, val, 1);
-}
-
 static u8 axp209_mvolt_to_cfg(int mvolt, int min, int max, int div)
 {
 	if (mvolt < min)
@@ -37,14 +27,14 @@ int axp_set_dcdc2(unsigned int mvolt)
 	cfg = axp209_mvolt_to_cfg(mvolt, 700, 2275, 25);
 
 	/* Do we really need to be this gentle? It has built-in voltage slope */
-	while ((rc = axp209_read(AXP209_DCDC2_VOLTAGE, &current)) == 0 &&
+	while ((rc = pmic_bus_read(AXP209_DCDC2_VOLTAGE, &current)) == 0 &&
 	       current != cfg) {
 		if (current < cfg)
 			current++;
 		else
 			current--;
 
-		rc = axp209_write(AXP209_DCDC2_VOLTAGE, current);
+		rc = pmic_bus_write(AXP209_DCDC2_VOLTAGE, current);
 		if (rc)
 			break;
 	}
@@ -56,7 +46,7 @@ int axp_set_dcdc3(unsigned int mvolt)
 {
 	u8 cfg = axp209_mvolt_to_cfg(mvolt, 700, 3500, 25);
 
-	return axp209_write(AXP209_DCDC3_VOLTAGE, cfg);
+	return pmic_bus_write(AXP209_DCDC3_VOLTAGE, cfg);
 }
 
 int axp_set_aldo2(unsigned int mvolt)
@@ -66,13 +56,13 @@ int axp_set_aldo2(unsigned int mvolt)
 
 	cfg = axp209_mvolt_to_cfg(mvolt, 1800, 3300, 100);
 
-	rc = axp209_read(AXP209_LDO24_VOLTAGE, &reg);
+	rc = pmic_bus_read(AXP209_LDO24_VOLTAGE, &reg);
 	if (rc)
 		return rc;
 
 	/* LDO2 configuration is in upper 4 bits */
 	reg = (reg & 0x0f) | (cfg << 4);
-	return axp209_write(AXP209_LDO24_VOLTAGE, reg);
+	return pmic_bus_write(AXP209_LDO24_VOLTAGE, reg);
 }
 
 int axp_set_aldo3(unsigned int mvolt)
@@ -84,7 +74,7 @@ int axp_set_aldo3(unsigned int mvolt)
 	else
 		cfg = axp209_mvolt_to_cfg(mvolt, 700, 3500, 25);
 
-	return axp209_write(AXP209_LDO3_VOLTAGE, cfg);
+	return pmic_bus_write(AXP209_LDO3_VOLTAGE, cfg);
 }
 
 int axp_set_aldo4(unsigned int mvolt)
@@ -99,13 +89,13 @@ int axp_set_aldo4(unsigned int mvolt)
 	/* Translate mvolt to register cfg value, requested <= selected */
 	for (cfg = 15; vindex[cfg] > mvolt && cfg > 0; cfg--);
 
-	rc = axp209_read(AXP209_LDO24_VOLTAGE, &reg);
+	rc = pmic_bus_read(AXP209_LDO24_VOLTAGE, &reg);
 	if (rc)
 		return rc;
 
 	/* LDO4 configuration is in lower 4 bits */
 	reg = (reg & 0xf0) | (cfg << 0);
-	return axp209_write(AXP209_LDO24_VOLTAGE, reg);
+	return pmic_bus_write(AXP209_LDO24_VOLTAGE, reg);
 }
 
 int axp_init(void)
@@ -113,7 +103,11 @@ int axp_init(void)
 	u8 ver;
 	int i, rc;
 
-	rc = axp209_read(AXP209_CHIP_VERSION, &ver);
+	rc = pmic_bus_init();
+	if (rc)
+		return rc;
+
+	rc = pmic_bus_read(AXP209_CHIP_VERSION, &ver);
 	if (rc)
 		return rc;
 
@@ -125,7 +119,7 @@ int axp_init(void)
 
 	/* Mask all interrupts */
 	for (i = AXP209_IRQ_ENABLE1; i <= AXP209_IRQ_ENABLE5; i++) {
-		rc = axp209_write(i, 0);
+		rc = pmic_bus_write(i, 0);
 		if (rc)
 			return rc;
 	}
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 7/7] sunxi: power: Drop protection against multiple calls from axp221 axp_init()
  2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
                   ` (4 preceding siblings ...)
  2015-10-03 14:26 ` [U-Boot] [PATCH 6/7] sunxi: power: Use pmic_bus functions for axp152 / axp209 driver Hans de Goede
@ 2015-10-03 14:26 ` Hans de Goede
  2015-10-09  8:36   ` Ian Campbell
  2015-10-09  6:49 ` [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Ian Campbell
  6 siblings, 1 reply; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 14:26 UTC (permalink / raw)
  To: u-boot

The only thing axp221.c's axp_init() does which needs protection
against multiple calls is calling pmic_bus_init, and pmic_bus_init()
itself is already protected against being called multiple times.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/power/axp221.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index d621f2a..65802e4 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -269,14 +269,9 @@ int axp_set_eldo(int eldo_num, unsigned int mvolt)
 
 int axp_init(void)
 {
-	/* This cannot be 0 because it is used in SPL before BSS is ready */
-	static int needs_init = 1;
 	u8 axp_chip_id;
 	int ret;
 
-	if (!needs_init)
-		return 0;
-
 	ret = pmic_bus_init();
 	if (ret)
 		return ret;
@@ -288,7 +283,6 @@ int axp_init(void)
 	if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17))
 		return -ENODEV;
 
-	needs_init = 0;
 	return 0;
 }
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-03 14:26 ` [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names Hans de Goede
@ 2015-10-03 14:32   ` Chen-Yu Tsai
  2015-10-03 20:16     ` Hans de Goede
  2015-10-11 11:14   ` Ian Campbell
  1 sibling, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2015-10-03 14:32 UTC (permalink / raw)
  To: u-boot

On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> Stop prefixing the axp functions for setting voltages, etc. with the
> model number, there ever is only one pmic driver built into u-boot,
> this allows simplifying the callers.

Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
a subset of their LDOs share the same name, which would be a problem.

ChenYu

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-03 14:32   ` Chen-Yu Tsai
@ 2015-10-03 20:16     ` Hans de Goede
  2015-10-09  8:31       ` Ian Campbell
  0 siblings, 1 reply; 25+ messages in thread
From: Hans de Goede @ 2015-10-03 20:16 UTC (permalink / raw)
  To: u-boot

Hi,

On 03-10-15 16:32, Chen-Yu Tsai wrote:
> On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> Stop prefixing the axp functions for setting voltages, etc. with the
>> model number, there ever is only one pmic driver built into u-boot,
>> this allows simplifying the callers.
>
> Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
> a subset of their LDOs share the same name, which would be a problem.

My plan for that is to use a different function name for the ldo-s
on the secondary pmic, e.g. something like axp2_set_xldo1(...), or
somesuch. Actually this patch should help adding support for the
other pmics since it will make it less of an #ifdef fest.

Regards,

Hans

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER
  2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
                   ` (5 preceding siblings ...)
  2015-10-03 14:26 ` [U-Boot] [PATCH 7/7] sunxi: power: Drop protection against multiple calls from axp221 axp_init() Hans de Goede
@ 2015-10-09  6:49 ` Ian Campbell
  2015-10-09 11:20   ` Hans de Goede
  6 siblings, 1 reply; 25+ messages in thread
From: Ian Campbell @ 2015-10-09  6:49 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
> Note that sun5i boards can have either an AXP209 or an AXP152 pmic,

Is it actually xor? I think so given that you later on unify the names
such that they cannot be compiled in at the same time.

If so then...
 
> +config AXP152_POWER
> +	boolean "axp152 pmic support"
> +	depends on MACH_SUN5I
> +	---help---
> +	Say y here to enable support for the axp152 pmic found on
> most A10s
> +	boards.
> +
> +config AXP209_POWER
> +	boolean "axp209 pmic support"
> +	depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
> +	default y if MACH_SUN4I || MACH_SUN7I
> +	---help---
> +	Say y here to enable support for the axp209 pmic found on
> most
> +	A10, A13 and A20 boards.
> +
>  config AXP221_POWER

... these three ought to be inside a choice?

Ian.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig
  2015-10-03 14:26 ` [U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig Hans de Goede
@ 2015-10-09  6:56   ` Ian Campbell
  0 siblings, 0 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-09  6:56 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
> On boards with axp221/223 pmic-s we already allow configuring most
> voltages. Make the Kconfig options for these also apply to boards
> with
> axp152 / axp209 pmic-s and extend them to configure all voltages.
> 
> The Kconfig defaults are chosen so that this commit does not
> introduce any
> functional changes.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

(I'm afraid I have to go to the dentist now, I'll try and get to the
remainder after that, or if not then at the w/e.

Ian)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-03 20:16     ` Hans de Goede
@ 2015-10-09  8:31       ` Ian Campbell
  2015-10-09 11:24         ` Hans de Goede
  0 siblings, 1 reply; 25+ messages in thread
From: Ian Campbell @ 2015-10-09  8:31 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 22:16 +0200, Hans de Goede wrote:
> Hi,
> 
> On 03-10-15 16:32, Chen-Yu Tsai wrote:
> > On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com>
> > wrote:
> > > Stop prefixing the axp functions for setting voltages, etc. with the
> > > model number, there ever is only one pmic driver built into u-boot,
> > > this allows simplifying the callers.
> > 
> > Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
> > a subset of their LDOs share the same name, which would be a problem.
> 
> My plan for that is to use a different function name for the ldo-s
> on the secondary pmic, e.g. something like axp2_set_xldo1(...), or
> somesuch. Actually this patch should help adding support for the
> other pmics since it will make it less of an #ifdef fest.

Is it going to be (or very likely to be) the case that a given AXPxxx
device will only ever be a primary or a secondary,  but never used as both
(perhaps on different boards)?

Is there some property of these devices which causes them to be only usable
as one or the other?

If there is some possibility of this not being the case then this
unification + my comments on patch #1 might be seen in a different light.

Having a board which uses two of the same AXPxxx device looks like it would
be even more problematic, if such a thing is possible.

Or is the plan to just cross that bridge if/when we get there? (I think I'm
 OK with that).

Ian.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V
  2015-10-03 14:26 ` [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V Hans de Goede
@ 2015-10-09  8:33   ` Ian Campbell
  2015-10-10 14:13   ` Chen-Yu Tsai
  1 sibling, 0 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-09  8:33 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
> Change the axp223 dcdc2 / VDD-SYS default from 1.2V to 1.1V, 1.1V is the
> value recommended by Allwinner and is what most fex files specify.
> 
> This has been tested on a number of A23/A33 tablets including on an
> A23 Ippo-q8h-v1.2 PCB tablet which has a fex file which specifies 1.2V
> (which is where our original 1.2V default comes from).
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 5/7] sunxi: power: Change A23/A33 aldo1 default voltage to 3.0V
  2015-10-03 14:26 ` [U-Boot] [PATCH 5/7] sunxi: power: Change A23/A33 aldo1 default voltage to 3.0V Hans de Goede
@ 2015-10-09  8:34   ` Ian Campbell
  0 siblings, 0 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-09  8:34 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
> On A23 / A33 boards aldo1 is used for VCC-IO and should be 3.0V, make
> this
> the default.
> 
> Note that this does not cause any functional changes since all sun8i
> board defconfig-s already contained: CONFIG_AXP_ALDO1_VOLT=3000 .
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 6/7] sunxi: power: Use pmic_bus functions for axp152 / axp209 driver
  2015-10-03 14:26 ` [U-Boot] [PATCH 6/7] sunxi: power: Use pmic_bus functions for axp152 / axp209 driver Hans de Goede
@ 2015-10-09  8:36   ` Ian Campbell
  0 siblings, 0 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-09  8:36 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
> Use the generic pmic_bus helpers for the axp152 / axp209 drivers,
> rather then having them define their own register read / write
> functions.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 7/7] sunxi: power: Drop protection against multiple calls from axp221 axp_init()
  2015-10-03 14:26 ` [U-Boot] [PATCH 7/7] sunxi: power: Drop protection against multiple calls from axp221 axp_init() Hans de Goede
@ 2015-10-09  8:36   ` Ian Campbell
  0 siblings, 0 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-09  8:36 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
> The only thing axp221.c's axp_init() does which needs protection
> against multiple calls is calling pmic_bus_init, and pmic_bus_init()
> itself is already protected against being called multiple times.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER
  2015-10-09  6:49 ` [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Ian Campbell
@ 2015-10-09 11:20   ` Hans de Goede
  0 siblings, 0 replies; 25+ messages in thread
From: Hans de Goede @ 2015-10-09 11:20 UTC (permalink / raw)
  To: u-boot

Hi,

On 09-10-15 08:49, Ian Campbell wrote:
> On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
>> Note that sun5i boards can have either an AXP209 or an AXP152 pmic,
>
> Is it actually xor? I think so given that you later on unify the names
> such that they cannot be compiled in at the same time.
>
> If so then...
>
>> +config AXP152_POWER
>> +	boolean "axp152 pmic support"
>> +	depends on MACH_SUN5I
>> +	---help---
>> +	Say y here to enable support for the axp152 pmic found on
>> most A10s
>> +	boards.
>> +
>> +config AXP209_POWER
>> +	boolean "axp209 pmic support"
>> +	depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
>> +	default y if MACH_SUN4I || MACH_SUN7I
>> +	---help---
>> +	Say y here to enable support for the axp209 pmic found on
>> most
>> +	A10, A13 and A20 boards.
>> +
>>   config AXP221_POWER
>
> ... these three ought to be inside a choice?

I was thinking the same, but on A80 boards there are 2
different axp chips, so if we make this a choice now we
just end up needing to revert this when we get full A80 support.

Regards,

Hans

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-09  8:31       ` Ian Campbell
@ 2015-10-09 11:24         ` Hans de Goede
  2015-10-09 12:41           ` Ian Campbell
  0 siblings, 1 reply; 25+ messages in thread
From: Hans de Goede @ 2015-10-09 11:24 UTC (permalink / raw)
  To: u-boot

Hi,

On 09-10-15 10:31, Ian Campbell wrote:
> On Sat, 2015-10-03 at 22:16 +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 03-10-15 16:32, Chen-Yu Tsai wrote:
>>> On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com>
>>> wrote:
>>>> Stop prefixing the axp functions for setting voltages, etc. with the
>>>> model number, there ever is only one pmic driver built into u-boot,
>>>> this allows simplifying the callers.
>>>
>>> Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
>>> a subset of their LDOs share the same name, which would be a problem.
>>
>> My plan for that is to use a different function name for the ldo-s
>> on the secondary pmic, e.g. something like axp2_set_xldo1(...), or
>> somesuch. Actually this patch should help adding support for the
>> other pmics since it will make it less of an #ifdef fest.
>
> Is it going to be (or very likely to be) the case that a given AXPxxx
> device will only ever be a primary or a secondary,  but never used as both
> (perhaps on different boards)?

AFAIK that is correct, there are different axp models for primary / secondary
pmics. Some a80 / a83 boards may only use the primary pmic, but using only
the secondary is not really expected.

> Is there some property of these devices which causes them to be only usable
> as one or the other?

No, not really (unless you count things like power-on / power-button handling
which only the primary has AFAIK).

> If there is some possibility of this not being the case then this
> unification + my comments on patch #1 might be seen in a different light.
>
> Having a board which uses two of the same AXPxxx device looks like it would
> be even more problematic, if such a thing is possible.

AFAIK there are no boards which use the same pmic twice.

> Or is the plan to just cross that bridge if/when we get there? (I think I'm
>   OK with that).

Yes that is pretty much the plan :)

Regards,

Hans

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-09 11:24         ` Hans de Goede
@ 2015-10-09 12:41           ` Ian Campbell
  2015-10-09 13:44             ` Hans de Goede
  2015-10-09 14:49             ` Chen-Yu Tsai
  0 siblings, 2 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-09 12:41 UTC (permalink / raw)
  To: u-boot

On Fri, 2015-10-09 at 13:24 +0200, Hans de Goede wrote:
> Hi,
> 
> On 09-10-15 10:31, Ian Campbell wrote:
> > On Sat, 2015-10-03 at 22:16 +0200, Hans de Goede wrote:
> > > Hi,
> > > 
> > > On 03-10-15 16:32, Chen-Yu Tsai wrote:
> > > > On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com
> > > > >
> > > > wrote:
> > > > > Stop prefixing the axp functions for setting voltages, etc. with
> > > > > the
> > > > > model number, there ever is only one pmic driver built into u
> > > > > -boot,
> > > > > this allows simplifying the callers.
> > > > 
> > > > Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
> > > > a subset of their LDOs share the same name, which would be a
> > > > problem.
> > > 
> > > My plan for that is to use a different function name for the ldo-s
> > > on the secondary pmic, e.g. something like axp2_set_xldo1(...), or
> > > somesuch. Actually this patch should help adding support for the
> > > other pmics since it will make it less of an #ifdef fest.
> > 
> > Is it going to be (or very likely to be) the case that a given AXPxxx
> > device will only ever be a primary or a secondary,  but never used as
> > both
> > (perhaps on different boards)?
> 
> AFAIK that is correct, there are different axp models for primary / secondary
> pmics.

OK, that makes sense, but then this:

>  Some a80 / a83 boards may only use the primary pmic, but using only
> the secondary is not really expected.

... makes me want to clarify, since I understand that having a secondary
but not a primary would be rather strange and wasn't what I was getting at.

What I meant was for a given AXPxxx is that model only ever either used as
a primary _or_ used as a secondary (with some other AXPabc as the primary).
I think your answer further above is telling me that yes, a given AXPxxx is
either designed (and used) as a primary or a secondary.

From the patch #1 discussion (since it is predicated on the above and
splitting the conversation in two will probably just get confusing):

> > ... these three ought to be inside a choice?
> 
> I was thinking the same, but on A80 boards there are 2
> different axp chips, so if we make this a choice now we
> just end up needing to revert this when we get full A80 support.

But one of those would be a primary and the other a secondary, and as
discussed above (as I currently understand it at least) each
CONFIG_AXPxxx_POWER can be a primary XOR a secondary.

In which case what we would want is a set of choice options for primary and
a separate set choice options for secondary (with a none option too in this
case) and there would be no duplication of any specific AXPxxx option
between both the primary and secondary sets.

Ian.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-09 12:41           ` Ian Campbell
@ 2015-10-09 13:44             ` Hans de Goede
  2015-10-09 14:24               ` Ian Campbell
  2015-10-09 14:49             ` Chen-Yu Tsai
  1 sibling, 1 reply; 25+ messages in thread
From: Hans de Goede @ 2015-10-09 13:44 UTC (permalink / raw)
  To: u-boot

Hi,

On 09-10-15 14:41, Ian Campbell wrote:
> On Fri, 2015-10-09 at 13:24 +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 09-10-15 10:31, Ian Campbell wrote:
>>> On Sat, 2015-10-03 at 22:16 +0200, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 03-10-15 16:32, Chen-Yu Tsai wrote:
>>>>> On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com
>>>>>>
>>>>> wrote:
>>>>>> Stop prefixing the axp functions for setting voltages, etc. with
>>>>>> the
>>>>>> model number, there ever is only one pmic driver built into u
>>>>>> -boot,
>>>>>> this allows simplifying the callers.
>>>>>
>>>>> Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
>>>>> a subset of their LDOs share the same name, which would be a
>>>>> problem.
>>>>
>>>> My plan for that is to use a different function name for the ldo-s
>>>> on the secondary pmic, e.g. something like axp2_set_xldo1(...), or
>>>> somesuch. Actually this patch should help adding support for the
>>>> other pmics since it will make it less of an #ifdef fest.
>>>
>>> Is it going to be (or very likely to be) the case that a given AXPxxx
>>> device will only ever be a primary or a secondary,  but never used as
>>> both
>>> (perhaps on different boards)?
>>
>> AFAIK that is correct, there are different axp models for primary / secondary
>> pmics.
>
> OK, that makes sense, but then this:
>
>>   Some a80 / a83 boards may only use the primary pmic, but using only
>> the secondary is not really expected.
>
> ... makes me want to clarify, since I understand that having a secondary
> but not a primary would be rather strange and wasn't what I was getting at.
>
> What I meant was for a given AXPxxx is that model only ever either used as
> a primary _or_ used as a secondary (with some other AXPabc as the primary).
> I think your answer further above is telling me that yes, a given AXPxxx is
> either designed (and used) as a primary or a secondary.
>
>  From the patch #1 discussion (since it is predicated on the above and
> splitting the conversation in two will probably just get confusing):
>
>>> ... these three ought to be inside a choice?
>>
>> I was thinking the same, but on A80 boards there are 2
>> different axp chips, so if we make this a choice now we
>> just end up needing to revert this when we get full A80 support.
>
> But one of those would be a primary and the other a secondary, and as
> discussed above (as I currently understand it at least) each
> CONFIG_AXPxxx_POWER can be a primary XOR a secondary.
>
> In which case what we would want is a set of choice options for primary and
> a separate set choice options for secondary (with a none option too in this
> case) and there would be no duplication of any specific AXPxxx option
> between both the primary and secondary sets.

Ah Yes, from what we now know / expect about how things will work on
boards with 2 pmics that is correct. I'll respin the first patch to change
things into a choice including a none option.

Regards,

Hans

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-09 13:44             ` Hans de Goede
@ 2015-10-09 14:24               ` Ian Campbell
  0 siblings, 0 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-09 14:24 UTC (permalink / raw)
  To: u-boot

On Fri, 2015-10-09 at 15:44 +0200, Hans de Goede wrote:

> > In which case what we would want is a set of choice options for primary and
> > a separate set choice options for secondary (with a none option too in this
> > case) and there would be no duplication of any specific AXPxxx option
> > between both the primary and secondary sets.
> 
> Ah Yes, from what we now know / expect about how things will work on
> boards with 2 pmics that is correct. I'll respin the first patch to change
> things into a choice including a none option.

Do we need a "none" option for the primary case?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-09 12:41           ` Ian Campbell
  2015-10-09 13:44             ` Hans de Goede
@ 2015-10-09 14:49             ` Chen-Yu Tsai
  1 sibling, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2015-10-09 14:49 UTC (permalink / raw)
  To: u-boot

Hi,

On Fri, Oct 9, 2015 at 8:41 PM, Ian Campbell <ijc+uboot@hellion.org.uk> wrote:
> On Fri, 2015-10-09 at 13:24 +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 09-10-15 10:31, Ian Campbell wrote:
>> > On Sat, 2015-10-03 at 22:16 +0200, Hans de Goede wrote:
>> > > Hi,
>> > >
>> > > On 03-10-15 16:32, Chen-Yu Tsai wrote:
>> > > > On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com
>> > > > >
>> > > > wrote:
>> > > > > Stop prefixing the axp functions for setting voltages, etc. with
>> > > > > the
>> > > > > model number, there ever is only one pmic driver built into u
>> > > > > -boot,
>> > > > > this allows simplifying the callers.
>> > > >
>> > > > Hmm... What's going to happen with the A80, which has 2 PMICs? IIRC
>> > > > a subset of their LDOs share the same name, which would be a
>> > > > problem.
>> > >
>> > > My plan for that is to use a different function name for the ldo-s
>> > > on the secondary pmic, e.g. something like axp2_set_xldo1(...), or
>> > > somesuch. Actually this patch should help adding support for the
>> > > other pmics since it will make it less of an #ifdef fest.
>> >
>> > Is it going to be (or very likely to be) the case that a given AXPxxx
>> > device will only ever be a primary or a secondary,  but never used as
>> > both
>> > (perhaps on different boards)?
>>
>> AFAIK that is correct, there are different axp models for primary / secondary
>> pmics.
>
> OK, that makes sense, but then this:
>
>>  Some a80 / a83 boards may only use the primary pmic, but using only
>> the secondary is not really expected.
>
> ... makes me want to clarify, since I understand that having a secondary
> but not a primary would be rather strange and wasn't what I was getting at.
>
> What I meant was for a given AXPxxx is that model only ever either used as
> a primary _or_ used as a secondary (with some other AXPabc as the primary).
> I think your answer further above is telling me that yes, a given AXPxxx is
> either designed (and used) as a primary or a secondary.

Only the AXP806 is multi-role, i.e. can be primary or secondary. All the
others that we know of, excluding the AXP818 for which we have no docs,
are standalone PMICs.

And a system can also have multiple AXP806s, even on the same bus. This
is supported by some address extension register.

Having said the above, I really don't expect to see these kinds of designs
in the wild.

> From the patch #1 discussion (since it is predicated on the above and
> splitting the conversation in two will probably just get confusing):
>
>> > ... these three ought to be inside a choice?
>>
>> I was thinking the same, but on A80 boards there are 2
>> different axp chips, so if we make this a choice now we
>> just end up needing to revert this when we get full A80 support.
>
> But one of those would be a primary and the other a secondary, and as
> discussed above (as I currently understand it at least) each
> CONFIG_AXPxxx_POWER can be a primary XOR a secondary.
>
> In which case what we would want is a set of choice options for primary and
> a separate set choice options for secondary (with a none option too in this
> case) and there would be no duplication of any specific AXPxxx option
> between both the primary and secondary sets.

AFAIK, all the AXPs except AXP806 belong in the primary list. The secondary
set should only have AXP806, at least until Allwinner delivers some Cortex-A57
or Cortex-A72 design that needs the extra power of a secondary PMIC.

Regards
ChenYu

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V
  2015-10-03 14:26 ` [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V Hans de Goede
  2015-10-09  8:33   ` Ian Campbell
@ 2015-10-10 14:13   ` Chen-Yu Tsai
  2015-10-11 11:17     ` Hans de Goede
  1 sibling, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2015-10-10 14:13 UTC (permalink / raw)
  To: u-boot

On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> Change the axp223 dcdc2 / VDD-SYS default from 1.2V to 1.1V, 1.1V is the
> value recommended by Allwinner and is what most fex files specify.
>
> This has been tested on a number of A23/A33 tablets including on an
> A23 Ippo-q8h-v1.2 PCB tablet which has a fex file which specifies 1.2V
> (which is where our original 1.2V default comes from).
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

We should also be able to drop the VDD-SYS voltage for A31/A31s, which is
from DCDC4, as well.

Furthermore, DCDC2 on AXP221/sun6i is normally powering the GPU,
in spite of the reference design using it for the CPU.

Regards
ChenYu

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names
  2015-10-03 14:26 ` [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names Hans de Goede
  2015-10-03 14:32   ` Chen-Yu Tsai
@ 2015-10-11 11:14   ` Ian Campbell
  1 sibling, 0 replies; 25+ messages in thread
From: Ian Campbell @ 2015-10-11 11:14 UTC (permalink / raw)
  To: u-boot

On Sat, 2015-10-03 at 16:26 +0200, Hans de Goede wrote:
> Stop prefixing the axp functions for setting voltages, etc. with the
> model number, there ever is only one pmic driver built into u-boot,
> this allows simplifying the callers.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

@@ -1217,10 +1217,10 @@ static void sunxi_mode_set(const struct
> ctfb_res_modes *mode,
>  > 	> 	> if (IS_ENABLED(CONFIG_VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804)) {
>  > 	> 	> 	> /*
>  > 	> 	> 	>  * The anx9804 needs 1.8V from eldo3, we do this here
> -> 	> 	> 	>  * and not via CONFIG_AXP221_ELDO3 from board_init()
> +> 	> 	> 	>  * and not via CONFIG_AXP_ELDO3_VOLT from board_init()

I think strictly speaking that hunk belonged in a previous patch, but
nevermind (or feel to retain acks on both if you want to move it).

Ian.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V
  2015-10-10 14:13   ` Chen-Yu Tsai
@ 2015-10-11 11:17     ` Hans de Goede
  0 siblings, 0 replies; 25+ messages in thread
From: Hans de Goede @ 2015-10-11 11:17 UTC (permalink / raw)
  To: u-boot

Hi,

On 10-10-15 16:13, Chen-Yu Tsai wrote:
> On Sat, Oct 3, 2015 at 10:26 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> Change the axp223 dcdc2 / VDD-SYS default from 1.2V to 1.1V, 1.1V is the
>> value recommended by Allwinner and is what most fex files specify.
>>
>> This has been tested on a number of A23/A33 tablets including on an
>> A23 Ippo-q8h-v1.2 PCB tablet which has a fex file which specifies 1.2V
>> (which is where our original 1.2V default comes from).
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> We should also be able to drop the VDD-SYS voltage for A31/A31s, which is
> from DCDC4, as well.

The fex files do not agree with you all A31 fex files have it at either
1200 or 1240 mV.

> Furthermore, DCDC2 on AXP221/sun6i is normally powering the GPU,
> in spite of the reference design using it for the CPU.

Right, the Kconfig help for DCDC2 already contains:

         On A31 boards dcdc2 is used for VDD-GPU and should be 1.2V.

Regards,

Hans

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-10-11 11:17 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-03 14:26 [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Hans de Goede
2015-10-03 14:26 ` [U-Boot] [PATCH 2/7] sunxi: power: Make all voltages configurable through Kconfig Hans de Goede
2015-10-09  6:56   ` Ian Campbell
2015-10-03 14:26 ` [U-Boot] [PATCH 3/7] sunxi: power: Unify axp pmic function names Hans de Goede
2015-10-03 14:32   ` Chen-Yu Tsai
2015-10-03 20:16     ` Hans de Goede
2015-10-09  8:31       ` Ian Campbell
2015-10-09 11:24         ` Hans de Goede
2015-10-09 12:41           ` Ian Campbell
2015-10-09 13:44             ` Hans de Goede
2015-10-09 14:24               ` Ian Campbell
2015-10-09 14:49             ` Chen-Yu Tsai
2015-10-11 11:14   ` Ian Campbell
2015-10-03 14:26 ` [U-Boot] [PATCH 4/7] sunxi: power: Change A23/A33 VDD-SYS default from 1.2V to 1.1V Hans de Goede
2015-10-09  8:33   ` Ian Campbell
2015-10-10 14:13   ` Chen-Yu Tsai
2015-10-11 11:17     ` Hans de Goede
2015-10-03 14:26 ` [U-Boot] [PATCH 5/7] sunxi: power: Change A23/A33 aldo1 default voltage to 3.0V Hans de Goede
2015-10-09  8:34   ` Ian Campbell
2015-10-03 14:26 ` [U-Boot] [PATCH 6/7] sunxi: power: Use pmic_bus functions for axp152 / axp209 driver Hans de Goede
2015-10-09  8:36   ` Ian Campbell
2015-10-03 14:26 ` [U-Boot] [PATCH 7/7] sunxi: power: Drop protection against multiple calls from axp221 axp_init() Hans de Goede
2015-10-09  8:36   ` Ian Campbell
2015-10-09  6:49 ` [U-Boot] [PATCH 1/7] sunxi: Kconfig-ify CONFIG_AXP152_POWER and _AXP209_POWER Ian Campbell
2015-10-09 11:20   ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.