public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: yanhong wang <yanhong.wang@starfivetech.com>
To: Simon Glass <sjg@chromium.org>
Cc: <u-boot@lists.denx.de>, Rick Chen <rick@andestech.com>,
	Leo <ycliang@andestech.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	"Ramon Fried" <rfried.dev@gmail.com>
Subject: Re: [PATCH v1 1/5] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy
Date: Mon, 20 Mar 2023 10:53:59 +0800	[thread overview]
Message-ID: <e1676a7e-6927-4ba0-650a-e9b9eb9e9f48@starfivetech.com> (raw)
In-Reply-To: <CAPnjgZ2VWh+cbD8L-G6iCmMv0YdaQrSFKqg1ObBHTQHJQT-UEA@mail.gmail.com>



On 2023/3/19 4:20, Simon Glass wrote:
> Hi Yanhong,
> 
> On Thu, 16 Mar 2023 at 19:06, Yanhong Wang
> <yanhong.wang@starfivetech.com> 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 <yanhong.wang@starfivetech.com>
>> ---
>>  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

  reply	other threads:[~2023-03-20  2:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  1:05 [PATCH v1 0/5] Add Ethernet driver for StarFive JH7110 SoC Yanhong Wang
2023-03-17  1:05 ` [PATCH v1 1/5] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy Yanhong Wang
2023-03-18 20:20   ` Simon Glass
2023-03-20  2:53     ` yanhong wang [this message]
2023-03-24  8:21     ` yanhong wang
2023-03-17  1:05 ` [PATCH v1 2/5] net: dwc_eth_qos: Add StarFive ethernet driver glue layer Yanhong Wang
2023-03-18 20:20   ` Simon Glass
2023-03-20  3:30     ` yanhong wang
2023-03-17  1:05 ` [PATCH v1 3/5] riscv: dts: jh7110: Add ethernet device tree nodes Yanhong Wang
2023-03-17  1:05 ` [PATCH v1 4/5] riscv: dts: starfive: Add phy clock delay configuration for StarFive VisionFive2 board Yanhong Wang
2023-03-17  1:05 ` [PATCH v1 5/5] configs: starfive: Enable ethernet configuration for StarFive VisionFive 2 Yanhong Wang
2023-03-24 12:53 ` [PATCH v1 0/5] Add Ethernet driver for StarFive JH7110 SoC Torsten Duwe
2023-03-27  2:22   ` yanhong wang
2023-03-27  8:09     ` Torsten Duwe

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=e1676a7e-6927-4ba0-650a-e9b9eb9e9f48@starfivetech.com \
    --to=yanhong.wang@starfivetech.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=rick@andestech.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    /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