From b0928da648d440778512ddd81e690717239b8f1f Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <yamada.m@jp.panasonic.com>
Date: Tue, 16 Sep 2014 16:32:59 +0900
Subject: [PATCH] kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
---
 configs/bct-brettl2_defconfig       | 1 +
 configs/bf518f-ezbrd_defconfig      | 1 +
 configs/bf526-ezbrd_defconfig       | 1 +
 configs/bf527-ad7160-eval_defconfig | 1 +
 configs/bf527-ezkit-v2_defconfig    | 1 +
 configs/bf527-ezkit_defconfig       | 1 +
 configs/bf527-sdp_defconfig         | 1 +
 configs/bf533-ezkit_defconfig       | 1 +
 configs/bf533-stamp_defconfig       | 1 +
 configs/bf537-stamp_defconfig       | 1 +
 configs/bf538f-ezkit_defconfig      | 1 +
 configs/bf548-ezkit_defconfig       | 1 +
 configs/bf561-acvilon_defconfig     | 1 +
 configs/bf561-ezkit_defconfig       | 1 +
 configs/br4_defconfig               | 1 +
 configs/cm-bf527_defconfig          | 1 +
 configs/cm-bf533_defconfig          | 1 +
 configs/cm-bf537e_defconfig         | 1 +
 configs/cm-bf537u_defconfig         | 1 +
 configs/cm-bf548_defconfig          | 1 +
 configs/cm-bf561_defconfig          | 1 +
 configs/ip04_defconfig              | 1 +
 configs/pr1_defconfig               | 1 +
 configs/tcm-bf518_defconfig         | 1 +
 configs/tcm-bf537_defconfig         | 1 +
 include/configs/bct-brettl2.h       | 1 -
 include/configs/bf518f-ezbrd.h      | 1 -
 include/configs/bf526-ezbrd.h       | 1 -
 include/configs/bf527-ad7160-eval.h | 1 -
 include/configs/bf527-ezkit.h       | 1 -
 include/configs/bf527-sdp.h         | 1 -
 include/configs/bf533-ezkit.h       | 1 -
 include/configs/bf533-stamp.h       | 1 -
 include/configs/bf537-stamp.h       | 1 -
 include/configs/bf538f-ezkit.h      | 1 -
 include/configs/bf548-ezkit.h       | 1 -
 include/configs/bf561-acvilon.h     | 1 -
 include/configs/bf561-ezkit.h       | 1 -
 include/configs/br4.h               | 1 -
 include/configs/cm-bf527.h          | 1 -
 include/configs/cm-bf533.h          | 1 -
 include/configs/cm-bf537e.h         | 1 -
 include/configs/cm-bf537u.h         | 1 -
 include/configs/cm-bf548.h          | 1 -
 include/configs/cm-bf561.h          | 1 -
 include/configs/ip04.h              | 1 -
 include/configs/pr1.h               | 1 -
 include/configs/tcm-bf518.h         | 1 -
 include/configs/tcm-bf537.h         | 1 -
 lib/Kconfig                         | 8 ++++++++
 50 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/configs/bct-brettl2_defconfig b/configs/bct-brettl2_defconfig
index 367630647e7..26b145d30a1 100644
--- a/configs/bct-brettl2_defconfig
+++ b/configs/bct-brettl2_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BCT_BRETTL2=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf518f-ezbrd_defconfig b/configs/bf518f-ezbrd_defconfig
index a93eed08822..fb35ad023db 100644
--- a/configs/bf518f-ezbrd_defconfig
+++ b/configs/bf518f-ezbrd_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF518F_EZBRD=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf526-ezbrd_defconfig b/configs/bf526-ezbrd_defconfig
index 4a452235ac3..da06d3ad6ee 100644
--- a/configs/bf526-ezbrd_defconfig
+++ b/configs/bf526-ezbrd_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF526_EZBRD=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf527-ad7160-eval_defconfig b/configs/bf527-ad7160-eval_defconfig
index d9db715f146..47f53c9d816 100644
--- a/configs/bf527-ad7160-eval_defconfig
+++ b/configs/bf527-ad7160-eval_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF527_AD7160_EVAL=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf527-ezkit-v2_defconfig b/configs/bf527-ezkit-v2_defconfig
index aedbb9649a6..e250e10354b 100644
--- a/configs/bf527-ezkit-v2_defconfig
+++ b/configs/bf527-ezkit-v2_defconfig
@@ -1,3 +1,4 @@
 CONFIG_SYS_EXTRA_OPTIONS="BF527_EZKIT_REV_2_1"
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF527_EZKIT=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf527-ezkit_defconfig b/configs/bf527-ezkit_defconfig
index 3ed77a66b07..69f6ef781b9 100644
--- a/configs/bf527-ezkit_defconfig
+++ b/configs/bf527-ezkit_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF527_EZKIT=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf527-sdp_defconfig b/configs/bf527-sdp_defconfig
index 0f8c28c339e..57f47e9fc8e 100644
--- a/configs/bf527-sdp_defconfig
+++ b/configs/bf527-sdp_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF527_SDP=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf533-ezkit_defconfig b/configs/bf533-ezkit_defconfig
index 217d4c30a01..57f8da14758 100644
--- a/configs/bf533-ezkit_defconfig
+++ b/configs/bf533-ezkit_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF533_EZKIT=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf533-stamp_defconfig b/configs/bf533-stamp_defconfig
index a99b3c75ff4..1bcf3d319ae 100644
--- a/configs/bf533-stamp_defconfig
+++ b/configs/bf533-stamp_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF533_STAMP=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf537-stamp_defconfig b/configs/bf537-stamp_defconfig
index d9daf7e309e..9b9a92f13fa 100644
--- a/configs/bf537-stamp_defconfig
+++ b/configs/bf537-stamp_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF537_STAMP=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf538f-ezkit_defconfig b/configs/bf538f-ezkit_defconfig
index 0507cb2b912..1892151db0c 100644
--- a/configs/bf538f-ezkit_defconfig
+++ b/configs/bf538f-ezkit_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF538F_EZKIT=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf548-ezkit_defconfig b/configs/bf548-ezkit_defconfig
index 7bb4064ad7e..52369849aad 100644
--- a/configs/bf548-ezkit_defconfig
+++ b/configs/bf548-ezkit_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF548_EZKIT=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf561-acvilon_defconfig b/configs/bf561-acvilon_defconfig
index ba8a418928d..098f31fb559 100644
--- a/configs/bf561-acvilon_defconfig
+++ b/configs/bf561-acvilon_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF561_ACVILON=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/bf561-ezkit_defconfig b/configs/bf561-ezkit_defconfig
index 7ceb1d9f4a8..56652883162 100644
--- a/configs/bf561-ezkit_defconfig
+++ b/configs/bf561-ezkit_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF561_EZKIT=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/br4_defconfig b/configs/br4_defconfig
index 9d919332180..5655d54b041 100644
--- a/configs/br4_defconfig
+++ b/configs/br4_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BR4=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/cm-bf527_defconfig b/configs/cm-bf527_defconfig
index cb5110c7b1f..a6830b54fd3 100644
--- a/configs/cm-bf527_defconfig
+++ b/configs/cm-bf527_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF527=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/cm-bf533_defconfig b/configs/cm-bf533_defconfig
index aa38d0ed691..b9508ae2975 100644
--- a/configs/cm-bf533_defconfig
+++ b/configs/cm-bf533_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF533=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/cm-bf537e_defconfig b/configs/cm-bf537e_defconfig
index b9deaae3bfd..a44eab7f0da 100644
--- a/configs/cm-bf537e_defconfig
+++ b/configs/cm-bf537e_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF537E=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/cm-bf537u_defconfig b/configs/cm-bf537u_defconfig
index 16f7ae17a2a..29c33b95144 100644
--- a/configs/cm-bf537u_defconfig
+++ b/configs/cm-bf537u_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF537U=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/cm-bf548_defconfig b/configs/cm-bf548_defconfig
index e60306a1eaa..525f2e7f373 100644
--- a/configs/cm-bf548_defconfig
+++ b/configs/cm-bf548_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF548=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/cm-bf561_defconfig b/configs/cm-bf561_defconfig
index 1b9301cb9ec..062bfeb6dc6 100644
--- a/configs/cm-bf561_defconfig
+++ b/configs/cm-bf561_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_CM_BF561=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/ip04_defconfig b/configs/ip04_defconfig
index 4f9895aa770..ba737aedfbe 100644
--- a/configs/ip04_defconfig
+++ b/configs/ip04_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_IP04=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/pr1_defconfig b/configs/pr1_defconfig
index a8784c11df3..793a4e83768 100644
--- a/configs/pr1_defconfig
+++ b/configs/pr1_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_PR1=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/tcm-bf518_defconfig b/configs/tcm-bf518_defconfig
index a9d5da01fa7..0c9ae4d57e7 100644
--- a/configs/tcm-bf518_defconfig
+++ b/configs/tcm-bf518_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_TCM_BF518=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/configs/tcm-bf537_defconfig b/configs/tcm-bf537_defconfig
index fe9de13f367..6d604b6c9e4 100644
--- a/configs/tcm-bf537_defconfig
+++ b/configs/tcm-bf537_defconfig
@@ -1,2 +1,3 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_TCM_BF537=y
+CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED=y
diff --git a/include/configs/bct-brettl2.h b/include/configs/bct-brettl2.h
index c1eda963851..d0828d5f5c1 100644
--- a/include/configs/bct-brettl2.h
+++ b/include/configs/bct-brettl2.h
@@ -137,7 +137,6 @@
 #define CONFIG_MTD_DEVICE
 #define CONFIG_MTD_PARTITIONS
 #define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf518f-ezbrd.h b/include/configs/bf518f-ezbrd.h
