netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
To: "David.Wu" <david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: "Corentin Labbe"
	<clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Florian Fainelli"
	<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Andrew Lunn" <andrew-g2DYL2Zd6BY@public.gmane.org>,
	"David Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	"Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	"Rob Herring" <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Mark Rutland" <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	"Catalin Marinas" <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
	"Will Deacon" <will.deacon-5wv7dgnIgG8@public.gmane.org>,
	"Olof Johansson" <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	"Russell King" <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
	"Arnd Bergmann" <arnd-r2nGTMty4D4@public.gmane.org>,
	"Tao Huang" <huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	hwg-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	alexandre.torgue-qxv4g6HH51o@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"Giuseppe Cavallaro" <peppe.cavallaro@s>
Subject: Re: [PATCH v3 05/11] net: stmmac: dwmac-rk: Add internal phy support
Date: Thu, 10 Aug 2017 10:40:10 +0800	[thread overview]
Message-ID: <CAGb2v66ZG3Ct1aFBOXQd8vkMCF-UNk7bN-vsXasbe_j5FexENw@mail.gmail.com> (raw)
In-Reply-To: <a9fae87c-9df5-a250-5bc1-230be4af15cd-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

Hi David,

On Wed, Aug 9, 2017 at 5:38 PM, David.Wu <david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org> wrote:
> Hello Corentin, Chen-Yu
>
>
> 在 2017/8/9 16:45, Corentin Labbe 写道:
>>
>> On Thu, Aug 03, 2017 at 07:06:33PM +0800, Chen-Yu Tsai wrote:
>>>
>>> On Thu, Aug 3, 2017 at 1:38 AM, Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>> wrote:
>>>>
>>>> On 08/01/2017 11:21 PM, David Wu wrote:
>>>>>
>>>>> To make internal phy work, need to configure the phy_clock,
>>>>> phy cru_reset and related registers.
>>>>>
>>>>> Signed-off-by: David Wu <david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>>>>> ---
>>>>>   .../devicetree/bindings/net/rockchip-dwmac.txt     |  6 +-
>>>>>   drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 81
>>>>> ++++++++++++++++++++++
>>>>>   2 files changed, 86 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.txt
>>>>> b/Documentation/devicetree/bindings/net/rockchip-dwmac.txt
>>>>> index 8f42755..ec39b31 100644
>>>>> --- a/Documentation/devicetree/bindings/net/rockchip-dwmac.txt
>>>>> +++ b/Documentation/devicetree/bindings/net/rockchip-dwmac.txt
>>>>> @@ -25,7 +25,8 @@ Required properties:
>>>>>    - clock-names: One name for each entry in the clocks property.
>>>>>    - phy-mode: See ethernet.txt file in the same directory.
>>>>>    - pinctrl-names: Names corresponding to the numbered pinctrl states.
>>>>> - - pinctrl-0: pin-control mode. can be <&rgmii_pins> or <&rmii_pins>.
>>>>> + - pinctrl-0: pin-control mode. can be <&rgmii_pins>, <&rmii_pins> or
>>>>> led pins
>>>>> +   for internal phy mode.
>>>>>    - clock_in_out: For RGMII, it must be "input", means main
>>>>> clock(125MHz)
>>>>>      is not sourced from SoC's PLL, but input from PHY; For RMII,
>>>>> "input" means
>>>>>      PHY provides the reference clock(50MHz), "output" means GMAC
>>>>> provides the
>>>>> @@ -40,6 +41,9 @@ Optional properties:
>>>>>    - tx_delay: Delay value for TXD timing. Range value is 0~0x7F, 0x30
>>>>> as default.
>>>>>    - rx_delay: Delay value for RXD timing. Range value is 0~0x7F, 0x10
>>>>> as default.
>>>>>    - phy-supply: phandle to a regulator if the PHY needs one
>>>>> + - clocks: <&cru MAC_PHY>: Clock selector for internal macphy
>>>>> + - phy-is-internal: A boolean property allows us to know that MAC will
>>>>> connect to
>>>>> +   internal phy.
>>>>
>>>>
>>>> This is incorrect in two ways:
>>>>
>>>> - this is a property of the PHY, so it should be documented as such in
>>>> Documentation/devicetree/bindings/net/phy.txt so other bindings can
>>>> re-use it
>>>>
>>>> - if it was specific to your MAC you would expect a vendor prefix to
>>>> this property, which is not there
>>>>
>>>> An alternative way to implement the external/internal logic selection
>>>> would be mandate that your Ethernet PHY node have a compatible string
>>>> like this:
>>>>
>>>> phy@0 {
>>>>          compatible = "ethernet-phy-id1234.d400",
>>>> "ethernet-phy-802.3-c22";
>>>> };
>>>>
>>>> Then you don't need this phy-is-internal property, because you can
>>>> locate the PHY node by the phy-handle (see more about that in a reply to
>>>> patch 10) and you can determine ahead of time whether this PHY is
>>>> internal or not based on its compatible string.
>>>
>>>
>>> This doesn't really work for us (sunxi). The "internal" PHY of the H3
>>> is also available in the X-Powers AC200 combo chip, which would be
>>> external. Same ID. So if someone were to be stupid and put the two
>>> together, you wouldn't know which one it actually is. Generically
>>> it doesn't make sense to match against the ID either. The PHY is
>>> only integrated or inlined into the SoC, meaning it could be moved
>>> elsewhere or even be a discreet part.
>>>
>>> The way I see it is more like a reversed pinmux. The system should
>>> select either the internal set or external set of xMII pins to use.
>>>
>>> A phy-is-internal property in the PHY node would work for us. We
>>> already need a PHY node to describe its clocks and resets.
>>>
>>> A side note to this solution is that, since the internal PHY is defined
>>> at the .dtsi level, any external PHYs at the same address would need to
>>> make sure to delete the property, which is kind of counterintuitive, but
>>> it is how device tree works. One would want to put the internal PHY's
>>> address, assuming it is configurable, on something that is rarely used.
>>>
>>
>> Hello David, Florian, Andrew
>>
>> Could someone ack this ? or nack if you think that the chance for having
>> two PHY id both internal and external is too low.
>> Anyway, we need a choice.
>>
>
> I think we should be specific to the situation, for us we have the
> possibility that the Mac only picks up internal PHY, so this can be fixed at
> the. DTSi level, also possible INTERNL PHY's Mac can also be used to connect
> external PHY, while cutting off the connection with the internal PHY, so we
> should define the internal PHY at the DTS level, so I think Florian's
> approach is acceptable.

