Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F2B5C6FD1F for ; Mon, 20 Mar 2023 02:54:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3FE5E83A35; Mon, 20 Mar 2023 03:54:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 336C785283; Mon, 20 Mar 2023 03:54:09 +0100 (CET) Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by phobos.denx.de (Postfix) with ESMTP id 72BF083A1A for ; Mon, 20 Mar 2023 03:54:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=yanhong.wang@starfivetech.com Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 90D0324E287; Mon, 20 Mar 2023 10:54:01 +0800 (CST) Received: from EXMBX073.cuchost.com (172.16.6.83) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 20 Mar 2023 10:54:01 +0800 Received: from [192.168.120.49] (171.223.208.138) by EXMBX073.cuchost.com (172.16.6.83) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 20 Mar 2023 10:54:00 +0800 Message-ID: Date: Mon, 20 Mar 2023 10:53:59 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v1 1/5] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy To: Simon Glass CC: , Rick Chen , Leo , Joe Hershberger , "Ramon Fried" References: <20230317010536.17860-1-yanhong.wang@starfivetech.com> <20230317010536.17860-2-yanhong.wang@starfivetech.com> Content-Language: en-US From: yanhong wang In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX073.cuchost.com (172.16.6.83) X-YovoleRuleAgent: yovoleflag X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 2023/3/19 4:20, Simon Glass wrote: > Hi Yanhong, > > On Thu, 16 Mar 2023 at 19:06, Yanhong Wang > wrote: >> >> Add a driver for the motorcomm yt8531 gigabit ethernet phy. We have >> verified the driver on StarFive VisionFive2 board. >> >> Signed-off-by: Yanhong Wang >> --- >> drivers/net/phy/Kconfig | 6 + >> drivers/net/phy/Makefile | 1 + >> drivers/net/phy/motorcomm.c | 409 ++++++++++++++++++++++++++++++++++++ >> drivers/net/phy/phy.c | 4 +- >> include/phy.h | 1 + >> 5 files changed, 420 insertions(+), 1 deletion(-) >> create mode 100644 drivers/net/phy/motorcomm.c >> >> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig >> index 5eaff053a0..aba718566a 100644 >> --- a/drivers/net/phy/Kconfig >> +++ b/drivers/net/phy/Kconfig >> @@ -212,6 +212,12 @@ config PHY_MICREL_KSZ8XXX >> >> endif # PHY_MICREL >> >> +config PHY_MOTORCOMM >> + tristate "Motorcomm PHYs" >> + help >> + Enables support for Motorcomm network PHYs. >> + Currently supports the YT8531 Gigabit Ethernet PHYs. >> + >> config PHY_MSCC >> bool "Microsemi Corp Ethernet PHYs support" >> >> diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile >> index d38e99e717..e9523fed2e 100644 >> --- a/drivers/net/phy/Makefile >> +++ b/drivers/net/phy/Makefile >> @@ -23,6 +23,7 @@ obj-$(CONFIG_PHY_MARVELL) += marvell.o >> obj-$(CONFIG_PHY_MICREL_KSZ8XXX) += micrel_ksz8xxx.o >> obj-$(CONFIG_PHY_MICREL_KSZ90X1) += micrel_ksz90x1.o >> obj-$(CONFIG_PHY_MESON_GXL) += meson-gxl.o >> +obj-$(CONFIG_PHY_MOTORCOMM) += motorcomm.o >> obj-$(CONFIG_PHY_NATSEMI) += natsemi.o >> obj-$(CONFIG_PHY_NXP_C45_TJA11XX) += nxp-c45-tja11xx.o >> obj-$(CONFIG_PHY_NXP_TJA11XX) += nxp-tja11xx.o >> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c >> new file mode 100644 >> index 0000000000..c7e44cfb63 >> --- /dev/null >> +++ b/drivers/net/phy/motorcomm.c >> @@ -0,0 +1,409 @@ >> +// SPDX-License-Identifier: GPL-2.0+ >> +/* > > [..] > >> +static u32 ytphy_get_delay_reg_value(struct phy_device *phydev, >> + const char *prop_name, >> + const struct ytphy_cfg_reg_map *tbl, >> + int tb_size, >> + u16 *rxc_dly_en, >> + u32 dflt) >> +{ >> + int tb_size_half = tb_size / 2; >> + u32 val; >> + int i; >> + >> + if (ofnode_read_u32(phydev->node, prop_name, &val)) >> + goto err_dts_val; > > Please move to your ofdata_to_plat() method. > > Also, use dev_read_u32() when you have a device. > > [.] > Thanks. I will define a platform data structure for saving device-related configurations in the next version. >> +static int yt8531_startup(struct phy_device *phydev) >> +{ >> + bool tx_clk_adj_enabled = false; >> + bool tx_clk_1000_inverted = false; >> + bool tx_clk_100_inverted = false; >> + bool tx_clk_10_inverted = false; >> + u16 val = 0; >> + int ret; >> + >> + ret = genphy_update_link(phydev); >> + if (ret) >> + return ret; >> + >> + ret = yt8531_parse_status(phydev); >> + if (ret) >> + return ret; >> + >> + if (ofnode_read_bool(phydev->node, "motorcomm,tx-clk-adj-enabled")) >> + tx_clk_adj_enabled = true; > > priv->tx_clk_adj_enabled = ofnode_read_bool(...) > > Please fix globally > Ok. I will fixed. > Regards, > Simon