From acdf89ec060931ae4c87780ab0e65a6783ccd94b Mon Sep 17 00:00:00 2001
From: Tom Rini <trini@konsulko.com>
Date: Fri, 2 Dec 2022 16:42:32 -0500
Subject: [PATCH] Convert CONFIG_KSNET_NETCP_V1_0 et al to Kconfig

This converts the following to Kconfig:
   CONFIG_KSNET_NETCP_V1_0
   CONFIG_KSNET_NETCP_V1_5

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 configs/k2hk_evm_defconfig    |  1 +
 configs/k2hk_hs_evm_defconfig |  1 +
 drivers/net/ti/Kconfig        | 13 +++++++++++++
 include/configs/k2e_evm.h     |  1 -
 include/configs/k2g_evm.h     |  1 -
 include/configs/k2hk_evm.h    |  1 -
 include/configs/k2l_evm.h     |  1 -
 7 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/configs/k2hk_evm_defconfig b/configs/k2hk_evm_defconfig
index b0069fd60b..2bcf2265c7 100644
--- a/configs/k2hk_evm_defconfig
+++ b/configs/k2hk_evm_defconfig
@@ -87,6 +87,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_KEYSTONE_NET=y
+CONFIG_KSNET_NETCP_V1_0=y
 CONFIG_PHY=y
 CONFIG_NOP_PHY=y
 CONFIG_KEYSTONE_USB_PHY=y
diff --git a/configs/k2hk_hs_evm_defconfig b/configs/k2hk_hs_evm_defconfig
index 9ca26ae61f..94ab680343 100644
--- a/configs/k2hk_hs_evm_defconfig
+++ b/configs/k2hk_hs_evm_defconfig
@@ -62,6 +62,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_KEYSTONE_NET=y
+CONFIG_KSNET_NETCP_V1_0=y
 CONFIG_PHY=y
 CONFIG_NOP_PHY=y
 CONFIG_KEYSTONE_USB_PHY=y
diff --git a/drivers/net/ti/Kconfig b/drivers/net/ti/Kconfig
index 59c96d862d..e13dbc9401 100644
--- a/drivers/net/ti/Kconfig
+++ b/drivers/net/ti/Kconfig
@@ -25,6 +25,19 @@ config DRIVER_TI_KEYSTONE_NET
 	help
 	   This driver supports the TI Keystone 2 Ethernet subsystem
 
+choice
+	prompt "TI Keystone 2 Ethernet NETCP IP revision"
+	depends on DRIVER_TI_KEYSTONE_NET
+	default KSNET_NETCP_V1_5
+
+config KSNET_NETCP_V1_0
+	bool "NETCP version 1.0"
+
+config KSNET_NETCP_V1_5
+	bool "NETCP version 1.5"
+
+endchoice
+
 config TI_AM65_CPSW_NUSS
 	bool "TI K3 AM65x MCU CPSW Nuss Ethernet controller driver"
 	depends on ARCH_K3
diff --git a/include/configs/k2e_evm.h b/include/configs/k2e_evm.h
index 174a91c83e..1283f450b3 100644
--- a/include/configs/k2e_evm.h
+++ b/include/configs/k2e_evm.h
@@ -37,7 +37,6 @@
 #define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
 
 /* Network */
-#define CONFIG_KSNET_NETCP_V1_5
 #define CONFIG_KSNET_CPSW_NUM_PORTS	9
 
 #endif /* __CONFIG_K2E_EVM_H */
diff --git a/include/configs/k2g_evm.h b/include/configs/k2g_evm.h
index dc06d5943e..fd3708ba81 100644
--- a/include/configs/k2g_evm.h
+++ b/include/configs/k2g_evm.h
@@ -51,7 +51,6 @@
 	"name_fs=arago-base-tisdk-image-k2g-evm.cpio\0"
 
 /* Network */
-#define CONFIG_KSNET_NETCP_V1_5
 #define CONFIG_KSNET_CPSW_NUM_PORTS	2
 #define PHY_ANEG_TIMEOUT	10000 /* PHY needs longer aneg time */
 
diff --git a/include/configs/k2hk_evm.h b/include/configs/k2hk_evm.h
index 68cbe98b55..36e3c59d1c 100644
--- a/include/configs/k2hk_evm.h
+++ b/include/configs/k2hk_evm.h
@@ -37,7 +37,6 @@
 #define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
 
 /* Network */
-#define CONFIG_KSNET_NETCP_V1_0
 #define CONFIG_KSNET_CPSW_NUM_PORTS	5
 
 #endif /* __CONFIG_K2HK_EVM_H */
diff --git a/include/configs/k2l_evm.h b/include/configs/k2l_evm.h
index 5d629452ba..cb7b036781 100644
--- a/include/configs/k2l_evm.h
+++ b/include/configs/k2l_evm.h
@@ -37,7 +37,6 @@
 #define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
 
 /* Network */
-#define CONFIG_KSNET_NETCP_V1_5
 #define CONFIG_KSNET_CPSW_NUM_PORTS	5
 
 #endif /* __CONFIG_K2L_EVM_H */
-- 
2.39.5