Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1576344 > unrolled thread
| Started by | Corentin Labbe <clabbe.montjoie@gmail.com> |
|---|---|
| First post | 2017-02-08 09:40 +0100 |
| Last post | 2017-02-08 14:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 08/16] net: stmmac: Use readl_poll_timeout Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-02-08 09:40 +0100
Re: [PATCH v2 08/16] net: stmmac: Use readl_poll_timeout Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-02-08 14:20 +0100
| From | Corentin Labbe <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2017-02-08 09:40 +0100 |
| Subject | [PATCH v2 08/16] net: stmmac: Use readl_poll_timeout |
| Message-ID | <t8vXc-6oU-23@gated-at.bofh.it> |
The dwmac_dma_reset function use an open coded of readl_poll_timeout().
Replace the open coded handling with the proper function.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
index e4cda39..e60bfca 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
@@ -17,6 +17,7 @@
*******************************************************************************/
#include <linux/io.h>
+#include <linux/iopoll.h>
#include "common.h"
#include "dwmac_dma.h"
@@ -25,19 +26,16 @@
int dwmac_dma_reset(void __iomem *ioaddr)
{
u32 value = readl(ioaddr + DMA_BUS_MODE);
- int limit;
+ int err;
/* DMA SW reset */
value |= DMA_BUS_MODE_SFT_RESET;
writel(value, ioaddr + DMA_BUS_MODE);
- limit = 10;
- while (limit--) {
- if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
- break;
- mdelay(10);
- }
- if (limit < 0)
+ err = readl_poll_timeout(ioaddr + DMA_BUS_MODE, value,
+ !(value & DMA_BUS_MODE_SFT_RESET),
+ 100000, 10000);
+ if (err)
return -EBUSY;
return 0;
--
2.10.2
[toc] | [next] | [standalone]
| From | Giuseppe CAVALLARO <peppe.cavallaro@st.com> |
|---|---|
| Date | 2017-02-08 14:20 +0100 |
| Message-ID | <t8Akb-O0-41@gated-at.bofh.it> |
| In reply to | #1576344 |
On 2/8/2017 9:31 AM, Corentin Labbe wrote:
> The dwmac_dma_reset function use an open coded of readl_poll_timeout().
> Replace the open coded handling with the proper function.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> index e4cda39..e60bfca 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
> @@ -17,6 +17,7 @@
> *******************************************************************************/
>
> #include <linux/io.h>
> +#include <linux/iopoll.h>
> #include "common.h"
> #include "dwmac_dma.h"
>
> @@ -25,19 +26,16 @@
> int dwmac_dma_reset(void __iomem *ioaddr)
> {
> u32 value = readl(ioaddr + DMA_BUS_MODE);
> - int limit;
> + int err;
>
> /* DMA SW reset */
> value |= DMA_BUS_MODE_SFT_RESET;
> writel(value, ioaddr + DMA_BUS_MODE);
> - limit = 10;
> - while (limit--) {
> - if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
> - break;
> - mdelay(10);
> - }
>
> - if (limit < 0)
> + err = readl_poll_timeout(ioaddr + DMA_BUS_MODE, value,
> + !(value & DMA_BUS_MODE_SFT_RESET),
> + 100000, 10000);
> + if (err)
> return -EBUSY;
>
> return 0;
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web