From bd3ef27886dcb1c496a4583eb8b894296edf045d Mon Sep 17 00:00:00 2001
From: Tom Rini <trini@konsulko.com>
Date: Wed, 30 Mar 2022 18:07:13 -0400
Subject: [PATCH] tegra: Migrate CI_UDC_HAS_HOSTPC to Kconfig

This option is only enabled for CI_UDC and !TEGRA20, so implement it as
such in Kconfig directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
---
 arch/arm/mach-tegra/Kconfig               |  4 ++++
 include/configs/apalis-tk1.h              |  1 -
 include/configs/apalis_t30.h              |  1 -
 include/configs/beaver.h                  |  1 -
 include/configs/cei-tk1-som.h             |  1 -
 include/configs/colibri_t20.h             |  1 -
 include/configs/colibri_t30.h             |  1 -
 include/configs/dalmore.h                 |  1 -
 include/configs/jetson-tk1.h              |  1 -
 include/configs/nyan-big.h                |  1 -
 include/configs/p2371-0000.h              |  1 -
 include/configs/p2371-2180.h              |  1 -
 include/configs/p2571.h                   |  1 -
 include/configs/p3450-0000.h              |  1 -
 include/configs/tegra-common-usb-gadget.h | 18 ------------------
 include/configs/venice2.h                 |  1 -
 16 files changed, 4 insertions(+), 32 deletions(-)
 delete mode 100644 include/configs/tegra-common-usb-gadget.h

diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 957e3ce64a..5309be9cc2 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -164,6 +164,10 @@ config TEGRA_DISCONNECT_UDC_ON_BOOT
 	  USB controller when U-Boot boots to avoid leaving a stale USB device
 	  present.
 
+config CI_UDC_HAS_HOSTPC
+	def_bool y
+	depends on CI_UDC && !TEGRA20
+
 config SYS_MALLOC_F_LEN
 	default 0x1800
 
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index da935f77b9..59c901994f 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -111,7 +111,6 @@
 #undef CONFIG_SYS_MAXARGS
 #define CONFIG_SYS_MAXARGS		32
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index eab4f22be3..b7a2fb695e 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -49,7 +49,6 @@
 #define BOARD_EXTRA_ENV_SETTINGS \
 	UBOOT_UPDATE
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/beaver.h b/include/configs/beaver.h
index 8be491e601..1d51bb4e4c 100644
--- a/include/configs/beaver.h
+++ b/include/configs/beaver.h
@@ -24,7 +24,6 @@
 #define CONFIG_TEGRA_SLINK_CTRLS       6
 #define CONFIG_SPI_FLASH_SIZE          (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/cei-tk1-som.h b/include/configs/cei-tk1-som.h
index 1cc8609102..0672b7dbbe 100644
--- a/include/configs/cei-tk1-som.h
+++ b/include/configs/cei-tk1-som.h
@@ -25,7 +25,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index c45016a835..fdf6bb2841 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -39,7 +39,6 @@
 #undef CONFIG_SYS_MAXARGS
 #define CONFIG_SYS_MAXARGS		32
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index 324e607839..cbe73bf86b 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -47,7 +47,6 @@
 #define BOARD_EXTRA_ENV_SETTINGS \
 	UBOOT_UPDATE
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h
index 2a020e96c4..e03a24adca 100644
--- a/include/configs/dalmore.h
+++ b/include/configs/dalmore.h
@@ -22,7 +22,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE          (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/jetson-tk1.h b/include/configs/jetson-tk1.h
index b4c42fd372..69aa55f86c 100644
--- a/include/configs/jetson-tk1.h
+++ b/include/configs/jetson-tk1.h
@@ -23,7 +23,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index 3584d9ad90..bc5754566b 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -26,7 +26,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE          (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/p2371-0000.h b/include/configs/p2371-0000.h
index 5cebafc7c7..ecd0405d29 100644
--- a/include/configs/p2371-0000.h
+++ b/include/configs/p2371-0000.h
@@ -22,7 +22,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* _P2371_0000_H */
diff --git a/include/configs/p2371-2180.h b/include/configs/p2371-2180.h
index 5e1d50b254..ef1fa2a592 100644
--- a/include/configs/p2371-2180.h
+++ b/include/configs/p2371-2180.h
@@ -22,7 +22,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 /* Crystal is 38.4MHz. clk_m runs at half that rate */
diff --git a/include/configs/p2571.h b/include/configs/p2571.h
index 5a89dc8a4a..50cddb4a4a 100644
--- a/include/configs/p2571.h
+++ b/include/configs/p2571.h
@@ -22,7 +22,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE		(4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* _P2571_H */
diff --git a/include/configs/p3450-0000.h b/include/configs/p3450-0000.h
index b03d3a433b..1c962be8b8 100644
--- a/include/configs/p3450-0000.h
+++ b/include/configs/p3450-0000.h
@@ -33,7 +33,6 @@
 	"fi\0"
 
 /* General networking support */
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 /* Crystal is 38.4MHz. clk_m runs at half that rate */
diff --git a/include/configs/tegra-common-usb-gadget.h b/include/configs/tegra-common-usb-gadget.h
deleted file mode 100644
index 201f4bc093..0000000000
--- a/include/configs/tegra-common-usb-gadget.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * (C) Copyright 2014
- * NVIDIA Corporation <www.nvidia.com>
- */
-
-#ifndef _TEGRA_COMMON_USB_GADGET_H_
-#define _TEGRA_COMMON_USB_GADGET_H_
-
-#ifndef CONFIG_SPL_BUILD
-/* USB gadget mode support*/
-#ifndef CONFIG_TEGRA20
-#define CONFIG_CI_UDC_HAS_HOSTPC
-#endif
-/* DFU protocol */
-#endif
-
-#endif /* _TEGRA_COMMON_USB_GADGET_H_ */
diff --git a/include/configs/venice2.h b/include/configs/venice2.h
index fe861a6f7b..03aa7adcc0 100644
--- a/include/configs/venice2.h
+++ b/include/configs/venice2.h
@@ -23,7 +23,6 @@
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE          (4 << 20)
 
-#include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
-- 
2.39.5