mbox series

[v9,0/8] Add MV88E6xxx DSA driver and use on gwventana

Message ID 20221130174251.82087-1-tharvey@gateworks.com
Headers show
Series Add MV88E6xxx DSA driver and use on gwventana | expand

Message

Tim Harvey Nov. 30, 2022, 5:42 p.m. UTC
This series adds a DSA driver for the MV88E6xxx based on
drivers/net/phy/mv88e61xx and uses it in the gwventana_gw5904_defconfig.

The hope is that the other three boards that use the MV88E61xx driver
can move to this as well eventually so that we can remove the non-dm
driver and the 4 Kconfig options it requires.

The MV88E6xxx has an MDIO interface thus DM_MDIO must be used so support
for a UCLASS_MDIO driver is added to the fec_mxc ethernet driver in a
way that allows a fallback to the previous non DM_MDIO case as there are
many boards out there using this driver that define DM_MDIO but do not
have the required dt props for a DM_MDIO driver which would cause a
regression.

Additionally some other patches are here suggested by Vladimir:
 - ensure MDIO children are scanned on post-bind is needed
 - sanity check DSA driver required ops are present
 - allow DSA drivers to not require xmit/recv functions
 - remove unecessary xmit/recv functions from ksz9477 driver

v9:
 - fix regression in dsa xmit() logic for patch 4:
   net: dsa: allow rcv() and xmit() to be optional

v8:
 - en remove energy-detect low-power mode config
 - add phy-mode internal dt prop to phy ports

v7:
 - rebase on master
 - update commit short msg (s/MV88E61xx/MV88E6xxx)
 - replace inline smi_cmd* with macros using logical operators
 - replace bitfield_replace with logical operators for readibility
 - removed some unused register definitions
 - config switch based SERDES mode once in probe vs port_enable
 - rework port_enable to clean up and:
  - enable energy-detect for all non fixed PHY ports
  - configure RGMII delays based on interface type
 - add Vladimir's rb tag to patch 8

v6:
 - update commit messages
 - squash accidently change to mv88e6xxx driver into previous patch
 - remove unused dt label for cpu port
 - removed unnecessary semicolon
 - update commit msg (s/MV88E61xx/MV88E6xxx)
 - remove GbE from commit msg and Kconfig desc
 - squash accidental change from patch 7 into patch 6
 - added error print on failure to read switch id
 - mv88e6xxx_probe:
  - check for switch enabled
  - remove unused variable enabled
  - remove unnecessary call to dsa_set_tagging
 - port_probe:
  - new function to configure phy features by calling phy_config
 - port_enable:
  - only enable energy-detect sensing on phy ports
  - add phy/cmode verification mistmatch warning
  - remove mv88e6xxx_fixed_port_setup()
  - always force link up for fixed ports
  - always set SERDES mode regardless of cpu port
  - remove unnecessary setting of CPUDEST
 - port_disable:
  - remove pointless error check
 - removed unnecessary priv data for mdio controller
 - fix indentation
 - change variable name for clarity

v5:
 - fix typo in defconfig update
 - added support for MV88E6320
 - added Fabio's rb tag

v4:
 - use standard Linux internal MDIO dt structure
 - use PHY_FIXED_ID define
 - rename to mv88e6xxx
 - sort includes alphabetically
 - remove dsa term from function names
 - reduce indentation level and remove unecessary code in of probe_mdio
   function
 - rename pdev to mdev to represent mdio device

v3:
 - fix mdios node in dt
 - add Vladimir's rb tag's

v2:
 - added Ramon's rb tag's to first two patches
 - add patches for dsa-uclass to sanity check ops and make xmit/recv
   optional
 - fec: fix fallback for non conforming DM_MDIO dts
 - mv88e61xx:
  - rebase on v2022.07-rc2 (use ofnode_get_phy_node)
  - remove unused commented out fields from struct
  - remove unused PORT_MASK macro
  - remove phy from priv struct name
  - refactor code from original drivers/net/phy/mv88e61xx with
    suggestions from review to consolidate some functions
    into mv88e61xx_dsa_port_enable
  - remove unecessary skiping of disabling of CPU port
  - remove unecessary dev_set_parent_priv
  - remove unnecessary static init flag
  - replace debug with a dev_warn if switch device-id unsupported
  - remove unnecessary xmit/recv functions as we rely on the fact that
    only a single port is active instead of mangling packets

Tested on a Gateworks GW5904 which has a Marvell 88E6176 switch hanging
off the IMX6 FEC.

Best Regards,

Tim

