mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <r.hieber@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 07/14] ARM: MXS: refactor mx2*_power_init source configuration
Date: Mon, 13 Aug 2018 15:04:38 +0200	[thread overview]
Message-ID: <20180813130438.m44vjjte3qg53oyn@pengutronix.de> (raw)
In-Reply-To: <CAHQ1cqECyzAkhA9ULmQDtQ=EUgszYeU-r7s6LNbhFdk4fhV_3w@mail.gmail.com>

On Fri, Aug 10, 2018 at 12:29:07PM -0700, Andrey Smirnov wrote:
> On Fri, Aug 10, 2018 at 9:36 AM Roland Hieber <r.hieber@pengutronix.de> wrote:
> > diff --git a/arch/arm/mach-mxs/power-init.c b/arch/arm/mach-mxs/power-init.c
> > index 595b51c5ba..a07ff9d676 100644
> > --- a/arch/arm/mach-mxs/power-init.c
> > +++ b/arch/arm/mach-mxs/power-init.c
> > @@ -24,21 +24,7 @@
> >  #include <mach/regs-rtc.h>
> >  #include <mach/regs-lradc.h>
> >
> > -/*
> > - * has_battery - true when this board has a battery.
> > - */
> > -static int has_battery;
> > -
> > -/*
> > - * use_battery_input - true when this board is supplied from the
> > - * battery input, but has a DC source instead of a real battery
> > - */
> > -static int use_battery_input;
> > -
> > -/*
> > - * use_5v_input - true when this board can use the 5V input
> > - */
> > -static int use_5v_input;
> > +static int power_config;
> 
> I might be missing something, so take this with a grain of salt. It
> seems like if you change this variable to be "power_use" and
> initialize it accordingly (maybe using a new helper function
> mxs_power_use() that does the bitmasking) you should be able to cut
> down on amount of (power_config & __POWER_USE_MASK) statements you
> have further in the code.

Indeed, that's a good idea! Will send v3 shortly.

> >  static void mxs_power_status(void)
> >  {
> > @@ -514,7 +500,8 @@ static void mxs_power_enable_4p2(void)
> >                 POWER_5VCTRL_HEADROOM_ADJ_MASK,
> >                 0x4 << POWER_5VCTRL_HEADROOM_ADJ_OFFSET);
> >
> > -       if (has_battery || use_battery_input)
> > +       if ((power_config & __POWER_USE_MASK) == POWER_USE_BATTERY ||
> > +           (power_config & __POWER_USE_MASK) == POWER_USE_BATTERY_INPUT)
> >                 dropout_ctrl = POWER_DCDC4P2_DROPOUT_CTRL_SRC_SEL;
> >         else
> >                 dropout_ctrl = POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2;
> > @@ -1182,16 +1169,15 @@ static void mx23_ungate_power(void)
[...]

 - Roland

-- 
Roland Hieber                     | r.hieber@pengutronix.de     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-08-13 13:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 16:34 [PATCH v2 00/14] MXS low-level improvements Roland Hieber
2018-08-10 16:34 ` [PATCH v2 01/14] scripts: mxsimage: Allow unencrypted images Roland Hieber
2018-08-10 16:34 ` [PATCH v2 02/14] images: MXS: allow generation of unencrypted bootstreams Roland Hieber
2018-08-10 16:34 ` [PATCH v2 03/14] ARM: MXS: i.MX28: allow setup of low-voltage SDRAM Roland Hieber
2018-08-10 16:34 ` [PATCH v2 04/14] ARM: MXS: allow configuration of EMI clock prescaler Roland Hieber
2018-08-10 16:34 ` [PATCH v2 05/14] ARM: i.MX28: Add memory size detection Roland Hieber
2018-08-10 16:34 ` [PATCH v2 06/14] ARM: i.MX23: " Roland Hieber
2018-08-10 19:14   ` Andrey Smirnov
2018-08-10 16:34 ` [PATCH v2 07/14] ARM: MXS: refactor mx2*_power_init source configuration Roland Hieber
2018-08-10 19:29   ` Andrey Smirnov
2018-08-13 13:04     ` Roland Hieber [this message]
2018-08-10 16:34 ` [PATCH v2 08/14] ARM: MXS: allow starting from battery input without 4P2 source enabled Roland Hieber
2018-08-10 16:34 ` [PATCH v2 09/14] ARM: MXS: make power levels configurable in mx2*_power_init Roland Hieber
2018-08-10 16:34 ` [PATCH v2 10/14] ARM: MXS: fix VDDx brownout setup logic Roland Hieber
2018-08-10 16:34 ` [PATCH v2 11/14] ARM: MXS: make VDDx brownout setup more understandable Roland Hieber
2018-08-10 16:34 ` [PATCH v2 12/14] ARM: MXS: mxs_power_status: use less magic values Roland Hieber
2018-08-10 16:34 ` [PATCH v2 13/14] ARM: MXS: mxs_power_status: align output Roland Hieber
2018-08-10 16:35 ` [PATCH v2 14/14] Documentation: MXS: general update and improvements Roland Hieber

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=20180813130438.m44vjjte3qg53oyn@pengutronix.de \
    --to=r.hieber@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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