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

From: [email-masked] (Emilio López)
Date: Sun, 03 Aug 2014 18:37:31 -0300

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 <[email-masked]>
>> ---
(...)
>> +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.

Cheers,

Emilio