mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: at91: constify struct at91_ddramc_register parameters
Date: Tue, 5 Jan 2021 13:02:44 +0100	[thread overview]
Message-ID: <20210105120244.GC19063@pengutronix.de> (raw)
In-Reply-To: <20210104093327.5830-1-a.fatoum@pengutronix.de>

On Mon, Jan 04, 2021 at 10:33:27AM +0100, Ahmad Fatoum wrote:
> The SDRAM config passed as struct at91_ddramc_register is read-only,
> so make it const everywhere to document and enforce this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/mach-at91/ddramc_ll.c                       | 6 +++---
>  arch/arm/mach-at91/include/mach/ddramc.h             | 6 +++---
>  arch/arm/mach-at91/include/mach/sama5d2-sip-ddramc.h | 2 +-
>  arch/arm/mach-at91/include/mach/sama5d2_ll.h         | 2 +-
>  arch/arm/mach-at91/sama5d2_ll.c                      | 2 +-
>  5 files changed, 9 insertions(+), 9 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-at91/ddramc_ll.c b/arch/arm/mach-at91/ddramc_ll.c
> index 4768fdcd6281..77d03720cca4 100644
> --- a/arch/arm/mach-at91/ddramc_ll.c
> +++ b/arch/arm/mach-at91/ddramc_ll.c
> @@ -12,7 +12,7 @@
>  
>  void at91_ddram_initialize(void __iomem *base_address,
>  			   void __iomem *ram_address,
> -			   struct at91_ddramc_register *ddramc_config)
> +			   const struct at91_ddramc_register *ddramc_config)
>  {
>  	unsigned long ba_offset;
>  	unsigned long cr = 0;
> @@ -235,7 +235,7 @@ void at91_ddram_initialize(void __iomem *base_address,
>  
>  void at91_lpddr2_sdram_initialize(void __iomem *base_address,
>  				  void __iomem *ram_address,
> -				  struct at91_ddramc_register *ddramc_config)
> +				  const struct at91_ddramc_register *ddramc_config)
>  {
>  	unsigned long reg;
>  
> @@ -386,7 +386,7 @@ void at91_lpddr2_sdram_initialize(void __iomem *base_address,
>  
>  void at91_lpddr1_sdram_initialize(void __iomem *base_address,
>  				  void __iomem *ram_address,
> -				  struct at91_ddramc_register *ddramc_config)
> +				  const struct at91_ddramc_register *ddramc_config)
>  {
>  	unsigned long ba_offset;
>  
> diff --git a/arch/arm/mach-at91/include/mach/ddramc.h b/arch/arm/mach-at91/include/mach/ddramc.h
> index b929bf5f58e8..5d6f3a70b788 100644
> --- a/arch/arm/mach-at91/include/mach/ddramc.h
> +++ b/arch/arm/mach-at91/include/mach/ddramc.h
> @@ -21,16 +21,16 @@ struct at91_ddramc_register {
>  
>  void at91_ddram_initialize(void __iomem *base_address,
>  			   void __iomem *ram_address,
> -			   struct at91_ddramc_register *ddramc_config);
> +			   const struct at91_ddramc_register *ddramc_config);
>  
>  void at91_lpddr2_sdram_initialize(void __iomem *base_address,
>  				  void __iomem *ram_address,
> -				  struct at91_ddramc_register *ddramc_config);
> +				  const struct at91_ddramc_register *ddramc_config);
>  
>  
>  void at91_lpddr1_sdram_initialize(void __iomem *base_address,
>  				  void __iomem *ram_address,
> -				  struct at91_ddramc_register *ddramc_config);
> +				  const struct at91_ddramc_register *ddramc_config);
>  
>  void __noreturn sama5d2_barebox_entry(unsigned int r4, void *boarddata);
>  
> diff --git a/arch/arm/mach-at91/include/mach/sama5d2-sip-ddramc.h b/arch/arm/mach-at91/include/mach/sama5d2-sip-ddramc.h
> index 35c92c43fce8..6a75ac71fc35 100644
> --- a/arch/arm/mach-at91/include/mach/sama5d2-sip-ddramc.h
> +++ b/arch/arm/mach-at91/include/mach/sama5d2-sip-ddramc.h
> @@ -11,7 +11,7 @@
>  
>  static inline void sama5d2_d1g_ddrconf(void) /* DDR2 1Gbit SDRAM */
>  {
> -	struct at91_ddramc_register conf = {
> +	const struct at91_ddramc_register conf = {
>  		.mdr = AT91_DDRC2_DBW_16_BITS | AT91_DDRC2_MD_DDR2_SDRAM,
>  
>  		.cr = AT91_DDRC2_NC_DDR10_SDR9 | AT91_DDRC2_NR_13 |
> diff --git a/arch/arm/mach-at91/include/mach/sama5d2_ll.h b/arch/arm/mach-at91/include/mach/sama5d2_ll.h
> index 96f3bc545284..244b1a706594 100644
> --- a/arch/arm/mach-at91/include/mach/sama5d2_ll.h
> +++ b/arch/arm/mach-at91/include/mach/sama5d2_ll.h
> @@ -25,7 +25,7 @@ static inline void sama5d2_udelay_init(unsigned int msc)
>  }
>  
>  
> -void sama5d2_ddr2_init(struct at91_ddramc_register *ddramc_reg_config);
> +void sama5d2_ddr2_init(const struct at91_ddramc_register *ddramc_reg_config);
>  
>  static inline int sama5d2_pmc_enable_generic_clock(unsigned int periph_id,
>  						   unsigned int clk_source,
> diff --git a/arch/arm/mach-at91/sama5d2_ll.c b/arch/arm/mach-at91/sama5d2_ll.c
> index c3b50617778a..3366a50e8fba 100644
> --- a/arch/arm/mach-at91/sama5d2_ll.c
> +++ b/arch/arm/mach-at91/sama5d2_ll.c
> @@ -18,7 +18,7 @@
>  #define sama5d2_pmc_write(off, val) writel(val, SAMA5D2_BASE_PMC + off)
>  #define sama5d2_pmc_read(off) readl(SAMA5D2_BASE_PMC + off)
>  
> -void sama5d2_ddr2_init(struct at91_ddramc_register *ddramc_reg_config)
> +void sama5d2_ddr2_init(const struct at91_ddramc_register *ddramc_reg_config)
>  {
>  	unsigned int reg;
>  
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2021-01-05 12:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04  9:33 Ahmad Fatoum
2021-01-05 12:02 ` Sascha Hauer [this message]

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=20210105120244.GC19063@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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