From: Andrew Lunn <andrew@lunn.ch>
To: Divya Koppera <Divya.Koppera@microchip.com>
Cc: netdev@vger.kernel.org, hkallweit1@gmail.com,
linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org,
robh+dt@kernel.org, devicetree@vger.kernel.org,
richardcochran@gmail.com, linux-kernel@vger.kernel.org,
UNGLinuxDriver@microchip.com, madhuri.sripada@microchip.com,
manohar.puri@microchip.com
Subject: Re: [PATCH net-next 3/3] net: phy: micrel: 1588 support for LAN8814 phy
Date: Fri, 4 Mar 2022 14:06:09 +0100 [thread overview]
Message-ID: <YiIOwZih+I6gsNlM@lunn.ch> (raw)
In-Reply-To: <20220304093418.31645-4-Divya.Koppera@microchip.com>
> +static struct kszphy_latencies lan8814_latencies = {
> + .rx_10 = 0x22AA,
> + .tx_10 = 0x2E4A,
> + .rx_100 = 0x092A,
> + .tx_100 = 0x02C1,
> + .rx_1000 = 0x01AD,
> + .tx_1000 = 0x00C9,
> +};
Seems odd to use hex here. Are these the defaults? At minimum, you
need to add these to the binding document, making it clear what
defaults are used. Also, what are the unit here?
> + /* Make sure the PHY is not broken. Read idle error count,
> + * and reset the PHY if it is maxed out.
> + */
> + regval = phy_read(phydev, MII_STAT1000);
> + if ((regval & 0xFF) == 0xFF) {
> + phy_init_hw(phydev);
> + phydev->link = 0;
> + if (phydev->drv->config_intr && phy_interrupt_is_valid(phydev))
> + phydev->drv->config_intr(phydev);
> + return genphy_config_aneg(phydev);
> + }
Is this related to PTP? Or is the PHY broken in general? This looks
like it should be something submitted to stable.
> +static int lan8814_config_init(struct phy_device *phydev)
> +{
> + int val;
> +
> + /* Reset the PHY */
> + val = lanphy_read_page_reg(phydev, 4, LAN8814_QSGMII_SOFT_RESET);
> + val |= LAN8814_QSGMII_SOFT_RESET_BIT;
> + lanphy_write_page_reg(phydev, 4, LAN8814_QSGMII_SOFT_RESET, val);
> +
> + /* Disable ANEG with QSGMII PCS Host side */
> + val = lanphy_read_page_reg(phydev, 5, LAN8814_QSGMII_PCS1G_ANEG_CONFIG);
> + val &= ~LAN8814_QSGMII_PCS1G_ANEG_CONFIG_ANEG_ENA;
> + lanphy_write_page_reg(phydev, 5, LAN8814_QSGMII_PCS1G_ANEG_CONFIG, val);
> +
> + /* MDI-X setting for swap A,B transmit */
> + val = lanphy_read_page_reg(phydev, 2, LAN8814_ALIGN_SWAP);
> + val &= ~LAN8814_ALIGN_TX_A_B_SWAP_MASK;
> + val |= LAN8814_ALIGN_TX_A_B_SWAP;
> + lanphy_write_page_reg(phydev, 2, LAN8814_ALIGN_SWAP, val);
This does not look related to PTP. If David has not ready merged this,
i would of said you should of submitted this as a separate patch.
> +static void lan8814_parse_latency(struct phy_device *phydev)
> +{
> + const struct device_node *np = phydev->mdio.dev.of_node;
> + struct kszphy_priv *priv = phydev->priv;
> + struct kszphy_latencies *latency = &priv->latencies;
> + u32 val;
> +
> + if (!of_property_read_u32(np, "lan8814,latency_rx_10", &val))
> + latency->rx_10 = val;
> + if (!of_property_read_u32(np, "lan8814,latency_tx_10", &val))
> + latency->tx_10 = val;
> + if (!of_property_read_u32(np, "lan8814,latency_rx_100", &val))
> + latency->rx_100 = val;
> + if (!of_property_read_u32(np, "lan8814,latency_tx_100", &val))
> + latency->tx_100 = val;
> + if (!of_property_read_u32(np, "lan8814,latency_rx_1000", &val))
> + latency->rx_1000 = val;
> + if (!of_property_read_u32(np, "lan8814,latency_tx_1000", &val))
> + latency->tx_1000 = val;
Are range checks need here? You are reading a u32, but PHY registers
are generally 16 bit.
Andrew
next prev parent reply other threads:[~2022-03-04 13:06 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 9:34 [PATCH net-next 0/3] Add support for 1588 in LAN8814 Divya Koppera
2022-03-04 9:34 ` [PATCH net-next 1/3] net: phy: micrel: Fix concurrent register access Divya Koppera
2022-03-04 9:34 ` [PATCH net-next 2/3] dt-bindings: net: micrel: Configure latency values and timestamping check for LAN8814 phy Divya Koppera
2022-03-04 12:50 ` Andrew Lunn
2022-03-04 13:55 ` Richard Cochran
2022-03-07 5:02 ` Divya.Koppera
2022-03-07 4:40 ` Divya.Koppera
2022-03-07 13:08 ` Andrew Lunn
2022-03-08 10:05 ` Divya.Koppera
2022-03-08 13:54 ` Andrew Lunn
2022-03-08 14:54 ` Richard Cochran
2022-03-08 15:43 ` Horatiu Vultur
2022-03-08 18:10 ` Andrew Lunn
2022-03-08 22:14 ` Horatiu Vultur
2022-03-08 23:36 ` Andrew Lunn
2022-03-09 1:46 ` Richard Cochran
2022-03-09 1:58 ` Richard Cochran
2022-03-09 13:24 ` Horatiu Vultur
2022-03-09 14:55 ` Russell King (Oracle)
2022-03-09 19:52 ` Richard Cochran
2022-03-11 14:28 ` Horatiu Vultur
2022-03-11 15:08 ` Richard Cochran
2022-03-12 19:36 ` Allan W. Nielsen
2022-03-13 2:41 ` Richard Cochran
2022-03-13 4:04 ` Richard Cochran
2022-03-11 15:21 ` Woojung.Huh
2022-03-12 2:48 ` Richard Cochran
2022-03-12 20:04 ` Andrew Lunn
2022-03-13 2:46 ` Richard Cochran
2022-03-13 15:07 ` Andrew Lunn
2022-03-13 19:37 ` Allan W. Nielsen
2022-03-13 20:03 ` Richard Cochran
2022-03-13 20:07 ` Richard Cochran
2022-03-11 14:07 ` Horatiu Vultur
2022-03-07 21:33 ` Rob Herring
2022-03-04 9:34 ` [PATCH net-next 3/3] net: phy: micrel: 1588 support " Divya Koppera
2022-03-04 13:06 ` Andrew Lunn [this message]
2022-03-07 4:58 ` Divya.Koppera
2022-03-07 13:19 ` Andrew Lunn
2022-03-04 13:46 ` Kurt Kanzenbach
2022-03-04 13:57 ` Richard Cochran
2022-03-04 12:50 ` [PATCH net-next 0/3] Add support for 1588 in LAN8814 patchwork-bot+netdevbpf
2022-03-04 13:06 ` Andrew Lunn
2022-03-04 13:21 ` David Miller
2022-03-04 13:47 ` Andrew Lunn
2022-03-04 14:37 ` David Miller
2022-03-04 14:06 ` Richard Cochran
2022-03-04 14:17 ` Andrew Lunn
2022-03-04 15:42 ` Richard Cochran
2022-03-17 12:16 ` Michael Walle
2022-03-17 14:05 ` Allan W. Nielsen
2022-03-17 14:38 ` Andrew Lunn
2022-03-17 19:30 ` Allan W. Nielsen
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=YiIOwZih+I6gsNlM@lunn.ch \
--to=andrew@lunn.ch \
--cc=Divya.Koppera@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=madhuri.sripada@microchip.com \
--cc=manohar.puri@microchip.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=robh+dt@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 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).