Skip to content

Commit

Permalink
common_proc.tcl: Append baseaddr to memory node
Browse files Browse the repository at this point in the history
Update memory node to have base address from reg property.
This will fix the issue of having multiple memory nodes in final dtb
file if board dtsi has one with memory@<baseaddr>.

Signed-off-by: Raju Kumar Pothuraju <[email protected]>
Acked-by: Swagath Gadde <[email protected]>
  • Loading branch information
Rajukumar45 authored and Siva Addepalli committed Dec 12, 2022
1 parent b79c291 commit c103341
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions device_tree/data/common_proc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6408,10 +6408,23 @@ proc add_memory_node {drv_handle} {
set ddr_list "psu_ddr ps7_ddr axi_emc mig_7series psv_ddr"
if {[lsearch -nocase $ddr_list $ddr_ip] >= 0} {
set parent_node [add_or_get_dt_node -n / -d ${master_dts}]
set unit_addr [get_baseaddr $drv_handle]
set memory_node [add_or_get_dt_node -n memory -p $parent_node]
set proctype [get_property IP_NAME [get_cells -hier [get_sw_processor]]]
set reg_value [get_property CONFIG.reg $drv_handle]
hsi::utils::add_new_dts_param "${memory_node}" "reg" $reg_value inthexlist
# Append base address to memory node.
if {[llength "$reg_value"]} {
if {[string match -nocase $proctype "psu_cortexa53"] || \
[string match -nocase $proctype "psv_cortexa72"] || \
[string match -nocase $proctype "psx_cortexa78"]} {
set higheraddr [expr [lindex $reg_value 0] << 32]
set loweraddr [lindex $reg_value 1]
set unitaddr [format 0x%x [expr {${higheraddr} + ${loweraddr}}]]
} else {
set unitaddr [lindex $reg_value 0]
}
regsub -all {^0x} $unitaddr {} unitaddr
set memory_node [add_or_get_dt_node -n memory -p $parent_node -u $unitaddr]
hsi::utils::add_new_dts_param "${memory_node}" "reg" $reg_value inthexlist
}
# maybe hardcoded
if {[catch {set dev_type [get_property CONFIG.device_type $drv_handle]} msg]} {
set dev_type memory
Expand Down

0 comments on commit c103341

Please sign in to comment.