Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1589343rwr; Wed, 26 Apr 2023 18:15:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5t/Zmb94SBfd4K46+aJzBQDxwB/R1UnIjgEZBwFyMp9MyiUbJ9sMnuhCH1wROBwi6e8P3N X-Received: by 2002:a05:6a20:3d01:b0:f6:9492:93c0 with SMTP id y1-20020a056a203d0100b000f6949293c0mr8135058pzi.29.1682558151850; Wed, 26 Apr 2023 18:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682558151; cv=none; d=google.com; s=arc-20160816; b=Stzu7s+ne7nPrlcfF/9TPz52BD6lMR7hZkZoFj1dBbEf3LmZTwSW4Ec06c9guxSDFo RopjuKCgwfxX+DY6rQL0T8HBavfyrds5JDFYEKCav0FnBMghg/OL4L3n5UqtWPFeS825 hlpqq0lo23yO5Yz6p4LVqtZe5Gb/8ZPoUqI1aCXU4vRgx5NG5CrtBK6602QuEjUGJb4g Rpg1WQQb2s6e/p2W0HFk27bl84wHJOreeMsTAHdRe2KOwdtXUp3HYJXu7rMnetDZJrzS vVUh8HCTwqK8vyhsl3Oat/mZ/7B3tUIpHPFiDCqrMniQPchUBx/GVh6dPXZ9joHQCVw9 jX3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Y79WHOur0tXYZTq5S+VoP17FNkWf9uvrUyuFGP+/Lpo=; b=wSf8MNcESSq454yHKzioFCBp5jYs/3uApg5RF5rtiX2sF8c0q7WJx6wPtwzNuNgcLJ VrrGErpczdT1GhbS1KhJVAAMRzTfXuF3JtUBVXDH19Hv0+JorxCGWewN+cREUM0ZXPdh wxaG5tqiWMQZP/anY7XPwCzg9h3/I5WXGxsgU9dtPVs3Oa+rCZiYKcTbxcob/ba5yBuv CEA5fV8mgUBuX1GmBwWvgdh1reHBuWmiDTQsSk7ZwkSaQ+hW0LQ6dcR+ueYaB340v0zg 67G5liEhjC2Xi0DE/PC1EuQMX1PusUgiP0sZqZEp87mCYn+seicFyF6BomDJE5hVMypV GHgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a63ee08000000b0051357734521si17493842pgi.604.2023.04.26.18.15.39; Wed, 26 Apr 2023 18:15:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242841AbjD0Az0 (ORCPT + 99 others); Wed, 26 Apr 2023 20:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233821AbjD0AzY (ORCPT ); Wed, 26 Apr 2023 20:55:24 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A043A92; Wed, 26 Apr 2023 17:55:23 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 615F924E1E4; Thu, 27 Apr 2023 08:55:16 +0800 (CST) Received: from EXMBX162.cuchost.com (172.16.6.72) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 27 Apr 2023 08:55:16 +0800 Received: from [192.168.120.42] (171.223.208.138) by EXMBX162.cuchost.com (172.16.6.72) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 27 Apr 2023 08:55:15 +0800 Message-ID: Date: Thu, 27 Apr 2023 08:55:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v1 2/2] net: phy: motorcomm: Add pad drive strength cfg support Content-Language: en-US To: Frank Sae , , , , Peter Geis CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , "Heiner Kallweit" , Russell King , Yanhong Wang References: <20230426063541.15378-1-samin.guo@starfivetech.com> <20230426063541.15378-3-samin.guo@starfivetech.com> <11f0641a-ef6c-eee8-79f3-45654ae006d5@motor-comm.com> From: Guo Samin In-Reply-To: <11f0641a-ef6c-eee8-79f3-45654ae006d5@motor-comm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS061.cuchost.com (172.16.6.21) To EXMBX162.cuchost.com (172.16.6.72) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Re: [PATCH v1 2/2] net: phy: motorcomm: Add pad drive strength cfg support From: Frank Sae to: Samin Guo , , , , Peter Geis data: 2023/4/26 > > > On 2023/4/26 14:35, Samin Guo wrote: >> The motorcomm phy (YT8531) supports the ability to adjust the drive >> strength of the rx_clk/rx_data, and the default strength may not be >> suitable for all boards. So add configurable options to better match >> the boards.(e.g. StarFive VisionFive 2) >> >> Signed-off-by: Samin Guo >> --- >> drivers/net/phy/motorcomm.c | 32 ++++++++++++++++++++++++++++++++ >> 1 file changed, 32 insertions(+) >> >> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c >> index 2fa5a90e073b..08f28ed83e60 100644 >> --- a/drivers/net/phy/motorcomm.c >> +++ b/drivers/net/phy/motorcomm.c >> @@ -236,6 +236,11 @@ >> */ >> #define YTPHY_WCR_TYPE_PULSE BIT(0) >> >> +#define YTPHY_PAD_DRIVE_STRENGTH_REG 0xA010 >> +#define YTPHY_RGMII_RXC_DS GENMASK(15, 13) >> +#define YTPHY_RGMII_RXD_DS GENMASK(5, 4) /* Bit 1 and 0 of rgmii_rxd_ds */ >> +#define YTPHY_RGMII_RXD_DS2 BIT(12) /* Bit 2 of rgmii_rxd_ds */ >> + > > Please change YTPHY_RGMII_XXX to YT8531_RGMII_XXX. YT8521's reg (0xA010) is not same as this. > Keep bit order. will fix. > >> #define YTPHY_SYNCE_CFG_REG 0xA012 >> #define YT8521_SCR_SYNCE_ENABLE BIT(5) >> /* 1b0 output 25m clock >> @@ -1495,6 +1500,7 @@ static int yt8531_config_init(struct phy_device *phydev) >> { >> struct device_node *node = phydev->mdio.dev.of_node; >> int ret; >> + u32 val; >> >> ret = ytphy_rgmii_clk_delay_config_with_lock(phydev); >> if (ret < 0) >> @@ -1518,6 +1524,32 @@ static int yt8531_config_init(struct phy_device *phydev) >> return ret; >> } >> >> + if (!of_property_read_u32(node, "rx-clk-driver-strength", &val)) { > > Please check the val of "val", add the handle of default value. > Will fix it in the next version, thanks. >> + ret = ytphy_modify_ext_with_lock(phydev, >> + YTPHY_PAD_DRIVE_STRENGTH_REG, >> + YTPHY_RGMII_RXC_DS, >> + FIELD_PREP(YTPHY_RGMII_RXC_DS, val)); >> + if (ret < 0) >> + return ret; >> + } >> + >> + if (!of_property_read_u32(node, "rx-data-driver-strength", &val)) { >> + if (val > FIELD_MAX(YTPHY_RGMII_RXD_DS)) { >> + val &= FIELD_MAX(YTPHY_RGMII_RXD_DS); >> + val = FIELD_PREP(YTPHY_RGMII_RXD_DS, val); >> + val |= YTPHY_RGMII_RXD_DS2; >> + } else { >> + val = FIELD_PREP(YTPHY_RGMII_RXD_DS, val); >> + } >> + >> + ret = ytphy_modify_ext_with_lock(phydev, >> + YTPHY_PAD_DRIVE_STRENGTH_REG, >> + YTPHY_RGMII_RXD_DS | YTPHY_RGMII_RXD_DS2, >> + val); >> + if (ret < 0) >> + return ret; >> + } >> + >> return 0; >> } >>