These two patches are destined for both EDK2 and OpenPlatformPkg. The EDK2 patch should be merged first.
LAN9118 investigations by Mark Rutland has shown that the Juno ARM Development Platform does not work well when LAN9118 auto-negotiates in full duplex mode.
It was suggested that a PCD could be added to control the advertised features. One way of implementing the PCDi, as implemented here, is to provide a mask, where the platform developer can enable/disable features.
[PATCH 1/2] EmbeddedPkg/Lan9118Dxe: PcdLan9118NegotiationFeatureMask [PATCH 2/2] Platforms/ARM: Add PcdLan9118NegotiationFeatureMask ~ ~
Add a PCD to allow the platform to mask in/out specific features of the LAN9118 device advertised during auto-negotiation.
For example, the Juno ARM Development Platform doesn't support full duplex mode. This PCD will allow the platform developer to prevent the full duplex modes from being advertised.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- EmbeddedPkg/EmbeddedPkg.dec | 1 + EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf | 1 + EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c | 1 + 3 files changed, 3 insertions(+)
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 7bcb133..73f7ee6 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -147,6 +147,7 @@ [PcdsFixedAtBuild.common] gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress|0x0|UINT32|0x00000025 gEmbeddedTokenSpaceGuid.PcdLan9118DefaultMacAddress|0x0|UINT64|0x00000026 gEmbeddedTokenSpaceGuid.PcdLan9118DefaultNegotiationTimeout|4000|UINT32|0x00000027 + gEmbeddedTokenSpaceGuid.PcdLan9118NegotiationFeatureMask|0xFFFFFFFF|UINT32|0x00000028
# # Android FastBoot diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf index 3c2246f..055a055 100644 --- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf +++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf @@ -52,6 +52,7 @@ [FixedPcd] gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress gEmbeddedTokenSpaceGuid.PcdLan9118DefaultMacAddress gEmbeddedTokenSpaceGuid.PcdLan9118DefaultNegotiationTimeout + gEmbeddedTokenSpaceGuid.PcdLan9118NegotiationFeatureMask
[Depex] TRUE diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c index 8491396..5ce658c 100644 --- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c +++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c @@ -648,6 +648,7 @@ AutoNegotiate ( Features &= ~(PHYANA_PAUSE_OP_MASK); Features |= 3 << 10; } + Features &= FixedPcdGet32 (PcdLan9118NegotiationFeatureMask);
// Write the features IndirectPHYWrite32 (PHY_INDEX_AUTO_NEG_ADVERT, Features);
The LAN9118 features mask us used to enable/disable certain features advertised by the device during auto-negotiation.
Juno and TC2 do not support full duplex communication properly, causing intermittent failures, so we disable them using the mask.
The feature mask used is effectively: ~(PHYANA_10BASETFD | PHYANA_100BASETXFD);
The constants for the bit masks are defined here: EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeHw.h
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- Platforms/ARM/Juno/ArmJuno.dsc | 1 + Platforms/ARM/VExpress/ArmVExpress-CTA15-A7.dsc | 1 + 2 files changed, 2 insertions(+)
diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index e3a675e..4a1fe10 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -132,6 +132,7 @@ gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress|0x18000000 gEmbeddedTokenSpaceGuid.PcdLan9118DefaultMacAddress|0x1215161822242628 gEmbeddedTokenSpaceGuid.PcdLan9118DefaultNegotiationTimeout|40000 + gEmbeddedTokenSpaceGuid.PcdLan9118NegotiationFeatureMask|0xFFFFFEBF
# # ARM General Interrupt Controller diff --git a/Platforms/ARM/VExpress/ArmVExpress-CTA15-A7.dsc b/Platforms/ARM/VExpress/ArmVExpress-CTA15-A7.dsc index c6d0b13..c4e437f 100644 --- a/Platforms/ARM/VExpress/ArmVExpress-CTA15-A7.dsc +++ b/Platforms/ARM/VExpress/ArmVExpress-CTA15-A7.dsc @@ -170,6 +170,7 @@ # Ethernet (SMSC LAN9118) gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress|0x1A000000 gEmbeddedTokenSpaceGuid.PcdLan9118DefaultNegotiationTimeout|400000 + gEmbeddedTokenSpaceGuid.PcdLan9118NegotiationFeatureMask|0xFFFFFEBF
# # Define the device path to the FDT for the platform