Commit c6c2c85e4b980cba54b34a55399f9b82ae2787ea

Authored by Icenowy Zheng
Committed by Jagan Teki
1 parent 3d99a0b33a

sunxi: disable Pine A64 model detection code on other boards

The Pine A64 Plus/non-Plus model detection code is now built on all
64-bit ARM SoCs, even if the code cannot be triggered when H5/H6 is in
use.

Disable them when the board is Pine A64 by adding a Kconfig option that
is only selected on Pine A64.

On GCC 7.3.1 this makes the size of the function reduces 184 bytes, and
saves a 104 byte strstr() function, then makes SPL on H6 succeed to
build.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

Showing 3 changed files with 14 additions and 0 deletions Side-by-side Diff

arch/arm/mach-sunxi/Kconfig
... ... @@ -970,5 +970,15 @@
970 970 sunxi SPI Flash. It uses the same method as the boot ROM, so does
971 971 not need any extra configuration.
972 972  
  973 +config PINE64_DT_SELECTION
  974 + bool "Enable Pine64 device tree selection code"
  975 + depends on MACH_SUN50I
  976 + help
  977 + The original Pine A64 and Pine A64+ are similar but different
  978 + boards and can be differed by the DRAM size. Pine A64 has
  979 + 512MiB DRAM, and Pine A64+ has 1GiB or 2GiB. By selecting this
  980 + option, the device tree selection code specific to Pine64 which
  981 + utilizes the DRAM size will be enabled.
  982 +
973 983 endif
... ... @@ -820,6 +820,7 @@
820 820 #endif
821 821 };
822 822  
  823 +#ifdef CONFIG_PINE64_DT_SELECTION
823 824 /* Differentiate the two Pine64 board DTs by their DRAM size. */
824 825 if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) {
825 826 if ((gd->ram_size > 512 * 1024 * 1024))
... ... @@ -829,6 +830,8 @@
829 830 } else {
830 831 return strcmp(name, cmp_str);
831 832 }
  833 +#endif
  834 + return strcmp(name, cmp_str);
832 835 }
833 836 #endif
configs/pine64_plus_defconfig
... ... @@ -3,6 +3,7 @@
3 3 CONFIG_SPL=y
4 4 CONFIG_MACH_SUN50I=y
5 5 CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y
  6 +CONFIG_PINE64_DT_SELECTION=y
6 7 CONFIG_NR_DRAM_BANKS=1
7 8 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
8 9 # CONFIG_CMD_FLASH is not set