netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Behun <marek.behun@nic.cz>
To: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Vivien Didelot <vivien.didelot@gmail.com>
Subject: Re: [PATCH net-next 06/10] net: dsa: mv88e6xxx: extend phylink to Serdes PHYs
Date: Thu, 5 Mar 2020 14:38:47 +0100	[thread overview]
Message-ID: <20200305143847.6507e32b@nic.cz> (raw)
In-Reply-To: <E1j9ppf-00072N-L9@rmk-PC.armlinux.org.uk>

On Thu, 05 Mar 2020 12:42:31 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> +int mv88e6390_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port,
> +				 u8 lane, int speed, int duplex)
> +{
> +	u16 val, bmcr;
> +	int err;
> +
> +	err = mv88e6390_serdes_read(chip, lane, MDIO_MMD_PHYXS,
> +				    MV88E6390_SGMII_BMCR, &val);
> +	if (err)
> +		return err;
> +
> +	bmcr = val & ~(BMCR_SPEED100 | BMCR_FULLDPLX | BMCR_SPEED1000);
> +	switch (speed) {
> +	case SPEED_2500:
> +	case SPEED_1000:
> +		bmcr |= BMCR_SPEED1000;
>  		break;
> -	case MV88E6XXX_PORT_STS_CMODE_1000BASEX:
> -		mode = PHY_INTERFACE_MODE_1000BASEX;
> +	case SPEED_100:
> +		bmcr |= BMCR_SPEED100;
>  		break;
> -	case MV88E6XXX_PORT_STS_CMODE_2500BASEX:
> -		mode = PHY_INTERFACE_MODE_2500BASEX;
> +	case SPEED_10:
>  		break;
> -	default:
> -		mode = PHY_INTERFACE_MODE_NA;
>  	}
>  
> -	err = mv88e6xxx_port_setup_mac(chip, port, link, speed, duplex,
> -				       PAUSE_OFF, mode);
> -	if (err)
> -		dev_err(chip->dev, "can't propagate PHY settings to MAC: %d\n",
> -			err);
> -	else
> -		dsa_port_phylink_mac_change(ds, port, link == LINK_FORCED_UP);
> +	if (duplex == DUPLEX_FULL)
> +		bmcr |= BMCR_FULLDPLX;
> +
> +	if (bmcr == val)
> +		return 0;
> +
> +	return mv88e6390_serdes_write(chip, lane, MDIO_MMD_PHYXS,
> +				      MV88E6390_SGMII_BMCR, bmcr);
> +}

Hi,

some time ago I wondered if it would make sense to separate the
SERDES PHY code into a separate phy driver to reside in
drivers/net/phy/marvell-serdes.c or something like that. Are there
compatible PHYs which aren't integrated into a switch?

Marek

  reply	other threads:[~2020-03-05 13:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 12:41 [PATCH net-next 0/10] net: dsa: improve serdes integration Russell King - ARM Linux admin
2020-03-05 12:42 ` [PATCH net-next 01/10] net: mii: convert mii_lpa_to_ethtool_lpa_x() to linkmode variant Russell King
2020-03-05 12:42 ` [PATCH net-next 02/10] net: mii: add linkmode_adv_to_mii_adv_x() Russell King
2020-03-05 12:42 ` [PATCH net-next 03/10] net: dsa: warn if phylink_mac_link_state returns error Russell King
2020-03-05 12:42 ` [PATCH net-next 04/10] net: dsa: mv88e6xxx: use BMCR definitions for serdes control register Russell King
2020-03-05 12:42 ` [PATCH net-next 05/10] net: dsa: mv88e6xxx: configure interface settings in mac_config Russell King
2020-03-05 12:42 ` [PATCH net-next 06/10] net: dsa: mv88e6xxx: extend phylink to Serdes PHYs Russell King
2020-03-05 13:38   ` Marek Behun [this message]
2020-03-05 13:43     ` Russell King - ARM Linux admin
2020-03-05 12:42 ` [PATCH net-next 07/10] net: dsa: mv88e6xxx: fix Serdes link changes Russell King
2020-03-05 12:42 ` [PATCH net-next 08/10] net: dsa: mv88e6xxx: combine port_set_speed and port_set_duplex Russell King
2020-03-05 12:42 ` [PATCH net-next 09/10] net: dsa: mv88e6xxx: remove port_link_state functions Russell King
2020-03-05 12:42 ` [PATCH net-next 10/10] net: dsa: mv88e6xxx: use PHY_DETECT in mac_link_up/mac_link_down Russell King
2020-03-05 22:54 ` [PATCH net-next 0/10] net: dsa: improve serdes integration Andrew Lunn
2020-03-05 23:45   ` Russell King - ARM Linux admin
2020-03-06  0:27     ` Andrew Lunn
2020-03-06  1:13     ` Andrew Lunn
2020-03-06  3:57       ` Andrew Lunn
2020-03-06 10:39         ` Russell King - ARM Linux admin
2020-03-06 13:29           ` Andrew Lunn
2020-03-06 13:53           ` Marek Behun
2020-03-06 14:51             ` Andrew Lunn
2020-03-09  5:04 ` David Miller
2020-03-09  9:48   ` Russell King - ARM Linux admin
2020-03-09 12:40     ` Andrew Lunn
2020-03-09 12:50       ` 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=20200305143847.6507e32b@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vivien.didelot@gmail.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).