Skip to content

Commit

Permalink
common: Add memory nodes for axi_emc and linear qspi
Browse files Browse the repository at this point in the history
axi_emc and linear qspi like ps7_qspi_linear and psu_qspi_linear IPs are valid
memory segments and can be used inside linker sections. Add memory nodes for these
IPs to facilitate the same.

Signed-off-by: Onkar Harsh <[email protected]>

Acked-for-series: Siva Durga Prasad Paladugu <[email protected]>
  • Loading branch information
onkarharsh authored and Siva Addepalli committed Mar 26, 2024
1 parent b980dc5 commit 4b99ac0
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 7 deletions.
11 changes: 10 additions & 1 deletion axi_emc/data/axi_emc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,14 @@
set datawidth [get_ip_param_value $ip [format "C_MEM%d_WIDTH" $x]]
add_prop $node "bank-width" [expr ($datawidth/8)] int "pl.dtsi"
}
}

set baseaddr [get_baseaddr $drv_handle no_prefix]
set memory_node [create_node -n "memory" -l "${drv_handle}_memory" -u $baseaddr -p root -d "system-top.dts"]
add_prop "${memory_node}" "device_type" "memory" string "system-top.dts"
set reg [string trim [pldt get $node "reg"] \<\>]
add_prop "${memory_node}" "reg" $reg hexlist "system-top.dts"
set mem_compatible_string [gen_compatible_string $drv_handle]
if {![string_is_empty $mem_compatible_string]} {
add_prop ${memory_node} "compatible" "${mem_compatible_string}-memory" string "system-top.dts"
}
}
12 changes: 9 additions & 3 deletions device_tree/data/common_proc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -5335,15 +5335,15 @@ proc gen_interrupt_property {drv_handle {intr_port_name ""}} {
}
}

proc gen_reg_property {drv_handle {skip_ps_check ""}} {
proc gen_reg_property {drv_handle {skip_ps_check ""} {set_node_prop 1}} {
global apu_proc_ip
proc_called_by
set unit_addr [get_baseaddr ${drv_handle} no_prefix]
if {$unit_addr == "" } {
return 0
}
set ps_mapping [gen_ps_mapping]
if {[catch {set tmp [dict get $ps_mapping $unit_addr label]} msg] || [is_pl_ip $drv_handle]} {
if {[catch {set tmp [dict get $ps_mapping $unit_addr label]} msg] || [is_pl_ip $drv_handle] || ![string_is_empty $skip_ps_check]} {
} else {
return 0
}
Expand Down Expand Up @@ -5424,7 +5424,9 @@ proc gen_reg_property {drv_handle {skip_ps_check ""}} {
set reg "$base $size"
}

set_drv_prop_if_empty $drv_handle reg $reg $node hexlist
if {$set_node_prop} {
set_drv_prop_if_empty $drv_handle reg $reg $node hexlist
}
}

return
Expand Down Expand Up @@ -5536,12 +5538,16 @@ proc gen_reg_property {drv_handle {skip_ps_check ""}} {
}
}
}
if {$set_node_prop} {
set_drv_prop_if_empty $drv_handle reg $reg $node hexlist
}
set_drv_prop_if_empty $drv_handle reg $reg $node hexlist
set ip_name [get_ip_property $drv_handle IP_NAME]
if {[string match -nocase $ip_name "psv_pciea_attrib"]} {
set ranges " 0x02000000 0x00000000 0xe0000000 0x0 0xe0000000 0x00000000 0x10000000>, \n\t\t\t <0x43000000 0x00000080 0x00000000 0x00000080 0x00000000 0x00000000 0x80000000"
add_prop $node "ranges" $ranges hexlist "pcw.dtsi"
}
return $reg
}

