From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Date: Mon, 02 Mar 2015 13:25:32 +0100 Subject: [U-Boot] Basic A33 support including dram init available in my personal repo In-Reply-To: References: <54F43A7F.4020803@redhat.com> Message-ID: <54F456BC.8030303@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, On 02-03-15 12:51, Vishnu Patekar wrote: > Hello Hans, > Thank you for the comments. > > On Mon, Mar 2, 2015 at 3:55 PM, Hans de Goede 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? IANAL, but linking non GPL binaries into a GPL binary is not good. But in the end it does not matter even if Allwinnner does not honor the GPL, we must still honor their copyrights, this are 2 orthogonal (independent) issues. > I'll see how can I re-use the A31 dram init code and get it work for A33. Thanks! Regards, Hans