Skip to content

Add support for TH1520 SoC #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 49 commits into
base: main
Choose a base branch
from

Conversation

kanakshilledar
Copy link
Contributor

TH1520 is a RISCV SoC from Alibaba T-Head. It has four C910 cores.

Few boards using this SoC are:

  • Beagle V Ahead
  • Milk-V Meles
  • LicheePi 4A

@orangecms
Copy link
Contributor

@orangecms
Copy link
Contributor

We're now at

 TrainedVREFDQ_RANK0  : 1a
 TrainedVREFDQ_RANK1  : 1a
 RxClkDly_Margin_A0   : 0d
 VrefDac_Margin_A0    : 19
 TxDqDly_Margin_A0    : 0b
 DeviceVref_Margin_A0 : 1a
 RxClkDly_Margin_A1   : 0c
 VrefDac_Margin_A1    : 18
 TxDqDly_Margin_A1    : 0b
 DeviceVref_Margin_A1 : 1a
 TrainedVREFDQ_RANK0  : 18
 TrainedVREFDQ_RANK1  : 18
 RxClkDly_Margin_A0   : 0c
 VrefDac_Margin_A0    : 17
 TxDqDly_Margin_A0    : 0b
 DeviceVref_Margin_A0 : 18
 RxClkDly_Margin_A1   : 0c
 VrefDac_Margin_A1    : 17
 TxDqDly_Margin_A1    : 0c
 DeviceVref_Margin_A1 : 18
 [+] lp4_phy_train1d2d Complete...

@kanakshilledar
Copy link
Contributor Author

We are currently at
WIP

DeviceVref_Margin_A1 : 18
PHY0 P Code 0
PHY0 N Code 0
PllCtrl1 is 0
PllCtrl2 is 0
PllCtrl4 is 0
PllTestmode is 0
Trained DB0 DFIMRL is 0
Trained DB1 DFIMRL is 0
Trained DB2 DFIMRL is 0
Trained DB3 DFIMRL is 0
DQS Preamble is 0
ARdPtrInitVal is 0
PHY0 DB0 VREF        is 0
PHY0 DB1 VREF        is 0
PHY0 DB2 VREF        is 0
PHY0 DB3 VREF        is 0
R0 TxDQSDly        is 0
R0 TxDQSDly        is 0
R1 TxDQSDly        is 0
R1 TxDQSDly        is 0
PHY1 P Code 0
PHY1 N Code 0
[+] lp4_phy_train1d2d Complete...

@kanakshilledar kanakshilledar force-pushed the add_th1520 branch 3 times, most recently from 9cb31bc to f4e38b9 Compare October 5, 2024 10:49
Copy link

codecov bot commented Oct 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.

Project coverage is 0.20%. Comparing base (37a5e71) to head (9f5eff1).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/mainboard/milk-v/meles/bt0/src/uart.rs 0.00% 21 Missing ⚠️
src/mainboard/milk-v/meles/bt0/src/main.rs 0.00% 12 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #756      +/-   ##
========================================
- Coverage   0.21%   0.20%   -0.01%     
========================================
  Files         22      25       +3     
  Lines        931     966      +35     
========================================
  Hits           2       2              
- Misses       929     964      +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@orangecms
Copy link
Contributor

https://mastodon.social/@CyReVolt/113614408539014507

DRAM test now passes :)

@orangecms
Copy link
Contributor

More extensive tests are showing some issues, still.
https://mastodon.social/@CyReVolt/113617971468084828

orangecms and others added 16 commits April 23, 2025 15:03
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
this commit has a few functions which help in dram initialization.
this is currently WORK IN PROGRESS.

added clock initialization `sys_clk_config()`.
board not yet tested after clock initialization.

on testing on the board. the board seems to crash after entering the
`pll_config()` function. exactly at L#166.

more debugging required.

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
audio and other clocks were removed from sys_clk_config()
fixed the board crashing in the pll_config() and deassert_pwrok_apb()
due to some of the register write operations used a different method for
writing the values which was missed durin the initial porting.

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
TODO: drop this commit in future

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
added pre training configs and setup. created a helper function
to write 16 bit data required from writing to some registers.

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
dram training data is added along with a few helper functions
output of phase1 training matches to the uboot data.
phase2 training started but the output is 0 when i try to
print some of the values from the registers. the uboot code
prints some data corresponding to those registers but oreboot
prints nothing just 0 for all.

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
changed the default code formatter in Rust Rover to rustfmt
also changed the file format from CRLF to LF

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
This looks like a dummy in the original C code, though reading
from MMIO registers may actually have side effects in hardware.

Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
If you really want to, pass your custom command:
make FASTBOOT='sudo fastboot' run

Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
kanakshilledar and others added 23 commits April 23, 2025 15:03
this function was yet to be implemented required for `lpddr_init()`
still the DRAM test is not passing :(

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
…_DCH1

Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
…rface and ctrl_en

Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
clock seems to be an issue which is causing the board to crash after
dram init during the write operation. this patch adds remaining clocks
were removed previously. these are mainly the audio/gpu/npu subsys
clocks.

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
This reverts commit 6ee08e21aee47989341563eca3bc2fad342da55d.

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Daniel Maslowski <info@orangecms.org>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
@kanakshilledar kanakshilledar force-pushed the add_th1520 branch 2 times, most recently from 2071087 to e997237 Compare April 23, 2025 11:07
switch to DRAM_BASE_0 instead of DRAM_BASE_4

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
chaged the training data to match with our type of memory.
eariler we were not using the training data for dbi_off memory

changed the PMP register addresses.

Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy