[U-Boot] [PATCH 04/10] sunxi: power: enabled support for axp818

Vishnu Patekar vishnupatekar0510 at gmail.com
Sat Nov 14 19:43:42 CET 2015


Hello,

On Sat, Nov 14, 2015 at 1:24 AM, Hans de Goede <hdegoede at redhat.com> wrote:
> Hi,
>
>
> On 12-11-15 19:09, Vishnu Patekar wrote:
>>
>> Enabled support for AXP818 in SPL and u-boot.
>> DCDC1, DCDC2, DCDC3 and DCSC5 are enabled.
>>
>> Signed-off-by: Vishnu Patekar <vishnupatekar0510 at gmail.com>
>> ---
>>   arch/arm/cpu/armv7/sunxi/Makefile   |  1 +
>>   arch/arm/cpu/armv7/sunxi/pmic_bus.c | 15 +++++++++++++++
>>   board/sunxi/board.c                 |  8 ++++++++
>>   include/configs/sunxi-common.h      |  2 +-
>>   4 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/cpu/armv7/sunxi/Makefile
>> b/arch/arm/cpu/armv7/sunxi/Makefile
>> index 459d5d8..929a933 100644
>> --- a/arch/arm/cpu/armv7/sunxi/Makefile
>> +++ b/arch/arm/cpu/armv7/sunxi/Makefile
>> @@ -33,6 +33,7 @@ obj-$(CONFIG_MACH_SUN6I)      += tzpc.o
>>   obj-$(CONFIG_AXP152_POWER)    += pmic_bus.o
>>   obj-$(CONFIG_AXP209_POWER)    += pmic_bus.o
>>   obj-$(CONFIG_AXP221_POWER)    += pmic_bus.o
>> +obj-$(CONFIG_AXP818_POWER)     += pmic_bus.o
>>
>>   ifndef CONFIG_SPL_BUILD
>>   ifdef CONFIG_ARMV7_PSCI
>> diff --git a/arch/arm/cpu/armv7/sunxi/pmic_bus.c
>> b/arch/arm/cpu/armv7/sunxi/pmic_bus.c
>> index 9e05127..838831d 100644
>> --- a/arch/arm/cpu/armv7/sunxi/pmic_bus.c
>> +++ b/arch/arm/cpu/armv7/sunxi/pmic_bus.c
>> @@ -26,6 +26,9 @@
>>   #define AXP223_DEVICE_ADDR            0x3a3
>>   #define AXP223_RUNTIME_ADDR           0x2d
>>
>> +#define AXP818_DEVICE_ADDR             0x3a3
>> +#define AXP818_RUNTIME_ADDR            0x2d
>> +
>
>
> These are exactly the same, please just add a comment that the
> AXP818 addresses are the same as the AXP223 ones instead
> of adding new defines.
Okie, It's going to be so many ifdefs as all voltages are not yet implemented.

>
>
>>   int pmic_bus_init(void)
>>   {
>>         /* This cannot be 0 because it is used in SPL before BSS is ready
>> */
>> @@ -49,6 +52,14 @@ int pmic_bus_init(void)
>>   # endif
>>         if (ret)
>>                 return ret;
>> +#elif defined CONFIG_AXP818_POWER
>
>
> And instead of this #elif make the #if above:
>
> #elif defined CONFIG_AXP223_POWER || defined CONFIG_AXP818_POWER
>
>> +       ret = rsb_init();
>> +       if (ret)
>> +               return ret;
>> +
>> +       ret = rsb_set_device_address(AXP818_DEVICE_ADDR,
>> AXP818_RUNTIME_ADDR);
>> +       if (ret)
>> +               return ret;
>>   #endif
>>
>>         needs_init = 0;
>> @@ -67,6 +78,8 @@ int pmic_bus_read(u8 reg, u8 *data)
>>   # else
>>         return rsb_read(AXP223_RUNTIME_ADDR, reg, data);
>>   # endif
>> +#elif defined CONFIG_AXP818_POWER
>> +       return rsb_read(AXP818_RUNTIME_ADDR, reg, data);
>>   #endif
>>   }
>>
>> @@ -82,6 +95,8 @@ int pmic_bus_write(u8 reg, u8 data)
>>   # else
>>         return rsb_write(AXP223_RUNTIME_ADDR, reg, data);
>>   # endif
>> +#elif CONFIG_AXP818_POWER
>> +       return rsb_write(AXP818_RUNTIME_ADDR, reg, data);
>>   #endif
>>   }
>>
>
> And idem for all the other functions.
okie.
>
>> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
>> index 6ac398c..ebfa94e 100644
>> --- a/board/sunxi/board.c
>> +++ b/board/sunxi/board.c
>> @@ -430,6 +430,14 @@ void sunxi_board_init(void)
>>         int power_failed = 0;
>>         unsigned long ramsize;
>>
>> +#if defined CONFIG_AXP818_POWER
>> +       power_failed = axp_init();
>> +       power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
>> +       power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
>> +       power_failed |= axp_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
>> +       power_failed |= axp_set_dcdc5(CONFIG_AXP_DCDC5_VOLT);
>> +#endif
>> +
>>   #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER ||
>> defined CONFIG_AXP221_POWER
>>         power_failed = axp_init();
>>
>
> Please do not add this AXP818 specific block, instead modify the block below
> to work for the 818.
>
>> diff --git a/include/configs/sunxi-common.h
>> b/include/configs/sunxi-common.h
>> index ddcfe94..61af897 100644
>> --- a/include/configs/sunxi-common.h
>> +++ b/include/configs/sunxi-common.h
>> @@ -243,7 +243,7 @@ extern int soft_i2c_gpio_scl;
>>   #endif
>>
>>   /* PMU */
>> -#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined
>> CONFIG_AXP221_POWER
>> +#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined
>> CONFIG_AXP221_POWER || defined CONFIG_AXP818_POWER
>>   #define CONFIG_SPL_POWER_SUPPORT
>>   #endif
>>
>>
>
> Regards,
>
> Hans


More information about the U-Boot mailing list