|
@@ -415,16 +415,31 @@ static void xgene_enet_clear(struct xgene_enet_pdata *pdata,
|
|
|
xgene_enet_wr_ring_if(pdata, addr, data);
|
|
|
}
|
|
|
|
|
|
+static int xgene_enet_gpio_lookup(struct xgene_enet_pdata *pdata)
|
|
|
+{
|
|
|
+ struct device *dev = &pdata->pdev->dev;
|
|
|
+
|
|
|
+ pdata->sfp_rdy = gpiod_get(dev, "rxlos", GPIOD_IN);
|
|
|
+ if (IS_ERR(pdata->sfp_rdy))
|
|
|
+ pdata->sfp_rdy = gpiod_get(dev, "sfp", GPIOD_IN);
|
|
|
+
|
|
|
+ if (IS_ERR(pdata->sfp_rdy))
|
|
|
+ return -ENODEV;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static void xgene_enet_link_state(struct work_struct *work)
|
|
|
{
|
|
|
struct xgene_enet_pdata *pdata = container_of(to_delayed_work(work),
|
|
|
struct xgene_enet_pdata, link_work);
|
|
|
- struct gpio_desc *sfp_rdy = pdata->sfp_rdy;
|
|
|
struct net_device *ndev = pdata->ndev;
|
|
|
u32 link_status, poll_interval;
|
|
|
|
|
|
link_status = xgene_enet_link_status(pdata);
|
|
|
- if (link_status && !IS_ERR(sfp_rdy) && !gpiod_get_value(sfp_rdy))
|
|
|
+ if (pdata->sfp_gpio_en && link_status &&
|
|
|
+ (!IS_ERR(pdata->sfp_rdy) || !xgene_enet_gpio_lookup(pdata)) &&
|
|
|
+ !gpiod_get_value(pdata->sfp_rdy))
|
|
|
link_status = 0;
|
|
|
|
|
|
if (link_status) {
|