public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Chee, Tien Fong <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/8] ARM: socfpga: arria10: Add qts-filter for arria10 socfpga
Date: Sat, 12 Oct 2019 13:28:40 +0000	[thread overview]
Message-ID: <1570886919.10072.2.camel@intel.com> (raw)
In-Reply-To: <20191004223043.18127-2-dalon.westergreen@linux.intel.com>

On Fri, 2019-10-04 at 15:30 -0700, Dalon Westergreen wrote:
> From: Dalon Westergreen <dalon.westergreen@intel.com>
> 
> Add a script to process hps handoff data and generate a header
> for inclusion in u-boot specific devicetree addons.  The header
> should be included in the top level u-boot.dtsi.
> 
> Signed-off-by: Dalon Westergreen <dalon.westergreen@intel.com>
> ---
>  arch/arm/mach-socfpga/qts-filter-a10.sh | 141
> ++++++++++++++++++++++++
>  1 file changed, 141 insertions(+)
>  create mode 100755 arch/arm/mach-socfpga/qts-filter-a10.sh
> 
> diff --git a/arch/arm/mach-socfpga/qts-filter-a10.sh b/arch/arm/mach-
> socfpga/qts-filter-a10.sh
> new file mode 100755
> index 0000000000..ddb0d0a6f3
> --- /dev/null
> +++ b/arch/arm/mach-socfpga/qts-filter-a10.sh
> @@ -0,0 +1,141 @@
> +#!/bin/bash
> +
> +#
> +# helper function to convert from DOS to Unix, if necessary, and
> handle
> +# lines ending in '\'.
> +#
> +fix_newlines_in_macros() {
> +	sed -n ':next;s/\r$//;/[^\\]\\$/ {N;s/\\\n//;b next};p' $1
> +}
> +
> +#filter out only what we need from a10 hps.xml
> +grep_a10_hps_config() {
> +	egrep "clk_hz|i_clk_mgr|i_io48_pin_mux|AXI_SLAVE|AXI_MASTER"
> +}

Above function seems unused.

> +
> +#
> +# Process hps.xml
> +# $1:	hps.xml
> +# $2:	Output File
> +#
> +process_a10_hps_config() {
> +	hps_xml="$1"
> +	outfile="$2"
> +
> +	(cat << EOF
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Altera Arria10 SoCFPGA configuration
> + */
> +
> +#ifndef __SOCFPGA_ARRIA10_CONFIG_H__
> +#define __SOCFPGA_ARRIA10_CONFIG_H__
> +
> +EOF
> +
> +	echo "/* Clocks */"
> +	fix_newlines_in_macros \
> +		${hps_xml} | egrep "clk_hz" |
> +			awk -F"'" '{ gsub("\\.","_",$2) ; \
> +				print "#define" " " toupper($2) " "
> $4}' |
> +			sed 's/\.[0-9]//' |
> +			sed 's/I_CLK_MGR_//' |
> +			sort
> +	fix_newlines_in_macros \
> +		${hps_xml} | egrep "i_clk_mgr_mainpll" |
> +			awk -F"'" '{ gsub("\\.","_",$2) ; \
> +				print "#define" " " toupper($2) " "
> $4}' |
> +			sed 's/\.[0-9]//' |
> +			sed 's/I_CLK_MGR_//' |
> +			sort
> +	fix_newlines_in_macros \
> +		${hps_xml} | egrep "i_clk_mgr_perpll" |
> +			awk -F"'" '{ gsub("\\.","_",$2) ; \
> +				print "#define" " " toupper($2) " "
> $4}' |
> +			sed 's/\.[0-9]//' |
> +			sed 's/I_CLK_MGR_//' |
> +			sort
> +	fix_newlines_in_macros \
> +		${hps_xml} | egrep "i_clk_mgr_clkmgr" |
> +			awk -F"'" '{ gsub("\\.","_",$2) ; \
> +				print "#define" " " toupper($2) " "
> $4}' |
> +			sed 's/\.[0-9]//' |
> +			sed 's/I_CLK_MGR_//' |
> +			sort
> +	fix_newlines_in_macros \
> +		${hps_xml} | egrep "i_clk_mgr_alteragrp" |
> +			awk -F"'" '{ gsub("\\.","_",$2) ; \
> +				print "#define" " " toupper($2) " "
> $4}' |
> +			sed 's/\.[0-9]//' |
> +			sed 's/I_CLK_MGR_//' |
> +			sort
> +	echo "#define ALTERAGRP_MPUCLK ((ALTERAGRP_MPUCLK_PERICNT <<
> 16) | \\"
> +	echo "	(ALTERAGRP_MPUCLK_MAINCNT))"
> +	echo "#define ALTERAGRP_NOCCLK ((ALTERAGRP_NOCCLK_PERICNT <<
> 16) | \\"
> +	echo "	(ALTERAGRP_NOCCLK_MAINCNT))"
> +
> +	echo
> +	echo "/* Pin Mux Configuration */"
> +	fix_newlines_in_macros \
> +		${hps_xml} | egrep "i_io48_pin_mux" |
> +			awk -F"'" '{ gsub("\\.","_",$2) ; \
> +				print "#define" " " toupper($2) " "
> $4}' |
> +			sed 's/I_IO48_PIN_MUX_//' |
> +			sed 's/SHARED_3V_IO_GRP_//' |
> +			sed 's/FPGA_INTERFACE_GRP_//' |
> +			sed 's/DEDICATED_IO_GRP_//' |
> +			sed 's/CONFIGURATION_DEDICATED/CONFIG/' |
> +			sort
> +
> +	echo
> +	echo "/* Bridge Configuration */"
> +	fix_newlines_in_macros \
> +		${hps_xml} | egrep "AXI_SLAVE|AXI_MASTER" |
> +			awk -F"'" '{ gsub("\\.","_",$2) ; \
> +				print "#define" " " toupper($2) " "
> $4}' |
> +			sed 's/true/1/' |
> +			sed 's/false/0/' |
> +			sort
> +
> +	echo
> +	echo "/* Voltage Select for Config IO */"
> +	echo "#define CONFIG_IO_BANK_VSEL \\"
> +	echo "	(((CONFIG_IO_BANK_VOLTAGE_SEL_CLKRST_IO & 0x3)
> << 8) | \\"
> +	echo "	(CONFIG_IO_BANK_VOLTAGE_SEL_PERI_IO & 0x3))"
> +
> +	echo
> +	echo "/* Macro for Config IO bit mapping */"
> +	echo -n "#define CONFIG_IO_MACRO(NAME) "
> +	echo "(((NAME ## _RTRIM & 0xff) << 19) | \\"
> +	echo "	((NAME ## _INPUT_BUF_EN & 0x3) << 17) | \\"
> +	echo "	((NAME ## _WK_PU_EN & 0x1) << 16) | \\"
> +	echo "	((NAME ## _PU_SLW_RT & 0x1) << 13) | \\"
> +	echo "	((NAME ## _PU_DRV_STRG & 0xf) << 8) | \\"
> +	echo "	((NAME ## _PD_SLW_RT & 0x1) << 5) | \\"
> +	echo "	(NAME ## _PD_DRV_STRG & 0x1f))"
> +
> +	cat << EOF
> +
> +#endif /* __SOCFPGA_ARRIA10_CONFIG_H__ */
> +EOF
> +	) > "${outfile}"
> +}
> +
> +usage() {
> +	echo "$0 [hps_xml] [output_file]"
> +	echo "Process QTS-generated hps.xml into devicetree header."
> +	echo ""
> +	echo "  hps_xml      - hps.xml file from hps_isw_handoff"
> +	echo "  output_file  - Output header file for dtsi include"
> +	echo ""
> +}
> +
> +hps_xml="$1"
> +outfile="$2"
> +
> +if [ "$#" -ne 2 ] ; then
> +	usage
> +	exit 1
> +fi
> +
> +process_a10_hps_config "${hps_xml}" "${outfile}"

  parent reply	other threads:[~2019-10-12 13:28 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 22:30 [U-Boot] [PATCH 0/8] ARM: socfpga: arria10: Cleanup devicetree and Dalon Westergreen
2019-10-04 22:30 ` [U-Boot] [PATCH 1/8] ARM: socfpga: arria10: Add qts-filter for arria10 socfpga Dalon Westergreen
2019-10-04 23:47   ` Marek Vasut
2019-10-05 23:22     ` Dalon L Westergreen
2019-10-12 13:28   ` Chee, Tien Fong [this message]
2019-10-04 22:30 ` [U-Boot] [PATCH 2/8] ARM: socfpga: arria10: Sync A10 SoCDK devicetrees Dalon Westergreen
2019-10-04 23:47   ` Marek Vasut
2019-10-05 23:23     ` Dalon L Westergreen
2019-10-07 14:03       ` Dalon L Westergreen
2019-10-07 14:06         ` Marek Vasut
2019-10-07 14:49           ` Dalon L Westergreen
2019-10-07 15:16             ` Dalon L Westergreen
2019-10-04 22:30 ` [U-Boot] [PATCH 3/8] ARM: socfpga: arria10: Add common u-boot devicetree include Dalon Westergreen
2019-10-04 23:49   ` Marek Vasut
2019-10-05 23:25     ` Dalon L Westergreen
2019-10-06 13:40       ` Marek Vasut
2019-10-07  3:30     ` Dalon L Westergreen
2019-10-07 14:04       ` Simon Goldschmidt
2019-10-04 22:30 ` [U-Boot] [PATCH 4/8] ARM: socfpga: arria10: Add generic handoff " Dalon Westergreen
2019-10-04 23:51   ` Marek Vasut
2019-10-05 23:19     ` Dalon L Westergreen
2019-10-06 13:44       ` Marek Vasut
2019-10-06 17:44         ` Dalon L Westergreen
2019-10-06 18:05           ` Simon Goldschmidt
2019-10-06 23:04             ` Dalon L Westergreen
2019-10-07 14:34             ` Dalon L Westergreen
2019-10-07 14:45               ` Simon Goldschmidt
2019-10-08 17:08                 ` Dalon L Westergreen
2019-10-06 23:06         ` Dalon L Westergreen
2019-10-04 22:30 ` [U-Boot] [PATCH 5/8] ARM: socfpga: arria10: Add handoff header for A10 SoCDK SDMMC Dalon Westergreen
2019-10-04 22:30 ` [U-Boot] [PATCH 6/8] ARM: socfpga: arria10: Add u-boot include for A10 SoCDK SDMMC devicetree Dalon Westergreen
2019-10-04 22:30 ` [U-Boot] [PATCH 7/8] ARM: socfpga: arria10: Remove old A10 SoCDK Handoff dtsi Dalon Westergreen
2019-10-04 22:30 ` [U-Boot] [PATCH 8/8] ARM: socfpga: Update README.socfpga to add qts-filter-a10 Dalon Westergreen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1570886919.10072.2.camel@intel.com \
    --to=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox