All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Kirkwood: declare mpp config static and const
@ 2012-05-26  0:27 Michael Walle
  2012-05-27 21:20 ` Luka Perkov
  2012-05-28  9:48 ` Prafulla Wadaskar
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Walle @ 2012-05-26  0:27 UTC (permalink / raw)
  To: u-boot

Change the prototype of kirkwood_mpp_conf() from
  void kirkwood_mpp_conf(u32 *mpp_list)
to
  void kirkwood_mpp_conf(const u32 *mpp_list)

Now we can declare the kwmpp_config static and const where possible.

Signed-off-by: Michael Walle <michael@walle.cc>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Cc: Simon Guinot <simon.guinot@sequanux.org>
Cc: Jason Cooper <u-boot@lakedaemon.net>
Cc: Siddarth Gore <gores@marvell.com>
Cc: Eric Cooper <ecc@cmu.edu>
Cc: Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
---

This was spotted by Mike in an earlier patch series (Kirkwood: add lschlv2
and lsxhl board support). Declaring the mpp_config static avoids generating
the array on the stack.
This was compile tested on all kirkwood boards and tested on the lschlv2.


 arch/arm/cpu/arm926ejs/kirkwood/mpp.c           |    2 +-
 arch/arm/include/asm/arch-kirkwood/mpp.h        |    2 +-
 board/LaCie/net2big_v2/net2big_v2.c             |    2 +-
 board/LaCie/netspace_v2/netspace_v2.c           |    2 +-
 board/Marvell/dreamplug/dreamplug.c             |    2 +-
 board/Marvell/guruplug/guruplug.c               |    2 +-
 board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |    2 +-
 board/Marvell/openrd/openrd.c                   |    2 +-
 board/Marvell/rd6281a/rd6281a.c                 |    2 +-
 board/Marvell/sheevaplug/sheevaplug.c           |    2 +-
 board/Seagate/dockstar/dockstar.c               |    2 +-
 board/buffalo/lsxl/lsxl.c                       |    2 +-
 board/d-link/dns325/dns325.c                    |    2 +-
 board/keymile/km_arm/km_arm.c                   |    2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
index 3da6c98..838f6bf 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
@@ -31,7 +31,7 @@ static u32 kirkwood_variant(void)
 #define MPP_CTRL(i)	(KW_MPP_BASE + (i* 4))
 #define MPP_NR_REGS	(1 + MPP_MAX/8)
 
