[PATCH 1/8] Convert CONFIG_AM335X_USB0 et al to Kconfig

Tom Rini trini at konsulko.com
Sat Mar 12 05:07:29 CET 2022


This converts the following to Kconfig:
   CONFIG_AM335X_USB0
   CONFIG_AM335X_USB0_MODE
   CONFIG_AM335X_USB1
   CONFIG_AM335X_USB1_MODE

We do this by introducing specific options for static configuration of
USB0/USB1 in SPL rather than defining CONFIG_AM335X_USBx_MODE to the
enum value being used.  Furthermore, with how the code is used now we do
not need to have OTG mode exposed as an option here, so remove that.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 arch/arm/mach-omap2/am33xx/Kconfig     | 32 ++++++++++++++++++++++++++
 arch/arm/mach-omap2/am33xx/board.c     |  8 +++----
 configs/am335x_evm_defconfig           |  3 +++
 configs/am335x_guardian_defconfig      |  3 +++
 include/configs/am335x_evm.h           | 12 ----------
 include/configs/am335x_guardian.h      |  5 ----
 include/configs/baltos.h               | 12 ----------
 include/configs/chiliboard.h           |  4 ----
 include/configs/siemens-am33x-common.h |  7 ------
 9 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig
index 1402376915ea..b8e115dc92bf 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -280,3 +280,35 @@ config PUB_ROM_DATA_SIZE
 	  image, this area is no longer used, and can be reclaimed
 	  for run time use by the boot image.
 endif
