Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570511 > unrolled thread

[PATCH 00/17] net: stmmac: misc fix

Started byCorentin Labbe <clabbe.montjoie@gmail.com>
First post2017-01-31 10:30 +0100
Last post2017-01-31 11:50 +0100
Articles 20 on this page of 24 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/17] net: stmmac: misc fix Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:30 +0100
    [PATCH 08/17] net: stmmac: Use readl_poll_timeout Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:30 +0100
    [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:30 +0100
      Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by  readl_poll_timeout Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 11:40 +0100
        Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by  readl_poll_timeout Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:50 +0100
      Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by  readl_poll_timeout Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:50 +0100
    [PATCH 10/17] net: stmmac: Correct the error message about invalid speed Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:30 +0100
      Re: [PATCH 10/17] net: stmmac: Correct the error message about  invalid speed Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:10 +0100
    [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:30 +0100
      Re: [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:10 +0100
    [PATCH 11/17] net: stmmac: Rewrite two test against NULL value Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:30 +0100
      Re: [PATCH 11/17] net: stmmac: Rewrite two test against NULL value Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:10 +0100
    [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:30 +0100
    [PATCH 14/17] net: stmmac: print phy information Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:50 +0100
      Re: [PATCH 14/17] net: stmmac: print phy information Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:20 +0100
        Re: [PATCH 14/17] net: stmmac: print phy information Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-02-03 14:20 +0100
    [PATCH 06/17] net: stmmac: fix some code style problem Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:50 +0100
      Re: [PATCH 06/17] net: stmmac: fix some code style problem Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:10 +0100
    [PATCH 05/17] net: stmmac: remplace asm/io.h by linux/io.h Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:50 +0100
    [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-01-31 10:50 +0100
    Re: [PATCH 00/17] net: stmmac: misc fix Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:10 +0100
      Re: [PATCH 00/17] net: stmmac: misc fix Joao Pinto <Joao.Pinto@synopsys.com> - 2017-01-31 11:40 +0100
        Re: [PATCH 00/17] net: stmmac: misc fix Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-01-31 11:40 +0100
          Re: [PATCH 00/17] net: stmmac: misc fix Joao Pinto <Joao.Pinto@synopsys.com> - 2017-01-31 11:50 +0100

Page 1 of 2  [1] 2  Next page →


#1570511 — [PATCH 00/17] net: stmmac: misc fix

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:30 +0100
Subject[PATCH 00/17] net: stmmac: misc fix
Message-ID<t5CLw-7mj-19@gated-at.bofh.it>
Hello

I am currently working on dwmac-sun8i glue driver for Allwinner H3/A83T/A64.
This serie is the result of all minor problem found in the stmmac driver.

Regards

Corentin Labbe (17):
  net: stmmac: fix the typo on MAC_RNABLE_RX
  net: stmmac: Remove the bus_setup function pointer
  net: stmmac: fix some typos in comments
  net: stmmac: remove freesoftware address
  net: stmmac: remplace asm/io.h by linux/io.h
  net: stmmac: fix some code style problem
  net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
  net: stmmac: Use readl_poll_timeout
  net: stmmac: replace ENOSYS by EINVAL
  net: stmmac: Correct the error message about invalid speed
  net: stmmac: Rewrite two test against NULL value
  net: stmmac: rename rx_crc to rx_crc_errors
  net: stmmac: Implement NAPI for TX
  net: stmmac: print phy information
  net: stmmac: remove dead code in stmmac_tx_clean
  net: stmmac: remove unused variable in sysfs_display_ring
  net: stmmac: replace unsigned by u32

 drivers/net/ethernet/stmicro/stmmac/chain_mode.c   |  4 --
 drivers/net/ethernet/stmicro/stmmac/common.h       |  8 +--
 drivers/net/ethernet/stmicro/stmmac/descs.h        |  4 --
 drivers/net/ethernet/stmicro/stmmac/descs_com.h    |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    |  4 --
 .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  4 --
 .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  4 --
 .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |  4 --
 drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c    | 28 ++++------
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c     |  6 +--
 drivers/net/ethernet/stmicro/stmmac/mmc.h          |  4 --
 drivers/net/ethernet/stmicro/stmmac/mmc_core.c     |  4 --
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c    |  6 +--
 drivers/net/ethernet/stmicro/stmmac/ring_mode.c    |  4 --
 drivers/net/ethernet/stmicro/stmmac/stmmac.h       |  4 --
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  6 +--
 .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |  4 --
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 63 ++++++++++------------
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  | 52 +++++++-----------
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c   |  4 --
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  6 +--
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c   |  4 --
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |  4 --
 include/linux/stmmac.h                             |  1 -
 28 files changed, 65 insertions(+), 185 deletions(-)

-- 
2.10.2

[toc] | [next] | [standalone]


#1570512 — [PATCH 08/17] net: stmmac: Use readl_poll_timeout

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:30 +0100
Subject[PATCH 08/17] net: stmmac: Use readl_poll_timeout
Message-ID<t5CVc-7pw-17@gated-at.bofh.it>
In reply to#1570511
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] | [prev] | [next] | [standalone]


#1570513 — [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:30 +0100
Subject[PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
Message-ID<t5CVc-7pw-25@gated-at.bofh.it>
In reply to#1570511
The stmmac_mdio_busy_wait() function do the same job than
readl_poll_timeout().
So is is better to replace it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index c24bef2..d9893cf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -21,6 +21,7 @@
 *******************************************************************************/
 
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <linux/mii.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
@@ -38,22 +39,6 @@
 #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
 #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
 
-static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
-{
-	unsigned long curr;
-	unsigned long finish = jiffies + 3 * HZ;
-
-	do {
-		curr = jiffies;
-		if (readl(ioaddr + mii_addr) & MII_BUSY)
-			cpu_relax();
-		else
-			return 0;
-	} while (!time_after_eq(curr, finish));
-
-	return -EBUSY;
-}
-
 /**
  * stmmac_mdio_read
  * @bus: points to the mii_bus structure
@@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	unsigned int mii_address = priv->hw->mii.addr;
 	unsigned int mii_data = priv->hw->mii.data;
-
+	u32 v;
 	int data;
 	u32 value = MII_BUSY;
 
@@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
 	if (priv->plat->has_gmac4)
 		value |= MII_GMAC4_READ;
 
-	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
+	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+			       100, 10000))
 		return -EBUSY;
 
 	writel(value, priv->ioaddr + mii_address);
 
-	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
+	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+			       100, 10000))
 		return -EBUSY;
 
 	/* Read the data from the MII data register */
@@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	unsigned int mii_address = priv->hw->mii.addr;
 	unsigned int mii_data = priv->hw->mii.data;
-
+	u32 v;
 	u32 value = MII_BUSY;
 
 	value |= (phyaddr << priv->hw->mii.addr_shift)
@@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
 		value |= MII_WRITE;
 
 	/* Wait until any existing MII operation is complete */
-	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
+	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+			       100, 10000))
 		return -EBUSY;
 
 	/* Set the MII address register to write */
@@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
 	writel(value, priv->ioaddr + mii_address);
 
 	/* Wait until any existing MII operation is complete */
-	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
+	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
+				  100, 10000);
 }
 
 /**
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570581 — Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 11:40 +0100
SubjectRe: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
Message-ID<t5E0W-81e-31@gated-at.bofh.it>
In reply to#1570513
On Tue, Jan 31, 2017 at 11:13:49AM +0100, Giuseppe CAVALLARO wrote:
> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> > The stmmac_mdio_busy_wait() function do the same job than
> > readl_poll_timeout().
> > So is is better to replace it.
> >
> > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> 
> I just wonder if you also tested it, this impacts all the platforms
> where SMA block is used

I have tested all patch in this series on my cubieboard2 (dwmac-sunxi) and my opipc/pine64/bpim2+ (dwmac-sun8i)
(Yes I could have said that in cover letter).
So this code was tested on two different stmmac glue driver.

> 
> if yes, pls consider my:
> 
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> 
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
> >  1 file changed, 11 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> > index c24bef2..d9893cf 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> > @@ -21,6 +21,7 @@
> >  *******************************************************************************/
> >
> >  #include <linux/io.h>
> > +#include <linux/iopoll.h>
> >  #include <linux/mii.h>
> >  #include <linux/of.h>
> >  #include <linux/of_gpio.h>
> > @@ -38,22 +39,6 @@
> >  #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
> >  #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
> >
> > -static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
> > -{
> > -	unsigned long curr;
> > -	unsigned long finish = jiffies + 3 * HZ;
> > -
> > -	do {
> > -		curr = jiffies;
> > -		if (readl(ioaddr + mii_addr) & MII_BUSY)
> > -			cpu_relax();
> > -		else
> > -			return 0;
> > -	} while (!time_after_eq(curr, finish));
> > -
> > -	return -EBUSY;
> > -}
> > -
> >  /**
> >   * stmmac_mdio_read
> >   * @bus: points to the mii_bus structure
> > @@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
> >  	struct stmmac_priv *priv = netdev_priv(ndev);
> >  	unsigned int mii_address = priv->hw->mii.addr;
> >  	unsigned int mii_data = priv->hw->mii.data;
> > -
> > +	u32 v;
> >  	int data;
> >  	u32 value = MII_BUSY;
> >
> > @@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
> >  	if (priv->plat->has_gmac4)
> >  		value |= MII_GMAC4_READ;
> >
> > -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> > +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +			       100, 10000))
> >  		return -EBUSY;
> >
> >  	writel(value, priv->ioaddr + mii_address);
> >
> > -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> > +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +			       100, 10000))
> >  		return -EBUSY;
> >
> >  	/* Read the data from the MII data register */
> > @@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
> >  	struct stmmac_priv *priv = netdev_priv(ndev);
> >  	unsigned int mii_address = priv->hw->mii.addr;
> >  	unsigned int mii_data = priv->hw->mii.data;
> > -
> > +	u32 v;
> >  	u32 value = MII_BUSY;
> >
> >  	value |= (phyaddr << priv->hw->mii.addr_shift)
> > @@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
> >  		value |= MII_WRITE;
> >
> >  	/* Wait until any existing MII operation is complete */
> > -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> > +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +			       100, 10000))
> >  		return -EBUSY;
> >
> >  	/* Set the MII address register to write */
> > @@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
> >  	writel(value, priv->ioaddr + mii_address);
> >
> >  	/* Wait until any existing MII operation is complete */
> > -	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
> > +	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> > +				  100, 10000);
> >  }
> >
> >  /**
> >
> 

[toc] | [prev] | [next] | [standalone]


#1570601 — Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout

FromGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Date2017-01-31 11:50 +0100
SubjectRe: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
Message-ID<t5EaD-84y-43@gated-at.bofh.it>
In reply to#1570581
On 1/31/2017 11:39 AM, Corentin Labbe wrote:
> On Tue, Jan 31, 2017 at 11:13:49AM +0100, Giuseppe CAVALLARO wrote:
>> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
>>> The stmmac_mdio_busy_wait() function do the same job than
>>> readl_poll_timeout().
>>> So is is better to replace it.
>>>
>>> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
>>
>> I just wonder if you also tested it, this impacts all the platforms
>> where SMA block is used
>
> I have tested all patch in this series on my cubieboard2 (dwmac-sunxi) and my opipc/pine64/bpim2+ (dwmac-sun8i)
> (Yes I could have said that in cover letter).
> So this code was tested on two different stmmac glue driver.

perfect :-) thx for the clarification and consider my Acked-by.

peppe

>>
>> if yes, pls consider my:
>>
>> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>>
>>> ---
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
>>>  1 file changed, 11 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> index c24bef2..d9893cf 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
>>> @@ -21,6 +21,7 @@
>>>  *******************************************************************************/
>>>
>>>  #include <linux/io.h>
>>> +#include <linux/iopoll.h>
>>>  #include <linux/mii.h>
>>>  #include <linux/of.h>
>>>  #include <linux/of_gpio.h>
>>> @@ -38,22 +39,6 @@
>>>  #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
>>>  #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
>>>
>>> -static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
>>> -{
>>> -	unsigned long curr;
>>> -	unsigned long finish = jiffies + 3 * HZ;
>>> -
>>> -	do {
>>> -		curr = jiffies;
>>> -		if (readl(ioaddr + mii_addr) & MII_BUSY)
>>> -			cpu_relax();
>>> -		else
>>> -			return 0;
>>> -	} while (!time_after_eq(curr, finish));
>>> -
>>> -	return -EBUSY;
>>> -}
>>> -
>>>  /**
>>>   * stmmac_mdio_read
>>>   * @bus: points to the mii_bus structure
>>> @@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>>>  	struct stmmac_priv *priv = netdev_priv(ndev);
>>>  	unsigned int mii_address = priv->hw->mii.addr;
>>>  	unsigned int mii_data = priv->hw->mii.data;
>>> -
>>> +	u32 v;
>>>  	int data;
>>>  	u32 value = MII_BUSY;
>>>
>>> @@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>>>  	if (priv->plat->has_gmac4)
>>>  		value |= MII_GMAC4_READ;
>>>
>>> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
>>> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +			       100, 10000))
>>>  		return -EBUSY;
>>>
>>>  	writel(value, priv->ioaddr + mii_address);
>>>
>>> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
>>> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +			       100, 10000))
>>>  		return -EBUSY;
>>>
>>>  	/* Read the data from the MII data register */
>>> @@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>>>  	struct stmmac_priv *priv = netdev_priv(ndev);
>>>  	unsigned int mii_address = priv->hw->mii.addr;
>>>  	unsigned int mii_data = priv->hw->mii.data;
>>> -
>>> +	u32 v;
>>>  	u32 value = MII_BUSY;
>>>
>>>  	value |= (phyaddr << priv->hw->mii.addr_shift)
>>> @@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>>>  		value |= MII_WRITE;
>>>
>>>  	/* Wait until any existing MII operation is complete */
>>> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
>>> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +			       100, 10000))
>>>  		return -EBUSY;
>>>
>>>  	/* Set the MII address register to write */
>>> @@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>>>  	writel(value, priv->ioaddr + mii_address);
>>>
>>>  	/* Wait until any existing MII operation is complete */
>>> -	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
>>> +	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
>>> +				  100, 10000);
>>>  }
>>>
>>>  /**
>>>
>>
>

[toc] | [prev] | [next] | [standalone]


#1570589 — Re: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout

FromGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Date2017-01-31 11:50 +0100
SubjectRe: [PATCH 07/17] net: stmmac: replace stmmac_mdio_busy_wait by readl_poll_timeout
Message-ID<t5E0W-81e-33@gated-at.bofh.it>
In reply to#1570513
On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> The stmmac_mdio_busy_wait() function do the same job than
> readl_poll_timeout().
> So is is better to replace it.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

I just wonder if you also tested it, this impacts all the platforms
where SMA block is used

if yes, pls consider my:

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 33 ++++++++---------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index c24bef2..d9893cf 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -21,6 +21,7 @@
>  *******************************************************************************/
>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>  #include <linux/mii.h>
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
> @@ -38,22 +39,6 @@
>  #define MII_GMAC4_WRITE			(1 << MII_GMAC4_GOC_SHIFT)
>  #define MII_GMAC4_READ			(3 << MII_GMAC4_GOC_SHIFT)
>
> -static int stmmac_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_addr)
> -{
> -	unsigned long curr;
> -	unsigned long finish = jiffies + 3 * HZ;
> -
> -	do {
> -		curr = jiffies;
> -		if (readl(ioaddr + mii_addr) & MII_BUSY)
> -			cpu_relax();
> -		else
> -			return 0;
> -	} while (!time_after_eq(curr, finish));
> -
> -	return -EBUSY;
> -}
> -
>  /**
>   * stmmac_mdio_read
>   * @bus: points to the mii_bus structure
> @@ -70,7 +55,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>  	struct stmmac_priv *priv = netdev_priv(ndev);
>  	unsigned int mii_address = priv->hw->mii.addr;
>  	unsigned int mii_data = priv->hw->mii.data;
> -
> +	u32 v;
>  	int data;
>  	u32 value = MII_BUSY;
>
> @@ -82,12 +67,14 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
>  	if (priv->plat->has_gmac4)
>  		value |= MII_GMAC4_READ;
>
> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +			       100, 10000))
>  		return -EBUSY;
>
>  	writel(value, priv->ioaddr + mii_address);
>
> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +			       100, 10000))
>  		return -EBUSY;
>
>  	/* Read the data from the MII data register */
> @@ -111,7 +98,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>  	struct stmmac_priv *priv = netdev_priv(ndev);
>  	unsigned int mii_address = priv->hw->mii.addr;
>  	unsigned int mii_data = priv->hw->mii.data;
> -
> +	u32 v;
>  	u32 value = MII_BUSY;
>
>  	value |= (phyaddr << priv->hw->mii.addr_shift)
> @@ -126,7 +113,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>  		value |= MII_WRITE;
>
>  	/* Wait until any existing MII operation is complete */
> -	if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
> +	if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +			       100, 10000))
>  		return -EBUSY;
>
>  	/* Set the MII address register to write */
> @@ -134,7 +122,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
>  	writel(value, priv->ioaddr + mii_address);
>
>  	/* Wait until any existing MII operation is complete */
> -	return stmmac_mdio_busy_wait(priv->ioaddr, mii_address);
> +	return readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
> +				  100, 10000);
>  }
>
>  /**
>

[toc] | [prev] | [next] | [standalone]


#1570514 — [PATCH 10/17] net: stmmac: Correct the error message about invalid speed

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:30 +0100
Subject[PATCH 10/17] net: stmmac: Correct the error message about invalid speed
Message-ID<t5CVd-7pw-31@gated-at.bofh.it>
In reply to#1570511
Add 1000 as a valid speed in the error message about invalid speed
in stmmac_adjust_link()

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.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 98f544e..b0154d5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -749,7 +749,7 @@ static void stmmac_adjust_link(struct net_device *dev)
 				break;
 			default:
 				netif_warn(priv, link, priv->dev,
-					   "Speed (%d) not 10/100\n",
+					   "Speed (%d) not 10/100/1000\n",
 					   phydev->speed);
 				break;
 			}
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570551 — Re: [PATCH 10/17] net: stmmac: Correct the error message about invalid speed

FromGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Date2017-01-31 11:10 +0100
SubjectRe: [PATCH 10/17] net: stmmac: Correct the error message about invalid speed
Message-ID<t5DxU-7RQ-25@gated-at.bofh.it>
In reply to#1570514
On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> Add 1000 as a valid speed in the error message about invalid speed
> in stmmac_adjust_link()
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.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 98f544e..b0154d5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -749,7 +749,7 @@ static void stmmac_adjust_link(struct net_device *dev)
>  				break;
>  			default:
>  				netif_warn(priv, link, priv->dev,
> -					   "Speed (%d) not 10/100\n",
> +					   "Speed (%d) not 10/100/1000\n",

maybe, it could be "broken speed: %d"

peppe

>  					   phydev->speed);
>  				break;
>  			}
>

[toc] | [prev] | [next] | [standalone]


#1570516 — [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:30 +0100
Subject[PATCH 02/17] net: stmmac: Remove the bus_setup function pointer
Message-ID<t5CVc-7pw-27@gated-at.bofh.it>
In reply to#1570511
The bus_setup function pointer is not used at all, this patch remove it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ----
 include/linux/stmmac.h                            | 1 -
 2 files changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e3f6389..bf2d8e6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1671,10 +1671,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 	/* Copy the MAC addr into the HW  */
 	priv->hw->mac->set_umac_addr(priv->hw, dev->dev_addr, 0);
 
