armv8: ls1046ardb: SPL size reduction
authorSumit Garg <sumit.garg@nxp.com>
Thu, 30 Mar 2017 04:23:13 +0000 (09:53 +0530)
committerYork Sun <york.sun@nxp.com>
Mon, 17 Apr 2017 16:03:30 +0000 (09:03 -0700)
Using changes in this patch we were able to reduce approx 4k
size of u-boot-spl.bin image. Following is breif description of
changes to reduce SPL size:
1. Changes in board/freescale/ls1046ardb/Makefile to remove
   compilation of eth.c and cpld.c in case of SPL build.
2. Changes in board/freescale/ls1046ardb/ls1046ardb.c to keep
   only ddr_init and board_early_init_f funcations in case of SPL
   build.
3. Changes in ls1046a_common.h & ls1046ardb.h to remove driver
   specific macros due to which static data was being compiled in
   case of SPL build.
4. Disable MMC driver from bieng compiled in case of SPL NAND
   build and NAND driver from bieng compiled in case of SPL MMC build.

Signed-off-by: Vinitha Pillai <vinitha.pillai@nxp.com>
Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
board/freescale/ls1046aqds/Makefile
board/freescale/ls1046ardb/Makefile
board/freescale/ls1046ardb/ls1046ardb.c
include/configs/ls1046a_common.h
include/configs/ls1046ardb.h

index df6e546..6267522 100644 (file)
@@ -5,5 +5,7 @@
 #
 
 obj-y += ddr.o
+ifndef CONFIG_SPL_BUILD
 obj-y += eth.o
+endif
 obj-y += ls1046aqds.o
index 348eb76..b92ed0b 100644 (file)
@@ -4,7 +4,9 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-y += cpld.o
 obj-y += ddr.o
 obj-y += ls1046ardb.o
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_SYS_DPAA_FMAN) += eth.o
+obj-y += cpld.o
+endif
index 02b6c4c..0cc508b 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int board_early_init_f(void)
+{
+       fsl_lsch2_early_init_f();
+
+       return 0;
+}
+
+#ifndef CONFIG_SPL_BUILD
 int checkboard(void)
 {
        static const char *freq[2] = {"100.00MHZ", "156.25MHZ"};
@@ -56,13 +64,6 @@ int checkboard(void)
        return 0;
 }
 
-int board_early_init_f(void)
-{
-       fsl_lsch2_early_init_f();
-
-       return 0;
-}
-
 int board_init(void)
 {
        struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR;
@@ -161,3 +162,4 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        return 0;
 }
+#endif
index cb79296..164a5f3 100644 (file)
@@ -7,6 +7,23 @@
 #ifndef __LS1046A_COMMON_H
 #define __LS1046A_COMMON_H
 
+/* SPL build */
+#ifdef CONFIG_SPL_BUILD
+#define SPL_NO_QBMAN
+#define SPL_NO_FMAN
+#define SPL_NO_ENV
+#define SPL_NO_MISC
+#define SPL_NO_QSPI
+#define SPL_NO_USB
+#define SPL_NO_SATA
+#endif
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_NAND_BOOT))
+#define SPL_NO_MMC
+#endif
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SD_BOOT))
+#define SPL_NO_IFC
+#endif
+
 #define CONFIG_REMAKE_ELF
 #define CONFIG_FSL_LAYERSCAPE
 #define CONFIG_MP
 #define CONFIG_SYS_I2C_MXC_I2C4
 
 /* Command line configuration */
+#ifndef SPL_NO_ENV
 #define CONFIG_CMD_ENV
+#endif
 
 /* MMC */
+#ifndef SPL_NO_MMC
 #ifdef CONFIG_MMC
 #define CONFIG_FSL_ESDHC
 #define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
 #endif
+#endif
 
+#ifndef SPL_NO_QBMAN
 #define CONFIG_SYS_DPAA_QBMAN          /* Support Q/Bman */
+#endif
 
 /* FMan ucode */
+#ifndef SPL_NO_FMAN
 #define CONFIG_SYS_DPAA_FMAN
 #ifdef CONFIG_SYS_DPAA_FMAN
 #define CONFIG_SYS_FM_MURAM_SIZE       0x60000
+#endif
 
 #ifdef CONFIG_SD_BOOT
 /*
 #define CONFIG_HWCONFIG
 #define HWCONFIG_BUFFER_SIZE           128
 
+#ifndef SPL_NO_MISC
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS              \
        "hwconfig=fsl_ddr:bank_intlv=auto\0"    \
 #define CONFIG_BOOTARGS                        "console=ttyS0,115200 root=/dev/ram0 " \
                                        "earlycon=uart8250,mmio,0x21c0500 " \
                                        MTDPARTS_DEFAULT
+#endif
+
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */
 #define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE + \
                                        sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE /* Boot args buffer */
 #define CONFIG_SYS_LONGHELP
+
+#ifndef SPL_NO_MISC
 #define CONFIG_CMDLINE_EDITING         1
+#endif
+
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_MAXARGS             64      /* max command args */
 
index 2141b82..e368072 100644 (file)
 #endif
 #endif
 
+#ifndef SPL_NO_IFC
 /* IFC */
 #define CONFIG_FSL_IFC
-
 /*
  * NAND Flash Definitions
  */
 #define CONFIG_NAND_FSL_IFC
+#endif
 
 #define CONFIG_SYS_NAND_BASE           0x7e800000
 #define CONFIG_SYS_NAND_BASE_PHYS      CONFIG_SYS_NAND_BASE
 /*
  * Environment
  */
+#ifndef SPL_NO_ENV
 #define CONFIG_ENV_OVERWRITE
+#endif
 
 #if defined(CONFIG_SD_BOOT)
 #define CONFIG_ENV_IS_IN_MMC
 #endif
 
 /* FMan */
+#ifndef SPL_NO_FMAN
 #ifdef CONFIG_SYS_DPAA_FMAN
 #define CONFIG_FMAN_ENET
 #define CONFIG_PHYLIB
 
 #define CONFIG_ETHPRIME                        "FM1@DTSEC3"
 #endif
+#endif
 
 /* QSPI device */
+#ifndef SPL_NO_QSPI
 #ifdef CONFIG_FSL_QSPI
 #define CONFIG_SPI_FLASH_SPANSION
 #define FSL_QSPI_FLASH_SIZE            (1 << 26)
 #define FSL_QSPI_FLASH_NUM             2
 #define CONFIG_SPI_FLASH_BAR
 #endif
+#endif
 
 /* USB */
+#ifndef SPL_NO_USB
 #define CONFIG_HAS_FSL_XHCI_USB
 #ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_HCD
 #define CONFIG_CMD_USB
 #define CONFIG_USB_STORAGE
 #endif
+#endif
 
 /* SATA */
+#ifndef SPL_NO_SATA
 #define CONFIG_LIBATA
 #define CONFIG_SCSI_AHCI
 #define CONFIG_SCSI_AHCI_PLAT
 #define CONFIG_SYS_SCSI_MAX_LUN                        1
 #define CONFIG_SYS_SCSI_MAX_DEVICE             (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
                                                CONFIG_SYS_SCSI_MAX_LUN)
+#endif
 
+#ifndef SPL_NO_MISC
 #define CONFIG_BOOTCOMMAND             "sf probe 0:0;sf read $kernel_load" \
                                        "$kernel_start $kernel_size;" \
                                        "bootm $kernel_load"
                        "15m(u-boot),48m(kernel.itb);" \
                        "7e800000.flash:16m(nand_uboot)," \
                        "48m(nand_kernel),448m(nand_free)"
+#endif
 
 #endif /* __LS1046ARDB_H__ */