This is used by the ethernet-phy on various boards.

Signed-off-by: Hans de Goede <[email protected]>
---
 board/sunxi/board.c    |  3 +++
 boards.cfg             |  2 +-
 drivers/power/axp221.c | 17 +++++++++++++++++
 include/axp221.h       |  5 +++++
 4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 3893d5e..386b03e 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -117,6 +117,9 @@ void sunxi_board_init(void)
        power_failed |= axp221_set_dcdc3(1260);
        power_failed |= axp221_set_dcdc4(1200);
        power_failed |= axp221_set_dcdc5(1500);
+#ifdef CONFIG_ENABLE_DLDO1_POWER
+       power_failed |= axp221_set_dldo1(3300);
+#endif
 #endif
 
 #if !defined(CONFIG_SUN6I)
diff --git a/boards.cfg b/boards.cfg
index b0335de..c50acaa 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -386,7 +386,7 @@ Active  arm         armv7          sunxi       -            
   sunxi
 Active  arm         armv7          sunxi       -               sunxi           
    Coby_MID9742                         sun4i:COBY_MID9742,SPL                 
                                                                                
           -
 Active  arm         armv7          sunxi       -               sunxi           
    Iteaduino_Plus_A10                           
sun4i:ITEADA10,SPL,SUNXI_EMAC,STATUSLED=244,STATUSLED1=245                      
                                                -
 Active  arm         armv7          sunxi       -               sunxi           
    Iteaduino_Plus_A20                           
sun7i:ITEADA20,SPL,SUNXI_EMAC,STATUSLED=244,STATUSLED1=245                      
                                                -
-Active  arm         armv7          sunxi       -               sunxi           
    Colombus                             sun6i:COLOMBUS,AXP221_POWER            
                                                                                
           -
+Active  arm         armv7          sunxi       -               sunxi           
    Colombus                             
sun6i:COLOMBUS,AXP221_POWER,ENABLE_DLDO1_POWER                                  
                                                  -
 Active  arm         armv7          sunxi       -               sunxi           
    Cubieboard                           
sun4i:CUBIEBOARD,SPL,SUNXI_EMAC,STATUSLED=244,STATUSLED1=245                    
                                                  -
 Active  arm         armv7          sunxi       -               sunxi           
    Cubieboard2                          
sun7i:CUBIEBOARD2,SPL,SUNXI_GMAC,STATUSLED=244,STATUSLED1=245,FAST_MBUS         
                                                  -
 Active  arm         armv7          sunxi       -               sunxi           
    Cubieboard2_FEL                      
sun7i:CUBIEBOARD2,SPL_FEL,SUNXI_GMAC,STATUSLED=244,STATUSLED1=245,FAST_MBUS     
                                                  -
diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index a17b8a8..6ce6a1b 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -34,6 +34,23 @@ int axp221_set_dcdc5(unsigned int mvolt)
        return p2wi_write(AXP221_DCDC5_CTRL, (mvolt - 600) / 20);
 }
 
+int axp221_set_dldo1(unsigned int mvolt)
+{
+       int ret;
+       u8 val;
+
+       ret = p2wi_write(AXP221_DLDO1_CTRL, (mvolt - 700) / 100);
+       if (ret)
+               return ret;
+
+       ret = p2wi_read(AXP221_OUTPUT_CTRL2, &val);
+       if (ret)
+               return ret;
+
+       val |= 1 << 3;
+       return p2wi_write(AXP221_OUTPUT_CTRL2, val);
+}
+
 int axp221_init(void)
 {
        u8 axp_chip_id;
diff --git a/include/axp221.h b/include/axp221.h
index 497134c..c3a6cf4 100644
--- a/include/axp221.h
+++ b/include/axp221.h
@@ -11,6 +11,10 @@
 #define AXP221_INIT_DATA 0x3e
 
 #define AXP221_CHIP_ID         0x03
+#define AXP221_OUTPUT_CTRL1    0x10
+#define AXP221_OUTPUT_CTRL2    0x12
+#define AXP221_OUTPUT_CTRL3    0x13
+#define AXP221_DLDO1_CTRL      0x15
 #define AXP221_DCDC1_CTRL      0x21
 #define AXP221_DCDC2_CTRL      0x22
 #define AXP221_DCDC3_CTRL      0x23
@@ -22,4 +26,5 @@ 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_init(void);
-- 
1.9.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to