index 9e374c40244..20f6ed1992f 100644
--- a/include/configs/bf518f-ezbrd.h
+++ b/include/configs/bf518f-ezbrd.h
@@ -155,7 +155,6 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf526-ezbrd.h b/include/configs/bf526-ezbrd.h
index 972eca9c174..c33d0350228 100644
--- a/include/configs/bf526-ezbrd.h
+++ b/include/configs/bf526-ezbrd.h
@@ -153,7 +153,6 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	1
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /* define to enable run status via led */
 /* #define CONFIG_STATUS_LED */
diff --git a/include/configs/bf527-ad7160-eval.h b/include/configs/bf527-ad7160-eval.h
index c0dfe2685bf..b497f267738 100644
--- a/include/configs/bf527-ad7160-eval.h
+++ b/include/configs/bf527-ad7160-eval.h
@@ -136,7 +136,6 @@
  */
 #define CONFIG_MISC_INIT_R
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf527-ezkit.h b/include/configs/bf527-ezkit.h
index 92c183e27c2..0bca53f2a69 100644
--- a/include/configs/bf527-ezkit.h
+++ b/include/configs/bf527-ezkit.h
@@ -179,7 +179,6 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	1
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf527-sdp.h b/include/configs/bf527-sdp.h
index 458868af726..9d43b811e3e 100644
--- a/include/configs/bf527-sdp.h
+++ b/include/configs/bf527-sdp.h
@@ -112,7 +112,6 @@
  */
 #define CONFIG_MISC_INIT_R
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h
index b50352823e7..0fda967ac24 100644
--- a/include/configs/bf533-ezkit.h
+++ b/include/configs/bf533-ezkit.h
@@ -110,7 +110,6 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h
index 3d36d84c7cb..ae4d83a8f14 100644
--- a/include/configs/bf533-stamp.h
+++ b/include/configs/bf533-stamp.h
@@ -186,7 +186,6 @@
  */
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /* FLASH/ETHERNET uses the same async bank */
 #define SHARED_RESOURCES 	1
diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h
index a302f839a1e..29f9316067d 100644
--- a/include/configs/bf537-stamp.h
+++ b/include/configs/bf537-stamp.h
@@ -254,7 +254,6 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /* Define if want to do post memory test */
 #undef CONFIG_POST
diff --git a/include/configs/bf538f-ezkit.h b/include/configs/bf538f-ezkit.h
index 32df5ec8f09..a65528246d6 100644
--- a/include/configs/bf538f-ezkit.h
+++ b/include/configs/bf538f-ezkit.h
@@ -135,7 +135,6 @@
  */
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf548-ezkit.h b/include/configs/bf548-ezkit.h
index 1a245a2b818..da5f0294351 100644
--- a/include/configs/bf548-ezkit.h
+++ b/include/configs/bf548-ezkit.h
@@ -181,7 +181,6 @@
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	1
 #define CONFIG_BFIN_SPI_IMG_SIZE 0x50000
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 #define CONFIG_ADI_GPIO2
 
