[OpenWrt-Devel] [PATCH 1/3] kernel: rtl8366_smi: explicitly set phy addr for switch

Hauke Mehrtens hauke at hauke-m.de
Tue Oct 1 16:52:11 EDT 2019

On 10/1/19 4:36 PM, Linus Walleij wrote:
> On Thu, Aug 15, 2019 at 10:27 AM Serge Vasilugin <vasilugin at yandex.ru> wrote:
>> By default rtl8366_smi use phy addr 0 at mii-bus to access switch registers.
>> This patch allow to set it explicitly in dts-file:
>>         rtl8367 {
>>                 compatible = "realtek,rtl8367b";
>>                 phy_id = <29>; /* switch address at mii-bus */
>>                 realtek,extif2 = <1 0 1 1 1 1 1 1 2>;
>>                 mii-bus = <&mdio>;
>>                 cpu-port = <7>;
>>         }
>> Use default 0 address if not set.
>> Backward compatibility tested on tplink archer c2 v1 (rtl8367rb switch)
>> Signed-off-by: Serge Vasilugin <vasilugin at yandex.ru>
> Drive-by comment, but is there some chance that you could have a look
> at the DSA driver which is upstream and included in the v4.19 baseline
> in drivers/net/dsa/rtl8366.c realtek-smi.c etc?
> I haven't implemented 8367 variants because I have nothing to test it
> on, but I think it could be pretty straight forward just following the
> pattern set by rtl8366rb (which is all I have).
> In my mind it is just another plug-in below the smi driver, but alas
> things are never as simple as one think.
> Yours,
> Linus Walleij


I have a device with a rtl8367s connected via SGMII with 2.5GBit/s to a
MT7622, currently I plan to make it work with the OpenWrt driver first,
and with the upstream DSA driver later.

I have the vendor GPL driver / hardware abstraction layer and would like
to use that from user space to configure something and monitor what it
actually sends to the hardware. I haven't found a way yet in which the
SoC in the mt7622 allows me to send something onto the MDIO bus from
user space. I used this code as a base:
https://github.com/PieVo/mdio-tool/blob/master/mdio-tool.c which uses
SIOCSMIIREG and SIOCGMIIREG, but the PHY has to be up and should not use
a fixed link to make this work. Currently the kernel does not allow me
to send the data from the user space, does someone know how to do this?
I already specified many different phy-modes in the device tree.

This is the MAC driver I am using:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20191001/a26bf91e/attachment.sig>
-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list