Tim Harvey (8):
  net: mdio-uclass: scan for dm mdio children on post-bind
  net: dsa: move cpu port probe to dsa_post_probe
  net: dsa: ensure dsa driver has proper ops
  net: dsa: allow rcv() and xmit() to be optional
  net: ksz9477: remove unnecessary xmit and recv functions
  net: fec: add support for DM_MDIO
  net: add MV88E6xxx DSA driver
  board: gw_ventana: enable MV88E61XX DSA support

 arch/arm/dts/imx6qdl-gw5904.dtsi        |  36 +-
 board/gateworks/gw_ventana/gw_ventana.c |  50 +-
 configs/gwventana_gw5904_defconfig      |   7 +-
 drivers/net/Kconfig                     |   7 +
 drivers/net/Makefile                    |   1 +
 drivers/net/fec_mxc.c                   |  90 ++-
 drivers/net/ksz9477.c                   |  23 -
 drivers/net/mv88e6xxx.c                 | 755 ++++++++++++++++++++++++
 net/dsa-uclass.c                        |  56 +-
 net/mdio-uclass.c                       |   4 +
 10 files changed, 953 insertions(+), 76 deletions(-)
 create mode 100644 drivers/net/mv88e6xxx.c

Comments

Vladimir Oltean Nov. 30, 2022, 10:30 p.m. UTC | #1
On Wed, Nov 30, 2022 at 09:42:43AM -0800, Tim Harvey wrote:
> This series adds a DSA driver for the MV88E6xxx based on
> drivers/net/phy/mv88e61xx and uses it in the gwventana_gw5904_defconfig.

I can't apply the patches on the current master, am I doing something wrong?

$ git reset --hard origin/master

