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::243; helo=mail-wm0-x243.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (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 C8EA7203525FD for ; Thu, 26 Oct 2017 06:34:53 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id r68so8408627wmr.3 for ; Thu, 26 Oct 2017 06:38:39 -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=N/eKmB3PhC+Ou3/ziHIpHHvdRq16iibmKDt5tlscRqc=; b=hghl9BA1EBrSzJDbjIJ6bQGknMU45yQ1sHpAb49N68YNLBJWekYabnfbyMXyRHMZJL YF1a8VRehEEnEL8KIbPvDbCYUYRB9N8Bw4H6UzOnwox22vQvrz29BwzfaehwQ/Gc5zFR QEeZyfnyBU+EeR3GkVu1E/zu7mSwpE29MfVR4= 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=N/eKmB3PhC+Ou3/ziHIpHHvdRq16iibmKDt5tlscRqc=; b=IrvfL8abGBDK8UpJRz/wwxe90YDBEEQsL1hNu8Dvy4TmbQ3Vf1ZogdbY+hZOgGCX3h QaDa56BDGe0+6F/6lY837yn1GFkyFcKJ/e9f7XiRr2GHUpB6z+K6JrFabOXqCIW+5MNE dzAJL8nLRgx7zifCvmR1fqnglf/WbQiSMr9XxVx/xi9i+tKcE7cddAIb7yQbb2zbJ264 qy44w8fV6eqgX1aCcJGXMkgAXP/6DGe4oJyahZaQeTdSyP4HUF6x98HnlShuWvd4L0MU XMVXBask77/5nIdUuJkiRVroYLpm2TlBC8bsIYWPE75mYVcH1tGd3E8p3Yke2hGh7BrP rkNg== X-Gm-Message-State: AMCzsaWnr/ArJAxEjwxAgZ2UTvaikF9e5x9oRkEXuAmTDcEraVIRgrJ/ ykPWIeShvxwf/j5hk4P7PkIKSIbKyBw= X-Google-Smtp-Source: ABhQp+RqcF6DVD4cqC+imf8/yN2c4lcQzxTwZLvEu0HxQelyJ015JbFBdajMrKQf5b9M/RppgO8AfA== X-Received: by 10.28.138.202 with SMTP id m193mr1804914wmd.63.1509025118540; Thu, 26 Oct 2017 06:38:38 -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 c17sm7518352wrg.26.2017.10.26.06.38.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Oct 2017 06:38:37 -0700 (PDT) Date: Thu, 26 Oct 2017 14:38:35 +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: <20171026133835.p43465xgj5ueiuop@bivouac.eciton.net> References: <1508980777-29006-1-git-send-email-mw@semihalf.com> <1508980777-29006-8-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1508980777-29006-8-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH 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: Thu, 26 Oct 2017 13:34:54 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 26, 2017 at 03:19:34AM +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 | 31 ++++++++++++++++++++ > Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h | 7 +++++ > Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 6 +++- > 3 files changed, 43 insertions(+), 1 deletion(-) > > diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c > index 53154db..e3ddc58 100644 > --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c > +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c > @@ -4804,6 +4804,37 @@ 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 ForceLinkUp, > + IN BOOLEAN ForceLinkDown) > +{ > + UINT32 RegVal; > + > + /* Can't force link pass and link fail at the same time */ Then why pass two parameters to the function? The function is called ForceLink. Have one ForceLinkUp BOOL parameter, and force up if TRUE and down if FALSE. > + if ((ForceLinkUp) && (ForceLinkDown)) > + return; > + > + RegVal = MvGop110GmacRead (Port, MVPP2_PORT_AUTO_NEG_CFG_REG); > + > + if (ForceLinkUp) Always {} with if/else (throughout). / Leif > + RegVal |= MVPP2_PORT_AUTO_NEG_CFG_FORCE_LINK_UP_MASK; > + else > + RegVal &= ~MVPP2_PORT_AUTO_NEG_CFG_FORCE_LINK_UP_MASK; > + > + if (ForceLinkDown) > + RegVal |= MVPP2_PORT_AUTO_NEG_CFG_FORCE_LINK_DOWN_MASK; > + else > + 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..2938777 100644 > --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h > +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h > @@ -504,6 +504,13 @@ MvGop110XlgPortLinkEventMask ( > IN PP2DXE_PORT *Port > ); > > +VOID > +MvGop110GmacForceLinkModeSet ( > + IN PP2DXE_PORT *Port, > + IN BOOLEAN ForceLinkUp, > + IN BOOLEAN ForceLinkDown > + ); > + > 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..94a2988 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, FALSE); > + MvGop110FlCfg (&Pp2Context->Port); > + } > > Status = gBS->CreateEvent ( > EVT_SIGNAL_EXIT_BOOT_SERVICES, > -- > 2.7.4 >