Re: [PATCH net-next] net: dsa: bcm_sf2: Ensure that MDIO diversion is used

2020-09-04 Thread Andrew Lunn
On Thu, Sep 03, 2020 at 09:00:13PM -0700, Florian Fainelli wrote:
> 
> 
> On 9/3/2020 3:03 PM, Andrew Lunn wrote:
> > > The firmware provides the Device Tree but here is the relevant section for
> > > you pasted below. The problematic device is a particular revision of the
> > > silicon (D0) which got later fixed (E0) however the Device Tree was 
> > > created
> > > after the fixed platform, not the problematic one. Both revisions of the
> > > silicon are in production.
> > > 
> > > There should have been an internal MDIO bus created for that chip revision
> > > such that we could have correctly parented phy@0 (bcm53125 below) as child
> > > node of the internal MDIO bus, but you have to realize that this was done
> > > back in 2014 when DSA was barely revived as an active subsystem. The
> > > BCM53125 node should have have been converted to an actual switch node at
> > > some point, I use a mdio_boardinfo overlay downstream to support the 
> > > switch
> > > as a proper b53/DSA switch, anyway.
> > 
> > I was expecting something like that. I think this patch needs a
> > comment in the code explaining it is a workaround for a DT blob which
> > cannot be changed. Maybe also make it conditional on the board
> > compatible string?
> 
> It is already targeted at the Broadcom pseudo PHY address (30) which is the
> one that needs diversion, I will update the patch description accordingly
> though.

O.K, looking at the patch, it was not clear to me it was already
restricted. 

Andrew


Re: [PATCH net-next] net: dsa: bcm_sf2: Ensure that MDIO diversion is used

2020-09-03 Thread Florian Fainelli




On 9/3/2020 3:03 PM, Andrew Lunn wrote:

The firmware provides the Device Tree but here is the relevant section for
you pasted below. The problematic device is a particular revision of the
silicon (D0) which got later fixed (E0) however the Device Tree was created
after the fixed platform, not the problematic one. Both revisions of the
silicon are in production.

There should have been an internal MDIO bus created for that chip revision
such that we could have correctly parented phy@0 (bcm53125 below) as child
node of the internal MDIO bus, but you have to realize that this was done
back in 2014 when DSA was barely revived as an active subsystem. The
BCM53125 node should have have been converted to an actual switch node at
some point, I use a mdio_boardinfo overlay downstream to support the switch
as a proper b53/DSA switch, anyway.


I was expecting something like that. I think this patch needs a
comment in the code explaining it is a workaround for a DT blob which
cannot be changed. Maybe also make it conditional on the board
compatible string?


It is already targeted at the Broadcom pseudo PHY address (30) which is 
the one that needs diversion, I will update the patch description 
accordingly though.

--
Florian


Re: [PATCH net-next] net: dsa: bcm_sf2: Ensure that MDIO diversion is used

2020-09-03 Thread Andrew Lunn
> The firmware provides the Device Tree but here is the relevant section for
> you pasted below. The problematic device is a particular revision of the
> silicon (D0) which got later fixed (E0) however the Device Tree was created
> after the fixed platform, not the problematic one. Both revisions of the
> silicon are in production.
> 
> There should have been an internal MDIO bus created for that chip revision
> such that we could have correctly parented phy@0 (bcm53125 below) as child
> node of the internal MDIO bus, but you have to realize that this was done
> back in 2014 when DSA was barely revived as an active subsystem. The
> BCM53125 node should have have been converted to an actual switch node at
> some point, I use a mdio_boardinfo overlay downstream to support the switch
> as a proper b53/DSA switch, anyway.

I was expecting something like that. I think this patch needs a
comment in the code explaining it is a workaround for a DT blob which
cannot be changed. Maybe also make it conditional on the board
compatible string?

Thanks
Andrew


Re: [PATCH net-next] net: dsa: bcm_sf2: Ensure that MDIO diversion is used

2020-09-02 Thread Florian Fainelli




On 9/2/2020 6:13 PM, Andrew Lunn wrote:

On Wed, Sep 02, 2020 at 02:03:27PM -0700, Florian Fainelli wrote:

Registering our slave MDIO bus outside of the OF infrastructure is
necessary in order to avoid creating double references of the same
Device Tree nodes, however it is not sufficient to guarantee that the
MDIO bus diversion is used because of_phy_connect() will still resolve
to a valid PHY phandle and it will connect to the PHY using its parent
MDIO bus which is still the SF2 master MDIO bus.

Ensure that of_phy_connect() does not suceed by removing any phandle
reference for the PHY we need to divert. This forces the DSA code to use
the DSA slave_mii_bus that we register and ensures the MDIO diversion is
being used.


