All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  4:46 ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-can

The driver only supports memory-mapped I/O [by ioremap()],
so readl/writel is actually the right thing to do, IMO.
During the validation of this driver or IP on ARM 64-bit processor
while sending lot of packets observed that the tx packet drop with iowrite
Putting the barriers for each tx fifo register write fixes this issue
Instead of barriers using writel also fixed this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 6114214..055d6f3 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -170,7 +170,7 @@ static const struct can_bittiming_const xcan_bittiming_const = {
 static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
 			u32 val)
 {
-	iowrite32(val, priv->reg_base + reg);
+	writel(val, priv->reg_base + reg);
 }
 
 /**
@@ -183,7 +183,7 @@ static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
  */
 static u32 xcan_read_reg_le(const struct xcan_priv *priv, enum xcan_reg reg)
 {
-	return ioread32(priv->reg_base + reg);
+	return readl(priv->reg_base + reg);
 }
 
 /**
-- 
2.1.2

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  4:46 ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

The driver only supports memory-mapped I/O [by ioremap()],
so readl/writel is actually the right thing to do, IMO.
During the validation of this driver or IP on ARM 64-bit processor
while sending lot of packets observed that the tx packet drop with iowrite
Putting the barriers for each tx fifo register write fixes this issue
Instead of barriers using writel also fixed this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 6114214..055d6f3 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -170,7 +170,7 @@ static const struct can_bittiming_const xcan_bittiming_const = {
 static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
 			u32 val)
 {
-	iowrite32(val, priv->reg_base + reg);
+	writel(val, priv->reg_base + reg);
 }
 
 /**
@@ -183,7 +183,7 @@ static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
  */
 static u32 xcan_read_reg_le(const struct xcan_priv *priv, enum xcan_reg reg)
 {
-	return ioread32(priv->reg_base + reg);
+	return readl(priv->reg_base + reg);
 }
 
 /**
-- 
2.1.2


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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  4:46 ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-can

The driver only supports memory-mapped I/O [by ioremap()],
so readl/writel is actually the right thing to do, IMO.
During the validation of this driver or IP on ARM 64-bit processor
while sending lot of packets observed that the tx packet drop with iowrite
Putting the barriers for each tx fifo register write fixes this issue
Instead of barriers using writel also fixed this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 6114214..055d6f3 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -170,7 +170,7 @@ static const struct can_bittiming_const xcan_bittiming_const = {
 static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
 			u32 val)
 {
-	iowrite32(val, priv->reg_base + reg);
+	writel(val, priv->reg_base + reg);
 }
 
 /**
@@ -183,7 +183,7 @@ static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
  */
 static u32 xcan_read_reg_le(const struct xcan_priv *priv, enum xcan_reg reg)
 {
-	return ioread32(priv->reg_base + reg);
+	return readl(priv->reg_base + reg);
 }
 
 /**
-- 
2.1.2

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  4:46 ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: linux-arm-kernel

The driver only supports memory-mapped I/O [by ioremap()],
so readl/writel is actually the right thing to do, IMO.
During the validation of this driver or IP on ARM 64-bit processor
while sending lot of packets observed that the tx packet drop with iowrite
Putting the barriers for each tx fifo register write fixes this issue
Instead of barriers using writel also fixed this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 6114214..055d6f3 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -170,7 +170,7 @@ static const struct can_bittiming_const xcan_bittiming_const = {
 static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
 			u32 val)
 {
-	iowrite32(val, priv->reg_base + reg);
+	writel(val, priv->reg_base + reg);
 }
 
 /**
@@ -183,7 +183,7 @@ static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
  */
 static u32 xcan_read_reg_le(const struct xcan_priv *priv, enum xcan_reg reg)
 {
-	return ioread32(priv->reg_base + reg);
+	return readl(priv->reg_base + reg);
 }
 
 /**
-- 
2.1.2

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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
  2015-10-22  4:46 ` Kedareswara rao Appana
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  -1 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2

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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
  2015-10-22  4:46 ` Kedareswara rao Appana
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  -1 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2

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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
  2015-10-22  4:46 ` Kedareswara rao Appana
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  -1 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2


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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
  2015-10-22  4:46 ` Kedareswara rao Appana
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  -1 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2


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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2

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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2

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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: anirudh, wg, mkl, michal.simek, soren.brinkmann, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2


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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-22  4:46   ` Kedareswara rao Appana
  0 siblings, 0 replies; 40+ messages in thread
From: Kedareswara rao Appana @ 2015-10-22  4:46 UTC (permalink / raw)
  To: linux-arm-kernel

Simply resetting the peripheral on bus off condition is not enough,
Because we also need to re-initialize the whole device.
This patch fixes this issue.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 055d6f3..9aeb85f 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
 	return 1;
 }
 
+static void xcan_chip_stop(struct net_device *ndev);
+
 /**
  * xcan_err_interrupt - error frame Isr
  * @ndev:	net_device pointer
@@ -558,8 +560,9 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
 	if (isr & XCAN_IXR_BSOFF_MASK) {
 		priv->can.state = CAN_STATE_BUS_OFF;
 		priv->can.can_stats.bus_off++;
-		/* Leave device in Config Mode in bus-off state */
-		priv->write_reg(priv, XCAN_SRR_OFFSET, XCAN_SRR_RESET_MASK);
+		/* Re-initialize the whole device in bus-off state */
+		xcan_chip_stop(ndev);
+		xcan_chip_start(ndev);
 		can_bus_off(ndev);
 		if (skb)
 			cf->can_id |= CAN_ERR_BUSOFF;
-- 
2.1.2

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  4:46 ` Kedareswara rao Appana
@ 2015-10-22  8:14   ` Arnd Bergmann
  -1 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-22  8:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kedareswara rao Appana, anirudh, wg, mkl, michal.simek,
	soren.brinkmann, appanad, netdev, linux-kernel, linux-can

On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> The driver only supports memory-mapped I/O [by ioremap()],
> so readl/writel is actually the right thing to do, IMO.
> During the validation of this driver or IP on ARM 64-bit processor
> while sending lot of packets observed that the tx packet drop with iowrite
> Putting the barriers for each tx fifo register write fixes this issue
> Instead of barriers using writel also fixed this issue.
> 
> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>

The two should really do the same thing: iowrite32() is just a static inline
calling writel() on both ARM32 and ARM64. On which kernel version did you
observe the difference? It's possible that an older version used
CONFIG_GENERIC_IOMAP, which made this slightly more expensive.

If there are barriers that you want to get rid of for performance reasons,
you should use writel_relaxed(), but be careful to synchronize them correctly
with regard to DMA. It should be fine in this driver, as it does not
perform any DMA, but be aware that there is no big-endian version of
writel_relaxed() at the moment.

	Arnd

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  8:14   ` Arnd Bergmann
  0 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-22  8:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> The driver only supports memory-mapped I/O [by ioremap()],
> so readl/writel is actually the right thing to do, IMO.
> During the validation of this driver or IP on ARM 64-bit processor
> while sending lot of packets observed that the tx packet drop with iowrite
> Putting the barriers for each tx fifo register write fixes this issue
> Instead of barriers using writel also fixed this issue.
> 
> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>

The two should really do the same thing: iowrite32() is just a static inline
calling writel() on both ARM32 and ARM64. On which kernel version did you
observe the difference? It's possible that an older version used
CONFIG_GENERIC_IOMAP, which made this slightly more expensive.

If there are barriers that you want to get rid of for performance reasons,
you should use writel_relaxed(), but be careful to synchronize them correctly
with regard to DMA. It should be fine in this driver, as it does not
perform any DMA, but be aware that there is no big-endian version of
writel_relaxed() at the moment.

	Arnd

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  8:14   ` Arnd Bergmann
@ 2015-10-22  8:21     ` Marc Kleine-Budde
  -1 siblings, 0 replies; 40+ messages in thread
From: Marc Kleine-Budde @ 2015-10-22  8:21 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Kedareswara rao Appana, anirudh, wg, michal.simek,
	soren.brinkmann, appanad, netdev, linux-kernel, linux-can

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

On 10/22/2015 10:14 AM, Arnd Bergmann wrote:
> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
>> The driver only supports memory-mapped I/O [by ioremap()],
>> so readl/writel is actually the right thing to do, IMO.
>> During the validation of this driver or IP on ARM 64-bit processor
>> while sending lot of packets observed that the tx packet drop with iowrite
>> Putting the barriers for each tx fifo register write fixes this issue
>> Instead of barriers using writel also fixed this issue.
>>
>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> 
> The two should really do the same thing: iowrite32() is just a static inline
> calling writel() on both ARM32 and ARM64. On which kernel version did you
> observe the difference? It's possible that an older version used
> CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
> 
> If there are barriers that you want to get rid of for performance reasons,
> you should use writel_relaxed(), but be careful to synchronize them correctly
> with regard to DMA. It should be fine in this driver, as it does not
> perform any DMA, but be aware that there is no big-endian version of
> writel_relaxed() at the moment.

We don't have DMA in CAN drivers, but usually a certain write triggers
sending. Do we need a barrier before triggering the sending?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  8:21     ` Marc Kleine-Budde
  0 siblings, 0 replies; 40+ messages in thread
From: Marc Kleine-Budde @ 2015-10-22  8:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/22/2015 10:14 AM, Arnd Bergmann wrote:
> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
>> The driver only supports memory-mapped I/O [by ioremap()],
>> so readl/writel is actually the right thing to do, IMO.
>> During the validation of this driver or IP on ARM 64-bit processor
>> while sending lot of packets observed that the tx packet drop with iowrite
>> Putting the barriers for each tx fifo register write fixes this issue
>> Instead of barriers using writel also fixed this issue.
>>
>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> 
> The two should really do the same thing: iowrite32() is just a static inline
> calling writel() on both ARM32 and ARM64. On which kernel version did you
> observe the difference? It's possible that an older version used
> CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
> 
> If there are barriers that you want to get rid of for performance reasons,
> you should use writel_relaxed(), but be careful to synchronize them correctly
> with regard to DMA. It should be fine in this driver, as it does not
> perform any DMA, but be aware that there is no big-endian version of
> writel_relaxed() at the moment.

We don't have DMA in CAN drivers, but usually a certain write triggers
sending. Do we need a barrier before triggering the sending?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151022/b2643a57/attachment.sig>

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

* RE: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  8:14   ` Arnd Bergmann
  (?)
@ 2015-10-22  8:34     ` Appana Durga Kedareswara Rao
  -1 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-22  8:34 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Anirudha Sarangi, wg, mkl, Michal Simek, Soren Brinkmann, netdev,
	linux-kernel, linux-can

Hi Arnd,	

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Thursday, October 22, 2015 1:45 PM
> To: linux-arm-kernel@lists.infradead.org
> Cc: Appana Durga Kedareswara Rao; Anirudha Sarangi; wg@grandegger.com;
> mkl@pengutronix.de; Michal Simek; Soren Brinkmann; Appana Durga
> Kedareswara Rao; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> can@vger.kernel.org
> Subject: Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
> 
> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> > The driver only supports memory-mapped I/O [by ioremap()], so
> > readl/writel is actually the right thing to do, IMO.
> > During the validation of this driver or IP on ARM 64-bit processor
> > while sending lot of packets observed that the tx packet drop with
> > iowrite Putting the barriers for each tx fifo register write fixes
> > this issue Instead of barriers using writel also fixed this issue.
> >
> > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> 
> The two should really do the same thing: iowrite32() is just a static inline calling
> writel() on both ARM32 and ARM64. On which kernel version did you observe the
> difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
> which made this slightly more expensive.

I observed this issue with the 4.0.0 kernel version

> 
> If there are barriers that you want to get rid of for performance reasons, you
> should use writel_relaxed(), but be careful to synchronize them correctly with
> regard to DMA. It should be fine in this driver, as it does not perform any DMA,
> but be aware that there is no big-endian version of
> writel_relaxed() at the moment.

There is no DMA in CAN for this IP.

Regards,
Kedar.

> 
> 	Arnd

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

