[PATCH 2/9] ARM: sunxi: quirk support

Maxime Ripard
2014-08-04T19:32:59Z

On Sun, Aug 03, 2014 at 06:37:31PM -0300, Emilio L?pez wrote:
> Hi Maxime,
>
> El 03/08/14 a las 09:42, Maxime Ripard escibi?:
> >On Thu, Jul 31, 2014 at 06:28:05PM -0300, Emilio L?pez wrote:
> >>Currently, some hardware revisions of sunxi SoCs need special care on
> >>some blocks because of hardware differences and/or bugs. Unfortunately,
> >>it is unfeasible to account for these issues directly when writing the
> >>device tree, as SoC revision can vary between different units of the
> >>same device. This commit introduces a place to adjust DT compatibles
> >>as needed to work around said issues before devices are probed. To
> >>demonstrate usage, two quirks are added for the PLL2 and audio codec
> >>on sun4i.
> >>
> >>Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
> >>---
> (...)
> >>+static int __init sunxi_apply_quirks(void)
> >>+{
> >>+ if (of_machine_is_compatible("allwinner,sun4i-a10")) {
> >>+ sun4i_pll2_quirk();
> >>+ sun4i_codec_quirk();
> >>+ }
> >>+
> >>+ return 0;
> >>+}
> >>+postcore_initcall(sunxi_apply_quirks)
> >
> >Have you tested it? My guess is that it wolud have to run *much*
> >sooner, before of_platform_populate to be effective.
>
> I have, I was able to break my UART with it :)
>
> of_platform_populate() is called from arch/arm/kernel/setup.c on
> arch_initcall. From include/linux/init.h
>
> ...
> #define postcore_initcall(fn) __define_initcall(fn, 2)
> #define postcore_initcall_sync(fn) __define_initcall(fn, 2s)
> #define arch_initcall(fn) __define_initcall(fn, 3)
> ...
>
> So it should be fine.

Hmmm, right.

I was under the impression it was done sooner, but I was wrong,
obviously.

Still, the machine init callback has the advantage of being run only
on the current machine, not in every case.

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140804/6657bbdd/attachment.sig>