From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web08.4308.1648210691237861050 for ; Fri, 25 Mar 2022 05:18:12 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=gODLo5rF; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: purna.chandra.rao.bandaru@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648210691; x=1679746691; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=IcSChssqH9lqXdgItrwNrbcjI4Q0ltpEBfF5PDunxKE=; b=gODLo5rF4NbI2gOngoU+gPybA2Z6xE7SXoWvEdP697wn9OGEAduHJhpP pjh2isU1xKHCzlLwA9/RsJeaR1MOBnQUXRqN1p1yQ4Ocr+oje65agrk7X H5nLQeXA8CfbNAa2kJs3TLMTLJDNLs4ksR3xLcrSkgmnxALRwgmZhjT0t pWvAgiUosgj6yLfrpPZ+ySCUUGIwHPxO0PzTUAw6RvF8KzKxLnwx9/jok MMpRa7Ai3WTfvpmtvT1EogGFGsWGUr+Fl9eGuzVhLRH8HwBlIIOv10YQY k28Z4SC0du1vTfsbX2epVR9lMcdFidlcje/wnKJLOmBH3pd/eqC4OIKZT Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10296"; a="283491544" X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="283491544" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2022 05:18:10 -0700 X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="520184563" Received: from pbandaru-mobl1.gar.corp.intel.com ([10.252.82.171]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2022 05:18:08 -0700 From: "Bandaru, Purna Chandra Rao" To: devel@edk2.groups.io Cc: Purna Chandra Rao Bandaru , Wu Hao A , Albecki Mateusz , Liming Gao , Zhiguang Liu Subject: [PATCH] bRefClkFreq UFS card attribute need to be programmed after fDeviceInit Date: Fri, 25 Mar 2022 17:48:00 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3886 bRefClkFreq UFS card attribute need to be read and written after successful fDeviceInit and NOP response so that link will be stable. Cc: Wu Hao A Cc: Albecki Mateusz Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Purna Chandra Rao Bandaru --- .../Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c index dc78e09678..ae593ff03a 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c @@ -919,6 +919,23 @@ UfsPassThruDriverBindingStart ( goto Error; } + // + // UFS 2.0 spec Section 13.1.3.3: + // At the end of the UFS Interconnect Layer initialization on both host and device side, + // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready. + // + Status = UfsExecNopCmds (Private); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, Status = %r\n", Status)); + goto Error; + } + + Status = UfsFinishDeviceInitialization (Private); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Device failed to finish initialization, Status = %r\n", Status)); + goto Error; + } + if ((mUfsHcPlatform != NULL) && ((mUfsHcPlatform->RefClkFreq == EdkiiUfsCardRefClkFreq19p2Mhz) || (mUfsHcPlatform->RefClkFreq == EdkiiUfsCardRefClkFreq26Mhz) || @@ -967,23 +984,6 @@ UfsPassThruDriverBindingStart ( } } - // - // UFS 2.0 spec Section 13.1.3.3: - // At the end of the UFS Interconnect Layer initialization on both host and device side, - // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready. - // - Status = UfsExecNopCmds (Private); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, Status = %r\n", Status)); - goto Error; - } - - Status = UfsFinishDeviceInitialization (Private); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Device failed to finish initialization, Status = %r\n", Status)); - goto Error; - } - // // Check if 8 common luns are active and set corresponding bit mask. // -- 2.31.1.windows.1