[U-Boot] [PATCH v2 38/45] net: mvpp2: Add GoP and NetC support for ports 2 & 3 (RGMII & SGMII)

Joe Hershberger joe.hershberger at gmail.com
Sat Mar 25 20:05:29 UTC 2017


On Thu, Mar 23, 2017 at 12:02 PM, Stefan Roese <sr at denx.de> wrote:
> This patch adds the GoP (Group of Ports) and NetC (Net Complex) setup to
> the Marvell mvpp2 ethernet driver. This code is mostly copied from the
> Marvell U-Boot version and was written by Stefan Chulski. Please
> note that only RGMII and SGMII support have been added, as these are
> the only interfaces that this code has been tested with.
>
> Signed-off-by: Stefan Roese <sr at denx.de>
> Cc: Stefan Chulski <stefanc at marvell.com>
> Cc: Kostya Porotchkin <kostap at marvell.com>
> Cc: Nadav Haklai <nadavh at marvell.com>
> Cc: Joe Hershberger <joe.hershberger at ni.com>
>
> ---
>
> Changes in v2:
> - New patch
>
>  drivers/net/mvpp2.c | 766 +++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 758 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> index 6f9a4137f8..76370faff0 100644
> --- a/drivers/net/mvpp2.c
> +++ b/drivers/net/mvpp2.c

<snip>

> @@ -2833,6 +2986,570 @@ static inline void mvpp2_gmac_max_rx_size_set(struct mvpp2_port *port)
>         writel(val, port->base + MVPP2_GMAC_CTRL_0_REG);
>  }
>
> +/* PPv2.2 GoP/GMAC config */
> +
> +/* Set the MAC to reset or exit from reset */
> +static int gop_gmac_reset(struct mvpp2_port *port, enum mv_reset reset)

Is this copied from somewhere? The enum parameter seems unnecessary.
Why not just int for type?

> +{
> +       u32 val;
> +
> +       /* read - modify - write */
> +       val = readl(port->base + MVPP2_GMAC_CTRL_2_REG);
> +       if (reset == RESET)
> +               val |= MVPP2_GMAC_PORT_RESET_MASK;
> +       else
> +               val &= ~MVPP2_GMAC_PORT_RESET_MASK;
> +       writel(val, port->base + MVPP2_GMAC_CTRL_2_REG);
> +
> +       return 0;
> +}
> +
> +/*
> + * gop_gpcs_mode_cfg
> + *
> + * Configure port to working with Gig PCS or don't.
> + */
> +static int gop_gpcs_mode_cfg(struct mvpp2_port *port, bool en)

Similar here. Copied? Do we really use "bool" in U-Boot much? I care
less about this one that the enum above, though.

> +{
> +       u32 val;
> +
> +       val = readl(port->base + MVPP2_GMAC_CTRL_2_REG);
> +       if (en)
> +               val |= MVPP2_GMAC_PCS_ENABLE_MASK;
> +       else
> +               val &= ~MVPP2_GMAC_PCS_ENABLE_MASK;
> +       /* enable / disable PCS on this port */
> +       writel(val, port->base + MVPP2_GMAC_CTRL_2_REG);
> +
> +       return 0;
> +}

<snip>


More information about the U-Boot mailing list