summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2018-02-01 15:07:43 +0800
committerGitHub <noreply@github.com>2018-02-01 15:07:43 +0800
commitcf371e502bfc891a0f4009875d93345952a0c217 (patch)
tree3d15160ebf5db07cca624650a185fe2a8c79e2f2
parentfeefaa5a352e27cc3f56195f19b034f12b0d6767 (diff)
parent5944068bc71cc7356bdb5f6eaa27b16dc1915f87 (diff)
downloadedk2-cf371e502bfc891a0f4009875d93345952a0c217.tar.gz
Merge pull request #57 from hzhuang1/hynix_ufs_2
hynix ufs have some bugs for fixed
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c19
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h3
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c6
-rw-r--r--MdeModulePkg/Include/Protocol/UfsHostController.h3
4 files changed, 24 insertions, 7 deletions
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 761dc8ee1..8c9aad903 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -778,11 +778,14 @@ UfsPassThruDriverBindingStart (
UINTN UfsHcBase;
UINT32 Index;
UFS_CONFIG_DESC Config;
+ UFS_DEV_DESC Dev;
+ UINT32 DevQuirks;
Status = EFI_SUCCESS;
UfsHc = NULL;
Private = NULL;
UfsHcBase = 0;
+ DevQuirks = 0;
DEBUG ((EFI_D_INFO, "==UfsPassThru Start== Controller = %x\n", Controller));
@@ -855,6 +858,22 @@ UfsPassThruDriverBindingStart (
MicroSecondDelay (100000);
+ Status = UfsRwDeviceDesc (Private, TRUE, UfsDeviceDesc, 0, 0, &Dev, sizeof (UFS_DEV_DESC));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Ufs Get Dev Descriptor Error, Status = %r\n", Status));
+ goto Error;
+ }
+
+ if (SwapBytes16(Dev.ManufacturerId) == UFS_VENDOR_SKHYNIX) {
+ DevQuirks |= UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME;
+ }
+
+ Status = UfsHc->PhySetPowerMode (UfsHc, DevQuirks);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Phy Set Power Mode Fails, Status = %r\n", Status));
+ goto Error;
+ }
+
//
// Get Ufs Device's Lun Info by reading Configuration Descriptor.
//
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index af13757c1..ed1249b98 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -45,6 +45,9 @@
#define UFS_MAX_LUNS 12
#define UFS_WLUN_PREFIX 0xC1
+#define UFS_VENDOR_SKHYNIX 0x1AD
+#define UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME (1 << 0)
+
typedef struct {
UINT8 Lun[UFS_MAX_LUNS];
UINT16 BitMask:12; // Bit 0~7 is 1/1 mapping to common luns. Bit 8~11 is 1/1 mapping to well-known luns.
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index e53347d3a..e71be6afc 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -2113,12 +2113,6 @@ UfsControllerInit (
return Status;
}
- Status = UfsHc->PhySetPowerMode (UfsHc);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "UfsControllerInit: Phy Set Power Mode Fails, Status = %r\n", Status));
- return Status;
- }
-
Status = UfsInitTaskManagementRequestList (Private);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "UfsControllerInit: Task management list initialization Fails, Status = %r\n", Status));
diff --git a/MdeModulePkg/Include/Protocol/UfsHostController.h b/MdeModulePkg/Include/Protocol/UfsHostController.h
index 66cd629dc..f98be7072 100644
--- a/MdeModulePkg/Include/Protocol/UfsHostController.h
+++ b/MdeModulePkg/Include/Protocol/UfsHostController.h
@@ -230,7 +230,8 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EDKII_UFS_HC_PHY_SET_POWER_MODE)(
- IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This
+ IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,
+ IN UINT32 DevQuirks
);
///