public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support
@ 2018-10-09 17:50 Jeff Brasen
  2018-10-09 17:50 ` [PATCH v2 1/2] MdeModulePkg/SdMmcPciHcDxe: Add controller version defines Jeff Brasen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeff Brasen @ 2018-10-09 17:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jeff Brasen

Allow host controllers with spec. version higher than 3.0 recognizable by the driver
https://bugzilla.tianocore.org/show_bug.cgi?id=1233

V2 changes
- Restrict supported versions to versions defined in SDHCI specification
- Add bugzilla link

V1
- Initial support for controllers with versions > 3.00

Jeff Brasen (2):
  MdeModulePkg/SdMmcPciHcDxe: Add controller version defines
  MdeModulePkg/SdMmcPciHcDxe: Allow additional SDHCI versions

 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c    |  5 +++--
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c |  3 ++-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 10 ++++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)

-- 
2.7.4



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

* [PATCH v2 1/2] MdeModulePkg/SdMmcPciHcDxe: Add controller version defines
  2018-10-09 17:50 [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support Jeff Brasen
@ 2018-10-09 17:50 ` Jeff Brasen
  2018-10-09 17:50 ` [PATCH v2 2/2] MdeModulePkg/SdMmcPciHcDxe: Allow additional SDHCI versions Jeff Brasen
  2018-10-12  7:49 ` [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Brasen @ 2018-10-09 17:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jeff Brasen

Add SDHCI controller defines, this is useful as the version in the
register does not explictly map to a specification version. For example
vesion 4.10 of the specification is version 0x04.

https://bugzilla.tianocore.org/show_bug.cgi?id=1233

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c    |  4 ++--
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c |  2 +-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 10 ++++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index 8c93933..d3f77ed 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -978,9 +978,9 @@ SdCardIdentification (
     return Status;
   }
 
-  if ((ControllerVer & 0xFF) == 2) {
+  if ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_300) {
     S18r = TRUE;
-  } else if (((ControllerVer & 0xFF) == 0) || ((ControllerVer & 0xFF) == 1)) {
+  } else if (((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_100) || ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_200)) {
     S18r = FALSE;
   } else {
     ASSERT (FALSE);
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index 25771dc..3b9a184 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -782,7 +782,7 @@ SdMmcHcClockSupply (
   //
   // Set SDCLK Frequency Select and Internal Clock Enable fields in Clock Control register.
   //
-  if ((ControllerVer & 0xFF) == 2) {
+  if ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_300) {
     ASSERT (Divisor <= 0x3FF);
     ClockCtrl = ((Divisor & 0xFF) << 8) | ((Divisor & 0x300) >> 2);
   } else if (((ControllerVer & 0xFF) == 0) || ((ControllerVer & 0xFF) == 1)) {
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
index e389d52..7e3f588 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
@@ -135,6 +135,16 @@ typedef struct {
   UINT32   Hs400:1;           // bit 63
 } SD_MMC_HC_SLOT_CAP;
 
+//
+// SD Host controller version
+//
+#define SD_MMC_HC_CTRL_VER_100      0x00
+#define SD_MMC_HC_CTRL_VER_200      0x01
+#define SD_MMC_HC_CTRL_VER_300      0x02
+#define SD_MMC_HC_CTRL_VER_400      0x03
+#define SD_MMC_HC_CTRL_VER_410      0x04
+#define SD_MMC_HC_CTRL_VER_420      0x05
+
 /**
   Dump the content of SD/MMC host controller's Capability Register.
 
-- 
2.7.4



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

* [PATCH v2 2/2] MdeModulePkg/SdMmcPciHcDxe: Allow additional SDHCI versions
  2018-10-09 17:50 [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support Jeff Brasen
  2018-10-09 17:50 ` [PATCH v2 1/2] MdeModulePkg/SdMmcPciHcDxe: Add controller version defines Jeff Brasen
@ 2018-10-09 17:50 ` Jeff Brasen
  2018-10-12  7:49 ` [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Brasen @ 2018-10-09 17:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jeff Brasen

Clock control is similar in SDHCI versions greater then version 2. Add
support for more recent versions of the controller specification.

SD card support for 1.8V is also present in controller versions 3 and
greater.

https://bugzilla.tianocore.org/show_bug.cgi?id=1233

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c    | 3 ++-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index d3f77ed..6ee9ed7 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -978,7 +978,8 @@ SdCardIdentification (
     return Status;
   }
 
-  if ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_300) {
+  if (((ControllerVer & 0xFF) >= SD_MMC_HC_CTRL_VER_300) &&
+      ((ControllerVer & 0xFF) <= SD_MMC_HC_CTRL_VER_420)) {
     S18r = TRUE;
   } else if (((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_100) || ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_200)) {
     S18r = FALSE;
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
index 3b9a184..bedc968 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
@@ -782,7 +782,8 @@ SdMmcHcClockSupply (
   //
   // Set SDCLK Frequency Select and Internal Clock Enable fields in Clock Control register.
   //
-  if ((ControllerVer & 0xFF) == SD_MMC_HC_CTRL_VER_300) {
+  if (((ControllerVer & 0xFF) >= SD_MMC_HC_CTRL_VER_300) &&
+      ((ControllerVer & 0xFF) <= SD_MMC_HC_CTRL_VER_420)) {
     ASSERT (Divisor <= 0x3FF);
     ClockCtrl = ((Divisor & 0xFF) << 8) | ((Divisor & 0x300) >> 2);
   } else if (((ControllerVer & 0xFF) == 0) || ((ControllerVer & 0xFF) == 1)) {
-- 
2.7.4



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

* Re: [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support
  2018-10-09 17:50 [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support Jeff Brasen
  2018-10-09 17:50 ` [PATCH v2 1/2] MdeModulePkg/SdMmcPciHcDxe: Add controller version defines Jeff Brasen
  2018-10-09 17:50 ` [PATCH v2 2/2] MdeModulePkg/SdMmcPciHcDxe: Allow additional SDHCI versions Jeff Brasen
@ 2018-10-12  7:49 ` Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Wu, Hao A @ 2018-10-12  7:49 UTC (permalink / raw)
  To: Jeff Brasen, edk2-devel@lists.01.org

Series Reviewed-by: Hao Wu <hao.a.wu@intel.com>
And pushed at bdf038ccff..bbce001515

Best Regards,
Hao Wu


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Jeff Brasen
> Sent: Wednesday, October 10, 2018 1:51 AM
> To: edk2-devel@lists.01.org
> Cc: Jeff Brasen
> Subject: [edk2] [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support
> 
> Allow host controllers with spec. version higher than 3.0 recognizable by the
> driver
> https://bugzilla.tianocore.org/show_bug.cgi?id=1233
> 
> V2 changes
> - Restrict supported versions to versions defined in SDHCI specification
> - Add bugzilla link
> 
> V1
> - Initial support for controllers with versions > 3.00
> 
> Jeff Brasen (2):
>   MdeModulePkg/SdMmcPciHcDxe: Add controller version defines
>   MdeModulePkg/SdMmcPciHcDxe: Allow additional SDHCI versions
> 
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c    |  5 +++--
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c |  3 ++-
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 10 ++++++++++
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> --
> 2.7.4
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2018-10-12  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-09 17:50 [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support Jeff Brasen
2018-10-09 17:50 ` [PATCH v2 1/2] MdeModulePkg/SdMmcPciHcDxe: Add controller version defines Jeff Brasen
2018-10-09 17:50 ` [PATCH v2 2/2] MdeModulePkg/SdMmcPciHcDxe: Allow additional SDHCI versions Jeff Brasen
2018-10-12  7:49 ` [PATCH v2 0/2] [SdMmcPciDxe] SDHCI v4+ support Wu, Hao A

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