From: Ian Campbell <ijc@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/17] sunxi: axp221: Protect axp221_init against multiple calls
Date: Tue, 13 Jan 2015 18:49:03 +0000 [thread overview]
Message-ID: <1421174943.18322.0.camel@hellion.org.uk> (raw)
In-Reply-To: <1421004895-10896-2-git-send-email-hdegoede@redhat.com>
On Sun, 2015-01-11 at 20:34 +0100, Hans de Goede wrote:
> The voltage setting code knows it needs to call axp221_init before calling
> the various voltage setting functions.
>
> But users of axp utility functions like axp221_get_sid() do not know this,
> so the utility functions always call axp221_init() to ensure that the
> p2wi / rsb setup magic has been done.
>
> Since doing this repeatedly is quite expensive, add a check to axp221_init
> so that it only does the initialization once.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
> ---
> drivers/power/axp221.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
> index 1fda19a..728727b 100644
> --- a/drivers/power/axp221.c
> +++ b/drivers/power/axp221.c
> @@ -304,9 +304,14 @@ int axp221_set_aldo3(unsigned int mvolt)
>
> int axp221_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;
> @@ -318,6 +323,7 @@ int axp221_init(void)
> if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17))
> return -ENODEV;
>
> + needs_init = 0;
> return 0;
> }
>
next prev parent reply other threads:[~2015-01-13 18:49 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-11 19:34 [U-Boot] [PATCH 00/17] sunxi: musb otg controller support Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 01/17] sunxi: axp221: Protect axp221_init against multiple calls Hans de Goede
2015-01-13 18:49 ` Ian Campbell [this message]
2015-01-14 8:21 ` Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 02/17] sunxi: axp221: Add support for controlling the drivebus pin Hans de Goede
2015-01-13 18:52 ` Ian Campbell
2015-01-11 19:34 ` [U-Boot] [PATCH 03/17] sunxi: Move usb-controller init code out of ehci-sunxi.c for reuse for otg Hans de Goede
2015-01-13 18:55 ` Ian Campbell
2015-01-11 19:34 ` [U-Boot] [PATCH 04/17] sunxi: usbc: Add support for usb0 to the common usbc code Hans de Goede
2015-01-13 18:57 ` Ian Campbell
2015-01-11 19:34 ` [U-Boot] [PATCH 05/17] sunxi: usbc: Add support for usb-vbus0 controller by axp drivebus pin Hans de Goede
2015-01-13 18:58 ` Ian Campbell
2015-01-11 19:34 ` [U-Boot] [PATCH 06/17] usb: Fix usb_kbd_deregister when console-muxing is used Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 07/17] usb: Add an interval parameter to create_int_queue Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 08/17] usb: Do not log an error when no devices is plugged into a root-hub-less hcd Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 09/17] musb-new: Add register defines for different reg layout on sunxi Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 10/17] musb-new: Add sunxi musb controller support Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 11/17] musb-new: Use time based timeouts rather then cpu-cycles based timeouts Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 12/17] musb-new: Fix interrupt transfers not working Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 13/17] musb-new: Fix reset sequence when in host mode Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 14/17] musb-new: Properly remove a transfer from the schedule on timeout Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 15/17] musb-new: Add urb and hep parameters to construct_urb Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 16/17] musb-new: Add interrupt queue support Hans de Goede
2015-01-11 19:34 ` [U-Boot] [PATCH 17/17] sunxi: Hookup OTG USB controller support Hans de Goede
2015-01-13 19:59 ` Ian Campbell
2015-01-14 7:48 ` Hans de Goede
2015-01-31 2:54 ` Siarhei Siamashka
2015-02-09 3:54 ` Siarhei Siamashka
2015-02-09 22:10 ` Michal Suchanek
2015-02-10 8:24 ` Hans de Goede
2015-01-12 2:59 ` [U-Boot] [PATCH 00/17] sunxi: musb otg " Marek Vasut
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=1421174943.18322.0.camel@hellion.org.uk \
--to=ijc@hellion.org.uk \
--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