diff --git a/HtcLeoPkg/GPLDrivers/ClockDxe/ClockDxe.c b/HtcLeoPkg/GPLDrivers/ClockDxe/ClockDxe.c index af2a3477..041872e6 100644 --- a/HtcLeoPkg/GPLDrivers/ClockDxe/ClockDxe.c +++ b/HtcLeoPkg/GPLDrivers/ClockDxe/ClockDxe.c @@ -274,22 +274,6 @@ int msm_pll_request(unsigned id, unsigned on) return msm_proc_comm(PCOM_CLKCTL_RPC_PLL_REQUEST, &id, &on); } -static int ClocksOn[] = { - SDC1_CLK, - SDC2_CLK, - SDC3_CLK, - SDC4_CLK, -}; - -EFI_STATUS -MsmClockInit(VOID) -{ - for (int i = 0; i < (int)ARRAY_SIZE(ClocksOn); i++) - ClkEnable(ClocksOn[i]); - - return EFI_SUCCESS; -} - /** Protocol variable definition **/ @@ -315,28 +299,22 @@ ClockDxeInitialize( ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEmbeddedClockProtocolGuid); FillClocksLookup(); - if (MsmClockInit() == EFI_SUCCESS) - { - DEBUG((EFI_D_INFO, "Clock init done!\n")); - - // Install the Embedded Clock Protocol onto a new handle - Handle = NULL; - Status = gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEmbeddedClockProtocolGuid, - &gClock, - NULL - ); - if (EFI_ERROR (Status)) { - Status = EFI_OUT_OF_RESOURCES; - } + // Setup Scorpion PLL + msm_acpu_clock_init(11+6); - // Setup Scorpion PLL - msm_acpu_clock_init(11+6); - return EFI_SUCCESS; - } - else { - return EFI_D_ERROR; + // Install the Embedded Clock Protocol onto a new handle + Handle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEmbeddedClockProtocolGuid, + &gClock, + NULL + ); + + if (EFI_ERROR (Status)) { + Status = EFI_OUT_OF_RESOURCES; } + + return EFI_SUCCESS; } \ No newline at end of file diff --git a/HtcLeoPkg/GPLDrivers/ClockDxe/acpuclock.c b/HtcLeoPkg/GPLDrivers/ClockDxe/acpuclock.c index 4fcd41b2..1ae74aa5 100755 --- a/HtcLeoPkg/GPLDrivers/ClockDxe/acpuclock.c +++ b/HtcLeoPkg/GPLDrivers/ClockDxe/acpuclock.c @@ -44,10 +44,6 @@ unsigned acpuclk_init_done = 0; #define SRC_RAW 0 /* clock from SPSS_CLK_CNTL */ #define SRC_SCPLL 1 /* output of scpll 128-998 MHZ */ -//#define dmb() __asm__ __volatile__("DMB") - -//extern void dmb(void); - /* Set rate and enable the clock */ void clock_config(UINT32 ns, UINT32 md, UINT32 ns_addr, UINT32 md_addr) { diff --git a/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.c b/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.c index a2c2757f..c0fc65c5 100644 --- a/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.c +++ b/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.c @@ -38,6 +38,9 @@ #include #include #include +#include + +#include #include "SdCardDxe.h" @@ -46,6 +49,9 @@ static block_dev_desc_t *sdc_dev; // Cached copy of the Hardware Gpio protocol instance TLMM_GPIO *gGpio = NULL; +// Cached copy of the Embedded Clock protocol instance +EMBEDDED_CLOCK_PROTOCOL *gClock = NULL; + EFI_BLOCK_IO_MEDIA gMMCHSMedia = { SIGNATURE_32('s', 'd', 'c', 'c'), // MediaId @@ -83,7 +89,6 @@ MMCHS_DEVICE_PATH gMmcHsDevicePath = { }; - /** Reset the Block Device. @@ -296,8 +301,15 @@ SdCardInitialize( Status = gBS->LocateProtocol (&gTlmmGpioProtocolGuid, NULL, (VOID **)&gGpio); ASSERT_EFI_ERROR (Status); + // Find the clock controller protocol. ASSERT if not found. + Status = gBS->LocateProtocol (&gEmbeddedClockProtocolGuid, NULL, (VOID **)&gClock); + ASSERT_EFI_ERROR (Status); + if (!gGpio->Get(HTCLEO_GPIO_SD_STATUS)) { + // Enable the SDC2 clock + gClock->ClkEnable(SDC2_CLK); + // Enable SD mmc_legacy_init(0); diff --git a/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.inf b/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.inf index dd0c9935..0486cdff 100644 --- a/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.inf +++ b/HtcLeoPkg/GPLDrivers/SdCardDxe/SdCardDxe.inf @@ -67,6 +67,7 @@ gEfiCpuArchProtocolGuid gEfiDevicePathProtocolGuid gTlmmGpioProtocolGuid + gEmbeddedClockProtocolGuid [Pcd]