public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 04/10] sunxi: power: enabled support for axp818
Date: Fri, 13 Nov 2015 18:24:12 +0100	[thread overview]
Message-ID: <56461CBC.1000503@redhat.com> (raw)
In-Reply-To: <1447351758-10413-5-git-send-email-vishnupatekar0510@gmail.com>

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@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.


>   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.

> 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

  reply	other threads:[~2015-11-13 17:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 18:09 [U-Boot] [PATCH 00/10] basic support for Allwinner A83T SOC Vishnu Patekar
2015-11-12 18:09 ` [U-Boot] [PATCH 01/10] sunxi: Add Machine Support for " Vishnu Patekar
2015-11-13 17:19   ` Hans de Goede
2015-11-14 18:35     ` Vishnu Patekar
2015-11-12 18:09 ` [U-Boot] [PATCH 02/10] sunxi: Add support for UART0 in PB pin group on A83T Vishnu Patekar
2015-11-13 17:19   ` Hans de Goede
2015-11-12 18:09 ` [U-Boot] [PATCH 03/10] sunxi: power: axp818: add support for axp818 driver Vishnu Patekar
2015-11-13 17:21   ` Hans de Goede
2015-11-12 18:09 ` [U-Boot] [PATCH 04/10] sunxi: power: enabled support for axp818 Vishnu Patekar
2015-11-13 17:24   ` Hans de Goede [this message]
2015-11-14 18:43     ` Vishnu Patekar
2015-11-12 18:09 ` [U-Boot] [PATCH 05/10] sunxi: do not enable smp for A83T Vishnu Patekar
2015-11-13 17:24   ` Hans de Goede
2015-11-12 18:09 ` [U-Boot] [PATCH 06/10] sunxi: clk: add basic clocks " Vishnu Patekar
2015-11-13 17:25   ` Hans de Goede
2015-11-14 18:47     ` Vishnu Patekar
2015-11-15  2:10       ` Chen-Yu Tsai
2015-11-12 18:09 ` [U-Boot] [PATCH 07/10] sunxi: Add support for Allwinner A83T DRAM Vishnu Patekar
2015-11-13 17:25   ` Hans de Goede
2015-11-12 18:09 ` [U-Boot] [PATCH 08/10] sunxi: do not include display for A83T Vishnu Patekar
2015-11-13 17:25   ` Hans de Goede
2015-11-12 18:09 ` [U-Boot] [PATCH 09/10] sunxi: dts: sun8i: Add Allwinner A83T dtsi Vishnu Patekar
2015-11-13 17:26   ` Hans de Goede
2015-11-12 18:09 ` [U-Boot] [PATCH 10/10] sunxi: Add suport for A83T HomletV2 Board by Allwinner Vishnu Patekar
2015-11-13 17:27   ` Hans de Goede
2015-11-13 16:52 ` [U-Boot] [PATCH 00/10] basic support for Allwinner A83T SOC Hans de Goede
2015-11-13 17:05   ` Chen-Yu Tsai
2015-11-14 18:32   ` Vishnu Patekar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56461CBC.1000503@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox