All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/10] Fix warning and issues
@ 2016-07-30  0:33 ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: davem, netdev, devicetree
  Cc: linux-arm-kernel, patches, linux, Iyappan Subramanian

This patch set fixes the following warning and issues,

  1. Fix kbuild warning
	- drivers: net: xgene: Fix kbuild warning
  2. unmap DMA memory on xgene_Enet_delete_bufpoool() 
	- drivers: net: xgene: fix: Add dma_unmap_single
  3. Delete descriptor rings and buffer pools on error
	- drivers: net: xgene: fix: Delete descriptor rings and buffer pools
  4. Fix error desconstruction on probe()
 	- drivers: net: xgene: Fix error deconstruction path
  5. Fix RSS indirection table fields
 	- drivers: net: xgene: Fix RSS indirection table fields
  6. Change the port init sequence as per hardware specification
	- drivers: net: xgene: Change port init sequence
  7. Fix link not recovered after link is down issue
	- drivers: net: xgene: XFI PCS reset when link is down
  8. Fix link up is reported when no SFP+ module is plugged in issue
	- drivers: net: xgene: Poll link status via GPIO
	- dtb: xgene: Add rxlos-gpios property
	- Documentation: dtb: xgene: Add rxlos GPIO mapping

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---

Iyappan Subramanian (10):
  drivers: net: xgene: Fix kbuild warning
  drivers: net: xgene: fix: Add dma_unmap_single
  drivers: net: xgene: fix: Delete descriptor rings and buffer pools
  drivers: net: xgene: Fix error deconstruction path
  drivers: net: xgene: Fix RSS indirection table fields
  drivers: net: xgene: Change port init sequence
  drivers: net: xgene: XFI PCS reset when link is down
  drivers: net: xgene: Poll link status via GPIO
  dtb: xgene: Add rxlos-gpios property
  Documentation: dtb: xgene: Add rxlos GPIO mapping

 .../devicetree/bindings/net/apm-xgene-enet.txt     |  1 +
 arch/arm64/boot/dts/apm/apm-mustang.dts            |  1 +
 drivers/net/ethernet/apm/xgene/Kconfig             |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c    | 17 ++++--
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.h    | 10 +++-
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c     |  7 +--
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.h     |  6 ++
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c   | 69 +++++++++++++++++-----
 drivers/net/ethernet/apm/xgene/xgene_enet_main.h   |  2 +
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c  | 53 ++++++++++++++++-
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h  |  4 ++
 11 files changed, 140 insertions(+), 31 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 00/10] Fix warning and issues
@ 2016-07-30  0:33 ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: linux-arm-kernel

This patch set fixes the following warning and issues,

  1. Fix kbuild warning
	- drivers: net: xgene: Fix kbuild warning
  2. unmap DMA memory on xgene_Enet_delete_bufpoool() 
	- drivers: net: xgene: fix: Add dma_unmap_single
  3. Delete descriptor rings and buffer pools on error
	- drivers: net: xgene: fix: Delete descriptor rings and buffer pools
  4. Fix error desconstruction on probe()
 	- drivers: net: xgene: Fix error deconstruction path
  5. Fix RSS indirection table fields
 	- drivers: net: xgene: Fix RSS indirection table fields
  6. Change the port init sequence as per hardware specification
	- drivers: net: xgene: Change port init sequence
  7. Fix link not recovered after link is down issue
	- drivers: net: xgene: XFI PCS reset when link is down
  8. Fix link up is reported when no SFP+ module is plugged in issue
	- drivers: net: xgene: Poll link status via GPIO
	- dtb: xgene: Add rxlos-gpios property
	- Documentation: dtb: xgene: Add rxlos GPIO mapping

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---

Iyappan Subramanian (10):
  drivers: net: xgene: Fix kbuild warning
  drivers: net: xgene: fix: Add dma_unmap_single
  drivers: net: xgene: fix: Delete descriptor rings and buffer pools
  drivers: net: xgene: Fix error deconstruction path
  drivers: net: xgene: Fix RSS indirection table fields
  drivers: net: xgene: Change port init sequence
  drivers: net: xgene: XFI PCS reset when link is down
  drivers: net: xgene: Poll link status via GPIO
  dtb: xgene: Add rxlos-gpios property
  Documentation: dtb: xgene: Add rxlos GPIO mapping

 .../devicetree/bindings/net/apm-xgene-enet.txt     |  1 +
 arch/arm64/boot/dts/apm/apm-mustang.dts            |  1 +
 drivers/net/ethernet/apm/xgene/Kconfig             |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c    | 17 ++++--
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.h    | 10 +++-
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c     |  7 +--
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.h     |  6 ++
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c   | 69 +++++++++++++++++-----
 drivers/net/ethernet/apm/xgene/xgene_enet_main.h   |  2 +
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c  | 53 ++++++++++++++++-
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h  |  4 ++
 11 files changed, 140 insertions(+), 31 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:33     ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q, netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-qTEPVZfXA3Y, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	Iyappan Subramanian

This patch fixes the following kbuild warning, when ACPI was not enabled.

>> drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:878:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
     phy_dev->advertising = phy_dev->supported;

Signed-off-by: Iyappan Subramanian <isubramanian-qTEPVZfXA3Y@public.gmane.org>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d..b6bc6fa 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -776,15 +776,11 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 			netdev_err(ndev, "Could not connect to PHY\n");
 			return -ENODEV;
 		}
-
-		pdata->phy_dev = phy_dev;
 	} else {
 #ifdef CONFIG_ACPI
 		struct acpi_device *adev = acpi_phy_find_device(dev);
 		if (adev)
-			pdata->phy_dev =  adev->driver_data;
-
-		phy_dev = pdata->phy_dev;
+			phy_dev =  adev->driver_data;
 
 		if (!phy_dev ||
 		    phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
@@ -795,6 +791,7 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 #endif
 	}
 
+	pdata->phy_dev = phy_dev;
 	pdata->phy_speed = SPEED_UNKNOWN;
 	phy_dev->supported &= ~SUPPORTED_10baseT_Half &
 			      ~SUPPORTED_100baseT_Half &
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning
@ 2016-07-30  0:33     ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the following kbuild warning, when ACPI was not enabled.

>> drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:878:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
     phy_dev->advertising = phy_dev->supported;

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d..b6bc6fa 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -776,15 +776,11 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 			netdev_err(ndev, "Could not connect to PHY\n");
 			return -ENODEV;
 		}
-
-		pdata->phy_dev = phy_dev;
 	} else {
 #ifdef CONFIG_ACPI
 		struct acpi_device *adev = acpi_phy_find_device(dev);
 		if (adev)
-			pdata->phy_dev =  adev->driver_data;
-
-		phy_dev = pdata->phy_dev;
+			phy_dev =  adev->driver_data;
 
 		if (!phy_dev ||
 		    phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
@@ -795,6 +791,7 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 #endif
 	}
 
+	pdata->phy_dev = phy_dev;
 	pdata->phy_speed = SPEED_UNKNOWN;
 	phy_dev->supported &= ~SUPPORTED_10baseT_Half &
 			      ~SUPPORTED_100baseT_Half &
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 02/10] drivers: net: xgene: fix: Add dma_unmap_single
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:33   ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: davem, netdev, devicetree
  Cc: linux-arm-kernel, patches, linux, Iyappan Subramanian

In addition to xgene_enet_delete_bufpool() freeing skbs, their associated
dma memory should also be unmapped.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index d1d6b5e..5246457 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -72,7 +72,6 @@ static int xgene_enet_refill_bufpool(struct xgene_enet_desc_ring *buf_pool,
 		skb = netdev_alloc_skb_ip_align(ndev, len);
 		if (unlikely(!skb))
 			return -ENOMEM;
-		buf_pool->rx_skb[tail] = skb;
 
 		dma_addr = dma_map_single(dev, skb->data, len, DMA_FROM_DEVICE);
 		if (dma_mapping_error(dev, dma_addr)) {
@@ -81,6 +80,8 @@ static int xgene_enet_refill_bufpool(struct xgene_enet_desc_ring *buf_pool,
 			return -EINVAL;
 		}
 
+		buf_pool->rx_skb[tail] = skb;
+
 		raw_desc->m1 = cpu_to_le64(SET_VAL(DATAADDR, dma_addr) |
 					   SET_VAL(BUFDATALEN, bufdatalen) |
 					   SET_BIT(COHERENT));
@@ -102,12 +103,21 @@ static u8 xgene_enet_hdr_len(const void *data)
 
 static void xgene_enet_delete_bufpool(struct xgene_enet_desc_ring *buf_pool)
 {
+	struct device *dev = ndev_to_dev(buf_pool->ndev);
+	struct xgene_enet_raw_desc16 *raw_desc;
+	dma_addr_t dma_addr;
 	int i;
 
 	/* Free up the buffers held by hardware */
 	for (i = 0; i < buf_pool->slots; i++) {
-		if (buf_pool->rx_skb[i])
+		if (buf_pool->rx_skb[i]) {
 			dev_kfree_skb_any(buf_pool->rx_skb[i]);
+
+			raw_desc = &buf_pool->raw_desc16[i];
+			dma_addr = GET_VAL(DATAADDR, le64_to_cpu(raw_desc->m1));
+			dma_unmap_single(dev, dma_addr, XGENE_ENET_MAX_MTU,
+					 DMA_FROM_DEVICE);
+		}
 	}
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 02/10] drivers: net: xgene: fix: Add dma_unmap_single
@ 2016-07-30  0:33   ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: linux-arm-kernel

In addition to xgene_enet_delete_bufpool() freeing skbs, their associated
dma memory should also be unmapped.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index d1d6b5e..5246457 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -72,7 +72,6 @@ static int xgene_enet_refill_bufpool(struct xgene_enet_desc_ring *buf_pool,
 		skb = netdev_alloc_skb_ip_align(ndev, len);
 		if (unlikely(!skb))
 			return -ENOMEM;
-		buf_pool->rx_skb[tail] = skb;
 
 		dma_addr = dma_map_single(dev, skb->data, len, DMA_FROM_DEVICE);
 		if (dma_mapping_error(dev, dma_addr)) {
@@ -81,6 +80,8 @@ static int xgene_enet_refill_bufpool(struct xgene_enet_desc_ring *buf_pool,
 			return -EINVAL;
 		}
 
+		buf_pool->rx_skb[tail] = skb;
+
 		raw_desc->m1 = cpu_to_le64(SET_VAL(DATAADDR, dma_addr) |
 					   SET_VAL(BUFDATALEN, bufdatalen) |
 					   SET_BIT(COHERENT));
@@ -102,12 +103,21 @@ static u8 xgene_enet_hdr_len(const void *data)
 
 static void xgene_enet_delete_bufpool(struct xgene_enet_desc_ring *buf_pool)
 {
+	struct device *dev = ndev_to_dev(buf_pool->ndev);
+	struct xgene_enet_raw_desc16 *raw_desc;
+	dma_addr_t dma_addr;
 	int i;
 
 	/* Free up the buffers held by hardware */
 	for (i = 0; i < buf_pool->slots; i++) {
-		if (buf_pool->rx_skb[i])
+		if (buf_pool->rx_skb[i]) {
 			dev_kfree_skb_any(buf_pool->rx_skb[i]);
+
+			raw_desc = &buf_pool->raw_desc16[i];
+			dma_addr = GET_VAL(DATAADDR, le64_to_cpu(raw_desc->m1));
+			dma_unmap_single(dev, dma_addr, XGENE_ENET_MAX_MTU,
+					 DMA_FROM_DEVICE);
+		}
 	}
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 03/10] drivers: net: xgene: fix: Delete descriptor rings and buffer pools
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:33     ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q, netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-qTEPVZfXA3Y, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	Iyappan Subramanian

xgene_enet_init_hw() should delete any descriptor rings and
buffer pools setup should le_ops->cle_init() return an error.

Signed-off-by: Iyappan Subramanian <isubramanian-qTEPVZfXA3Y@public.gmane.org>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 5246457..6fc5698 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1464,10 +1464,8 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
 		buf_pool = pdata->rx_ring[i]->buf_pool;
 		xgene_enet_init_bufpool(buf_pool);
 		ret = xgene_enet_refill_bufpool(buf_pool, pdata->rx_buff_cnt);
-		if (ret) {
-			xgene_enet_delete_desc_rings(pdata);
-			return ret;
-		}
+		if (ret)
+			goto err;
 	}
 
 	dst_ring_num = xgene_enet_dst_ring_num(pdata->rx_ring[0]);
@@ -1484,7 +1482,7 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
 		ret = pdata->cle_ops->cle_init(pdata);
 		if (ret) {
 			netdev_err(ndev, "Preclass Tree init error\n");
-			return ret;
+			goto err;
 		}
 	} else {
 		pdata->port_ops->cle_bypass(pdata, dst_ring_num, buf_pool->id);
@@ -1494,6 +1492,10 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
 	pdata->mac_ops->init(pdata);
 
 	return ret;
+
+err:
+	xgene_enet_delete_desc_rings(pdata);
+	return ret;
 }
 
 static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 03/10] drivers: net: xgene: fix: Delete descriptor rings and buffer pools
@ 2016-07-30  0:33     ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: linux-arm-kernel

xgene_enet_init_hw() should delete any descriptor rings and
buffer pools setup should le_ops->cle_init() return an error.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 5246457..6fc5698 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1464,10 +1464,8 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
 		buf_pool = pdata->rx_ring[i]->buf_pool;
 		xgene_enet_init_bufpool(buf_pool);
 		ret = xgene_enet_refill_bufpool(buf_pool, pdata->rx_buff_cnt);
-		if (ret) {
-			xgene_enet_delete_desc_rings(pdata);
-			return ret;
-		}
+		if (ret)
+			goto err;
 	}
 
 	dst_ring_num = xgene_enet_dst_ring_num(pdata->rx_ring[0]);
@@ -1484,7 +1482,7 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
 		ret = pdata->cle_ops->cle_init(pdata);
 		if (ret) {
 			netdev_err(ndev, "Preclass Tree init error\n");
-			return ret;
+			goto err;
 		}
 	} else {
 		pdata->port_ops->cle_bypass(pdata, dst_ring_num, buf_pool->id);
@@ -1494,6 +1492,10 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
 	pdata->mac_ops->init(pdata);
 
 	return ret;
+
+err:
+	xgene_enet_delete_desc_rings(pdata);
+	return ret;
 }
 
 static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 04/10] drivers: net: xgene: Fix error deconstruction path
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:33   ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: davem, netdev, devicetree
  Cc: linux-arm-kernel, patches, linux, Iyappan Subramanian

Since register_netdev() call in xgene_enet_probe() was moved down to
the end, it doesn't properly handle errors that may occur, by
deconstructing everything that was setup before the error occurred.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 27 +++++++++++++++++-------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 6fc5698..d05f999 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1643,8 +1643,8 @@ static int xgene_enet_probe(struct platform_device *pdev)
 	}
 #endif
 	if (!pdata->enet_id) {
-		free_netdev(ndev);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto err;
 	}
 
 	ret = xgene_enet_get_resources(pdata);
@@ -1667,7 +1667,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
 
 	ret = xgene_enet_init_hw(pdata);
 	if (ret)
-		goto err_netdev;
+		goto err;
 
 	link_state = pdata->mac_ops->link_state;
 	if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) {
@@ -1677,21 +1677,32 @@ static int xgene_enet_probe(struct platform_device *pdev)
 			ret = xgene_enet_mdio_config(pdata);
 		else
 			INIT_DELAYED_WORK(&pdata->link_work, link_state);
+
+		if (ret)
+			goto err1;
 	}
-	if (ret)
-		goto err;
 
 	xgene_enet_napi_add(pdata);
 	ret = register_netdev(ndev);
 	if (ret) {
 		netdev_err(ndev, "Failed to register netdev\n");
-		goto err;
+		goto err2;
 	}
 
 	return 0;
 
-err_netdev:
-	unregister_netdev(ndev);
+err2:
+	/*
+	 * If necessary, free_netdev() will call netif_napi_del() and undo
+	 * the effects of xgene_enet_napi_add()'s calls to netif_napi_add().
+	 */
+
+	if (pdata->mdio_driver)
+		xgene_enet_phy_disconnect(pdata);
+	else if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
+		xgene_enet_mdio_remove(pdata);
+err1:
+	xgene_enet_delete_desc_rings(pdata);
 err:
 	free_netdev(ndev);
 	return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 04/10] drivers: net: xgene: Fix error deconstruction path
@ 2016-07-30  0:33   ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: linux-arm-kernel

Since register_netdev() call in xgene_enet_probe() was moved down to
the end, it doesn't properly handle errors that may occur, by
deconstructing everything that was setup before the error occurred.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 27 +++++++++++++++++-------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 6fc5698..d05f999 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1643,8 +1643,8 @@ static int xgene_enet_probe(struct platform_device *pdev)
 	}
 #endif
 	if (!pdata->enet_id) {
-		free_netdev(ndev);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto err;
 	}
 
 	ret = xgene_enet_get_resources(pdata);
@@ -1667,7 +1667,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
 
 	ret = xgene_enet_init_hw(pdata);
 	if (ret)
-		goto err_netdev;
+		goto err;
 
 	link_state = pdata->mac_ops->link_state;
 	if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) {
@@ -1677,21 +1677,32 @@ static int xgene_enet_probe(struct platform_device *pdev)
 			ret = xgene_enet_mdio_config(pdata);
 		else
 			INIT_DELAYED_WORK(&pdata->link_work, link_state);
+
+		if (ret)
+			goto err1;
 	}
-	if (ret)
-		goto err;
 
 	xgene_enet_napi_add(pdata);
 	ret = register_netdev(ndev);
 	if (ret) {
 		netdev_err(ndev, "Failed to register netdev\n");
-		goto err;
+		goto err2;
 	}
 
 	return 0;
 
-err_netdev:
-	unregister_netdev(ndev);
+err2:
+	/*
+	 * If necessary, free_netdev() will call netif_napi_del() and undo
+	 * the effects of xgene_enet_napi_add()'s calls to netif_napi_add().
+	 */
+
+	if (pdata->mdio_driver)
+		xgene_enet_phy_disconnect(pdata);
+	else if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
+		xgene_enet_mdio_remove(pdata);
+err1:
+	xgene_enet_delete_desc_rings(pdata);
 err:
 	free_netdev(ndev);
 	return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 05/10] drivers: net: xgene: Fix RSS indirection table fields
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:33   ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: davem, netdev, devicetree
  Cc: linux-arm-kernel, patches, linux, Iyappan Subramanian, Quan Nguyen

This patch fixes FPSel and NxtFPSel fields length to 5-bit value.

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c | 17 ++++++++++++-----
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.h | 10 +++++++---
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c
index 472c0fb..23d72af 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c
@@ -32,12 +32,19 @@ static void xgene_cle_sband_to_hw(u8 frag, enum xgene_cle_prot_version ver,
 		SET_VAL(SB_HDRLEN, len);
 }
 
-static void xgene_cle_idt_to_hw(u32 dstqid, u32 fpsel,
+static void xgene_cle_idt_to_hw(struct xgene_enet_pdata *pdata,
+				u32 dstqid, u32 fpsel,
 				u32 nfpsel, u32 *idt_reg)
 {
-	*idt_reg =  SET_VAL(IDT_DSTQID, dstqid) |
-		    SET_VAL(IDT_FPSEL, fpsel) |
-		    SET_VAL(IDT_NFPSEL, nfpsel);
+	if (pdata->enet_id == XGENE_ENET1) {
+		*idt_reg = SET_VAL(IDT_DSTQID, dstqid) |
+			   SET_VAL(IDT_FPSEL1, fpsel)  |
+			   SET_VAL(IDT_NFPSEL1, nfpsel);
+	} else {
+		*idt_reg = SET_VAL(IDT_DSTQID, dstqid) |
+			   SET_VAL(IDT_FPSEL, fpsel)   |
+			   SET_VAL(IDT_NFPSEL, nfpsel);
+	}
 }
 
 static void xgene_cle_dbptr_to_hw(struct xgene_enet_pdata *pdata,
@@ -344,7 +351,7 @@ static int xgene_cle_set_rss_idt(struct xgene_enet_pdata *pdata)
 		nfpsel = 0;
 		idt_reg = 0;
 
-		xgene_cle_idt_to_hw(dstqid, fpsel, nfpsel, &idt_reg);
+		xgene_cle_idt_to_hw(pdata, dstqid, fpsel, nfpsel, &idt_reg);
 		ret = xgene_cle_dram_wr(&pdata->cle, &idt_reg, 1, i,
 					RSS_IDT, CLE_CMD_WR);
 		if (ret)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h
index 33c5f6b..9ac9f8e 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h
@@ -196,9 +196,13 @@ enum xgene_cle_ptree_dbptrs {
 #define IDT_DSTQID_POS		0
 #define IDT_DSTQID_LEN		12
 #define IDT_FPSEL_POS		12
-#define IDT_FPSEL_LEN		4
-#define IDT_NFPSEL_POS		16
-#define IDT_NFPSEL_LEN		4
+#define IDT_FPSEL_LEN		5
+#define IDT_NFPSEL_POS		17
+#define IDT_NFPSEL_LEN		5
+#define IDT_FPSEL1_POS		12
+#define IDT_FPSEL1_LEN		4
+#define IDT_NFPSEL1_POS		16
+#define IDT_NFPSEL1_LEN		4
 
 struct xgene_cle_ptree_branch {
 	bool valid;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 05/10] drivers: net: xgene: Fix RSS indirection table fields
@ 2016-07-30  0:33   ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes FPSel and NxtFPSel fields length to 5-bit value.

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.c | 17 ++++++++++++-----
 drivers/net/ethernet/apm/xgene/xgene_enet_cle.h | 10 +++++++---
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c
index 472c0fb..23d72af 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c
@@ -32,12 +32,19 @@ static void xgene_cle_sband_to_hw(u8 frag, enum xgene_cle_prot_version ver,
 		SET_VAL(SB_HDRLEN, len);
 }
 
-static void xgene_cle_idt_to_hw(u32 dstqid, u32 fpsel,
+static void xgene_cle_idt_to_hw(struct xgene_enet_pdata *pdata,
+				u32 dstqid, u32 fpsel,
 				u32 nfpsel, u32 *idt_reg)
 {
-	*idt_reg =  SET_VAL(IDT_DSTQID, dstqid) |
-		    SET_VAL(IDT_FPSEL, fpsel) |
-		    SET_VAL(IDT_NFPSEL, nfpsel);
+	if (pdata->enet_id == XGENE_ENET1) {
+		*idt_reg = SET_VAL(IDT_DSTQID, dstqid) |
+			   SET_VAL(IDT_FPSEL1, fpsel)  |
+			   SET_VAL(IDT_NFPSEL1, nfpsel);
+	} else {
+		*idt_reg = SET_VAL(IDT_DSTQID, dstqid) |
+			   SET_VAL(IDT_FPSEL, fpsel)   |
+			   SET_VAL(IDT_NFPSEL, nfpsel);
+	}
 }
 
 static void xgene_cle_dbptr_to_hw(struct xgene_enet_pdata *pdata,
@@ -344,7 +351,7 @@ static int xgene_cle_set_rss_idt(struct xgene_enet_pdata *pdata)
 		nfpsel = 0;
 		idt_reg = 0;
 
-		xgene_cle_idt_to_hw(dstqid, fpsel, nfpsel, &idt_reg);
+		xgene_cle_idt_to_hw(pdata, dstqid, fpsel, nfpsel, &idt_reg);
 		ret = xgene_cle_dram_wr(&pdata->cle, &idt_reg, 1, i,
 					RSS_IDT, CLE_CMD_WR);
 		if (ret)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h
index 33c5f6b..9ac9f8e 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h
@@ -196,9 +196,13 @@ enum xgene_cle_ptree_dbptrs {
 #define IDT_DSTQID_POS		0
 #define IDT_DSTQID_LEN		12
 #define IDT_FPSEL_POS		12
-#define IDT_FPSEL_LEN		4
-#define IDT_NFPSEL_POS		16
-#define IDT_NFPSEL_LEN		4
+#define IDT_FPSEL_LEN		5
+#define IDT_NFPSEL_POS		17
+#define IDT_NFPSEL_LEN		5
+#define IDT_FPSEL1_POS		12
+#define IDT_FPSEL1_LEN		4
+#define IDT_NFPSEL1_POS		16
+#define IDT_NFPSEL1_LEN		4
 
 struct xgene_cle_ptree_branch {
 	bool valid;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 06/10] drivers: net: xgene: Change port init sequence
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:33   ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: davem, netdev, devicetree
  Cc: linux-arm-kernel, patches, linux, Iyappan Subramanian

This patch rearranges the port initialization sequence as recommended by
hardware specification.  This patch also removes, mac_init() call from
xgene_enet_link_state(), as it was not required.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
index 9c6ad0d..d53c053 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
@@ -216,12 +216,12 @@ static void xgene_xgmac_init(struct xgene_enet_pdata *pdata)
 	data |= CFG_RSIF_FPBUFF_TIMEOUT_EN;
 	xgene_enet_wr_csr(pdata, XG_RSIF_CONFIG_REG_ADDR, data);
 
-	xgene_enet_wr_csr(pdata, XG_CFG_BYPASS_ADDR, RESUME_TX);
-	xgene_enet_wr_csr(pdata, XGENET_RX_DV_GATE_REG_0_ADDR, 0);
 	xgene_enet_rd_csr(pdata, XG_ENET_SPARE_CFG_REG_ADDR, &data);
 	data |= BIT(12);
 	xgene_enet_wr_csr(pdata, XG_ENET_SPARE_CFG_REG_ADDR, data);
 	xgene_enet_wr_csr(pdata, XG_ENET_SPARE_CFG_REG_1_ADDR, 0x82);
+	xgene_enet_wr_csr(pdata, XGENET_RX_DV_GATE_REG_0_ADDR, 0);
+	xgene_enet_wr_csr(pdata, XG_CFG_BYPASS_ADDR, RESUME_TX);
 }
 
 static void xgene_xgmac_rx_enable(struct xgene_enet_pdata *pdata)
@@ -366,7 +366,6 @@ static void xgene_enet_link_state(struct work_struct *work)
 	if (link_status) {
 		if (!netif_carrier_ok(ndev)) {
 			netif_carrier_on(ndev);
-			xgene_xgmac_init(pdata);
 			xgene_xgmac_rx_enable(pdata);
 			xgene_xgmac_tx_enable(pdata);
 			netdev_info(ndev, "Link is Up - 10Gbps\n");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 06/10] drivers: net: xgene: Change port init sequence
@ 2016-07-30  0:33   ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:33 UTC (permalink / raw)
  To: linux-arm-kernel

This patch rearranges the port initialization sequence as recommended by
hardware specification.  This patch also removes, mac_init() call from
xgene_enet_link_state(), as it was not required.

Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
index 9c6ad0d..d53c053 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
@@ -216,12 +216,12 @@ static void xgene_xgmac_init(struct xgene_enet_pdata *pdata)
 	data |= CFG_RSIF_FPBUFF_TIMEOUT_EN;
 	xgene_enet_wr_csr(pdata, XG_RSIF_CONFIG_REG_ADDR, data);
 
-	xgene_enet_wr_csr(pdata, XG_CFG_BYPASS_ADDR, RESUME_TX);
-	xgene_enet_wr_csr(pdata, XGENET_RX_DV_GATE_REG_0_ADDR, 0);
 	xgene_enet_rd_csr(pdata, XG_ENET_SPARE_CFG_REG_ADDR, &data);
 	data |= BIT(12);
 	xgene_enet_wr_csr(pdata, XG_ENET_SPARE_CFG_REG_ADDR, data);
 	xgene_enet_wr_csr(pdata, XG_ENET_SPARE_CFG_REG_1_ADDR, 0x82);
+	xgene_enet_wr_csr(pdata, XGENET_RX_DV_GATE_REG_0_ADDR, 0);
+	xgene_enet_wr_csr(pdata, XG_CFG_BYPASS_ADDR, RESUME_TX);
 }
 
 static void xgene_xgmac_rx_enable(struct xgene_enet_pdata *pdata)
@@ -366,7 +366,6 @@ static void xgene_enet_link_state(struct work_struct *work)
 	if (link_status) {
 		if (!netif_carrier_ok(ndev)) {
 			netif_carrier_on(ndev);
-			xgene_xgmac_init(pdata);
 			xgene_xgmac_rx_enable(pdata);
 			xgene_xgmac_tx_enable(pdata);
 			netdev_info(ndev, "Link is Up - 10Gbps\n");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 07/10] drivers: net: xgene: XFI PCS reset when link is down
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:34   ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: davem, netdev, devicetree
  Cc: linux-arm-kernel, patches, linux, Iyappan Subramanian, Fushen Chen

This patch fixes the link recovery issue, by doing PCS reset
when the link is down.

Signed-off-by: Fushen Chen <fchen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.h    |  6 ++++
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_main.h  |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 42 +++++++++++++++++++++++
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h |  4 +++
 5 files changed, 54 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
index 179a44d..8a8d055 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
@@ -124,6 +124,12 @@ enum xgene_enet_rm {
 #define MAC_READ_REG_OFFSET		0x0c
 #define MAC_COMMAND_DONE_REG_OFFSET	0x10
 
+#define PCS_ADDR_REG_OFFSET		0x00
+#define PCS_COMMAND_REG_OFFSET		0x04
+#define PCS_WRITE_REG_OFFSET		0x08
+#define PCS_READ_REG_OFFSET		0x0c
+#define PCS_COMMAND_DONE_REG_OFFSET	0x10
+
 #define MII_MGMT_CONFIG_ADDR		0x20
 #define MII_MGMT_COMMAND_ADDR		0x24
 #define MII_MGMT_ADDRESS_ADDR		0x28
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index d05f999..383e7ad 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1435,6 +1435,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	} else {
 		pdata->mcx_mac_addr = base_addr + BLOCK_AXG_MAC_OFFSET;
 		pdata->mcx_mac_csr_addr = base_addr + BLOCK_AXG_MAC_CSR_OFFSET;
+		pdata->pcs_addr = base_addr + BLOCK_PCS_OFFSET;
 	}
 	pdata->rx_buff_cnt = NUM_PKT_BUF;
 
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
index 217546e..53f4a16 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
@@ -196,6 +196,7 @@ struct xgene_enet_pdata {
 	void __iomem *mcx_mac_addr;
 	void __iomem *mcx_mac_csr_addr;
 	void __iomem *base_addr;
+	void __iomem *pcs_addr;
 	void __iomem *ring_csr_addr;
 	void __iomem *ring_cmd_addr;
 	int phy_mode;
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
index d53c053..4087dba 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
@@ -84,6 +84,21 @@ static void xgene_enet_wr_mac(struct xgene_enet_pdata *pdata,
 			   wr_addr);
 }
 
+static void xgene_enet_wr_pcs(struct xgene_enet_pdata *pdata,
+			      u32 wr_addr, u32 wr_data)
+{
+	void __iomem *addr, *wr, *cmd, *cmd_done;
+
+	addr = pdata->pcs_addr + PCS_ADDR_REG_OFFSET;
+	wr = pdata->pcs_addr + PCS_WRITE_REG_OFFSET;
+	cmd = pdata->pcs_addr + PCS_COMMAND_REG_OFFSET;
+	cmd_done = pdata->pcs_addr + PCS_COMMAND_DONE_REG_OFFSET;
+
+	if (!xgene_enet_wr_indirect(addr, wr, cmd, cmd_done, wr_addr, wr_data))
+		netdev_err(pdata->ndev, "PCS write failed, addr: %04x\n",
+			   wr_addr);
+}
+
 static void xgene_enet_rd_csr(struct xgene_enet_pdata *pdata,
 			      u32 offset, u32 *val)
 {
@@ -122,6 +137,7 @@ static bool xgene_enet_rd_indirect(void __iomem *addr, void __iomem *rd,
 
 	return true;
 }
+
 static void xgene_enet_rd_mac(struct xgene_enet_pdata *pdata,
 			      u32 rd_addr, u32 *rd_data)
 {
@@ -137,6 +153,21 @@ static void xgene_enet_rd_mac(struct xgene_enet_pdata *pdata,
 			   rd_addr);
 }
 
+static void xgene_enet_rd_pcs(struct xgene_enet_pdata *pdata,
+			      u32 rd_addr, u32 *rd_data)
+{
+	void __iomem *addr, *rd, *cmd, *cmd_done;
+
+	addr = pdata->pcs_addr + PCS_ADDR_REG_OFFSET;
+	rd = pdata->pcs_addr + PCS_READ_REG_OFFSET;
+	cmd = pdata->pcs_addr + PCS_COMMAND_REG_OFFSET;
+	cmd_done = pdata->pcs_addr + PCS_COMMAND_DONE_REG_OFFSET;
+
+	if (!xgene_enet_rd_indirect(addr, rd, cmd, cmd_done, rd_addr, rd_data))
+		netdev_err(pdata->ndev, "PCS read failed, addr: %04x\n",
+			   rd_addr);
+}
+
 static int xgene_enet_ecc_init(struct xgene_enet_pdata *pdata)
 {
 	struct net_device *ndev = pdata->ndev;
@@ -171,6 +202,15 @@ static void xgene_xgmac_reset(struct xgene_enet_pdata *pdata)
 	xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_0, 0);
 }
 
+static void xgene_pcs_reset(struct xgene_enet_pdata *pdata)
+{
+	u32 data;
+
+	xgene_enet_rd_pcs(pdata, PCS_CONTROL_1, &data);
+	xgene_enet_wr_pcs(pdata, PCS_CONTROL_1, data | PCS_CTRL_PCS_RST);
+	xgene_enet_wr_pcs(pdata, PCS_CONTROL_1, data & ~PCS_CTRL_PCS_RST);
+}
+
 static void xgene_xgmac_set_mac_addr(struct xgene_enet_pdata *pdata)
 {
 	u32 addr0, addr1;
@@ -379,6 +419,8 @@ static void xgene_enet_link_state(struct work_struct *work)
 			netdev_info(ndev, "Link is Down\n");
 		}
 		poll_interval = PHY_POLL_LINK_OFF;
+
+		xgene_pcs_reset(pdata);
 	}
 
 	schedule_delayed_work(&pdata->link_work, poll_interval);
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
index f1ea485..360ccbd 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
@@ -24,6 +24,7 @@
 #define X2_BLOCK_ETH_MAC_CSR_OFFSET	0x3000
 #define BLOCK_AXG_MAC_OFFSET		0x0800
 #define BLOCK_AXG_MAC_CSR_OFFSET	0x2000
+#define BLOCK_PCS_OFFSET		0x3800
 
 #define XGENET_CONFIG_REG_ADDR		0x20
 #define XGENET_SRST_ADDR		0x00
@@ -72,6 +73,9 @@
 #define XG_MCX_ICM_CONFIG0_REG_0_ADDR	0x00e0
 #define XG_MCX_ICM_CONFIG2_REG_0_ADDR	0x00e8
 
+#define PCS_CONTROL_1			0x0000
+#define PCS_CTRL_PCS_RST		BIT(15)
+
 extern const struct xgene_mac_ops xgene_xgmac_ops;
 extern const struct xgene_port_ops xgene_xgport_ops;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 07/10] drivers: net: xgene: XFI PCS reset when link is down
@ 2016-07-30  0:34   ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the link recovery issue, by doing PCS reset
when the link is down.

Signed-off-by: Fushen Chen <fchen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.h    |  6 ++++
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_main.h  |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 42 +++++++++++++++++++++++
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h |  4 +++
 5 files changed, 54 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
index 179a44d..8a8d055 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
@@ -124,6 +124,12 @@ enum xgene_enet_rm {
 #define MAC_READ_REG_OFFSET		0x0c
 #define MAC_COMMAND_DONE_REG_OFFSET	0x10
 
+#define PCS_ADDR_REG_OFFSET		0x00
+#define PCS_COMMAND_REG_OFFSET		0x04
+#define PCS_WRITE_REG_OFFSET		0x08
+#define PCS_READ_REG_OFFSET		0x0c
+#define PCS_COMMAND_DONE_REG_OFFSET	0x10
+
 #define MII_MGMT_CONFIG_ADDR		0x20
 #define MII_MGMT_COMMAND_ADDR		0x24
 #define MII_MGMT_ADDRESS_ADDR		0x28
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index d05f999..383e7ad 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1435,6 +1435,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	} else {
 		pdata->mcx_mac_addr = base_addr + BLOCK_AXG_MAC_OFFSET;
 		pdata->mcx_mac_csr_addr = base_addr + BLOCK_AXG_MAC_CSR_OFFSET;
+		pdata->pcs_addr = base_addr + BLOCK_PCS_OFFSET;
 	}
 	pdata->rx_buff_cnt = NUM_PKT_BUF;
 
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
index 217546e..53f4a16 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
@@ -196,6 +196,7 @@ struct xgene_enet_pdata {
 	void __iomem *mcx_mac_addr;
 	void __iomem *mcx_mac_csr_addr;
 	void __iomem *base_addr;
+	void __iomem *pcs_addr;
 	void __iomem *ring_csr_addr;
 	void __iomem *ring_cmd_addr;
 	int phy_mode;
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
index d53c053..4087dba 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
@@ -84,6 +84,21 @@ static void xgene_enet_wr_mac(struct xgene_enet_pdata *pdata,
 			   wr_addr);
 }
 
+static void xgene_enet_wr_pcs(struct xgene_enet_pdata *pdata,
+			      u32 wr_addr, u32 wr_data)
+{
+	void __iomem *addr, *wr, *cmd, *cmd_done;
+
+	addr = pdata->pcs_addr + PCS_ADDR_REG_OFFSET;
+	wr = pdata->pcs_addr + PCS_WRITE_REG_OFFSET;
+	cmd = pdata->pcs_addr + PCS_COMMAND_REG_OFFSET;
+	cmd_done = pdata->pcs_addr + PCS_COMMAND_DONE_REG_OFFSET;
+
+	if (!xgene_enet_wr_indirect(addr, wr, cmd, cmd_done, wr_addr, wr_data))
+		netdev_err(pdata->ndev, "PCS write failed, addr: %04x\n",
+			   wr_addr);
+}
+
 static void xgene_enet_rd_csr(struct xgene_enet_pdata *pdata,
 			      u32 offset, u32 *val)
 {
@@ -122,6 +137,7 @@ static bool xgene_enet_rd_indirect(void __iomem *addr, void __iomem *rd,
 
 	return true;
 }
+
 static void xgene_enet_rd_mac(struct xgene_enet_pdata *pdata,
 			      u32 rd_addr, u32 *rd_data)
 {
@@ -137,6 +153,21 @@ static void xgene_enet_rd_mac(struct xgene_enet_pdata *pdata,
 			   rd_addr);
 }
 
+static void xgene_enet_rd_pcs(struct xgene_enet_pdata *pdata,
+			      u32 rd_addr, u32 *rd_data)
+{
+	void __iomem *addr, *rd, *cmd, *cmd_done;
+
+	addr = pdata->pcs_addr + PCS_ADDR_REG_OFFSET;
+	rd = pdata->pcs_addr + PCS_READ_REG_OFFSET;
+	cmd = pdata->pcs_addr + PCS_COMMAND_REG_OFFSET;
+	cmd_done = pdata->pcs_addr + PCS_COMMAND_DONE_REG_OFFSET;
+
+	if (!xgene_enet_rd_indirect(addr, rd, cmd, cmd_done, rd_addr, rd_data))
+		netdev_err(pdata->ndev, "PCS read failed, addr: %04x\n",
+			   rd_addr);
+}
+
 static int xgene_enet_ecc_init(struct xgene_enet_pdata *pdata)
 {
 	struct net_device *ndev = pdata->ndev;
@@ -171,6 +202,15 @@ static void xgene_xgmac_reset(struct xgene_enet_pdata *pdata)
 	xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_0, 0);
 }
 
+static void xgene_pcs_reset(struct xgene_enet_pdata *pdata)
+{
+	u32 data;
+
+	xgene_enet_rd_pcs(pdata, PCS_CONTROL_1, &data);
+	xgene_enet_wr_pcs(pdata, PCS_CONTROL_1, data | PCS_CTRL_PCS_RST);
+	xgene_enet_wr_pcs(pdata, PCS_CONTROL_1, data & ~PCS_CTRL_PCS_RST);
+}
+
 static void xgene_xgmac_set_mac_addr(struct xgene_enet_pdata *pdata)
 {
 	u32 addr0, addr1;
@@ -379,6 +419,8 @@ static void xgene_enet_link_state(struct work_struct *work)
 			netdev_info(ndev, "Link is Down\n");
 		}
 		poll_interval = PHY_POLL_LINK_OFF;
+
+		xgene_pcs_reset(pdata);
 	}
 
 	schedule_delayed_work(&pdata->link_work, poll_interval);
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
index f1ea485..360ccbd 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
@@ -24,6 +24,7 @@
 #define X2_BLOCK_ETH_MAC_CSR_OFFSET	0x3000
 #define BLOCK_AXG_MAC_OFFSET		0x0800
 #define BLOCK_AXG_MAC_CSR_OFFSET	0x2000
+#define BLOCK_PCS_OFFSET		0x3800
 
 #define XGENET_CONFIG_REG_ADDR		0x20
 #define XGENET_SRST_ADDR		0x00
@@ -72,6 +73,9 @@
 #define XG_MCX_ICM_CONFIG0_REG_0_ADDR	0x00e0
 #define XG_MCX_ICM_CONFIG2_REG_0_ADDR	0x00e8
 
+#define PCS_CONTROL_1			0x0000
+#define PCS_CTRL_PCS_RST		BIT(15)
+
 extern const struct xgene_mac_ops xgene_xgmac_ops;
 extern const struct xgene_port_ops xgene_xgport_ops;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:34     ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q, netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-qTEPVZfXA3Y, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	Iyappan Subramanian, Quan Nguyen

When 10GbE SFP+ module is not plugged in or cable is not connected,
the link status register does not report the proper state due
to floating signal. This patch checks the module present status via an
GPIO to determine whether to ignore the link status register and report
link down.

Signed-off-by: Quan Nguyen <qnguyen-qTEPVZfXA3Y@public.gmane.org>
Signed-off-by: Iyappan Subramanian <isubramanian-qTEPVZfXA3Y@public.gmane.org>
Tested-by: Fushen Chen <fchen-qTEPVZfXA3Y@public.gmane.org>
---
 drivers/net/ethernet/apm/xgene/Kconfig            |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  | 15 +++++++++++++++
 drivers/net/ethernet/apm/xgene/xgene_enet_main.h  |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c |  6 ++++++
 4 files changed, 23 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/Kconfig b/drivers/net/ethernet/apm/xgene/Kconfig
index 300e3b5..6c60a7d 100644
--- a/drivers/net/ethernet/apm/xgene/Kconfig
+++ b/drivers/net/ethernet/apm/xgene/Kconfig
@@ -4,6 +4,7 @@ config NET_XGENE
 	depends on ARCH_XGENE || COMPILE_TEST
 	select PHYLIB
 	select MDIO_XGENE
+	select GPIO_XGENE_SB
 	help
 	  This is the Ethernet driver for the on-chip ethernet interface on the
 	  APM X-Gene SoC.
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 383e7ad..bda386d 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -19,6 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/gpio.h>
 #include "xgene_enet_main.h"
 #include "xgene_enet_hw.h"
 #include "xgene_enet_sgmac.h"
@@ -1322,6 +1323,18 @@ static int xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)
 	return 0;
 }
 
+static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata)
+{
+	struct device *dev = &pdata->pdev->dev;
+
+	if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
+		return;
+
+	pdata->sfp_rdy = gpiod_get(dev, "rxlos", GPIOD_IN);
+	if (IS_ERR(pdata->sfp_rdy))
+		pdata->sfp_rdy = gpiod_get(dev, "sfp", GPIOD_IN);
+}
+
 static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 {
 	struct platform_device *pdev;
@@ -1411,6 +1424,8 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	if (ret)
 		return ret;
 
+	xgene_enet_gpiod_get(pdata);
+
 	pdata->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pdata->clk)) {
 		/* Firmware may have set up the clock already. */
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
index 53f4a16..b339fc1 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
@@ -217,6 +217,7 @@ struct xgene_enet_pdata {
 	u8 tx_delay;
 	u8 rx_delay;
 	bool mdio_driver;
+	struct gpio_desc *sfp_rdy;
 };
 
 struct xgene_indirect_ctl {
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
index 4087dba..d672e71 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
@@ -18,6 +18,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/of_gpio.h>
+#include <linux/gpio.h>
 #include "xgene_enet_main.h"
 #include "xgene_enet_hw.h"
 #include "xgene_enet_xgmac.h"
@@ -399,10 +401,14 @@ 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))
+		link_status = 0;
+
 	if (link_status) {
 		if (!netif_carrier_ok(ndev)) {
 			netif_carrier_on(ndev);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-07-30  0:34     ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

When 10GbE SFP+ module is not plugged in or cable is not connected,
the link status register does not report the proper state due
to floating signal. This patch checks the module present status via an
GPIO to determine whether to ignore the link status register and report
link down.

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 drivers/net/ethernet/apm/xgene/Kconfig            |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  | 15 +++++++++++++++
 drivers/net/ethernet/apm/xgene/xgene_enet_main.h  |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c |  6 ++++++
 4 files changed, 23 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/Kconfig b/drivers/net/ethernet/apm/xgene/Kconfig
index 300e3b5..6c60a7d 100644
--- a/drivers/net/ethernet/apm/xgene/Kconfig
+++ b/drivers/net/ethernet/apm/xgene/Kconfig
@@ -4,6 +4,7 @@ config NET_XGENE
 	depends on ARCH_XGENE || COMPILE_TEST
 	select PHYLIB
 	select MDIO_XGENE
+	select GPIO_XGENE_SB
 	help
 	  This is the Ethernet driver for the on-chip ethernet interface on the
 	  APM X-Gene SoC.
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 383e7ad..bda386d 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -19,6 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/gpio.h>
 #include "xgene_enet_main.h"
 #include "xgene_enet_hw.h"
 #include "xgene_enet_sgmac.h"
@@ -1322,6 +1323,18 @@ static int xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)
 	return 0;
 }
 
+static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata)
+{
+	struct device *dev = &pdata->pdev->dev;
+
+	if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
+		return;
+
+	pdata->sfp_rdy = gpiod_get(dev, "rxlos", GPIOD_IN);
+	if (IS_ERR(pdata->sfp_rdy))
+		pdata->sfp_rdy = gpiod_get(dev, "sfp", GPIOD_IN);
+}
+
 static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 {
 	struct platform_device *pdev;
@@ -1411,6 +1424,8 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	if (ret)
 		return ret;
 
+	xgene_enet_gpiod_get(pdata);
+
 	pdata->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pdata->clk)) {
 		/* Firmware may have set up the clock already. */
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
index 53f4a16..b339fc1 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
@@ -217,6 +217,7 @@ struct xgene_enet_pdata {
 	u8 tx_delay;
 	u8 rx_delay;
 	bool mdio_driver;
+	struct gpio_desc *sfp_rdy;
 };
 
 struct xgene_indirect_ctl {
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
index 4087dba..d672e71 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
@@ -18,6 +18,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/of_gpio.h>
+#include <linux/gpio.h>
 #include "xgene_enet_main.h"
 #include "xgene_enet_hw.h"
 #include "xgene_enet_xgmac.h"
@@ -399,10 +401,14 @@ 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))
+		link_status = 0;
+
 	if (link_status) {
 		if (!netif_carrier_ok(ndev)) {
 			netif_carrier_on(ndev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 09/10] dtb: xgene: Add rxlos-gpios property
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:34   ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: davem, netdev, devicetree
  Cc: linux-arm-kernel, patches, linux, Iyappan Subramanian, Quan Nguyen

Added rxlos GPIO mapping by adding rxlos-gpios property.

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 arch/arm64/boot/dts/apm/apm-mustang.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/apm/apm-mustang.dts b/arch/arm64/boot/dts/apm/apm-mustang.dts
index b7fb5d9..32a961c 100644
--- a/arch/arm64/boot/dts/apm/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm/apm-mustang.dts
@@ -74,6 +74,7 @@
 
 &xgenet {
 	status = "ok";
+	rxlos-gpios = <&sbgpio 12 1>;
 };
 
 &mmc0 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 09/10] dtb: xgene: Add rxlos-gpios property
@ 2016-07-30  0:34   ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

Added rxlos GPIO mapping by adding rxlos-gpios property.

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 arch/arm64/boot/dts/apm/apm-mustang.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/apm/apm-mustang.dts b/arch/arm64/boot/dts/apm/apm-mustang.dts
index b7fb5d9..32a961c 100644
--- a/arch/arm64/boot/dts/apm/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm/apm-mustang.dts
@@ -74,6 +74,7 @@
 
 &xgenet {
 	status = "ok";
+	rxlos-gpios = <&sbgpio 12 1>;
 };
 
 &mmc0 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  0:34     ` Iyappan Subramanian
  -1 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q, netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-qTEPVZfXA3Y, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	Iyappan Subramanian, Quan Nguyen

Signed-off-by: Quan Nguyen <qnguyen-qTEPVZfXA3Y@public.gmane.org>
Signed-off-by: Iyappan Subramanian <isubramanian-qTEPVZfXA3Y@public.gmane.org>
Tested-by: Fushen Chen <fchen-qTEPVZfXA3Y@public.gmane.org>
---
 Documentation/devicetree/bindings/net/apm-xgene-enet.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
index 05f705e3..b83ae67 100644
--- a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
+++ b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
@@ -24,6 +24,7 @@ Required properties for all the ethernet interfaces:
 - clocks: Reference to the clock entry.
 - local-mac-address: MAC address assigned to this device
 - phy-connection-type: Interface type between ethernet device and PHY device
+- rxlos-gpios: rxlos GPIO mapping
 
 Required properties for ethernet interfaces that have external PHY:
 - phy-handle: Reference to a PHY node connected to this device
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping
@ 2016-07-30  0:34     ` Iyappan Subramanian
  0 siblings, 0 replies; 41+ messages in thread
From: Iyappan Subramanian @ 2016-07-30  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
---
 Documentation/devicetree/bindings/net/apm-xgene-enet.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
index 05f705e3..b83ae67 100644
--- a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
+++ b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
@@ -24,6 +24,7 @@ Required properties for all the ethernet interfaces:
 - clocks: Reference to the clock entry.
 - local-mac-address: MAC address assigned to this device
 - phy-connection-type: Interface type between ethernet device and PHY device
+- rxlos-gpios: rxlos GPIO mapping
 
 Required properties for ethernet interfaces that have external PHY:
 - phy-handle: Reference to a PHY node connected to this device
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
       [not found]     ` <1469838843-19943-9-git-send-email-isubramanian-qTEPVZfXA3Y@public.gmane.org>
  2016-07-30  1:56         ` kbuild test robot
@ 2016-07-30  1:56         ` kbuild test robot
  0 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  1:56 UTC (permalink / raw)
  To: Iyappan Subramanian
  Cc: kbuild-all-JC7UmRfGjtg, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-qTEPVZfXA3Y, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	Iyappan Subramanian, Quan Nguyen

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

Hi,

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

warning: (NET_XGENE) selects GPIO_XGENE_SB which has unmet direct dependencies (GPIOLIB && ARCH_XGENE && OF_GPIO)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45764 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-07-30  1:56         ` kbuild test robot
  0 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  1:56 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-qTEPVZfXA3Y, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	Iyappan Subramanian, Quan Nguyen

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

Hi,

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

warning: (NET_XGENE) selects GPIO_XGENE_SB which has unmet direct dependencies (GPIOLIB && ARCH_XGENE && OF_GPIO)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45764 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-07-30  1:56         ` kbuild test robot
  0 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  1:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

warning: (NET_XGENE) selects GPIO_XGENE_SB which has unmet direct dependencies (GPIOLIB && ARCH_XGENE && OF_GPIO)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 45764 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160730/8ebd0966/attachment-0001.obj>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 00/10] Fix warning and issues
  2016-07-30  0:33 ` Iyappan Subramanian
@ 2016-07-30  3:12     ` David Miller
  -1 siblings, 0 replies; 41+ messages in thread
From: David Miller @ 2016-07-30  3:12 UTC (permalink / raw)
  To: isubramanian-qTEPVZfXA3Y
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	patches-qTEPVZfXA3Y, linux-I+IVW8TIWO2tmTQ+vhA3Yw

From: Iyappan Subramanian <isubramanian-qTEPVZfXA3Y@public.gmane.org>
Date: Fri, 29 Jul 2016 17:33:53 -0700

> This patch set fixes the following warning and issues,

net-next is closed, please resubmit this after the merge window
is closed and net-next re-opens.

Thank you.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 00/10] Fix warning and issues
@ 2016-07-30  3:12     ` David Miller
  0 siblings, 0 replies; 41+ messages in thread
From: David Miller @ 2016-07-30  3:12 UTC (permalink / raw)
  To: linux-arm-kernel

From: Iyappan Subramanian <isubramanian@apm.com>
Date: Fri, 29 Jul 2016 17:33:53 -0700

> This patch set fixes the following warning and issues,

net-next is closed, please resubmit this after the merge window
is closed and net-next re-opens.

Thank you.

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
  2016-07-30  0:34     ` Iyappan Subramanian
  (?)
@ 2016-07-30  4:32       ` kbuild test robot
  -1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  4:32 UTC (permalink / raw)
  To: Iyappan Subramanian
  Cc: kbuild-all, davem, netdev, devicetree, linux-arm-kernel, patches,
	linux, Iyappan Subramanian, Quan Nguyen

[-- Attachment #1: Type: text/plain, Size: 19312 bytes --]

Hi,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All error/warnings (new ones prefixed by >>):

   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_irq_set_type':
>> drivers/gpio/gpio-xgene-sb.c:111:3: error: implicit declaration of function 'irq_chip_set_type_parent' [-Werror=implicit-function-declaration]
      return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
      ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
>> drivers/gpio/gpio-xgene-sb.c:118:13: error: 'irq_chip_eoi_parent' undeclared here (not in a function)
     .irq_eoi = irq_chip_eoi_parent,
                ^
>> drivers/gpio/gpio-xgene-sb.c:119:20: error: 'irq_chip_mask_parent' undeclared here (not in a function)
     .irq_mask       = irq_chip_mask_parent,
                       ^
>> drivers/gpio/gpio-xgene-sb.c:120:20: error: 'irq_chip_unmask_parent' undeclared here (not in a function)
     .irq_unmask     = irq_chip_unmask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_domain_alloc':
>> drivers/gpio/gpio-xgene-sb.c:198:3: error: implicit declaration of function 'irq_domain_set_hwirq_and_chip' [-Werror=implicit-function-declaration]
      irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
      ^
>> drivers/gpio/gpio-xgene-sb.c:201:31: error: 'struct irq_domain' has no member named 'parent'
     parent_fwspec.fwnode = domain->parent->fwnode;
                                  ^
>> drivers/gpio/gpio-xgene-sb.c:215:2: error: implicit declaration of function 'irq_domain_alloc_irqs_parent' [-Werror=implicit-function-declaration]
     return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
     ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
>> drivers/gpio/gpio-xgene-sb.c:220:2: error: unknown field 'translate' specified in initializer
     .translate      = xgene_gpio_sb_domain_translate,
     ^
>> drivers/gpio/gpio-xgene-sb.c:220:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:220:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.match')
>> drivers/gpio/gpio-xgene-sb.c:221:2: error: unknown field 'alloc' specified in initializer
     .alloc          = xgene_gpio_sb_domain_alloc,
     ^
   drivers/gpio/gpio-xgene-sb.c:221:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:221:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.select')
>> drivers/gpio/gpio-xgene-sb.c:222:2: error: unknown field 'free' specified in initializer
     .free           = irq_domain_free_irqs_common,
     ^
>> drivers/gpio/gpio-xgene-sb.c:222:20: error: 'irq_domain_free_irqs_common' undeclared here (not in a function)
     .free           = irq_domain_free_irqs_common,
                       ^
>> drivers/gpio/gpio-xgene-sb.c:223:2: error: unknown field 'activate' specified in initializer
     .activate = xgene_gpio_sb_domain_activate,
     ^
   drivers/gpio/gpio-xgene-sb.c:223:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:223:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.unmap')
>> drivers/gpio/gpio-xgene-sb.c:224:2: error: unknown field 'deactivate' specified in initializer
     .deactivate = xgene_gpio_sb_domain_deactivate,
     ^
   drivers/gpio/gpio-xgene-sb.c:224:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:224:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.xlate')
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_probe':
>> drivers/gpio/gpio-xgene-sb.c:293:2: error: implicit declaration of function 'irq_domain_create_hierarchy' [-Werror=implicit-function-declaration]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
     ^
>> drivers/gpio/gpio-xgene-sb.c:293:19: warning: assignment makes pointer from integer without a cast
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                      ^
   cc1: some warnings being treated as errors

vim +/irq_chip_set_type_parent +111 drivers/gpio/gpio-xgene-sb.c

1013fc417 Quan Nguyen        2016-02-17  105  			gpio * 2, 1);
1013fc417 Quan Nguyen        2016-02-17  106  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_INT_LVL,
1013fc417 Quan Nguyen        2016-02-17  107  			d->hwirq, lvl_type);
1013fc417 Quan Nguyen        2016-02-17  108  
1013fc417 Quan Nguyen        2016-02-17  109  	/* Propagate IRQ type setting to parent */
1013fc417 Quan Nguyen        2016-02-17  110  	if (type & IRQ_TYPE_EDGE_BOTH)
1013fc417 Quan Nguyen        2016-02-17 @111  		return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
1013fc417 Quan Nguyen        2016-02-17  112  	else
1013fc417 Quan Nguyen        2016-02-17  113  		return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
1013fc417 Quan Nguyen        2016-02-17  114  }
1013fc417 Quan Nguyen        2016-02-17  115  
1013fc417 Quan Nguyen        2016-02-17  116  static struct irq_chip xgene_gpio_sb_irq_chip = {
1013fc417 Quan Nguyen        2016-02-17  117  	.name           = "sbgpio",
1013fc417 Quan Nguyen        2016-02-17 @118  	.irq_eoi	= irq_chip_eoi_parent,
1013fc417 Quan Nguyen        2016-02-17 @119  	.irq_mask       = irq_chip_mask_parent,
1013fc417 Quan Nguyen        2016-02-17 @120  	.irq_unmask     = irq_chip_unmask_parent,
1013fc417 Quan Nguyen        2016-02-17  121  	.irq_set_type   = xgene_gpio_sb_irq_set_type,
1013fc417 Quan Nguyen        2016-02-17  122  };
b2b35e108 Y Vo               2015-01-16  123  
1013fc417 Quan Nguyen        2016-02-17  124  static int xgene_gpio_sb_to_irq(struct gpio_chip *gc, u32 gpio)
1013fc417 Quan Nguyen        2016-02-17  125  {
1013fc417 Quan Nguyen        2016-02-17  126  	struct xgene_gpio_sb *priv = gpiochip_get_data(gc);
1013fc417 Quan Nguyen        2016-02-17  127  	struct irq_fwspec fwspec;
b2b35e108 Y Vo               2015-01-16  128  
1013fc417 Quan Nguyen        2016-02-17  129  	if ((gpio < priv->irq_start) ||
1013fc417 Quan Nguyen        2016-02-17  130  			(gpio > HWIRQ_TO_GPIO(priv, priv->nirq)))
b2b35e108 Y Vo               2015-01-16  131  		return -ENXIO;
1013fc417 Quan Nguyen        2016-02-17  132  
1013fc417 Quan Nguyen        2016-02-17  133  	if (gc->parent->of_node)
1013fc417 Quan Nguyen        2016-02-17  134  		fwspec.fwnode = of_node_to_fwnode(gc->parent->of_node);
1013fc417 Quan Nguyen        2016-02-17  135  	else
1013fc417 Quan Nguyen        2016-02-17  136  		fwspec.fwnode = gc->parent->fwnode;
1013fc417 Quan Nguyen        2016-02-17  137  	fwspec.param_count = 2;
1013fc417 Quan Nguyen        2016-02-17  138  	fwspec.param[0] = GPIO_TO_HWIRQ(priv, gpio);
1013fc417 Quan Nguyen        2016-02-17  139  	fwspec.param[1] = IRQ_TYPE_NONE;
1013fc417 Quan Nguyen        2016-02-17  140  	return irq_create_fwspec_mapping(&fwspec);
1013fc417 Quan Nguyen        2016-02-17  141  }
1013fc417 Quan Nguyen        2016-02-17  142  
1013fc417 Quan Nguyen        2016-02-17  143  static void xgene_gpio_sb_domain_activate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  144  		struct irq_data *irq_data)
1013fc417 Quan Nguyen        2016-02-17  145  {
1013fc417 Quan Nguyen        2016-02-17  146  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  147  	u32 gpio = HWIRQ_TO_GPIO(priv, irq_data->hwirq);
1013fc417 Quan Nguyen        2016-02-17  148  
1013fc417 Quan Nguyen        2016-02-17  149  	if (gpiochip_lock_as_irq(&priv->gc, gpio)) {
1013fc417 Quan Nguyen        2016-02-17  150  		dev_err(priv->gc.parent,
1013fc417 Quan Nguyen        2016-02-17  151  		"Unable to configure XGene GPIO standby pin %d as IRQ\n",
1013fc417 Quan Nguyen        2016-02-17  152  				gpio);
1013fc417 Quan Nguyen        2016-02-17  153  		return;
1013fc417 Quan Nguyen        2016-02-17  154  	}
1013fc417 Quan Nguyen        2016-02-17  155  
1013fc417 Quan Nguyen        2016-02-17  156  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_SEL_LO,
1013fc417 Quan Nguyen        2016-02-17  157  			gpio * 2, 1);
1013fc417 Quan Nguyen        2016-02-17  158  }
1013fc417 Quan Nguyen        2016-02-17  159  
1013fc417 Quan Nguyen        2016-02-17  160  static void xgene_gpio_sb_domain_deactivate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  161  		struct irq_data *irq_data)
1013fc417 Quan Nguyen        2016-02-17  162  {
1013fc417 Quan Nguyen        2016-02-17  163  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  164  	u32 gpio = HWIRQ_TO_GPIO(priv, irq_data->hwirq);
1013fc417 Quan Nguyen        2016-02-17  165  
1013fc417 Quan Nguyen        2016-02-17  166  	gpiochip_unlock_as_irq(&priv->gc, gpio);
1013fc417 Quan Nguyen        2016-02-17  167  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_SEL_LO,
1013fc417 Quan Nguyen        2016-02-17  168  			gpio * 2, 0);
1013fc417 Quan Nguyen        2016-02-17  169  }
1013fc417 Quan Nguyen        2016-02-17  170  
1013fc417 Quan Nguyen        2016-02-17  171  static int xgene_gpio_sb_domain_translate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  172  		struct irq_fwspec *fwspec,
1013fc417 Quan Nguyen        2016-02-17  173  		unsigned long *hwirq,
1013fc417 Quan Nguyen        2016-02-17  174  		unsigned int *type)
1013fc417 Quan Nguyen        2016-02-17  175  {
1013fc417 Quan Nguyen        2016-02-17  176  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  177  
1013fc417 Quan Nguyen        2016-02-17  178  	if ((fwspec->param_count != 2) ||
1013fc417 Quan Nguyen        2016-02-17  179  		(fwspec->param[0] >= priv->nirq))
1013fc417 Quan Nguyen        2016-02-17  180  		return -EINVAL;
1013fc417 Quan Nguyen        2016-02-17  181  	*hwirq = fwspec->param[0];
1013fc417 Quan Nguyen        2016-02-17  182  	*type = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  183  	return 0;
b2b35e108 Y Vo               2015-01-16  184  }
b2b35e108 Y Vo               2015-01-16  185  
1013fc417 Quan Nguyen        2016-02-17  186  static int xgene_gpio_sb_domain_alloc(struct irq_domain *domain,
1013fc417 Quan Nguyen        2016-02-17  187  					unsigned int virq,
1013fc417 Quan Nguyen        2016-02-17  188  					unsigned int nr_irqs, void *data)
1013fc417 Quan Nguyen        2016-02-17  189  {
1013fc417 Quan Nguyen        2016-02-17  190  	struct irq_fwspec *fwspec = data;
1013fc417 Quan Nguyen        2016-02-17  191  	struct irq_fwspec parent_fwspec;
1013fc417 Quan Nguyen        2016-02-17  192  	struct xgene_gpio_sb *priv = domain->host_data;
1013fc417 Quan Nguyen        2016-02-17  193  	irq_hw_number_t hwirq;
1013fc417 Quan Nguyen        2016-02-17  194  	unsigned int i;
1013fc417 Quan Nguyen        2016-02-17  195  
1013fc417 Quan Nguyen        2016-02-17  196  	hwirq = fwspec->param[0];
1013fc417 Quan Nguyen        2016-02-17  197  	for (i = 0; i < nr_irqs; i++)
1013fc417 Quan Nguyen        2016-02-17 @198  		irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
1013fc417 Quan Nguyen        2016-02-17  199  				&xgene_gpio_sb_irq_chip, priv);
1013fc417 Quan Nguyen        2016-02-17  200  
1013fc417 Quan Nguyen        2016-02-17 @201  	parent_fwspec.fwnode = domain->parent->fwnode;
1013fc417 Quan Nguyen        2016-02-17  202  	if (is_of_node(parent_fwspec.fwnode)) {
1013fc417 Quan Nguyen        2016-02-17  203  		parent_fwspec.param_count = 3;
1013fc417 Quan Nguyen        2016-02-17  204  		parent_fwspec.param[0] = 0;/* SPI */
1013fc417 Quan Nguyen        2016-02-17  205  		/* Skip SGIs and PPIs*/
1013fc417 Quan Nguyen        2016-02-17  206  		parent_fwspec.param[1] = hwirq + priv->parent_irq_base - 32;
1013fc417 Quan Nguyen        2016-02-17  207  		parent_fwspec.param[2] = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  208  	} else if (is_fwnode_irqchip(parent_fwspec.fwnode)) {
1013fc417 Quan Nguyen        2016-02-17  209  		parent_fwspec.param_count = 2;
1013fc417 Quan Nguyen        2016-02-17  210  		parent_fwspec.param[0] = hwirq + priv->parent_irq_base;
1013fc417 Quan Nguyen        2016-02-17  211  		parent_fwspec.param[1] = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  212  	} else
1013fc417 Quan Nguyen        2016-02-17  213  		return -EINVAL;
1013fc417 Quan Nguyen        2016-02-17  214  
1013fc417 Quan Nguyen        2016-02-17 @215  	return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
1013fc417 Quan Nguyen        2016-02-17  216  			&parent_fwspec);
1013fc417 Quan Nguyen        2016-02-17  217  }
1013fc417 Quan Nguyen        2016-02-17  218  
1013fc417 Quan Nguyen        2016-02-17  219  static const struct irq_domain_ops xgene_gpio_sb_domain_ops = {
1013fc417 Quan Nguyen        2016-02-17 @220  	.translate      = xgene_gpio_sb_domain_translate,
1013fc417 Quan Nguyen        2016-02-17 @221  	.alloc          = xgene_gpio_sb_domain_alloc,
c6cc75fec Axel Lin           2016-03-17 @222  	.free           = irq_domain_free_irqs_common,
1013fc417 Quan Nguyen        2016-02-17 @223  	.activate	= xgene_gpio_sb_domain_activate,
1013fc417 Quan Nguyen        2016-02-17 @224  	.deactivate	= xgene_gpio_sb_domain_deactivate,
1013fc417 Quan Nguyen        2016-02-17  225  };
1013fc417 Quan Nguyen        2016-02-17  226  
b2b35e108 Y Vo               2015-01-16  227  static int xgene_gpio_sb_probe(struct platform_device *pdev)
b2b35e108 Y Vo               2015-01-16  228  {
b2b35e108 Y Vo               2015-01-16  229  	struct xgene_gpio_sb *priv;
67ebb742b Andrzej Hajda      2016-02-23  230  	int ret;
b2b35e108 Y Vo               2015-01-16  231  	struct resource *res;
b2b35e108 Y Vo               2015-01-16  232  	void __iomem *regs;
1013fc417 Quan Nguyen        2016-02-17  233  	struct irq_domain *parent_domain = NULL;
1013fc417 Quan Nguyen        2016-02-17  234  	struct fwnode_handle *fwnode;
1013fc417 Quan Nguyen        2016-02-17  235  	u32 val32;
b2b35e108 Y Vo               2015-01-16  236  
b2b35e108 Y Vo               2015-01-16  237  	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
b2b35e108 Y Vo               2015-01-16  238  	if (!priv)
b2b35e108 Y Vo               2015-01-16  239  		return -ENOMEM;
b2b35e108 Y Vo               2015-01-16  240  
b2b35e108 Y Vo               2015-01-16  241  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
b2b35e108 Y Vo               2015-01-16  242  	regs = devm_ioremap_resource(&pdev->dev, res);
33c07b467 Vladimir Zapolskiy 2015-03-29  243  	if (IS_ERR(regs))
b2b35e108 Y Vo               2015-01-16  244  		return PTR_ERR(regs);
b2b35e108 Y Vo               2015-01-16  245  
1013fc417 Quan Nguyen        2016-02-17  246  	priv->regs = regs;
1013fc417 Quan Nguyen        2016-02-17  247  
1013fc417 Quan Nguyen        2016-02-17  248  	ret = platform_get_irq(pdev, 0);
1013fc417 Quan Nguyen        2016-02-17  249  	if (ret > 0) {
1013fc417 Quan Nguyen        2016-02-17  250  		priv->parent_irq_base = irq_get_irq_data(ret)->hwirq;
1013fc417 Quan Nguyen        2016-02-17  251  		parent_domain = irq_get_irq_data(ret)->domain;
1013fc417 Quan Nguyen        2016-02-17  252  	}
1013fc417 Quan Nguyen        2016-02-17  253  	if (!parent_domain) {
1013fc417 Quan Nguyen        2016-02-17  254  		dev_err(&pdev->dev, "unable to obtain parent domain\n");
1013fc417 Quan Nguyen        2016-02-17  255  		return -ENODEV;
1013fc417 Quan Nguyen        2016-02-17  256  	}
1013fc417 Quan Nguyen        2016-02-17  257  
0f4630f37 Linus Walleij      2015-12-04  258  	ret = bgpio_init(&priv->gc, &pdev->dev, 4,
b2b35e108 Y Vo               2015-01-16  259  			regs + MPA_GPIO_IN_ADDR,
b2b35e108 Y Vo               2015-01-16  260  			regs + MPA_GPIO_OUT_ADDR, NULL,
b2b35e108 Y Vo               2015-01-16  261  			regs + MPA_GPIO_OE_ADDR, NULL, 0);
b2b35e108 Y Vo               2015-01-16  262          if (ret)
b2b35e108 Y Vo               2015-01-16  263                  return ret;
b2b35e108 Y Vo               2015-01-16  264  
1013fc417 Quan Nguyen        2016-02-17  265  	priv->gc.to_irq = xgene_gpio_sb_to_irq;
b2b35e108 Y Vo               2015-01-16  266  
1013fc417 Quan Nguyen        2016-02-17  267  	/* Retrieve start irq pin, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  268  	priv->irq_start = XGENE_DFLT_IRQ_START_PIN;
1013fc417 Quan Nguyen        2016-02-17  269  	if (!device_property_read_u32(&pdev->dev,
1013fc417 Quan Nguyen        2016-02-17  270  					XGENE_IRQ_START_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  271  		priv->irq_start = val32;
b2b35e108 Y Vo               2015-01-16  272  
1013fc417 Quan Nguyen        2016-02-17  273  	/* Retrieve number irqs, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  274  	priv->nirq = XGENE_DFLT_MAX_NIRQ;
1013fc417 Quan Nguyen        2016-02-17  275  	if (!device_property_read_u32(&pdev->dev, XGENE_NIRQ_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  276  		priv->nirq = val32;
b2b35e108 Y Vo               2015-01-16  277  
1013fc417 Quan Nguyen        2016-02-17  278  	/* Retrieve number gpio, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  279  	priv->gc.ngpio = XGENE_DFLT_MAX_NGPIO;
1013fc417 Quan Nguyen        2016-02-17  280  	if (!device_property_read_u32(&pdev->dev, XGENE_NGPIO_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  281  		priv->gc.ngpio = val32;
1013fc417 Quan Nguyen        2016-02-17  282  
1013fc417 Quan Nguyen        2016-02-17  283  	dev_info(&pdev->dev, "Support %d gpios, %d irqs start from pin %d\n",
1013fc417 Quan Nguyen        2016-02-17  284  			priv->gc.ngpio, priv->nirq, priv->irq_start);
b2b35e108 Y Vo               2015-01-16  285  
b2b35e108 Y Vo               2015-01-16  286  	platform_set_drvdata(pdev, priv);
b2b35e108 Y Vo               2015-01-16  287  
1013fc417 Quan Nguyen        2016-02-17  288  	if (pdev->dev.of_node)
1013fc417 Quan Nguyen        2016-02-17  289  		fwnode = of_node_to_fwnode(pdev->dev.of_node);
b2b35e108 Y Vo               2015-01-16  290  	else
1013fc417 Quan Nguyen        2016-02-17  291  		fwnode = pdev->dev.fwnode;
1013fc417 Quan Nguyen        2016-02-17  292  
1013fc417 Quan Nguyen        2016-02-17 @293  	priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
1013fc417 Quan Nguyen        2016-02-17  294  					0, priv->nirq, fwnode,
1013fc417 Quan Nguyen        2016-02-17  295  					&xgene_gpio_sb_domain_ops, priv);
1013fc417 Quan Nguyen        2016-02-17  296  	if (!priv->irq_domain)

:::::: The code at line 111 was first introduced by commit
:::::: 1013fc417cc15ead7c3a9091a47617f357db71a4 gpio: xgene: Enable X-Gene standby GPIO as interrupt controller

:::::: TO: Quan Nguyen <qnguyen@apm.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45764 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-07-30  4:32       ` kbuild test robot
  0 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  4:32 UTC (permalink / raw)
  Cc: kbuild-all, davem, netdev, devicetree, linux-arm-kernel, patches,
	linux, Iyappan Subramanian, Quan Nguyen

[-- Attachment #1: Type: text/plain, Size: 19312 bytes --]

Hi,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All error/warnings (new ones prefixed by >>):

   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_irq_set_type':
>> drivers/gpio/gpio-xgene-sb.c:111:3: error: implicit declaration of function 'irq_chip_set_type_parent' [-Werror=implicit-function-declaration]
      return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
      ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
>> drivers/gpio/gpio-xgene-sb.c:118:13: error: 'irq_chip_eoi_parent' undeclared here (not in a function)
     .irq_eoi = irq_chip_eoi_parent,
                ^
>> drivers/gpio/gpio-xgene-sb.c:119:20: error: 'irq_chip_mask_parent' undeclared here (not in a function)
     .irq_mask       = irq_chip_mask_parent,
                       ^
>> drivers/gpio/gpio-xgene-sb.c:120:20: error: 'irq_chip_unmask_parent' undeclared here (not in a function)
     .irq_unmask     = irq_chip_unmask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_domain_alloc':
>> drivers/gpio/gpio-xgene-sb.c:198:3: error: implicit declaration of function 'irq_domain_set_hwirq_and_chip' [-Werror=implicit-function-declaration]
      irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
      ^
>> drivers/gpio/gpio-xgene-sb.c:201:31: error: 'struct irq_domain' has no member named 'parent'
     parent_fwspec.fwnode = domain->parent->fwnode;
                                  ^
>> drivers/gpio/gpio-xgene-sb.c:215:2: error: implicit declaration of function 'irq_domain_alloc_irqs_parent' [-Werror=implicit-function-declaration]
     return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
     ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
>> drivers/gpio/gpio-xgene-sb.c:220:2: error: unknown field 'translate' specified in initializer
     .translate      = xgene_gpio_sb_domain_translate,
     ^
>> drivers/gpio/gpio-xgene-sb.c:220:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:220:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.match')
>> drivers/gpio/gpio-xgene-sb.c:221:2: error: unknown field 'alloc' specified in initializer
     .alloc          = xgene_gpio_sb_domain_alloc,
     ^
   drivers/gpio/gpio-xgene-sb.c:221:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:221:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.select')
>> drivers/gpio/gpio-xgene-sb.c:222:2: error: unknown field 'free' specified in initializer
     .free           = irq_domain_free_irqs_common,
     ^
>> drivers/gpio/gpio-xgene-sb.c:222:20: error: 'irq_domain_free_irqs_common' undeclared here (not in a function)
     .free           = irq_domain_free_irqs_common,
                       ^
>> drivers/gpio/gpio-xgene-sb.c:223:2: error: unknown field 'activate' specified in initializer
     .activate = xgene_gpio_sb_domain_activate,
     ^
   drivers/gpio/gpio-xgene-sb.c:223:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:223:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.unmap')
>> drivers/gpio/gpio-xgene-sb.c:224:2: error: unknown field 'deactivate' specified in initializer
     .deactivate = xgene_gpio_sb_domain_deactivate,
     ^
   drivers/gpio/gpio-xgene-sb.c:224:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:224:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.xlate')
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_probe':
>> drivers/gpio/gpio-xgene-sb.c:293:2: error: implicit declaration of function 'irq_domain_create_hierarchy' [-Werror=implicit-function-declaration]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
     ^
>> drivers/gpio/gpio-xgene-sb.c:293:19: warning: assignment makes pointer from integer without a cast
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                      ^
   cc1: some warnings being treated as errors

vim +/irq_chip_set_type_parent +111 drivers/gpio/gpio-xgene-sb.c

1013fc417 Quan Nguyen        2016-02-17  105  			gpio * 2, 1);
1013fc417 Quan Nguyen        2016-02-17  106  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_INT_LVL,
1013fc417 Quan Nguyen        2016-02-17  107  			d->hwirq, lvl_type);
1013fc417 Quan Nguyen        2016-02-17  108  
1013fc417 Quan Nguyen        2016-02-17  109  	/* Propagate IRQ type setting to parent */
1013fc417 Quan Nguyen        2016-02-17  110  	if (type & IRQ_TYPE_EDGE_BOTH)
1013fc417 Quan Nguyen        2016-02-17 @111  		return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
1013fc417 Quan Nguyen        2016-02-17  112  	else
1013fc417 Quan Nguyen        2016-02-17  113  		return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
1013fc417 Quan Nguyen        2016-02-17  114  }
1013fc417 Quan Nguyen        2016-02-17  115  
1013fc417 Quan Nguyen        2016-02-17  116  static struct irq_chip xgene_gpio_sb_irq_chip = {
1013fc417 Quan Nguyen        2016-02-17  117  	.name           = "sbgpio",
1013fc417 Quan Nguyen        2016-02-17 @118  	.irq_eoi	= irq_chip_eoi_parent,
1013fc417 Quan Nguyen        2016-02-17 @119  	.irq_mask       = irq_chip_mask_parent,
1013fc417 Quan Nguyen        2016-02-17 @120  	.irq_unmask     = irq_chip_unmask_parent,
1013fc417 Quan Nguyen        2016-02-17  121  	.irq_set_type   = xgene_gpio_sb_irq_set_type,
1013fc417 Quan Nguyen        2016-02-17  122  };
b2b35e108 Y Vo               2015-01-16  123  
1013fc417 Quan Nguyen        2016-02-17  124  static int xgene_gpio_sb_to_irq(struct gpio_chip *gc, u32 gpio)
1013fc417 Quan Nguyen        2016-02-17  125  {
1013fc417 Quan Nguyen        2016-02-17  126  	struct xgene_gpio_sb *priv = gpiochip_get_data(gc);
1013fc417 Quan Nguyen        2016-02-17  127  	struct irq_fwspec fwspec;
b2b35e108 Y Vo               2015-01-16  128  
1013fc417 Quan Nguyen        2016-02-17  129  	if ((gpio < priv->irq_start) ||
1013fc417 Quan Nguyen        2016-02-17  130  			(gpio > HWIRQ_TO_GPIO(priv, priv->nirq)))
b2b35e108 Y Vo               2015-01-16  131  		return -ENXIO;
1013fc417 Quan Nguyen        2016-02-17  132  
1013fc417 Quan Nguyen        2016-02-17  133  	if (gc->parent->of_node)
1013fc417 Quan Nguyen        2016-02-17  134  		fwspec.fwnode = of_node_to_fwnode(gc->parent->of_node);
1013fc417 Quan Nguyen        2016-02-17  135  	else
1013fc417 Quan Nguyen        2016-02-17  136  		fwspec.fwnode = gc->parent->fwnode;
1013fc417 Quan Nguyen        2016-02-17  137  	fwspec.param_count = 2;
1013fc417 Quan Nguyen        2016-02-17  138  	fwspec.param[0] = GPIO_TO_HWIRQ(priv, gpio);
1013fc417 Quan Nguyen        2016-02-17  139  	fwspec.param[1] = IRQ_TYPE_NONE;
1013fc417 Quan Nguyen        2016-02-17  140  	return irq_create_fwspec_mapping(&fwspec);
1013fc417 Quan Nguyen        2016-02-17  141  }
1013fc417 Quan Nguyen        2016-02-17  142  
1013fc417 Quan Nguyen        2016-02-17  143  static void xgene_gpio_sb_domain_activate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  144  		struct irq_data *irq_data)
1013fc417 Quan Nguyen        2016-02-17  145  {
1013fc417 Quan Nguyen        2016-02-17  146  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  147  	u32 gpio = HWIRQ_TO_GPIO(priv, irq_data->hwirq);
1013fc417 Quan Nguyen        2016-02-17  148  
1013fc417 Quan Nguyen        2016-02-17  149  	if (gpiochip_lock_as_irq(&priv->gc, gpio)) {
1013fc417 Quan Nguyen        2016-02-17  150  		dev_err(priv->gc.parent,
1013fc417 Quan Nguyen        2016-02-17  151  		"Unable to configure XGene GPIO standby pin %d as IRQ\n",
1013fc417 Quan Nguyen        2016-02-17  152  				gpio);
1013fc417 Quan Nguyen        2016-02-17  153  		return;
1013fc417 Quan Nguyen        2016-02-17  154  	}
1013fc417 Quan Nguyen        2016-02-17  155  
1013fc417 Quan Nguyen        2016-02-17  156  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_SEL_LO,
1013fc417 Quan Nguyen        2016-02-17  157  			gpio * 2, 1);
1013fc417 Quan Nguyen        2016-02-17  158  }
1013fc417 Quan Nguyen        2016-02-17  159  
1013fc417 Quan Nguyen        2016-02-17  160  static void xgene_gpio_sb_domain_deactivate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  161  		struct irq_data *irq_data)
1013fc417 Quan Nguyen        2016-02-17  162  {
1013fc417 Quan Nguyen        2016-02-17  163  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  164  	u32 gpio = HWIRQ_TO_GPIO(priv, irq_data->hwirq);
1013fc417 Quan Nguyen        2016-02-17  165  
1013fc417 Quan Nguyen        2016-02-17  166  	gpiochip_unlock_as_irq(&priv->gc, gpio);
1013fc417 Quan Nguyen        2016-02-17  167  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_SEL_LO,
1013fc417 Quan Nguyen        2016-02-17  168  			gpio * 2, 0);
1013fc417 Quan Nguyen        2016-02-17  169  }
1013fc417 Quan Nguyen        2016-02-17  170  
1013fc417 Quan Nguyen        2016-02-17  171  static int xgene_gpio_sb_domain_translate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  172  		struct irq_fwspec *fwspec,
1013fc417 Quan Nguyen        2016-02-17  173  		unsigned long *hwirq,
1013fc417 Quan Nguyen        2016-02-17  174  		unsigned int *type)
1013fc417 Quan Nguyen        2016-02-17  175  {
1013fc417 Quan Nguyen        2016-02-17  176  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  177  
1013fc417 Quan Nguyen        2016-02-17  178  	if ((fwspec->param_count != 2) ||
1013fc417 Quan Nguyen        2016-02-17  179  		(fwspec->param[0] >= priv->nirq))
1013fc417 Quan Nguyen        2016-02-17  180  		return -EINVAL;
1013fc417 Quan Nguyen        2016-02-17  181  	*hwirq = fwspec->param[0];
1013fc417 Quan Nguyen        2016-02-17  182  	*type = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  183  	return 0;
b2b35e108 Y Vo               2015-01-16  184  }
b2b35e108 Y Vo               2015-01-16  185  
1013fc417 Quan Nguyen        2016-02-17  186  static int xgene_gpio_sb_domain_alloc(struct irq_domain *domain,
1013fc417 Quan Nguyen        2016-02-17  187  					unsigned int virq,
1013fc417 Quan Nguyen        2016-02-17  188  					unsigned int nr_irqs, void *data)
1013fc417 Quan Nguyen        2016-02-17  189  {
1013fc417 Quan Nguyen        2016-02-17  190  	struct irq_fwspec *fwspec = data;
1013fc417 Quan Nguyen        2016-02-17  191  	struct irq_fwspec parent_fwspec;
1013fc417 Quan Nguyen        2016-02-17  192  	struct xgene_gpio_sb *priv = domain->host_data;
1013fc417 Quan Nguyen        2016-02-17  193  	irq_hw_number_t hwirq;
1013fc417 Quan Nguyen        2016-02-17  194  	unsigned int i;
1013fc417 Quan Nguyen        2016-02-17  195  
1013fc417 Quan Nguyen        2016-02-17  196  	hwirq = fwspec->param[0];
1013fc417 Quan Nguyen        2016-02-17  197  	for (i = 0; i < nr_irqs; i++)
1013fc417 Quan Nguyen        2016-02-17 @198  		irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
1013fc417 Quan Nguyen        2016-02-17  199  				&xgene_gpio_sb_irq_chip, priv);
1013fc417 Quan Nguyen        2016-02-17  200  
1013fc417 Quan Nguyen        2016-02-17 @201  	parent_fwspec.fwnode = domain->parent->fwnode;
1013fc417 Quan Nguyen        2016-02-17  202  	if (is_of_node(parent_fwspec.fwnode)) {
1013fc417 Quan Nguyen        2016-02-17  203  		parent_fwspec.param_count = 3;
1013fc417 Quan Nguyen        2016-02-17  204  		parent_fwspec.param[0] = 0;/* SPI */
1013fc417 Quan Nguyen        2016-02-17  205  		/* Skip SGIs and PPIs*/
1013fc417 Quan Nguyen        2016-02-17  206  		parent_fwspec.param[1] = hwirq + priv->parent_irq_base - 32;
1013fc417 Quan Nguyen        2016-02-17  207  		parent_fwspec.param[2] = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  208  	} else if (is_fwnode_irqchip(parent_fwspec.fwnode)) {
1013fc417 Quan Nguyen        2016-02-17  209  		parent_fwspec.param_count = 2;
1013fc417 Quan Nguyen        2016-02-17  210  		parent_fwspec.param[0] = hwirq + priv->parent_irq_base;
1013fc417 Quan Nguyen        2016-02-17  211  		parent_fwspec.param[1] = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  212  	} else
1013fc417 Quan Nguyen        2016-02-17  213  		return -EINVAL;
1013fc417 Quan Nguyen        2016-02-17  214  
1013fc417 Quan Nguyen        2016-02-17 @215  	return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
1013fc417 Quan Nguyen        2016-02-17  216  			&parent_fwspec);
1013fc417 Quan Nguyen        2016-02-17  217  }
1013fc417 Quan Nguyen        2016-02-17  218  
1013fc417 Quan Nguyen        2016-02-17  219  static const struct irq_domain_ops xgene_gpio_sb_domain_ops = {
1013fc417 Quan Nguyen        2016-02-17 @220  	.translate      = xgene_gpio_sb_domain_translate,
1013fc417 Quan Nguyen        2016-02-17 @221  	.alloc          = xgene_gpio_sb_domain_alloc,
c6cc75fec Axel Lin           2016-03-17 @222  	.free           = irq_domain_free_irqs_common,
1013fc417 Quan Nguyen        2016-02-17 @223  	.activate	= xgene_gpio_sb_domain_activate,
1013fc417 Quan Nguyen        2016-02-17 @224  	.deactivate	= xgene_gpio_sb_domain_deactivate,
1013fc417 Quan Nguyen        2016-02-17  225  };
1013fc417 Quan Nguyen        2016-02-17  226  
b2b35e108 Y Vo               2015-01-16  227  static int xgene_gpio_sb_probe(struct platform_device *pdev)
b2b35e108 Y Vo               2015-01-16  228  {
b2b35e108 Y Vo               2015-01-16  229  	struct xgene_gpio_sb *priv;
67ebb742b Andrzej Hajda      2016-02-23  230  	int ret;
b2b35e108 Y Vo               2015-01-16  231  	struct resource *res;
b2b35e108 Y Vo               2015-01-16  232  	void __iomem *regs;
1013fc417 Quan Nguyen        2016-02-17  233  	struct irq_domain *parent_domain = NULL;
1013fc417 Quan Nguyen        2016-02-17  234  	struct fwnode_handle *fwnode;
1013fc417 Quan Nguyen        2016-02-17  235  	u32 val32;
b2b35e108 Y Vo               2015-01-16  236  
b2b35e108 Y Vo               2015-01-16  237  	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
b2b35e108 Y Vo               2015-01-16  238  	if (!priv)
b2b35e108 Y Vo               2015-01-16  239  		return -ENOMEM;
b2b35e108 Y Vo               2015-01-16  240  
b2b35e108 Y Vo               2015-01-16  241  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
b2b35e108 Y Vo               2015-01-16  242  	regs = devm_ioremap_resource(&pdev->dev, res);
33c07b467 Vladimir Zapolskiy 2015-03-29  243  	if (IS_ERR(regs))
b2b35e108 Y Vo               2015-01-16  244  		return PTR_ERR(regs);
b2b35e108 Y Vo               2015-01-16  245  
1013fc417 Quan Nguyen        2016-02-17  246  	priv->regs = regs;
1013fc417 Quan Nguyen        2016-02-17  247  
1013fc417 Quan Nguyen        2016-02-17  248  	ret = platform_get_irq(pdev, 0);
1013fc417 Quan Nguyen        2016-02-17  249  	if (ret > 0) {
1013fc417 Quan Nguyen        2016-02-17  250  		priv->parent_irq_base = irq_get_irq_data(ret)->hwirq;
1013fc417 Quan Nguyen        2016-02-17  251  		parent_domain = irq_get_irq_data(ret)->domain;
1013fc417 Quan Nguyen        2016-02-17  252  	}
1013fc417 Quan Nguyen        2016-02-17  253  	if (!parent_domain) {
1013fc417 Quan Nguyen        2016-02-17  254  		dev_err(&pdev->dev, "unable to obtain parent domain\n");
1013fc417 Quan Nguyen        2016-02-17  255  		return -ENODEV;
1013fc417 Quan Nguyen        2016-02-17  256  	}
1013fc417 Quan Nguyen        2016-02-17  257  
0f4630f37 Linus Walleij      2015-12-04  258  	ret = bgpio_init(&priv->gc, &pdev->dev, 4,
b2b35e108 Y Vo               2015-01-16  259  			regs + MPA_GPIO_IN_ADDR,
b2b35e108 Y Vo               2015-01-16  260  			regs + MPA_GPIO_OUT_ADDR, NULL,
b2b35e108 Y Vo               2015-01-16  261  			regs + MPA_GPIO_OE_ADDR, NULL, 0);
b2b35e108 Y Vo               2015-01-16  262          if (ret)
b2b35e108 Y Vo               2015-01-16  263                  return ret;
b2b35e108 Y Vo               2015-01-16  264  
1013fc417 Quan Nguyen        2016-02-17  265  	priv->gc.to_irq = xgene_gpio_sb_to_irq;
b2b35e108 Y Vo               2015-01-16  266  
1013fc417 Quan Nguyen        2016-02-17  267  	/* Retrieve start irq pin, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  268  	priv->irq_start = XGENE_DFLT_IRQ_START_PIN;
1013fc417 Quan Nguyen        2016-02-17  269  	if (!device_property_read_u32(&pdev->dev,
1013fc417 Quan Nguyen        2016-02-17  270  					XGENE_IRQ_START_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  271  		priv->irq_start = val32;
b2b35e108 Y Vo               2015-01-16  272  
1013fc417 Quan Nguyen        2016-02-17  273  	/* Retrieve number irqs, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  274  	priv->nirq = XGENE_DFLT_MAX_NIRQ;
1013fc417 Quan Nguyen        2016-02-17  275  	if (!device_property_read_u32(&pdev->dev, XGENE_NIRQ_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  276  		priv->nirq = val32;
b2b35e108 Y Vo               2015-01-16  277  
1013fc417 Quan Nguyen        2016-02-17  278  	/* Retrieve number gpio, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  279  	priv->gc.ngpio = XGENE_DFLT_MAX_NGPIO;
1013fc417 Quan Nguyen        2016-02-17  280  	if (!device_property_read_u32(&pdev->dev, XGENE_NGPIO_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  281  		priv->gc.ngpio = val32;
1013fc417 Quan Nguyen        2016-02-17  282  
1013fc417 Quan Nguyen        2016-02-17  283  	dev_info(&pdev->dev, "Support %d gpios, %d irqs start from pin %d\n",
1013fc417 Quan Nguyen        2016-02-17  284  			priv->gc.ngpio, priv->nirq, priv->irq_start);
b2b35e108 Y Vo               2015-01-16  285  
b2b35e108 Y Vo               2015-01-16  286  	platform_set_drvdata(pdev, priv);
b2b35e108 Y Vo               2015-01-16  287  
1013fc417 Quan Nguyen        2016-02-17  288  	if (pdev->dev.of_node)
1013fc417 Quan Nguyen        2016-02-17  289  		fwnode = of_node_to_fwnode(pdev->dev.of_node);
b2b35e108 Y Vo               2015-01-16  290  	else
1013fc417 Quan Nguyen        2016-02-17  291  		fwnode = pdev->dev.fwnode;
1013fc417 Quan Nguyen        2016-02-17  292  
1013fc417 Quan Nguyen        2016-02-17 @293  	priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
1013fc417 Quan Nguyen        2016-02-17  294  					0, priv->nirq, fwnode,
1013fc417 Quan Nguyen        2016-02-17  295  					&xgene_gpio_sb_domain_ops, priv);
1013fc417 Quan Nguyen        2016-02-17  296  	if (!priv->irq_domain)

:::::: The code at line 111 was first introduced by commit
:::::: 1013fc417cc15ead7c3a9091a47617f357db71a4 gpio: xgene: Enable X-Gene standby GPIO as interrupt controller

:::::: TO: Quan Nguyen <qnguyen@apm.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45764 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-07-30  4:32       ` kbuild test robot
  0 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  4:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All error/warnings (new ones prefixed by >>):

   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_irq_set_type':
>> drivers/gpio/gpio-xgene-sb.c:111:3: error: implicit declaration of function 'irq_chip_set_type_parent' [-Werror=implicit-function-declaration]
      return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
      ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
>> drivers/gpio/gpio-xgene-sb.c:118:13: error: 'irq_chip_eoi_parent' undeclared here (not in a function)
     .irq_eoi = irq_chip_eoi_parent,
                ^
>> drivers/gpio/gpio-xgene-sb.c:119:20: error: 'irq_chip_mask_parent' undeclared here (not in a function)
     .irq_mask       = irq_chip_mask_parent,
                       ^
>> drivers/gpio/gpio-xgene-sb.c:120:20: error: 'irq_chip_unmask_parent' undeclared here (not in a function)
     .irq_unmask     = irq_chip_unmask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_domain_alloc':
>> drivers/gpio/gpio-xgene-sb.c:198:3: error: implicit declaration of function 'irq_domain_set_hwirq_and_chip' [-Werror=implicit-function-declaration]
      irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
      ^
>> drivers/gpio/gpio-xgene-sb.c:201:31: error: 'struct irq_domain' has no member named 'parent'
     parent_fwspec.fwnode = domain->parent->fwnode;
                                  ^
>> drivers/gpio/gpio-xgene-sb.c:215:2: error: implicit declaration of function 'irq_domain_alloc_irqs_parent' [-Werror=implicit-function-declaration]
     return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
     ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
>> drivers/gpio/gpio-xgene-sb.c:220:2: error: unknown field 'translate' specified in initializer
     .translate      = xgene_gpio_sb_domain_translate,
     ^
>> drivers/gpio/gpio-xgene-sb.c:220:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:220:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.match')
>> drivers/gpio/gpio-xgene-sb.c:221:2: error: unknown field 'alloc' specified in initializer
     .alloc          = xgene_gpio_sb_domain_alloc,
     ^
   drivers/gpio/gpio-xgene-sb.c:221:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:221:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.select')
>> drivers/gpio/gpio-xgene-sb.c:222:2: error: unknown field 'free' specified in initializer
     .free           = irq_domain_free_irqs_common,
     ^
>> drivers/gpio/gpio-xgene-sb.c:222:20: error: 'irq_domain_free_irqs_common' undeclared here (not in a function)
     .free           = irq_domain_free_irqs_common,
                       ^
>> drivers/gpio/gpio-xgene-sb.c:223:2: error: unknown field 'activate' specified in initializer
     .activate = xgene_gpio_sb_domain_activate,
     ^
   drivers/gpio/gpio-xgene-sb.c:223:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:223:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.unmap')
>> drivers/gpio/gpio-xgene-sb.c:224:2: error: unknown field 'deactivate' specified in initializer
     .deactivate = xgene_gpio_sb_domain_deactivate,
     ^
   drivers/gpio/gpio-xgene-sb.c:224:2: warning: initialization from incompatible pointer type
   drivers/gpio/gpio-xgene-sb.c:224:2: warning: (near initialization for 'xgene_gpio_sb_domain_ops.xlate')
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_probe':
>> drivers/gpio/gpio-xgene-sb.c:293:2: error: implicit declaration of function 'irq_domain_create_hierarchy' [-Werror=implicit-function-declaration]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
     ^
>> drivers/gpio/gpio-xgene-sb.c:293:19: warning: assignment makes pointer from integer without a cast
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                      ^
   cc1: some warnings being treated as errors

vim +/irq_chip_set_type_parent +111 drivers/gpio/gpio-xgene-sb.c

1013fc417 Quan Nguyen        2016-02-17  105  			gpio * 2, 1);
1013fc417 Quan Nguyen        2016-02-17  106  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_INT_LVL,
1013fc417 Quan Nguyen        2016-02-17  107  			d->hwirq, lvl_type);
1013fc417 Quan Nguyen        2016-02-17  108  
1013fc417 Quan Nguyen        2016-02-17  109  	/* Propagate IRQ type setting to parent */
1013fc417 Quan Nguyen        2016-02-17  110  	if (type & IRQ_TYPE_EDGE_BOTH)
1013fc417 Quan Nguyen        2016-02-17 @111  		return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
1013fc417 Quan Nguyen        2016-02-17  112  	else
1013fc417 Quan Nguyen        2016-02-17  113  		return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
1013fc417 Quan Nguyen        2016-02-17  114  }
1013fc417 Quan Nguyen        2016-02-17  115  
1013fc417 Quan Nguyen        2016-02-17  116  static struct irq_chip xgene_gpio_sb_irq_chip = {
1013fc417 Quan Nguyen        2016-02-17  117  	.name           = "sbgpio",
1013fc417 Quan Nguyen        2016-02-17 @118  	.irq_eoi	= irq_chip_eoi_parent,
1013fc417 Quan Nguyen        2016-02-17 @119  	.irq_mask       = irq_chip_mask_parent,
1013fc417 Quan Nguyen        2016-02-17 @120  	.irq_unmask     = irq_chip_unmask_parent,
1013fc417 Quan Nguyen        2016-02-17  121  	.irq_set_type   = xgene_gpio_sb_irq_set_type,
1013fc417 Quan Nguyen        2016-02-17  122  };
b2b35e108 Y Vo               2015-01-16  123  
1013fc417 Quan Nguyen        2016-02-17  124  static int xgene_gpio_sb_to_irq(struct gpio_chip *gc, u32 gpio)
1013fc417 Quan Nguyen        2016-02-17  125  {
1013fc417 Quan Nguyen        2016-02-17  126  	struct xgene_gpio_sb *priv = gpiochip_get_data(gc);
1013fc417 Quan Nguyen        2016-02-17  127  	struct irq_fwspec fwspec;
b2b35e108 Y Vo               2015-01-16  128  
1013fc417 Quan Nguyen        2016-02-17  129  	if ((gpio < priv->irq_start) ||
1013fc417 Quan Nguyen        2016-02-17  130  			(gpio > HWIRQ_TO_GPIO(priv, priv->nirq)))
b2b35e108 Y Vo               2015-01-16  131  		return -ENXIO;
1013fc417 Quan Nguyen        2016-02-17  132  
1013fc417 Quan Nguyen        2016-02-17  133  	if (gc->parent->of_node)
1013fc417 Quan Nguyen        2016-02-17  134  		fwspec.fwnode = of_node_to_fwnode(gc->parent->of_node);
1013fc417 Quan Nguyen        2016-02-17  135  	else
1013fc417 Quan Nguyen        2016-02-17  136  		fwspec.fwnode = gc->parent->fwnode;
1013fc417 Quan Nguyen        2016-02-17  137  	fwspec.param_count = 2;
1013fc417 Quan Nguyen        2016-02-17  138  	fwspec.param[0] = GPIO_TO_HWIRQ(priv, gpio);
1013fc417 Quan Nguyen        2016-02-17  139  	fwspec.param[1] = IRQ_TYPE_NONE;
1013fc417 Quan Nguyen        2016-02-17  140  	return irq_create_fwspec_mapping(&fwspec);
1013fc417 Quan Nguyen        2016-02-17  141  }
1013fc417 Quan Nguyen        2016-02-17  142  
1013fc417 Quan Nguyen        2016-02-17  143  static void xgene_gpio_sb_domain_activate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  144  		struct irq_data *irq_data)
1013fc417 Quan Nguyen        2016-02-17  145  {
1013fc417 Quan Nguyen        2016-02-17  146  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  147  	u32 gpio = HWIRQ_TO_GPIO(priv, irq_data->hwirq);
1013fc417 Quan Nguyen        2016-02-17  148  
1013fc417 Quan Nguyen        2016-02-17  149  	if (gpiochip_lock_as_irq(&priv->gc, gpio)) {
1013fc417 Quan Nguyen        2016-02-17  150  		dev_err(priv->gc.parent,
1013fc417 Quan Nguyen        2016-02-17  151  		"Unable to configure XGene GPIO standby pin %d as IRQ\n",
1013fc417 Quan Nguyen        2016-02-17  152  				gpio);
1013fc417 Quan Nguyen        2016-02-17  153  		return;
1013fc417 Quan Nguyen        2016-02-17  154  	}
1013fc417 Quan Nguyen        2016-02-17  155  
1013fc417 Quan Nguyen        2016-02-17  156  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_SEL_LO,
1013fc417 Quan Nguyen        2016-02-17  157  			gpio * 2, 1);
1013fc417 Quan Nguyen        2016-02-17  158  }
1013fc417 Quan Nguyen        2016-02-17  159  
1013fc417 Quan Nguyen        2016-02-17  160  static void xgene_gpio_sb_domain_deactivate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  161  		struct irq_data *irq_data)
1013fc417 Quan Nguyen        2016-02-17  162  {
1013fc417 Quan Nguyen        2016-02-17  163  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  164  	u32 gpio = HWIRQ_TO_GPIO(priv, irq_data->hwirq);
1013fc417 Quan Nguyen        2016-02-17  165  
1013fc417 Quan Nguyen        2016-02-17  166  	gpiochip_unlock_as_irq(&priv->gc, gpio);
1013fc417 Quan Nguyen        2016-02-17  167  	xgene_gpio_set_bit(&priv->gc, priv->regs + MPA_GPIO_SEL_LO,
1013fc417 Quan Nguyen        2016-02-17  168  			gpio * 2, 0);
1013fc417 Quan Nguyen        2016-02-17  169  }
1013fc417 Quan Nguyen        2016-02-17  170  
1013fc417 Quan Nguyen        2016-02-17  171  static int xgene_gpio_sb_domain_translate(struct irq_domain *d,
1013fc417 Quan Nguyen        2016-02-17  172  		struct irq_fwspec *fwspec,
1013fc417 Quan Nguyen        2016-02-17  173  		unsigned long *hwirq,
1013fc417 Quan Nguyen        2016-02-17  174  		unsigned int *type)
1013fc417 Quan Nguyen        2016-02-17  175  {
1013fc417 Quan Nguyen        2016-02-17  176  	struct xgene_gpio_sb *priv = d->host_data;
1013fc417 Quan Nguyen        2016-02-17  177  
1013fc417 Quan Nguyen        2016-02-17  178  	if ((fwspec->param_count != 2) ||
1013fc417 Quan Nguyen        2016-02-17  179  		(fwspec->param[0] >= priv->nirq))
1013fc417 Quan Nguyen        2016-02-17  180  		return -EINVAL;
1013fc417 Quan Nguyen        2016-02-17  181  	*hwirq = fwspec->param[0];
1013fc417 Quan Nguyen        2016-02-17  182  	*type = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  183  	return 0;
b2b35e108 Y Vo               2015-01-16  184  }
b2b35e108 Y Vo               2015-01-16  185  
1013fc417 Quan Nguyen        2016-02-17  186  static int xgene_gpio_sb_domain_alloc(struct irq_domain *domain,
1013fc417 Quan Nguyen        2016-02-17  187  					unsigned int virq,
1013fc417 Quan Nguyen        2016-02-17  188  					unsigned int nr_irqs, void *data)
1013fc417 Quan Nguyen        2016-02-17  189  {
1013fc417 Quan Nguyen        2016-02-17  190  	struct irq_fwspec *fwspec = data;
1013fc417 Quan Nguyen        2016-02-17  191  	struct irq_fwspec parent_fwspec;
1013fc417 Quan Nguyen        2016-02-17  192  	struct xgene_gpio_sb *priv = domain->host_data;
1013fc417 Quan Nguyen        2016-02-17  193  	irq_hw_number_t hwirq;
1013fc417 Quan Nguyen        2016-02-17  194  	unsigned int i;
1013fc417 Quan Nguyen        2016-02-17  195  
1013fc417 Quan Nguyen        2016-02-17  196  	hwirq = fwspec->param[0];
1013fc417 Quan Nguyen        2016-02-17  197  	for (i = 0; i < nr_irqs; i++)
1013fc417 Quan Nguyen        2016-02-17 @198  		irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
1013fc417 Quan Nguyen        2016-02-17  199  				&xgene_gpio_sb_irq_chip, priv);
1013fc417 Quan Nguyen        2016-02-17  200  
1013fc417 Quan Nguyen        2016-02-17 @201  	parent_fwspec.fwnode = domain->parent->fwnode;
1013fc417 Quan Nguyen        2016-02-17  202  	if (is_of_node(parent_fwspec.fwnode)) {
1013fc417 Quan Nguyen        2016-02-17  203  		parent_fwspec.param_count = 3;
1013fc417 Quan Nguyen        2016-02-17  204  		parent_fwspec.param[0] = 0;/* SPI */
1013fc417 Quan Nguyen        2016-02-17  205  		/* Skip SGIs and PPIs*/
1013fc417 Quan Nguyen        2016-02-17  206  		parent_fwspec.param[1] = hwirq + priv->parent_irq_base - 32;
1013fc417 Quan Nguyen        2016-02-17  207  		parent_fwspec.param[2] = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  208  	} else if (is_fwnode_irqchip(parent_fwspec.fwnode)) {
1013fc417 Quan Nguyen        2016-02-17  209  		parent_fwspec.param_count = 2;
1013fc417 Quan Nguyen        2016-02-17  210  		parent_fwspec.param[0] = hwirq + priv->parent_irq_base;
1013fc417 Quan Nguyen        2016-02-17  211  		parent_fwspec.param[1] = fwspec->param[1];
1013fc417 Quan Nguyen        2016-02-17  212  	} else
1013fc417 Quan Nguyen        2016-02-17  213  		return -EINVAL;
1013fc417 Quan Nguyen        2016-02-17  214  
1013fc417 Quan Nguyen        2016-02-17 @215  	return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
1013fc417 Quan Nguyen        2016-02-17  216  			&parent_fwspec);
1013fc417 Quan Nguyen        2016-02-17  217  }
1013fc417 Quan Nguyen        2016-02-17  218  
1013fc417 Quan Nguyen        2016-02-17  219  static const struct irq_domain_ops xgene_gpio_sb_domain_ops = {
1013fc417 Quan Nguyen        2016-02-17 @220  	.translate      = xgene_gpio_sb_domain_translate,
1013fc417 Quan Nguyen        2016-02-17 @221  	.alloc          = xgene_gpio_sb_domain_alloc,
c6cc75fec Axel Lin           2016-03-17 @222  	.free           = irq_domain_free_irqs_common,
1013fc417 Quan Nguyen        2016-02-17 @223  	.activate	= xgene_gpio_sb_domain_activate,
1013fc417 Quan Nguyen        2016-02-17 @224  	.deactivate	= xgene_gpio_sb_domain_deactivate,
1013fc417 Quan Nguyen        2016-02-17  225  };
1013fc417 Quan Nguyen        2016-02-17  226  
b2b35e108 Y Vo               2015-01-16  227  static int xgene_gpio_sb_probe(struct platform_device *pdev)
b2b35e108 Y Vo               2015-01-16  228  {
b2b35e108 Y Vo               2015-01-16  229  	struct xgene_gpio_sb *priv;
67ebb742b Andrzej Hajda      2016-02-23  230  	int ret;
b2b35e108 Y Vo               2015-01-16  231  	struct resource *res;
b2b35e108 Y Vo               2015-01-16  232  	void __iomem *regs;
1013fc417 Quan Nguyen        2016-02-17  233  	struct irq_domain *parent_domain = NULL;
1013fc417 Quan Nguyen        2016-02-17  234  	struct fwnode_handle *fwnode;
1013fc417 Quan Nguyen        2016-02-17  235  	u32 val32;
b2b35e108 Y Vo               2015-01-16  236  
b2b35e108 Y Vo               2015-01-16  237  	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
b2b35e108 Y Vo               2015-01-16  238  	if (!priv)
b2b35e108 Y Vo               2015-01-16  239  		return -ENOMEM;
b2b35e108 Y Vo               2015-01-16  240  
b2b35e108 Y Vo               2015-01-16  241  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
b2b35e108 Y Vo               2015-01-16  242  	regs = devm_ioremap_resource(&pdev->dev, res);
33c07b467 Vladimir Zapolskiy 2015-03-29  243  	if (IS_ERR(regs))
b2b35e108 Y Vo               2015-01-16  244  		return PTR_ERR(regs);
b2b35e108 Y Vo               2015-01-16  245  
1013fc417 Quan Nguyen        2016-02-17  246  	priv->regs = regs;
1013fc417 Quan Nguyen        2016-02-17  247  
1013fc417 Quan Nguyen        2016-02-17  248  	ret = platform_get_irq(pdev, 0);
1013fc417 Quan Nguyen        2016-02-17  249  	if (ret > 0) {
1013fc417 Quan Nguyen        2016-02-17  250  		priv->parent_irq_base = irq_get_irq_data(ret)->hwirq;
1013fc417 Quan Nguyen        2016-02-17  251  		parent_domain = irq_get_irq_data(ret)->domain;
1013fc417 Quan Nguyen        2016-02-17  252  	}
1013fc417 Quan Nguyen        2016-02-17  253  	if (!parent_domain) {
1013fc417 Quan Nguyen        2016-02-17  254  		dev_err(&pdev->dev, "unable to obtain parent domain\n");
1013fc417 Quan Nguyen        2016-02-17  255  		return -ENODEV;
1013fc417 Quan Nguyen        2016-02-17  256  	}
1013fc417 Quan Nguyen        2016-02-17  257  
0f4630f37 Linus Walleij      2015-12-04  258  	ret = bgpio_init(&priv->gc, &pdev->dev, 4,
b2b35e108 Y Vo               2015-01-16  259  			regs + MPA_GPIO_IN_ADDR,
b2b35e108 Y Vo               2015-01-16  260  			regs + MPA_GPIO_OUT_ADDR, NULL,
b2b35e108 Y Vo               2015-01-16  261  			regs + MPA_GPIO_OE_ADDR, NULL, 0);
b2b35e108 Y Vo               2015-01-16  262          if (ret)
b2b35e108 Y Vo               2015-01-16  263                  return ret;
b2b35e108 Y Vo               2015-01-16  264  
1013fc417 Quan Nguyen        2016-02-17  265  	priv->gc.to_irq = xgene_gpio_sb_to_irq;
b2b35e108 Y Vo               2015-01-16  266  
1013fc417 Quan Nguyen        2016-02-17  267  	/* Retrieve start irq pin, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  268  	priv->irq_start = XGENE_DFLT_IRQ_START_PIN;
1013fc417 Quan Nguyen        2016-02-17  269  	if (!device_property_read_u32(&pdev->dev,
1013fc417 Quan Nguyen        2016-02-17  270  					XGENE_IRQ_START_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  271  		priv->irq_start = val32;
b2b35e108 Y Vo               2015-01-16  272  
1013fc417 Quan Nguyen        2016-02-17  273  	/* Retrieve number irqs, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  274  	priv->nirq = XGENE_DFLT_MAX_NIRQ;
1013fc417 Quan Nguyen        2016-02-17  275  	if (!device_property_read_u32(&pdev->dev, XGENE_NIRQ_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  276  		priv->nirq = val32;
b2b35e108 Y Vo               2015-01-16  277  
1013fc417 Quan Nguyen        2016-02-17  278  	/* Retrieve number gpio, use default if property not found */
1013fc417 Quan Nguyen        2016-02-17  279  	priv->gc.ngpio = XGENE_DFLT_MAX_NGPIO;
1013fc417 Quan Nguyen        2016-02-17  280  	if (!device_property_read_u32(&pdev->dev, XGENE_NGPIO_PROPERTY, &val32))
1013fc417 Quan Nguyen        2016-02-17  281  		priv->gc.ngpio = val32;
1013fc417 Quan Nguyen        2016-02-17  282  
1013fc417 Quan Nguyen        2016-02-17  283  	dev_info(&pdev->dev, "Support %d gpios, %d irqs start from pin %d\n",
1013fc417 Quan Nguyen        2016-02-17  284  			priv->gc.ngpio, priv->nirq, priv->irq_start);
b2b35e108 Y Vo               2015-01-16  285  
b2b35e108 Y Vo               2015-01-16  286  	platform_set_drvdata(pdev, priv);
b2b35e108 Y Vo               2015-01-16  287  
1013fc417 Quan Nguyen        2016-02-17  288  	if (pdev->dev.of_node)
1013fc417 Quan Nguyen        2016-02-17  289  		fwnode = of_node_to_fwnode(pdev->dev.of_node);
b2b35e108 Y Vo               2015-01-16  290  	else
1013fc417 Quan Nguyen        2016-02-17  291  		fwnode = pdev->dev.fwnode;
1013fc417 Quan Nguyen        2016-02-17  292  
1013fc417 Quan Nguyen        2016-02-17 @293  	priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
1013fc417 Quan Nguyen        2016-02-17  294  					0, priv->nirq, fwnode,
1013fc417 Quan Nguyen        2016-02-17  295  					&xgene_gpio_sb_domain_ops, priv);
1013fc417 Quan Nguyen        2016-02-17  296  	if (!priv->irq_domain)

:::::: The code at line 111 was first introduced by commit
:::::: 1013fc417cc15ead7c3a9091a47617f357db71a4 gpio: xgene: Enable X-Gene standby GPIO as interrupt controller

:::::: TO: Quan Nguyen <qnguyen@apm.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 45764 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160730/4baf7fb6/attachment-0001.obj>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
  2016-07-30  0:34     ` Iyappan Subramanian
  (?)
@ 2016-07-30  5:42       ` kbuild test robot
  -1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  5:42 UTC (permalink / raw)
  To: Iyappan Subramanian
  Cc: kbuild-all, davem, netdev, devicetree, linux-arm-kernel, patches,
	linux, Iyappan Subramanian, Quan Nguyen

[-- Attachment #1: Type: text/plain, Size: 6479 bytes --]

Hi,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_irq_set_type':
   drivers/gpio/gpio-xgene-sb.c:111:10: error: implicit declaration of function 'irq_chip_set_type_parent' [-Werror=implicit-function-declaration]
      return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
             ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
   drivers/gpio/gpio-xgene-sb.c:118:13: error: 'irq_chip_eoi_parent' undeclared here (not in a function)
     .irq_eoi = irq_chip_eoi_parent,
                ^
   drivers/gpio/gpio-xgene-sb.c:119:20: error: 'irq_chip_mask_parent' undeclared here (not in a function)
     .irq_mask       = irq_chip_mask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c:120:20: error: 'irq_chip_unmask_parent' undeclared here (not in a function)
     .irq_unmask     = irq_chip_unmask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_domain_alloc':
   drivers/gpio/gpio-xgene-sb.c:198:3: error: implicit declaration of function 'irq_domain_set_hwirq_and_chip' [-Werror=implicit-function-declaration]
      irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
      ^
   drivers/gpio/gpio-xgene-sb.c:201:31: error: 'struct irq_domain' has no member named 'parent'
     parent_fwspec.fwnode = domain->parent->fwnode;
                                  ^
   drivers/gpio/gpio-xgene-sb.c:215:9: error: implicit declaration of function 'irq_domain_alloc_irqs_parent' [-Werror=implicit-function-declaration]
     return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
            ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
   drivers/gpio/gpio-xgene-sb.c:220:2: error: unknown field 'translate' specified in initializer
     .translate      = xgene_gpio_sb_domain_translate,
     ^
>> drivers/gpio/gpio-xgene-sb.c:220:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .translate      = xgene_gpio_sb_domain_translate,
                       ^
   drivers/gpio/gpio-xgene-sb.c:220:20: note: (near initialization for 'xgene_gpio_sb_domain_ops.match')
   drivers/gpio/gpio-xgene-sb.c:221:2: error: unknown field 'alloc' specified in initializer
     .alloc          = xgene_gpio_sb_domain_alloc,
     ^
   drivers/gpio/gpio-xgene-sb.c:221:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .alloc          = xgene_gpio_sb_domain_alloc,
                       ^
   drivers/gpio/gpio-xgene-sb.c:221:20: note: (near initialization for 'xgene_gpio_sb_domain_ops.select')
   drivers/gpio/gpio-xgene-sb.c:222:2: error: unknown field 'free' specified in initializer
     .free           = irq_domain_free_irqs_common,
     ^
   drivers/gpio/gpio-xgene-sb.c:222:20: error: 'irq_domain_free_irqs_common' undeclared here (not in a function)
     .free           = irq_domain_free_irqs_common,
                       ^
   drivers/gpio/gpio-xgene-sb.c:223:2: error: unknown field 'activate' specified in initializer
     .activate = xgene_gpio_sb_domain_activate,
     ^
   drivers/gpio/gpio-xgene-sb.c:223:14: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .activate = xgene_gpio_sb_domain_activate,
                 ^
   drivers/gpio/gpio-xgene-sb.c:223:14: note: (near initialization for 'xgene_gpio_sb_domain_ops.unmap')
   drivers/gpio/gpio-xgene-sb.c:224:2: error: unknown field 'deactivate' specified in initializer
     .deactivate = xgene_gpio_sb_domain_deactivate,
     ^
   drivers/gpio/gpio-xgene-sb.c:224:16: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .deactivate = xgene_gpio_sb_domain_deactivate,
                   ^
   drivers/gpio/gpio-xgene-sb.c:224:16: note: (near initialization for 'xgene_gpio_sb_domain_ops.xlate')
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_probe':
   drivers/gpio/gpio-xgene-sb.c:293:21: error: implicit declaration of function 'irq_domain_create_hierarchy' [-Werror=implicit-function-declaration]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                        ^
   drivers/gpio/gpio-xgene-sb.c:293:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                      ^
   cc1: some warnings being treated as errors

vim +220 drivers/gpio/gpio-xgene-sb.c

1013fc41 Quan Nguyen 2016-02-17  209  		parent_fwspec.param_count = 2;
1013fc41 Quan Nguyen 2016-02-17  210  		parent_fwspec.param[0] = hwirq + priv->parent_irq_base;
1013fc41 Quan Nguyen 2016-02-17  211  		parent_fwspec.param[1] = fwspec->param[1];
1013fc41 Quan Nguyen 2016-02-17  212  	} else
1013fc41 Quan Nguyen 2016-02-17  213  		return -EINVAL;
1013fc41 Quan Nguyen 2016-02-17  214  
1013fc41 Quan Nguyen 2016-02-17 @215  	return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
1013fc41 Quan Nguyen 2016-02-17  216  			&parent_fwspec);
1013fc41 Quan Nguyen 2016-02-17  217  }
1013fc41 Quan Nguyen 2016-02-17  218  
1013fc41 Quan Nguyen 2016-02-17  219  static const struct irq_domain_ops xgene_gpio_sb_domain_ops = {
1013fc41 Quan Nguyen 2016-02-17 @220  	.translate      = xgene_gpio_sb_domain_translate,
1013fc41 Quan Nguyen 2016-02-17  221  	.alloc          = xgene_gpio_sb_domain_alloc,
c6cc75fe Axel Lin    2016-03-17  222  	.free           = irq_domain_free_irqs_common,
1013fc41 Quan Nguyen 2016-02-17  223  	.activate	= xgene_gpio_sb_domain_activate,

:::::: The code at line 220 was first introduced by commit
:::::: 1013fc417cc15ead7c3a9091a47617f357db71a4 gpio: xgene: Enable X-Gene standby GPIO as interrupt controller

:::::: TO: Quan Nguyen <qnguyen@apm.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 42688 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-07-30  5:42       ` kbuild test robot
  0 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  5:42 UTC (permalink / raw)
  Cc: kbuild-all, davem, netdev, devicetree, linux-arm-kernel, patches,
	linux, Iyappan Subramanian, Quan Nguyen

[-- Attachment #1: Type: text/plain, Size: 6479 bytes --]

Hi,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_irq_set_type':
   drivers/gpio/gpio-xgene-sb.c:111:10: error: implicit declaration of function 'irq_chip_set_type_parent' [-Werror=implicit-function-declaration]
      return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
             ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
   drivers/gpio/gpio-xgene-sb.c:118:13: error: 'irq_chip_eoi_parent' undeclared here (not in a function)
     .irq_eoi = irq_chip_eoi_parent,
                ^
   drivers/gpio/gpio-xgene-sb.c:119:20: error: 'irq_chip_mask_parent' undeclared here (not in a function)
     .irq_mask       = irq_chip_mask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c:120:20: error: 'irq_chip_unmask_parent' undeclared here (not in a function)
     .irq_unmask     = irq_chip_unmask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_domain_alloc':
   drivers/gpio/gpio-xgene-sb.c:198:3: error: implicit declaration of function 'irq_domain_set_hwirq_and_chip' [-Werror=implicit-function-declaration]
      irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
      ^
   drivers/gpio/gpio-xgene-sb.c:201:31: error: 'struct irq_domain' has no member named 'parent'
     parent_fwspec.fwnode = domain->parent->fwnode;
                                  ^
   drivers/gpio/gpio-xgene-sb.c:215:9: error: implicit declaration of function 'irq_domain_alloc_irqs_parent' [-Werror=implicit-function-declaration]
     return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
            ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
   drivers/gpio/gpio-xgene-sb.c:220:2: error: unknown field 'translate' specified in initializer
     .translate      = xgene_gpio_sb_domain_translate,
     ^
>> drivers/gpio/gpio-xgene-sb.c:220:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .translate      = xgene_gpio_sb_domain_translate,
                       ^
   drivers/gpio/gpio-xgene-sb.c:220:20: note: (near initialization for 'xgene_gpio_sb_domain_ops.match')
   drivers/gpio/gpio-xgene-sb.c:221:2: error: unknown field 'alloc' specified in initializer
     .alloc          = xgene_gpio_sb_domain_alloc,
     ^
   drivers/gpio/gpio-xgene-sb.c:221:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .alloc          = xgene_gpio_sb_domain_alloc,
                       ^
   drivers/gpio/gpio-xgene-sb.c:221:20: note: (near initialization for 'xgene_gpio_sb_domain_ops.select')
   drivers/gpio/gpio-xgene-sb.c:222:2: error: unknown field 'free' specified in initializer
     .free           = irq_domain_free_irqs_common,
     ^
   drivers/gpio/gpio-xgene-sb.c:222:20: error: 'irq_domain_free_irqs_common' undeclared here (not in a function)
     .free           = irq_domain_free_irqs_common,
                       ^
   drivers/gpio/gpio-xgene-sb.c:223:2: error: unknown field 'activate' specified in initializer
     .activate = xgene_gpio_sb_domain_activate,
     ^
   drivers/gpio/gpio-xgene-sb.c:223:14: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .activate = xgene_gpio_sb_domain_activate,
                 ^
   drivers/gpio/gpio-xgene-sb.c:223:14: note: (near initialization for 'xgene_gpio_sb_domain_ops.unmap')
   drivers/gpio/gpio-xgene-sb.c:224:2: error: unknown field 'deactivate' specified in initializer
     .deactivate = xgene_gpio_sb_domain_deactivate,
     ^
   drivers/gpio/gpio-xgene-sb.c:224:16: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .deactivate = xgene_gpio_sb_domain_deactivate,
                   ^
   drivers/gpio/gpio-xgene-sb.c:224:16: note: (near initialization for 'xgene_gpio_sb_domain_ops.xlate')
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_probe':
   drivers/gpio/gpio-xgene-sb.c:293:21: error: implicit declaration of function 'irq_domain_create_hierarchy' [-Werror=implicit-function-declaration]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                        ^
   drivers/gpio/gpio-xgene-sb.c:293:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                      ^
   cc1: some warnings being treated as errors

vim +220 drivers/gpio/gpio-xgene-sb.c

1013fc41 Quan Nguyen 2016-02-17  209  		parent_fwspec.param_count = 2;
1013fc41 Quan Nguyen 2016-02-17  210  		parent_fwspec.param[0] = hwirq + priv->parent_irq_base;
1013fc41 Quan Nguyen 2016-02-17  211  		parent_fwspec.param[1] = fwspec->param[1];
1013fc41 Quan Nguyen 2016-02-17  212  	} else
1013fc41 Quan Nguyen 2016-02-17  213  		return -EINVAL;
1013fc41 Quan Nguyen 2016-02-17  214  
1013fc41 Quan Nguyen 2016-02-17 @215  	return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
1013fc41 Quan Nguyen 2016-02-17  216  			&parent_fwspec);
1013fc41 Quan Nguyen 2016-02-17  217  }
1013fc41 Quan Nguyen 2016-02-17  218  
1013fc41 Quan Nguyen 2016-02-17  219  static const struct irq_domain_ops xgene_gpio_sb_domain_ops = {
1013fc41 Quan Nguyen 2016-02-17 @220  	.translate      = xgene_gpio_sb_domain_translate,
1013fc41 Quan Nguyen 2016-02-17  221  	.alloc          = xgene_gpio_sb_domain_alloc,
c6cc75fe Axel Lin    2016-03-17  222  	.free           = irq_domain_free_irqs_common,
1013fc41 Quan Nguyen 2016-02-17  223  	.activate	= xgene_gpio_sb_domain_activate,

:::::: The code at line 220 was first introduced by commit
:::::: 1013fc417cc15ead7c3a9091a47617f357db71a4 gpio: xgene: Enable X-Gene standby GPIO as interrupt controller

:::::: TO: Quan Nguyen <qnguyen@apm.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 42688 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-07-30  5:42       ` kbuild test robot
  0 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2016-07-30  5:42 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Iyappan-Subramanian/Fix-warning-and-issues/20160730-083713
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_irq_set_type':
   drivers/gpio/gpio-xgene-sb.c:111:10: error: implicit declaration of function 'irq_chip_set_type_parent' [-Werror=implicit-function-declaration]
      return irq_chip_set_type_parent(d, IRQ_TYPE_EDGE_RISING);
             ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
   drivers/gpio/gpio-xgene-sb.c:118:13: error: 'irq_chip_eoi_parent' undeclared here (not in a function)
     .irq_eoi = irq_chip_eoi_parent,
                ^
   drivers/gpio/gpio-xgene-sb.c:119:20: error: 'irq_chip_mask_parent' undeclared here (not in a function)
     .irq_mask       = irq_chip_mask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c:120:20: error: 'irq_chip_unmask_parent' undeclared here (not in a function)
     .irq_unmask     = irq_chip_unmask_parent,
                       ^
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_domain_alloc':
   drivers/gpio/gpio-xgene-sb.c:198:3: error: implicit declaration of function 'irq_domain_set_hwirq_and_chip' [-Werror=implicit-function-declaration]
      irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
      ^
   drivers/gpio/gpio-xgene-sb.c:201:31: error: 'struct irq_domain' has no member named 'parent'
     parent_fwspec.fwnode = domain->parent->fwnode;
                                  ^
   drivers/gpio/gpio-xgene-sb.c:215:9: error: implicit declaration of function 'irq_domain_alloc_irqs_parent' [-Werror=implicit-function-declaration]
     return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
            ^
   drivers/gpio/gpio-xgene-sb.c: At top level:
   drivers/gpio/gpio-xgene-sb.c:220:2: error: unknown field 'translate' specified in initializer
     .translate      = xgene_gpio_sb_domain_translate,
     ^
>> drivers/gpio/gpio-xgene-sb.c:220:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .translate      = xgene_gpio_sb_domain_translate,
                       ^
   drivers/gpio/gpio-xgene-sb.c:220:20: note: (near initialization for 'xgene_gpio_sb_domain_ops.match')
   drivers/gpio/gpio-xgene-sb.c:221:2: error: unknown field 'alloc' specified in initializer
     .alloc          = xgene_gpio_sb_domain_alloc,
     ^
   drivers/gpio/gpio-xgene-sb.c:221:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .alloc          = xgene_gpio_sb_domain_alloc,
                       ^
   drivers/gpio/gpio-xgene-sb.c:221:20: note: (near initialization for 'xgene_gpio_sb_domain_ops.select')
   drivers/gpio/gpio-xgene-sb.c:222:2: error: unknown field 'free' specified in initializer
     .free           = irq_domain_free_irqs_common,
     ^
   drivers/gpio/gpio-xgene-sb.c:222:20: error: 'irq_domain_free_irqs_common' undeclared here (not in a function)
     .free           = irq_domain_free_irqs_common,
                       ^
   drivers/gpio/gpio-xgene-sb.c:223:2: error: unknown field 'activate' specified in initializer
     .activate = xgene_gpio_sb_domain_activate,
     ^
   drivers/gpio/gpio-xgene-sb.c:223:14: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .activate = xgene_gpio_sb_domain_activate,
                 ^
   drivers/gpio/gpio-xgene-sb.c:223:14: note: (near initialization for 'xgene_gpio_sb_domain_ops.unmap')
   drivers/gpio/gpio-xgene-sb.c:224:2: error: unknown field 'deactivate' specified in initializer
     .deactivate = xgene_gpio_sb_domain_deactivate,
     ^
   drivers/gpio/gpio-xgene-sb.c:224:16: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .deactivate = xgene_gpio_sb_domain_deactivate,
                   ^
   drivers/gpio/gpio-xgene-sb.c:224:16: note: (near initialization for 'xgene_gpio_sb_domain_ops.xlate')
   drivers/gpio/gpio-xgene-sb.c: In function 'xgene_gpio_sb_probe':
   drivers/gpio/gpio-xgene-sb.c:293:21: error: implicit declaration of function 'irq_domain_create_hierarchy' [-Werror=implicit-function-declaration]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                        ^
   drivers/gpio/gpio-xgene-sb.c:293:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     priv->irq_domain = irq_domain_create_hierarchy(parent_domain,
                      ^
   cc1: some warnings being treated as errors

vim +220 drivers/gpio/gpio-xgene-sb.c

1013fc41 Quan Nguyen 2016-02-17  209  		parent_fwspec.param_count = 2;
1013fc41 Quan Nguyen 2016-02-17  210  		parent_fwspec.param[0] = hwirq + priv->parent_irq_base;
1013fc41 Quan Nguyen 2016-02-17  211  		parent_fwspec.param[1] = fwspec->param[1];
1013fc41 Quan Nguyen 2016-02-17  212  	} else
1013fc41 Quan Nguyen 2016-02-17  213  		return -EINVAL;
1013fc41 Quan Nguyen 2016-02-17  214  
1013fc41 Quan Nguyen 2016-02-17 @215  	return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
1013fc41 Quan Nguyen 2016-02-17  216  			&parent_fwspec);
1013fc41 Quan Nguyen 2016-02-17  217  }
1013fc41 Quan Nguyen 2016-02-17  218  
1013fc41 Quan Nguyen 2016-02-17  219  static const struct irq_domain_ops xgene_gpio_sb_domain_ops = {
1013fc41 Quan Nguyen 2016-02-17 @220  	.translate      = xgene_gpio_sb_domain_translate,
1013fc41 Quan Nguyen 2016-02-17  221  	.alloc          = xgene_gpio_sb_domain_alloc,
c6cc75fe Axel Lin    2016-03-17  222  	.free           = irq_domain_free_irqs_common,
1013fc41 Quan Nguyen 2016-02-17  223  	.activate	= xgene_gpio_sb_domain_activate,

:::::: The code at line 220 was first introduced by commit
:::::: 1013fc417cc15ead7c3a9091a47617f357db71a4 gpio: xgene: Enable X-Gene standby GPIO as interrupt controller

:::::: TO: Quan Nguyen <qnguyen@apm.com>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 42688 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160730/f6bb2a14/attachment-0001.obj>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning
  2016-07-30  0:33     ` Iyappan Subramanian
@ 2016-07-30  9:13       ` Arnd Bergmann
  -1 siblings, 0 replies; 41+ messages in thread
From: Arnd Bergmann @ 2016-07-30  9:13 UTC (permalink / raw)
  To: Iyappan Subramanian
  Cc: davem, netdev, devicetree, linux-arm-kernel, patches, linux

On Friday, July 29, 2016 5:33:54 PM CEST Iyappan Subramanian wrote:
> This patch fixes the following kbuild warning, when ACPI was not enabled.
> 
> >> drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:878:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
>      phy_dev->advertising = phy_dev->supported;

>From looking at the patch, I don't think it addresses the warning.
Note that Linus added a patch to disable the warning in the latest
mainline kernel, so you won't see it any more, but I think the bug
is still there.

> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> index 7714b7d..b6bc6fa 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> @@ -776,15 +776,11 @@ int xgene_enet_phy_connect(struct net_device *ndev)
>                         netdev_err(ndev, "Could not connect to PHY\n");
>                         return -ENODEV;
>                 }
> -
> -               pdata->phy_dev = phy_dev;
>         } else {
>  #ifdef CONFIG_ACPI
>                 struct acpi_device *adev = acpi_phy_find_device(dev);
>                 if (adev)
> -                       pdata->phy_dev =  adev->driver_data;
> -
> -               phy_dev = pdata->phy_dev;
> +                       phy_dev =  adev->driver_data;
>  
>                 if (!phy_dev ||
>                     phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
> @@ -795,6 +791,7 @@ int xgene_enet_phy_connect(struct net_device *ndev)
>  #endif
>         }
>  
> +       pdata->phy_dev = phy_dev;

phy_dev is not initialized anywhere if CONFIG_ACPI is not set
and dev->of_node is NULL (which should not happen in practice,
but the compiler doesn't know that).

I think you want this instead:

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d4026a..98779fe2d558 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -792,6 +792,8 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 			netdev_err(ndev, "Could not connect to PHY\n");
 			return  -ENODEV;
 		}
+#else
+		return -ENODEV;
 #endif
 	}
 

	ARnd

	Arnd

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning
@ 2016-07-30  9:13       ` Arnd Bergmann
  0 siblings, 0 replies; 41+ messages in thread
From: Arnd Bergmann @ 2016-07-30  9:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday, July 29, 2016 5:33:54 PM CEST Iyappan Subramanian wrote:
> This patch fixes the following kbuild warning, when ACPI was not enabled.
> 
> >> drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:878:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
>      phy_dev->advertising = phy_dev->supported;

>From looking at the patch, I don't think it addresses the warning.
Note that Linus added a patch to disable the warning in the latest
mainline kernel, so you won't see it any more, but I think the bug
is still there.

> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> index 7714b7d..b6bc6fa 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
> @@ -776,15 +776,11 @@ int xgene_enet_phy_connect(struct net_device *ndev)
>                         netdev_err(ndev, "Could not connect to PHY\n");
>                         return -ENODEV;
>                 }
> -
> -               pdata->phy_dev = phy_dev;
>         } else {
>  #ifdef CONFIG_ACPI
>                 struct acpi_device *adev = acpi_phy_find_device(dev);
>                 if (adev)
> -                       pdata->phy_dev =  adev->driver_data;
> -
> -               phy_dev = pdata->phy_dev;
> +                       phy_dev =  adev->driver_data;
>  
>                 if (!phy_dev ||
>                     phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
> @@ -795,6 +791,7 @@ int xgene_enet_phy_connect(struct net_device *ndev)
>  #endif
>         }
>  
> +       pdata->phy_dev = phy_dev;

phy_dev is not initialized anywhere if CONFIG_ACPI is not set
and dev->of_node is NULL (which should not happen in practice,
but the compiler doesn't know that).

I think you want this instead:

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d4026a..98779fe2d558 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -792,6 +792,8 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 			netdev_err(ndev, "Could not connect to PHY\n");
 			return  -ENODEV;
 		}
+#else
+		return -ENODEV;
 #endif
 	}
 

	ARnd

	Arnd

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
  2016-07-30  0:34     ` Iyappan Subramanian