$ git am ~/incoming/*
Applying: net: mdio-uclass: scan for dm mdio children on post-bind
Applying: net: dsa: move cpu port probe to dsa_post_probe
Applying: net: dsa: ensure dsa driver has proper ops
Applying: net: dsa: allow rcv() and xmit() to be optional
Applying: net: ksz9477: remove unnecessary xmit and recv functions
Applying: net: fec: add support for DM_MDIO
Applying: net: add MV88E6xxx DSA driver
Applying: board: gw_ventana: enable MV88E61XX DSA support
error: patch failed: arch/arm/dts/imx6qdl-gw5904.dtsi:212
error: arch/arm/dts/imx6qdl-gw5904.dtsi: patch does not apply
error: patch failed: board/gateworks/gw_ventana/gw_ventana.c:83
error: board/gateworks/gw_ventana/gw_ventana.c: patch does not apply
error: patch failed: configs/gwventana_gw5904_defconfig:110
error: configs/gwventana_gw5904_defconfig: patch does not apply
Patch failed at 0008 board: gw_ventana: enable MV88E61XX DSA support
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

$ git remote show origin
* remote origin
  Fetch URL: https://source.denx.de/u-boot/u-boot.git
  Push  URL: https://source.denx.de/u-boot/u-boot.git

$ git show origin/master
commit 39b81955d38c11254b455322b9d98e07010049d6 (origin/master)
Merge: 597e7b784dbf 5e6c069b2c6b
Author: Tom Rini <trini@konsulko.com>
Date:   Mon Nov 28 13:12:40 2022 -0500

    Merge branch '2022-11-28-networking-updates-and-improvements'

    - LiteX Ethernet support, dwc_eth_qos fixes, re-work fixing
      CVE-2022-{30790,30552}, macb race fix, Intel XWAY PHY support
      and add wget command and TCP support.
Tim Harvey Nov. 30, 2022, 11:27 p.m. UTC | #2
On Wed, Nov 30, 2022 at 2:30 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> On Wed, Nov 30, 2022 at 09:42:43AM -0800, Tim Harvey wrote:
> > This series adds a DSA driver for the MV88E6xxx based on
> > drivers/net/phy/mv88e61xx and uses it in the gwventana_gw5904_defconfig.
>
> I can't apply the patches on the current master, am I doing something wrong?
>
> $ git reset --hard origin/master
>
> $ git am ~/incoming/*
> Applying: net: mdio-uclass: scan for dm mdio children on post-bind
> Applying: net: dsa: move cpu port probe to dsa_post_probe
> Applying: net: dsa: ensure dsa driver has proper ops
> Applying: net: dsa: allow rcv() and xmit() to be optional
> Applying: net: ksz9477: remove unnecessary xmit and recv functions
> Applying: net: fec: add support for DM_MDIO
> Applying: net: add MV88E6xxx DSA driver
> Applying: board: gw_ventana: enable MV88E61XX DSA support
> error: patch failed: arch/arm/dts/imx6qdl-gw5904.dtsi:212
> error: arch/arm/dts/imx6qdl-gw5904.dtsi: patch does not apply
> error: patch failed: board/gateworks/gw_ventana/gw_ventana.c:83
> error: board/gateworks/gw_ventana/gw_ventana.c: patch does not apply
> error: patch failed: configs/gwventana_gw5904_defconfig:110
> error: configs/gwventana_gw5904_defconfig: patch does not apply
> Patch failed at 0008 board: gw_ventana: enable MV88E61XX DSA support
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
>
> $ git remote show origin
> * remote origin
>   Fetch URL: https://source.denx.de/u-boot/u-boot.git
>   Push  URL: https://source.denx.de/u-boot/u-boot.git
>
> $ git show origin/master
> commit 39b81955d38c11254b455322b9d98e07010049d6 (origin/master)
> Merge: 597e7b784dbf 5e6c069b2c6b
> Author: Tom Rini <trini@konsulko.com>
> Date:   Mon Nov 28 13:12:40 2022 -0500
>
>     Merge branch '2022-11-28-networking-updates-and-improvements'
>
>     - LiteX Ethernet support, dwc_eth_qos fixes, re-work fixing
>       CVE-2022-{30790,30552}, macb race fix, Intel XWAY PHY support
>       and add wget command and TCP support.

That's the same head that I based them off of and I just did the
following and it worked fine:
cd /tmp
git clone git://git.denx.de/u-boot.git
cd u-boot
wget https://patchwork.ozlabs.org/series/330704/mbox/ -O mbox
git am mbox

Looks like only the last patch failed right?

Tim
Vladimir Oltean Dec. 1, 2022, 12:26 a.m. UTC | #3
On Wed, Nov 30, 2022 at 03:27:04PM -0800, Tim Harvey wrote:
> That's the same head that I based them off of and I just did the
> following and it worked fine:
> cd /tmp
> git clone git://git.denx.de/u-boot.git
> cd u-boot
> wget https://patchwork.ozlabs.org/series/330704/mbox/ -O mbox
> git am mbox
> 
> Looks like only the last patch failed right?

Yeah, only the last patch failed. I converted them again to mbox format
using my super awkward procmail-based mail-to-mbox scripts, and now it
seems that git-am eats them just fine. I had taken a look at the last
patch context, and it looked identical to what was in tree, so I didn't
understand what was wrong.

Anyway, I just wanted to make sure that the dsa sandbox tests still
pass, which they do. I'm away from my boards right now, so I won't be
able to change U-Boot remotely to do a live check.
Tim Harvey Jan. 25, 2023, 5:26 p.m. UTC | #4
On Wed, Nov 30, 2022 at 4:26 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> On Wed, Nov 30, 2022 at 03:27:04PM -0800, Tim Harvey wrote:
> > That's the same head that I based them off of and I just did the
> > following and it worked fine:
> > cd /tmp
> > git clone git://git.denx.de/u-boot.git
> > cd u-boot
> > wget https://patchwork.ozlabs.org/series/330704/mbox/ -O mbox
> > git am mbox
> >
> > Looks like only the last patch failed right?
>
> Yeah, only the last patch failed. I converted them again to mbox format
> using my super awkward procmail-based mail-to-mbox scripts, and now it
> seems that git-am eats them just fine. I had taken a look at the last
> patch context, and it looked identical to what was in tree, so I didn't
> understand what was wrong.
>
> Anyway, I just wanted to make sure that the dsa sandbox tests still
> pass, which they do. I'm away from my boards right now, so I won't be
> able to change U-Boot remotely to do a live check.

Joe,

These have been lingering for some time. Will you pick up at least the first 7?

Best Regards,

Tim
Tim Harvey Jan. 31, 2023, 11:14 p.m. UTC | #5
On Wed, Jan 25, 2023 at 9:26 AM Tim Harvey <tharvey@gateworks.com> wrote:
>
> On Wed, Nov 30, 2022 at 4:26 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > On Wed, Nov 30, 2022 at 03:27:04PM -0800, Tim Harvey wrote:
> > > That's the same head that I based them off of and I just did the
> > > following and it worked fine:
> > > cd /tmp
> > > git clone git://git.denx.de/u-boot.git
> > > cd u-boot
> > > wget https://patchwork.ozlabs.org/series/330704/mbox/ -O mbox
> > > git am mbox
> > >
> > > Looks like only the last patch failed right?
> >
> > Yeah, only the last patch failed. I converted them again to mbox format
> > using my super awkward procmail-based mail-to-mbox scripts, and now it
> > seems that git-am eats them just fine. I had taken a look at the last
> > patch context, and it looked identical to what was in tree, so I didn't
> > understand what was wrong.
> >
> > Anyway, I just wanted to make sure that the dsa sandbox tests still
> > pass, which they do. I'm away from my boards right now, so I won't be
> > able to change U-Boot remotely to do a live check.
>
> Joe,
>
> These have been lingering for some time. Will you pick up at least the first 7?
>
> Best Regards,
>
> Tim

gentle ping

I'm not sure what needs to be done to get this series merged.

Tim Harvey (8):
  net: mdio-uclass: scan for dm mdio children on post-bind
  net: dsa: move cpu port probe to dsa_post_probe
  net: dsa: ensure dsa driver has proper ops
  net: dsa: allow rcv() and xmit() to be optional
  net: ksz9477: remove unnecessary xmit and recv functions
  net: fec: add support for DM_MDIO
  net: add MV88E6xxx DSA driver
  board: gw_ventana: enable MV88E61XX DSA support

The first 7 should go through Joe/Ramon I would think and the last
through Stefano.

Best Regards,

Tim