-void kirkwood_mpp_conf(u32 *mpp_list)
+void kirkwood_mpp_conf(const u32 *mpp_list)
 {
 	u32 mpp_ctrl[MPP_NR_REGS];
 	unsigned int variant_mask;
diff --git a/arch/arm/include/asm/arch-kirkwood/mpp.h b/arch/arm/include/asm/arch-kirkwood/mpp.h
index b3c090e..54ec89f 100644
--- a/arch/arm/include/asm/arch-kirkwood/mpp.h
+++ b/arch/arm/include/asm/arch-kirkwood/mpp.h
@@ -312,6 +312,6 @@
 
 #define MPP_MAX			49
 
-void kirkwood_mpp_conf(unsigned int *mpp_list);
+void kirkwood_mpp_conf(const unsigned int *mpp_list);
 
 #endif
diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c
index d0b4adf..3437e82 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -39,7 +39,7 @@ int board_early_init_f(void)
 			NET2BIG_V2_OE_LOW, NET2BIG_V2_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_SPI_SCn,
 		MPP1_SPI_MOSI,
 		MPP2_SPI_SCK,
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index fbf020f..66f8f89 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -39,7 +39,7 @@ int board_early_init_f(void)
 			NETSPACE_V2_OE_LOW, NETSPACE_V2_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_SPI_SCn,
 		MPP1_SPI_MOSI,
 		MPP2_SPI_SCK,
diff --git a/board/Marvell/dreamplug/dreamplug.c b/board/Marvell/dreamplug/dreamplug.c
index 31b73c9..e446735 100644
--- a/board/Marvell/dreamplug/dreamplug.c
+++ b/board/Marvell/dreamplug/dreamplug.c
@@ -46,7 +46,7 @@ int board_early_init_f(void)
 			DREAMPLUG_OE_LOW, DREAMPLUG_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_SPI_SCn,		/* SPI Flash */
 		MPP1_SPI_MOSI,
 		MPP2_SPI_SCK,
diff --git a/board/Marvell/guruplug/guruplug.c b/board/Marvell/guruplug/guruplug.c
index 057c558..d30b2fe 100644
--- a/board/Marvell/guruplug/guruplug.c
+++ b/board/Marvell/guruplug/guruplug.c
@@ -43,7 +43,7 @@ int board_early_init_f(void)
 			GURUPLUG_OE_LOW, GURUPLUG_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_NF_IO2,
 		MPP1_NF_IO3,
 		MPP2_NF_IO4,
diff --git a/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c b/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
index 4c41f3b..66077e7 100644
--- a/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
+++ b/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
@@ -45,7 +45,7 @@ int board_early_init_f(void)
 			MV88F6281GTW_GE_OE_LOW, MV88F6281GTW_GE_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_SPI_SCn,
 		MPP1_SPI_MOSI,
 		MPP2_SPI_SCK,
diff --git a/board/Marvell/openrd/openrd.c b/board/Marvell/openrd/openrd.c
index 2a10e69..6291eab 100644
--- a/board/Marvell/openrd/openrd.c
+++ b/board/Marvell/openrd/openrd.c
@@ -48,7 +48,7 @@ int board_early_init_f(void)
 			OPENRD_OE_LOW, OPENRD_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_NF_IO2,
 		MPP1_NF_IO3,
 		MPP2_NF_IO4,
diff --git a/board/Marvell/rd6281a/rd6281a.c b/board/Marvell/rd6281a/rd6281a.c
index 9c768bf..760aba4 100644
--- a/board/Marvell/rd6281a/rd6281a.c
+++ b/board/Marvell/rd6281a/rd6281a.c
@@ -44,7 +44,7 @@ int board_early_init_f(void)
 			RD6281A_OE_LOW, RD6281A_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_NF_IO2,
 		MPP1_NF_IO3,
 		MPP2_NF_IO4,
diff --git a/board/Marvell/sheevaplug/sheevaplug.c b/board/Marvell/sheevaplug/sheevaplug.c
index 71e6793..868a6ed 100644
--- a/board/Marvell/sheevaplug/sheevaplug.c
+++ b/board/Marvell/sheevaplug/sheevaplug.c
@@ -43,7 +43,7 @@ int board_early_init_f(void)
 			SHEEVAPLUG_OE_LOW, SHEEVAPLUG_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_NF_IO2,
 		MPP1_NF_IO3,
 		MPP2_NF_IO4,
diff --git a/board/Seagate/dockstar/dockstar.c b/board/Seagate/dockstar/dockstar.c
index 38473e5..d191653 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -47,7 +47,7 @@ int board_early_init_f(void)
 			DOCKSTAR_OE_LOW, DOCKSTAR_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_NF_IO2,
 		MPP1_NF_IO3,
 		MPP2_NF_IO4,
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 5d9b7bc..2a0f399 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -76,7 +76,7 @@ int board_early_init_f(void)
 	 * Multi-Purpose Pins Functionality configuration
 	 * These strappings are taken from the original vendor uboot port.
 	 */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_SPI_SCn,
 		MPP1_SPI_MOSI,
 		MPP2_SPI_SCK,
diff --git a/board/d-link/dns325/dns325.c b/board/d-link/dns325/dns325.c
index 990d79f..b3fd4a4 100644
--- a/board/d-link/dns325/dns325.c
+++ b/board/d-link/dns325/dns325.c
@@ -44,7 +44,7 @@ int board_early_init_f(void)
 			DNS325_OE_LOW, DNS325_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const u32 kwmpp_config[] = {
 		MPP0_NF_IO2,
 		MPP1_NF_IO3,
 		MPP2_NF_IO4,
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 9e9940c..e12e978 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -53,7 +53,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define MASK_RBI_DEFECT_16	0x01
 
 /* Multi-Purpose Pins Functionality configuration */
-u32 kwmpp_config[] = {
+static u32 kwmpp_config[] = {
 	MPP0_NF_IO2,
 	MPP1_NF_IO3,
 	MPP2_NF_IO4,
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] Kirkwood: declare mpp config static and const
  2012-05-26  0:27 [U-Boot] [PATCH] Kirkwood: declare mpp config static and const Michael Walle
@ 2012-05-27 21:20 ` Luka Perkov
  2012-05-28 21:45   ` Michael Walle
  2012-05-28  9:48 ` Prafulla Wadaskar
  1 sibling, 1 reply; 4+ messages in thread
From: Luka Perkov @ 2012-05-27 21:20 UTC (permalink / raw)
  To: u-boot

Hi Michael,

On Sat, May 26, 2012 at 02:27:01AM +0200, Michael Walle wrote:
> Change the prototype of kirkwood_mpp_conf() from
>   void kirkwood_mpp_conf(u32 *mpp_list)
> to
>   void kirkwood_mpp_conf(const u32 *mpp_list)
> 
> Now we can declare the kwmpp_config static and const where possible.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> Cc: Simon Guinot <simon.guinot@sequanux.org>
> Cc: Jason Cooper <u-boot@lakedaemon.net>
> Cc: Siddarth Gore <gores@marvell.com>
> Cc: Eric Cooper <ecc@cmu.edu>
> Cc: Stefan Herbrechtsmeier <stefan@code.herbrechtsmeier.net>
> Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> ---
> 
> This was spotted by Mike in an earlier patch series (Kirkwood: add lschlv2
> and lsxhl board support). Declaring the mpp_config static avoids generating
> the array on the stack.
> This was compile tested on all kirkwood boards and tested on the lschlv2.
> 
> 
>  arch/arm/cpu/arm926ejs/kirkwood/mpp.c           |    2 +-
>  arch/arm/include/asm/arch-kirkwood/mpp.h        |    2 +-
>  board/LaCie/net2big_v2/net2big_v2.c             |    2 +-
>  board/LaCie/netspace_v2/netspace_v2.c           |    2 +-
>  board/Marvell/dreamplug/dreamplug.c             |    2 +-
>  board/Marvell/guruplug/guruplug.c               |    2 +-
>  board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |    2 +-
>  board/Marvell/openrd/openrd.c                   |    2 +-
>  board/Marvell/rd6281a/rd6281a.c                 |    2 +-
>  board/Marvell/sheevaplug/sheevaplug.c           |    2 +-
>  board/Seagate/dockstar/dockstar.c               |    2 +-
>  board/buffalo/lsxl/lsxl.c                       |    2 +-
>  board/d-link/dns325/dns325.c                    |    2 +-
>  board/keymile/km_arm/km_arm.c                   |    2 +-
>  14 files changed, 14 insertions(+), 14 deletions(-)

NACK. At least in this version. Please double check all the kirkwood
boards (taken from boards.cfg):

pogo_e02                     arm         arm926ejs   -                   cloudengines   kirkwood
dns325                       arm         arm926ejs   -                   d-link         kirkwood
km_kirkwood                  arm         arm926ejs   km_arm              keymile        kirkwood	km_kirkwood:KM_DISABLE_PCI
km_kirkwood_pci              arm         arm926ejs   km_arm              keymile        kirkwood	km_kirkwood:KM_RECONFIG_XLX
mgcoge3un                    arm         arm926ejs   km_arm              keymile        kirkwood
portl2                       arm         arm926ejs   km_arm              keymile        kirkwood
inetspace_v2                 arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:INETSPACE_V2
net2big_v2                   arm         arm926ejs   net2big_v2          LaCie          kirkwood	lacie_kw:NET2BIG_V2
netspace_max_v2              arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:NETSPACE_MAX_V2
netspace_v2                  arm         arm926ejs   netspace_v2         LaCie          kirkwood	lacie_kw:NETSPACE_V2
dreamplug                    arm         arm926ejs   -                   Marvell        kirkwood
guruplug                     arm         arm926ejs   -                   Marvell        kirkwood
mv88f6281gtw_ge              arm         arm926ejs   -                   Marvell        kirkwood
openrd_base                  arm         arm926ejs   openrd              Marvell        kirkwood        openrd:BOARD_IS_OPENRD_BASE
openrd_client                arm         arm926ejs   openrd              Marvell        kirkwood        openrd:BOARD_IS_OPENRD_CLIENT
openrd_ultimate              arm         arm926ejs   openrd              Marvell        kirkwood        openrd:BOARD_IS_OPENRD_ULTIMATE
rd6281a                      arm         arm926ejs   -                   Marvell        kirkwood
sheevaplug                   arm         arm926ejs   -                   Marvell        kirkwood
ib62x0                       arm         arm926ejs   ib62x0              raidsonic      kirkwood
dockstar                     arm         arm926ejs   -                   Seagate        kirkwood

I have noticed that board ib62x0 is not in this patch. I have tested
this patch with my ib62x0 board and it works. This is the patch I have
added:

diff --git a/board/raidsonic/ib62x0/ib62x0.c b/board/raidsonic/ib62x0/ib62x0.c
index 65f2c2e..f888901 100644
--- a/board/raidsonic/ib62x0/ib62x0.c
+++ b/board/raidsonic/ib62x0/ib62x0.c
@@ -42,7 +42,7 @@ int board_early_init_f(void)
 			IB62x0_OE_LOW, IB62x0_OE_HIGH);
 
 	/* Multi-Purpose Pins Functionality configuration */
-	u32 kwmpp_config[] = {
+	static const kwmpp_config[] = {
 		MPP0_NF_IO2,
 		MPP1_NF_IO3,
 		MPP2_NF_IO4,

Also you should note that this patch should be applied after your
patches for lsxl board.

Regards,
Luka

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] Kirkwood: declare mpp config static and const
  2012-05-26  0:27 [U-Boot] [PATCH] Kirkwood: declare mpp config static and const Michael Walle
  2012-05-27 21:20 ` Luka Perkov
@ 2012-05-28  9:48 ` Prafulla Wadaskar
  1 sibling, 0 replies; 4+ messages in thread
From: Prafulla Wadaskar @ 2012-05-28  9:48 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Michael Walle [mailto:michael at walle.cc]
> Sent: 26 May 2012 05:57
> To: u-boot at lists.denx.de
> Cc: Mike Frysinger; Michael Walle; Prafulla Wadaskar; Simon Guinot;
> Jason Cooper; Siddarth Gore; Eric Cooper; Stefan Herbrechtsmeier;
> Valentin Longchamp
> Subject: [PATCH] Kirkwood: declare mpp config static and const
> 
> Change the prototype of kirkwood_mpp_conf() from
>   void kirkwood_mpp_conf(u32 *mpp_list)
> to
>   void kirkwood_mpp_conf(const u32 *mpp_list)

There are few patches being discussed that may affect if the const is declared for this function.

Ref:
http://lists.denx.de/pipermail/u-boot/2012-May/124516.html
http://patchwork.ozlabs.org/patch/159582/

Regards..
Prafulla . . .

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] Kirkwood: declare mpp config static and const
  2012-05-27 21:20 ` Luka Perkov
@ 2012-05-28 21:45   ` Michael Walle
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2012-05-28 21:45 UTC (permalink / raw)
  To: u-boot


Hi Luka,

Am Sonntag 27 Mai 2012, 23:20:29 schrieb Luka Perkov:
> NACK. At least in this version. Please double check all the kirkwood
> boards (taken from boards.cfg):

ups sorry, actually my tree wasn't up to date :( pogo_e02 is missing, too.


> diff --git a/board/raidsonic/ib62x0/ib62x0.c
> b/board/raidsonic/ib62x0/ib62x0.c index 65f2c2e..f888901 100644
> --- a/board/raidsonic/ib62x0/ib62x0.c
> +++ b/board/raidsonic/ib62x0/ib62x0.c
> @@ -42,7 +42,7 @@ int board_early_init_f(void)
>  			IB62x0_OE_LOW, IB62x0_OE_HIGH);
> 
>  	/* Multi-Purpose Pins Functionality configuration */
> -	u32 kwmpp_config[] = {
> +	static const kwmpp_config[] = {

this should be static const u32 kwmpp_config[] = {

> Also you should note that this patch should be applied after your
> patches for lsxl board.
ah yes, thanks.

-- 
Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-28 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-26  0:27 [U-Boot] [PATCH] Kirkwood: declare mpp config static and const Michael Walle
2012-05-27 21:20 ` Luka Perkov
2012-05-28 21:45   ` Michael Walle
2012-05-28  9:48 ` Prafulla Wadaskar

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.