-	/* If required, perform hw setup of the bus. */
-	if (priv->plat->bus_setup)
-		priv->plat->bus_setup(priv->ioaddr);
-
 	/* PS and related bits will be programmed according to the speed */
 	if (priv->hw->pcs) {
 		int speed = priv->plat->mac_port_sel_speed;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 266dab9..2d82df9 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -135,7 +135,6 @@ struct plat_stmmacenet_data {
 	int tx_fifo_size;
 	int rx_fifo_size;
 	void (*fix_mac_speed)(void *priv, unsigned int speed);
-	void (*bus_setup)(void __iomem *ioaddr);
 	int (*init)(struct platform_device *pdev, void *priv);
 	void (*exit)(struct platform_device *pdev, void *priv);
 	void *bsp_priv;
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570552 — Re: [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer

FromGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Date2017-01-31 11:10 +0100
SubjectRe: [PATCH 02/17] net: stmmac: Remove the bus_setup function pointer
Message-ID<t5DxU-7RQ-27@gated-at.bofh.it>
In reply to#1570516
On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> The bus_setup function pointer is not used at all, this patch remove it.

indeed this was used and documented on some previous kernels where some
ST40/SH4 platforms (w/o DT).

It's ok to remove it in the new MAC generation; I do not think that
ST will re-use it on new development.

Peppe

>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ----
>  include/linux/stmmac.h                            | 1 -
>  2 files changed, 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e3f6389..bf2d8e6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1671,10 +1671,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
>  	/* Copy the MAC addr into the HW  */
>  	priv->hw->mac->set_umac_addr(priv->hw, dev->dev_addr, 0);
>
> -	/* If required, perform hw setup of the bus. */
> -	if (priv->plat->bus_setup)
> -		priv->plat->bus_setup(priv->ioaddr);
> -
>  	/* PS and related bits will be programmed according to the speed */
>  	if (priv->hw->pcs) {
>  		int speed = priv->plat->mac_port_sel_speed;
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index 266dab9..2d82df9 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -135,7 +135,6 @@ struct plat_stmmacenet_data {
>  	int tx_fifo_size;
>  	int rx_fifo_size;
>  	void (*fix_mac_speed)(void *priv, unsigned int speed);
> -	void (*bus_setup)(void __iomem *ioaddr);
>  	int (*init)(struct platform_device *pdev, void *priv);
>  	void (*exit)(struct platform_device *pdev, void *priv);
>  	void *bsp_priv;
>

[toc] | [prev] | [next] | [standalone]


#1570517 — [PATCH 11/17] net: stmmac: Rewrite two test against NULL value

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:30 +0100
Subject[PATCH 11/17] net: stmmac: Rewrite two test against NULL value
Message-ID<t5CVd-7pw-35@gated-at.bofh.it>
In reply to#1570511
This patch rewrite two test against NULL value with correct style.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b0154d5..2df36bd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -700,7 +700,7 @@ static void stmmac_adjust_link(struct net_device *dev)
 	int new_state = 0;
 	unsigned int fc = priv->flow_ctrl, pause_time = priv->pause;
 
-	if (phydev == NULL)
+	if (!phydev)
 		return;
 
 	spin_lock_irqsave(&priv->lock, flags);
@@ -1143,7 +1143,7 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
 						 DMA_TO_DEVICE);
 		}
 
-		if (priv->tx_skbuff[i] != NULL) {
+		if (priv->tx_skbuff[i]) {
 			dev_kfree_skb_any(priv->tx_skbuff[i]);
 			priv->tx_skbuff[i] = NULL;
 			priv->tx_skbuff_dma[i].buf = 0;
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570559 — Re: [PATCH 11/17] net: stmmac: Rewrite two test against NULL value

FromGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Date2017-01-31 11:10 +0100
SubjectRe: [PATCH 11/17] net: stmmac: Rewrite two test against NULL value
Message-ID<t5DxW-7RQ-57@gated-at.bofh.it>
In reply to#1570517
On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> This patch rewrite two test against NULL value with correct style.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index b0154d5..2df36bd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -700,7 +700,7 @@ static void stmmac_adjust_link(struct net_device *dev)
>  	int new_state = 0;
>  	unsigned int fc = priv->flow_ctrl, pause_time = priv->pause;
>
> -	if (phydev == NULL)
> +	if (!phydev)
>  		return;
>
>  	spin_lock_irqsave(&priv->lock, flags);
> @@ -1143,7 +1143,7 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
>  						 DMA_TO_DEVICE);
>  		}
>
> -		if (priv->tx_skbuff[i] != NULL) {
> +		if (priv->tx_skbuff[i]) {
>  			dev_kfree_skb_any(priv->tx_skbuff[i]);
>  			priv->tx_skbuff[i] = NULL;
>  			priv->tx_skbuff_dma[i].buf = 0;
>

[toc] | [prev] | [next] | [standalone]


#1570518 — [PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:30 +0100
Subject[PATCH 01/17] net: stmmac: fix the typo on MAC_RNABLE_RX
Message-ID<t5CVc-7pw-29@gated-at.bofh.it>
In reply to#1570511
the define MAC_RNABLE_RX have a typo, rename it to MAC_ENABLE_RX

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h    | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index b13a144..0f90f91 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -340,7 +340,7 @@ struct dma_features {
 /* Common MAC defines */
 #define MAC_CTRL_REG		0x00000000	/* MAC Control */
 #define MAC_ENABLE_TX		0x00000008	/* Transmitter Enable */
-#define MAC_RNABLE_RX		0x00000004	/* Receiver Enable */
+#define MAC_ENABLE_RX		0x00000004	/* Receiver Enable */
 
 /* Default LPI timers */
 #define STMMAC_DEFAULT_LIT_LS	0x3E8
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
index 84e3e84..a414bde 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
@@ -261,9 +261,9 @@ void stmmac_set_mac(void __iomem *ioaddr, bool enable)
 	u32 value = readl(ioaddr + MAC_CTRL_REG);
 
 	if (enable)
-		value |= MAC_RNABLE_RX | MAC_ENABLE_TX;
+		value |= MAC_ENABLE_RX | MAC_ENABLE_TX;
 	else
-		value &= ~(MAC_ENABLE_TX | MAC_RNABLE_RX);
+		value &= ~(MAC_ENABLE_TX | MAC_ENABLE_RX);
 
 	writel(value, ioaddr + MAC_CTRL_REG);
 }
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570530 — [PATCH 14/17] net: stmmac: print phy information

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:50 +0100
Subject[PATCH 14/17] net: stmmac: print phy information
Message-ID<t5Dex-7w7-5@gated-at.bofh.it>
In reply to#1570511
When a PHY is found, printing which one was found (and which type/model) is
a good information to know.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e53b727..3d52b8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -885,6 +885,7 @@ static int stmmac_init_phy(struct net_device *dev)
 	netdev_dbg(priv->dev, "%s: attached to PHY (UID 0x%x) Link = %d\n",
 		   __func__, phydev->phy_id, phydev->link);
 
+	phy_attached_info(phydev);
 	return 0;
 }
 
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570564 — Re: [PATCH 14/17] net: stmmac: print phy information

FromGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Date2017-01-31 11:20 +0100
SubjectRe: [PATCH 14/17] net: stmmac: print phy information
Message-ID<t5DHA-7V9-11@gated-at.bofh.it>
In reply to#1570530
On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> When a PHY is found, printing which one was found (and which type/model) is
> a good information to know.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e53b727..3d52b8c 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -885,6 +885,7 @@ static int stmmac_init_phy(struct net_device *dev)
>  	netdev_dbg(priv->dev, "%s: attached to PHY (UID 0x%x) Link = %d\n",
>  		   __func__, phydev->phy_id, phydev->link);
>
> +	phy_attached_info(phydev);

maybe we could remove the netdev_dbg above and just keep
phy_attached_info(phydev);

peppe

>  	return 0;
>  }
>
>

[toc] | [prev] | [next] | [standalone]


#1573077 — Re: [PATCH 14/17] net: stmmac: print phy information

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-02-03 14:20 +0100
SubjectRe: [PATCH 14/17] net: stmmac: print phy information
Message-ID<t6LWp-22L-9@gated-at.bofh.it>
In reply to#1570564
On Tue, Jan 31, 2017 at 11:10:04AM +0100, Giuseppe CAVALLARO wrote:
> On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> > When a PHY is found, printing which one was found (and which type/model) is
> > a good information to know.
> >
> > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index e53b727..3d52b8c 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -885,6 +885,7 @@ static int stmmac_init_phy(struct net_device *dev)
> >  	netdev_dbg(priv->dev, "%s: attached to PHY (UID 0x%x) Link = %d\n",
> >  		   __func__, phydev->phy_id, phydev->link);
> >
> > +	phy_attached_info(phydev);
> 
> maybe we could remove the netdev_dbg above and just keep
> phy_attached_info(phydev);
> 
> peppe
> 

Ok, I will remove it

Regards
Corentin Labbe

[toc] | [prev] | [next] | [standalone]


#1570531 — [PATCH 06/17] net: stmmac: fix some code style problem

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:50 +0100
Subject[PATCH 06/17] net: stmmac: fix some code style problem
Message-ID<t5Dey-7w7-9@gated-at.bofh.it>
In reply to#1570511
Checkpatch complains about some code style problem on stmmac_mdio.c.
This patch fix them.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 3fdc6ec..c24bef2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -152,9 +152,9 @@ int stmmac_mdio_reset(struct mii_bus *bus)
 
 #ifdef CONFIG_OF
 	if (priv->device->of_node) {
-
 		if (data->reset_gpio < 0) {
 			struct device_node *np = priv->device->of_node;
+
 			if (!np)
 				return 0;
 
@@ -221,7 +221,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 		return 0;
 
 	new_bus = mdiobus_alloc();
-	if (new_bus == NULL)
+	if (!new_bus)
 		return -ENOMEM;
 
 	if (mdio_bus_data->irqs)
@@ -258,6 +258,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 	found = 0;
 	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
 		struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
+
 		if (phydev) {
 			int act = 0;
 			char irq_num[4];
@@ -267,7 +268,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 			 * If an IRQ was provided to be assigned after
 			 * the bus probe, do it here.
 			 */
-			if ((mdio_bus_data->irqs == NULL) &&
+			if ((!mdio_bus_data->irqs) &&
 			    (mdio_bus_data->probed_phy_irq > 0)) {
 				new_bus->irq[addr] =
 					mdio_bus_data->probed_phy_irq;
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570548 — Re: [PATCH 06/17] net: stmmac: fix some code style problem

FromGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Date2017-01-31 11:10 +0100
SubjectRe: [PATCH 06/17] net: stmmac: fix some code style problem
Message-ID<t5DxU-7RQ-21@gated-at.bofh.it>
In reply to#1570531
On 1/31/2017 10:11 AM, Corentin Labbe wrote:
> Checkpatch complains about some code style problem on stmmac_mdio.c.
> This patch fix them.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index 3fdc6ec..c24bef2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -152,9 +152,9 @@ int stmmac_mdio_reset(struct mii_bus *bus)
>
>  #ifdef CONFIG_OF
>  	if (priv->device->of_node) {
> -
>  		if (data->reset_gpio < 0) {
>  			struct device_node *np = priv->device->of_node;
> +
>  			if (!np)
>  				return 0;
>
> @@ -221,7 +221,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  		return 0;
>
>  	new_bus = mdiobus_alloc();
> -	if (new_bus == NULL)
> +	if (!new_bus)
>  		return -ENOMEM;
>
>  	if (mdio_bus_data->irqs)
> @@ -258,6 +258,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  	found = 0;
>  	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
>  		struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
> +
>  		if (phydev) {
>  			int act = 0;
>  			char irq_num[4];
> @@ -267,7 +268,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  			 * If an IRQ was provided to be assigned after
>  			 * the bus probe, do it here.
>  			 */
> -			if ((mdio_bus_data->irqs == NULL) &&
> +			if ((!mdio_bus_data->irqs) &&
>  			    (mdio_bus_data->probed_phy_irq > 0)) {
>  				new_bus->irq[addr] =
>  					mdio_bus_data->probed_phy_irq;
>

[toc] | [prev] | [next] | [standalone]


#1570533 — [PATCH 05/17] net: stmmac: remplace asm/io.h by linux/io.h

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:50 +0100
Subject[PATCH 05/17] net: stmmac: remplace asm/io.h by linux/io.h
Message-ID<t5Dey-7w7-15@gated-at.bofh.it>
In reply to#1570511
This patch fix the checkpatch warning about asm/io.h.
Sorting all includes in the process.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 738d5c7..3fdc6ec 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -20,13 +20,13 @@
   Maintainer: Giuseppe Cavallaro <peppe.cavallaro@st.com>
 *******************************************************************************/
 
+#include <linux/io.h>
 #include <linux/mii.h>
-#include <linux/phy.h>
-#include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/of_mdio.h>
-#include <asm/io.h>
+#include <linux/phy.h>
+#include <linux/slab.h>
 
 #include "stmmac.h"
 
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1570536 — [PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-01-31 10:50 +0100
Subject[PATCH 15/17] net: stmmac: remove dead code in stmmac_tx_clean
Message-ID<t5Dey-7w7-33@gated-at.bofh.it>
In reply to#1570511
Since commit cf32deec16e4 ("stmmac: add tx_skbuff_dma to save descriptors used by PTP"),
the struct dma_desc *p in stmmac_tx_clean was not used at all.

This patch remove this dead code.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3d52b8c..b494bc2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1124,13 +1124,6 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
 	int i;
 
 	for (i = 0; i < DMA_TX_SIZE; i++) {
-		struct dma_desc *p;
-
-		if (priv->extend_desc)
-			p = &((priv->dma_etx + i)->basic);
-		else
-			p = priv->dma_tx + i;
-
 		if (priv->tx_skbuff_dma[i].buf) {
 			if (priv->tx_skbuff_dma[i].map_as_page)
 				dma_unmap_page(priv->device,
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web