net: phy: micrel: Separate KSZ9000 drivers from KSZ8000 drivers

The KS8721BL and KSZ9021 PHYs are software-incompatible, yet they
share the same ID. Drivers for bothe PHYs cannot safely coexist, so
the solution was to use #ifdefs to select between the two drivers.

As a result KSZ9031, which has a unique ID, is now caught in the
crossfire. Unless CONFIG_PHY_MICREL_KSZ9031 is defined, the KSZ9031
will not function properly, as some essential configuration code is
ifdef'd-out.

To prevent such situations, move the KSZ9000 drivers to a separate
file, and place them under a separate Kconfig option. While it is
possible to enable both KSZ8000 and KSZ9000 drivers at the same time,
the assumption is that it is highly unlikely for a system to contain
both a KSZ8000 and a KSZ9000 PHY, and that only one of the drivers
will be enabled at any given time.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 1afd809..aecf7ed 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -69,6 +69,7 @@
 config PHY_MICREL_KSZ9021
 	bool "Micrel KSZ9021 family support"
 	select PHY_GIGE
+	select PHY_MICREL_KSZ90X1
 	help
 	  Enable support for the Micrel KSZ9021 GbE PHY family.  If
 	  enabled, the extended register read/write for KSZ9021 PHYs
@@ -80,9 +81,12 @@
 	  KSZ8921BL, so enabling this option disables support for the
 	  KSZ8721BL.
 
+	  Deprecated. Use PHY_MICREL_KSZ90X1 instead.
+
 config PHY_MICREL_KSZ9031
 	bool "Micrel KSZ9031 family support"
 	select PHY_GIGE
+	select PHY_MICREL_KSZ90X1
 	help
 	  Enable support for the Micrel KSZ9031 GbE PHY family.  If
 	  enabled, the extended register read/write for KSZ9021 PHYs
@@ -90,6 +94,32 @@
 	  delays configured in the device tree will be applied to the
 	  PHY during initialisatioin.
 
+	  Deprecated. Use PHY_MICREL_KSZ90X1 instead.
+
+config PHY_MICREL_KSZ90X1
+	bool "Micrel KSZ90x1 family support"
+	select PHY_GIGE
+	help
+	  Enable support for the Micrel KSZ9021 and KSZ9031 GbE PHYs. If
+	  enabled, the extended register read/write for KSZ90x1 PHYs
+	  is supported through the 'mdio' command and any RGMII signal
+	  delays configured in the device tree will be applied to the
+	  PHY during initialization.
+
+	  This should not be enabled at the same time with PHY_MICREL_KSZ8XXX
+	  as the KSZ9021 and KS8721 share the same ID.
+
+config PHY_MICREL_KSZ8XXX
+	bool "Micrel KSZ8xxx family support"
+	default y if !PHY_MICREL_KSZ90X1
+	help
+	  Enable support for the 8000 series GbE PHYs manufactured by Micrel
+	  (now a part of Microchip). This includes drivers for the KSZ804,
+	  KSZ8031, KSZ8051, KSZ8081, KSZ8895, KSZ886x, and KSZ8721.
+
+	  This should not be enabled at the same time with PHY_MICREL_KSZ90X1
+	  as the KSZ9021 and KS8721 share the same ID.
+
 endif # PHY_MICREL
 
 config PHY_MSCC