Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1691512ybz; Thu, 16 Apr 2020 13:47:34 -0700 (PDT) X-Google-Smtp-Source: APiQypL/KHJuL94Bbgfru+oXkwE18JM/x+4S++1YXy1Rj1QUzz1gCmMacuqBwEr7a70ir6W/MSNQ X-Received: by 2002:a17:906:7e19:: with SMTP id e25mr11871898ejr.358.1587070053882; Thu, 16 Apr 2020 13:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587070053; cv=none; d=google.com; s=arc-20160816; b=xj8JGs6zq3NM2PJGNyCtFh8mnC/13AU9AJaYoJEGmZcC7NPBVTFHpWPUj+IorJUuOD 9iMC3iCqsD0z0H+qsxjb9boBIr3nsXM7x9JLnpcYCfi1aJLDBQXl+LdSW/a4zPS4xy+U aHi1kEG0/HVEYMt6/RM9YI2M2yVjlK/1QPySEbbFPTh9wusjUtHwqBl1/YdQpDeB1OQz 4UOVERShvQRpQ6IBBatt3mYzcW6ZzJ9aHCNO/k1EWSw/nU1bCBDghBGPOZRWP7+WS2ax EMqjf3N7wbfoqWGk0OGaV0p+BDhbLnh1QJOjMdDexVdGkCEnpBQgZv5GZ8s1Cq7LjJGK 7FmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=e82KDXd5ytTWPE1FY/zm/Yn+yGNuQqRobHdfZUxy9Xo=; b=RFORS04SImYXY4bXUvYWYdL/oCkficC7ysdA8a+DEwi+1iL0hZJcRKAlHob0dYEXye c+E7YkAONFLKK+pUhB7ndjsQrZykO3Yc6VzyeuJAe7resjKsV5V507HM9IJ0JHjU0Pqf h7ya5NlNkzvq/k5BMhHoR35ldycP5k1grHzdTSBqM9K8JfVB+nxqupg3wSHZuFWXjTJL vAhUreKlOR32nP8koqllFQFleOWSDJ4rbj/fGmFf0hrHFWsKosv929q1dJLsMkeQI52f 2wYV12T8DId/3iv4/LovctQBCAb2idD+OV6iFQ5H5Jae72Mbf76gH1IFnuOGRtWIU4ti 9SGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fbLQGmH0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s4si12523025ejq.495.2020.04.16.13.47.11; Thu, 16 Apr 2020 13:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fbLQGmH0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729847AbgDPUbv (ORCPT + 99 others); Thu, 16 Apr 2020 16:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728880AbgDPUbr (ORCPT ); Thu, 16 Apr 2020 16:31:47 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96F4AC061A0C; Thu, 16 Apr 2020 13:31:47 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id i10so45801wrv.10; Thu, 16 Apr 2020 13:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e82KDXd5ytTWPE1FY/zm/Yn+yGNuQqRobHdfZUxy9Xo=; b=fbLQGmH060SUxuiJXgFOK9u5htf1EMwb3O3t9XcTaqIeBRKXe1T8OAT0xtqyU1Sw58 HQrHcTpV1+TqofzLRyEfxwicePTcvbZMeccmQ/KykjZNSn9WwOMLrfl1m0kCLKn5ZZbQ FafwCKHnc2idNjQic3oJuBM6c9Dmt/td6ry1+EYKpciQwC7nOoutM1WCBNOlJise8pW0 EjgDCZKfwpFSK9s/+Or70Ht3yG8Fpe9ahzNMvdXjtzHGMyxY0bFym7nQbWFFNSLuhH68 3caKHl21e8LMlL+hQKOqUWvCmEFgI/fmfFFtvJNQbXYQ86Gq0hJB5iAc+p3ihdHsymjD JuWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e82KDXd5ytTWPE1FY/zm/Yn+yGNuQqRobHdfZUxy9Xo=; b=r8DcWQXZ0dA/HXjmbmEJllVaevv1OsKkJwuK5x9XU3gDkclTJyMACCM3W0aViJsNl9 dAUjt38jfT4xKD+UVi/xeD9wSZvyqPCpm2fppLxTv8e97YxvRDKi6xVxZiYNzfkP2R2H 0O28m13mn/nYo0MM6SpL/3qgeRdjKA/H6ZwBkD1ckZ1CVTzgqN9c7FPwf3+hVSiVTMOd bW9aYXFmFNqkEyOf015KN11XahwW++oKmqF/ch69Mt1/XfLQ5gn2M7XVKKSg7LU6qD3y grePLOD9MGfYzKTnoi+J1yMZ10wdC9S75+uVMF+I1uTi2NGgsEz9pRuFwBMujy5HqWSS tTGA== X-Gm-Message-State: AGi0PuYLNB43BBaCQavOriijvHCpbF3BEOBeB9pXxFLhCdSyVaML/mKX okSKZpB5CryAyWxT09fvz0sAF0hU X-Received: by 2002:adf:9e8c:: with SMTP id a12mr35563836wrf.273.1587069105614; Thu, 16 Apr 2020 13:31:45 -0700 (PDT) Received: from localhost.localdomain (ip5f5bfcc8.dynamic.kabel-deutschland.de. [95.91.252.200]) by smtp.gmail.com with ESMTPSA id s9sm17638864wrg.27.2020.04.16.13.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2020 13:31:44 -0700 (PDT) From: huobean@gmail.com X-Google-Original-From: beanhuo@micron.com To: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] scsi; ufs: add device descriptor for Host Performance Booster Date: Thu, 16 Apr 2020 22:31:22 +0200 Message-Id: <20200416203126.1210-2-beanhuo@micron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200416203126.1210-1-beanhuo@micron.com> References: <20200416203126.1210-1-beanhuo@micron.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bean Huo Add HPB related attributes in devivce descriptor. HPB support is specified by Bit7 of bUFSFeatureSupport, HPB version is indicated by wHPBVersion and the HPB Control Mode is specified by bHPBControl in UFS device descriptor. Signed-off-by: Bean Huo --- drivers/scsi/ufs/ufs.h | 6 ++++++ drivers/scsi/ufs/ufshcd.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index b7fec5c73688..53a5e263f7c8 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -258,6 +258,8 @@ enum device_desc_param { DEVICE_DESC_PARAM_PSA_MAX_DATA = 0x25, DEVICE_DESC_PARAM_PSA_TMT = 0x29, DEVICE_DESC_PARAM_PRDCT_REV = 0x2A, + DEVICE_DESC_PARAM_HPB_VER = 0x40, + DEVICE_DESC_PARAM_HPB_CTRL_MODE = 0x42, }; /* Interconnect descriptor parameters offsets in bytes*/ @@ -537,6 +539,10 @@ struct ufs_dev_info { u8 *model; u16 wspecversion; u32 clk_gating_wait_us; + /* HPB Version */ + u16 hpb_ver; + /* bHPBControl */ + u8 hpb_control_mode; }; /** diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 698e8d20b4ba..de13d2333f1f 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6627,6 +6627,17 @@ static int ufs_get_device_desc(struct ufs_hba *hba) goto out; } + if (desc_buf[DEVICE_DESC_PARAM_UFS_FEAT] & 0x80) { + hba->dev_info.hpb_control_mode = + desc_buf[DEVICE_DESC_PARAM_HPB_CTRL_MODE]; + hba->dev_info.hpb_ver = + (u16) (desc_buf[DEVICE_DESC_PARAM_HPB_VER] << 8) | + desc_buf[DEVICE_DESC_PARAM_HPB_VER + 1]; + dev_info(hba->dev, "HPB Version: 0x%2x\n", + hba->dev_info.hpb_ver); + dev_info(hba->dev, "HPB control mode: %d\n", + hba->dev_info.hpb_control_mode); + } /* * getting vendor (manufacturerID) and Bank Index in big endian * format -- 2.17.1