* [PATCH 0/4] fix some bugs in stmmac
@ 2019-04-29 6:15 Biao Huang
2019-04-29 6:15 ` [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue Biao Huang
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Biao Huang @ 2019-04-29 6:15 UTC (permalink / raw)
To: Jose Abreu, davem
Cc: jianguo.zhang, Alexandre Torgue, biao.huang, netdev,
linux-kernel, yt.shen, linux-mediatek, Maxime Coquelin,
Matthias Brugger, Giuseppe Cavallaro, linux-stm32,
linux-arm-kernel
This series fix some bugs in stmmac driver.
3 patches are for common stmmac or dwmac4:
1. update rx tail pointer to fix rx dma hang issue.
2. change condition for mdc clock to fix csr_clk can't be zero issue.
3. write the modified value back to MTL_OPERATION_MODE.
1 patche is for dwmac-mediatek:
1. modify csr_clk value to fix mdio read/write fail issue for dwmac-mediatek.
Biao Huang (4):
net: stmmac: update rx tail pointer register to fix rx dma hang
issue.
net: stmmac: fix csr_clk can't be zero issue
net: stmmac: write the modified value back to MTL_OPERATION_MODE
net: stmmac: dwmac-mediatek: modify csr_clk value to fix mdio
read/write fail
.../net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 4 ++--
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 ++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++-
3 files changed, 8 insertions(+), 3 deletions(-)
--
1.7.9.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue.
2019-04-29 6:15 [PATCH 0/4] fix some bugs in stmmac Biao Huang
@ 2019-04-29 6:15 ` Biao Huang
2019-04-29 8:51 ` Jose Abreu
2019-04-29 6:15 ` [PATCH 2/4] net: stmmac: fix csr_clk can't be zero issue Biao Huang
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Biao Huang @ 2019-04-29 6:15 UTC (permalink / raw)
To: Jose Abreu, davem
Cc: jianguo.zhang, Alexandre Torgue, biao.huang, netdev,
linux-kernel, yt.shen, linux-mediatek, Maxime Coquelin,
Matthias Brugger, Giuseppe Cavallaro, linux-stm32,
linux-arm-kernel
Currently we will not update the receive descriptor tail pointer in
stmmac_rx_refill. Rx dma will think no available descriptors and stop
once received packets exceed DMA_RX_SIZE, so that the rx only test will fail.
Update the receive tail pointer in stmmac_rx_refill to add more descriptors
to the rx channel, so packets can be received continually
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 97c5e1a..818ad88 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3336,6 +3336,9 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
}
rx_q->dirty_rx = entry;
+ stmmac_set_rx_tail_ptr(priv, priv->ioaddr,
+ rx_q->dma_rx_phy + (entry * sizeof(struct dma_desc)),
+ queue);
}
/**
--
1.7.9.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] net: stmmac: fix csr_clk can't be zero issue
2019-04-29 6:15 [PATCH 0/4] fix some bugs in stmmac Biao Huang
2019-04-29 6:15 ` [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue Biao Huang
@ 2019-04-29 6:15 ` Biao Huang
2019-04-29 6:15 ` [PATCH 3/4] net: stmmac: write the modified value back to MTL_OPERATION_MODE Biao Huang
2019-04-29 6:15 ` [PATCH 4/4] net: stmmac: dwmac-mediatek: modify csr_clk value to fix mdio read/write fail Biao Huang
3 siblings, 0 replies; 7+ messages in thread
From: Biao Huang @ 2019-04-29 6:15 UTC (permalink / raw)
To: Jose Abreu, davem
Cc: jianguo.zhang, Alexandre Torgue, biao.huang, netdev,
linux-kernel, yt.shen, linux-mediatek, Maxime Coquelin,
Matthias Brugger, Giuseppe Cavallaro, linux-stm32,
linux-arm-kernel
The specific clk_csr value can be zero, and
stmmac_clk is necessary for MDC clock which can be set dynamically.
So, change the condition from plat->clk_csr to plat->stmmac_clk to
fix clk_csr can't be zero issue.
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 818ad88..9e89b94 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4376,7 +4376,7 @@ int stmmac_dvr_probe(struct device *device,
* set the MDC clock dynamically according to the csr actual
* clock input.
*/
- if (!priv->plat->clk_csr)
+ if (priv->plat->stmmac_clk)
stmmac_clk_csr_set(priv);
else
priv->clk_csr = priv->plat->clk_csr;
--
1.7.9.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] net: stmmac: write the modified value back to MTL_OPERATION_MODE
2019-04-29 6:15 [PATCH 0/4] fix some bugs in stmmac Biao Huang
2019-04-29 6:15 ` [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue Biao Huang
2019-04-29 6:15 ` [PATCH 2/4] net: stmmac: fix csr_clk can't be zero issue Biao Huang
@ 2019-04-29 6:15 ` Biao Huang
2019-04-29 6:15 ` [PATCH 4/4] net: stmmac: dwmac-mediatek: modify csr_clk value to fix mdio read/write fail Biao Huang
3 siblings, 0 replies; 7+ messages in thread
From: Biao Huang @ 2019-04-29 6:15 UTC (permalink / raw)
To: Jose Abreu, davem
Cc: jianguo.zhang, Alexandre Torgue, biao.huang, netdev,
linux-kernel, yt.shen, linux-mediatek, Maxime Coquelin,
Matthias Brugger, Giuseppe Cavallaro, linux-stm32,
linux-arm-kernel
The value of MTL_OPERATION_MODE is modified, and should
be write back to the register.
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 7e5d5db..b4bb562 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -192,6 +192,8 @@ static void dwmac4_prog_mtl_tx_algorithms(struct mac_device_info *hw,
default:
break;
}
+
+ writel(value, ioaddr + MTL_OPERATION_MODE);
}
static void dwmac4_set_mtl_tx_queue_weight(struct mac_device_info *hw,
--
1.7.9.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] net: stmmac: dwmac-mediatek: modify csr_clk value to fix mdio read/write fail
2019-04-29 6:15 [PATCH 0/4] fix some bugs in stmmac Biao Huang
` (2 preceding siblings ...)
2019-04-29 6:15 ` [PATCH 3/4] net: stmmac: write the modified value back to MTL_OPERATION_MODE Biao Huang
@ 2019-04-29 6:15 ` Biao Huang
3 siblings, 0 replies; 7+ messages in thread
From: Biao Huang @ 2019-04-29 6:15 UTC (permalink / raw)
To: Jose Abreu, davem
Cc: jianguo.zhang, Alexandre Torgue, biao.huang, netdev,
linux-kernel, yt.shen, linux-mediatek, Maxime Coquelin,
Matthias Brugger, Giuseppe Cavallaro, linux-stm32,
linux-arm-kernel
The frequency of csr clock is 66.5MHz, so the csr_clk value should
be 0. Modify the csr_clk value to fix mdio read/write fail issue.
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
---
.../net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
index bf25629..6b12d0f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
@@ -346,8 +346,8 @@ static int mediatek_dwmac_probe(struct platform_device *pdev)
return PTR_ERR(plat_dat);
plat_dat->interface = priv_plat->phy_mode;
- /* clk_csr_i = 250-300MHz & MDC = clk_csr_i/124 */
- plat_dat->clk_csr = 5;
+ /* clk_csr_i = 60-100MHz & MDC = clk_csr_i/42 */
+ plat_dat->clk_csr = 0;
plat_dat->has_gmac4 = 1;
plat_dat->has_gmac = 0;
plat_dat->pmt = 0;
--
1.7.9.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue.
2019-04-29 6:15 ` [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue Biao Huang
@ 2019-04-29 8:51 ` Jose Abreu
2019-04-30 8:56 ` biao huang
0 siblings, 1 reply; 7+ messages in thread
From: Jose Abreu @ 2019-04-29 8:51 UTC (permalink / raw)
To: Biao Huang, davem
Cc: jianguo.zhang, Alexandre Torgue, netdev, linux-kernel, yt.shen,
linux-mediatek, Maxime Coquelin, Matthias Brugger,
Giuseppe Cavallaro, linux-stm32, linux-arm-kernel
From: Biao Huang <biao.huang@mediatek.com>
Date: Mon, Apr 29, 2019 at 07:15:53
> Currently we will not update the receive descriptor tail pointer in
> stmmac_rx_refill. Rx dma will think no available descriptors and stop
> once received packets exceed DMA_RX_SIZE, so that the rx only test will fail.
>
> Update the receive tail pointer in stmmac_rx_refill to add more descriptors
> to the rx channel, so packets can be received continually
>
> Signed-off-by: Biao Huang <biao.huang@mediatek.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 97c5e1a..818ad88 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3336,6 +3336,9 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
> entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
> }
> rx_q->dirty_rx = entry;
> + stmmac_set_rx_tail_ptr(priv, priv->ioaddr,
> + rx_q->dma_rx_phy + (entry * sizeof(struct dma_desc)),
I think you can just use the "rx_q->rx_tail_addr" here. It'll always
trigger a poll demand for the channel.
Thanks,
Jose Miguel Abreu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue.
2019-04-29 8:51 ` Jose Abreu
@ 2019-04-30 8:56 ` biao huang
0 siblings, 0 replies; 7+ messages in thread
From: biao huang @ 2019-04-30 8:56 UTC (permalink / raw)
To: Jose Abreu
Cc: jianguo.zhang, Alexandre Torgue, netdev, linux-kernel,
linux-stm32, yt.shen, linux-mediatek, Maxime Coquelin,
Matthias Brugger, Giuseppe Cavallaro, davem, linux-arm-kernel
On Mon, 2019-04-29 at 08:51 +0000, Jose Abreu wrote:
> From: Biao Huang <biao.huang@mediatek.com>
> Date: Mon, Apr 29, 2019 at 07:15:53
>
> > Currently we will not update the receive descriptor tail pointer in
> > stmmac_rx_refill. Rx dma will think no available descriptors and stop
> > once received packets exceed DMA_RX_SIZE, so that the rx only test will fail.
> >
> > Update the receive tail pointer in stmmac_rx_refill to add more descriptors
> > to the rx channel, so packets can be received continually
> >
> > Signed-off-by: Biao Huang <biao.huang@mediatek.com>
> > ---
> > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 97c5e1a..818ad88 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -3336,6 +3336,9 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
> > entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
> > }
> > rx_q->dirty_rx = entry;
> > + stmmac_set_rx_tail_ptr(priv, priv->ioaddr,
> > + rx_q->dma_rx_phy + (entry * sizeof(struct dma_desc)),
>
> I think you can just use the "rx_q->rx_tail_addr" here. It'll always
> trigger a poll demand for the channel.
Yes, will use rx_q->rx_tail_addr here.
>
> Thanks,
> Jose Miguel Abreu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-04-30 8:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 6:15 [PATCH 0/4] fix some bugs in stmmac Biao Huang
2019-04-29 6:15 ` [PATCH 1/4] net: stmmac: update rx tail pointer register to fix rx dma hang issue Biao Huang
2019-04-29 8:51 ` Jose Abreu
2019-04-30 8:56 ` biao huang
2019-04-29 6:15 ` [PATCH 2/4] net: stmmac: fix csr_clk can't be zero issue Biao Huang
2019-04-29 6:15 ` [PATCH 3/4] net: stmmac: write the modified value back to MTL_OPERATION_MODE Biao Huang
2019-04-29 6:15 ` [PATCH 4/4] net: stmmac: dwmac-mediatek: modify csr_clk value to fix mdio read/write fail Biao Huang
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).