From: Florian Fainelli <f.fainelli@gmail.com>
To: "Arınç ÜNAL" <arinc.unal@arinc9.com>
Cc: "Rafał Miłecki" <rafal@milecki.pl>,
"Hauke Mehrtens" <hauke@hauke-m.de>,
"Rob Herring" <robh+dt@kernel.org>,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
"Alvin Šipraga" <alsi@bang-olufsen.dk>
Subject: Re: [PATCH] ARM: dts: BCM5301X: Add DT for Asus RT-AC88U
Date: Wed, 22 Sep 2021 17:22:37 -0700 [thread overview]
Message-ID: <b26b86d9-a2d2-70b5-c06f-b4edba75de13@gmail.com> (raw)
In-Reply-To: <50b7d44c-614e-bf3a-00bc-bc8a1c5d353a@arinc9.com>
On 9/22/2021 3:26 PM, Arınç ÜNAL wrote:
> On 22/09/2021 21:15, Florian Fainelli wrote:
>> On 9/21/21 5:19 AM, Arınç ÜNAL wrote:
>>> Hardware Info
>>> -------------
>>>
>>> Processor - Broadcom BCM4709C0KFEBG dual-core @ 1.4 GHz
>>> Switch - BCM53012 in BCM4709C0KFEBG & external RTL8365MB
>>
>> There is no Device Tree description of the RTL8365MB switch, can it be
>> driven/controlled via MDIO, SPI or GPIOs by any chance? This is not a
>> show stopper for accepting the patch, just wondering if you are somehow
>> trying to get that switch controlled by the rtl8366 DSA driver as well?
>>
> There's a v1 patch on net-next adding DSA support for RTL8365MB by Alvin
> Šipraga, CC'ing them. There's also a v2 patch coming.
> https://lore.kernel.org/netdev/20210822193145.1312668-1-alvin@pqrs.dk/
>
> I've been mailing Alvin to figure out how to define it on the device
> tree. They have provided very useful information. Quoting a few:
>
> >> I'm trying to write the device tree to support this switch. I'm not
> sure
> >> whether the default GPIO IDs of mdc-gpios, mdio-gpios, reset-gpios &
> >> interrupts on realtek-smi.txt kernel documentation are correct.
> >>
> https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
>
> >
> > These gpios are just an example. It really depends how your board is
> > wired up. You have to figure out which SoC pad is wired to the MDC,
> > MDIO, and RESET pins on the RTL8365MB. Then you have to make sure the
> > pinmux is set up correctly so that these pads correspond to some GPIO
> > with a given ID, and then pick the right GPIO controller (&chipcommon?)
> > and put the ID after that. It will not necessarily be 21, 22, 14.
>
> > In summary:
> >
> > - figure out which pads are wired to MDC, MDIO, RESET
> > - figure out pinmux to make them into gpios
> > - figure out gpio ID and describe that in the device tree
> >
>
> I have backported the v1 patch to kernel 5.10 and tried an example
> definition on the device tree to test it out on RT-AC88U. It's on this
> branch:
> https://github.com/arinc9/openwrt/commits/realtek-work-asus_rt-ac88u
Your dsa,member proper looks reversed, you would want it to be:
dsa,member = <1 0>;
to indicate that these are indeed disjoint DSA trees with the tree being
1 and the switch being member 0 (the one and only). This part of the
driver/binding looks a bit weird too:
switch@1 {
+ compatible = "realtek,rtl8365mb";
+ /* 22 = MDIO (has input reads), 21 = MDC (clock, output only) */
+ mdc-gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>;
+ mdio-gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>;
+ reset-gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
this is clearly a MDIO-attached switch, so it should be a children of
the GPIO controller node. There is a hardware MDIO controller on the
BCM5301X so you should be able to avoid using bit-banging here and
instead using the BCM5301X's MDIO controller proper.
>
> It doesn't work as is, likely missing further configuration, which I'm
> clueless to figure out myself. I'd very appreciate it if you could weigh
> in.
>
> [ 1.598858] realtek-smi switch@1: failed to get RESET GPIO
> ---
> [ 3.015528] realtek-smi switch@1: deasserted RESET
> [ 3.021171] realtek-smi switch@1: found an RTL8365MB-VC switch
> (ver=0x0040)
> [ 3.028193] realtek-smi switch@1: unable to register switch ret = -517
> ---
> [ 3.405527] realtek-smi switch@1: deasserted RESET
> [ 3.411165] realtek-smi switch@1: found an RTL8365MB-VC switch
> (ver=0x0040)
> [ 3.418449] DSA: tree 0 already setup! Disjoint trees?
> [ 3.423607] realtek-smi switch@1: unable to register switch ret = -17
> [ 3.430137] realtek-smi: probe of switch@1 failed with error -17
>
> ---
>
> I was thinking, we figure out how to define it properly on the device
> tree and make the driver work whilst the v2 patch is applied to
> net-next. Then we could send another patch defining the switch on the
> device tree.
> There's the "compatible = "realtek,rtl8365mb";" property, which would be
> undefined until the driver is added.
That works for me, which is why I already applied your patch.
--
Florian
next prev parent reply other threads:[~2021-09-23 0:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-21 12:19 [PATCH] ARM: dts: BCM5301X: Add DT for Asus RT-AC88U Arınç ÜNAL
2021-09-22 18:15 ` Florian Fainelli
2021-09-22 22:26 ` Arınç ÜNAL
2021-09-23 0:22 ` Florian Fainelli [this message]
2021-09-24 8:50 ` Arınç ÜNAL
2021-09-24 16:32 ` Florian Fainelli
2021-09-24 21:02 ` Arınç ÜNAL
2021-09-24 21:20 ` Florian Fainelli
2021-09-24 21:44 ` Arınç ÜNAL
2021-09-22 18:37 ` Florian Fainelli
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=b26b86d9-a2d2-70b5-c06f-b4edba75de13@gmail.com \
--to=f.fainelli@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=arinc.unal@arinc9.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=hauke@hauke-m.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=rafal@milecki.pl \
--cc=robh+dt@kernel.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).