[U-Boot] [PATCH v2 15/23] sunxi: A64: use H3 DRAM initialization code for A64

Simon Glass sjg at chromium.org
Sat Dec 17 23:48:15 CET 2016


Hi Andre,

On 16 December 2016 at 10:30, Andre Przywara <andre.przywara at arm.com> wrote:
> Hi Simon,
>
> On 05/12/16 06:26, Simon Glass wrote:
>> Hi Andre,
>>
>> On 4 December 2016 at 18:52, Andre Przywara <andre.przywara at arm.com> wrote:
>>> From: Jens Kuske <jenskuske at gmail.com>
>>>
>>> The A64 DRAM controller is very similar to the H3 one,
>>> so the code can be reused with some small changes.
>>
>> Yes but it makes the code a mess. Can you avoid putting #iifdefs everywhere?
>
> Sure ...
>
>> Since it is a static function I wonder if you can instead use a
>> function parameter which defines the chip to support, and the compiler
>> will eliminate the unused code?
>
> I like that idea. Actually I went ahead and converted the file to this
> approach and it looks much nicer, especially since I added support for a
> third DRAM controller on top.
> Also it opens the doors to potentially serve multiple variants in one
> binary (one day ...)
>
> I took the freedom to use the Allwinner SoCID (a 16-bit value (mostly)
> unique to a certain SoC) as the variant identifier.
> That doesn't make any difference for this passing-to-static-functions
> case, but avoids inventing identifiers and can be easily reused with
> auto-detection.
>

OK great I'm pleased it worked out.

Regards,
Simon


More information about the U-Boot mailing list