netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround
@ 2015-08-12  9:52 Mugunthan V N
  2015-08-12  9:52 ` [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps Mugunthan V N
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Mugunthan V N @ 2015-08-12  9:52 UTC (permalink / raw)
  To: netdev
  Cc: devicetree, linux-omap, David S . Miller, Tony Lindgren,
	alex.aring, Mugunthan V N

With commit 870915feabdc ("drivers: net: cpsw: remove
disable_irq/enable_irq as irq can be masked from cpsw itself"),
CPSW on AM335x beagle bone white is broken as there is a errata
for AM335x PG1.0. This patch series implements the workaround by
disabling the interrupts from ARM IRQ controller for AM335x SoC
in addition to the masking of interrupts in CPSW.

Mugunthan V N (3):
  drivers: net: cpsw: add am335x errata workarround for interrutps
  ARM: dts: dra7: update cpsw compatible
  ARM: dts: am33xx: update cpsw compatible

 arch/arm/boot/dts/am33xx.dtsi  |  2 +-
 arch/arm/boot/dts/dra7.dtsi    |  2 +-
 drivers/net/ethernet/ti/cpsw.c | 83 +++++++++++++++++++++++++++++++++++++++---
 3 files changed, 79 insertions(+), 8 deletions(-)

-- 
2.5.0.234.gefc8a62

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

* [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps
  2015-08-12  9:52 [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround Mugunthan V N
@ 2015-08-12  9:52 ` Mugunthan V N
  2015-08-24 10:04   ` Sekhar Nori
  2015-08-12  9:52 ` [net-next PATCH 2/3] ARM: dts: dra7: update cpsw compatible Mugunthan V N
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Mugunthan V N @ 2015-08-12  9:52 UTC (permalink / raw)
  To: netdev
  Cc: devicetree, linux-omap, David S . Miller, Tony Lindgren,
	alex.aring, Mugunthan V N

As per Am335x Errata [1] Advisory 1.0.9, The CPSW C0_TX_PEND and
C0_RX_PEND interrupt outputs provide a single transmit interrupt
that combines transmit channel interrupts TXPEND[7:0] and a
single receive interrupt that combines receive channel interrupts
RXPEND[7:0]. The TXPEND[0] and RXPEND[0] interrupt outputs are
connected to the ARM Cortex-A8 interrupt controller (INTC) rather
than the C0_TX_PEND and C0_RX_PEND interrupt outputs. So even
though CPSW interrupt is cleared by writing appropriate values to
EOI register the interrupt is not cleared in IRQ controller. So
interrupt is still pending and CPU is struck in ISR, the
workaround is to disable the interrupts in ARM irq controller.

[1] http://www.ti.com/lit/er/sprz360f/sprz360f.pdf

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/net/ethernet/ti/cpsw.c | 83 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 77 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 3b81b39..8fc90f1 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -387,6 +387,9 @@ struct cpsw_priv {
 	struct cpsw_ale			*ale;
 	bool				rx_pause;
 	bool				tx_pause;
+	bool				quirk_irq;
+	bool				rx_irq_disabled;
+	bool				tx_irq_disabled;
 	/* snapshot of IRQ numbers */
 	u32 irqs_table[4];
 	u32 num_irqs;
@@ -755,6 +758,11 @@ static irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id)
 	writel(0, &priv->wr_regs->tx_en);
 	cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
 
+	if (priv->quirk_irq) {
+		disable_irq_nosync(priv->irqs_table[1]);
+		priv->tx_irq_disabled = true;
+	}
+
 	napi_schedule(&priv->napi_tx);
 	return IRQ_HANDLED;
 }
@@ -766,6 +774,11 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id)
 	cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
 	writel(0, &priv->wr_regs->rx_en);
 
+	if (priv->quirk_irq) {
+		disable_irq_nosync(priv->irqs_table[0]);
+		priv->rx_irq_disabled = true;
+	}
+
 	napi_schedule(&priv->napi_rx);
 	return IRQ_HANDLED;
 }
@@ -779,6 +792,10 @@ static int cpsw_tx_poll(struct napi_struct *napi_tx, int budget)
 	if (num_tx < budget) {
 		napi_complete(napi_tx);
 		writel(0xff, &priv->wr_regs->tx_en);
+		if (priv->quirk_irq && priv->tx_irq_disabled) {
+			priv->tx_irq_disabled = false;
+			enable_irq(priv->irqs_table[1]);
+		}
 	}
 
 	if (num_tx)
@@ -796,6 +813,10 @@ static int cpsw_rx_poll(struct napi_struct *napi_rx, int budget)
 	if (num_rx < budget) {
 		napi_complete(napi_rx);
 		writel(0xff, &priv->wr_regs->rx_en);
+		if (priv->quirk_irq && priv->rx_irq_disabled) {
+			priv->rx_irq_disabled = false;
+			enable_irq(priv->irqs_table[0]);
+		}
 	}
 
 	if (num_rx)
@@ -1267,6 +1288,16 @@ static int cpsw_ndo_open(struct net_device *ndev)
 		napi_enable(&priv_sl0->napi_rx);
 		napi_enable(&priv_sl0->napi_tx);
 
+		if (priv_sl0->tx_irq_disabled) {
+			priv_sl0->tx_irq_disabled = false;
+			enable_irq(priv->irqs_table[1]);
+		}
+
+		if (priv_sl0->rx_irq_disabled) {
+			priv_sl0->rx_irq_disabled = false;
+			enable_irq(priv->irqs_table[0]);
+		}
+
 		if (WARN_ON(!priv->data.rx_descs))
 			priv->data.rx_descs = 128;
 
@@ -2128,6 +2159,44 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev,
 	return ret;
 }
 
+#define CPSW_QUIRK_IRQ		BIT(0)
+
+static struct platform_device_id cpsw_devtype[] = {
+	{
+		/* keep it for existing comaptibles */
+		.name = "cpsw",
+		.driver_data = CPSW_QUIRK_IRQ,
+	}, {
+		.name = "am335x-cpsw",
+		.driver_data = CPSW_QUIRK_IRQ,
+	}, {
+		.name = "am4372-cpsw",
+		.driver_data = 0,
+	}, {
+		.name = "dra7-cpsw",
+		.driver_data = 0,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(platform, cpsw_devtype);
+
+enum ti_cpsw_type {
+	CPSW = 0,
+	AM335X_CPSW,
+	AM4372_CPSW,
+	DRA7_CPSW,
+};
+
+static const struct of_device_id cpsw_of_mtable[] = {
+	{ .compatible = "ti,cpsw", .data = &cpsw_devtype[CPSW], },
+	{ .compatible = "ti,am335x-cpsw", .data = &cpsw_devtype[AM335X_CPSW], },
+	{ .compatible = "ti,am4372-cpsw", .data = &cpsw_devtype[AM4372_CPSW], },
+	{ .compatible = "ti,dra7-cpsw", .data = &cpsw_devtype[DRA7_CPSW], },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, cpsw_of_mtable);
+
 static int cpsw_probe(struct platform_device *pdev)
 {
 	struct cpsw_platform_data	*data;
@@ -2137,6 +2206,7 @@ static int cpsw_probe(struct platform_device *pdev)
 	struct cpsw_ale_params		ale_params;
 	void __iomem			*ss_regs;
 	struct resource			*res, *ss_res;
+	const struct of_device_id	*of_id;
 	u32 slave_offset, sliver_offset, slave_size;
 	int ret = 0, i;
 	int irq;
@@ -2327,6 +2397,13 @@ static int cpsw_probe(struct platform_device *pdev)
 		goto clean_ale_ret;
 	}
 
+	of_id = of_match_device(cpsw_of_mtable, &pdev->dev);
+	if (of_id) {
+		pdev->id_entry = of_id->data;
+		if (pdev->id_entry->driver_data)
+			priv->quirk_irq = true;
+	}
+
 	/* Grab RX and TX IRQs. Note that we also have RX_THRESHOLD and
 	 * MISC IRQs which are always kept disabled with this driver so
 	 * we will not request them.
@@ -2491,12 +2568,6 @@ static int cpsw_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume);
 
-static const struct of_device_id cpsw_of_mtable[] = {
-	{ .compatible = "ti,cpsw", },
-	{ /* sentinel */ },
-};
-MODULE_DEVICE_TABLE(of, cpsw_of_mtable);
-
 static struct platform_driver cpsw_driver = {
 	.driver = {
 		.name	 = "cpsw",
-- 
2.5.0.234.gefc8a62

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

* [net-next PATCH 2/3] ARM: dts: dra7: update cpsw compatible
  2015-08-12  9:52 [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround Mugunthan V N
  2015-08-12  9:52 ` [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps Mugunthan V N
@ 2015-08-12  9:52 ` Mugunthan V N
  2015-08-13  9:55   ` Tony Lindgren
  2015-08-12  9:52 ` [net-next PATCH 3/3] ARM: dts: am33xx: " Mugunthan V N
  2015-08-13 23:51 ` [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround David Miller
  3 siblings, 1 reply; 9+ messages in thread
From: Mugunthan V N @ 2015-08-12  9:52 UTC (permalink / raw)
  To: netdev
  Cc: devicetree, linux-omap, David S . Miller, Tony Lindgren,
	alex.aring, Mugunthan V N

CPSW driver has been updated with compatibles for enabling errata
workarounds. So updating cpsw compatibles.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 8f1e25b..b4fdd10 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1398,7 +1398,7 @@
 		};
 
 		mac: ethernet@4a100000 {
-			compatible = "ti,cpsw";
+			compatible = "ti,dra7-cpsw","ti,cpsw";
 			ti,hwmods = "gmac";
 			clocks = <&dpll_gmac_ck>, <&gmac_gmii_ref_clk_div>;
 			clock-names = "fck", "cpts";
-- 
2.5.0.234.gefc8a62

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

* [net-next PATCH 3/3] ARM: dts: am33xx: update cpsw compatible
  2015-08-12  9:52 [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround Mugunthan V N
  2015-08-12  9:52 ` [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps Mugunthan V N
  2015-08-12  9:52 ` [net-next PATCH 2/3] ARM: dts: dra7: update cpsw compatible Mugunthan V N
@ 2015-08-12  9:52 ` Mugunthan V N
  2015-08-13  9:56   ` Tony Lindgren
  2015-08-13 23:51 ` [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround David Miller
  3 siblings, 1 reply; 9+ messages in thread
From: Mugunthan V N @ 2015-08-12  9:52 UTC (permalink / raw)
  To: netdev
  Cc: devicetree, linux-omap, David S . Miller, Tony Lindgren,
	alex.aring, Mugunthan V N

CPSW driver has been updated with compatibles for enabling errata
workarounds. So updating cpsw compatibles.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/boot/dts/am33xx.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 21fcc44..8b59c86 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -700,7 +700,7 @@
 		};
 
 		mac: ethernet@4a100000 {
-			compatible = "ti,cpsw";
+			compatible = "ti,am335x-cpsw","ti,cpsw";
 			ti,hwmods = "cpgmac0";
 			clocks = <&cpsw_125mhz_gclk>, <&cpsw_cpts_rft_clk>;
 			clock-names = "fck", "cpts";
-- 
2.5.0.234.gefc8a62

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

* Re: [net-next PATCH 2/3] ARM: dts: dra7: update cpsw compatible
  2015-08-12  9:52 ` [net-next PATCH 2/3] ARM: dts: dra7: update cpsw compatible Mugunthan V N
@ 2015-08-13  9:55   ` Tony Lindgren
  0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2015-08-13  9:55 UTC (permalink / raw)
  To: Mugunthan V N
  Cc: netdev, devicetree, linux-omap, David S . Miller, alex.aring

* Mugunthan V N <mugunthanvnm@ti.com> [150812 02:56]:
> CPSW driver has been updated with compatibles for enabling errata
> workarounds. So updating cpsw compatibles.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Please feel free to merge this one via net tree once the changes
are reviewed:

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/boot/dts/dra7.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 8f1e25b..b4fdd10 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1398,7 +1398,7 @@
>  		};
>  
>  		mac: ethernet@4a100000 {
> -			compatible = "ti,cpsw";
> +			compatible = "ti,dra7-cpsw","ti,cpsw";
>  			ti,hwmods = "gmac";
>  			clocks = <&dpll_gmac_ck>, <&gmac_gmii_ref_clk_div>;
>  			clock-names = "fck", "cpts";
> -- 
> 2.5.0.234.gefc8a62
> 

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

* Re: [net-next PATCH 3/3] ARM: dts: am33xx: update cpsw compatible
  2015-08-12  9:52 ` [net-next PATCH 3/3] ARM: dts: am33xx: " Mugunthan V N
@ 2015-08-13  9:56   ` Tony Lindgren
  0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2015-08-13  9:56 UTC (permalink / raw)
  To: Mugunthan V N
  Cc: netdev, devicetree, linux-omap, David S . Miller, alex.aring

* Mugunthan V N <mugunthanvnm@ti.com> [150812 02:56]:
> CPSW driver has been updated with compatibles for enabling errata
> workarounds. So updating cpsw compatibles.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

This too:

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/boot/dts/am33xx.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
> index 21fcc44..8b59c86 100644
> --- a/arch/arm/boot/dts/am33xx.dtsi
> +++ b/arch/arm/boot/dts/am33xx.dtsi
> @@ -700,7 +700,7 @@
>  		};
>  
>  		mac: ethernet@4a100000 {
> -			compatible = "ti,cpsw";
> +			compatible = "ti,am335x-cpsw","ti,cpsw";
>  			ti,hwmods = "cpgmac0";
>  			clocks = <&cpsw_125mhz_gclk>, <&cpsw_cpts_rft_clk>;
>  			clock-names = "fck", "cpts";
> -- 
> 2.5.0.234.gefc8a62
> 

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

* Re: [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround
  2015-08-12  9:52 [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround Mugunthan V N
                   ` (2 preceding siblings ...)
  2015-08-12  9:52 ` [net-next PATCH 3/3] ARM: dts: am33xx: " Mugunthan V N
@ 2015-08-13 23:51 ` David Miller
  3 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2015-08-13 23:51 UTC (permalink / raw)
  To: mugunthanvnm; +Cc: netdev, devicetree, linux-omap, tony, alex.aring

From: Mugunthan V N <mugunthanvnm@ti.com>
Date: Wed, 12 Aug 2015 15:22:52 +0530

> With commit 870915feabdc ("drivers: net: cpsw: remove
> disable_irq/enable_irq as irq can be masked from cpsw itself"),
> CPSW on AM335x beagle bone white is broken as there is a errata
> for AM335x PG1.0. This patch series implements the workaround by
> disabling the interrupts from ARM IRQ controller for AM335x SoC
> in addition to the masking of interrupts in CPSW.

Series applied, thanks.

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

* Re: [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps
  2015-08-12  9:52 ` [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps Mugunthan V N
@ 2015-08-24 10:04   ` Sekhar Nori
  2015-08-25  6:17     ` Mugunthan V N
  0 siblings, 1 reply; 9+ messages in thread
From: Sekhar Nori @ 2015-08-24 10:04 UTC (permalink / raw)
  To: Mugunthan V N, netdev
  Cc: devicetree, linux-omap, David S . Miller, Tony Lindgren,
	alex.aring

Hi Mugunthan,

On Wednesday 12 August 2015 03:22 PM, Mugunthan V N wrote:
> +static const struct of_device_id cpsw_of_mtable[] = {
> +	{ .compatible = "ti,cpsw", .data = &cpsw_devtype[CPSW], },

> +	{ .compatible = "ti,am335x-cpsw", .data = &cpsw_devtype[AM335X_CPSW], },
> +	{ .compatible = "ti,am4372-cpsw", .data = &cpsw_devtype[AM4372_CPSW], },
> +	{ .compatible = "ti,dra7-cpsw", .data = &cpsw_devtype[DRA7_CPSW], },

I do not see documentation added for these compatibles. Since the series
is already applied, can you send additional patches adding documentation?

Thanks,
Sekhar

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

* Re: [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps
  2015-08-24 10:04   ` Sekhar Nori
@ 2015-08-25  6:17     ` Mugunthan V N
  0 siblings, 0 replies; 9+ messages in thread
From: Mugunthan V N @ 2015-08-25  6:17 UTC (permalink / raw)
  To: Sekhar Nori, netdev
  Cc: devicetree, linux-omap, David S . Miller, Tony Lindgren,
	alex.aring

On Monday 24 August 2015 03:34 PM, Sekhar Nori wrote:
> Hi Mugunthan,
> 
> On Wednesday 12 August 2015 03:22 PM, Mugunthan V N wrote:
>> > +static const struct of_device_id cpsw_of_mtable[] = {
>> > +	{ .compatible = "ti,cpsw", .data = &cpsw_devtype[CPSW], },
>> > +	{ .compatible = "ti,am335x-cpsw", .data = &cpsw_devtype[AM335X_CPSW], },
>> > +	{ .compatible = "ti,am4372-cpsw", .data = &cpsw_devtype[AM4372_CPSW], },
>> > +	{ .compatible = "ti,dra7-cpsw", .data = &cpsw_devtype[DRA7_CPSW], },
> I do not see documentation added for these compatibles. Since the series
> is already applied, can you send additional patches adding documentation?

Will submit a patch ASAP

Regards
Mugunthan V N

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

end of thread, other threads:[~2015-08-25  6:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-12  9:52 [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround Mugunthan V N
2015-08-12  9:52 ` [net-next PATCH 1/3] drivers: net: cpsw: add am335x errata workarround for interrutps Mugunthan V N
2015-08-24 10:04   ` Sekhar Nori
2015-08-25  6:17     ` Mugunthan V N
2015-08-12  9:52 ` [net-next PATCH 2/3] ARM: dts: dra7: update cpsw compatible Mugunthan V N
2015-08-13  9:55   ` Tony Lindgren
2015-08-12  9:52 ` [net-next PATCH 3/3] ARM: dts: am33xx: " Mugunthan V N
2015-08-13  9:56   ` Tony Lindgren
2015-08-13 23:51 ` [net-next PATCH 0/3] Add AM335x PG1.0 CPSW errata workaround David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).