Change DEFAULT_FLASH_SIZE_IN_MB define name, use 4 by default, throw error on not...
authorPiotr Dymacz <pepe2k@gmail.com>
Thu, 3 Mar 2016 13:05:27 +0000 (14:05 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Thu, 3 Mar 2016 13:05:27 +0000 (14:05 +0100)
u-boot/Makefile
u-boot/board/ar7240/common/spi_flash.c

index 2d958f32b64f84af411db4839ad44ad40e4bd6d6..004bbb481709a3ba58d5409ae842679b6cbce7bc 100644 (file)
@@ -350,7 +350,7 @@ wr703n_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR703N at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_WR703N_V1          1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR703N\"" >> include/config.h
 
@@ -360,7 +360,7 @@ wr720n_v3_CN_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR720N v3 CN at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_WR720N_V3          1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR720N v3 CN\"" >> include/config.h
 
@@ -370,7 +370,7 @@ wr710n_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR710N at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_WR710N_V1          1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR710N\"" >> include/config.h
 
@@ -380,7 +380,7 @@ mr3020_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3020 at:' `date`.'\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_MR3020_V1          1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3020\"" >> include/config.h
 
@@ -390,7 +390,7 @@ mr3040_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3040 at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_MR3040_V1V2        1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3040\"" >> include/config.h
 
@@ -400,7 +400,7 @@ mr10u_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR10U at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_MR10U_V1           1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR10U\"" >> include/config.h
 
@@ -410,7 +410,7 @@ mr13u_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR13U at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_MR13U_V1           1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR13U\"" >> include/config.h
 
@@ -420,7 +420,7 @@ wr740n_v4_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR740N v4 at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_WR740N_V4          1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR74xN/D v4\"" >> include/config.h
 
@@ -430,7 +430,7 @@ mr3220_v2_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3220 v2 at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_TPLINK_MR3220_V2          1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3220 v2\"" >> include/config.h
 
@@ -441,7 +441,7 @@ dir505_config : unconfig hornet_common_config
        @echo "#define CONFIG_FOR_DLINK_DIR505_A1           1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"D-Link DIR-505\"" >> include/config.h
 
        @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
@@ -450,7 +450,7 @@ gs_oolite_v1_dev_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for GS-Oolite v1 with dev board at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV          1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Gainstrong GS-Oolite v1\"" >> include/config.h
 
        @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
@@ -460,7 +460,7 @@ black_swift_board_config : unconfig hornet_common_config
        @echo "#define CONFIG_FOR_BLACK_SWIFT_BOARD         1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Black Swift board\"" >> include/config.h
 
        @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
@@ -472,7 +472,7 @@ carambola2_config : unconfig hornet_common_config
        @echo "#define CONFIG_40MHZ_XTAL_SUPPORT            1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"8devices Carambola2 v1\"" >> include/config.h
 
        @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
@@ -483,7 +483,7 @@ dragino_v2_ms14_config : unconfig hornet_common_config
        @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
        @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
        @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Dragino v2 MS14\"" >> include/config.h
@@ -496,7 +496,7 @@ villagetelco_mp2_config : unconfig hornet_common_config
        @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
        @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
        @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Village Telco Mesh Potato 2\"" >> include/config.h
@@ -507,7 +507,7 @@ gl-inet_config : unconfig hornet_common_config
        @/bin/echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m'
        @echo "#define CONFIG_FOR_GL_INET                   1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"GL.iNet\"" >> include/config.h
 
        @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
@@ -526,7 +526,7 @@ wdr3600_43x0_config : unconfig wasp_common_config
        @echo "#define CFG_DUAL_PHY_SUPPORT                 1" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 16" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WDR3600/43x0\"" >> include/config.h
 
@@ -541,7 +541,7 @@ wdr3500_config : unconfig wasp_common_config
        @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 16" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             8" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WDR3500\"" >> include/config.h
 
@@ -557,7 +557,7 @@ mr3420_v2_config : unconfig wasp_common_config
        @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 17" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3420 v2\"" >> include/config.h
 
@@ -573,7 +573,7 @@ wr841n_v8_config : unconfig wasp_common_config
        @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 17" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR841N/D v8\"" >> include/config.h
 
@@ -589,7 +589,7 @@ wa830re_v2_wa801nd_v2_config : unconfig wasp_common_config
        @echo "#define CFG_AG7240_NMACS                        2" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                    17" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW           1" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB                4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB         4" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER              1" >> include/config.h
        @echo "#define CONFIG_BOARD_CUSTOM_STRING              \"TP-Link TL-WA830RE/TL-WA801ND v2\"" >> include/config.h
 
@@ -605,7 +605,7 @@ wr820n_CN_config : unconfig ap143_common_config
        @echo "#define CONFIG_FOR_TPLINK_WR820N_CN          1" >> include/config.h
        @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
        @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 12" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
@@ -619,7 +619,7 @@ wr841n_v9_config : unconfig ap143_common_config
        @echo "#define CONFIG_FOR_TPLINK_WR841N_V9          1" >> include/config.h
        @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
        @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
-       @echo "#define DEFAULT_FLASH_SIZE_IN_MB             4" >> include/config.h
+       @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_BIT                 12" >> include/config.h
        @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
        @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
index 7b036250a9720a1d1bd0d2aec8c66e629e227aca..773ab906f0018e6355c5f7b520130df8e261e5af 100644 (file)
@@ -11,9 +11,9 @@
 #include <asm/types.h>
 #include <soc/qca_soc_common.h>
 
-/* We need it in case of unknown FLASH chip */
-#ifndef DEFAULT_FLASH_SIZE_IN_MB
-       #error "DEFAULT_FLASH_SIZE_IN_MB not defined!"
+/* Use 4 MB by default */
+#ifndef CONFIG_DEFAULT_FLASH_SIZE_IN_MB
+       #define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4
 #endif
 
 /*
@@ -85,12 +85,14 @@ u32 flash_init(void)
 
                                printf("   - erase sector command: 0x%02X\n\n", sfdp_ec);
                        } else {
-                               #if (DEFAULT_FLASH_SIZE_IN_MB == 4)
+                               #if (CONFIG_DEFAULT_FLASH_SIZE_IN_MB == 4)
                                info->size = SIZE_4MiB;
-                               #elif (DEFAULT_FLASH_SIZE_IN_MB == 8)
+                               #elif (CONFIG_DEFAULT_FLASH_SIZE_IN_MB == 8)
                                info->size = SIZE_8MiB;
-                               #elif (DEFAULT_FLASH_SIZE_IN_MB == 16)
+                               #elif (CONFIG_DEFAULT_FLASH_SIZE_IN_MB == 16)
                                info->size = SIZE_16MiB;
+                               #else
+                                       #error "Not supported CONFIG_DEFAULT_FLASH_SIZE_IN_MB value!"
                                #endif
 
                                printf("## Error: SPI NOR FLASH chip in bank #%d\n"