mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable
Date: Wed, 20 Jun 2018 09:16:41 +0200	[thread overview]
Message-ID: <20180620071641.ugore3xr72emxu6t@pengutronix.de> (raw)
In-Reply-To: <CAHQ1cqHsVi8pftSbWB8dGQm_ZnxUt+ua2CDqiGUF0q3_AGGn2w@mail.gmail.com>

On Tue, Jun 19, 2018 at 09:55:02AM -0700, Andrey Smirnov wrote:
> On Tue, Jun 19, 2018 at 1:51 AM Lucas Stach <l.stach@pengutronix.de> wrote:
> >
> > Am Montag, den 18.06.2018, 22:43 -0700 schrieb Andrey Smirnov:
> > > Some board designs copy i.MX51 Babbadge board's PMIC design and so
> > > require exactly the same initialization. Move correspoding code into a
> > > separate file, add new compatiblity string and make appropriate
> > > Kconfig change to allow other boards to share that code.
> > >
> > > > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > > ---
> >
> > [...]
> >
> > > +static int imx51_babbage_power_init(void)
> > > +{
> > > > +   if (!of_machine_is_compatible("fsl,imx51-babbage") &&
> > > > +       !of_machine_is_compatible("fsl,imx51-babbage-power"))
> > > > +           return 0;
> > > +
> > > > +   mc13xxx_register_init_callback(babbage_power_init);
> >
> > I think it would be better for the board code to explicitly call this
> > setup function. Gating this by DT compatible is a bit too much magic.
> >
> 
> Where do you see magic here? There's nothing unusual in gating board
> initialization code on "compatible", it's used all over the place. And
> having multiple level of compatibility one of the intended use-cases
> of "compatible" property.

Better just export imx51_babbage_power_init (maybe with a better name)
and call it from your board code after having checked the compatible
strings. Putting "fsl,imx51-babbage-power" in your board dts in order to
run some hardware init code for hardware that happens to be the same as
parts of the babbage board, that's indeed magic.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
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-06-20  7:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19  5:43 Andrey Smirnov
2018-06-19  5:43 ` [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board Andrey Smirnov
2018-06-19  8:51   ` Lucas Stach
2018-06-19 11:34     ` Nikita Yushchenko
2018-06-19 12:42       ` Lucas Stach
2018-06-19 16:24     ` Andrey Smirnov
2018-06-19  8:51 ` [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Lucas Stach
2018-06-19 16:55   ` Andrey Smirnov
2018-06-20  7:16     ` Sascha Hauer [this message]
2018-06-20 18:13       ` Andrey Smirnov

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=20180620071641.ugore3xr72emxu6t@pengutronix.de \
    --to=s.hauer@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