From patchwork Fri Oct 25 13:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 838677 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC2381632FC for ; Fri, 25 Oct 2024 13:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862093; cv=none; b=qk7x/9QCFFjUNIP333Jpm69aY6tpHl+yas/f3m4YJ33z8o0tiqmbhO77cwn/jhbcbU/zQv/mcqBjJnCpZ8ILg9bwFsh36y3HajKdotML4tMK28gKV1NgsQQ4p9pdq0LOZWt7Z+LeAzBPPDffbSh/GMevY6PXp1jPsH3oLRW39Ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862093; c=relaxed/simple; bh=XQJlYvZ6vjn/TYO+WTDp4FMJOckllIU+bQgG44hsbCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jeV+9LpS+7gfhYcuAgYvL6bG4W9lb5SXikqM7W1WftoQtQpawLbs/b+LDtrQcOar+erpDfmrwAK5sOiaPUT0jWF+5iP+OpXJ2RvjaRNNX/K8Vpit198pookDDaUDYsydY3EYe77PPoN+CKMeXOF/yQTM+yB7HmaJszdwOZ1FRPo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HjrK8CEF; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HjrK8CEF" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-431695fa98bso19834165e9.3 for ; Fri, 25 Oct 2024 06:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862089; x=1730466889; darn=vger.kernel.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=mphjevL2wKBjhbt7qb95YXVF8X2HJNmvgdrJOySayeQ=; b=HjrK8CEFsT7+nAKDWnRBRB2T6DBSkrHLSjY/jqMzO3BzpbnjiWnfFjJYc8SerbXt8H BSP6bKWlOHvnOR8HHaRMYEDfJATtFBP9butVVIm6K/ASn0ta2qL6htUkAbyDvFmngLEy zVfhw2IRJog21N851OCsroQLPwUkqL14BUbE1ZpMZvPMES6VZ/jR4iqu/d/WJcoBAGEU UfS+MMQEdusjlNs9kdpf8VyZq55diapcuuJikVexH9R6sB2dya333DE955Zgx1P85nxC kyAfNtFSs6Mrp1ZaWa6pGex2mLx1FcsJCZg/LUED58WYlrlW4rNDCLkzlgfNObkjNfKF J3xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862089; x=1730466889; 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=mphjevL2wKBjhbt7qb95YXVF8X2HJNmvgdrJOySayeQ=; b=YUucz3sJXAW8rLTj3gN5n3g64W23oRY3zVbaDklnLbseU1BJl3RtaZaLjUECge4WB4 wCdO7PorwWxzKpqLdIl715PU3/yIzDadGzqbmIRtzOKMXOAkixszJwcGY80zV5eXfsZc 6GhRhUqAhWHLVxD/RtH5/A7HL88qDku4jFpHjgFcSVid1xnwXeGMRq2rWx3CoGsS19RQ PV9Tm/5Vf/hlBvI9Rf9N4nKgF9ogIlImYevG0cx7egWVZKe529VVZcCD+tEs2oEYufmY 7uqEK4YLqKhrKqmw4VCGvODIAxqnGnNT661QQ8rxMXSr6JMfodQEtjs1XU5zVDHlQ32m ODuw== X-Forwarded-Encrypted: i=1; AJvYcCWQSK+C6A29weZiSGEkOxSocq5G84M8UIXyiHxdmvaHrlpGEjBy1cuCpd7htjj8t3AgKhXiwY7FhLL3@vger.kernel.org X-Gm-Message-State: AOJu0YxvW8ufFT0qJA3dd3VdjzeOQFPeMFC9amvdePoW2FRdiblZoB0I t6lGn7kF4So8eP57TBXNjGvIsBphTi4uxGrDyMqoRdkCvhXtyQiz5d073UD2o1w= X-Google-Smtp-Source: AGHT+IEoUmmF2a29+b6OYTb4dbCjEKsfEZfPzHCBO3Ytnq8YsVvh+s+5uHtHvSiBw8IREAZ9aiGHMw== X-Received: by 2002:a05:600c:468f:b0:42c:a6da:a149 with SMTP id 5b1f17b1804b1-4318c73a46amr48990985e9.25.1729862089150; Fri, 25 Oct 2024 06:14:49 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:48 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 01/11] scsi: ufs: exynos: Allow UFS Gear 4 Date: Fri, 25 Oct 2024 14:14:32 +0100 Message-ID: <20241025131442.112862-2-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Tudor Ambarus --- 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) { From patchwork Fri Oct 25 13:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 839090 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65E821F7550 for ; Fri, 25 Oct 2024 13:14:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862096; cv=none; b=MEnm/g/LXOpH30Hw71D3kKbjG3/gMb2zqTjnK8+hgrzWAquPtncZ3EAcou+7b5v7aJGciHvcNCa0G+7ULCl/YPnVRHVVO/9Hw93HpxQPR+OrcmmyKsGqqclQvOmWiHwaktbRrOu67qhQlEAm3WAN+i+phAxQZMGCTtfahunWGXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862096; c=relaxed/simple; bh=52vVF03lgySM2/6ZOOgdrHinb/FvQUa3VHWIhQleV78=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D9JmaGuyw8uhbpr3EnKOBhvC6YK4rE9JQxx6bAXv28OwS4aCPbc4Y07x4Gw4Grd/vGERxDl4Sxd1u+DoyXZa9Ae/b5whrKnysUW/NoEgvNgtnQEaPlzCdl/3JyRI2/PaPYJLZ+/viRWg+cWLhuXcPv8Pe/Noe9Lt+S7r/7Fe5MI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hlwMn1FE; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hlwMn1FE" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-539f0f9ee49so2158308e87.1 for ; Fri, 25 Oct 2024 06:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862091; x=1730466891; darn=vger.kernel.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=9ndmeeqYmXUmeG3ahgXNOhxMW6zZzHIs2RxYCsW225E=; b=hlwMn1FEuu+VB5I4KfJGcr3MEbBntU4wVZfTEKhUt5CZrxCdZnbpF0bHS87A5k2zE/ NUfr3cVPYQn5DBtWh+oQFc/PGQj8mdBHajlfLesxWjXETEr5hhp0xMMcPV6SGbWTG/qO pKpkVa/IhwAEjdQEtBfV5IA79a2BUuCewn45yO3I8dUN+B/d6y0zYHbhdEblUffkLWWQ LFGM++8uYVaU+CV7N4wrXjRtUoWCIbpl1nMoQuY2pRwPCk0h8FSOYGOLDJxnaUgLxE+N Qo6mrjd3a3XIuk2FAHhfAwVT5LGuPC1blLLPGJIzd2i/koQMguUi6WYR72z04q8bN3DT P2FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862091; x=1730466891; 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=9ndmeeqYmXUmeG3ahgXNOhxMW6zZzHIs2RxYCsW225E=; b=BkxujvkukN9ZEZqMyR7FwbcWdDv7PCOYk0E/8Xn0Me63cJA6p+fq0t7gkJf614PEev ByXE+OorV587STc9q5pHdFLnjDZKETnDsvGDGvm8oqFnmd5J4CmP2cNas1tCgsVivjXB oNdHT+6GdhyEZkFVTJgsXQd7hVDIULLYgqetkTijk1u31rj3ZxTmR8xbGEft3K5CP/wG jmS7fCxAfDfhaSGtE4jCjdion+lMEY0/P3gN4mtVA7BvKPE2Jtulljkm9h4kRbIbE23M ftfaJH3E/RukOi1lAsqCIws5ZL/j2HXkAkhFNqVR3fGmblybpR31fgo0Yrry/zgxo2mS vDtQ== X-Forwarded-Encrypted: i=1; AJvYcCU8S70h/O47iy8T8YsDQh2RoNFPRYkTfs3GdtoYaYiFY3MMdjg409tzIyDfp+P3xPMvjVFEIYATDq9Y@vger.kernel.org X-Gm-Message-State: AOJu0Yy3alqq9sE42/3oqVQx6DJi7Sst6n8w9jPq1W6zxISMxMqBrg1H pfDJRUGzVLLCkT40RWDzEdVBLs+ZuEAr9j+ZhnNeXgKM9FLyEhqXyfc7eF4TFG8= X-Google-Smtp-Source: AGHT+IGqC8HKU9NrjiBFGdut1et0Yr+WYmeKxlnHqZ/w+vIyRSTfXiYFfbHCJ6h5jr2qgVPoi7F9Wg== X-Received: by 2002:a05:6512:6c3:b0:539:e279:b3da with SMTP id 2adb3069b0e04-53b23df5806mr3664939e87.18.1729862091324; Fri, 25 Oct 2024 06:14:51 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:50 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 02/11] scsi: ufs: exynos: add check inside exynos_ufs_config_smu() Date: Fri, 25 Oct 2024 14:14:33 +0100 Message-ID: <20241025131442.112862-3-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move the EXYNOS_UFS_OPT_UFSPR_SECURE check inside exynos_ufs_config_smu(). This way all call sites will benefit from the check. This fixes a bug currently in the exynos_ufs_resume() path on gs101 which will cause a serror. Fixes: d11e0a318df8 ("scsi: ufs: exynos: Add support for Tensor gs101 SoC") Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index e25de4b86ac0..939d08bce545 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -724,6 +724,9 @@ static void exynos_ufs_config_smu(struct exynos_ufs *ufs) { u32 reg, val; + if (ufs->opts & EXYNOS_UFS_OPT_UFSPR_SECURE) + return; + exynos_ufs_disable_auto_ctrl_hcc_save(ufs, &val); /* make encryption disabled by default */ @@ -1457,8 +1460,8 @@ static int exynos_ufs_init(struct ufs_hba *hba) if (ret) goto out; exynos_ufs_specify_phy_time_attr(ufs); - if (!(ufs->opts & EXYNOS_UFS_OPT_UFSPR_SECURE)) - exynos_ufs_config_smu(ufs); + + exynos_ufs_config_smu(ufs); hba->host->dma_alignment = DATA_UNIT_SIZE - 1; return 0; From patchwork Fri Oct 25 13:14:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 838676 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ECC32003C1 for ; Fri, 25 Oct 2024 13:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862096; cv=none; b=d/Hvisyk3qFEjNXU/XNNXbgDBowMvd7b86JvarowX4yw4CyGPhx3UTEL3UFwkAHEa+OTxL9ssC5+yqUXnyEwFHwaSLALBGS3PhmMnwHz/UKZX2czHUC4DcYbWfAn0uMX8YDhciy5ymS3XPZ8tF6LoBvxkoxdqcLv1/6rDMoMZRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862096; c=relaxed/simple; bh=nFcIrt+JzS+rRiCV4wugLYxatuBOei3DlyFR1BxfoD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mg0Axp/72FSmGdLayIWUNcxkeGNqL4rKy8Jcgmp42xH3LP5LPFygrj8F+ZIPOJKeg4FMrEqKf6wkBjtvy6+7wkg/yyTNiLVEjnMNQKf3e8nLSMeo3XRDWNvtHND2zjKSTcuqLfJq3vNGYGxgCAw/C7ctu4zmyL9uRhB180s1mDU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=otZykFAg; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="otZykFAg" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so20428325e9.0 for ; Fri, 25 Oct 2024 06:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862093; x=1730466893; darn=vger.kernel.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=yQgS5nIosT9WP+28fCSlQ/AHJVYYLIctL5rlsevVeIM=; b=otZykFAgvcNLkshp9T1l8FpU8O3Fqi97fRx55xX4FWFftCB1M1iuMq1t+1KAqmUwrW IlM24mxxkOs18fS/v7KMXCRZX9ZeIcqxEvFBl4v+fqwljohaXKNxdnVmD/XpYWJB6FmG y2dnoUhyR/XBY5q3OFsKvsycIOMpZaDSCgTPosiwXNsxujfBIQ7A0uD7b3nRFGnszBhv U2C+kY0qiuCg7CJ/Dzy9HMgwyyRLY6wi5x0a7EhygvcjXn7q8PBEzrrhM+Y+hl6M89Xl ciZoKNOXgejNLK/25dyA1kr/nfRw1w+GWbayLkGLUUifrRPOHEvzh57IjvHFP1ibbs3Z pLoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862093; x=1730466893; 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=yQgS5nIosT9WP+28fCSlQ/AHJVYYLIctL5rlsevVeIM=; b=jRFlQPu7YS3BEaEKOkyEUoZ2tsEbN8xcVMpsHM1QJtODaYm8ljeA6VWCA1eTFS3WRX YJCagaZnZsWnNXdYz3pyGsnVs3gU4lUfcoIHR2gE1dqt76j8J9DMOiN3UPFEZLz+SYY3 kLIRgVs6zNWT3xbd0C7gD/yFlDwlBrGug0JCu5/hopeCVpm8YoooulfJuaQHcEHzMTNr cNj+ilgd4l4fyKc1j7Ae3FlxGt5baftf01f8eFksGB2doIURQZwcPiDAhPjAwVO+Svja 9h2P2cAFZrI8qeHH8vc1i1E9Bz+zjjij9EfR7MMOZtjCG43JbRH8SA6LNYja6/19aYrI 38Rg== X-Forwarded-Encrypted: i=1; AJvYcCVdBiAlqMPOTe8kRpuj81U/XFjoB/mwjJGopti84/Hkccn6FJWq6iX2A3ovFihA5OcHUPW9HBup03ui@vger.kernel.org X-Gm-Message-State: AOJu0YwPmumhemMRmqdqp8QStrPlcPLS0w6bEtOtTHJAJ8elrg+df1eV nuIOSQVi0E667THAFuxzt9eeybFuu92MTBTzKlh+zBfdejVsaRq1Jtixpr64ky0= X-Google-Smtp-Source: AGHT+IFu6kZDvdli2L18ry096b5sZipxK9OsOWeDSxbyTNiVEAO1GAWmUbs/6CZi5Y3noCEY1ICL6w== X-Received: by 2002:a05:600c:3543:b0:431:6153:a246 with SMTP id 5b1f17b1804b1-4318414a3d9mr88410625e9.13.1729862092697; Fri, 25 Oct 2024 06:14:52 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:52 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 03/11] scsi: ufs: exynos: gs101: remove EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL Date: Fri, 25 Oct 2024 14:14:34 +0100 Message-ID: <20241025131442.112862-4-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This flag is not required for gs101 SoC. Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 939d08bce545..d685d3e93ea1 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -2142,8 +2142,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = { UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR | UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL | UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING, - .opts = EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL | - EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | + .opts = EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | EXYNOS_UFS_OPT_UFSPR_SECURE | EXYNOS_UFS_OPT_TIMER_TICK_SELECT, .drv_init = exynosauto_ufs_drv_init, From patchwork Fri Oct 25 13:14: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: 838675 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2DA820BB23 for ; Fri, 25 Oct 2024 13:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862099; cv=none; b=eQJwDY92NKie8mHYaB/U7VUFvBlXSoC5Q9vv7RBc1buqPSiNLxi7WYrpMP6YlXL78M0ST2XuftsXrFrr1VBpeRRwQ3/WFfVc/c68iwSPaVP3hyykP009rZJIm22m5lw9vaEiYura7zrV6DjwjFyE8C0pnPr/vzbCWPNlbHjvKwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862099; c=relaxed/simple; bh=p3g/8Z+J2ecDwNAbeCRrJL+kfRSjnRzkTSKppiTWOGE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N/hRRaVkTs7j/qrJteSLL8rgXFPvajEsomggkE8JNDyD4Il6NlsEJjIMHKDYnamaq6FcIE9I8wQqX6NcDFkqpPVnjwr694nLjUEWz13oN6fbAiIhUMRcABZ6+vqu+wTfEV9lmqaEqkn1gHls/9BliuamNltFNUrRzv6yybq/64o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Usum0fAE; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Usum0fAE" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-539f6e1f756so2412138e87.0 for ; Fri, 25 Oct 2024 06:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862094; x=1730466894; darn=vger.kernel.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=cdoImO6OFfTM2Lw/aicaT3K93cFHqPSr98CjhrJS+DM=; b=Usum0fAEfnAwg3DRH7UdAGsJxPATtqGNJdUYbE4dijh2ZeJf8cDpLpQv+6JWlOSyCQ UhDh90QmUyoZ3lp9dmn8m1RkrIo+fsi9Mi3AAHZag24g7vGzTD7TEGl3GIM4BNpklFH2 QidgeNUrhsFjot4Y9paoZWveLi500zWezYN7pZZgeko2Vst2rK7Htm+FatRFZhHocI/v l6TaYsPBGU6EqeO/z8shvLwRyzSJ0ERMqAsEGPFBQ1/qOsgPciwD6dmPut4iSFSDrGKA 4jl4adjswJ63QyOimLourBwYo3rp8IRd7PlhhKy9gEs9MJkSi9AsJ0nWRfeGh3x6jMty nzhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862094; x=1730466894; 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=cdoImO6OFfTM2Lw/aicaT3K93cFHqPSr98CjhrJS+DM=; b=uqcLUoEA4DVtuBn61mXE5mxGkeoieoIgjIX8ufN9vJuyhdJGtkGhQCn6+TCtIGMEBM 1dMK4BdT/RlLZuG4/cOMWlBmmuvcMDX9lCQ4W4PUtI5jn/qVpM9gq3g+AUOttBZkroV3 Rf9D7yddrsqSLI6RI1jwqtXKmDAAxD9o/Ds4cXqMP3ztI/gCzJyBV1JKbUj85vpUM7Ai G001xVr3Z22LGJJeKO4Ghg89BRTVa0zP5WK24AlmuQDKzxL4keJhPgumC8OslrGqgV5w T5/VxYhYiDCqVJ6vRXpHnMqr0X0u6cpg5c5AjqDeejwDx8VlJLBu1gz0Kg71EI8Gwcaq zsOg== X-Forwarded-Encrypted: i=1; AJvYcCUqopo7oSNe+GJ9uKgc2sGfdftr4tgm1Ek8QTQnCe55qs4xEbl4WGLLLAsnac7WbgMNtwbFaojSdhOg@vger.kernel.org X-Gm-Message-State: AOJu0YwB6rRDJB0LJ1wju32hfz7x6d2XicafpTIf1ZsrifrpFrChi9qf Xsxzscv8SNY5eMPMyjXWnvRCBwQ5sD/k+zTjtU/ZePHRVIZDR+kgDKKO7VMtnpo= X-Google-Smtp-Source: AGHT+IHBrQGT9pmxc4oL2n1+HSGkoaeL5c5Y5zzjK0zgLQAj/a//GEezqB7iJbnehPJAIoa5TXY2sg== X-Received: by 2002:a05:6512:1585:b0:52f:d69e:bb38 with SMTP id 2adb3069b0e04-53b23dcd34fmr3409903e87.2.1729862094046; Fri, 25 Oct 2024 06:14:54 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:53 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 04/11] scsi: ufs: exynos: Add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR check Date: Fri, 25 Oct 2024 14:14:35 +0100 Message-ID: <20241025131442.112862-5-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The values calculated in exynos_ufs_specify_phy_time_attr() are only used in exynos_ufs_config_phy_time_attr() and exynos_ufs_config_phy_cap_attr() if EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR flag is not set. Add a check for this flag to exynos_ufs_specify_phy_time_attr() and return for platforms that don't set it. Signed-off-by: Peter Griffin --- drivers/ufs/host/ufs-exynos.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index d685d3e93ea1..a1a2fdcb8a40 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -546,6 +546,9 @@ static void exynos_ufs_specify_phy_time_attr(struct exynos_ufs *ufs) struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; struct ufs_phy_time_cfg *t_cfg = &ufs->t_cfg; + if (ufs->opts & EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR) + return; + t_cfg->tx_linereset_p = exynos_ufs_calc_time_cntr(ufs, attr->tx_dif_p_nsec); t_cfg->tx_linereset_n = From patchwork Fri Oct 25 13:14:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 839089 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A96320BB3B for ; Fri, 25 Oct 2024 13:14:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862099; cv=none; b=oKP2RA9ZVUZjUQiToJ0EoAaleYOdvRB3in9WH4nMxr6noW4yAyGRCe+0RkUWJzqsyrABeE97Jo0Tghr51TAquBhNSN/lKhTj7O+HzBwkjykenSmRaudKhRqajVhsgvQq/0L1vagZdx2B+fIjohynJyp6DAoMESmr9EODleOgiBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862099; c=relaxed/simple; bh=5eFNbj8oKYgUwgjCPIPgeqetnx6XevHf8p0h8myP650=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VoFiv4Vbp/BTU4qrYyhLwS1nYRRquJHKLYxgreU27cVvr5WW56vj6/Mzn9oAS6Nnq8fwC/9XsEeetOhRP6v41zgTC+Q6MPLkceVtF5Cqyx60SOOfAaLF06qAbHwKK2YUm5g2B6jKA+cHlazJ2pDdQEX8+ho64EIZync+OZSdtGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Wy2xOp9f; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Wy2xOp9f" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-53a0c160b94so2436179e87.2 for ; Fri, 25 Oct 2024 06:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862095; x=1730466895; darn=vger.kernel.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=M4p/a/n3EAi1phVyfP45uoVE5rF3xsXeLLa3VUUHv34=; b=Wy2xOp9fUzbZ2W/7xYQjYaryAa6BHnlzKLPu10Vj/amZr2+GNi5PS5/dGNdx/W/AvS 0ncux9kscK4KZWkt2OGnvvgrgdH3SwtO1rKkE6YuTyxr+4CwtH7I94OepIo10cGZTFm0 V86CuToeFFYzZvAhsO7E2/+AOlTlkOJYvo1lJTxotyxg+E2rMCCUjEAVhfqt1Nc7EdfR 0HNc9yyDbd8a3VU99dvfMqZjsJ8aMX3qWAY/0eZqnOvepod8QMepHjE/FhnwsEmXG0Aw Sk0Vh+knbGtI5HnFtCv9M8AwB0KZ13KcjmDKsc8abacLRdTQa3Kj8wDK974nRU8ntHAG byrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862095; x=1730466895; 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=M4p/a/n3EAi1phVyfP45uoVE5rF3xsXeLLa3VUUHv34=; b=Q8sVO6KlFnulIgpf/8zZZb0s3xaRlQ+LGUZfI4qModx/kT18qjxBw+EfG1pVAEWtMx yB+QyjhctdKi/dx7Vp39O5eVx7XWGPWd0V5so6ExjfcllPY3lIJypzcRtW0qWiZjAInx oR7kyDxVwtV66rUH0YX2+Fpbn3nzah/3iA8OM92LPSX1A7UQoVkIsStmX1EJMhJVSYLV V8Z1iL/7+89TAkcs/h1xjkAjmIckpTBrN0X+FQh0xAGkiqvC1acRNJY27J8KQ3+QCpYM lRW0wENk9DOk8P0dnbxTxx2FBxuVvasfLoMlF6/9ScZYxFDlGG59FV0pq+5it1Fzb/59 wcpg== X-Forwarded-Encrypted: i=1; AJvYcCWI+Sz6zn85qEjCkgZm6BzvHN6E1MUXfcUlzPLq0ivahATbFAcEs+i8zpvNwLMKCeSCayuh3gWVaWnB@vger.kernel.org X-Gm-Message-State: AOJu0Ywx08Ogj2WHWQAFoubtYoORaWxi1GzUsT76RrmLVYEB3Lw+Fa99 KWyGOxH0MUSofhoYEBQoEjRWXmawwsJ+k8VT0W/GrG7qBZ43CzYBUpi97fnORM0= X-Google-Smtp-Source: AGHT+IF1nqwM65nZ/hmqcna4gL0pzIQdq9UtAly6V9yqCaP7b5l/UQUT68oG19uDiQ23I6pznxiPSw== X-Received: by 2002:a05:6512:234e:b0:535:6cde:5c4d with SMTP id 2adb3069b0e04-53b1a2f1eebmr5293668e87.3.1729862095389; Fri, 25 Oct 2024 06:14:55 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:55 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 05/11] scsi: ufs: exynos: gs101: remove unused phy attribute fields Date: Fri, 25 Oct 2024 14:14:36 +0100 Message-ID: <20241025131442.112862-6-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that exynos_ufs_specify_phy_time_attr() checks the appropriate EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR flag. Remove the unused fields in gs101_uic_attr. Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index a1a2fdcb8a40..9d668d13fe94 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -2068,26 +2068,6 @@ static const struct exynos_ufs_drv_data exynos_ufs_drvs = { static struct exynos_ufs_uic_attr gs101_uic_attr = { .tx_trailingclks = 0xff, - .tx_dif_p_nsec = 3000000, /* unit: ns */ - .tx_dif_n_nsec = 1000000, /* unit: ns */ - .tx_high_z_cnt_nsec = 20000, /* unit: ns */ - .tx_base_unit_nsec = 100000, /* unit: ns */ - .tx_gran_unit_nsec = 4000, /* unit: ns */ - .tx_sleep_cnt = 1000, /* unit: ns */ - .tx_min_activatetime = 0xa, - .rx_filler_enable = 0x2, - .rx_dif_p_nsec = 1000000, /* unit: ns */ - .rx_hibern8_wait_nsec = 4000000, /* unit: ns */ - .rx_base_unit_nsec = 100000, /* unit: ns */ - .rx_gran_unit_nsec = 4000, /* unit: ns */ - .rx_sleep_cnt = 1280, /* unit: ns */ - .rx_stall_cnt = 320, /* unit: ns */ - .rx_hs_g1_sync_len_cap = SYNC_LEN_COARSE(0xf), - .rx_hs_g2_sync_len_cap = SYNC_LEN_COARSE(0xf), - .rx_hs_g3_sync_len_cap = SYNC_LEN_COARSE(0xf), - .rx_hs_g1_prep_sync_len_cap = PREP_LEN(0xf), - .rx_hs_g2_prep_sync_len_cap = PREP_LEN(0xf), - .rx_hs_g3_prep_sync_len_cap = PREP_LEN(0xf), .pa_dbg_opt_suite1_val = 0x90913C1C, .pa_dbg_opt_suite1_off = PA_GS101_DBG_OPTION_SUITE1, .pa_dbg_opt_suite2_val = 0xE01C115F, From patchwork Fri Oct 25 13:14:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 839088 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D3120BB57 for ; Fri, 25 Oct 2024 13:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862100; cv=none; b=AECH9NPBc8RsZiSxUMAlQzzV21YmvkztO6zjB1/0/amj3LccGH0n6eJRN0dQeB1Hrf1GX12lNULpNCDNY91quzyhwHPFNNCLniSICDWtJIn/kFLJtzG/hWtUy7V0tfI6B/kdghMbha+825akiH88of5azywAU/dK/OPvXV6R5Fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862100; c=relaxed/simple; bh=x7XRxl7ysLw3w3rGpNl5xX6v+xyCoZrRF5jieQeGFEc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KyxkfsSX7Ejp0idT76N9suCYRYRr6gY+6SzlUgmNQzVd55MpyhjwuySBQZEPm4dAdKhy4MeqDf8vBtLYQ9z9e8/R3okWpJYg/qcS0FigflJkB/hvyV1yDDAYV2i5UlmUAIXII6s3ua2ReV/0hkxCertGb8eE3zRN9IFdUJYLzKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cm1KTRXz; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cm1KTRXz" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4315baec69eso20499825e9.2 for ; Fri, 25 Oct 2024 06:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862097; x=1730466897; darn=vger.kernel.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=cNn15pq7FtlSd8hCdE286On7l4GZ1JdLdzQd70l8fTI=; b=cm1KTRXz5lg838koa+prBNwXYveBj5m3AOdbflgBkOAeuSPsMODLhq+ECxNuT+3jpx TzIXalUL9K60+6fSQonUf9Gfh3pZUfKd/UJs+IzCkLNA9u2sQWTmMv6zpXxByBn/IOXx Cp3MhQ1ZSCblqCspoAGzrkNLKJcyaYvaJ/8H++4hfkAyhFl1z/qyOxzd6DpUUGa+wur8 xN+ErjDP1KbGFG9c1fUpnGkiveN52rO9CKkDCjSW40ASjLa4cJ/u7sp0smF+dQr37zSa 900tmE6qmhbyfQsSeYaSRMxyfiVkvY+ZwTBg4qEkXGu4jaDmdqj77vsL6ruDKK6DuYH6 czZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862097; x=1730466897; 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=cNn15pq7FtlSd8hCdE286On7l4GZ1JdLdzQd70l8fTI=; b=f4yX3Uwwa9wwMuKtwh5Ru7Ko3WpXyLbaxx/qxZL1OQL5TfSSCzEpBMVtrj2eVVKDeH yTwbVkB81g0AyocN9TsnkIZn6aNpTBNow44JcB8887g9o0kHLIvBw0GDGbekzih2vEbu 112WqxgVhBG34PNPfOGdjoIvaaXbR42d7oJoi/CYTOOBmiEvmg/vDD2lYtWWrexrM9H5 Z8DuMtJ8WfjLpHqdry3o2NtShKq8NeCH6+PW8dZjc2Yw6Z6s+0VAS2tUyi1t6X73fJ9H j9bk/F412xm4QKavN8fOHMiLnsIWhpJ25ha7q7DAmjwRnuXDkHT3dUhPa343Vw8TDAj4 9bOQ== X-Forwarded-Encrypted: i=1; AJvYcCVqD5S94ZN46tQghO4R1sf/0VADazKL3BzxWVF+V1dDwR2S5ii5YI1ssc8Z0ngYITl6hk41nQCAts3K@vger.kernel.org X-Gm-Message-State: AOJu0YxMNDgKLdenOyyMcNrsTObCXke2hQhJXgBJrcUTCQEWyX1wS/ui f9dz1dRGy67IVeCN/eyohyWUihHa+p+Eflg94txtPRsBaGre9rw/eqvx34Jcv9A= X-Google-Smtp-Source: AGHT+IGmYuHoaUOEGVL/28LOiMK/A9Q47ttebm2jL0yHOWlag+R8pd+KgV3xQfuxq1xntOnAKAHD4w== X-Received: by 2002:a05:600c:46c4:b0:42a:a6d2:3270 with SMTP id 5b1f17b1804b1-43184224094mr87230815e9.21.1729862096953; Fri, 25 Oct 2024 06:14:56 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:56 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 06/11] scsi: ufs: exynos: remove tx_dif_p_nsec from exynosauto_ufs_drv_init() Date: Fri, 25 Oct 2024 14:14:37 +0100 Message-ID: <20241025131442.112862-7-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Firstly exynosauto sets EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR so setting tx_dif_p_nsec has no effect. Secondly this assignment can't get executed as samsung,sysreg dt property is provided in for this platform. Meaning the execution flow will return on regmap_update_bits call above. Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 9d668d13fe94..d4e786afbbbc 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -205,8 +205,6 @@ static int exynos7_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) { - struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; - /* IO Coherency setting */ if (ufs->sysreg) { return regmap_update_bits(ufs->sysreg, @@ -214,8 +212,6 @@ static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) UFS_SHARABLE, UFS_SHARABLE); } - attr->tx_dif_p_nsec = 3200000; - return 0; } From patchwork Fri Oct 25 13:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 838674 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E85020D507 for ; Fri, 25 Oct 2024 13:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862103; cv=none; b=VspEFXentNpa1xCS6zVUEfB3oGzj1GjEimqlbykrg6El5I1SQe9t2GvX61YrxqHvRbVTPOYfl5gAu81LQHKS7d4WLwvHKO39D/hm4T8en6Gkhzrzw3gmPJZwqxhoiPLEmf7CWViMFekV3OgzlT/yIGb/G++KObtsaSJ72FAReGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862103; c=relaxed/simple; bh=UMHAH+7d2ubvmat4NPmFpXjrw0W8dqJHnrFUvo9OI4o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z5L4Tj0O+LMmmK4t8VgVPQFebw4NPWXeQ75jKRgRDy/OSeCF0K2+wMCK7EOI25//tw2RQIDw3/VLAMmO+YpVqjanmmBRX4NET6KaPDNLQ1/I5v8MOrWUGAVd7elTu6dyk4Ne7l5jGGJ8/jORIjMIVkn/Y4qgW48AkNHI/DlD3W4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=NRPQ0cEp; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NRPQ0cEp" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-539f1292a9bso2604216e87.2 for ; Fri, 25 Oct 2024 06:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862098; x=1730466898; darn=vger.kernel.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=8mSP0Idfdl9Bddnm7Irkt+YNMMsQJrdvTnch1RJ4UlY=; b=NRPQ0cEp4OpsryTWWGL5cuw3MWDowipQAhe4dDzFYXr6rKK/6b2NzSm9fP1yFi/SA4 mqWk0TdGGaS+GR2a0xiQO0NJKK2TO7IfCUAUKQZct5w3dXrs+Z7ocGesZ8FWxrzV719f mspEQ/G1lD4MMzyyCrnG5jhU7k194s1lhgy+VJNTgQPs7HwmYUu6+odzom+bx/DdK5n5 S9YI0oRbUanpsLoVITWk1jY6sOAxc/8yXDmwjtdx3+ATtYGEqZBOSoN3DpenFtxhNDin O3l67T0TnTinIO/5XBbbUOqU3iJcVfjkfyYDf5BNEinmzLDh0QeyjJ1RlB+IO6sJFauT PXBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862098; x=1730466898; 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=8mSP0Idfdl9Bddnm7Irkt+YNMMsQJrdvTnch1RJ4UlY=; b=s+cL2Gr5blnPdGDD5iUduXlR4uq2lIdlN3EF8gqahVnSIQa8mPKSRoRBOmZj/Fg6Vu hu3Ci1DbogvBvMUPrueUibmGwVTmmQQ6yT4qohfHpmGSrfx0Bwc9e2LpXq0Bd7ajH3+j +Att1S1rpTlkRnY8QekE3UUoGm75nNqcROdbXHGJZ6IDIApdMKXSzmSvjl+yBn6WFeOK gvGWaO/LV4Y/MOdsne6Jj/f0ZACICtiU52rCJFtgD6U40KxXFPz5ZRsGtk7tMxq9QqrL ATSU/amQEhdcdB97S5pcpRrLiJ2QeLKBYd4+xoNWA5P7pcLzgzKA22VPqf7rABF2oP3P tyYg== X-Forwarded-Encrypted: i=1; AJvYcCUE7vFpPERXx1RFO7Nw96AiyyEjcVU+iurSQrLLrGI/zl1r4MGgZNtOp0Rl1QP4xrHAIYAc1aca/fCS@vger.kernel.org X-Gm-Message-State: AOJu0YxXttE1kGGxeeQ1dvFE/xLZGmOQU17TdC02uoMA8b0RTroC30Ag A7Jc0wMFpQCYBLH5tZhnVLxWlH2oPWBgBdz884E1yPLNCRmS9C/zdID9Lgs6ub4= X-Google-Smtp-Source: AGHT+IFIjxCtFqGk3E1YIZeIbZDApteEen8rQ8qLd9MWNW7M5VeqNXGVeyRg3HBljC/8CXJKDn+GyA== X-Received: by 2002:ac2:4c55:0:b0:539:fc75:99ae with SMTP id 2adb3069b0e04-53b23e1df9emr3392181e87.31.1729862098342; Fri, 25 Oct 2024 06:14:58 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:58 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 07/11] scsi: ufs: exynos: add gs101_ufs_drv_init() hook and enable WriteBooster Date: Fri, 25 Oct 2024 14:14:38 +0100 Message-ID: <20241025131442.112862-8-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Factor out the common code into a new exynos_ufs_shareability() function and provide a dedicated gs101_drv_init() hook. This allows us to enable WriteBooster capability (UFSHCD_CAP_WB_EN) in a way that doesn't effect other SoCs supported in this driver. WriteBooster improves write speeds by enabling a pseudo SLC cache. Using the `fio seqwrite` test we can achieve speeds of 945MB/s with this feature enabled (until the cache is exhausted) before dropping back to ~260MB/s (which are the speeds we see without the WriteBooster feature enabled). Assuming the UFSHCD_CAP_WB_EN capability is set by the host then WriteBooster can also be enabled and disabled via sysfs so it is possible for the system to only enable it when extra write performance is required. Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index d4e786afbbbc..40b2563fe011 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -203,7 +203,7 @@ static int exynos7_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) return 0; } -static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) +static int exynos_ufs_shareability(struct exynos_ufs *ufs) { /* IO Coherency setting */ if (ufs->sysreg) { @@ -215,6 +215,21 @@ static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) return 0; } +static int gs101_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) +{ + struct ufs_hba *hba = ufs->hba; + + /* Enable WriteBooster */ + hba->caps |= UFSHCD_CAP_WB_EN; + + return exynos_ufs_shareability(ufs); +} + +static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) +{ + return exynos_ufs_shareability(ufs); +} + static int exynosauto_ufs_post_hce_enable(struct exynos_ufs *ufs) { struct ufs_hba *hba = ufs->hba; @@ -2124,7 +2139,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = { .opts = EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | EXYNOS_UFS_OPT_UFSPR_SECURE | EXYNOS_UFS_OPT_TIMER_TICK_SELECT, - .drv_init = exynosauto_ufs_drv_init, + .drv_init = gs101_ufs_drv_init, .pre_link = gs101_ufs_pre_link, .post_link = gs101_ufs_post_link, .pre_pwr_change = gs101_ufs_pre_pwr_change, From patchwork Fri Oct 25 13:14:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 839087 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 661E5231C91 for ; Fri, 25 Oct 2024 13:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862104; cv=none; b=hekbF6xgYnRdWOAbZEPPt1kafloEfUfrBeD5SLRIwMwxqnlQ30ouhBFbVurF2m66ZtMjI2o+A0AzeqMgG+036TcwRfSLnCcacga2BL2uHtg6uASF/Db1khbRjQNkbajy/mUG7HXmaeS8Uqzsu82Chk5pxwk0YX2yNNxvos2okt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862104; c=relaxed/simple; bh=Kbtu/Jwk87kTVLdVAMrWCkkXYYLx9gjrujo0HVB2Blc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cl0ROUQLgWN4b2gHNUY9b3SRzNZK8jyXdda0YI4FMqLg6BzRwosT7o4TnAtHb9o9JOBklex2c6/yN07Wypd7ey1XSaswGy7OqNH7Z0NW91S9Q8REfhCoIb5KWWAcsyhj+qwQ9JcIDjmVzZroHqzA46CAeVqbSMJt7crddgHNfWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wcvBNRsk; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wcvBNRsk" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-43162cf1eaaso26612035e9.0 for ; Fri, 25 Oct 2024 06:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862100; x=1730466900; darn=vger.kernel.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=/Db/7vYWfVTvRELCJjsaav3g2wtQjNY/cZ7wO3qNfos=; b=wcvBNRskRcTbVz+u/17RThq3mHMTXmE/xDb7lwfY2yWovzZ81Z/v0WNfhU7UvhgYJH ZaJ+U1mx1DDVbgRSLYLD2PYvPO3Kq5/BkdcPzaetgBZmY3iatG6EzHG77HBCzlS8lj8j Q06o0UGoGshPVT5d9sNdxoxgPRSH02GHGGTllvxZaJXFWtkqecuPM4vrKL9hmTDMS+td x+y8XRAYQ2mqHur1q0Xe6GKOF2uZVy4cGY9YhG7YNUjUeJHzl5UJVOoVuJsZzIpA19mi BuLypD4nHD4+fe3iKY3JrVT6UlNjPUTOM9Ui48Yl0YKwVxuPnDkidrotOZdRC7cfw5T3 iJxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862100; x=1730466900; 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=/Db/7vYWfVTvRELCJjsaav3g2wtQjNY/cZ7wO3qNfos=; b=M6TJ+8wBs7WdXMXS9hYYs0g6+dOkUFNwHQILJgCGsek+UPmSK2wVSRldF1c3jsngkV FaFkZIN2ad3ZMP8K9A195X1Mt+ID85KM9GF707j9MGaEVRaQ9tqdU4zzXG2+2hLYcBvr 7BJcAsghvTq/qWOF5xnQnx7izbA/opiWGZRJi1oPNSfEsi2vWX7uPoIl3azQiQgIoG/3 gsIaRTRUtxYSPJE7b/dfgrNyfikqPBjky5re7jWe2T7qU5PYJXtXuo0wuEXV+YPuS7G7 61bmaYDHqffIsXPfJakhzaIAMTFyy4rL3mVt3EgGSXuZEzDyQzNjR5SylaI4FnRE5uxc hywg== X-Forwarded-Encrypted: i=1; AJvYcCXGFRkgkTrsx90JuC9em9LjDrW6TsZ//AXSbdDBLZ72aPuqld2nIZRyWtJCCb0SXE5AFLU8V+NuZkhM@vger.kernel.org X-Gm-Message-State: AOJu0YyWgpyW+mdrJqxFVvVAliCFNyrim94RIDLcyCqr2n5EgklLe0Yx VNrgzI715Lk6tFF7YDWpT1zZaM5wqhrusys87zN01TG6hYOZHDLnACHoQ7ubIF8= X-Google-Smtp-Source: AGHT+IGy7gCwHmZzWRjYuJdLjKUklIvRll7qzxjTVKsdjpMsJu9lcX39EllePZe+fyuRleAhBbilyQ== X-Received: by 2002:a5d:4441:0:b0:37c:d1ea:f1ce with SMTP id ffacd0b85a97d-37efcf15f1fmr7504792f8f.25.1729862099741; Fri, 25 Oct 2024 06:14:59 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:14:59 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 08/11] scsi: ufs: exynos: enable write line unique transactions on gs101 Date: Fri, 25 Oct 2024 14:14:39 +0100 Message-ID: <20241025131442.112862-9-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Previously just AXIDMA_RWDATA_BURST_LEN[3:0] field was set to 8. To enable WLU transaction additionally we need to set Write Line Unique enable [31], Write Line Unique Burst Length [30:27] and AXIDMA_RWDATA_BURST_LEN[3:0]. To support WLU transaction, both burth length fields need to be 0x3. Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 40b2563fe011..b0cbb147c7a1 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -48,6 +48,8 @@ #define HCI_UNIPRO_APB_CLK_CTRL 0x68 #define UNIPRO_APB_CLK(v, x) (((v) & ~0xF) | ((x) & 0xF)) #define HCI_AXIDMA_RWDATA_BURST_LEN 0x6C +#define WLU_EN BIT(31) +#define WLU_BURST_LEN(x) ((x) << 27 | ((x) & 0xF)) #define HCI_GPIO_OUT 0x70 #define HCI_ERR_EN_PA_LAYER 0x78 #define HCI_ERR_EN_DL_LAYER 0x7C @@ -1925,6 +1927,12 @@ static int gs101_ufs_post_link(struct exynos_ufs *ufs) { struct ufs_hba *hba = ufs->hba; + /* + * Enable Write Line Unique. This field has to be 0x3 + * to support Write Line Unique transaction on gs101. + */ + hci_writel(ufs, WLU_EN | WLU_BURST_LEN(3), HCI_AXIDMA_RWDATA_BURST_LEN); + exynos_ufs_enable_dbg_mode(hba); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_SAVECONFIGTIME), 0x3e8); exynos_ufs_disable_dbg_mode(hba); From patchwork Fri Oct 25 13:14:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 838673 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 201D120D506 for ; Fri, 25 Oct 2024 13:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862105; cv=none; b=UsFq2ggzQ2Mei3D3WTEYlH0VdoCmkOWz193im/Z8p5sCohmCaGDxLoIANA+tAEfkHDqWQACxZ+zAAYLJgwEat/3K9vcFEL90GJyg5OVWZMDVuMj4aKIqX3vJEpFXZYDjdcylzzRJITwqkaymst5TENruTO1AaY+J8jvkMgc9iq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862105; c=relaxed/simple; bh=KgknpPj0iOoQwiAH+NqX1OZF6SNzI/a1pt2l/tElo20=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HZFtpRxQLdwGmf8Gx+T1jgcpESHZT9DzI2B/SqbTM8sbqwH0mdDm7Q+qhcO6+7UqUXhxk/o7+yURHyYR4vxhxwtuC5cKI7xFIr9YhMYTrq4+wBGejcpYgWlt4H5tOMdqVDgYQ6aSQ2yavMGeKEM4WPdBbXnTvtaM6cLpQW6lkOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=RXESPEVn; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RXESPEVn" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4315e62afe0so20833975e9.1 for ; Fri, 25 Oct 2024 06:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862101; x=1730466901; darn=vger.kernel.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=hwJALAAeKO6DZ5STVB6W3oZmi4qjYoxF/2Uc+rthKgs=; b=RXESPEVnCDqturQkxU4EWOC1dqwlB1am6qoIjk7u03VDNraJt8fqOn9gXYhr+CVxR+ P9Gnu72DI226tr61oTtjG/EAD29pS9Mam/M5jHutfrsRgigkY5QM+Cg1WLMd2VmH/L2e a5Xp5Lwn6rBBUUyBW2CJFpp24cTvtK3hPCsQuNxTfFF2rMCd7Txll+37a+JmkLGmDo/d Oo/miWICCbIiOkxGHT4NfEX1nCiBSTloDXgR7gYAT0KrTQReUiwL54cTMAYwgTp8XWmN l+F7OA1yaOLNyfVUIGyWfe/mmExlRUmeNb77R/wifw/v8rWELRAwV61rLhvM+HxI/4rV QaNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862101; x=1730466901; 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=hwJALAAeKO6DZ5STVB6W3oZmi4qjYoxF/2Uc+rthKgs=; b=YWjB7tv6zQFn5lvvjlFgCvmMqMJplN9htEiCJJY7v07CTy2kYTfWrtVCZup7MAmGyl L851xIBCWvXXLpQOX9z4x81tnpIvMZx8+qVXQJHlnPrLZ2c17Qj0uiEko8wVmabQICC9 QrJO8nDLk88Oobtv85Unm1j8DPPZyf+N7eODMd+dLItZwpIeJVSk1xrF7a1FiuPdGIMs 1L2tVp6QF21eV3pPAWEf/nxsHRajR9KmHK2/lyW9v4yKyjU5RZJ174fxgBzknPTGr9mQ +5zV/MaGkZvpuT3PONEvYjgLtjWN6J2Sq+8CAQ6wTmU2Nooo6X7IQ+IZPNJEdGp1yRFa tLqg== X-Forwarded-Encrypted: i=1; AJvYcCWqBeP36tNO59jeoZkxC/CE8+mU/PMwYHCQR57jgZpOLg7Kkn+WTpvpIOEwuxlSWB6/Inor7ATwfSQd@vger.kernel.org X-Gm-Message-State: AOJu0YzTe6lFA0NutoLxFqGFFVOEXQycDveahJQHhgcjYf8HxNSwqw8p RiDG3yovUGy8Url3YxJl8eoELgsul66fYhCblYYU4HNOMZV3SFSMvq3bA3WFH1c= X-Google-Smtp-Source: AGHT+IG93PjcVz+7+9Ks5a4tZOcJmfpGpRSJSrp4oHNgenqx8uAoLySbtv12lhSPEbntHZWJ76vNhQ== X-Received: by 2002:a05:600c:1d8f:b0:431:5bae:c600 with SMTP id 5b1f17b1804b1-4318c780d48mr50376755e9.34.1729862101341; Fri, 25 Oct 2024 06:15:01 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:15:00 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 09/11] scsi: ufs: exynos: set ACG to be controlled by UFS_ACG_DISABLE Date: Fri, 25 Oct 2024 14:14:40 +0100 Message-ID: <20241025131442.112862-10-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 HCI_IOP_ACG_DISABLE is an undocumented register in the TRM but the downstream driver sets this register so we follow suit here. The register is already 0 presumed to be set by the bootloader as the comment downstream implies the reset state is 1. So whilst this is a nop currently, it should help with suspend/resume. Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index b0cbb147c7a1..fa4e61f152c4 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -76,6 +76,10 @@ #define CLK_CTRL_EN_MASK (REFCLK_CTRL_EN |\ UNIPRO_PCLK_CTRL_EN |\ UNIPRO_MCLK_CTRL_EN) + +#define HCI_IOP_ACG_DISABLE 0x100 +#define HCI_IOP_ACG_DISABLE_EN BIT(0) + /* Device fatal error */ #define DFES_ERR_EN BIT(31) #define DFES_DEF_L2_ERRS (UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF |\ @@ -220,10 +224,15 @@ static int exynos_ufs_shareability(struct exynos_ufs *ufs) static int gs101_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) { struct ufs_hba *hba = ufs->hba; + u32 reg; /* Enable WriteBooster */ hba->caps |= UFSHCD_CAP_WB_EN; + /* set ACG to be controlled by UFS_ACG_DISABLE */ + reg = hci_readl(ufs, HCI_IOP_ACG_DISABLE); + hci_writel(ufs, reg & (~HCI_IOP_ACG_DISABLE_EN), HCI_IOP_ACG_DISABLE); + return exynos_ufs_shareability(ufs); } From patchwork Fri Oct 25 13:14:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 839086 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E75D20F3D8 for ; Fri, 25 Oct 2024 13:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862108; cv=none; b=GGlI0EnQeBSxYxg0XazAqEKZLp3kzXVoMlNiytL8h3kofj7fI7JDRu01b0dmH9RmEfX4BruJnrFU9LqFH5yrBUUHijECjy0GeLBjRvPqoMk8BtKXNOEtxK2KEZHKZmI0zc0kwWZdS+dlSmHcaR/vrK68I7yztF5QID5wZB/CrZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862108; c=relaxed/simple; bh=F2qnRTR340hKwHQSf4//6eO6VZH4516ssxBM5pftm4Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GEcK5AjO/uofo6W3wLd322rXICQTzy9pN1PR4SlH+7/Tch87zuzrZJvQa5w4B0KdTTTMZEBl0aNtkSoPKrdtWCGgFr9LkDa/9PeFm6/l2/mIL2U6p8Ete2sl3IpwH7pYxROFHsDY5P66hh1nEEt4S3Kq3Mwdh7sYZxj6AFg3rO0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sFrwdN2I; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sFrwdN2I" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-431695fa98bso19836855e9.3 for ; Fri, 25 Oct 2024 06:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862103; x=1730466903; darn=vger.kernel.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=Ivh7+EYUuihJcPnZHjnVXOeazDxQAc1FZwbuTGARMJo=; b=sFrwdN2IyP3rYPRzWUw82FX+bSNpKhA4mzd+g3WF8t+qBMwV1Hh61iuP6RnZ1nv0C3 HSkSFAFYcEv9/7/oKX7hF3Dg/wLKLmWi9YKvCDKohXrfn25AnKlFiltr654bpFiIEleJ abJpGn5sfu667qaAoUV7mQuDLQ6xEMSR/HQ2TOrxoB28eVewJpXU2AqgC99qoo1b7rjW 2YlfGuPe1mlcWFvj1ASTPbqwqqk7+MBkjCTMk4uRsyYdhyin7ePCOd/3hYX0ewGnCTnC y52ObddhyJWCwgZL+u81OoXiCD2u0N6QTMMfWAGoHdMo8OeDsqjTmJzu4Mw5Cf0Axqpg Q1Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862103; x=1730466903; 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=Ivh7+EYUuihJcPnZHjnVXOeazDxQAc1FZwbuTGARMJo=; b=OaddhC3CLQO27HlGkOMR/jz2FinEmW0819vsgfdEP1jyUDeYDUKWx7wHE17aFUsHTL zz9r2lG91QRicMN67KxS14MJl1X+D+6FLaWMYOqjs9elqQ09c49xCa7sZoHf1MEzjLNY pqwGUpSs9v542P+jWO3LRojMbp4SYhJIEuPm0FHSeqXe5AgRkKyuuayleDmUUQ0r3imR Nb225YOr0V6m840MU+VPu5tBT0yWrCT9k8utRYfeL9KcPWWQPxmM4iEo+lhT0dV/fxwZ PQyPrG5BXMjQDqXlEHGPj49oGaPtjdWjr7XL1a9eMAUj3xRuHQqH3Lzp1l8edBJvxIsf 2aUw== X-Forwarded-Encrypted: i=1; AJvYcCUKHeX+6b7G1vphgnRLb7FfRguaC4o5+F99f+tHm49VN/Y7aE5RcSJnThXs1iT7eT5O21aOoGno8lki@vger.kernel.org X-Gm-Message-State: AOJu0YzuOuzVtD+BHCNFYk3PkzjCtXtIeJFQ9LRbD9xvxI/a0CssXQNw +Bpi+4mdw4a213Uv3xXkntwCjpisDzTSKs5uFezEVZCEpeNK1XLJ+v+vc1tIuH4= X-Google-Smtp-Source: AGHT+IFHaCs0Brlywx2EDejiKT/SRxUFjAkp/495iouOQYJDyac2EtGgBL2CMBR/7/lJY4x2bivyMQ== X-Received: by 2002:a05:600c:4f88:b0:428:ec2a:8c94 with SMTP id 5b1f17b1804b1-4318c6ea2f0mr54335655e9.10.1729862102813; Fri, 25 Oct 2024 06:15:02 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:15:02 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 10/11] scsi: ufs: exynos: fix hibern8 notify callbacks Date: Fri, 25 Oct 2024 14:14:41 +0100 Message-ID: <20241025131442.112862-11-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 v1 of the patch which introduced the ufshcd_vops_hibern8_notify() callback used a bool instead of an enum. In v2 this was updated to an enum based on the review feedback in [1]. ufs-exynos hibernate calls have always been broken upstream as it follows the v1 bool implementation. [1] https://patchwork.kernel.org/project/linux-scsi/patch/001f01d23994$719997c0$54ccc740$@samsung.com/ Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- --- drivers/ufs/host/ufs-exynos.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index fa4e61f152c4..3bbb71f7bae7 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -1529,12 +1529,12 @@ static void exynos_ufs_dev_hw_reset(struct ufs_hba *hba) hci_writel(ufs, 1 << 0, HCI_GPIO_OUT); } -static void exynos_ufs_pre_hibern8(struct ufs_hba *hba, u8 enter) +static void exynos_ufs_pre_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) { struct exynos_ufs *ufs = ufshcd_get_variant(hba); struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; - if (!enter) { + if (cmd == UIC_CMD_DME_HIBER_EXIT) { if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL) exynos_ufs_disable_auto_ctrl_hcc(ufs); exynos_ufs_ungate_clks(ufs); @@ -1562,11 +1562,11 @@ static void exynos_ufs_pre_hibern8(struct ufs_hba *hba, u8 enter) } } -static void exynos_ufs_post_hibern8(struct ufs_hba *hba, u8 enter) +static void exynos_ufs_post_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) { struct exynos_ufs *ufs = ufshcd_get_variant(hba); - if (!enter) { + if (cmd == UIC_CMD_DME_HIBER_EXIT) { u32 cur_mode = 0; u32 pwrmode; @@ -1585,7 +1585,7 @@ static void exynos_ufs_post_hibern8(struct ufs_hba *hba, u8 enter) if (!(ufs->opts & EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB)) exynos_ufs_establish_connt(ufs); - } else { + } else if (cmd == UIC_CMD_DME_HIBER_ENTER) { ufs->entry_hibern8_t = ktime_get(); exynos_ufs_gate_clks(ufs); if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL) @@ -1672,15 +1672,15 @@ static int exynos_ufs_pwr_change_notify(struct ufs_hba *hba, } static void exynos_ufs_hibern8_notify(struct ufs_hba *hba, - enum uic_cmd_dme enter, + enum uic_cmd_dme cmd, enum ufs_notify_change_status notify) { switch ((u8)notify) { case PRE_CHANGE: - exynos_ufs_pre_hibern8(hba, enter); + exynos_ufs_pre_hibern8(hba, cmd); break; case POST_CHANGE: - exynos_ufs_post_hibern8(hba, enter); + exynos_ufs_post_hibern8(hba, cmd); break; } } From patchwork Fri Oct 25 13:14:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 838672 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC999231CA4 for ; Fri, 25 Oct 2024 13:15:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862108; cv=none; b=O5rZ58WWDNJFWOfjGDpSpZiZYLiowGXmCz6gdPT4kfUIcn81weaMfep+ko1AnUfm6wYv2WlTrOtETMJe2K05vB1DdcEACkOq+31bIPvBKisYiXBJdkSOUedxtBvo4ihSoXeqhxvZg6Z+KhhXytQs7RqjlcbtBrm+9wt6+3jk4Fw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729862108; c=relaxed/simple; bh=k9VgnamHeRSjv5GGKdOvAnnQA43iGAwv8ANgyYMaoCs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jMCfsfLG4F9RcxN4up1XOX2GfN2OIjamBFV3ngFoH/ZoxYPq9kKLWrJr6fxOglkD8g8bkfEaoGfu+mEmLFFYmvTsIoM5EFE9LsrKlPbkhFBFFU4aypeFtRT9o6CRFXUO+X2REpsHMAL0PBTC0jZL0MQMVnCjo/a+kYvDls0IkPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=YLTpqkIN; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YLTpqkIN" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-43168d9c6c9so20727305e9.3 for ; Fri, 25 Oct 2024 06:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729862104; x=1730466904; darn=vger.kernel.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=0aTUxFFuuS7q4apCNsR9KGVB+f/W8Symh/UfMC9/XY8=; b=YLTpqkINQl/k0Dmo/dHnkTCtWaDaxrXXf9ErowBdR4zfWFuU/nl86wGe5bfu2QG4IJ dqy2IH85DJxdqO3vp5e/k9NJ+p4TWsKi00I4KManBdi8rg3eqMZ2c+VefxvNoZUWoScR TYNWo/RYe7rRBeVlbqJ3s0tRpFiRh56rvE5RPGDOsaSxBRVV9lIaMVrPTqYbwpZ3S/Z8 ZL0d3he39HeE1rexS6w+jI/YyQq42kNu0SOhoSl0/HtV7oEuEn2dIi2XfA1m7PcC/z/S 23Tb48sCIxLM2mS4s5dyONyaGvIPq6horZas85YREmlEespKBvcgd2mKfBxDY1KwV858 +KQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729862104; x=1730466904; 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=0aTUxFFuuS7q4apCNsR9KGVB+f/W8Symh/UfMC9/XY8=; b=N043FX6lrDwUb0EHoBCG1YR4e9+IsBHK1c3ock8+FsVD25UZ0JTYycRE6L51iLecyc Kp5wZlP/7UZMnQPFn4HcbFIRnW7MJkIn75H867v2sSiUvu5wBQAY+yr//kedTkBzmBss kITZeSN8X+tWE4nt6L+YfYY2Aosz74Oc6rw2s7ERoTpI9fD4dVflvKVgD9Ahzz4Q0kWC Et+BcyP3Fum4waBH8Wm4o371hgvLNJ0cXF1wHvMI5+q7WVf/oGAV9Hf/2fKACKEwNkBc 7WEu3qZ6Ziiz3/wn/nYJRQLSFfadYNz+BDbseVUfi/ps3dWBmLUQbYYxQOvJiZO4+WDh 3AoQ== X-Forwarded-Encrypted: i=1; AJvYcCUdSe0m5GlT7SpRYC/j3qCWM1US2ZGkg6iKKcrWAbwiF8KNypCjva4ZqtQ0CGWl6f9UBpACg/SdF7U+@vger.kernel.org X-Gm-Message-State: AOJu0Yywdul8Rg4VD49jXyO6k5jMxfym0sATfhwsXCob2/rNAQ2A7hdr 1NzhiLdQ0pVPigtqL4QehaBvQ2SFLnnpCN7MF+ePOCqEC5CAJuFkrTlkhghZhPU= X-Google-Smtp-Source: AGHT+IFn4umTFqPxopB2GAJY2aOrR7RfiFspVJ8SdEfcnoO13PLJi0jzfHRWD2Ee5O6gR0xA2R/rxA== X-Received: by 2002:a05:600c:3b2a:b0:42c:af2a:dcf4 with SMTP id 5b1f17b1804b1-4318c754f00mr39202585e9.27.1729862104292; Fri, 25 Oct 2024 06:15:04 -0700 (PDT) Received: from gpeter-l.lan ([145.224.67.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b58b6bdsm47616685e9.45.2024.10.25.06.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 06:15:03 -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, ebiggers@kernel.org, Peter Griffin Subject: [PATCH v2 11/11] scsi: ufs: exynos: gs101: enable clock gating with hibern8 Date: Fri, 25 Oct 2024 14:14:42 +0100 Message-ID: <20241025131442.112862-12-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog In-Reply-To: <20241025131442.112862-1-peter.griffin@linaro.org> References: <20241025131442.112862-1-peter.griffin@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Enable clock gating and hibern8 capabilities for gs101. This leads to a significantly cooler phone when running the upstream kernel. The exynos_ufs_post_hibern8() hook is also updated to remove the UIC_CMD_DME_HIBER_EXIT code path as this causes a hang on gs101. The code path is removed rather than re-factored as no other SoC in ufs-exynos driver sets UFSHCD_CAP_HIBERN8_WITH_CLK_GATING capability. Additionally until the previous commit the hibern8 callbacks were broken anyway as they expected a bool. Signed-off-by: Peter Griffin Reviewed-by: Tudor Ambarus --- drivers/ufs/host/ufs-exynos.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 3bbb71f7bae7..7c8195f27bb6 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -229,6 +229,9 @@ static int gs101_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) /* Enable WriteBooster */ hba->caps |= UFSHCD_CAP_WB_EN; + /* Enable clock gating and hibern8 */ + hba->caps |= UFSHCD_CAP_CLK_GATING | UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; + /* set ACG to be controlled by UFS_ACG_DISABLE */ reg = hci_readl(ufs, HCI_IOP_ACG_DISABLE); hci_writel(ufs, reg & (~HCI_IOP_ACG_DISABLE_EN), HCI_IOP_ACG_DISABLE); @@ -1566,26 +1569,7 @@ static void exynos_ufs_post_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) { struct exynos_ufs *ufs = ufshcd_get_variant(hba); - if (cmd == UIC_CMD_DME_HIBER_EXIT) { - u32 cur_mode = 0; - u32 pwrmode; - - if (ufshcd_is_hs_mode(&ufs->dev_req_params)) - pwrmode = FAST_MODE; - else - pwrmode = SLOW_MODE; - - ufshcd_dme_get(hba, UIC_ARG_MIB(PA_PWRMODE), &cur_mode); - if (cur_mode != (pwrmode << 4 | pwrmode)) { - dev_warn(hba->dev, "%s: power mode change\n", __func__); - hba->pwr_info.pwr_rx = (cur_mode >> 4) & 0xf; - hba->pwr_info.pwr_tx = cur_mode & 0xf; - ufshcd_config_pwr_mode(hba, &hba->max_pwr_info.info); - } - - if (!(ufs->opts & EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB)) - exynos_ufs_establish_connt(ufs); - } else if (cmd == UIC_CMD_DME_HIBER_ENTER) { + if (cmd == UIC_CMD_DME_HIBER_ENTER) { ufs->entry_hibern8_t = ktime_get(); exynos_ufs_gate_clks(ufs); if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL)