public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 6/9] Platform/RaspberryPi: Power up sd, and tweak GPIOs
@ 2020-12-15 21:00 Jeremy Linton
  2021-01-04 16:08 ` Jeremy Linton
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Linton @ 2020-12-15 21:00 UTC (permalink / raw)
  To: devel
  Cc: ard.biesheuvel, leif, pete, andrey.warkentin,
	samer.el-haj-mahmoud, Jeremy Linton

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 <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/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
+       */
+      Status = mFwProtocol->SetPowerState (RPI_MBOX_POWER_STATE_SDHCI,
+                                           TRUE, TRUE); //SD on with wait
+      Status = mFwProtocol->SetGpioConfig (RPI_EXP_GPIO_SD_VOLT, 
+                                           RPI_EXP_GPIO_DIR_OUT, TRUE); //3.3v
+      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC2, TRUE);
+      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC, TRUE);
     }
   } else {
     DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n", mModelFamily));
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 6/9] Platform/RaspberryPi: Power up sd, and tweak GPIOs
  2020-12-15 21:00 [PATCH v2 6/9] Platform/RaspberryPi: Power up sd, and tweak GPIOs Jeremy Linton
@ 2021-01-04 16:08 ` Jeremy Linton
  2021-01-04 16:10   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Linton @ 2021-01-04 16:08 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif, pete, andrey.warkentin,
	samer.el-haj-mahmoud

Hi,

On 12/15/20 3:00 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.

Looks like this hasn't been merged yet. I sent this patch as a 
replacement for 6/9 in the original set, rather than resend the entire set.

Would it help if I resent the entire series?

Thanks,




> 
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/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
> +       */
> +      Status = mFwProtocol->SetPowerState (RPI_MBOX_POWER_STATE_SDHCI,
> +                                           TRUE, TRUE); //SD on with wait
> +      Status = mFwProtocol->SetGpioConfig (RPI_EXP_GPIO_SD_VOLT,
> +                                           RPI_EXP_GPIO_DIR_OUT, TRUE); //3.3v
> +      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC2, TRUE);
> +      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC, TRUE);
>       }
>     } else {
>       DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n", mModelFamily));
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 6/9] Platform/RaspberryPi: Power up sd, and tweak GPIOs
  2021-01-04 16:08 ` Jeremy Linton
@ 2021-01-04 16:10   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2021-01-04 16:10 UTC (permalink / raw)
  To: Jeremy Linton, devel; +Cc: leif, pete, andrey.warkentin, samer.el-haj-mahmoud

On 1/4/21 5:08 PM, Jeremy Linton wrote:
> Hi,
> 
> On 12/15/20 3:00 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.
> 
> Looks like this hasn't been merged yet. I sent this patch as a
> replacement for 6/9 in the original set, rather than resend the entire set.
> 
> Would it help if I resent the entire series?
> 

Yes please,

-- 
Ard.

> 
>>
>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>> ---
>>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
>> b/Platform/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
>> +       */
>> +      Status = mFwProtocol->SetPowerState (RPI_MBOX_POWER_STATE_SDHCI,
>> +                                           TRUE, TRUE); //SD on with
>> wait
>> +      Status = mFwProtocol->SetGpioConfig (RPI_EXP_GPIO_SD_VOLT,
>> +                                           RPI_EXP_GPIO_DIR_OUT,
>> TRUE); //3.3v
>> +      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC2,
>> TRUE);
>> +      Status = mFwProtocol->SetClockState (RPI_MBOX_CLOCK_RATE_EMMC,
>> TRUE);
>>       }
>>     } else {
>>       DEBUG ((DEBUG_ERROR, "Model Family %d not supported...\n",
>> mModelFamily));
>>
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-04 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-15 21:00 [PATCH v2 6/9] Platform/RaspberryPi: Power up sd, and tweak GPIOs Jeremy Linton
2021-01-04 16:08 ` Jeremy Linton
2021-01-04 16:10   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox