[U-Boot] [linux-sunxi] Re: Basic A33 support including dram init available in my personal repo

Hans de Goede hdegoede at redhat.com
Wed Mar 4 15:06:48 CET 2015


Hi,

On 04-03-15 13:33, Siarhei Siamashka wrote:
> On Mon, 2 Mar 2015 17:21:48 +0530
> Vishnu Patekar <vishnupatekar0510 at gmail.com> wrote:
>
>> Hello Hans,
>> Thank you for the comments.
>>
>> On Mon, Mar 2, 2015 at 3:55 PM, Hans de Goede <hdegoede at redhat.com> wrote:
>>
>>> Hi,
>>>
>>> On 01-03-15 19:42, Vishnu Patekar wrote:
>>>
>>>> Allwinner A33 tablets comes with the libdram binary, fortunately I've
>>>> found the libdram code at
>>>> https://github.com/realthunder/a33_bootloader/
>>>> tree/master/basic_loader/bsp/bsp_for_a67.
>>>>
>>>
>>> Ah, that is both good and bad...
>>
>> Now, for me good part is over, now it's just bad.
>>
>>>
>>>
>>>   I've integrated it with mainline u-boot, still lot to do to post it to
>>>> upstream
>>>>
>>>
>>> Integrated sounds as if you've copied pieces of code from the bsp code
>>> you've found
>>> into mainline u-boot. That is a big no no (this the bad part). AFAIK the
>>> bsp code
>>> does not come with a GPL license header, and Allwinner does not want to
>>> release
>>> these bits under the GPL for whatever reasons, a lot can be said about
>>> this, but
>>> in the end currently the bsp code is not GPL licensed, so we cannot use it
>>> / copy
>>> from it. There can be no discussion on this, when you're submitting this
>>> upstream
>>> you must not have any literal copied code in the patch you're sending
>>> upstream.
>>>
>>> You can use non copyrightable information from the bsp sources like
>>> register
>>> names and the initialization algorithm (IANAL), but you must 100% write
>>> your own
>>> code!
>>>
>>> I've been working on A33 dram support too, without any source code access,
>>> instead
>>> I've been tracing what the boot0 machine code does and going from there.
>>> What I've
>>> sofar is that the code first inits the DRAM PLL / cmu dram registers, it
>>> seems that
>>> the A33 has 2 dram pll-s and that one of the dram_para fields configures
>>> which pll
>>> to use and configures some sigma-delta pattern to reduce rf interference,
>>> at least
>>> on my A33 tablet the code seems to want to pick the new / second dram pll.
>>> But I
>>> see no reason why the first one should not work, so for now if I were you
>>> I would
>>> just use the A23 dram pll / cmu setup code modified to set the one or 2
>>> extra
>>> reset / enable bits the A33 has, but still using the old / first dram pll,
>>> we can
>>> always add support for the new one later.
>>>
>>> Then the boot0 code calculates a load of timing parameters and writes
>>> these to
>>> registers. I've already written my own C-code reproducing the init
>>> algorithm from
>>> boot0 for this (attached) this is GPL code and you should be able to use
>>> this to
>>> replace a chunk of the bsp code. Note that I found 2 code paths based on a
>>> tpr13
>>> bit (iirc) one for autoconfig, and one for reading values from the tpr
>>> dram_para
>>> values, my code supports only autoconfig, you can add a printf to warn if
>>> manual
>>> config is requested and still keep using autoconfig. The same goes for any
>>> other
>>> code paths were there is both a manual and an auto option, look at what
>>> actual
>>> shipped tablets are using, only support that and print a warning for the
>>> other
>>> case, were possible always use autoconfig.
>>>
>>> After this boot0 does more stuff, but this is as far as I've gotten and
>>> currently I've other priorities.
>>>
>>> If I were you I would start with the existing dram_sun6i.c from
>>> upstream u-boot, as the A33 DRAM controller seems to be closest to the
>>> A31 one, then add in the dram_sun8i.c pll init code, and the timing
>>> stuff which I've already written, and then see where the initialization
>>> algorithm is different for the A33 and modify the dram_sun6i.c code to
>>> match what is needed to get the A33 going, if extra code is needed you
>>> MUST write NEW code.
>>>
>>> When you submit support for this upstream you must include a Signed-off-by,
>>> and thereby you are declaring that the code is all your own and that you've
>>> the right to submit this code under the GPL license, this means that there
>>> must be absolutely no copied code in your upstream patch submission!
>>>
>>> Also see:
>>>
>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/
>>> linux.git/tree/Documentation/SubmittingPatches
>>>
>>> Section "11) Sign your work
>>>
>>>   Basic A33 support including dram init available in my personal repo
>>>> https://github.com/vishnupatekar/u-boot-sunxi/tree/a33-dram
>>>>
>>>> I could able to boot u-boot over fel, and get u-boot command prompt on
>>>> microSD pins which are multiplexed with UART0.
>>>>
>>>> The device page for A33 tablet which I've is here:
>>>> http://linux-sunxi.org/Softwinner_astar-rda
>>>>
>>>
>>> Thanks for your work on this, and sorry if I sound a bit harsh above, but I
>>> really need to be strict about not allowing any non GPL code into u-boot.
>>>
>>
>> No, You've not been harsh, instead you've been helpful in this case.
>>
>> Thank you for clearing my doubts. I was under impression that if we keep
>> the copyright header, it can be accepted.
>>
>> BTW, libdram as binary and used in u-boot is also GPL violation, right?
>>
>> I'll see how can I re-use the A31 dram init code and get it work for A33.
>
> I see that this discussion has unfortunately derailed. Vishnu, please
> don't take this "MUST" and "NEW code" statements from Hans as a strict
> requirement.
>
> We only need Allwinner to re-license these pieces of A33 dram code
> under GPL. This even is not something really new and had been already
> done for the A10 dram code before, at the time when Tom Cubie had been
> an Allwinner employee and took the initiative to communicate with
> the free software community. As a result, we got the license status
> clarified for a lot of sources from both the bootloader and the
> linux kernel.
>
> Now David Lanzendörfer (added to CC) is trying to basically do the
> same job as Tom Cubie did before. And seems like Allwinner is actually
> interested in having support for all the new SoC variants the in the
> mainline U-Boot:
>
>      http://irclog.whitequark.org/linux-sunxi/2015-02-14#11841248
>      http://irclog.whitequark.org/linux-sunxi/2015-02-14#11838181
>
> Based on the irc discussion logs, I was under impression that Vishnu
> was already in contact with the relevant people from Allwinner. And
> that they actually liked his A33 bring-up work.
>
> Also please have a look at how a similar "All rights reserved" issue
> with the NAND source code got recently solved:
>
>      https://github.com/allwinner-zh/bootloader/issues/4
>
> To sum it up. Allwinner really has nothing to lose by re-licensing
> the A33 dram code to make it U-Boot compatible. And the same would
> be very much appreciated for the original Allwinner's A23 and A80
> dram code too.

True, if Allwinner is willing to relicense their A33 dram init code
that is fine too. But until that actually happens my "MUST" and "NEW code"
statements are very much strict requirements.

Regards,

Hans


>


More information about the U-Boot mailing list