aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-05-23 14:34:28 -0400
committerDavid S. Miller <davem@davemloft.net>2018-05-23 14:34:28 -0400
commite89e59c08d1bc736c8f593d7bad0706b20e73f30 (patch)
tree580a061017e14731a212838e8ba0eb663bcc2973 /drivers/net
parentMerge branch 'nfp-abm-add-basic-support-for-advanced-buffering-NIC' (diff)
parentDocumentation/bindings: net: the sfp i2c-bus property is now mandatory (diff)
downloadlinux-dev-e89e59c08d1bc736c8f593d7bad0706b20e73f30.tar.xz
linux-dev-e89e59c08d1bc736c8f593d7bad0706b20e73f30.zip
Merge branch 'net-sfp-small-improvements'
Antoine Tenart says: ==================== net: sfp: small improvements A small series of patches improving the SFP support by adding a warning when no Tx disable pin is available, and making the i2c-bus property mandatory. Thanks! Antoine Since v1: - Removed the patch fixing the sfp driver when no i2c bus was described. - Made two new patches to make the i2c-bus property mandatory for sfp modules. Since the phylink series: - s/-EOPNOTSUPP/-ENODEV/ in patch 1/2. - I added the acked-by tag in patch 2/2. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/phy/sfp.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 4ab6e9a50bbe..c4c92db86dfa 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -976,6 +976,7 @@ static int sfp_probe(struct platform_device *pdev)
if (pdev->dev.of_node) {
struct device_node *node = pdev->dev.of_node;
const struct of_device_id *id;
+ struct i2c_adapter *i2c;
struct device_node *np;
id = of_match_node(sfp_of_match, node);
@@ -985,19 +986,20 @@ static int sfp_probe(struct platform_device *pdev)
sff = sfp->type = id->data;
np = of_parse_phandle(node, "i2c-bus", 0);
- if (np) {
- struct i2c_adapter *i2c;
-
- i2c = of_find_i2c_adapter_by_node(np);
- of_node_put(np);
- if (!i2c)
- return -EPROBE_DEFER;
-
- err = sfp_i2c_configure(sfp, i2c);
- if (err < 0) {
- i2c_put_adapter(i2c);
- return err;
- }
+ if (!np) {
+ dev_err(sfp->dev, "missing 'i2c-bus' property\n");
+ return -ENODEV;
+ }
+
+ i2c = of_find_i2c_adapter_by_node(np);
+ of_node_put(np);
+ if (!i2c)
+ return -EPROBE_DEFER;
+
+ err = sfp_i2c_configure(sfp, i2c);
+ if (err < 0) {
+ i2c_put_adapter(i2c);
+ return err;
}
}
@@ -1065,6 +1067,15 @@ static int sfp_probe(struct platform_device *pdev)
if (poll)
mod_delayed_work(system_wq, &sfp->poll, poll_jiffies);
+ /* We could have an issue in cases no Tx disable pin is available or
+ * wired as modules using a laser as their light source will continue to
+ * be active when the fiber is removed. This could be a safety issue and
+ * we should at least warn the user about that.
+ */
+ if (!sfp->gpio[GPIO_TX_DISABLE])
+ dev_warn(sfp->dev,
+ "No tx_disable pin: SFP modules will always be emitting.\n");
+
return 0;
}