diff options
author | Andrew Lunn <andrew@lunn.ch> | 2016-01-27 20:30:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-29 01:53:16 -0500 |
commit | ae461131960b27d4be158d62a89d40977388d7a1 (patch) | |
tree | e3a1824525a42cc2e907e42151985191f104c923 /drivers/of | |
parent | a77ce1bc12d6e0c03e9cc5683bb657ae2f2bb9b5 (diff) |
of: of_mdio: Add a whitelist of PHY compatibilities.
Some phy nodes list a compatible value indicating the PHY make/model.
This is never used to match the device to the driver. However it does
confuse the code to separate a PHY from a generic MDIO device like a
switch. Generic MDIO devices must have a compatible value, PHYs can
list clause 22 or 45, but nothing else.
Issue a warning if we find a compatible value known on the whitelist,
and say it is a PHY.
Fixes: a9049e0c513c ("mdio: Add support for mdio drivers.")
Reported-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Reported-by: Olof Johansson <olof@lixom.net>
Tested-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/of_mdio.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index b5aa004a24b6..5648317d355f 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -143,11 +143,31 @@ int of_mdio_parse_addr(struct device *dev, const struct device_node *np) | |||
143 | } | 143 | } |
144 | EXPORT_SYMBOL(of_mdio_parse_addr); | 144 | EXPORT_SYMBOL(of_mdio_parse_addr); |
145 | 145 | ||
146 | /* The following is a list of PHY compatible strings which appear in | ||
147 | * some DTBs. The compatible string is never matched against a PHY | ||
148 | * driver, so is pointless. We only expect devices which are not PHYs | ||
149 | * to have a compatible string, so they can be matched to an MDIO | ||
150 | * driver. Encourage users to upgrade their DT blobs to remove these. | ||
151 | */ | ||
152 | static const struct of_device_id whitelist_phys[] = { | ||
153 | { .compatible = "brcm,40nm-ephy" }, | ||
154 | { .compatible = "marvell,88E1111", }, | ||
155 | { .compatible = "marvell,88e1116", }, | ||
156 | { .compatible = "marvell,88e1118", }, | ||
157 | { .compatible = "marvell,88e1149r", }, | ||
158 | { .compatible = "marvell,88e1310", }, | ||
159 | { .compatible = "marvell,88E1510", }, | ||
160 | { .compatible = "marvell,88E1514", }, | ||
161 | { .compatible = "moxa,moxart-rtl8201cp", }, | ||
162 | {} | ||
163 | }; | ||
164 | |||
146 | /* | 165 | /* |
147 | * Return true if the child node is for a phy. It must either: | 166 | * Return true if the child node is for a phy. It must either: |
148 | * o Compatible string of "ethernet-phy-idX.X" | 167 | * o Compatible string of "ethernet-phy-idX.X" |
149 | * o Compatible string of "ethernet-phy-ieee802.3-c45" | 168 | * o Compatible string of "ethernet-phy-ieee802.3-c45" |
150 | * o Compatible string of "ethernet-phy-ieee802.3-c22" | 169 | * o Compatible string of "ethernet-phy-ieee802.3-c22" |
170 | * o In the white list above (and issue a warning) | ||
151 | * o No compatibility string | 171 | * o No compatibility string |
152 | * | 172 | * |
153 | * A device which is not a phy is expected to have a compatible string | 173 | * A device which is not a phy is expected to have a compatible string |
@@ -166,6 +186,13 @@ static bool of_mdiobus_child_is_phy(struct device_node *child) | |||
166 | if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) | 186 | if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) |
167 | return true; | 187 | return true; |
168 | 188 | ||
189 | if (of_match_node(whitelist_phys, child)) { | ||
190 | pr_warn(FW_WARN | ||
191 | "%s: Whitelisted compatible string. Please remove\n", | ||
192 | child->full_name); | ||
193 | return true; | ||
194 | } | ||
195 | |||
169 | if (!of_find_property(child, "compatible", NULL)) | 196 | if (!of_find_property(child, "compatible", NULL)) |
170 | return true; | 197 | return true; |
171 | 198 | ||