From: David Wu <david.wu@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [PATCH 3/8] net: dwc_eth_qos: Add option "snps,reset-gpio" phy-rst gpio for stm32
Date: Sat, 9 May 2020 10:59:26 +0800 [thread overview]
Message-ID: <313a9f42-57af-5a35-e2fc-6ac831fb4475@rock-chips.com> (raw)
In-Reply-To: <78711f22-8c04-03f1-ce93-23420165e3ee@st.com>
Hi Patrice,
? 2020/4/30 ??11:47, Patrice CHOTARD ??:
>> @@ -701,6 +702,15 @@ static int eqos_start_resets_stm32(struct udevice *dev)
>>
>> debug("%s(dev=%p):\n", __func__, dev);
>> if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
>> + ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 0);
>> + if (ret < 0) {
>> + pr_err("dm_gpio_set_value(phy_reset, deassert) failed: %d",
>> + ret);
>> + return ret;
>> + }
>> +
>> + udelay(eqos->reset_delays[0]);
>> +
> not related to this patch subject
>> ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 1);
>> if (ret < 0) {
>> pr_err("dm_gpio_set_value(phy_reset, assert) failed: %d",
>> @@ -708,7 +718,7 @@ static int eqos_start_resets_stm32(struct udevice *dev)
>> return ret;
>> }
>>
>> - udelay(2);
>> + udelay(eqos->reset_delays[1]);
>>
>> ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 0);
>> if (ret < 0) {
>> @@ -1712,11 +1724,29 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
>> if (ret)
>> pr_warn("gpio_request_by_name(phy reset) not provided %d",
>> ret);
>> + else
>> + eqos->reset_delays[1] = 2;
> this is not the correct place to set default value. It must be set in case we can't get value from DT below
No, three cases below, it is second case, and we can see udelay(2) in
eqos_start_resets_stm32(), here we are to be compatible with the original.
- If there is not phy rst, reset_delays is 0;
- If "reset-gpios exists in phy node, reset_delays [1] = 2;
- "snps, reset-gpio" exists in DT, reset_delays is obtained from DT
>>
>> eqos->phyaddr = ofnode_read_u32_default(phandle_args.node,
>> "reg", -1);
>> }
>>
>> + if (!dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
>> + int reset_flags = GPIOD_IS_OUT;
>> +
>> + if (dev_read_bool(dev, "snps,reset-active-low"))
>> + reset_flags |= GPIOD_ACTIVE_LOW;
>> +
>> + ret = gpio_request_by_name(dev, "snps,reset-gpio", 0,
>> + &eqos->phy_reset_gpio, reset_flags);
>> + if (ret == 0)
>> + ret = dev_read_u32_array(dev, "snps,reset-delays-us",
>> + eqos->reset_delays, 3);
> in case "snps,reset-delays-us" is not in present DT, all resets-delays are set to 0, see my remark above
>> + else
>> + pr_warn("gpio_request_by_name(snps,reset-gpio) failed: %d",
>> + ret);
>> + }
>> +
>> debug("%s: OK\n", __func__);
>> return 0;
>>
next prev parent reply other threads:[~2020-05-09 2:59 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 10:36 [PATCH 0/8] Add dwc_eth_qos support for rockchip David Wu
2020-04-30 10:36 ` [PATCH 1/8] net: dwc_eth_qos: Use dev_ functions calls to get FDT data David Wu
2020-04-30 10:36 ` [PATCH 2/8] net: dwc_eth_qos: Fix the software reset David Wu
2020-04-30 15:28 ` Patrice CHOTARD
2020-04-30 22:25 ` Stephen Warren
2020-04-30 10:36 ` [PATCH 3/8] net: dwc_eth_qos: Add option "snps, reset-gpio" phy-rst gpio for stm32 David Wu
2020-04-30 15:47 ` [PATCH 3/8] net: dwc_eth_qos: Add option "snps,reset-gpio" " Patrice CHOTARD
2020-05-09 2:59 ` David Wu [this message]
2020-04-30 22:36 ` [PATCH 3/8] net: dwc_eth_qos: Add option "snps, reset-gpio" " Stephen Warren
2020-04-30 22:42 ` Stephen Warren
2020-05-09 2:41 ` David Wu
2020-05-09 3:32 ` David Wu
2020-04-30 10:36 ` [PATCH 4/8] net: dwc_eth_qos: Move interface() to eqos_ops struct David Wu
2020-04-30 22:39 ` Stephen Warren
2020-05-09 3:22 ` David Wu
2020-04-30 10:43 ` [PATCH 5/8] net: dwc_eth_qos: Make clk_rx and clk_tx optional David Wu
2020-04-30 14:00 ` Patrice CHOTARD
2020-05-09 6:31 ` David Wu
2020-04-30 22:45 ` Stephen Warren
2020-05-09 6:33 ` David Wu
2020-04-30 10:44 ` [PATCH 6/8] net: dwc_eth_qos: Split eqos_start() to get link speed David Wu
2020-04-30 15:33 ` Patrice CHOTARD
2020-05-09 6:42 ` David Wu
2020-05-11 12:48 ` Patrice CHOTARD
2020-05-12 1:56 ` David Wu
2020-04-30 10:45 ` [PATCH 7/8] net: dwc_eth_qos: Export common struct and interface at head file David Wu
2020-04-30 12:06 ` Patrice CHOTARD
2020-04-30 22:47 ` Stephen Warren
2020-04-30 10:45 ` [PATCH 8/8] net: gmac_rockchip: Add dwc_eth_qos support David Wu
2020-04-30 22:52 ` Stephen Warren
2020-05-09 6:56 ` David Wu
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=313a9f42-57af-5a35-e2fc-6ac831fb4475@rock-chips.com \
--to=david.wu@rock-chips.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.