So it looks like you have the clock for the internal/integrated PHY at the
MAC level. I think this lets you define/add the PHY at the board level more
easily without a lot of duplication?

Sunxi has the clock and reset in the PHY node, which is defined in the dtsi
file. (This part is already done.)

ChenYu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-08-10  2:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02  6:15 [PATCH v3 00/11] Add the internal phy support David Wu
2017-08-02  6:15 ` [PATCH v3 01/11] net: phy: Add rockchip phy driver support David Wu
2017-08-02  6:20   ` Corentin Labbe
2017-08-02 13:21   ` Andrew Lunn
2017-08-09  7:01     ` David.Wu
2017-08-02  6:15 ` [PATCH v3 02/11] multi_v7_defconfig: Make rockchip phy built-in David Wu
2017-08-02  6:15 ` [PATCH v3 03/11] arm64: defconfig: Enable CONFIG_ROCKCHIP_PHY David Wu
2017-08-02  6:15 ` [PATCH v3 04/11] net: stmmac: dwmac-rk: Remove unwanted code for rk3328_set_to_rmii() David Wu
2017-08-02  6:22 ` [PATCH v3 06/11] net: stmmac: dwmac-rk: Add internal phy support for rk3228 David Wu
2017-08-02  6:24 ` [PATCH v3 09/11] ARM: dts: rk3228-evb: Enable the internal phy for gmac David Wu
     [not found] ` <1501654546-17292-1-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-08-02  6:21   ` [PATCH v3 05/11] net: stmmac: dwmac-rk: Add internal phy support David Wu
     [not found]     ` <1501654888-19514-1-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-08-02 17:38       ` Florian Fainelli
2017-08-03 11:06         ` Chen-Yu Tsai
2017-08-09  8:45           ` Corentin Labbe
2017-08-09  9:38             ` David.Wu
     [not found]               ` <a9fae87c-9df5-a250-5bc1-230be4af15cd-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-08-10  2:40                 ` Chen-Yu Tsai [this message]
2017-08-10  7:48                   ` David.Wu
2017-08-09 22:42             ` Florian Fainelli
2017-08-03 14:02         ` David.Wu
2017-08-02  6:23   ` [PATCH v3 07/11] net: stmmac: dwmac-rk: Add internal phy supprot for rk3328 David Wu
2017-08-02  6:23   ` [PATCH v3 08/11] ARM: dts: rk322x: Add support internal phy for gmac David Wu
2017-08-02  6:24   ` [PATCH v3 10/11] ARM64: dts: rockchip: Add gmac2phy node support for rk3328 David Wu
     [not found]     ` <1501655097-21054-1-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-08-02 11:49       ` Sergei Shtylyov
2017-08-02 17:40     ` Florian Fainelli
2017-08-02  6:26   ` [PATCH v3 11/11] ARM64: dts: rockchip: Enable gmac2phy for rk3328-evb 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=CAGb2v66ZG3Ct1aFBOXQd8vkMCF-UNk7bN-vsXasbe_j5FexENw@mail.gmail.com \
    --to=wens-jday2fn1rrm@public.gmane.org \
    --cc=alexandre.torgue-qxv4g6HH51o@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=hwg-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=peppe.cavallaro@s \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).