Add of_mdio fixes to make device tree fixed-link definitions work properly

This commit is contained in:
Ben Hutchings 2016-10-02 16:26:16 +01:00
parent c418b49b09
commit 78f97bb258
4 changed files with 135 additions and 0 deletions

2
debian/changelog vendored
View File

@ -65,6 +65,8 @@ linux (4.7.6-1) UNRELEASED; urgency=medium
* udeb: Fold core-modules into kernel-image
* udeb: Move nls_utf8 from fat-modules to kernel-image, as many other
filesystems need it but vfat no longer does
* of_mdio: Enable fixed PHY support if driver is a module
* of_mdio: select fixed phy support unconditionally
[ Cyril Brulebois ]
* Add nls_ascii to the fat-modules udeb, following the change of

View File

@ -0,0 +1,42 @@
From: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date: Tue, 21 Jun 2016 01:17:17 +0100
Subject: of_mdio: Enable fixed PHY support if driver is a module
Origin: https://git.kernel.org/linus/d1bd330a229fc8a69f0e7532138dfd42b4542fd4
The fixed_phy driver doesn't have to be built-in, and it's
important that of_mdio supports it even if it's a module.
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/of/of_mdio.c | 2 +-
include/linux/of_mdio.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index e051e1b57609..de68707a99c7 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -361,7 +361,7 @@ struct phy_device *of_phy_attach(struct net_device *dev,
}
EXPORT_SYMBOL(of_phy_attach);
-#if defined(CONFIG_FIXED_PHY)
+#if IS_ENABLED(CONFIG_FIXED_PHY)
/*
* of_phy_is_fixed_link() and of_phy_register_fixed_link() must
* support two DT bindings:
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 8f2237eb3485..6c8cb9aa4c00 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -69,7 +69,7 @@ static inline int of_mdio_parse_addr(struct device *dev,
}
#endif /* CONFIG_OF */
-#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
+#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_FIXED_PHY)
extern int of_phy_register_fixed_link(struct device_node *np);
extern bool of_phy_is_fixed_link(struct device_node *np);
#else

View File

@ -0,0 +1,89 @@
From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 24 Jun 2016 11:24:08 +0200
Subject: of_mdio: select fixed phy support unconditionally
Origin: https://git.kernel.org/linus/a5e4bd991362223346e1d3561e61d7a25797fe25
Calling the fixed-phy functions when CONFIG_FIXED_PHY=m as a previous
change tried cannot work if the caller is in built-in code:
drivers/of/built-in.o: In function `of_phy_register_fixed_link':
of_reserved_mem.c:(.text+0x85e0): undefined reference to `fixed_phy_register'
Making of_mdio depend on 'FIXED_PHY || !FIXED_PHY' would solve this
dependency by enforcing that OF_MDIO itself becomes a loadable module
when FIXED_PHY=y, but that creates a different dependency as it
breaks any built-in ethernet driver that uses of_mdio.
Making FIXED_PHY a bool option also cannot work, since it depends on
PHYLIB, which again is tristate.
This version now uses 'select FIXED_PHY' to ensure that the fixed-phy
portion of of_mdio is not optional. The main downside of this is
a small increase in code size for cases that do not need fixed phy
support, but it should avoid all of the link-time problems.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: d1bd330a229f ("of_mdio: Enable fixed PHY support if driver is a module")
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/of/Kconfig | 1 +
drivers/of/of_mdio.c | 2 --
include/linux/of_mdio.h | 8 ++------
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index b3bec3aaa45d..bc07ad30c9bf 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -74,6 +74,7 @@ config OF_NET
config OF_MDIO
def_tristate PHYLIB
depends on PHYLIB
+ select FIXED_PHY
help
OpenFirmware MDIO bus (Ethernet PHY) accessors
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index de68707a99c7..e2b50bc12f23 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -361,7 +361,6 @@ struct phy_device *of_phy_attach(struct net_device *dev,
}
EXPORT_SYMBOL(of_phy_attach);
-#if IS_ENABLED(CONFIG_FIXED_PHY)
/*
* of_phy_is_fixed_link() and of_phy_register_fixed_link() must
* support two DT bindings:
@@ -451,4 +450,3 @@ int of_phy_register_fixed_link(struct device_node *np)
return -ENODEV;
}
EXPORT_SYMBOL(of_phy_register_fixed_link);
-#endif
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 6c8cb9aa4c00..4b04587d0441 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -25,6 +25,8 @@ struct phy_device *of_phy_attach(struct net_device *dev,
extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
+extern int of_phy_register_fixed_link(struct device_node *np);
+extern bool of_phy_is_fixed_link(struct device_node *np);
#else /* CONFIG_OF */
static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
@@ -67,12 +69,6 @@ static inline int of_mdio_parse_addr(struct device *dev,
{
return -ENOSYS;
}
-#endif /* CONFIG_OF */
-
-#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_FIXED_PHY)
-extern int of_phy_register_fixed_link(struct device_node *np);
-extern bool of_phy_is_fixed_link(struct device_node *np);
-#else
static inline int of_phy_register_fixed_link(struct device_node *np)
{
return -ENOSYS;

View File

@ -75,6 +75,8 @@ bugfix/all/disable-some-marvell-phys.patch
bugfix/all/fs-add-module_softdep-declarations-for-hard-coded-cr.patch
bugfix/all/kbuild-do-not-use-hyphen-in-exported-variable-name.patch
bugfix/all/ext4-fix-bug-838544.patch
bugfix/all/of_mdio-enable-fixed-phy-support-if-driver-is-a-modu.patch
bugfix/all/of_mdio-select-fixed-phy-support-unconditionally.patch
# Miscellaneous features