Re: [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx> 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@xxxxxxxxx>
> > > ---
> >
> > [...]
> >
> > > +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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux