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.1872.1608063340585822499 for ; Tue, 15 Dec 2020 12:15:41 -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 8EE2B30E; Tue, 15 Dec 2020 12:15:39 -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 428413F66B; Tue, 15 Dec 2020 12:15:39 -0800 (PST) Subject: Re: [edk2-devel] [PATCH 6/7] Platform/RaspberryPi: Power up sd, and tweak GPIOs To: Andrei Warkentin , "devel@edk2.groups.io" Cc: "ard.biesheuvel@arm.com" , "leif@nuviainc.com" , "pete@akeo.ie" , "andrey.warkentin@gmail.com" , "samer.el-haj-mahmoud@arm.com" References: <20201214232350.1192387-1-jeremy.linton@arm.com> <20201214232350.1192387-7-jeremy.linton@arm.com> <30beb5f7-75da-2f57-1dea-b4f973498a64@arm.com> From: "Jeremy Linton" Message-ID: Date: Tue, 15 Dec 2020 14:15:34 -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: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 12/15/20 1:36 PM, Andrei Warkentin wrote: > Reviewed-by: Andrey Warkentin Thanks, To be clear i'm going to repost this one. > ________________________________ > From: Jeremy Linton > Sent: Tuesday, December 15, 2020 12:55 PM > To: Andrei Warkentin ; devel@edk2.groups.io > Cc: ard.biesheuvel@arm.com ; leif@nuviainc.com ; pete@akeo.ie ; andrey.warkentin@gmail.com ; samer.el-haj-mahmoud@arm.com > Subject: Re: [edk2-devel] [PATCH 6/7] Platform/RaspberryPi: Power up sd, and tweak GPIOs > > Hi, > > On 12/15/20 12:21 PM, Andrei Warkentin wrote: >> Could we rework some of these magic constants? Esp the SetPowerState ones. > > Yes, I know from the mailbox description what the 1,1 do (on with > wait?). But its clear as mud what the channel "0" really means. It seems > to have varying definitions, from "power everything" to "power sd". So > it may depend on model, but again, ugh, uboot is doing it. > > >> >> Do we need both EMMC and EMMC2 clocks enabled all the time? > > I think so, not so much for edk2, but for the resulting OS. At least > until we get AML to power on/enable them. > > Which is sorta a todo at this point for the platform, we really should > be supporting the ACPI power states and forwarding that info via mailbox > commands. > >> > A >> ________________________________ >> From: devel@edk2.groups.io on behalf of Jeremy Linton via groups.io >> Sent: Monday, December 14, 2020 5:23 PM >> To: devel@edk2.groups.io >> Cc: ard.biesheuvel@arm.com ; leif@nuviainc.com ; pete@akeo.ie ; andrey.warkentin@gmail.com ; samer.el-haj-mahmoud@arm.com ; Jeremy Linton >> Subject: [edk2-devel] [PATCH 6/7] Platform/RaspberryPi: Power up sd, and tweak GPIOs >> >> 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 >> --- >> Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> index 28f57438c5..8829740938 100644 >> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c >> @@ -552,6 +552,15 @@ ApplyVariables ( >> GpioPinFuncSet (37, GPIO_FSEL_ALT3); >> >> GpioPinFuncSet (38, GPIO_FSEL_ALT3); >> >> GpioPinFuncSet (39, GPIO_FSEL_ALT3); >> >> + >> >> + /* >> >> + * power and clock everything by default >> >> + */ >> >> + Status = mFwProtocol->SetPowerState (0, 1, 1); //SD on >> >> + Status = mFwProtocol->SetGpioConfig (RPI_EXP_GPIO_SD_VOLT, >> >> + RPI_EXP_GPIO_DIR_OUT, 1); //3.3v >> >> + Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC2, 1); >> >> + Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC, 1); >> >> } >> >> } else { >> >> DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n", mModelFamily)); >> >> -- >> 2.13.7 >> >> >> >> -=-=-=-=-=-= >> Groups.io Links: You receive all messages sent to this group. >> View/Reply Online (#68818): https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F68818&data=04%7C01%7Cawarkentin%40vmware.com%7C72669f70d63c494ac71408d8a12b1035%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637436553643223033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nSIj0mEg742NAcojf0oTDhWds2ZBoIJuQuvdo09sJzM%3D&reserved=0 >> Mute This Topic: https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F78964895%2F4387333&data=04%7C01%7Cawarkentin%40vmware.com%7C72669f70d63c494ac71408d8a12b1035%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637436553643223033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ginptEm%2FCGAaCPtqLlmKqNMGEPWog3RhWBHuTh%2FIWG8%3D&reserved=0 >> Group Owner: devel+owner@edk2.groups.io >> Unsubscribe: https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=04%7C01%7Cawarkentin%40vmware.com%7C72669f70d63c494ac71408d8a12b1035%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637436553643223033%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=NzTgITb5uDBkEggkjmjXgfdp0XpHEhJ8o9g1cPbVDNE%3D&reserved=0 [awarkentin@vmware.com] >> -=-=-=-=-=-= >> >> >> > >