+
+config AM335X_USB0
+	bool "Static mode configuration for USB0 in SPL"
+	depends on AM33XX && SPL_MUSB_NEW && !SPL_OF_CONTROL
+
+choice
+	prompt "USB0 port configuration"
+	depends on AM335X_USB0
+
+config AM335X_USB0_HOST
+	bool "Port is used in host mode"
+
+config AM335X_USB0_PERIPHERAL
+	bool "Port is used in peripheral mode"
+
+endchoice
+
+config AM335X_USB1
+	bool "Static mode configuration for USB1 in SPL"
+	depends on AM33XX && SPL_MUSB_NEW && !SPL_OF_CONTROL
+
+choice
+	prompt "USB1 port configuration"
+	depends on AM335X_USB1
+
+config AM335X_USB1_HOST
+	bool "Port is used in host mode"
+
+config AM335X_USB1_PERIPHERAL
+	bool "Port is used in peripheral mode"
+
+endchoice
diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c
index ed809329f29c..7f1b84e466da 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -242,14 +242,14 @@ static struct ti_musb_plat usb1 = {
 #endif
 
 U_BOOT_DRVINFOS(am33xx_usbs) = {
-#if CONFIG_AM335X_USB0_MODE == MUSB_PERIPHERAL
+#ifdef CONFIG_AM335X_USB0_PERIPHERAL
 	{ "ti-musb-peripheral", &usb0 },
-#elif CONFIG_AM335X_USB0_MODE == MUSB_HOST
+#elif defined(CONFIG_AM335X_USB0_HOST)
 	{ "ti-musb-host", &usb0 },
 #endif
-#if CONFIG_AM335X_USB1_MODE == MUSB_PERIPHERAL
+#ifdef CONFIG_AM335X_USB1_PERIPHERAL
 	{ "ti-musb-peripheral", &usb1 },
-#elif CONFIG_AM335X_USB1_MODE == MUSB_HOST
+#elif defined(CONFIG_AM335X_USB1_HOST)
 	{ "ti-musb-host", &usb1 },
 #endif
 };
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index 535b269076cf..497127d4065b 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -4,6 +4,9 @@ CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
 CONFIG_AM33XX=y
+CONFIG_AM335X_USB0=y
+CONFIG_AM335X_USB0_PERIPHERAL=y
+CONFIG_AM335X_USB1=y
 CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_TIMESTAMP=y
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig
index ca3d01aea429..f8cc073c2329 100644
--- a/configs/am335x_guardian_defconfig
+++ b/configs/am335x_guardian_defconfig
@@ -10,6 +10,9 @@ CONFIG_ENV_OFFSET=0x500000
 CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian"
 CONFIG_AM33XX=y
 CONFIG_TARGET_AM335X_GUARDIAN=y
+CONFIG_AM335X_USB0=y
+CONFIG_AM335X_USB0_PERIPHERAL=y
+CONFIG_AM335X_USB1=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 9070845b7a64..4db04ff54e7e 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -201,18 +201,6 @@
  * in memory.
  */
 
-/*
- * USB configuration.  We enable MUSB support, both for host and for
- * gadget.  We set USB0 as peripheral and USB1 as host, based on the
- * board schematic and physical port wired to each.  Then for host we
- * add mass storage support and for gadget we add both RNDIS ethernet
- * and DFU.
- */
-#define CONFIG_AM335X_USB0
-#define CONFIG_AM335X_USB0_MODE	MUSB_PERIPHERAL
-#define CONFIG_AM335X_USB1
-#define CONFIG_AM335X_USB1_MODE MUSB_HOST
-
 /*
  * Disable MMC DM for SPL build and can be re-enabled after adding
  * DM support in SPL
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h
index 10a95a10a0eb..608a22db4442 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -129,9 +129,4 @@
 
 #endif /* CONFIG_MTD_RAW_NAND */
 
-#define CONFIG_AM335X_USB0
-#define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL
-#define CONFIG_AM335X_USB1
-#define CONFIG_AM335X_USB1_MODE MUSB_HOST
-
 #endif	/* ! __CONFIG_AM335X_GUARDIAN_H */
diff --git a/include/configs/baltos.h b/include/configs/baltos.h
index f4ab6640cdc8..b881d8c03fd7 100644
--- a/include/configs/baltos.h
+++ b/include/configs/baltos.h
@@ -214,18 +214,6 @@
 #endif
 #endif
 
-/*
- * USB configuration.  We enable MUSB support, both for host and for
- * gadget.  We set USB0 as peripheral and USB1 as host, based on the
- * board schematic and physical port wired to each.  Then for host we
- * add mass storage support and for gadget we add both RNDIS ethernet
- * and DFU.
- */
-#define CONFIG_AM335X_USB0
-#define CONFIG_AM335X_USB0_MODE	MUSB_HOST
-#define CONFIG_AM335X_USB1
-#define CONFIG_AM335X_USB1_MODE MUSB_OTG
-
 /* NAND support */
 #ifdef CONFIG_MTD_RAW_NAND
 #define GPMC_NAND_ECC_LP_x8_LAYOUT	1
diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h
index fe496272630d..aa2a07e910f8 100644
--- a/include/configs/chiliboard.h
+++ b/include/configs/chiliboard.h
@@ -127,10 +127,6 @@
 #define CONFIG_SYS_NAND_ECCBYTES	14
 /* NAND: SPL related configs */
 
-/* USB configuration */
-#define CONFIG_AM335X_USB1
-#define CONFIG_AM335X_USB1_MODE MUSB_HOST
-
 /*
  * Disable MMC DM for SPL build and can be re-enabled after adding
  * DM support in SPL
diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h
index c3a04c2f65a6..bfadf4a6b861 100644
--- a/include/configs/siemens-am33x-common.h
+++ b/include/configs/siemens-am33x-common.h
@@ -104,13 +104,6 @@
  */
 
 #ifndef CONFIG_SPL_BUILD
-/*
- * USB configuration
- */
-#define CONFIG_AM335X_USB0
-#define CONFIG_AM335X_USB0_MODE	MUSB_PERIPHERAL
-#define CONFIG_AM335X_USB1
-#define CONFIG_AM335X_USB1_MODE MUSB_HOST
 
 /* USB DRACO ID as default */
 #define CONFIG_USBD_HS
-- 
2.25.1



More information about the U-Boot mailing list