From 4b99ac03e49c57d93b22a82802aa18e14d2d4061 Mon Sep 17 00:00:00 2001 From: Onkar Harsh Date: Mon, 25 Mar 2024 14:52:45 -1200 Subject: [PATCH] common: Add memory nodes for axi_emc and linear qspi 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 Acked-for-series: Siva Durga Prasad Paladugu --- axi_emc/data/axi_emc.tcl | 11 ++++++++++- device_tree/data/common_proc.tcl | 12 +++++++++--- device_tree/data/device_tree.tcl | 23 ++++++++++++++++++++--- linear_spi/data/linear_spi.tcl | 29 +++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 linear_spi/data/linear_spi.tcl diff --git a/axi_emc/data/axi_emc.tcl b/axi_emc/data/axi_emc.tcl index 4d846d72..e5d2128a 100644 --- a/axi_emc/data/axi_emc.tcl +++ b/axi_emc/data/axi_emc.tcl @@ -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" + } + } diff --git a/device_tree/data/common_proc.tcl b/device_tree/data/common_proc.tcl index 5aad9ec8..3eca4aeb 100644 --- a/device_tree/data/common_proc.tcl +++ b/device_tree/data/common_proc.tcl @@ -5335,7 +5335,7 @@ 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] @@ -5343,7 +5343,7 @@ proc gen_reg_property {drv_handle {skip_ps_check ""}} { 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 } @@ -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 @@ -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} { diff --git a/device_tree/data/device_tree.tcl b/device_tree/data/device_tree.tcl index 84eaf092..fa919d0d 100644 --- a/device_tree/data/device_tree.tcl +++ b/device_tree/data/device_tree.tcl @@ -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" @@ -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} { @@ -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" @@ -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] @@ -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 @@ -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 + } + } } #}]" diff --git a/linear_spi/data/linear_spi.tcl b/linear_spi/data/linear_spi.tcl new file mode 100644 index 00000000..ecefe069 --- /dev/null +++ b/linear_spi/data/linear_spi.tcl @@ -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" +}