From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::242; helo=mail-lf0-x242.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) (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 4A04121E1B76A for ; Fri, 27 Oct 2017 09:28:58 -0700 (PDT) Received: by mail-lf0-x242.google.com with SMTP id n69so8032561lfn.2 for ; Fri, 27 Oct 2017 09:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rwet9tcB6m+d7EppTvzCZbj3uAtRZWmz7vvXBHa72U0=; b=nizQLqn7x2244YclH0c/N4GLs6Ap0UlxUR8CXIvMYtu7GHIh+nAvWBa+jANrAaGvJi VOrZ4FVBwY4n3BmcXU8i9TedxWQg/7MmQBWKw2YuY4PN10EJ0hHpV5XtOcIc6KFTAtov geXhvU9DbeiNqJXMma8oJiOop3qzJ7i8ok7xC5M7UMnkaqJFjoFYoV6LTJJRIgqV8n1P qlf7E7I3fAdqMg4vY0ZDTXoX8ouY+WBQbw254LDuhXnp5uE329/DGPTIjcFCFKvOL2fc waBY457r+IHsKV/g73wLv6jiISq1g4WzqnlSLLL+itDsNRePKzGoj0QDLJhWoKiUXPv/ doLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rwet9tcB6m+d7EppTvzCZbj3uAtRZWmz7vvXBHa72U0=; b=H+VgFwU9SXc6vQ0UlM4RtcBR6vLGvT5yYFXVkMSmuI4XDYaHkQMR40diGqECpK1+wD /4lipLSCJllkUPUWWzICI4S/P0qUJDvwXK929yqWuPuFupAMNKPcuzmzyxk+S5Sas1/S tR6mBFHNl4+KbALfflfiLaEKPWHBsdFk4DnxsRqrtpQGSLg5p4aLd0xCPhlWwhj8n8Tz XjwoP/SbvaEpJUJv+sIkWbc92onvfTIi2jUdEbS4+m+Q9oC+5K2PnTaemvVyNZWDGXh4 iW9rQW3vEujOarnRbF6oljW4nqvsMoHybthwuHl7K8+ba8ZucCj5WrGo+5qM+iklBWIL kygQ== X-Gm-Message-State: AMCzsaWFwruQuj2mC+kDN/bz7gKBdA6uKk0wWOH/xC4n6pUG5wGGva1q nQU3909OBXWrSa/lpiGlql6vcTcAGic= X-Google-Smtp-Source: ABhQp+Ta9ylpCxd77JJvkRwZG5FSKKPOVthMVIwU3v8NniX3Dhbl5TeEAXCI4DWmzgi4NEu6Ahjs0Q== X-Received: by 10.46.4.29 with SMTP id 29mr487328lje.82.1509121963761; Fri, 27 Oct 2017 09:32:43 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h3sm1569222lfj.26.2017.10.27.09.32.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Oct 2017 09:32:43 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com, jinghua@marvell.com, mw@semihalf.com, jsd@semihalf.com Date: Fri, 27 Oct 2017 18:31:50 +0200 Message-Id: <1509121913-12937-8-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509121913-12937-1-git-send-email-mw@semihalf.com> References: <1509121913-12937-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH v3 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 16:28:58 -0000 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 | 19 +++++++++++++++++++ Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h | 5 +++++ Platform/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 6 +++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c index 53154db..0c9f00c 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.c @@ -4804,6 +4804,25 @@ MvGop110PortEventsMask ( return 0; } +/* + * Sets "Force Link Pass" and clears "Do Not Force Link Fail" bits. + * This function should only be called when the port is disabled. + */ +VOID +MvGop110GmacForceLinkUp ( + IN PP2DXE_PORT *Port + ) +{ + UINT32 RegVal; + + RegVal = MvGop110GmacRead (Port, MVPP2_PORT_AUTO_NEG_CFG_REG); + + 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..3dc9ecd 100644 --- a/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h +++ b/Platform/Marvell/Drivers/Net/Pp2Dxe/Mvpp2Lib.h @@ -504,6 +504,11 @@ MvGop110XlgPortLinkEventMask ( IN PP2DXE_PORT *Port ); +VOID +MvGop110GmacForceLinkUp ( + IN PP2DXE_PORT *Port + ); + 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..b0a38b3 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) { + MvGop110GmacForceLinkUp (&Pp2Context->Port); + MvGop110FlCfg (&Pp2Context->Port); + } Status = gBS->CreateEvent ( EVT_SIGNAL_EXIT_BOOT_SERVICES, -- 2.7.4