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.web09.1217.1609821345713826585 for ; Mon, 04 Jan 2021 20:35:45 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@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 4F30C101E; Mon, 4 Jan 2021 20:35:45 -0800 (PST) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0C64B3F70D; Mon, 4 Jan 2021 20:35:45 -0800 (PST) Subject: Re: [edk2-devel] [PATCH v3 6/7] Platform/RaspberryPi: Power up sd, and tweak GPIOs To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, samer.el-haj-mahmoud@arm.com, Andrei Warkentin References: <20210104173731.1413044-1-jeremy.linton@arm.com> <20210104173731.1413044-7-jeremy.linton@arm.com> <97584144-c3ac-8e91-83bd-2d63921bdc9d@redhat.com> From: "Jeremy Linton" Message-ID: <513633f8-9ecb-ac55-28c9-2d53630d9244@arm.com> Date: Mon, 4 Jan 2021 22:35:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <97584144-c3ac-8e91-83bd-2d63921bdc9d@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi, On 1/4/21 12:44 PM, Philippe Mathieu-Daud=C3=A9 wrote: > On 1/4/21 6:37 PM, Jeremy Linton wrote: >> It seems we should be powering up the sd cards, and possibly >> the clocks as well to assure they are setup properly before >> we attempt to access the controller. >> >> Signed-off-by: Jeremy Linton >> Reviewed-by: Andrei Warkentin >> --- >> Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> index 28f57438c5..e55ed63efa 100644 >> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> @@ -552,6 +552,16 @@ ApplyVariables ( >> GpioPinFuncSet (37, GPIO_FSEL_ALT3); >> GpioPinFuncSet (38, GPIO_FSEL_ALT3); >> GpioPinFuncSet (39, GPIO_FSEL_ALT3); >> + >> + /* >> + * power and clock everything by default >=20 > Isn't this comment a bit exaggerated? You only power the minimum > required to use the SD controller to access the card. Maybe. Since I will be re-posting, maybe just dropping the comment is=20 reasonable since the code is fairly self explanatory now. >=20 >> + */ >> + Status =3D mFwProtocol->SetPowerState (RPI_MBOX_POWER_STATE_SDH= CI, >> + TRUE, TRUE); //SD on with = wait >> + Status =3D mFwProtocol->SetGpioConfig (RPI_EXP_GPIO_SD_VOLT, >> + RPI_EXP_GPIO_DIR_OUT, TRUE= ); //3.3v >> + Status =3D mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC= 2, TRUE); >> + Status =3D mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC= , TRUE); >> } >> } else { >> DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n", mMode= lFamily)); >> >=20