@ 2016-08-01  5:39       ` Quan Nguyen
  -1 siblings, 0 replies; 41+ messages in thread
From: Quan Nguyen @ 2016-08-01  5:39 UTC (permalink / raw)
  To: Iyappan Subramanian
  Cc: devicetree, netdev, patches, linux, davem, linux-arm-kernel

On Sat, Jul 30, 2016 at 7:34 AM, Iyappan Subramanian
<isubramanian@apm.com> wrote:
> When 10GbE SFP+ module is not plugged in or cable is not connected,
> the link status register does not report the proper state due
> to floating signal. This patch checks the module present status via an
> GPIO to determine whether to ignore the link status register and report
> link down.
>
> Signed-off-by: Quan Nguyen <qnguyen@apm.com>
> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
> Tested-by: Fushen Chen <fchen@apm.com>
> ---
>  drivers/net/ethernet/apm/xgene/Kconfig            |  1 +
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.c  | 15 +++++++++++++++
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.h  |  1 +
>  drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c |  6 ++++++
>  4 files changed, 23 insertions(+)
>
> diff --git a/drivers/net/ethernet/apm/xgene/Kconfig b/drivers/net/ethernet/apm/xgene/Kconfig
> index 300e3b5..6c60a7d 100644
> --- a/drivers/net/ethernet/apm/xgene/Kconfig
> +++ b/drivers/net/ethernet/apm/xgene/Kconfig
> @@ -4,6 +4,7 @@ config NET_XGENE
>         depends on ARCH_XGENE || COMPILE_TEST
>         select PHYLIB
>         select MDIO_XGENE
> +       select GPIO_XGENE_SB

I think this should change to GPIOLIB as we dont expected to work with
only gpio-xgene-sb.c. Other gpio drivers should be used as well.

>         help
>           This is the Ethernet driver for the on-chip ethernet interface on the
>           APM X-Gene SoC.
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> index 383e7ad..bda386d 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> @@ -19,6 +19,7 @@
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
>
> +#include <linux/gpio.h>
>  #include "xgene_enet_main.h"
>  #include "xgene_enet_hw.h"
>  #include "xgene_enet_sgmac.h"
> @@ -1322,6 +1323,18 @@ static int xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)
>         return 0;
>  }
>
> +static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata)
> +{
> +       struct device *dev = &pdata->pdev->dev;
> +
> +       if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
> +               return;
> +
> +       pdata->sfp_rdy = gpiod_get(dev, "rxlos", GPIOD_IN);
> +       if (IS_ERR(pdata->sfp_rdy))
> +               pdata->sfp_rdy = gpiod_get(dev, "sfp", GPIOD_IN);
> +}
> +
>  static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
>  {
>         struct platform_device *pdev;
> @@ -1411,6 +1424,8 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
>         if (ret)
>                 return ret;
>
> +       xgene_enet_gpiod_get(pdata);
> +
>         pdata->clk = devm_clk_get(&pdev->dev, NULL);
>         if (IS_ERR(pdata->clk)) {
>                 /* Firmware may have set up the clock already. */
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
> index 53f4a16..b339fc1 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
> @@ -217,6 +217,7 @@ struct xgene_enet_pdata {
>         u8 tx_delay;
>         u8 rx_delay;
>         bool mdio_driver;
> +       struct gpio_desc *sfp_rdy;
>  };
>
>  struct xgene_indirect_ctl {
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
> index 4087dba..d672e71 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
> @@ -18,6 +18,8 @@
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
>
> +#include <linux/of_gpio.h>
> +#include <linux/gpio.h>
>  #include "xgene_enet_main.h"
>  #include "xgene_enet_hw.h"
>  #include "xgene_enet_xgmac.h"
> @@ -399,10 +401,14 @@ 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))
> +               link_status = 0;
> +
>         if (link_status) {
>                 if (!netif_carrier_ok(ndev)) {
>                         netif_carrier_on(ndev);
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO
@ 2016-08-01  5:39       ` Quan Nguyen
  0 siblings, 0 replies; 41+ messages in thread
