All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Antoine Ténart" <antoine.tenart@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net] net: macb: Properly handle phylink on at91rm9200
Date: Fri, 21 Feb 2020 17:10:24 +0000	[thread overview]
Message-ID: <20200221171024.GK25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <661c1e61-11c8-0c54-83a2-5e81674246e0@gmail.com>

On Mon, Feb 17, 2020 at 02:03:47PM -0800, Florian Fainelli wrote:
> 
> 
> On 2/17/2020 2:43 AM, Alexandre Belloni wrote:
> > at91ether_init was handling the phy mode and speed but since the switch to
> > phylink, the NCFGR register got overwritten by macb_mac_config().
> > 
> > Add new phylink callbacks to handle emac and at91rm9200 properly.
> > 
> > Fixes: 7897b071ac3b ("net: macb: convert to phylink")
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > ---
> 
> [snip]
> 
> > +static void at91ether_mac_link_up(struct phylink_config *config,
> > +				  unsigned int mode,
> > +				  phy_interface_t interface,
> > +				  struct phy_device *phy)
> > +{
> > +	struct net_device *ndev = to_net_dev(config->dev);
> > +	struct macb *bp = netdev_priv(ndev);
> > +
> > +	/* Enable Rx and Tx */
> > +	macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
> > +
> > +	netif_tx_wake_all_queues(ndev);
> 
> So this happens to be copied from the mvpp2 driver, if this is a
> requirement, should not this be moved to the phylink implementation
> since it already manages the carrier? Those two drivers are the only
> ones doing this.

Looking at mvneta, it does stuff with managing the queues itself, and
I suspect adding that into phylink will mess that driver up.  Maybe
someone with more knowledge can take a look.

But, IMHO, two drivers doing something is not grounds for moving it
into higher layers.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Antoine Ténart" <antoine.tenart@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net] net: macb: Properly handle phylink on at91rm9200
Date: Fri, 21 Feb 2020 17:10:24 +0000	[thread overview]
Message-ID: <20200221171024.GK25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <661c1e61-11c8-0c54-83a2-5e81674246e0@gmail.com>

On Mon, Feb 17, 2020 at 02:03:47PM -0800, Florian Fainelli wrote:
> 
> 
> On 2/17/2020 2:43 AM, Alexandre Belloni wrote:
> > at91ether_init was handling the phy mode and speed but since the switch to
> > phylink, the NCFGR register got overwritten by macb_mac_config().
> > 
> > Add new phylink callbacks to handle emac and at91rm9200 properly.
> > 
> > Fixes: 7897b071ac3b ("net: macb: convert to phylink")
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > ---
> 
> [snip]
> 
> > +static void at91ether_mac_link_up(struct phylink_config *config,
> > +				  unsigned int mode,
> > +				  phy_interface_t interface,
> > +				  struct phy_device *phy)
> > +{
> > +	struct net_device *ndev = to_net_dev(config->dev);
> > +	struct macb *bp = netdev_priv(ndev);
> > +
> > +	/* Enable Rx and Tx */
> > +	macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
> > +
> > +	netif_tx_wake_all_queues(ndev);
> 
> So this happens to be copied from the mvpp2 driver, if this is a
> requirement, should not this be moved to the phylink implementation
> since it already manages the carrier? Those two drivers are the only
> ones doing this.

Looking at mvneta, it does stuff with managing the queues itself, and
I suspect adding that into phylink will mess that driver up.  Maybe
someone with more knowledge can take a look.

But, IMHO, two drivers doing something is not grounds for moving it
into higher layers.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

  reply	other threads:[~2020-02-21 17:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17 10:43 [PATCH net] net: macb: Properly handle phylink on at91rm9200 Alexandre Belloni
2020-02-17 10:43 ` Alexandre Belloni
2020-02-17 16:56 ` Russell King - ARM Linux admin
2020-02-17 16:56   ` Russell King - ARM Linux admin
2020-02-17 17:06   ` Russell King - ARM Linux admin
2020-02-17 17:06     ` Russell King - ARM Linux admin
2020-02-17 17:42   ` Alexandre Belloni
2020-02-17 17:42     ` Alexandre Belloni
2020-02-17 18:47     ` Russell King - ARM Linux admin
2020-02-17 18:47       ` Russell King - ARM Linux admin
2020-02-17 22:03 ` Florian Fainelli
2020-02-17 22:03   ` Florian Fainelli
2020-02-21 17:10   ` Russell King - ARM Linux admin [this message]
2020-02-21 17:10     ` Russell King - ARM Linux admin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200221171024.GK25745@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alexandre.belloni@bootlin.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.