From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5B23B2034A890 for ; Fri, 27 Oct 2017 07:32:57 -0700 (PDT) Received: by mail-wm0-x241.google.com with SMTP id t139so4252730wmt.1 for ; Fri, 27 Oct 2017 07:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vrAbzhORAOSAj05kx8cf36nxvjJQpSqSDKAoRZt679o=; b=J7j0l1xmQqHYopAbskD27MA/ZJd8H+8gDlnV6aadTbt8vneJhvXRFHDVpsf1bzjGJz L1xM8ROJWI3Girgr5hP1DaY2+cETkXogG7UsA41z2S1AHP6DkgC3mUTYO22zMoO/D1yi LvWPa9PY5wg0b4PEYw/tM+U1flHDaYiDHfzc4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vrAbzhORAOSAj05kx8cf36nxvjJQpSqSDKAoRZt679o=; b=metJwvEMiN615DH+DY06s7IVQShWYSH0nw/pzBt8u53fgKmu2yGaEJKlLnr32aOjjC thUwigmYmxu+MB2snWp4Dl7jAscCxCvqxa6at0zpd5vGltlRFjyqtlGjWqEOEn/LDryn mn2rClOu2fUofxrbqL+oZ8MDzcdbZ2TklC8lXE4pT+p9UGLP3VQgX7hpMJC1SuEDSTVX rIlbxPEwkWhOt+nJGefJ0zXcyORF0QfBpmlIT4H+MRearDSgAAus/UTB6lu+fMxl4SNr MEiLfy9Izr9ttxzOZDotJuumuL1PjtAQsI6nZMBfhxJLZb1lRScGApJa4OEHSMndXW+s 3DTw== X-Gm-Message-State: AMCzsaUkxdurjx6u0mcV+TNgHMZFrE2SrBhCZfMLifVj88TmeloDmQT1 WcQ0LXSllfDxNmrmLwzusAZc8Q== X-Google-Smtp-Source: ABhQp+S9etqQuojOBWkLjaXx5IQ9Fc1YbElmBTkg7IvbLBtIYOt1DzNjiOYkng3YyhhWAUr9hrDf6A== X-Received: by 10.28.234.197 with SMTP id g66mr565997wmi.76.1509115003205; Fri, 27 Oct 2017 07:36:43 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id 25sm6696436wrv.8.2017.10.27.07.36.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Oct 2017 07:36:42 -0700 (PDT) Date: Fri, 27 Oct 2017 15:36:40 +0100 From: Leif Lindholm To: Marcin Wojtas Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com, jinghua@marvell.com, jsd@semihalf.com Message-ID: <20171027143640.msneayaflrcc6u54@bivouac.eciton.net> References: <1509066832-5285-1-git-send-email-mw@semihalf.com> <1509066832-5285-8-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1509066832-5285-8-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH v2 07/10] Marvell/Drivers: Pp2Dxe: Change settings for the always-up link X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 14:32:57 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 27, 2017 at 03:13:49AM +0200, Marcin Wojtas wrote: > Currently initial forcing link status happened for all ports, not only > marked as 'always-up'. Although this didn't actually matter for the MAC > settings, because MAC is automatically updated with PHY HW polling > feature of the controller, perform mv_gop110_fl_cfg only when > the appropriate flag is true. Also in such case, force the link as up, > using a new library routine. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Marcin Wojtas > --- > Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c | 25 ++++++++++++++++++++ > Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h | 6 +++++ > Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 6 ++++- > 3 files changed, 36 insertions(+), 1 deletion(-) > > diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c > index 53154db..c2d0199 100644 > --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c > +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c > @@ -4804,6 +4804,31 @@ MvGop110PortEventsMask ( > return 0; > } > > +/* > + * Sets "Force Link Pass" and "Do Not Force Link Fail" bits. > + * This function should only be called when the port is disabled. > + */ > +VOID > +MvGop110GmacForceLinkModeSet( > + IN PP2DXE_PORT *Port, > + IN BOOLEAN LinkUp > + ) > +{ > + UINT32 RegVal; > + > + RegVal = MvGop110GmacRead (Port, MVPP2_PORT_AUTO_NEG_CFG_REG); > + > + if (LinkUp) { > + RegVal |= MVPP2_PORT_AUTO_NEG_CFG_FORCE_LINK_UP_MASK; > + RegVal &= ~MVPP2_PORT_AUTO_NEG_CFG_FORCE_LINK_DOWN_MASK; So, I know UP and DOWN are separate bits (what's that about!?), but unless you know that, the above two lines look like they're in the wrong order. If you flip those around (and make it like the 'else' clause): Reviewed-by: Leif Lindholm > + } else { > + RegVal &= ~MVPP2_PORT_AUTO_NEG_CFG_FORCE_LINK_UP_MASK; > + RegVal |= MVPP2_PORT_AUTO_NEG_CFG_FORCE_LINK_DOWN_MASK; > + } > + > + MvGop110GmacWrite (Port, MVPP2_PORT_AUTO_NEG_CFG_REG, RegVal); > +} > + > INT32 > MvGop110FlCfg ( > IN PP2DXE_PORT *Port > diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h > index a7011f7..3ebe294 100644 > --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h > +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h > @@ -504,6 +504,12 @@ MvGop110XlgPortLinkEventMask ( > IN PP2DXE_PORT *Port > ); > > +VOID > +MvGop110GmacForceLinkModeSet ( > + IN PP2DXE_PORT *Port, > + IN BOOLEAN LinkUp > + ); > + > INT32 > MvGop110FlCfg ( > IN PP2DXE_PORT *Port > diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c > index 2827976..4a1b9d5 100644 > --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c > +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c > @@ -1310,7 +1310,11 @@ Pp2DxeInitialiseController ( > NetCompConfig |= MvpPp2xGop110NetcCfgCreate(&Pp2Context->Port); > > MvGop110PortInit(&Pp2Context->Port); > - MvGop110FlCfg(&Pp2Context->Port); > + > + if (Pp2Context->Port.AlwaysUp == TRUE) { > + MvGop110GmacForceLinkModeSet (&Pp2Context->Port, TRUE); > + MvGop110FlCfg (&Pp2Context->Port); > + } > > Status = gBS->CreateEvent ( > EVT_SIGNAL_EXIT_BOOT_SERVICES, > -- > 2.7.4 >