]> git.sur5r.net Git - u-boot/commitdiff
kirkwood: make MPP arrays static const
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>
Mon, 26 Nov 2012 11:27:36 +0000 (11:27 +0000)
committerPrafulla Wadaskar <prafulla@marvell.com>
Tue, 8 Jan 2013 22:42:10 +0000 (04:12 +0530)
This saves stack and code memory for local copy, and
consumes initialized data memory. For 22 of the 29
kirkwood-based boards, this results in a global saving
of about 30 bytes. For 7 of them, it results in an
increase of 6 to 14 bytes.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
19 files changed:
arch/arm/cpu/arm926ejs/kirkwood/mpp.c
arch/arm/include/asm/arch-kirkwood/mpp.h
board/LaCie/net2big_v2/net2big_v2.c
board/LaCie/netspace_v2/netspace_v2.c
board/Marvell/dreamplug/dreamplug.c
board/Marvell/guruplug/guruplug.c
board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
board/Marvell/openrd/openrd.c
board/Marvell/rd6281a/rd6281a.c
board/Marvell/sheevaplug/sheevaplug.c
board/Seagate/dockstar/dockstar.c
board/buffalo/lsxl/lsxl.c
board/cloudengines/pogo_e02/pogo_e02.c
board/d-link/dns325/dns325.c
board/iomega/iconnect/iconnect.c
board/karo/tk71/tk71.c
board/keymile/km_arm/km_arm.c
board/raidsonic/ib62x0/ib62x0.c
drivers/spi/kirkwood_spi.c

index 03eb2de520f72bbf555d62fd643c6bc7151d061f..0ba6f098cb6b2c6486dc1a79375a6482634327f9 100644 (file)
@@ -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, u32 *mpp_save)
+void kirkwood_mpp_conf(const u32 *mpp_list, u32 *mpp_save)
 {
        u32 mpp_ctrl[MPP_NR_REGS];
        unsigned int variant_mask;
index 8ceea7bb886ee127a5d803586205e4d07be8fc18..48d1477fff77069215458a91b3d1d0eacee39815 100644 (file)
 
 #define MPP_MAX                        49
 
-void kirkwood_mpp_conf(u32 *mpp_list, u32 *mpp_save);
+void kirkwood_mpp_conf(const u32 *mpp_list, u32 *mpp_save);
 
 #endif
index 0e06c29153dfefc89059845c1c054656963a81bd..e524f3511d2691b0ccaef26840c85b7885e01005 100644 (file)
@@ -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,
index 101a80a70ab9a0eed2c792dc9c2121674b115a1b..0aa5345ddcc8040ecff6e0948e0a2b3c93dc89a6 100644 (file)
@@ -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,
index d6497aaa07e6ff104dbaad34c85a6f5ae0171188..0caf34ff0a8f195f8a893ef93e07d566ccf97cf8 100644 (file)
@@ -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,
index f5c1c3cfd908318a4405c45cde90eeef3738a7c4..3a52ab2744472d365948b60d13ac0bb783f8b0f5 100644 (file)
@@ -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,
index 43852f6b24f1a04a5397c988f40578b30bf1f57b..fb57faa52bf3fe2e62c9d4d3fec85e331d422993 100644 (file)
@@ -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,
index d48f05a0488ade209a5df311b2175dfb2a3da7f0..c59a32611c6866999de713c46b20e45c1892ecb4 100644 (file)
@@ -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,
index 1fd7677dcb589cb26d60c11978b43936eb87b720..adaa6a1a696394a926133e056ab39eeb05f7d0d8 100644 (file)
@@ -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,
index 688d3086d4d3f3296b82e4e45a464788f2f92619..16efe645d1a69f7e938ddc6b8abde4fb99ccd747 100644 (file)
@@ -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,
index fc88520b2d15eea8d852a8db47392075c885d6f2..4f1f899b903e7607a92a9f018f6c25b491e0b2b8 100644 (file)
@@ -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,
index 57776fb077400599fbc30333c58baede3b30bb35..f2980204c8d9ec331e93a43319919e3139878657 100644 (file)
@@ -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,
index bac9ce55a88363352b1ed0dc088bd8f19deca8e3..3b1c8ec2adde3a3a45726ec7d8e326183fbbade3 100644 (file)
@@ -45,7 +45,7 @@ int board_early_init_f(void)
                        POGO_E02_OE_LOW, POGO_E02_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index 11260fe5f68ded64f248094fd69f4204ecf3d61c..41879017e82cdf10465d0f8fff24abced4705346 100644 (file)
@@ -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,
index 8cfb4e6620dade4577bca5c1e02d3944d3d3fc65..c54c95d28886bb702afca0419e33d7932dc0af79 100644 (file)
@@ -41,7 +41,7 @@ int board_early_init_f(void)
                        ICONNECT_OE_LOW, ICONNECT_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index 96410d77d60ae5c195752418f102ced0a5ec2f0f..7a4e7b3286a207aca0fa4339b6ea60a90a1c4461 100644 (file)
@@ -47,7 +47,7 @@ int board_early_init_f(void)
                        TK71_OE_LOW, TK71_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index 262b8d2cf15515450bd93911264c4d3ffe509470..eda9199bbe9f499e9c49301709007fd68708cbc1 100644 (file)
@@ -54,7 +54,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define MASK_RBI_DEFECT_16     0x01
 
 /* Multi-Purpose Pins Functionality configuration */
-u32 kwmpp_config[] = {
+static const u32 kwmpp_config[] = {
        MPP0_NF_IO2,
        MPP1_NF_IO3,
        MPP2_NF_IO4,
index 5f0f3961d319ad2ab037403e26b243f2debe43c3..cf4ca51fcb479405cff2996a7ab0b853498517d5 100644 (file)
@@ -45,7 +45,7 @@ int board_early_init_f(void)
        /* Set SATA activity LEDs to default off */
        writel(MVSATAHC_LED_POLARITY_CTRL, MVSATAHC_LED_CONF_REG);
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
index a7cda751bd0a3eba5663331a7e16a724cd370b56..de81064b9defbff63f15b2975f5271d976e2a1ee 100644 (file)
@@ -41,7 +41,10 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 {
        struct spi_slave *slave;
        u32 data;
-       u32 kwspi_mpp_config[] = { 0, 0 };
+       static const u32 kwspi_mpp_config[2][2] = {
+               { MPP0_SPI_SCn, 0 }, /* if cs == 0 */
+               { MPP7_SPI_SCn, 0 } /* if cs != 0 */
+       };
 
        if (!spi_cs_is_valid(bus, cs))
                return NULL;
@@ -68,12 +71,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        writel(KWSPI_IRQMASK, &spireg->irq_mask);
 
        /* program mpp registers to select  SPI_CSn */
-       if (cs) {
-               kwspi_mpp_config[0] = MPP7_SPI_SCn;
-       } else {
-               kwspi_mpp_config[0] = MPP0_SPI_SCn;
-       }
-       kirkwood_mpp_conf(kwspi_mpp_config, cs_spi_mpp_back);
+       kirkwood_mpp_conf(kwspi_mpp_config[cs ? 1 : 0], cs_spi_mpp_back);
 
        return slave;
 }