proc check_64_base {reg base size} {
Expand Down
23 changes: 20 additions & 3 deletions device_tree/data/device_tree.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ proc init_proclist {} {
dict set ::sdtgen::namespacelist "ps7_xadc" "xadcps"
dict set ::sdtgen::namespacelist "qdma" "xdmapcie"

dict set ::sdtgen::namespacelist "psu_qspi_linear" "linear_spi"
dict set ::sdtgen::namespacelist "ps7_qspi_linear" "linear_spi"

dict set ::sdtgen::namespacelist "psx_apm" "apmps"
dict set ::sdtgen::namespacelist "psx_canfd" "canfdps"
dict set ::sdtgen::namespacelist "noc_mc_ddr5" "ddrpsv"
Expand Down Expand Up @@ -1295,6 +1298,9 @@ proc generate_sdt args {
global baseaddr_dict
global highaddr_dict
global processor_ip_list
global linear_spi_list

set linear_spi_list "psu_qspi_linear ps7_qspi_linear"

set is_rm_design 0
if {[llength $args]!= 0} {
Expand Down Expand Up @@ -1389,7 +1395,7 @@ Generates system device tree based on args given in:
}
}

set non_val_list "versal_cips psx_wizard psxl ps_wizard dmac_slv axi_noc axi_noc2 noc_mc_ddr4 noc_mc_ddr5 ddr3 ddr4 mig_7series noc_nmu noc_nsu noc2_nmu noc2_nsu ila zynq_ultra_ps_e psu_iou_s smart_connect emb_mem_gen xlconcat xlconstant xlslice axis_tdest_editor util_reduced_logic noc_nsw noc2_nsw axis_ila pspmc psv_ocm_ram_0 psv_pmc_qspi_ospi psx_pmc_qspi_ospi add_keep_128 c_counter_binary dbg_monmux"
set non_val_list "versal_cips psx_wizard psxl ps_wizard dmac_slv axi_noc axi_noc2 noc_mc_ddr4 noc_mc_ddr5 ddr3 ddr4 mig_7series noc_nmu noc_nsu noc2_nmu noc2_nsu ila zynq_ultra_ps_e psu_iou_s smart_connect emb_mem_gen xlconcat xlconstant xlslice axis_tdest_editor util_reduced_logic noc_nsw noc2_nsw axis_ila pspmc psv_ocm_ram_0 psv_pmc_qspi_ospi psx_pmc_qspi_ospi add_keep_128 c_counter_binary dbg_monmux ${linear_spi_list}"
set non_val_ip_types "MONITOR BUS PROCESSOR"
set non_val_list1 "psv_cortexa72 psu_cortexa53 ps7_cortexa9 versal_cips psx_wizard ps_wizard noc_nmu noc_nsu ila psu_iou_s noc_nsw pspmc"
set non_val_ip_types1 "MONITOR BUS"
Expand Down Expand Up @@ -1657,6 +1663,7 @@ proc gen_r5_trustzone_config {} {

proc proc_mapping {} {
global is_versal_net_platform
global linear_spi_list
set proctype [get_hw_family]
set default_dts "system-top.dts"
set overall_periph_list [hsi::get_cells -hier]
Expand Down Expand Up @@ -1711,7 +1718,7 @@ proc proc_mapping {} {
}
set ipname [get_ip_property [hsi::get_cells -hier $periph] IP_NAME]
if {[lsearch $periphs_list $periph] >= 0} {
set valid_periph "psu_qspi_linear psv_pmc_qspi axi_emc ps7_qspi_linear axi_quad_spi axi_spi psx_pmc_qspi"
set valid_periph "psv_pmc_qspi axi_quad_spi psx_pmc_qspi axi_emc ${linear_spi_list}"
if {[lsearch $valid_periph $ipname] >= 0} {
} else {
continue
Expand Down Expand Up @@ -1838,9 +1845,19 @@ proc proc_mapping {} {
} else {
set_memmap [dict get $dup_periph_handle $periph] $mem_map_key $regprop
}
} else {
} elseif {[lsearch $linear_spi_list $ipname] < 0} {
set_memmap $temp $mem_map_key $regprop
}

if {[lsearch $linear_spi_list $ipname] >= 0 || $ipname in {"axi_emc"}} {
set temp [get_node "${periph}_memory"]
if {[llength $temp] > 1} {
set temp [lindex [split $temp ":"] 0]
}
if {![string_is_empty $temp]} {
set_memmap $temp $mem_map_key $regprop
}
}
}
#}]"

Expand Down
29 changes: 29 additions & 0 deletions linear_spi/data/linear_spi.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# (C) Copyright 2024 Advanced Micro Devices, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#

proc linear_spi_generate {drv_handle} {
set baseaddr [get_baseaddr $drv_handle no_prefix]
set memory_node [create_node -n "memory" -l "${drv_handle}_memory" -u $baseaddr -p root -d "system-top.dts"]
add_prop "${memory_node}" "device_type" "memory" string "system-top.dts" 1
set mem_compatible_string [gen_compatible_string $drv_handle]
if {![string_is_empty $mem_compatible_string]} {
add_prop ${memory_node} "compatible" "${mem_compatible_string}-memory" string "system-top.dts"
}
set reg [gen_reg_property $drv_handle "skip_ps_check" 0]
if {![string_is_empty $reg]} {
add_prop "${memory_node}" "reg" $reg hexlist "system-top.dts" 1
}
add_prop "${memory_node}" "xlnx,ip-name" [get_ip_property $drv_handle IP_NAME] string "system-top.dts"
add_prop "${memory_node}" "memory_type" "linear_flash" string "system-top.dts"
}

0 comments on commit 4b99ac0

Please sign in to comment.