netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>, Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	Arun Ramadoss <arun.ramadoss@microchip.com>,
	"Russell King (Oracle)" <linux@armlinux.org.uk>,
	Simon Horman <simon.horman@corigine.com>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v4 1/2] net: dsa: microchip: ksz8: Make flow control, speed, and duplex on CPU port configurable
Date: Sat, 20 May 2023 06:56:23 +0200	[thread overview]
Message-ID: <20230520045623.GB18246@pengutronix.de> (raw)
In-Reply-To: <20230519232802.ae34asc4zgfmv3u4@skbuf>

On Sat, May 20, 2023 at 02:28:02AM +0300, Vladimir Oltean wrote:
> > +	/* This hardware only supports SPEED_10 and SPEED_100. For SPEED_10
> > +	 * we need to set the SW_10_MBIT bit. Otherwise, we can leave it 0.
> > +	 */
> > +	if (speed == SPEED_10)
> > +		ctrl |= SW_10_MBIT;
> > +
> > +	ksz_rmw8(dev, REG_SW_CTRL_4, SW_HALF_DUPLEX | SW_FLOW_CTRL |
> > +		 SW_10_MBIT, ctrl);
> 
> REG_SW_CTRL_4 ... S_REPLACE_VID_CTRL ... dev->info->regs[P_XMII_CTRL_1] ...
> at some point we will need one more consolidation effort here, since we
> have at least 3 ways of reaching the same register.

Agree, the register access is a bit messy now. Your idea about the
regfield API sounds good. We should try it.

Should i convert this patch to use dev->info->regs?

> >  	.mirror_del = ksz8_port_mirror_del,
> >  	.get_caps = ksz8_get_caps,
> > +	.phylink_mac_link_up = ksz8_phylink_mac_link_up,
> 
> Another future consolidation to consider: since all ksz_dev_ops now
> provide .phylink_mac_link_up(), the "if" condition here is no longer
> necessary:
> 
> static void ksz_phylink_mac_link_up(struct dsa_switch *ds, int port,
> 				    unsigned int mode,
> 				    phy_interface_t interface,
> 				    struct phy_device *phydev, int speed,
> 				    int duplex, bool tx_pause, bool rx_pause)
> {
> 	struct ksz_device *dev = ds->priv;
> 
> 	if (dev->dev_ops->phylink_mac_link_up)
> 		dev->dev_ops->phylink_mac_link_up(dev, port, mode, interface,
> 						  phydev, speed, duplex,
> 						  tx_pause, rx_pause);
> }
> 
> which reminds me of the fact that I also had a patch to remove
> dev->dev_ops->phylink_mac_config():
> https://patchwork.kernel.org/project/netdevbpf/patch/20230316161250.3286055-5-vladimir.oltean@nxp.com/
> 
> I give up with that patch set now, since there's zero reviewer interest.
> If you want and you think it's useful, you might want to adapt it for
> KSZ8873.

Sounds good. I'll take it in to my mainlining queue for KSZ8873.

> >  	.config_cpu_port = ksz8_config_cpu_port,
> >  	.enable_stp_addr = ksz8_enable_stp_addr,
> >  	.reset = ksz8_reset_switch,
> > -- 
> > 2.39.2
> > 
> 
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
> 

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2023-05-20  4:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 12:46 [PATCH net-next v4 0/2] Fine-Tune Flow Control and Speed Configurations in Microchip KSZ8xxx DSA Driver Oleksij Rempel
2023-05-19 12:46 ` [PATCH net-next v4 1/2] net: dsa: microchip: ksz8: Make flow control, speed, and duplex on CPU port configurable Oleksij Rempel
2023-05-19 14:30   ` Vladimir Oltean
2023-05-19 18:50     ` Oleksij Rempel
2023-05-19 20:34       ` Vladimir Oltean
2023-05-20  5:03         ` Oleksij Rempel
2023-05-20 15:17           ` Vladimir Oltean
2023-05-21  4:38             ` Oleksij Rempel
2023-05-21 10:28               ` Vladimir Oltean
2023-05-19 23:28   ` Vladimir Oltean
2023-05-20  4:56     ` Oleksij Rempel [this message]
2023-05-19 12:47 ` [PATCH net-next v4 2/2] net: dsa: microchip: ksz8: Add function to configure ports with integrated PHYs Oleksij Rempel
2023-05-19 23:36   ` Vladimir Oltean

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=20230520045623.GB18246@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arun.ramadoss@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=simon.horman@corigine.com \
    --cc=woojung.huh@microchip.com \
    /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 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).