lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdU1ZmSm_tjtWxoFNako2fzmranGVz5qqD2YRNEFRjX0Sw@mail.gmail.com>
Date:   Tue, 28 Apr 2020 17:28:30 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Oleksij Rempel <o.rempel@...gutronix.de>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        David Jander <david@...tonic.nl>,
        "David S. Miller" <davem@...emloft.net>,
        Sascha Hauer <kernel@...gutronix.de>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        Philippe Schenker <philippe.schenker@...adex.com>,
        Russell King <linux@...linux.org.uk>,
        Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH net-next v3] net: phy: micrel: add phy-mode support for
 the KSZ9031 PHY

Hi Oleksij,

On Wed, Apr 22, 2020 at 9:24 AM Oleksij Rempel <o.rempel@...gutronix.de> wrote:
> Add support for following phy-modes: rgmii, rgmii-id, rgmii-txid, rgmii-rxid.
>
> This PHY has an internal RX delay of 1.2ns and no delay for TX.
>
> The pad skew registers allow to set the total TX delay to max 1.38ns and
> the total RX delay to max of 2.58ns (configurable 1.38ns + build in
> 1.2ns) and a minimal delay of 0ns.
>
> According to the RGMII v1.3 specification the delay provided by PCB traces
> should be between 1.5ns and 2.0ns. The RGMII v2.0 allows to provide this
> delay by MAC or PHY. So, we configure this PHY to the best values we can
> get by this HW: TX delay to 1.38ns (max supported value) and RX delay to
> 1.80ns (best calculated delay)
>
> The phy-modes can still be fine tuned/overwritten by *-skew-ps
> device tree properties described in:
> Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>

This is now commit bcf3440c6dd78bfe ("net: phy: micrel: add phy-mode
support for the KSZ9031 PHY") in net-next/master.

> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c

> @@ -597,21 +703,33 @@ static int ksz9031_config_init(struct phy_device *phydev)
>         } while (!of_node && dev_walker);
>
>         if (of_node) {
> +               bool update = false;
> +
> +               if (phy_interface_is_rgmii(phydev)) {
> +                       result = ksz9031_config_rgmii_delay(phydev);
> +                       if (result < 0)
> +                               return result;
> +               }
> +
>                 ksz9031_of_load_skew_values(phydev, of_node,
>                                 MII_KSZ9031RN_CLK_PAD_SKEW, 5,
> -                               clk_skews, 2);
> +                               clk_skews, 2, &update);
>
>                 ksz9031_of_load_skew_values(phydev, of_node,
>                                 MII_KSZ9031RN_CONTROL_PAD_SKEW, 4,
> -                               control_skews, 2);
> +                               control_skews, 2, &update);
>
>                 ksz9031_of_load_skew_values(phydev, of_node,
>                                 MII_KSZ9031RN_RX_DATA_PAD_SKEW, 4,
> -                               rx_data_skews, 4);
> +                               rx_data_skews, 4, &update);
>
>                 ksz9031_of_load_skew_values(phydev, of_node,
>                                 MII_KSZ9031RN_TX_DATA_PAD_SKEW, 4,
> -                               tx_data_skews, 4);
> +                               tx_data_skews, 4, &update);
> +
> +               if (update && phydev->interface != PHY_INTERFACE_MODE_RGMII)
> +                       phydev_warn(phydev,
> +                                   "*-skew-ps values should be used only with phy-mode = \"rgmii\"\n");

This triggers on Renesas Salvator-X(S):

    Micrel KSZ9031 Gigabit PHY e6800000.ethernet-ffffffff:00:
*-skew-ps values should be used only with phy-mode = "rgmii"

which uses:

        phy-mode = "rgmii-txid";

and:

        rxc-skew-ps = <1500>;

If I understand Documentation/devicetree/bindings/net/ethernet-controller.yaml
correctly:

      # RX and TX delays are added by the MAC when required
      - rgmii

i.e. any *-skew-ps can be specified.

      # RGMII with internal RX and TX delays provided by the PHY,
      # the MAC should not add the RX or TX delays in this case
      - rgmii-id

i.e. *-skew-ps must not be specified.

      # RGMII with internal RX delay provided by the PHY, the MAC
      # should not add an RX delay in this case
      - rgmii-rxid

i.e. it's still OK to specify tx*-skew-ps values here...

      # RGMII with internal TX delay provided by the PHY, the MAC
      # should not add an TX delay in this case
      - rgmii-txid

... and rx*-skew-ps values here?
Is my understanding correct, and should the check be updated to take into
account rxid and txid?

BTW, the example in Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
still specifies *-skew-ps values with phy-mode = "rgmii-id", so I think
that should be updated, too.

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