* RE: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  8:34     ` Appana Durga Kedareswara Rao
  0 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-22  8:34 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Anirudha Sarangi, wg, mkl, Michal Simek, Soren Brinkmann, netdev,
	linux-kernel, linux-can

Hi Arnd,	

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Thursday, October 22, 2015 1:45 PM
> To: linux-arm-kernel@lists.infradead.org
> Cc: Appana Durga Kedareswara Rao; Anirudha Sarangi; wg@grandegger.com;
> mkl@pengutronix.de; Michal Simek; Soren Brinkmann; Appana Durga
> Kedareswara Rao; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> can@vger.kernel.org
> Subject: Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
> 
> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> > The driver only supports memory-mapped I/O [by ioremap()], so
> > readl/writel is actually the right thing to do, IMO.
> > During the validation of this driver or IP on ARM 64-bit processor
> > while sending lot of packets observed that the tx packet drop with
> > iowrite Putting the barriers for each tx fifo register write fixes
> > this issue Instead of barriers using writel also fixed this issue.
> >
> > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> 
> The two should really do the same thing: iowrite32() is just a static inline calling
> writel() on both ARM32 and ARM64. On which kernel version did you observe the
> difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
> which made this slightly more expensive.

I observed this issue with the 4.0.0 kernel version

> 
> If there are barriers that you want to get rid of for performance reasons, you
> should use writel_relaxed(), but be careful to synchronize them correctly with
> regard to DMA. It should be fine in this driver, as it does not perform any DMA,
> but be aware that there is no big-endian version of
> writel_relaxed() at the moment.

There is no DMA in CAN for this IP.

Regards,
Kedar.

> 
> 	Arnd

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  8:34     ` Appana Durga Kedareswara Rao
  0 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-22  8:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,	

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd at arndb.de]
> Sent: Thursday, October 22, 2015 1:45 PM
> To: linux-arm-kernel at lists.infradead.org
> Cc: Appana Durga Kedareswara Rao; Anirudha Sarangi; wg at grandegger.com;
> mkl at pengutronix.de; Michal Simek; Soren Brinkmann; Appana Durga
> Kedareswara Rao; netdev at vger.kernel.org; linux-kernel at vger.kernel.org; linux-
> can at vger.kernel.org
> Subject: Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
> 
> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> > The driver only supports memory-mapped I/O [by ioremap()], so
> > readl/writel is actually the right thing to do, IMO.
> > During the validation of this driver or IP on ARM 64-bit processor
> > while sending lot of packets observed that the tx packet drop with
> > iowrite Putting the barriers for each tx fifo register write fixes
> > this issue Instead of barriers using writel also fixed this issue.
> >
> > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> 
> The two should really do the same thing: iowrite32() is just a static inline calling
> writel() on both ARM32 and ARM64. On which kernel version did you observe the
> difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
> which made this slightly more expensive.

I observed this issue with the 4.0.0 kernel version

> 
> If there are barriers that you want to get rid of for performance reasons, you
> should use writel_relaxed(), but be careful to synchronize them correctly with
> regard to DMA. It should be fine in this driver, as it does not perform any DMA,
> but be aware that there is no big-endian version of
> writel_relaxed() at the moment.

There is no DMA in CAN for this IP.

Regards,
Kedar.

> 
> 	Arnd

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

* RE: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  8:21     ` Marc Kleine-Budde
  (?)
@ 2015-10-22  8:39       ` Appana Durga Kedareswara Rao
  -1 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-22  8:39 UTC (permalink / raw)
  To: Marc Kleine-Budde, Arnd Bergmann, linux-arm-kernel
  Cc: Anirudha Sarangi, wg, Michal Simek, Soren Brinkmann, netdev,
	linux-kernel, linux-can

Hi Marc,

> -----Original Message-----
> From: Marc Kleine-Budde [mailto:mkl@pengutronix.de]
> Sent: Thursday, October 22, 2015 1:52 PM
> To: Arnd Bergmann; linux-arm-kernel@lists.infradead.org
> Cc: Appana Durga Kedareswara Rao; Anirudha Sarangi; wg@grandegger.com;
> Michal Simek; Soren Brinkmann; Appana Durga Kedareswara Rao;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> can@vger.kernel.org
> Subject: Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
> 
> On 10/22/2015 10:14 AM, Arnd Bergmann wrote:
> > On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> >> The driver only supports memory-mapped I/O [by ioremap()], so
> >> readl/writel is actually the right thing to do, IMO.
> >> During the validation of this driver or IP on ARM 64-bit processor
> >> while sending lot of packets observed that the tx packet drop with
> >> iowrite Putting the barriers for each tx fifo register write fixes
> >> this issue Instead of barriers using writel also fixed this issue.
> >>
> >> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> >
> > The two should really do the same thing: iowrite32() is just a static
> > inline calling writel() on both ARM32 and ARM64. On which kernel
> > version did you observe the difference? It's possible that an older
> > version used CONFIG_GENERIC_IOMAP, which made this slightly more
> expensive.
> >
> > If there are barriers that you want to get rid of for performance
> > reasons, you should use writel_relaxed(), but be careful to
> > synchronize them correctly with regard to DMA. It should be fine in
> > this driver, as it does not perform any DMA, but be aware that there
> > is no big-endian version of
> > writel_relaxed() at the moment.
> 
> We don't have DMA in CAN drivers, but usually a certain write triggers sending.
> Do we need a barrier before triggering the sending?

Yes During validation of this IP on ARM 64 bit processor with using iowrite32() and sending a lot of packets it requires barriers before triggering the send.
With using writel() barriers are not needed.

Regards,
Kedar.

> 
> Marc
> 
> --
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


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

* RE: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  8:39       ` Appana Durga Kedareswara Rao
  0 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-22  8:39 UTC (permalink / raw)
  To: Marc Kleine-Budde, Arnd Bergmann, linux-arm-kernel
  Cc: Anirudha Sarangi, wg, Michal Simek, Soren Brinkmann, netdev,
	linux-kernel, linux-can

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2565 bytes --]

Hi Marc,

> -----Original Message-----
> From: Marc Kleine-Budde [mailto:mkl@pengutronix.de]
> Sent: Thursday, October 22, 2015 1:52 PM
> To: Arnd Bergmann; linux-arm-kernel@lists.infradead.org
> Cc: Appana Durga Kedareswara Rao; Anirudha Sarangi; wg@grandegger.com;
> Michal Simek; Soren Brinkmann; Appana Durga Kedareswara Rao;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> can@vger.kernel.org
> Subject: Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
> 
> On 10/22/2015 10:14 AM, Arnd Bergmann wrote:
> > On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> >> The driver only supports memory-mapped I/O [by ioremap()], so
> >> readl/writel is actually the right thing to do, IMO.
> >> During the validation of this driver or IP on ARM 64-bit processor
> >> while sending lot of packets observed that the tx packet drop with
> >> iowrite Putting the barriers for each tx fifo register write fixes
> >> this issue Instead of barriers using writel also fixed this issue.
> >>
> >> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> >
> > The two should really do the same thing: iowrite32() is just a static
> > inline calling writel() on both ARM32 and ARM64. On which kernel
> > version did you observe the difference? It's possible that an older
> > version used CONFIG_GENERIC_IOMAP, which made this slightly more
> expensive.
> >
> > If there are barriers that you want to get rid of for performance
> > reasons, you should use writel_relaxed(), but be careful to
> > synchronize them correctly with regard to DMA. It should be fine in
> > this driver, as it does not perform any DMA, but be aware that there
> > is no big-endian version of
> > writel_relaxed() at the moment.
> 
> We don't have DMA in CAN drivers, but usually a certain write triggers sending.
> Do we need a barrier before triggering the sending?

Yes During validation of this IP on ARM 64 bit processor with using iowrite32() and sending a lot of packets it requires barriers before triggering the send.
With using writel() barriers are not needed.

Regards,
Kedar.

> 
> Marc
> 
> --
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  8:39       ` Appana Durga Kedareswara Rao
  0 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-22  8:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,

> -----Original Message-----
> From: Marc Kleine-Budde [mailto:mkl at pengutronix.de]
> Sent: Thursday, October 22, 2015 1:52 PM
> To: Arnd Bergmann; linux-arm-kernel at lists.infradead.org
> Cc: Appana Durga Kedareswara Rao; Anirudha Sarangi; wg at grandegger.com;
> Michal Simek; Soren Brinkmann; Appana Durga Kedareswara Rao;
> netdev at vger.kernel.org; linux-kernel at vger.kernel.org; linux-
> can at vger.kernel.org
> Subject: Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
> 
> On 10/22/2015 10:14 AM, Arnd Bergmann wrote:
> > On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> >> The driver only supports memory-mapped I/O [by ioremap()], so
> >> readl/writel is actually the right thing to do, IMO.
> >> During the validation of this driver or IP on ARM 64-bit processor
> >> while sending lot of packets observed that the tx packet drop with
> >> iowrite Putting the barriers for each tx fifo register write fixes
> >> this issue Instead of barriers using writel also fixed this issue.
> >>
> >> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> >
> > The two should really do the same thing: iowrite32() is just a static
> > inline calling writel() on both ARM32 and ARM64. On which kernel
> > version did you observe the difference? It's possible that an older
> > version used CONFIG_GENERIC_IOMAP, which made this slightly more
> expensive.
> >
> > If there are barriers that you want to get rid of for performance
> > reasons, you should use writel_relaxed(), but be careful to
> > synchronize them correctly with regard to DMA. It should be fine in
> > this driver, as it does not perform any DMA, but be aware that there
> > is no big-endian version of
> > writel_relaxed() at the moment.
> 
> We don't have DMA in CAN drivers, but usually a certain write triggers sending.
> Do we need a barrier before triggering the sending?

Yes During validation of this IP on ARM 64 bit processor with using iowrite32() and sending a lot of packets it requires barriers before triggering the send.
With using writel() barriers are not needed.

Regards,
Kedar.

> 
> Marc
> 
> --
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  8:21     ` Marc Kleine-Budde
@ 2015-10-22  8:58       ` Arnd Bergmann
  -1 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-22  8:58 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: linux-arm-kernel, Kedareswara rao Appana, anirudh, wg,
	michal.simek, soren.brinkmann, appanad, netdev, linux-kernel,
	linux-can

On Thursday 22 October 2015 10:21:58 Marc Kleine-Budde wrote:
> On 10/22/2015 10:14 AM, Arnd Bergmann wrote:
> > On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> >> The driver only supports memory-mapped I/O [by ioremap()],
> >> so readl/writel is actually the right thing to do, IMO.
> >> During the validation of this driver or IP on ARM 64-bit processor
> >> while sending lot of packets observed that the tx packet drop with iowrite
> >> Putting the barriers for each tx fifo register write fixes this issue
> >> Instead of barriers using writel also fixed this issue.
> >>
> >> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> > 
> > The two should really do the same thing: iowrite32() is just a static inline
> > calling writel() on both ARM32 and ARM64. On which kernel version did you
> > observe the difference? It's possible that an older version used
> > CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
> > 
> > If there are barriers that you want to get rid of for performance reasons,
> > you should use writel_relaxed(), but be careful to synchronize them correctly
> > with regard to DMA. It should be fine in this driver, as it does not
> > perform any DMA, but be aware that there is no big-endian version of
> > writel_relaxed() at the moment.
> 
> We don't have DMA in CAN drivers, but usually a certain write triggers
> sending. Do we need a barrier before triggering the sending?

No, the relaxed writes are not well-defined across architectures. On
ARM, the CPU guarantees that stores to an MMIO area are still in order
with respect to one another, the barrier is only needed for actual DMA,
so you are fine. I would expect the same to be true everywhere,
otherwise a lot of other drivers would be broken too.

To be on the safe side, that last write() could remain a writel() instead
of writel_relaxed(), and that would be guaranteed to work on all
architectures even if they end relax the ordering between MMIO writes.
If there is a measurable performance difference, just use writel_relaxed()
and add a comment.

	Arnd

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  8:58       ` Arnd Bergmann
  0 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-22  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 22 October 2015 10:21:58 Marc Kleine-Budde wrote:
> On 10/22/2015 10:14 AM, Arnd Bergmann wrote:
> > On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> >> The driver only supports memory-mapped I/O [by ioremap()],
> >> so readl/writel is actually the right thing to do, IMO.
> >> During the validation of this driver or IP on ARM 64-bit processor
> >> while sending lot of packets observed that the tx packet drop with iowrite
> >> Putting the barriers for each tx fifo register write fixes this issue
> >> Instead of barriers using writel also fixed this issue.
> >>
> >> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> > 
> > The two should really do the same thing: iowrite32() is just a static inline
> > calling writel() on both ARM32 and ARM64. On which kernel version did you
> > observe the difference? It's possible that an older version used
> > CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
> > 
> > If there are barriers that you want to get rid of for performance reasons,
> > you should use writel_relaxed(), but be careful to synchronize them correctly
> > with regard to DMA. It should be fine in this driver, as it does not
> > perform any DMA, but be aware that there is no big-endian version of
> > writel_relaxed() at the moment.
> 
> We don't have DMA in CAN drivers, but usually a certain write triggers
> sending. Do we need a barrier before triggering the sending?

No, the relaxed writes are not well-defined across architectures. On
ARM, the CPU guarantees that stores to an MMIO area are still in order
with respect to one another, the barrier is only needed for actual DMA,
so you are fine. I would expect the same to be true everywhere,
otherwise a lot of other drivers would be broken too.

To be on the safe side, that last write() could remain a writel() instead
of writel_relaxed(), and that would be guaranteed to work on all
architectures even if they end relax the ordering between MMIO writes.
If there is a measurable performance difference, just use writel_relaxed()
and add a comment.

	Arnd

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  8:34     ` Appana Durga Kedareswara Rao
@ 2015-10-22  9:02       ` Arnd Bergmann
  -1 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-22  9:02 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Appana Durga Kedareswara Rao, netdev, linux-kernel, linux-can,
	Michal Simek, Soren Brinkmann, Anirudha Sarangi, mkl, wg

On Thursday 22 October 2015 08:34:53 Appana Durga Kedareswara Rao wrote:
> > On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> > > The driver only supports memory-mapped I/O [by ioremap()], so
> > > readl/writel is actually the right thing to do, IMO.
> > > During the validation of this driver or IP on ARM 64-bit processor
> > > while sending lot of packets observed that the tx packet drop with
> > > iowrite Putting the barriers for each tx fifo register write fixes
> > > this issue Instead of barriers using writel also fixed this issue.
> > >
> > > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> > 
> > The two should really do the same thing: iowrite32() is just a static inline calling
> > writel() on both ARM32 and ARM64. On which kernel version did you observe the
> > difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
> > which made this slightly more expensive.
> 
> I observed this issue with the 4.0.0 kernel version

Is it possible that you have nonstandard patches on your kernel? If so, can
you send a diff against the mainline version?

I don't see CONFIG_GENERIC_IOMAP in 4.0.0, and writel() definitely has the
necessary barriers on arm64, the same way that iowrite() does.

> > If there are barriers that you want to get rid of for performance reasons, you
> > should use writel_relaxed(), but be careful to synchronize them correctly with
> > regard to DMA. It should be fine in this driver, as it does not perform any DMA,
> > but be aware that there is no big-endian version of
> > writel_relaxed() at the moment.
> 
> There is no DMA in CAN for this IP.

Ok, good.

	Arnd

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  9:02       ` Arnd Bergmann
  0 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-22  9:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 22 October 2015 08:34:53 Appana Durga Kedareswara Rao wrote:
> > On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
> > > The driver only supports memory-mapped I/O [by ioremap()], so
> > > readl/writel is actually the right thing to do, IMO.
> > > During the validation of this driver or IP on ARM 64-bit processor
> > > while sending lot of packets observed that the tx packet drop with
> > > iowrite Putting the barriers for each tx fifo register write fixes
> > > this issue Instead of barriers using writel also fixed this issue.
> > >
> > > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> > 
> > The two should really do the same thing: iowrite32() is just a static inline calling
> > writel() on both ARM32 and ARM64. On which kernel version did you observe the
> > difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
> > which made this slightly more expensive.
> 
> I observed this issue with the 4.0.0 kernel version

Is it possible that you have nonstandard patches on your kernel? If so, can
you send a diff against the mainline version?

I don't see CONFIG_GENERIC_IOMAP in 4.0.0, and writel() definitely has the
necessary barriers on arm64, the same way that iowrite() does.

> > If there are barriers that you want to get rid of for performance reasons, you
> > should use writel_relaxed(), but be careful to synchronize them correctly with
> > regard to DMA. It should be fine in this driver, as it does not perform any DMA,
> > but be aware that there is no big-endian version of
> > writel_relaxed() at the moment.
> 
> There is no DMA in CAN for this IP.

Ok, good.

	Arnd

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  9:02       ` Arnd Bergmann
  (?)
  (?)
@ 2015-10-22  9:49         ` Michal Simek
  -1 siblings, 0 replies; 40+ messages in thread
From: Michal Simek @ 2015-10-22  9:49 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Appana Durga Kedareswara Rao, netdev, linux-kernel, linux-can,
	mkl, Soren Brinkmann, Anirudha Sarangi, wg

On 10/22/2015 11:02 AM, Arnd Bergmann wrote:
> On Thursday 22 October 2015 08:34:53 Appana Durga Kedareswara Rao wrote:
>>> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
>>>> The driver only supports memory-mapped I/O [by ioremap()], so
>>>> readl/writel is actually the right thing to do, IMO.
>>>> During the validation of this driver or IP on ARM 64-bit processor
>>>> while sending lot of packets observed that the tx packet drop with
>>>> iowrite Putting the barriers for each tx fifo register write fixes
>>>> this issue Instead of barriers using writel also fixed this issue.
>>>>
>>>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
>>>
>>> The two should really do the same thing: iowrite32() is just a static inline calling
>>> writel() on both ARM32 and ARM64. On which kernel version did you observe the
>>> difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
>>> which made this slightly more expensive.
>>
>> I observed this issue with the 4.0.0 kernel version
> 
> Is it possible that you have nonstandard patches on your kernel? If so, can
> you send a diff against the mainline version?

Kedar: Can you please retest this on mainline kernel?
We shouldn't have any patches which should influence this.

Thanks,
Michal

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  9:49         ` Michal Simek
  0 siblings, 0 replies; 40+ messages in thread
From: Michal Simek @ 2015-10-22  9:49 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Appana Durga Kedareswara Rao, netdev, linux-kernel, linux-can,
	Soren Brinkmann, Anirudha Sarangi, mkl, wg

On 10/22/2015 11:02 AM, Arnd Bergmann wrote:
> On Thursday 22 October 2015 08:34:53 Appana Durga Kedareswara Rao wrote:
>>> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
>>>> The driver only supports memory-mapped I/O [by ioremap()], so
>>>> readl/writel is actually the right thing to do, IMO.
>>>> During the validation of this driver or IP on ARM 64-bit processor
>>>> while sending lot of packets observed that the tx packet drop with
>>>> iowrite Putting the barriers for each tx fifo register write fixes
>>>> this issue Instead of barriers using writel also fixed this issue.
>>>>
>>>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
>>>
>>> The two should really do the same thing: iowrite32() is just a static inline calling
>>> writel() on both ARM32 and ARM64. On which kernel version did you observe the
>>> difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
>>> which made this slightly more expensive.
>>
>> I observed this issue with the 4.0.0 kernel version
> 
> Is it possible that you have nonstandard patches on your kernel? If so, can
> you send a diff against the mainline version?

Kedar: Can you please retest this on mainline kernel?
We shouldn't have any patches which should influence this.

Thanks,
Michal

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  9:49         ` Michal Simek
  0 siblings, 0 replies; 40+ messages in thread
From: Michal Simek @ 2015-10-22  9:49 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Appana Durga Kedareswara Rao, netdev, linux-kernel, linux-can,
	mkl, Soren Brinkmann, Anirudha Sarangi, wg

On 10/22/2015 11:02 AM, Arnd Bergmann wrote:
> On Thursday 22 October 2015 08:34:53 Appana Durga Kedareswara Rao wrote:
>>> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
>>>> The driver only supports memory-mapped I/O [by ioremap()], so
>>>> readl/writel is actually the right thing to do, IMO.
>>>> During the validation of this driver or IP on ARM 64-bit processor
>>>> while sending lot of packets observed that the tx packet drop with
>>>> iowrite Putting the barriers for each tx fifo register write fixes
>>>> this issue Instead of barriers using writel also fixed this issue.
>>>>
>>>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
>>>
>>> The two should really do the same thing: iowrite32() is just a static inline calling
>>> writel() on both ARM32 and ARM64. On which kernel version did you observe the
>>> difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
>>> which made this slightly more expensive.
>>
>> I observed this issue with the 4.0.0 kernel version
> 
> Is it possible that you have nonstandard patches on your kernel? If so, can
> you send a diff against the mainline version?

Kedar: Can you please retest this on mainline kernel?
We shouldn't have any patches which should influence this.

Thanks,
Michal

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-22  9:49         ` Michal Simek
  0 siblings, 0 replies; 40+ messages in thread
From: Michal Simek @ 2015-10-22  9:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/22/2015 11:02 AM, Arnd Bergmann wrote:
> On Thursday 22 October 2015 08:34:53 Appana Durga Kedareswara Rao wrote:
>>> On Thursday 22 October 2015 10:16:02 Kedareswara rao Appana wrote:
>>>> The driver only supports memory-mapped I/O [by ioremap()], so
>>>> readl/writel is actually the right thing to do, IMO.
>>>> During the validation of this driver or IP on ARM 64-bit processor
>>>> while sending lot of packets observed that the tx packet drop with
>>>> iowrite Putting the barriers for each tx fifo register write fixes
>>>> this issue Instead of barriers using writel also fixed this issue.
>>>>
>>>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
>>>
>>> The two should really do the same thing: iowrite32() is just a static inline calling
>>> writel() on both ARM32 and ARM64. On which kernel version did you observe the
>>> difference? It's possible that an older version used CONFIG_GENERIC_IOMAP,
>>> which made this slightly more expensive.
>>
>> I observed this issue with the 4.0.0 kernel version
> 
> Is it possible that you have nonstandard patches on your kernel? If so, can
> you send a diff against the mainline version?

Kedar: Can you please retest this on mainline kernel?
We shouldn't have any patches which should influence this.

Thanks,
Michal

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

* Re: [PATCH 2/2] can: xilinx: fix bug in bus error handling
  2015-10-22  4:46   ` Kedareswara rao Appana
  (?)
@ 2015-10-22 16:33     ` Sören Brinkmann
  -1 siblings, 0 replies; 40+ messages in thread
From: Sören Brinkmann @ 2015-10-22 16:33 UTC (permalink / raw)
  To: Kedareswara rao Appana
  Cc: anirudh, wg, mkl, michal.simek, appanad, linux-can, netdev,
	linux-arm-kernel, linux-kernel

On Thu, 2015-10-22 at 10:16AM +0530, Kedareswara rao Appana wrote:
> Simply resetting the peripheral on bus off condition is not enough,
> Because we also need to re-initialize the whole device.
> This patch fixes this issue.
> 
> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> ---
>  drivers/net/can/xilinx_can.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> index 055d6f3..9aeb85f 100644
> --- a/drivers/net/can/xilinx_can.c
> +++ b/drivers/net/can/xilinx_can.c
> @@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
>  	return 1;
>  }
>  
> +static void xcan_chip_stop(struct net_device *ndev);

Isn't it possible to move the function and avoid the forward
declaration?

	Sören

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

* Re: [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-22 16:33     ` Sören Brinkmann
  0 siblings, 0 replies; 40+ messages in thread
From: Sören Brinkmann @ 2015-10-22 16:33 UTC (permalink / raw)
  To: Kedareswara rao Appana
  Cc: anirudh, wg, mkl, michal.simek, appanad, linux-can, netdev,
	linux-arm-kernel, linux-kernel

On Thu, 2015-10-22 at 10:16AM +0530, Kedareswara rao Appana wrote:
> Simply resetting the peripheral on bus off condition is not enough,
> Because we also need to re-initialize the whole device.
> This patch fixes this issue.
> 
> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> ---
>  drivers/net/can/xilinx_can.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> index 055d6f3..9aeb85f 100644
> --- a/drivers/net/can/xilinx_can.c
> +++ b/drivers/net/can/xilinx_can.c
> @@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
>  	return 1;
>  }
>  
> +static void xcan_chip_stop(struct net_device *ndev);

Isn't it possible to move the function and avoid the forward
declaration?

	Sören

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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-22 16:33     ` Sören Brinkmann
  0 siblings, 0 replies; 40+ messages in thread
From: Sören Brinkmann @ 2015-10-22 16:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2015-10-22 at 10:16AM +0530, Kedareswara rao Appana wrote:
> Simply resetting the peripheral on bus off condition is not enough,
> Because we also need to re-initialize the whole device.
> This patch fixes this issue.
> 
> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> ---
>  drivers/net/can/xilinx_can.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> index 055d6f3..9aeb85f 100644
> --- a/drivers/net/can/xilinx_can.c
> +++ b/drivers/net/can/xilinx_can.c
> @@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
>  	return 1;
>  }
>  
> +static void xcan_chip_stop(struct net_device *ndev);

Isn't it possible to move the function and avoid the forward
declaration?

	S?ren

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

* RE: [PATCH 2/2] can: xilinx: fix bug in bus error handling
  2015-10-22 16:33     ` Sören Brinkmann
  (?)
@ 2015-10-23  5:21       ` Appana Durga Kedareswara Rao
  -1 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-23  5:21 UTC (permalink / raw)
  To: Soren Brinkmann
  Cc: Anirudha Sarangi, wg, mkl, Michal Simek, linux-can, netdev,
	linux-arm-kernel, linux-kernel

Hi Soren,

> -----Original Message-----
> From: Sören Brinkmann [mailto:soren.brinkmann@xilinx.com]
> Sent: Thursday, October 22, 2015 10:03 PM
> To: Appana Durga Kedareswara Rao
> Cc: Anirudha Sarangi; wg@grandegger.com; mkl@pengutronix.de; Michal
> Simek; Appana Durga Kedareswara Rao; linux-can@vger.kernel.org;
> netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH 2/2] can: xilinx: fix bug in bus error handling
> 
> On Thu, 2015-10-22 at 10:16AM +0530, Kedareswara rao Appana wrote:
> > Simply resetting the peripheral on bus off condition is not enough,
> > Because we also need to re-initialize the whole device.
> > This patch fixes this issue.
> >
> > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> > ---
> >  drivers/net/can/xilinx_can.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/can/xilinx_can.c
> > b/drivers/net/can/xilinx_can.c index 055d6f3..9aeb85f 100644
> > --- a/drivers/net/can/xilinx_can.c
> > +++ b/drivers/net/can/xilinx_can.c
> > @@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
> >  	return 1;
> >  }
> >
> > +static void xcan_chip_stop(struct net_device *ndev);
> 
> Isn't it possible to move the function and avoid the forward declaration?

Yes it is possible to move the function will fix it in the next version of the patch.

Regards,
Kedar.

> 
> 	Sören

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

* RE: [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-23  5:21       ` Appana Durga Kedareswara Rao
  0 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-23  5:21 UTC (permalink / raw)
  To: Soren Brinkmann
  Cc: Anirudha Sarangi, wg, mkl, Michal Simek, linux-can, netdev,
	linux-arm-kernel, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1596 bytes --]

Hi Soren,

> -----Original Message-----
> From: Sören Brinkmann [mailto:soren.brinkmann@xilinx.com]
> Sent: Thursday, October 22, 2015 10:03 PM
> To: Appana Durga Kedareswara Rao
> Cc: Anirudha Sarangi; wg@grandegger.com; mkl@pengutronix.de; Michal
> Simek; Appana Durga Kedareswara Rao; linux-can@vger.kernel.org;
> netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH 2/2] can: xilinx: fix bug in bus error handling
> 
> On Thu, 2015-10-22 at 10:16AM +0530, Kedareswara rao Appana wrote:
> > Simply resetting the peripheral on bus off condition is not enough,
> > Because we also need to re-initialize the whole device.
> > This patch fixes this issue.
> >
> > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> > ---
> >  drivers/net/can/xilinx_can.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/can/xilinx_can.c
> > b/drivers/net/can/xilinx_can.c index 055d6f3..9aeb85f 100644
> > --- a/drivers/net/can/xilinx_can.c
> > +++ b/drivers/net/can/xilinx_can.c
> > @@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
> >  	return 1;
> >  }
> >
> > +static void xcan_chip_stop(struct net_device *ndev);
> 
> Isn't it possible to move the function and avoid the forward declaration?

Yes it is possible to move the function will fix it in the next version of the patch.

Regards,
Kedar.

> 
> 	Sören
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* [PATCH 2/2] can: xilinx: fix bug in bus error handling
@ 2015-10-23  5:21       ` Appana Durga Kedareswara Rao
  0 siblings, 0 replies; 40+ messages in thread
From: Appana Durga Kedareswara Rao @ 2015-10-23  5:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Soren,

> -----Original Message-----
> From: S?ren Brinkmann [mailto:soren.brinkmann at xilinx.com]
> Sent: Thursday, October 22, 2015 10:03 PM
> To: Appana Durga Kedareswara Rao
> Cc: Anirudha Sarangi; wg at grandegger.com; mkl at pengutronix.de; Michal
> Simek; Appana Durga Kedareswara Rao; linux-can at vger.kernel.org;
> netdev at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-
> kernel at vger.kernel.org
> Subject: Re: [PATCH 2/2] can: xilinx: fix bug in bus error handling
> 
> On Thu, 2015-10-22 at 10:16AM +0530, Kedareswara rao Appana wrote:
> > Simply resetting the peripheral on bus off condition is not enough,
> > Because we also need to re-initialize the whole device.
> > This patch fixes this issue.
> >
> > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> > ---
> >  drivers/net/can/xilinx_can.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/can/xilinx_can.c
> > b/drivers/net/can/xilinx_can.c index 055d6f3..9aeb85f 100644
> > --- a/drivers/net/can/xilinx_can.c
> > +++ b/drivers/net/can/xilinx_can.c
> > @@ -529,6 +529,8 @@ static int xcan_rx(struct net_device *ndev)
> >  	return 1;
> >  }
> >
> > +static void xcan_chip_stop(struct net_device *ndev);
> 
> Isn't it possible to move the function and avoid the forward declaration?

Yes it is possible to move the function will fix it in the next version of the patch.

Regards,
Kedar.

> 
> 	S?ren

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-22  8:58       ` Arnd Bergmann
@ 2015-10-25 20:32         ` Marc Kleine-Budde
  -1 siblings, 0 replies; 40+ messages in thread
From: Marc Kleine-Budde @ 2015-10-25 20:32 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Kedareswara rao Appana, anirudh, wg,
	michal.simek, soren.brinkmann, appanad, netdev, linux-kernel,
	linux-can

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

On 10/22/2015 10:58 AM, Arnd Bergmann wrote:
>>> The two should really do the same thing: iowrite32() is just a static inline
>>> calling writel() on both ARM32 and ARM64. On which kernel version did you
>>> observe the difference? It's possible that an older version used
>>> CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
>>>
>>> If there are barriers that you want to get rid of for performance reasons,
>>> you should use writel_relaxed(), but be careful to synchronize them correctly
>>> with regard to DMA. It should be fine in this driver, as it does not
>>> perform any DMA, but be aware that there is no big-endian version of
>>> writel_relaxed() at the moment.
>>
>> We don't have DMA in CAN drivers, but usually a certain write triggers
>> sending. Do we need a barrier before triggering the sending?
> 
> No, the relaxed writes are not well-defined across architectures. On
> ARM, the CPU guarantees that stores to an MMIO area are still in order
> with respect to one another, the barrier is only needed for actual DMA,
> so you are fine. I would expect the same to be true everywhere,
> otherwise a lot of other drivers would be broken too.

And the relaxed functions seem not to be available on all archs. This
driver should work on microblaze. Are __raw_writeX(), __raw_readX() an
alternative here?

> To be on the safe side, that last write() could remain a writel() instead
> of writel_relaxed(), and that would be guaranteed to work on all
> architectures even if they end relax the ordering between MMIO writes.
> If there is a measurable performance difference, just use writel_relaxed()
> and add a comment.

Thanks,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-25 20:32         ` Marc Kleine-Budde
  0 siblings, 0 replies; 40+ messages in thread
From: Marc Kleine-Budde @ 2015-10-25 20:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/22/2015 10:58 AM, Arnd Bergmann wrote:
>>> The two should really do the same thing: iowrite32() is just a static inline
>>> calling writel() on both ARM32 and ARM64. On which kernel version did you
>>> observe the difference? It's possible that an older version used
>>> CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
>>>
>>> If there are barriers that you want to get rid of for performance reasons,
>>> you should use writel_relaxed(), but be careful to synchronize them correctly
>>> with regard to DMA. It should be fine in this driver, as it does not
>>> perform any DMA, but be aware that there is no big-endian version of
>>> writel_relaxed() at the moment.
>>
>> We don't have DMA in CAN drivers, but usually a certain write triggers
>> sending. Do we need a barrier before triggering the sending?
> 
> No, the relaxed writes are not well-defined across architectures. On
> ARM, the CPU guarantees that stores to an MMIO area are still in order
> with respect to one another, the barrier is only needed for actual DMA,
> so you are fine. I would expect the same to be true everywhere,
> otherwise a lot of other drivers would be broken too.

And the relaxed functions seem not to be available on all archs. This
driver should work on microblaze. Are __raw_writeX(), __raw_readX() an
alternative here?

> To be on the safe side, that last write() could remain a writel() instead
> of writel_relaxed(), and that would be guaranteed to work on all
> architectures even if they end relax the ordering between MMIO writes.
> If there is a measurable performance difference, just use writel_relaxed()
> and add a comment.

Thanks,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151025/b5fa83eb/attachment.sig>

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

* Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
  2015-10-25 20:32         ` Marc Kleine-Budde
@ 2015-10-26  1:25           ` Arnd Bergmann
  -1 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-26  1:25 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: linux-arm-kernel, Kedareswara rao Appana, anirudh, wg,
	michal.simek, soren.brinkmann, appanad, netdev, linux-kernel,
	linux-can

On Sunday 25 October 2015, Marc Kleine-Budde wrote:
> On 10/22/2015 10:58 AM, Arnd Bergmann wrote:
> >>> The two should really do the same thing: iowrite32() is just a static inline
> >>> calling writel() on both ARM32 and ARM64. On which kernel version did you
> >>> observe the difference? It's possible that an older version used
> >>> CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
> >>>
> >>> If there are barriers that you want to get rid of for performance reasons,
> >>> you should use writel_relaxed(), but be careful to synchronize them correctly
> >>> with regard to DMA. It should be fine in this driver, as it does not
> >>> perform any DMA, but be aware that there is no big-endian version of
> >>> writel_relaxed() at the moment.
> >>
> >> We don't have DMA in CAN drivers, but usually a certain write triggers
> >> sending. Do we need a barrier before triggering the sending?
> > 
> > No, the relaxed writes are not well-defined across architectures. On
> > ARM, the CPU guarantees that stores to an MMIO area are still in order
> > with respect to one another, the barrier is only needed for actual DMA,
> > so you are fine. I would expect the same to be true everywhere,
> > otherwise a lot of other drivers would be broken too.
> 
> And the relaxed functions seem not to be available on all archs. This
> driver should work on microblaze. Are __raw_writeX(), __raw_readX() an
> alternative here?

__raw_writeX() and __raw_readX()  are not safe to use in drivers in general.

readl_relaxed() should work on all architectures nowadays, and I've checked
that it does on microblaze.

	Arnd

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

* [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
@ 2015-10-26  1:25           ` Arnd Bergmann
  0 siblings, 0 replies; 40+ messages in thread
From: Arnd Bergmann @ 2015-10-26  1:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Sunday 25 October 2015, Marc Kleine-Budde wrote:
> On 10/22/2015 10:58 AM, Arnd Bergmann wrote:
> >>> The two should really do the same thing: iowrite32() is just a static inline
> >>> calling writel() on both ARM32 and ARM64. On which kernel version did you
> >>> observe the difference? It's possible that an older version used
> >>> CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
> >>>
> >>> If there are barriers that you want to get rid of for performance reasons,
> >>> you should use writel_relaxed(), but be careful to synchronize them correctly
> >>> with regard to DMA. It should be fine in this driver, as it does not
> >>> perform any DMA, but be aware that there is no big-endian version of
> >>> writel_relaxed() at the moment.
> >>
> >> We don't have DMA in CAN drivers, but usually a certain write triggers
> >> sending. Do we need a barrier before triggering the sending?
> > 
> > No, the relaxed writes are not well-defined across architectures. On
> > ARM, the CPU guarantees that stores to an MMIO area are still in order
> > with respect to one another, the barrier is only needed for actual DMA,
> > so you are fine. I would expect the same to be true everywhere,
> > otherwise a lot of other drivers would be broken too.
> 
> And the relaxed functions seem not to be available on all archs. This
> driver should work on microblaze. Are __raw_writeX(), __raw_readX() an
> alternative here?

__raw_writeX() and __raw_readX()  are not safe to use in drivers in general.

readl_relaxed() should work on all architectures nowadays, and I've checked
that it does on microblaze.

	Arnd

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

end of thread, other threads:[~2015-10-26  1:25 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22  4:46 [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite Kedareswara rao Appana
2015-10-22  4:46 ` Kedareswara rao Appana
2015-10-22  4:46 ` Kedareswara rao Appana
2015-10-22  4:46 ` Kedareswara rao Appana
2015-10-22  4:46 ` [PATCH 2/2] can: xilinx: fix bug in bus error handling Kedareswara rao Appana
2015-10-22  4:46   ` Kedareswara rao Appana
2015-10-22  4:46 ` Kedareswara rao Appana
2015-10-22  4:46   ` Kedareswara rao Appana
2015-10-22  4:46 ` Kedareswara rao Appana
2015-10-22  4:46   ` Kedareswara rao Appana
2015-10-22  4:46 ` Kedareswara rao Appana
2015-10-22  4:46   ` Kedareswara rao Appana
2015-10-22 16:33   ` Sören Brinkmann
2015-10-22 16:33     ` Sören Brinkmann
2015-10-22 16:33     ` Sören Brinkmann
2015-10-23  5:21     ` Appana Durga Kedareswara Rao
2015-10-23  5:21       ` Appana Durga Kedareswara Rao
2015-10-23  5:21       ` Appana Durga Kedareswara Rao
2015-10-22  8:14 ` [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite Arnd Bergmann
2015-10-22  8:14   ` Arnd Bergmann
2015-10-22  8:21   ` Marc Kleine-Budde
2015-10-22  8:21     ` Marc Kleine-Budde
2015-10-22  8:39     ` Appana Durga Kedareswara Rao
2015-10-22  8:39       ` Appana Durga Kedareswara Rao
2015-10-22  8:39       ` Appana Durga Kedareswara Rao
2015-10-22  8:58     ` Arnd Bergmann
2015-10-22  8:58       ` Arnd Bergmann
2015-10-25 20:32       ` Marc Kleine-Budde
2015-10-25 20:32         ` Marc Kleine-Budde
2015-10-26  1:25         ` Arnd Bergmann
2015-10-26  1:25           ` Arnd Bergmann
2015-10-22  8:34   ` Appana Durga Kedareswara Rao
2015-10-22  8:34     ` Appana Durga Kedareswara Rao
2015-10-22  8:34     ` Appana Durga Kedareswara Rao
2015-10-22  9:02     ` Arnd Bergmann
2015-10-22  9:02       ` Arnd Bergmann
2015-10-22  9:49       ` Michal Simek
2015-10-22  9:49         ` Michal Simek
2015-10-22  9:49         ` Michal Simek
2015-10-22  9:49         ` Michal Simek

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.