BPF List
 help / color / mirror / Atom feed
From: <Arun.Ramadoss@microchip.com>
To: <linux@armlinux.org.uk>
Cc: <andrew@lunn.ch>, <linux-kernel@vger.kernel.org>,
	<UNGLinuxDriver@microchip.com>, <vivien.didelot@gmail.com>,
	<ast@kernel.org>, <bpf@vger.kernel.org>, <olteanv@gmail.com>,
	<devicetree@vger.kernel.org>, <robh+dt@kernel.org>,
	<andrii@kernel.org>, <songliubraving@fb.com>,
	<f.fainelli@gmail.com>, <daniel@iogearbox.net>,
	<john.fastabend@gmail.com>, <kuba@kernel.org>,
	<edumazet@google.com>, <pabeni@redhat.com>, <kpsingh@kernel.org>,
	<netdev@vger.kernel.org>, <Woojung.Huh@microchip.com>,
	<krzysztof.kozlowski+dt@linaro.org>, <yhs@fb.com>,
	<davem@davemloft.net>, <kafai@fb.com>
Subject: Re: [Patch net-next v14 11/13] net: dsa: microchip: lan937x: add phylink_mac_link_up support
Date: Fri, 1 Jul 2022 05:44:52 +0000	[thread overview]
Message-ID: <3ef3e69289552f93ee94151a68c0ff3cf1226963.camel@microchip.com> (raw)
In-Reply-To: <Yr2MImcS9lzr3yx9@shell.armlinux.org.uk>

Hi Russell,
Thanks for the review comment.

On Thu, 2022-06-30 at 12:42 +0100, Russell King (Oracle) wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Thu, Jun 30, 2022 at 03:50:39PM +0530, Arun Ramadoss wrote:
> > +static void lan937x_config_gbit(struct ksz_device *dev, bool gbit,
> > u8 *data)
> > +{
> > +     if (gbit)
> > +             *data &= ~PORT_MII_NOT_1GBIT;
> > +     else
> > +             *data |= PORT_MII_NOT_1GBIT;
> > +}
> > +
> > +static void lan937x_config_interface(struct ksz_device *dev, int
> > port,
> > +                                  int speed, int duplex,
> > +                                  bool tx_pause, bool rx_pause)
> > +{
> > +     u8 xmii_ctrl0, xmii_ctrl1;
> > +
> > +     ksz_pread8(dev, port, REG_PORT_XMII_CTRL_0, &xmii_ctrl0);
> > +     ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &xmii_ctrl1);
> > +
> > +     switch (speed) {
> > +     case SPEED_1000:
> > +             lan937x_config_gbit(dev, true, &xmii_ctrl1);
> > +             break;
> > +     case SPEED_100:
> > +             lan937x_config_gbit(dev, false, &xmii_ctrl1);
> > +             xmii_ctrl0 |= PORT_MII_100MBIT;
> > +             break;
> > +     case SPEED_10:
> > +             lan937x_config_gbit(dev, false, &xmii_ctrl1);
> > +             xmii_ctrl0 &= ~PORT_MII_100MBIT;
> > +             break;
> > +     default:
> > +             dev_err(dev->dev, "Unsupported speed on port %d:
> > %d\n",
> > +                     port, speed);
> > +             return;
> > +     }
> 
> Isn't this:
> 
>         if (speed == SPEED_1000)
>                 xmii_ctrl1 &= ~PORT_MII_NOT_1GBIT;
>         else
>                 xmii_ctrl1 |= PORT_MII_NOT_1GBIT;
> 
>         if (speed == SPEED_100)
>                 xmii_ctrl0 |= PORT_MII_100MBIT;
>         else
>                 xmii_ctrl0 &= ~PORT_MII_100MBIT;
> 
> There isn't much need to validate that "speed" is correct, you've
> already told phylink that you only support 1G, 100M and 10M so you're
> not going to get called with anything except one of those.

Ok, I will update the code.

> 
> > +
> > +     if (duplex)
> > +             xmii_ctrl0 |= PORT_MII_FULL_DUPLEX;
> > +     else
> > +             xmii_ctrl0 &= ~PORT_MII_FULL_DUPLEX;
> > +
> > +     if (tx_pause)
> > +             xmii_ctrl0 |= PORT_MII_TX_FLOW_CTRL;
> > +     else
> > +             xmii_ctrl1 &= ~PORT_MII_TX_FLOW_CTRL;
> 
> It seems weird to set a bit in one register and clear it in a
> different
> register. I suspect you mean xmii_ctrl0 here.

Sorry, its a typo mistake. I will update the register.

> 
> > +
> > +     if (rx_pause)
> > +             xmii_ctrl0 |= PORT_MII_RX_FLOW_CTRL;
> > +     else
> > +             xmii_ctrl0 &= ~PORT_MII_RX_FLOW_CTRL;
> > +
> > +     ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_0, xmii_ctrl0);
> > +     ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_1, xmii_ctrl1);
> > +}
> > +
> 
> Thanks!
> 
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2022-07-01  5:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 10:20 [Patch net-next v14 00/13] net: dsa: microchip: DSA Driver support for LAN937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 01/13] dt-bindings: net: make internal-delay-ps based on phy-mode Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 02/13] dt-bindings: net: dsa: dt bindings for microchip lan937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 03/13] net: dsa: tag_ksz: add tag handling for Microchip LAN937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 04/13] net: dsa: microchip: generic access to ksz9477 static and reserved table Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 05/13] net: dsa: microchip: add DSA support for microchip LAN937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 06/13] net: dsa: microchip: lan937x: add dsa_tag_protocol Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 07/13] net: dsa: microchip: lan937x: add phy read and write support Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 08/13] net: dsa: microchip: lan937x: register mdio-bus Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 09/13] net: dsa: microchip: lan937x: add MTU and fast_age support Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 10/13] net: dsa: microchip: lan937x: add phylink_get_caps support Arun Ramadoss
2022-06-30 11:36   ` Russell King (Oracle)
2022-07-01  5:51     ` Arun.Ramadoss
2022-07-01  8:07       ` Russell King (Oracle)
2022-07-01  8:37         ` Arun.Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 11/13] net: dsa: microchip: lan937x: add phylink_mac_link_up support Arun Ramadoss
2022-06-30 11:42   ` Russell King (Oracle)
2022-07-01  5:44     ` Arun.Ramadoss [this message]
2022-06-30 10:20 ` [Patch net-next v14 12/13] net: dsa: microchip: lan937x: add phylink_mac_config support Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 13/13] net: dsa: microchip: add LAN937x in the ksz spi probe Arun Ramadoss

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=3ef3e69289552f93ee94151a68c0ff3cf1226963.camel@microchip.com \
    --to=arun.ramadoss@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --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=robh+dt@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=vivien.didelot@gmail.com \
    --cc=yhs@fb.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