From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0582C11F67 for ; Tue, 29 Jun 2021 14:11:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C50A261DB3 for ; Tue, 29 Jun 2021 14:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234326AbhF2OOW (ORCPT ); Tue, 29 Jun 2021 10:14:22 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:33390 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233106AbhF2OOV (ORCPT ); Tue, 29 Jun 2021 10:14:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=7ObJSRSuHN+MA7ZvW6xKZmT6lRaUAOxEM0Gf6yOQ90U=; b=GKS5AYdhZsSVl6B8uK2VN7XjBk IFP2ierQijzZQBk/uevyncHpdW3dwKWyUpja9d9ufybUF/0wh07BTrIrzF+/U6u8pXSP3GrIVEMp/ 5+CewPy5GSS9q9/Qv+gPKtywQ132SipwUlzSFIgQLgjgS34h+aoWl9fjiRURbqT1R7Kk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1lyESm-00BY9x-Jo; Tue, 29 Jun 2021 16:11:44 +0200 Date: Tue, 29 Jun 2021 16:11:44 +0200 From: Andrew Lunn To: Harini Katakam Cc: robh+dt@kernel.org, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org, steen.hegelund@microchip.com, bjarni.jonasson@microchip.com, ioana.ciornei@nxp.com, likaige@loongson.cn, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, harinikatakamlinux@gmail.com, michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com Subject: Re: [PATCH 3/3] phy: mscc: Add support for VSC8531_02 with RGMII tuning Message-ID: References: <20210629094038.18610-1-harini.katakam@xilinx.com> <20210629094038.18610-4-harini.katakam@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210629094038.18610-4-harini.katakam@xilinx.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -535,15 +535,16 @@ static int vsc85xx_rgmii_set_skews(struct phy_device *phydev, u32 rgmii_cntl, > u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1; > u16 reg_val = 0; > int rc; > + struct vsc8531_private *vsc8531 = phydev->priv; reverse christmass tree. > mutex_lock(&phydev->lock); > > if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || > phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) > - reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_rx_delay_pos; > + reg_val |= vsc8531->rx_delay << rgmii_rx_delay_pos; > if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || > phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) > - reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_tx_delay_pos; > + reg_val |= vsc8531->tx_delay << rgmii_tx_delay_pos; > > rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_2, > rgmii_cntl, > @@ -1820,6 +1821,17 @@ static int vsc85xx_config_init(struct phy_device *phydev) > { > int rc, i, phy_id; > struct vsc8531_private *vsc8531 = phydev->priv; > + struct device_node *of_node = phydev->mdio.dev.of_node; > + > + rc = of_property_read_u32(of_node, "vsc8531,rx-delay", > + &vsc8531->rx_delay); > + if (rc < 0) > + vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS; of_property_read_u32() is guaranteed not to touch the result value, if it is not in device tree. So you can simplify this to: vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS; of_property_read_u32(of_node, "vsc8531,rx-delay", &vsc8531->rx_delay); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DB88C11F69 for ; Tue, 29 Jun 2021 14:14:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D54661DCB for ; Tue, 29 Jun 2021 14:14:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D54661DCB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yttz7OwfvvLxLf3MFJ7Qv89HnyW81jivNM8i/wCFBEM=; b=o39pzsojwjwRaj FqR+xg38i5XzQCAc8GH6shb+496Cl8EcCi5ViiBme7/wZGzCgdJiKeiKWq/ZJq6rPClmsNvMAC3bQ mWOcjGk5hadyWADAAHNF8g+8DwaWZwfo2MLv71ucGjb4Rp53BRwa9nKlosugzCL//SzrKl6uUI2GF 9wCWZ0b7Bcw3J4Na81OFr6RH2hS3wk4PY+BcNaxNilnd1pYSGsiMfb6pi8AHJL7Oq9nPJBBIXZSTA F6IVftBy5YAhW3NLjV/I5BNCIsMnmRLO9wxyJD949rcmlLff1rcqX9XdGA7jf3dT9tHkA5JZiYyge vI9d85Cp2bq/6zMowzKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyET8-00BEHN-5a; Tue, 29 Jun 2021 14:12:06 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyESu-00BEEr-8n for linux-arm-kernel@lists.infradead.org; Tue, 29 Jun 2021 14:11:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=7ObJSRSuHN+MA7ZvW6xKZmT6lRaUAOxEM0Gf6yOQ90U=; b=GKS5AYdhZsSVl6B8uK2VN7XjBk IFP2ierQijzZQBk/uevyncHpdW3dwKWyUpja9d9ufybUF/0wh07BTrIrzF+/U6u8pXSP3GrIVEMp/ 5+CewPy5GSS9q9/Qv+gPKtywQ132SipwUlzSFIgQLgjgS34h+aoWl9fjiRURbqT1R7Kk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1lyESm-00BY9x-Jo; Tue, 29 Jun 2021 16:11:44 +0200 Date: Tue, 29 Jun 2021 16:11:44 +0200 From: Andrew Lunn To: Harini Katakam Cc: robh+dt@kernel.org, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org, steen.hegelund@microchip.com, bjarni.jonasson@microchip.com, ioana.ciornei@nxp.com, likaige@loongson.cn, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, harinikatakamlinux@gmail.com, michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com Subject: Re: [PATCH 3/3] phy: mscc: Add support for VSC8531_02 with RGMII tuning Message-ID: References: <20210629094038.18610-1-harini.katakam@xilinx.com> <20210629094038.18610-4-harini.katakam@xilinx.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210629094038.18610-4-harini.katakam@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210629_071152_353799_CD260C2E X-CRM114-Status: GOOD ( 10.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > @@ -535,15 +535,16 @@ static int vsc85xx_rgmii_set_skews(struct phy_device *phydev, u32 rgmii_cntl, > u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1; > u16 reg_val = 0; > int rc; > + struct vsc8531_private *vsc8531 = phydev->priv; reverse christmass tree. > mutex_lock(&phydev->lock); > > if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || > phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) > - reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_rx_delay_pos; > + reg_val |= vsc8531->rx_delay << rgmii_rx_delay_pos; > if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || > phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) > - reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_tx_delay_pos; > + reg_val |= vsc8531->tx_delay << rgmii_tx_delay_pos; > > rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_2, > rgmii_cntl, > @@ -1820,6 +1821,17 @@ static int vsc85xx_config_init(struct phy_device *phydev) > { > int rc, i, phy_id; > struct vsc8531_private *vsc8531 = phydev->priv; > + struct device_node *of_node = phydev->mdio.dev.of_node; > + > + rc = of_property_read_u32(of_node, "vsc8531,rx-delay", > + &vsc8531->rx_delay); > + if (rc < 0) > + vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS; of_property_read_u32() is guaranteed not to touch the result value, if it is not in device tree. So you can simplify this to: vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS; of_property_read_u32(of_node, "vsc8531,rx-delay", &vsc8531->rx_delay); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel