EmbeddedPkg/Lan9118Dxe: add LAN9118 MMIO wrappers
As described in the LAN9118 datasheet, delays are necessary after some reads and writes in order to ensure subsequent reads do not see stale data. This patch adds helpers to provide these delays automatically, by performing dummy reads of the BYTE_TEST register (as recommended in the LAN9118 datasheet). This approach allows the device register file itself to provide the required delay, avoiding issues with early write acknowledgement, or re-ordering of MMIO accesses aganist other instructions (e.g. the delay loop). Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Ryan Harkin <ryan.harkin@linaro.org> Signed-off-by: Mark Rutland <mark.rutland@arm.com> Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
committed by
Ard Biesheuvel
parent
28f52b9fae
commit
73683a2464
@@ -38,6 +38,23 @@ GenEtherCrc32 (
|
||||
IN UINT32 AddrLen
|
||||
);
|
||||
|
||||
UINT32
|
||||
Lan9118RawMmioRead32(
|
||||
UINTN Address,
|
||||
UINTN Delay
|
||||
);
|
||||
#define Lan9118MmioRead32(a) \
|
||||
Lan9118RawMmioRead32(a, a ## _RD_DELAY)
|
||||
|
||||
UINT32
|
||||
Lan9118RawMmioWrite32(
|
||||
UINTN Address,
|
||||
UINT32 Value,
|
||||
UINTN Delay
|
||||
);
|
||||
#define Lan9118MmioWrite32(a, v) \
|
||||
Lan9118RawMmioWrite32(a, v, a ## _WR_DELAY)
|
||||
|
||||
/* ------------------ MAC CSR Access ------------------- */
|
||||
|
||||
// Read from MAC indirect registers
|
||||
|
Reference in New Issue
Block a user