From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.9393.1588690246979666646 for ; Tue, 05 May 2020 07:50:47 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A12911FB; Tue, 5 May 2020 07:50:46 -0700 (PDT) Received: from e123331-lin.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5CB0A3F68F; Tue, 5 May 2020 07:50:45 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, pete@akeo.ie, andrey.warkentin@gmail.com, Ard Biesheuvel Subject: [PATCH edk2-platforms 4/5] Platform/RaspberryPi3: query firmware for 16550 input clock at boot Date: Tue, 5 May 2020 16:50:28 +0200 Message-Id: <20200505145029.29826-5-ard.biesheuvel@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200505145029.29826-1-ard.biesheuvel@arm.com> References: <20200505145029.29826-1-ard.biesheuvel@arm.com> Query the firmware for the clock rate that is used to drive the 16550 baud clock, so that we can program the correct baud rate. Co-authored-by: Pete Batard Co-authored-by: Andrei Warkentin Co-authored-by: Ard Biesheuvel Signed-off-by: Pete Batard Signed-off-by: Ard Biesheuvel --- Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S index 91dfe1bb981e..35580e4ed73a 100644 --- a/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S +++ b/Platform/RaspberryPi/Library/PlatformLib/AArch64/RaspberryPiHelper.S @@ -3,7 +3,7 @@ * Copyright (c) 2020, Andrei Warkentin * Copyright (c) 2019-2020, Pete Batard * Copyright (c) 2016, Linaro Limited. All rights reserved. - * Copyright (c) 2011-2013, ARM Limited. All rights reserved. + * Copyright (c) 2011-2020, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -85,6 +85,14 @@ ASM_FUNC (ArmPlatformPeiBootAction) adr x2, mBoardRevision str w0, [x2] +#if (RPI_MODEL == 3) + run .Lclkinfo_buffer + + ldr w0, .Lfrequency + adrp x2, _gPcd_BinaryPatch_PcdSerialClockRate + str w0, [x2, :lo12:_gPcd_BinaryPatch_PcdSerialClockRate] +#endif + ret .align 4 @@ -127,6 +135,21 @@ ASM_FUNC (ArmPlatformPeiBootAction) .long 0 // end tag .set .Lrevinfo_size, . - .Lrevinfo_buffer +#if (RPI_MODEL == 3) + .align 4 +.Lclkinfo_buffer: + .long .Lclkinfo_size + .long 0x0 + .long RPI_MBOX_GET_CLOCK_RATE + .long 8 // buf size + .long 4 // input len + .long 4 // clock id: 0x04 = Core/VPU +.Lfrequency: + .long 0 // frequency + .long 0 // end tag + .set .Lclkinfo_size, . - .Lclkinfo_buffer +#endif + //UINTN //ArmPlatformGetPrimaryCoreMpId ( // VOID -- 2.17.1