From: Quan Nguyen @ 2016-08-01  5:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Jul 30, 2016 at 7:34 AM, Iyappan Subramanian
<isubramanian@apm.com> wrote:
> When 10GbE SFP+ module is not plugged in or cable is not connected,
> the link status register does not report the proper state due
> to floating signal. This patch checks the module present status via an
> GPIO to determine whether to ignore the link status register and report
> link down.
>
> Signed-off-by: Quan Nguyen <qnguyen@apm.com>
> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
> Tested-by: Fushen Chen <fchen@apm.com>
> ---
>  drivers/net/ethernet/apm/xgene/Kconfig            |  1 +
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.c  | 15 +++++++++++++++
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.h  |  1 +
>  drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c |  6 ++++++
>  4 files changed, 23 insertions(+)
>
> diff --git a/drivers/net/ethernet/apm/xgene/Kconfig b/drivers/net/ethernet/apm/xgene/Kconfig
> index 300e3b5..6c60a7d 100644
> --- a/drivers/net/ethernet/apm/xgene/Kconfig
> +++ b/drivers/net/ethernet/apm/xgene/Kconfig
> @@ -4,6 +4,7 @@ config NET_XGENE
>         depends on ARCH_XGENE || COMPILE_TEST
>         select PHYLIB
>         select MDIO_XGENE
> +       select GPIO_XGENE_SB

I think this should change to GPIOLIB as we dont expected to work with
only gpio-xgene-sb.c. Other gpio drivers should be used as well.

>         help
>           This is the Ethernet driver for the on-chip ethernet interface on the
>           APM X-Gene SoC.
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> index 383e7ad..bda386d 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> @@ -19,6 +19,7 @@
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
>
> +#include <linux/gpio.h>
>  #include "xgene_enet_main.h"
>  #include "xgene_enet_hw.h"
>  #include "xgene_enet_sgmac.h"
> @@ -1322,6 +1323,18 @@ static int xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)
>         return 0;
>  }
>
> +static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata)
> +{
> +       struct device *dev = &pdata->pdev->dev;
> +
> +       if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
> +               return;
> +
> +       pdata->sfp_rdy = gpiod_get(dev, "rxlos", GPIOD_IN);
> +       if (IS_ERR(pdata->sfp_rdy))
> +               pdata->sfp_rdy = gpiod_get(dev, "sfp", GPIOD_IN);
> +}
> +
>  static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
>  {
>         struct platform_device *pdev;
> @@ -1411,6 +1424,8 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
>         if (ret)
>                 return ret;
>
> +       xgene_enet_gpiod_get(pdata);
> +
>         pdata->clk = devm_clk_get(&pdev->dev, NULL);
>         if (IS_ERR(pdata->clk)) {
>                 /* Firmware may have set up the clock already. */
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
> index 53f4a16..b339fc1 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
> @@ -217,6 +217,7 @@ struct xgene_enet_pdata {
>         u8 tx_delay;
>         u8 rx_delay;
>         bool mdio_driver;
> +       struct gpio_desc *sfp_rdy;
>  };
>
>  struct xgene_indirect_ctl {
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
> index 4087dba..d672e71 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
> @@ -18,6 +18,8 @@
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
>
> +#include <linux/of_gpio.h>
> +#include <linux/gpio.h>
>  #include "xgene_enet_main.h"
>  #include "xgene_enet_hw.h"
>  #include "xgene_enet_xgmac.h"
> @@ -399,10 +401,14 @@ 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))
> +               link_status = 0;
> +
>         if (link_status) {
>                 if (!netif_carrier_ok(ndev)) {
>                         netif_carrier_on(ndev);
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping
  2016-07-30  0:34     ` Iyappan Subramanian
@ 2016-08-01 16:35       ` Rob Herring
  -1 siblings, 0 replies; 41+ messages in thread
From: Rob Herring @ 2016-08-01 16:35 UTC (permalink / raw)
  To: Iyappan Subramanian
  Cc: devicetree, Quan Nguyen, netdev, patches, linux, davem, linux-arm-kernel

On Fri, Jul 29, 2016 at 05:34:03PM -0700, Iyappan Subramanian wrote:
> Signed-off-by: Quan Nguyen <qnguyen@apm.com>
> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
> Tested-by: Fushen Chen <fchen@apm.com>
> ---
>  Documentation/devicetree/bindings/net/apm-xgene-enet.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
> index 05f705e3..b83ae67 100644
> --- a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
> +++ b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
> @@ -24,6 +24,7 @@ Required properties for all the ethernet interfaces:
>  - clocks: Reference to the clock entry.
>  - local-mac-address: MAC address assigned to this device
>  - phy-connection-type: Interface type between ethernet device and PHY device
> +- rxlos-gpios: rxlos GPIO mapping

Needs a vendor prefix and some definition of what rxlos is. Direction 
and active state is needed as well.

Rob

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping
@ 2016-08-01 16:35       ` Rob Herring
  0 siblings, 0 replies; 41+ messages in thread
From: Rob Herring @ 2016-08-01 16:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 29, 2016 at 05:34:03PM -0700, Iyappan Subramanian wrote:
> Signed-off-by: Quan Nguyen <qnguyen@apm.com>
> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
> Tested-by: Fushen Chen <fchen@apm.com>
> ---
>  Documentation/devicetree/bindings/net/apm-xgene-enet.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
> index 05f705e3..b83ae67 100644
> --- a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
> +++ b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
> @@ -24,6 +24,7 @@ Required properties for all the ethernet interfaces:
>  - clocks: Reference to the clock entry.
>  - local-mac-address: MAC address assigned to this device
>  - phy-connection-type: Interface type between ethernet device and PHY device
> +- rxlos-gpios: rxlos GPIO mapping

Needs a vendor prefix and some definition of what rxlos is. Direction 
and active state is needed as well.

Rob

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping
  2016-08-01 16:35       ` Rob Herring
@ 2016-08-02  6:03         ` Quan Nguyen
  -1 siblings, 0 replies; 41+ messages in thread
From: Quan Nguyen @ 2016-08-02  6:03 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, netdev, patches, linux, Iyappan Subramanian, davem,
	linux-arm-kernel

On Mon, Aug 1, 2016 at 11:35 PM, Rob Herring <robh@kernel.org> wrote:
> On Fri, Jul 29, 2016 at 05:34:03PM -0700, Iyappan Subramanian wrote:
>> Signed-off-by: Quan Nguyen <qnguyen@apm.com>
>> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
>> Tested-by: Fushen Chen <fchen@apm.com>
>> ---
>>  Documentation/devicetree/bindings/net/apm-xgene-enet.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
>> index 05f705e3..b83ae67 100644
>> --- a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
>> +++ b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
>> @@ -24,6 +24,7 @@ Required properties for all the ethernet interfaces:
>>  - clocks: Reference to the clock entry.
>>  - local-mac-address: MAC address assigned to this device
>>  - phy-connection-type: Interface type between ethernet device and PHY device
>> +- rxlos-gpios: rxlos GPIO mapping
>
> Needs a vendor prefix and some definition of what rxlos is. Direction
> and active state is needed as well.
>

Hi Rob,

This gpio signal is from SFP+ module which will tell whether incoming
fiber signal available. As this is gpio, it must have the form of
"xxxx-gpios" as stated in Documentation/gpio/board.txt. As per this
document, the active state is also included in this property.

About definition for "rxlos-gpios", I suggested as below :
"- rxlos-gpios: Optional, input gpio from SFP+ module to indicate
availability of incoming signal"

Thank you,
Quan

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping
@ 2016-08-02  6:03         ` Quan Nguyen
  0 siblings, 0 replies; 41+ messages in thread
From: Quan Nguyen @ 2016-08-02  6:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 1, 2016 at 11:35 PM, Rob Herring <robh@kernel.org> wrote:
> On Fri, Jul 29, 2016 at 05:34:03PM -0700, Iyappan Subramanian wrote:
>> Signed-off-by: Quan Nguyen <qnguyen@apm.com>
>> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
>> Tested-by: Fushen Chen <fchen@apm.com>
>> ---
>>  Documentation/devicetree/bindings/net/apm-xgene-enet.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
>> index 05f705e3..b83ae67 100644
>> --- a/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
>> +++ b/Documentation/devicetree/bindings/net/apm-xgene-enet.txt
>> @@ -24,6 +24,7 @@ Required properties for all the ethernet interfaces:
>>  - clocks: Reference to the clock entry.
>>  - local-mac-address: MAC address assigned to this device
>>  - phy-connection-type: Interface type between ethernet device and PHY device
>> +- rxlos-gpios: rxlos GPIO mapping
>
> Needs a vendor prefix and some definition of what rxlos is. Direction
> and active state is needed as well.
>

Hi Rob,

This gpio signal is from SFP+ module which will tell whether incoming
fiber signal available. As this is gpio, it must have the form of
"xxxx-gpios" as stated in Documentation/gpio/board.txt. As per this
document, the active state is also included in this property.

About definition for "rxlos-gpios", I suggested as below :
"- rxlos-gpios: Optional, input gpio from SFP+ module to indicate
availability of incoming signal"

Thank you,
Quan

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2016-08-02  6:03 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-30  0:33 [PATCH net-next 00/10] Fix warning and issues Iyappan Subramanian
2016-07-30  0:33 ` Iyappan Subramanian
     [not found] ` <1469838843-19943-1-git-send-email-isubramanian-qTEPVZfXA3Y@public.gmane.org>
2016-07-30  0:33   ` [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning Iyappan Subramanian
2016-07-30  0:33     ` Iyappan Subramanian
2016-07-30  9:13     ` Arnd Bergmann
2016-07-30  9:13       ` Arnd Bergmann
2016-07-30  0:33   ` [PATCH net-next 03/10] drivers: net: xgene: fix: Delete descriptor rings and buffer pools Iyappan Subramanian
2016-07-30  0:33     ` Iyappan Subramanian
2016-07-30  0:34   ` [PATCH net-next 08/10] drivers: net: xgene: Poll link status via GPIO Iyappan Subramanian
2016-07-30  0:34     ` Iyappan Subramanian
     [not found]     ` <1469838843-19943-9-git-send-email-isubramanian-qTEPVZfXA3Y@public.gmane.org>
2016-07-30  1:56       ` kbuild test robot
2016-07-30  1:56         ` kbuild test robot
2016-07-30  1:56         ` kbuild test robot
2016-07-30  4:32     ` kbuild test robot
2016-07-30  4:32       ` kbuild test robot
2016-07-30  4:32       ` kbuild test robot
2016-07-30  5:42     ` kbuild test robot
2016-07-30  5:42       ` kbuild test robot
2016-07-30  5:42       ` kbuild test robot
2016-08-01  5:39     ` Quan Nguyen
2016-08-01  5:39       ` Quan Nguyen
2016-07-30  0:34   ` [PATCH net-next 10/10] Documentation: dtb: xgene: Add rxlos GPIO mapping Iyappan Subramanian
2016-07-30  0:34     ` Iyappan Subramanian
2016-08-01 16:35     ` Rob Herring
2016-08-01 16:35       ` Rob Herring
2016-08-02  6:03       ` Quan Nguyen
2016-08-02  6:03         ` Quan Nguyen
2016-07-30  3:12   ` [PATCH net-next 00/10] Fix warning and issues David Miller
2016-07-30  3:12     ` David Miller
2016-07-30  0:33 ` [PATCH net-next 02/10] drivers: net: xgene: fix: Add dma_unmap_single Iyappan Subramanian
2016-07-30  0:33   ` Iyappan Subramanian
2016-07-30  0:33 ` [PATCH net-next 04/10] drivers: net: xgene: Fix error deconstruction path Iyappan Subramanian
2016-07-30  0:33   ` Iyappan Subramanian
2016-07-30  0:33 ` [PATCH net-next 05/10] drivers: net: xgene: Fix RSS indirection table fields Iyappan Subramanian
2016-07-30  0:33   ` Iyappan Subramanian
2016-07-30  0:33 ` [PATCH net-next 06/10] drivers: net: xgene: Change port init sequence Iyappan Subramanian
2016-07-30  0:33   ` Iyappan Subramanian
2016-07-30  0:34 ` [PATCH net-next 07/10] drivers: net: xgene: XFI PCS reset when link is down Iyappan Subramanian
2016-07-30  0:34   ` Iyappan Subramanian
2016-07-30  0:34 ` [PATCH net-next 09/10] dtb: xgene: Add rxlos-gpios property Iyappan Subramanian
2016-07-30  0:34   ` Iyappan Subramanian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.