diff --git a/include/configs/bf561-acvilon.h b/include/configs/bf561-acvilon.h
index 3db917e37bc..6871d8c4222 100644
--- a/include/configs/bf561-acvilon.h
+++ b/include/configs/bf561-acvilon.h
@@ -160,7 +160,6 @@
 #define CONFIG_UART_CONSOLE			0
 #define CONFIG_BAUDRATE				57600
 #define CONFIG_SYS_PROMPT "Acvilon> "
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h
index 0a309d92694..fb6f94873af 100644
--- a/include/configs/bf561-ezkit.h
+++ b/include/configs/bf561-ezkit.h
@@ -102,7 +102,6 @@
  * Misc Settings
  */
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Run core 1 from L1 SRAM start address when init uboot on core 0
diff --git a/include/configs/br4.h b/include/configs/br4.h
index f8d3158d475..3f240085e3f 100644
--- a/include/configs/br4.h
+++ b/include/configs/br4.h
@@ -135,7 +135,6 @@
 #define CONFIG_BOOTCOMMAND	"run nandboot"
 #define CONFIG_BOOTDELAY	2
 #define CONFIG_LOADADDR		0x2000000
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf527.h b/include/configs/cm-bf527.h
index 8d3ae49913e..f5351ad2643 100644
--- a/include/configs/cm-bf527.h
+++ b/include/configs/cm-bf527.h
@@ -128,7 +128,6 @@
 #define FLASHBOOT_ENV_SETTINGS \
 	"flashboot=flread 20040000 1000000 300000;" \
 	"bootm 0x1000000\0"
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf533.h b/include/configs/cm-bf533.h
index 8bd499a7d2c..485f01a01c0 100644
--- a/include/configs/cm-bf533.h
+++ b/include/configs/cm-bf533.h
@@ -97,7 +97,6 @@
 #define CONFIG_UART_CONSOLE	0
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf537e.h b/include/configs/cm-bf537e.h
index 47967d71203..1729b44a1bf 100644
--- a/include/configs/cm-bf537e.h
+++ b/include/configs/cm-bf537e.h
@@ -146,7 +146,6 @@
 	"flashboot=flread 20040000 1000000 3c0000;" \
 	"bootm 0x1000000\0"
 #define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024))
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf537u.h b/include/configs/cm-bf537u.h
index 88c99821b1e..272aa744a95 100644
--- a/include/configs/cm-bf537u.h
+++ b/include/configs/cm-bf537u.h
@@ -143,7 +143,6 @@
 	"flashboot=flread 20040000 1000000 300000;" \
 	"bootm 0x1000000\0"
 #define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024))
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf548.h b/include/configs/cm-bf548.h
index 346e27f3ebd..7f27eda416d 100644
--- a/include/configs/cm-bf548.h
+++ b/include/configs/cm-bf548.h
@@ -117,7 +117,6 @@
 #define CONFIG_UART_CONSOLE	1
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 #define CONFIG_ADI_GPIO2
 
diff --git a/include/configs/cm-bf561.h b/include/configs/cm-bf561.h
index 5265e5f6ef0..96910a7afd2 100644
--- a/include/configs/cm-bf561.h
+++ b/include/configs/cm-bf561.h
@@ -99,7 +99,6 @@
 #define CONFIG_UART_CONSOLE	0
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/ip04.h b/include/configs/ip04.h
index 3767502faa5..ec510bdac42 100644
--- a/include/configs/ip04.h
+++ b/include/configs/ip04.h
@@ -133,7 +133,6 @@
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_MISC_INIT_R	/* needed for MAC address */
 #define CONFIG_UART_CONSOLE	0
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 #undef CONFIG_SHOW_BOOT_PROGRESS
 /* Enable this if bootretry required; currently it's disabled */
diff --git a/include/configs/pr1.h b/include/configs/pr1.h
index e96ed4b4f28..0f57e868a5d 100644
--- a/include/configs/pr1.h
+++ b/include/configs/pr1.h
@@ -135,7 +135,6 @@
 #define CONFIG_BOOTCOMMAND	"run nandboot"
 #define CONFIG_BOOTDELAY	2
 #define CONFIG_LOADADDR		0x2000000
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/tcm-bf518.h b/include/configs/tcm-bf518.h
index a77ba697d0f..66730267a33 100644
--- a/include/configs/tcm-bf518.h
+++ b/include/configs/tcm-bf518.h
@@ -116,7 +116,6 @@
 #define CONFIG_UART_CONSOLE	0
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/tcm-bf537.h b/include/configs/tcm-bf537.h
index c4c1c579bc1..999834351f3 100644
--- a/include/configs/tcm-bf537.h
+++ b/include/configs/tcm-bf537.h
@@ -145,7 +145,6 @@
 	"flashboot=flread 20040000 1000000 300000;" \
 	"bootm 0x1000000\0"
 #define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024))
-#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/lib/Kconfig b/lib/Kconfig
index 9724eb88cb0..88e5da72ecc 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -1,3 +1,11 @@
 menu "Library routines"
 
+config CC_OPTIMIZE_LIBS_FOR_SPEED
+	bool "Optimize libraries for speed"
+	help
+	  Enabling this option will pass "-O2" to gcc when compiling
+	  under "lib" directory.
+
+	  If unsure, say N.
+
 endmenu
-- 
GitLab