apritzel / u-boot

various u-boot patches
24 stars 13 forks source link

Question about using lpdd3/ddr4 on h616! #9

Open sputnik2019 opened 2 years ago

sputnik2019 commented 2 years ago

We want to use lpddr/ddr4 on h616, but the mainline u-boot does not support it, is there any other way than using sunxi-uboot?

jernejsk commented 2 years ago

Usually you would work together with Allwinner to determine correct DRAM parameters for your board. Those parameters should allow to make working BSP based images. Once that's done, mainline U-Boot can re-use them and if necessary, reverse engineer additional code, to make it work.

sputnik2019 commented 2 years ago

We use the SDK provided by Allwinner, which can use ddr4 normally, but how can we transplant these parameters to the mainline u-boot?dump all register?

jernejsk commented 2 years ago

Well, in this case, some reverse engineering of AW blob is also needed, because there is no H616 DDR4 support in mainline yet. I'm original author of mainline DDR3 driver for H616, so I can help you with that. Contact me on e-mail in profile for further information.

apritzel commented 2 years ago

Yes, dumping the registers would be a start, from a quick check at the driver it's probably (at the U-Boot prompt): => md.l 0x047FA000 0x141 => md.l 0x047FB000 0xca => md.l 0x04800000 0x2d8 But please keep in mind that DDR4 is somewhat different, so probably requires a different initialisation sequence, which is impossible to deduct from just the controller register dump. If you have a boot0 binary, that would help, but is still quite a lot of work, and realistically requires access to the hardware for testing and verification.

sputnik2019 commented 2 years ago

Sorry to reply to you after so long, we encountered some problems about h313/h616.Allwinnertech recently upgraded h313/h616 (BA->BB version) hardware. We found that the original ac200 was upgraded to ac300! One of the network cards of our hardware did not work (using jernejsk the u-boot patch), and now we are working with fae to fix this problem, but we have not solved this problem yet because Allwinnertech did not provide detailed information there! After this problem is fixed, the next step we are ready to debug the ddr4 module! Thank you for your help, thank you very much!

sputnik2019 commented 2 years ago

@jernejsk @apritzel We dumping the registers! We used ddr4 16bit one die!log: ddr3_720(mainline).txt ddr4参数.txt h313_ddr4 _16bit_BB_720mhz.txt h313_ddr4 _16bit_BB_792mhz.txt sys_config.fex.txt

sputnik2019 commented 2 years ago

@jernejsk We disassemble boot0.elf by ida, refer to the mainline initialization of ddr3. Now ddr4 can work fine on h313, thanks again for the tip! Next we will start to solve the problem of ac300! thx

jernejsk commented 2 years ago

@sputnik2019 I didn't have much time to help you, but it seems you figured it on your own. That's always a great thing to see! Do you plan to upstream support for your board? It would be great to have official upstream support for ddr4 board.

iuncuim commented 2 years ago

@sputnik2019 Could you share your solution to the ddr4 issue?

sputnik2019 commented 2 years ago

my mail:195375690@qq.com
my board is h313 and use 16bit ddr4!First you should need to run boot0 (uboot) on your board,and => md.l 0x047FA000 0x141 => md.l 0x047FB000 0xca => md.l 0x04800000 0x2d8

sputnik2019 commented 2 years ago

Thanks to jernejsk's mainline uboot source code, we only need to modify it on this basis to use it (at least I am)!!

You just need to modify a few jump branches on the basis of the mainline uboot, and compare which 3 sets of registers and modify it according to the source code of boot0! You can use the ida tool to disassemble the boot0 source code (ida open boot0.elf press the F5 button to see the C source code, parameter a1 is your sys_config.fex in the lpddr4 parameter) If you see the source code I believe you should soon make your lpddr4 work. There's a difference between what I'm using ddr4 not lpddr4, so you can't use my source code boot0 elf

smarthobee612 commented 1 year ago

感谢 jernejsk 的主线 uboot 源代码,我们只需要在此基础上修改它就可以使用它(至少我是)!!

你只需要在主线uboot的基础上修改几个跳转分支,对比哪3组寄存器,根据boot0的源码进行修改!你可以使用 ida 工具反汇编 boot0 源代码(ida 打开 boot0.elf 按 F5 按钮查看 C 源代码,参数 a1 是 lpddr4 参数中的 sys_config.fex)如果你看到源代码,我相信你应该很快就会让你的 lpddr4 工作。我使用的 ddr4 和 lpddr4 是有区别的,所以你不能使用我的源代码 boot0 elf

我最近也在使用全志H616为自己设计一款便携开发板,想使用LPDDR4/DDR4颗粒,使用你修改U-boot就可以支持LPDDR4/DDR4颗粒是吗?还有最大支持的4GB是吗?谢谢!

iuncuim commented 1 year ago

@smarthobee612, I made initial support for LPDDR4 (you can look u-boot repository in my profile), and @sputnik2019 have something for DDR4. So anything is possible.

P.S.: Next time will be better if you duplicate your request in English (even with a translator)

smarthobee612 commented 1 year ago

ok,thank you for your reply!

xobs commented 1 year ago

I see this Issue is still open, even though there is a comment on initial support being added. Is there still more work to do, and if so how much?

Andre-ARM commented 1 year ago

@xobs please keep in mind that U-Boot uses a mailing list development approach, so (personal!) github repos are merely a way to contact developers, but not in anyway used to track actual development. That being said: LPDDR3 support has been merged some days ago, and LPDDR4 support has been posted on the list: https://lore.kernel.org/u-boot/20230729111331.173768-2-iuncuim@gmail.com/ Feel free to test and reply on the list, to accelerate the upstreaming process.