From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hershberger Date: Sat, 25 Mar 2017 16:05:29 -0400 Subject: [U-Boot] [PATCH v2 38/45] net: mvpp2: Add GoP and NetC support for ports 2 & 3 (RGMII & SGMII) In-Reply-To: <20170323160211.18072-39-sr@denx.de> References: <20170323160211.18072-1-sr@denx.de> <20170323160211.18072-39-sr@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Mar 23, 2017 at 12:02 PM, Stefan Roese 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 > Cc: Stefan Chulski > Cc: Kostya Porotchkin > Cc: Nadav Haklai > Cc: Joe Hershberger > > --- > > 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 > @@ -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; > +}