From patchwork Wed Oct 9 11:21:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13828238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF91CCEDD88 for ; Wed, 9 Oct 2024 11:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ghtUYLBlSjf3IggEwHExig2CKcpoS8dsJVFld1RzVuU=; b=E6+0WC6iznbGexycs6V1jbQ6wg N6ytJMUOC1BdUNrhqSeq0/eiWrGDcIjZ0lxd1DUWhxxuVEcBLNwCsHJewceK6JUy4nj9SVXtxIH+o eAS2tBHfKqB7tvBsinMfGeq0WLn/n+Zrv4mvdo7ZV0BD3hhRQpUw5MLVeAZ1vpBUnK21YV1g7+LJ6 t5OMSKEyqQUT2TCMco5dYhaCjSLXbRJBV6hY86AZQ45QAlASSk6xN/8YSFTdFjIH2OSzoAFim0yq7 kdngLjqMU0IAmrBHMXsXc5h7OJo5afDFAIEd2iBm8nJMti0GiVa3xDesLaZPIpDV5EkDOc/OmB9sj qAl6mx+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syVK8-000000097VH-09Xd; Wed, 09 Oct 2024 11:57:48 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syUlN-000000092Sx-0pee for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 11:21:54 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42e748f78d6so60082285e9.0 for ; Wed, 09 Oct 2024 04:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728472911; x=1729077711; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ghtUYLBlSjf3IggEwHExig2CKcpoS8dsJVFld1RzVuU=; b=c1HpCoJ+dgNvySjJ7YAjZ30BQMOi1IN59kO+lkGnpmhxsHz4XQDQ6nhMtx/4uFwNY6 gVg2MkAbxiJDfi8VOqcVHBxOBM/DpF3cNVB27dIa+WJz0cToBpbb4R6PD1eooQoW6829 bZYk5K/QJVpiBJfswnQ+vYQLFZ/aCCqZosqIp6f/YtfbqhgeTZB8PU7267ZFfOC/B9sd WuDI8kbRvg33yhjrSMS79P5Zt39NPhTqqnqaA9K84LgexsI6/Z2ET/kMGnvytXjnrEbq PKcim54UZOUeol287SWM6ZCleojLyeLIv5HRYl6cfCbwv/PD5PkhiwY/pZSMw0aEh+vw xYdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728472911; x=1729077711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ghtUYLBlSjf3IggEwHExig2CKcpoS8dsJVFld1RzVuU=; b=XldmTmzxoL2QeshE/4qENKN0VyqprfTlzHUkg+aKzjKW6CfFPszEQ7AxU379qHbW/J 7Cgi1NO75jlJXZ6vzOTccv0KRti2kXtNkIZKlkAW5YgTZOmMOMOgus1bAvTdfo3du4Rq 05k40pwF3FfGnyhwIhjE2f/jXWUw2oppRz8ZgGO7wIkR0XKfCh693xAkM8bLm/obmVlM 8XeaOBA2AFsw46xOjBLvUlE+IH/+SGRt3mtL2X85u2/7nRxoGJXnQi2j+dFKMQ+Yz9q2 zEHdq8v42DfGhglwFUpqTzSyAsi6OWthCPhW7laf/mwZ35hP1XHq1D7DLxHgC7QO1Afq dflw== X-Forwarded-Encrypted: i=1; AJvYcCUOlgJlaQ4Un0hD0IGRnbs4nIdeAB50pgEQamGjYImJXvWmFbmA4t1l2yZ7LjhMnUxDY6k/OvHRx4uvgLagdSzg@lists.infradead.org X-Gm-Message-State: AOJu0YwsSxA0fIT0hRe0bDDAuzF42JcKctUN6kC7181SufQh/hJR7/yL s6TLcb8c+ugkAnpYXdrJaTC7O8O25TxhA7vZlNqzYvk3sfy0kzD4tVPfCVBMgJ4= X-Google-Smtp-Source: AGHT+IEJX2RjpFeLUHsr4Qx7o7zdf3TWL+5xxAUSFTySxWEYnSA6UXjwYDBXPN59NyQNksavaCy8pQ== X-Received: by 2002:a05:600c:3544:b0:42f:7c9e:1f96 with SMTP id 5b1f17b1804b1-430ccf091a7mr14596575e9.1.1728472911183; Wed, 09 Oct 2024 04:21:51 -0700 (PDT) Received: from gpeter-l.lan ([145.224.65.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4310c3dcdcbsm12331445e9.0.2024.10.09.04.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 04:21:49 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com, avri.altman@wdc.com, bvanassche@acm.org, krzk@kernel.org Cc: tudor.ambarus@linaro.org, andre.draszik@linaro.org, kernel-team@android.com, willmcvicker@google.com, linux-scsi@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Griffin Subject: [PATCH 1/7] scsi: ufs: exynos: Allow UFS Gear 4 Date: Wed, 9 Oct 2024 12:21:35 +0100 Message-ID: <20241009112141.1771087-2-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog In-Reply-To: <20241009112141.1771087-1-peter.griffin@linaro.org> References: <20241009112141.1771087-1-peter.griffin@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_042153_387724_8EA48467 X-CRM114-Status: GOOD ( 11.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org UFS Gear 4 offers faster speeds, and better power usage so lets enable it. Currently ufshcd_init_host_params() sets UFS_HS_G3 as a default, so even if the device supports G4 we end up negotiating down to G3. For SoCs like gs101 which have a UFS major controller version of 3 or above advertise Gear 4. This then allows a Gear 4 link on Pixel 6. For earlier controller versions keep the current default behaviour of reporting G3. Signed-off-by: Peter Griffin --- drivers/ufs/host/ufs-exynos.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 9ec318ef52bf..e25de4b86ac0 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -771,6 +771,21 @@ static void exynos_ufs_config_sync_pattern_mask(struct exynos_ufs *ufs, exynos_ufs_disable_ov_tm(hba); } +#define UFS_HW_VER_MAJOR_MASK GENMASK(15, 8) + +static u32 exynos_ufs_get_hs_gear(struct ufs_hba *hba) +{ + u8 major; + + major = FIELD_GET(UFS_HW_VER_MAJOR_MASK, hba->ufs_version); + + if (major >= 3) + return UFS_HS_G4; + + /* Default is HS-G3 */ + return UFS_HS_G3; +} + static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, struct ufs_pa_layer_attr *dev_max_params, struct ufs_pa_layer_attr *dev_req_params) @@ -787,6 +802,8 @@ static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, } ufshcd_init_host_params(&host_params); + /* This driver only support symmetric gear setting e.g. hs_tx_gear == hs_rx_gear */ + host_params.hs_tx_gear = host_params.hs_rx_gear = exynos_ufs_get_hs_gear(hba); ret = ufshcd_negotiate_pwr_params(&host_params, dev_max_params, dev_req_params); if (ret) {