All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] ARM: socfpga: Add support for selecting bridges in bridge command
Date: Fri, 19 Apr 2019 22:00:36 +0200	[thread overview]
Message-ID: <54171397-bd34-2769-9e85-b301c00bbb21@gmail.com> (raw)
In-Reply-To: <20190417201529.23953-4-marex@denx.de>



On 17.04.19 22:15, Marek Vasut wrote:
> Add optional "mask" argument to the SoCFPGA bridge command, to select
> which bridges should be enabled/disabled. This allows the user to avoid
> enabling bridges which are not connected into the FPGA fabric. Default
> behavior is to enable/disable all bridges.

So does this change the command? Seems like leaving away the new 'mask' 
argument would now lead to enabling all bridges by overwriting whatever 
the handoff values were before?

Regards,
Simon

> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Chin Liang See <chin.liang.see@intel.com>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tien Fong Chee <tien.fong.chee@intel.com>
> ---
>   arch/arm/mach-socfpga/include/mach/misc.h |  2 +-
>   arch/arm/mach-socfpga/misc.c              | 17 +++++++++++------
>   arch/arm/mach-socfpga/misc_arria10.c      |  2 +-
>   arch/arm/mach-socfpga/misc_gen5.c         | 12 +++++++++++-
>   arch/arm/mach-socfpga/misc_s10.c          |  2 +-
>   5 files changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm/mach-socfpga/include/mach/misc.h b/arch/arm/mach-socfpga/include/mach/misc.h
> index 86d5d2b62b..c3ca8cdf3b 100644
> --- a/arch/arm/mach-socfpga/include/mach/misc.h
> +++ b/arch/arm/mach-socfpga/include/mach/misc.h
> @@ -39,6 +39,6 @@ void socfpga_init_security_policies(void);
>   void socfpga_sdram_remap_zero(void);
>   #endif
>   
> -void do_bridge_reset(int enable);
> +void do_bridge_reset(int enable, unsigned int mask);
>   
>   #endif /* _MISC_H_ */
> diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c
> index ec8339e045..e1ea8eb73e 100644
> --- a/arch/arm/mach-socfpga/misc.c
> +++ b/arch/arm/mach-socfpga/misc.c
> @@ -126,17 +126,22 @@ int arch_cpu_init(void)
>   #ifndef CONFIG_SPL_BUILD
>   static int do_bridge(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>   {
> -	if (argc != 2)
> +	unsigned int mask = ~0;
> +
> +	if (argc < 2 || argc > 3)
>   		return CMD_RET_USAGE;
>   
>   	argv++;
>   
> +	if (argc == 3)
> +		mask = simple_strtoul(argv[1], NULL, 16);
> +
>   	switch (*argv[0]) {
>   	case 'e':	/* Enable */
> -		do_bridge_reset(1);
> +		do_bridge_reset(1, mask);
>   		break;
>   	case 'd':	/* Disable */
> -		do_bridge_reset(0);
> +		do_bridge_reset(0, mask);
>   		break;
>   	default:
>   		return CMD_RET_USAGE;
> @@ -145,10 +150,10 @@ static int do_bridge(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>   	return 0;
>   }
>   
> -U_BOOT_CMD(bridge, 2, 1, do_bridge,
> +U_BOOT_CMD(bridge, 3, 1, do_bridge,
>   	   "SoCFPGA HPS FPGA bridge control",
> -	   "enable  - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
> -	   "bridge disable - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
> +	   "enable [mask] - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
> +	   "bridge disable [mask] - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
>   	   ""
>   );
>   
> diff --git a/arch/arm/mach-socfpga/misc_arria10.c b/arch/arm/mach-socfpga/misc_arria10.c
> index 63b8c75d31..2e2a40b65d 100644
> --- a/arch/arm/mach-socfpga/misc_arria10.c
> +++ b/arch/arm/mach-socfpga/misc_arria10.c
> @@ -115,7 +115,7 @@ int print_cpuinfo(void)
>   }
>   #endif
>   
> -void do_bridge_reset(int enable)
> +void do_bridge_reset(int enable, unsigned int mask)
>   {
>   	if (enable)
>   		socfpga_reset_deassert_bridges_handoff();
> diff --git a/arch/arm/mach-socfpga/misc_gen5.c b/arch/arm/mach-socfpga/misc_gen5.c
> index 6e11ba6cb2..7876953595 100644
> --- a/arch/arm/mach-socfpga/misc_gen5.c
> +++ b/arch/arm/mach-socfpga/misc_gen5.c
> @@ -249,9 +249,19 @@ static void socfpga_sdram_apply_static_cfg(void)
>   	: : "r"(val), "r"(&sdr_ctrl->static_cfg) : "memory", "cc");
>   }
>   
> -void do_bridge_reset(int enable)
> +void do_bridge_reset(int enable, unsigned int mask)
>   {
> +	int i;
> +
>   	if (enable) {
> +		socfpga_bridges_set_handoff_regs(!(mask & BIT(0)),
> +						 !(mask & BIT(1)),
> +						 !(mask & BIT(2)));
> +		for (i = 0; i < 2; i++) {	/* Reload SW setting cache */
> +			iswgrp_handoff[i] =
> +				readl(&sysmgr_regs->iswgrp_handoff[i]);
> +		}
> +
>   		writel(iswgrp_handoff[2], &sysmgr_regs->fpgaintfgrp_module);
>   		socfpga_sdram_apply_static_cfg();
>   		writel(iswgrp_handoff[3], &sdr_ctrl->fpgaport_rst);
> diff --git a/arch/arm/mach-socfpga/misc_s10.c b/arch/arm/mach-socfpga/misc_s10.c
> index 113eace650..60c96090ce 100644
> --- a/arch/arm/mach-socfpga/misc_s10.c
> +++ b/arch/arm/mach-socfpga/misc_s10.c
> @@ -150,7 +150,7 @@ int arch_early_init_r(void)
>   	return 0;
>   }
>   
> -void do_bridge_reset(int enable)
> +void do_bridge_reset(int enable, unsigned int mask)
>   {
>   	socfpga_bridges_reset(enable);
>   }
> 

  reply	other threads:[~2019-04-19 20:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 20:15 [U-Boot] [PATCH 1/4] ARM: socfpga: Factor out handoff register configuration Marek Vasut
2019-04-17 20:15 ` [U-Boot] [PATCH 2/4] ARM: socfpga: Disable bridges in SPL unless booting from FPGA Marek Vasut
2019-04-19 19:53   ` Simon Goldschmidt
2019-04-17 20:15 ` [U-Boot] [PATCH 3/4] ARM: socfpga: Fully unmap the FPGA bridges from L3 space Marek Vasut
2019-04-19 19:54   ` Simon Goldschmidt
2019-04-17 20:15 ` [U-Boot] [PATCH 4/4] ARM: socfpga: Add support for selecting bridges in bridge command Marek Vasut
2019-04-19 20:00   ` Simon Goldschmidt [this message]
2019-04-22 18:01     ` Marek Vasut
2019-04-22 18:22       ` Simon Goldschmidt
2019-04-22 18:41         ` Marek Vasut
2019-04-22 19:18           ` Simon Goldschmidt
2019-04-22 19:24             ` Marek Vasut
2019-04-26  6:36               ` Simon Goldschmidt
2019-04-29  8:35                 ` Marek Vasut
2019-04-19 19:47 ` [U-Boot] [PATCH 1/4] ARM: socfpga: Factor out handoff register configuration Simon Goldschmidt
2019-04-22 17:59   ` Marek Vasut
2019-04-22 18:17     ` Simon Goldschmidt

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=54171397-bd34-2769-9e85-b301c00bbb21@gmail.com \
    --to=simon.k.r.goldschmidt@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.