* [PATCH net-next] net: phy: mdio-mux-bcm-iproc: use readl_poll_timeout() to simplify code
@ 2020-03-24 11:26 ` Dejin Zheng
0 siblings, 0 replies; 6+ messages in thread
From: Dejin Zheng @ 2020-03-24 11:26 UTC (permalink / raw)
To: andrew, f.fainelli, hkallweit1, linux, davem, rjui, sbranden,
bcm-kernel-feedback-list, netdev
Cc: linux-arm-kernel, linux-kernel, Dejin Zheng
use readl_poll_timeout() to replace the poll codes for simplify
iproc_mdio_wait_for_idle() function
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
drivers/net/phy/mdio-mux-bcm-iproc.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
index aad6809ebe39..42fb5f166136 100644
--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
+++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
@@ -10,6 +10,7 @@
#include <linux/phy.h>
#include <linux/mdio-mux.h>
#include <linux/delay.h>
+#include <linux/iopoll.h>
#define MDIO_RATE_ADJ_EXT_OFFSET 0x000
#define MDIO_RATE_ADJ_INT_OFFSET 0x004
@@ -78,18 +79,11 @@ static void mdio_mux_iproc_config(struct iproc_mdiomux_desc *md)
static int iproc_mdio_wait_for_idle(void __iomem *base, bool result)
{
- unsigned int timeout = 1000; /* loop for 1s */
u32 val;
- do {
- val = readl(base + MDIO_STAT_OFFSET);
- if ((val & MDIO_STAT_DONE) == result)
- return 0;
-
- usleep_range(1000, 2000);
- } while (timeout--);
-
- return -ETIMEDOUT;
+ return readl_poll_timeout(base + MDIO_STAT_OFFSET, val,
+ (val & MDIO_STAT_DONE) == result,
+ 2000, 1000000);
}
/* start_miim_ops- Program and start MDIO transaction over mdio bus.
--
2.25.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next] net: phy: mdio-mux-bcm-iproc: use readl_poll_timeout() to simplify code
@ 2020-03-24 11:26 ` Dejin Zheng
0 siblings, 0 replies; 6+ messages in thread
From: Dejin Zheng @ 2020-03-24 11:26 UTC (permalink / raw)
To: andrew, f.fainelli, hkallweit1, linux, davem, rjui, sbranden,
bcm-kernel-feedback-list, netdev
Cc: Dejin Zheng, linux-kernel, linux-arm-kernel
use readl_poll_timeout() to replace the poll codes for simplify
iproc_mdio_wait_for_idle() function
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
drivers/net/phy/mdio-mux-bcm-iproc.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
index aad6809ebe39..42fb5f166136 100644
--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
+++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
@@ -10,6 +10,7 @@
#include <linux/phy.h>
#include <linux/mdio-mux.h>
#include <linux/delay.h>
+#include <linux/iopoll.h>
#define MDIO_RATE_ADJ_EXT_OFFSET 0x000
#define MDIO_RATE_ADJ_INT_OFFSET 0x004
@@ -78,18 +79,11 @@ static void mdio_mux_iproc_config(struct iproc_mdiomux_desc *md)
static int iproc_mdio_wait_for_idle(void __iomem *base, bool result)
{
- unsigned int timeout = 1000; /* loop for 1s */
u32 val;
- do {
- val = readl(base + MDIO_STAT_OFFSET);
- if ((val & MDIO_STAT_DONE) == result)
- return 0;
-
- usleep_range(1000, 2000);
- } while (timeout--);
-
- return -ETIMEDOUT;
+ return readl_poll_timeout(base + MDIO_STAT_OFFSET, val,
+ (val & MDIO_STAT_DONE) == result,
+ 2000, 1000000);
}
/* start_miim_ops- Program and start MDIO transaction over mdio bus.
--
2.25.0
_______________________________________________
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] 6+ messages in thread
* Re: [PATCH net-next] net: phy: mdio-mux-bcm-iproc: use readl_poll_timeout() to simplify code
2020-03-24 11:26 ` Dejin Zheng
@ 2020-03-24 12:47 ` Andrew Lunn
-1 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2020-03-24 12:47 UTC (permalink / raw)
To: Dejin Zheng
Cc: f.fainelli, hkallweit1, linux, davem, rjui, sbranden,
bcm-kernel-feedback-list, netdev, linux-arm-kernel, linux-kernel
On Tue, Mar 24, 2020 at 07:26:47PM +0800, Dejin Zheng wrote:
> use readl_poll_timeout() to replace the poll codes for simplify
> iproc_mdio_wait_for_idle() function
>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: phy: mdio-mux-bcm-iproc: use readl_poll_timeout() to simplify code
@ 2020-03-24 12:47 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2020-03-24 12:47 UTC (permalink / raw)
To: Dejin Zheng
Cc: f.fainelli, sbranden, rjui, linux, linux-kernel,
bcm-kernel-feedback-list, netdev, davem, linux-arm-kernel,
hkallweit1
On Tue, Mar 24, 2020 at 07:26:47PM +0800, Dejin Zheng wrote:
> use readl_poll_timeout() to replace the poll codes for simplify
> iproc_mdio_wait_for_idle() function
>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
_______________________________________________
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] 6+ messages in thread
* Re: [PATCH net-next] net: phy: mdio-mux-bcm-iproc: use readl_poll_timeout() to simplify code
2020-03-24 11:26 ` Dejin Zheng
@ 2020-03-24 23:21 ` David Miller
-1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-03-24 23:21 UTC (permalink / raw)
To: zhengdejin5
Cc: andrew, f.fainelli, hkallweit1, linux, rjui, sbranden,
bcm-kernel-feedback-list, netdev, linux-arm-kernel, linux-kernel
From: Dejin Zheng <zhengdejin5@gmail.com>
Date: Tue, 24 Mar 2020 19:26:47 +0800
> use readl_poll_timeout() to replace the poll codes for simplify
> iproc_mdio_wait_for_idle() function
>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: phy: mdio-mux-bcm-iproc: use readl_poll_timeout() to simplify code
@ 2020-03-24 23:21 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-03-24 23:21 UTC (permalink / raw)
To: zhengdejin5
Cc: andrew, f.fainelli, sbranden, rjui, linux, linux-kernel,
bcm-kernel-feedback-list, netdev, linux-arm-kernel, hkallweit1
From: Dejin Zheng <zhengdejin5@gmail.com>
Date: Tue, 24 Mar 2020 19:26:47 +0800
> use readl_poll_timeout() to replace the poll codes for simplify
> iproc_mdio_wait_for_idle() function
>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Applied, thanks.
_______________________________________________
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] 6+ messages in thread
end of thread, other threads:[~2020-03-24 23:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 11:26 [PATCH net-next] net: phy: mdio-mux-bcm-iproc: use readl_poll_timeout() to simplify code Dejin Zheng
2020-03-24 11:26 ` Dejin Zheng
2020-03-24 12:47 ` Andrew Lunn
2020-03-24 12:47 ` Andrew Lunn
2020-03-24 23:21 ` David Miller
2020-03-24 23:21 ` David Miller
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.