[PATCH] net: phy: add driver for Motorcomm yt8511 phy

Subsystems: ethernet phy library, motorcomm phy driver, networking drivers, the rest

STALE1904d

12 messages, 4 authors, 2021-05-19 · open the first message on its own page

[PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Peter Geis <hidden>
Date: 2021-05-11 21:46:41

Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 601b5ae0368a..2a2e406238fc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12388,6 +12388,12 @@ F:	Documentation/userspace-api/media/drivers/meye*
 F:	drivers/media/pci/meye/
 F:	include/uapi/linux/meye.h
 
+MOTORCOMM PHY DRIVER
+M:	Peter Geis <pgwipeout@gmail.com>
+L:	netdev@vger.kernel.org
+S:	Maintained
+F:	drivers/net/phy/motorcomm.c
+
 MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD
 S:	Orphan
 F:	Documentation/driver-api/serial/moxa-smartio.rst
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 288bf405ebdb..16db9f8037b5 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -229,6 +229,12 @@ config MICROSEMI_PHY
 	help
 	  Currently supports VSC8514, VSC8530, VSC8531, VSC8540 and VSC8541 PHYs
 
+config MOTORCOMM_PHY
+	tristate "Motorcomm PHYs"
+	help
+	  Enables support for Motorcomm network PHYs.
+	  Currently supports the YT8511 gigabit PHY.
+
 config NATIONAL_PHY
 	tristate "National Semiconductor PHYs"
 	help
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index bcda7ed2455d..37ffbc6e3c87 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_MICREL_PHY)	+= micrel.o
 obj-$(CONFIG_MICROCHIP_PHY)	+= microchip.o
 obj-$(CONFIG_MICROCHIP_T1_PHY)	+= microchip_t1.o
 obj-$(CONFIG_MICROSEMI_PHY)	+= mscc/
+obj-$(CONFIG_MOTORCOMM_PHY)	+= motorcomm.o
 obj-$(CONFIG_NATIONAL_PHY)	+= national.o
 obj-$(CONFIG_NXP_C45_TJA11XX_PHY)	+= nxp-c45-tja11xx.o
 obj-$(CONFIG_NXP_TJA11XX_PHY)	+= nxp-tja11xx.o
diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
new file mode 100644
index 000000000000..c6923dcf9f8f
--- /dev/null
+++ b/drivers/net/phy/motorcomm.c
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Driver for Motorcomm PHYs
+ *
+ * Author: Peter Geis <pgwipeout@gmail.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/phy.h>
+
+#define PHY_ID_YT8511		0x0000010a
+
+#define YT8511_PAGE_SELECT	0x1e
+#define YT8511_PAGE		0x1f
+#define YT8511_EXT_CLK_GATE	0x0c
+#define YT8511_EXT_SLEEP_CTRL	0x27
+
+/* 2b00 25m from pll
+ * 2b01 25m from xtl *default*
+ * 2b10 62.m from pll
+ * 2b11 125m from pll
+ */
+#define YT8511_CLK_125M		(BIT(2) | BIT(1))
+
+static int yt8511_read_page(struct phy_device *phydev)
+{
+	return __phy_read(phydev, YT8511_PAGE_SELECT);
+};
+
+static int yt8511_write_page(struct phy_device *phydev, int page)
+{
+	return __phy_write(phydev, YT8511_PAGE_SELECT, page);
+};
+
+static int yt8511_config_init(struct phy_device *phydev)
+{
+	int ret, val, oldpage;
+
+	/* set clock mode to 125mhz */
+	oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
+	if (oldpage < 0)
+		goto err_restore_page;
+
+	val = __phy_read(phydev, YT8511_PAGE);
+	val |= (YT8511_CLK_125M);
+	ret = __phy_write(phydev, YT8511_PAGE, val);
+
+	/* disable auto sleep */
+	ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
+	val = __phy_read(phydev, YT8511_PAGE);
+	val &= (~BIT(15));
+	ret = __phy_write(phydev, YT8511_PAGE, val);
+
+err_restore_page:
+	return phy_restore_page(phydev, oldpage, ret);
+}
+
+static struct phy_driver motorcomm_phy_drvs[] = {
+	{
+		PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
+		.name		= "YT8511 Gigabit Ethernet",
+		.config_init	= &yt8511_config_init,
+		.get_features	= genphy_read_abilities,
+		.config_aneg	= genphy_config_aneg,
+		.read_status	= genphy_read_status,
+		.suspend	= genphy_suspend,
+		.resume		= genphy_resume,
+		.read_page	= yt8511_read_page,
+		.write_page	= yt8511_write_page,
+	},
+};
+
+module_phy_driver(motorcomm_phy_drvs);
+
+MODULE_DESCRIPTION("Motorcomm PHY driver");
+MODULE_AUTHOR("Peter Geis");
+MODULE_LICENSE("GPL");
+
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+	{ PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+	{ /* sentinal */ }
+};
+
+MODULE_DEVICE_TABLE(mdio, motorcomm_tbl);
-- 
2.25.1

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Date: 2021-05-11 21:56:53

Hi,

On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
+static int yt8511_config_init(struct phy_device *phydev)
+{
+	int ret, val, oldpage;
+
+	/* set clock mode to 125mhz */
+	oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
+	if (oldpage < 0)
+		goto err_restore_page;
+
+	val = __phy_read(phydev, YT8511_PAGE);
+	val |= (YT8511_CLK_125M);
+	ret = __phy_write(phydev, YT8511_PAGE, val);
Please consider __phy_modify(), and handle any error it returns.
+
+	/* disable auto sleep */
+	ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
Please consider handling a failure to write here.
+	val = __phy_read(phydev, YT8511_PAGE);
+	val &= (~BIT(15));
+	ret = __phy_write(phydev, YT8511_PAGE, val);
Also a use for __phy_modify().
+
+err_restore_page:
+	return phy_restore_page(phydev, oldpage, ret);
+}
+
+static struct phy_driver motorcomm_phy_drvs[] = {
+	{
+		PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
+		.name		= "YT8511 Gigabit Ethernet",
+		.config_init	= &yt8511_config_init,
Please drop the '&' here, it's unnecessary.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Peter Geis <hidden>
Date: 2021-05-11 22:56:46

On Tue, May 11, 2021 at 5:56 PM Russell King - ARM Linux admin
[off-list ref] wrote:
Hi,

On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
+static int yt8511_config_init(struct phy_device *phydev)
+{
+     int ret, val, oldpage;
+
+     /* set clock mode to 125mhz */
+     oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
+     if (oldpage < 0)
+             goto err_restore_page;
+
+     val = __phy_read(phydev, YT8511_PAGE);
+     val |= (YT8511_CLK_125M);
+     ret = __phy_write(phydev, YT8511_PAGE, val);
Please consider __phy_modify(), and handle any error it returns.
Hey that's really neat, thanks!
quoted
+
+     /* disable auto sleep */
+     ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
Please consider handling a failure to write here.
Will do.
quoted
+     val = __phy_read(phydev, YT8511_PAGE);
+     val &= (~BIT(15));
+     ret = __phy_write(phydev, YT8511_PAGE, val);
Also a use for __phy_modify().
quoted
+
+err_restore_page:
+     return phy_restore_page(phydev, oldpage, ret);
+}
+
+static struct phy_driver motorcomm_phy_drvs[] = {
+     {
+             PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
+             .name           = "YT8511 Gigabit Ethernet",
+             .config_init    = &yt8511_config_init,
Please drop the '&' here, it's unnecessary.
Will do, thank you.
Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Leon Romanovsky <leon@kernel.org>
Date: 2021-05-18 09:00:19

On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
<...>
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+	{ PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+	{ /* sentinal */ }
+}
Why is this "__maybe_unused"? This *.c file doesn't have any compilation option
to compile part of it.

The "__maybe_unused" is not needed in this case.

Thanks

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Peter Geis <hidden>
Date: 2021-05-19 00:20:22

On Tue, May 18, 2021 at 4:59 AM Leon Romanovsky [off-list ref] wrote:
On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
<...>
quoted
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+     { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+     { /* sentinal */ }
+}
Why is this "__maybe_unused"? This *.c file doesn't have any compilation option
to compile part of it.

The "__maybe_unused" is not needed in this case.
I was simply following convention, for example the realtek.c,
micrel.c, and smsc.c drivers all have this as well.
Thanks

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Leon Romanovsky <leon@kernel.org>
Date: 2021-05-19 08:18:26

On Tue, May 18, 2021 at 08:20:03PM -0400, Peter Geis wrote:
On Tue, May 18, 2021 at 4:59 AM Leon Romanovsky [off-list ref] wrote:
quoted
On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
<...>
quoted
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+     { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+     { /* sentinal */ }
+}
Why is this "__maybe_unused"? This *.c file doesn't have any compilation option
to compile part of it.

The "__maybe_unused" is not needed in this case.
I was simply following convention, for example the realtek.c,
micrel.c, and smsc.c drivers all have this as well.
Maybe they have a reason, but this specific driver doesn't have such.

Thanks
quoted
Thanks

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: 2021-05-19 10:38:14

On 19.05.2021 10:18, Leon Romanovsky wrote:
On Tue, May 18, 2021 at 08:20:03PM -0400, Peter Geis wrote:
quoted
On Tue, May 18, 2021 at 4:59 AM Leon Romanovsky [off-list ref] wrote:
quoted
On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
<...>
quoted
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+     { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+     { /* sentinal */ }
+}
Why is this "__maybe_unused"? This *.c file doesn't have any compilation option
to compile part of it.

The "__maybe_unused" is not needed in this case.
I was simply following convention, for example the realtek.c,
micrel.c, and smsc.c drivers all have this as well.
Maybe they have a reason, but this specific driver doesn't have such.
It's used like this:
MODULE_DEVICE_TABLE(mdio, <mdio_device_id_tbl>);

And MODULE_DEVICE_TABLE is a no-op if MODULE isn't defined:

#ifdef MODULE
/* Creates an alias so file2alias.c can find device table. */
#define MODULE_DEVICE_TABLE(type, name)					\
extern typeof(name) __mod_##type##__##name##_device_table		\
  __attribute__ ((unused, alias(__stringify(name))))
#else  /* !MODULE */
#define MODULE_DEVICE_TABLE(type, name)
#endif

In this case the table is unused.
Thanks
quoted
quoted
Thanks

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Leon Romanovsky <leon@kernel.org>
Date: 2021-05-19 11:50:16

On Wed, May 19, 2021 at 12:37:43PM +0200, Heiner Kallweit wrote:
On 19.05.2021 10:18, Leon Romanovsky wrote:
quoted
On Tue, May 18, 2021 at 08:20:03PM -0400, Peter Geis wrote:
quoted
On Tue, May 18, 2021 at 4:59 AM Leon Romanovsky [off-list ref] wrote:
quoted
On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
<...>
quoted
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+     { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+     { /* sentinal */ }
+}
Why is this "__maybe_unused"? This *.c file doesn't have any compilation option
to compile part of it.

The "__maybe_unused" is not needed in this case.
I was simply following convention, for example the realtek.c,
micrel.c, and smsc.c drivers all have this as well.
Maybe they have a reason, but this specific driver doesn't have such.
It's used like this:
MODULE_DEVICE_TABLE(mdio, <mdio_device_id_tbl>);

And MODULE_DEVICE_TABLE is a no-op if MODULE isn't defined:

#ifdef MODULE
/* Creates an alias so file2alias.c can find device table. */
#define MODULE_DEVICE_TABLE(type, name)					\
extern typeof(name) __mod_##type##__##name##_device_table		\
  __attribute__ ((unused, alias(__stringify(name))))
#else  /* !MODULE */
#define MODULE_DEVICE_TABLE(type, name)
#endif

In this case the table is unused.
Do you see compilation warning for such scenario?

Thanks
quoted
Thanks
quoted
quoted
Thanks

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Peter Geis <hidden>
Date: 2021-05-19 12:45:36

On Wed, May 19, 2021 at 7:50 AM Leon Romanovsky [off-list ref] wrote:
On Wed, May 19, 2021 at 12:37:43PM +0200, Heiner Kallweit wrote:
quoted
On 19.05.2021 10:18, Leon Romanovsky wrote:
quoted
On Tue, May 18, 2021 at 08:20:03PM -0400, Peter Geis wrote:
quoted
On Tue, May 18, 2021 at 4:59 AM Leon Romanovsky [off-list ref] wrote:
quoted
On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
<...>
quoted
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+     { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+     { /* sentinal */ }
+}
Why is this "__maybe_unused"? This *.c file doesn't have any compilation option
to compile part of it.

The "__maybe_unused" is not needed in this case.
I was simply following convention, for example the realtek.c,
micrel.c, and smsc.c drivers all have this as well.
Maybe they have a reason, but this specific driver doesn't have such.
It's used like this:
MODULE_DEVICE_TABLE(mdio, <mdio_device_id_tbl>);

And MODULE_DEVICE_TABLE is a no-op if MODULE isn't defined:

#ifdef MODULE
/* Creates an alias so file2alias.c can find device table. */
#define MODULE_DEVICE_TABLE(type, name)                                       \
extern typeof(name) __mod_##type##__##name##_device_table             \
  __attribute__ ((unused, alias(__stringify(name))))
#else  /* !MODULE */
#define MODULE_DEVICE_TABLE(type, name)
#endif

In this case the table is unused.
Do you see compilation warning for such scenario?
The issue you are describing has been fixed since 2010:

commit cf93c94581bab447a5634c6d737c1cf38c080261
Author: Uwe Kleine-König [off-list ref]
Date:   Sun Oct 3 23:43:32 2010 +0000

    net/phy: fix many "defined but unused" warnings

    MODULE_DEVICE_TABLE only expands to something if it's compiled
    for a module.  So when building-in support for the phys, the
    mdio_device_id tables are unused.  Marking them with __maybe_unused
    fixes the following warnings:

There is a strong push to fix all warnings during build, including W=1 warnings.
For fun I rebuilt without module support and confirmed that removing
this does trigger a W=1 warning.
Thanks
quoted
quoted
Thanks
quoted
quoted
Thanks

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Leon Romanovsky <leon@kernel.org>
Date: 2021-05-19 12:56:27

On Wed, May 19, 2021 at 08:45:21AM -0400, Peter Geis wrote:
On Wed, May 19, 2021 at 7:50 AM Leon Romanovsky [off-list ref] wrote:
quoted
On Wed, May 19, 2021 at 12:37:43PM +0200, Heiner Kallweit wrote:
quoted
On 19.05.2021 10:18, Leon Romanovsky wrote:
quoted
On Tue, May 18, 2021 at 08:20:03PM -0400, Peter Geis wrote:
quoted
On Tue, May 18, 2021 at 4:59 AM Leon Romanovsky [off-list ref] wrote:
quoted
On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
quoted
Add a driver for the Motorcomm yt8511 phy that will be used in the
production Pine64 rk3566-quartz64 development board.
It supports gigabit transfer speeds, rgmii, and 125mhz clk output.

Signed-off-by: Peter Geis <redacted>
---
 MAINTAINERS                 |  6 +++
 drivers/net/phy/Kconfig     |  6 +++
 drivers/net/phy/Makefile    |  1 +
 drivers/net/phy/motorcomm.c | 85 +++++++++++++++++++++++++++++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 drivers/net/phy/motorcomm.c
<...>
quoted
+static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
+     { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
+     { /* sentinal */ }
+}
Why is this "__maybe_unused"? This *.c file doesn't have any compilation option
to compile part of it.

The "__maybe_unused" is not needed in this case.
I was simply following convention, for example the realtek.c,
micrel.c, and smsc.c drivers all have this as well.
Maybe they have a reason, but this specific driver doesn't have such.
It's used like this:
MODULE_DEVICE_TABLE(mdio, <mdio_device_id_tbl>);

And MODULE_DEVICE_TABLE is a no-op if MODULE isn't defined:

#ifdef MODULE
/* Creates an alias so file2alias.c can find device table. */
#define MODULE_DEVICE_TABLE(type, name)                                       \
extern typeof(name) __mod_##type##__##name##_device_table             \
  __attribute__ ((unused, alias(__stringify(name))))
#else  /* !MODULE */
#define MODULE_DEVICE_TABLE(type, name)
#endif

In this case the table is unused.
Do you see compilation warning for such scenario?
The issue you are describing has been fixed since 2010:

commit cf93c94581bab447a5634c6d737c1cf38c080261
Author: Uwe Kleine-König [off-list ref]
Date:   Sun Oct 3 23:43:32 2010 +0000

    net/phy: fix many "defined but unused" warnings

    MODULE_DEVICE_TABLE only expands to something if it's compiled
    for a module.  So when building-in support for the phys, the
    mdio_device_id tables are unused.  Marking them with __maybe_unused
    fixes the following warnings:

There is a strong push to fix all warnings during build, including W=1 warnings.
For fun I rebuilt without module support and confirmed that removing
this does trigger a W=1 warning.
I'm sorry that I continue to ask, but is net/phy/* usable without MODULE?
If not, the better fix is to require it in Kconfig instead of fixing all drivers.

Thanks for your answers.
quoted
Thanks
quoted
quoted
Thanks
quoted
quoted
Thanks

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2021-05-19 13:15:34

On Wed, May 19, 2021 at 03:56:18PM +0300, Leon Romanovsky wrote:
I'm sorry that I continue to ask, but is net/phy/* usable without MODULE?
Simple answer: it is.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Peter Geis <hidden>
Date: 2021-05-19 13:25:29

On Wed, May 19, 2021 at 9:15 AM Russell King (Oracle)
[off-list ref] wrote:
On Wed, May 19, 2021 at 03:56:18PM +0300, Leon Romanovsky wrote:
quoted
I'm sorry that I continue to ask, but is net/phy/* usable without MODULE?
Simple answer: it is.
As far as I can tell, so correct me if I'm wrong, MODULE_DEVICE_TABLE
is what permits the module system to automatically load the correct
module for the device.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help