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

Stefan Roese sr at denx.de
Mon Mar 27 11:17:59 UTC 2017


Hi Joe,

On 25.03.2017 21:05, Joe Hershberger wrote:
> 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?

Yes, its copied from the original Marvell sources. And yes, I also
am not fond of this additional enum (just forgot to get rid of it
actually). I'll change it int instead.

>> +{
>> +       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.

Also copied, yes. "bool" is probably not used that much in U-Boot,
even though somewhat in this Linux driver. I'll move to int though
with these parameters.

Thanks,
Stefan


More information about the U-Boot mailing list