Hi Florian

Sorry, i don't get this explanation. Can you point me towards a device
tree i can look at to maybe understand what is going on.
The firmware provides the Device Tree but here is the relevant section 
for you pasted below. The problematic device is a particular revision of 
the silicon (D0) which got later fixed (E0) however the Device Tree was 
created after the fixed platform, not the problematic one. Both 
revisions of the silicon are in production.


There should have been an internal MDIO bus created for that chip 
revision such that we could have correctly parented phy@0 (bcm53125 
below) as child node of the internal MDIO bus, but you have to realize 
that this was done back in 2014 when DSA was barely revived as an active 
subsystem. The BCM53125 node should have have been converted to an 
actual switch node at some point, I use a mdio_boardinfo overlay 
downstream to support the switch as a proper b53/DSA switch, anyway.


The problem is that of_phy_connect() for port@1 will resolve the 
phy-handle from the mdio@403c0 node, which bypasses the diversion 
completely. This results in this double programming that the diversion 
refers to. In order to force of_phy_connect() to fail, and have DSA call 
to dsa_slave_phy_connect(), we must deactivate ethernet-phy@0 from 
mdio@403c0, and the best way to do that is by removing the phandle 
property completely.


Hope this clarifies the mess :)


switch_top@f0b0 {
#address-cells = <0x01>;
#size-cells = <0x01>;
compatible = "brcm,bcm7445-switch-top-v2.0\0simple-bus";
ranges = <0x00 0xf0b0 0x40804>;

ethernet_switch@0 {
#address-cells = <0x02>;
#size-cells = <0x00>;
brcm,num-acb-queues = <0x40>;
brcm,num-gphy = <0x01>;
brcm,num-rgmii-ports = <0x02>;
compatible = 
"brcm,bcm7445-switch-v4.0\0brcm,bcm53012";
dsa,ethernet = <0x16>;
dsa,mii-bus = <0x17>;
resets = <0x18 0x1a>;
reset-names = "switch";
reg = <0x00 0x4 0x4 0x110 0x40340 0x30 0x40380 0x30 0x40400 
0x34 0x40600 0x208>;

reg-names = 
"core\0reg\0intrl2_0\0intrl2_1\0fcb\0acb";
interrupts = <0x00 0x18 0x04 0x00 0x19 0x04>;
interrupt-names = "switch_0\0switch_1";
brcm,fcb-pause-override;
brcm,acb-packets-inflight;
clocks = <0x0a 0x6d 0x0a 0x76>;
clock-names = "sw_switch\0sw_switch_mdiv";

ports {
#address-cells = <0x01>;
#size-cells = <0x00>;

port@0 {
phy-mode = "internal";
phy-handle = <0x29>;
linux,phandle = <0x2a>;
phandle = <0x2a>;
reg = <0x00>;
label = "gphy";
};

port@1 {
phy-mode = "rgmii-txid";
phy-handle = <0x2c>;
linux,phandle = <0x2d>;
phandle = <0x2d>;
reg = <0x01>;
label = "rgmii_1";
};

port@2 {
phy-mode = "rgmii-txid";

Re: [PATCH net-next] net: dsa: bcm_sf2: Ensure that MDIO diversion is used

2020-09-02 Thread Andrew Lunn
On Wed, Sep 02, 2020 at 02:03:27PM -0700, Florian Fainelli wrote:
> Registering our slave MDIO bus outside of the OF infrastructure is
> necessary in order to avoid creating double references of the same
> Device Tree nodes, however it is not sufficient to guarantee that the
> MDIO bus diversion is used because of_phy_connect() will still resolve
> to a valid PHY phandle and it will connect to the PHY using its parent
> MDIO bus which is still the SF2 master MDIO bus.
> 
> Ensure that of_phy_connect() does not suceed by removing any phandle
> reference for the PHY we need to divert. This forces the DSA code to use
> the DSA slave_mii_bus that we register and ensures the MDIO diversion is
> being used.

Hi Florian

Sorry, i don't get this explanation. Can you point me towards a device
tree i can look at to maybe understand what is going on.

 Andrew


Re: [PATCH net-next] net: dsa: bcm_sf2: Ensure that MDIO diversion is used

2020-09-02 Thread kernel test robot
Hi Florian,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-dsa-bcm_sf2-Ensure-that-MDIO-diversion-is-used/20200903-050536
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
dc1a9bf2c8169d9f607502162af1858a73a18cb8
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "of_remove_property" [drivers/net/dsa/bcm-sf2.ko] undefined!
ERROR: modpost: "__delay" [drivers/net/mdio/mdio-cavium.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip