From patchwork Fri Apr 26 12:19:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13644699 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 7CEB3C04FFE for ; Fri, 26 Apr 2024 12:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LQ3iQxRmkEhkJHsdQEaRLQdmmrT3tfTpxV03GNxSiEc=; b=Myqb7bKHa/q42d mAqy7LCDUHgTJ65lfOXaA/iGvQUiGIvtmKGoHcJc0OWnwjlqHhF8R2dLUkN6vkC2GwB9cQqXwsGri k7OoZtqsHChqz/1ga6rOmAx7lgrkx06exbtkJrkMw4NZozRVnGGQzEGwPE5lNcMCGc06vqyEtZWqx 0YoSZxZ9yxc5rPtErGdvwc+oEFxsHRrArNbBRgONDgGNwlBnpvrepqcYeZArRMbb7gV00C3L5CgWc nce3S8xuwLcF801IVzDwu+rMb1sRBKrfibRVKOlrFYhmN68idgaRVtSkbAx4rw2rDWHFLCrR4svFR ntgFNWhMrtUha7kiS84A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZ0-0000000CRw8-1zSG; Fri, 26 Apr 2024 12:20:26 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KYm-0000000CRqT-1lOs for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2024 12:20:14 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-34b66f0500aso1496924f8f.3 for ; Fri, 26 Apr 2024 05:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714134009; x=1714738809; 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=0PRNqalgzRJP0wdqPI5aKVM4n2lOoPrcnW5MLhVms28=; b=evmP38z02RgT5B4cfeazV1DAWZu9copF2gvch4VEIRF191b7mYXGnjgkoPwNMTiEsc w6cQWcFD56L7TJfiP4FDyzcGm+4vYBZiFp6/zZFJMTjDnOwzCutUoTE7LHWJ7Q9txv+R e8zBhxOo7VF3V4MSSekYuzgfuptSQvRyONkfcdpxY7h/htvg6XY+VA8+uHvNpKED6+Bx 922TDtmrDtWSD35lvwyVgexx0ppFaFyzjTOQ6vteU6ysQA62Kxxk5O2f2IeTvUMnbjXz V8+Rvn7yfyS5spSJycgDVCPi/OljRbfkdJRjTfpt16I2qeaJJFlZ4jVIpSRPXzWvlnpr BI1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714134009; x=1714738809; 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=0PRNqalgzRJP0wdqPI5aKVM4n2lOoPrcnW5MLhVms28=; b=Qu2Bz3sfIETWC4v+eVhOjc/66YE5xapnL8ckt/iDl4EdlLprPkxfg5Gv7WbBR1PkuY buz5H2ujJlKUes50ibI92yi9Ng6DBjr7O/zwntp1zKiV5yqDHwMdaNKgN3D9823tErQV HXCfvTOxMuOaEhLd9PXuD5C+cuit6TLsMzwimGmOsI1eZp3BT1i4AoTFjH3m3lEJeidb JOAPKnbihQc4OGGA2UKcWG81s39L/U3AQW+hBMVx9+YUKQ96rXwegKvuorV2hvsOxoVN StArhvH76vLF+731/zOo8oUFtF74dDV8y2uP4UkrlWjbkwFeWLw/ATGEvsMO/ccIR/61 pYEw== X-Forwarded-Encrypted: i=1; AJvYcCUNmvRuq9DavYp2OIgayLSITUaccOeboQi9+j9pTDTyjKHGn/BRy2PYGx970waUaa1lAvWYoA+K6ZylpaRCO6DKz50+nGGAnJ87Vczmo841StJQVC4= X-Gm-Message-State: AOJu0YxH/xowhYWLyh2cOEqnbFEiRd+dgCEA8zyJFPltZLW5Q/uDM3Ct 6V+SRfzMXFctgbCBT1YaeszcMTSJTGxcOXzZOT1I9h04go0bB8eZlMPUxz4CvXYEqP7fiZJRgGg NFRY= X-Google-Smtp-Source: AGHT+IFPRQzrJNRe0ZHJxJr9q7e3kdzOr5FITfDYCVcG12MFC0Y3BF+U9bOg8Rq12hVlpBymtvyZFw== X-Received: by 2002:adf:ed84:0:b0:34a:a836:b940 with SMTP id c4-20020adfed84000000b0034aa836b940mr1795068wro.18.1714134009627; Fri, 26 Apr 2024 05:20:09 -0700 (PDT) Received: from gpeter-l.lan ([2a0d:3344:2e8:8510:63cc:9bae:f542:50e4]) by smtp.gmail.com with ESMTPSA id q2-20020adff942000000b00346bda84bf9sm22478146wrr.78.2024.04.26.05.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:20:09 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: 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, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, kernel-team@android.com, Peter Griffin Subject: [PATCH v3 1/6] dt-bindings: ufs: exynos-ufs: Add gs101 compatible Date: Fri, 26 Apr 2024 13:19:59 +0100 Message-ID: <20240426122004.2249178-2-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog In-Reply-To: <20240426122004.2249178-1-peter.griffin@linaro.org> References: <20240426122004.2249178-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-20240426_052012_482219_CD5FC71E X-CRM114-Status: UNSURE ( 9.68 ) X-CRM114-Notice: Please train this message. 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 Add dedicated google,gs101-ufs compatible for Google Tensor gs101 SoC. Signed-off-by: Peter Griffin Reviewed-by: Rob Herring (Arm) --- .../bindings/ufs/samsung,exynos-ufs.yaml | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml index b2b509b3944d..720879820f66 100644 --- a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml +++ b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml @@ -12,12 +12,10 @@ maintainers: description: | Each Samsung UFS host controller instance should have its own node. -allOf: - - $ref: ufs-common.yaml - properties: compatible: enum: + - google,gs101-ufs - samsung,exynos7-ufs - samsung,exynosautov9-ufs - samsung,exynosautov9-ufs-vh @@ -38,14 +36,24 @@ properties: - const: ufsp clocks: + minItems: 2 items: - description: ufs link core clock - description: unipro main clock + - description: fmp clock + - description: ufs aclk clock + - description: ufs pclk clock + - description: sysreg clock clock-names: + minItems: 2 items: - const: core_clk - const: sclk_unipro_main + - const: fmp + - const: aclk + - const: pclk + - const: sysreg phys: maxItems: 1 @@ -72,6 +80,30 @@ required: - clocks - clock-names +allOf: + - $ref: ufs-common.yaml + - if: + properties: + compatible: + contains: + const: google,gs101-ufs + + then: + properties: + clocks: + minItems: 6 + + clock-names: + minItems: 6 + + else: + properties: + clocks: + maxItems: 2 + + clock-names: + maxItems: 2 + unevaluatedProperties: false examples: From patchwork Fri Apr 26 12:20:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13644701 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 8F07EC25B4F for ; Fri, 26 Apr 2024 12:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+Tr/YzUV8UzVqp4t2+zUdXve6ivX/FwWaFNawoK+4BU=; b=FEBXngM3B3ZXJ7 qlTXrQlwYwG8aFi71OVNI+FOdnxATbxe75Dca3XXl5pdO+jtwTR+Nz0fH74TqpjBjzPpVymygYFPm MBQNaB5CRpaqFXzu8YXXC80bRkAurLe7DcymhlbADubR6njkgzcThBq9259cYfn3zLtyahAxIlxAA oWumLLcRiGO6jeHrgFKQS5ec0+j1pGq8rpN6NAoPcvQHagEAK2uZBNBIY/ApzKr+ZKtFXuz2HGh3h CwweedCBVJfAt2tjhADwxJ7U0JTgsEr1AoFktrHSSvMyZhpkASrpAFOrNFPWHl0ye97RTArWZswN0 WuavGEvYdoBMRlCt3jlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZ1-0000000CRwh-0ixP; Fri, 26 Apr 2024 12:20:27 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KYm-0000000CRqo-2773 for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2024 12:20:15 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-34c0f5f5cd0so1427199f8f.2 for ; Fri, 26 Apr 2024 05:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714134011; x=1714738811; 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=cGiBT+3rLHUSe0fCpI84iZd1Y9xr9GwhBK0cp1D0rYM=; b=JQFvAUJQ2u2j75Dp3djL2bZeHiS2+dIBR+5oIRIq6k3NMz1doW0JthBzXJo5JrdGBd MVEMjeraEZLlp4TB5Ba5Nl9NA8HvA3mdgH+t2kEbafbE5QH9kqpw2HpOwPklL8AlWdPI y2KnJMVKQdfDbGbb0Rv6EbiGwU1zwWpwBqVyiwOX14VaukTmTYCGwnL/41feNEhWfulq /PDPc/3VU1kaDERBm+VELfJW2qheioOLb1Jecp25ZpeQ2WkOGDHf1er6kGBb0d5Sk5dj keIg41tO0G04tCOiQ1TqVJQ9YZ0+woOW5D5duypNtGqLQyB7UoxxsjSk/we/nLeprJOL 4Iew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714134011; x=1714738811; 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=cGiBT+3rLHUSe0fCpI84iZd1Y9xr9GwhBK0cp1D0rYM=; b=bwgcV2Og/i4sz1MZbpVo/D0J+VtKSKIB8bp/Fe7As22EJUqyjt2u8EkPAgceKNidb7 ilfBjgtjhZ/jrKXBo/ud9UXZbWBbwKEwNewLqykw/E5F2x2pXIafjOak1vNf0qgYPVd+ /L0VvwmVr0fm8312DWU3P6pxiaR6qRSISqyN/yo8UkJKEYfzk8589J2tzyN9ugVbZaXX 4y5xh6TwToUaY6Gt8k0mPK2QYiyYaE9RWPIWEJhQQN1L/mJYWQi68vvUHmHrGe8wkAo0 ym6Xr7g84v3J2VFuHNnWUFxbpD/ENkE3PeNXycmIOcAxAnoTjhVmpuxx3yQBCOG+ZmtT 9/QQ== X-Forwarded-Encrypted: i=1; AJvYcCV7DFL/1P0p2FvaG/blhUckA43DDuJ5L+vnPwoZYvIiyocs438h5qRiy9bzBEGGn5SVp42qd+/r4GJ4bwC6EcTCKj43LGNnCBIcJuLhjkkktnGtjXk= X-Gm-Message-State: AOJu0YytXOYkoTAr2dyqFAKl0rQTgqaUFniEfupDtt08jFbZLeDryz7D BsAOTmKmEEFSvGmGGEYMkWkZuAZkhDCjI7Z/1i1cikR/7acEw7N8+kg4tygYV8k= X-Google-Smtp-Source: AGHT+IFnZl64tUcUlk94yOZUNVeflszVkGoOajT6n7ta7tcevMv0Y3TwjzY6xunY4Vmk8prFor+Gjg== X-Received: by 2002:a05:6000:1886:b0:34c:6798:13d6 with SMTP id a6-20020a056000188600b0034c679813d6mr1086457wri.43.1714134011175; Fri, 26 Apr 2024 05:20:11 -0700 (PDT) Received: from gpeter-l.lan ([2a0d:3344:2e8:8510:63cc:9bae:f542:50e4]) by smtp.gmail.com with ESMTPSA id q2-20020adff942000000b00346bda84bf9sm22478146wrr.78.2024.04.26.05.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:20:10 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: 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, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski Subject: [PATCH v3 2/6] scsi: ufs: host: ufs-exynos: Add EXYNOS_UFS_OPT_UFSPR_SECURE option Date: Fri, 26 Apr 2024 13:20:00 +0100 Message-ID: <20240426122004.2249178-3-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog In-Reply-To: <20240426122004.2249178-1-peter.griffin@linaro.org> References: <20240426122004.2249178-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-20240426_052012_817293_F2005A35 X-CRM114-Status: GOOD ( 12.64 ) 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 This option is intended to be set on platforms whose ufspr registers are only accessible via smc call (such as gs101). Signed-off-by: Peter Griffin Acked-by: Krzysztof Kozlowski Tested-by: Will McVicker --- drivers/ufs/host/ufs-exynos.c | 4 +++- drivers/ufs/host/ufs-exynos.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index e8d3302f6df0..66e52c3607e2 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -1186,7 +1186,9 @@ static int exynos_ufs_init(struct ufs_hba *hba) if (ret) goto out; exynos_ufs_specify_phy_time_attr(ufs); - exynos_ufs_config_smu(ufs); + + if (!(ufs->opts & EXYNOS_UFS_OPT_UFSPR_SECURE)) + exynos_ufs_config_smu(ufs); hba->host->dma_alignment = SZ_4K - 1; return 0; diff --git a/drivers/ufs/host/ufs-exynos.h b/drivers/ufs/host/ufs-exynos.h index a4bd6646d7f1..0fc21b6bbfcd 100644 --- a/drivers/ufs/host/ufs-exynos.h +++ b/drivers/ufs/host/ufs-exynos.h @@ -221,6 +221,7 @@ struct exynos_ufs { #define EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX BIT(3) #define EXYNOS_UFS_OPT_USE_SW_HIBERN8_TIMER BIT(4) #define EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR BIT(5) +#define EXYNOS_UFS_OPT_UFSPR_SECURE BIT(6) }; #define for_each_ufs_rx_lane(ufs, i) \ From patchwork Fri Apr 26 12:20:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13644700 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 ACAC8C04FFE for ; Fri, 26 Apr 2024 12:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qlngXpUI5mkWVQFICef691PqdSCFBAXTyOz58+zvfcg=; b=o4lO3EQmkwNT35 ydMAgCU945KoDuNYKtqClGV8FRjGbSa+GCbAA1EQBqX7cw7PjZC/Avd6B7zU6hI+Owt9nrvwRkcQp iNsfrCtOrbqdqP/+/6JOMljT6mCyJVEuTB4bl1PwTLKLi5K8MY2EUQf/DmUPDLqjgqG8HaEATZ81I yANjjpYVXMZIiOATVv7iSN25uVBr/oL6U9LTjCtS/GM+lhY+yMPLJ0PesGba1n5kp/NwbVZp5UHtt VOf0+3vIlZTc1VOZmw6V4ZW2c+a+BVQKwf5+STiBj0GcEXwiFpI4ICSiTfVdpWg5t6Lo7uEDlwW1V WxSMYaSAgcwrBkE0xSRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZ1-0000000CRx9-3f5t; Fri, 26 Apr 2024 12:20:27 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KYp-0000000CRrJ-2w5Z for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2024 12:20:17 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3476dcd9c46so1545880f8f.0 for ; Fri, 26 Apr 2024 05:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714134013; x=1714738813; 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=WCHTamsKWOa2PSWA2iiAOyEQMuVi7F/H9xo5LBfeSLo=; b=ke+8xwGjtGycw0a2nWGGA8RVvampPb6ba8ZLLT8mbgOQg0C7hq15q/eZwxldH3HTSf EKVIT9PSH3LeI8wJ2reEX3GPJPV+y1rO9y88ClbPhKX6dWpqgULbkUhAOUEZ9LunPK7A xf+u+qgc6J1tMqjzIkhh9/e3QlGiivWLIGYskMX/4iPCb52ZI5mgV+R/BYLnAAMrbsgz Rx1tQ9vJHUD71hBzgF3WRP27K3FjZl4eHnPBz5N7F2PLpTEVkkRokKrJRaqD5+Q2p/if 3hiLcAOZiRIkom0BuVtUSZGED/bnOk/gfiMuGtavZ4kmBDQLtE3C/fgxOs9KFCVsF/bk jjIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714134013; x=1714738813; 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=WCHTamsKWOa2PSWA2iiAOyEQMuVi7F/H9xo5LBfeSLo=; b=YdAYosgO6bpsbi4njAZQyrzZvP9fOTNJgHHg+puTfgOzQAHAHNPfaY+u+G7R5BKKrM jRobAx+mp1Jc8vY607RY8I/9D/qSo4jp3yJRWaGCA98AI5DL7o10BUBBoOvpwvo8RSwk R/Pz//+9D/iLPRtJOo3jxTZV6o3dJMG/22qsHST6Jpkc6BQ5VW9CHy6tAxU5jw4awMT6 YbG9TEfipDyihgTIbaawsf/3y47ocLYdAPhHXvUMu5DDkt8mj8H0imd+HOpch5XhXFzb /ZUiP8uLTq4na/swi5s5zLunDLfHMy44zRNM9TbAJLGgo/6OmlGdJKrrNEVQ6c0wNRSg G1NQ== X-Forwarded-Encrypted: i=1; AJvYcCWKKGDsCuqc8BqefutmA2ZLOzAs9XKXAp2JKTGL5EF2BAQbsh7AzvAh8JwRx6Ba4IRzfRpoNaYZuGHgHYni6hOZ1wBLEL3t3cwk911m4YXPan6b2yM= X-Gm-Message-State: AOJu0YwVidMrjQ+hHhViA/GbK7Tjrh2zSk/3EsTs3d2txkHC/wGizvBY XqPYimVI/+BEDLU3OP6v2eOS+6DgLF6hiBbmH5R9BBJlJK7XtiUSJVAqCsGSCc4= X-Google-Smtp-Source: AGHT+IGykyOc3M8ynwChyDnZq7IZSW2Q3KnP2WV/KJ4TVvvg2h6K+hdAd40QyDlKrbfmVhpzBmI2zg== X-Received: by 2002:adf:f60d:0:b0:34a:983:6b34 with SMTP id t13-20020adff60d000000b0034a09836b34mr1788556wrp.39.1714134012773; Fri, 26 Apr 2024 05:20:12 -0700 (PDT) Received: from gpeter-l.lan ([2a0d:3344:2e8:8510:63cc:9bae:f542:50e4]) by smtp.gmail.com with ESMTPSA id q2-20020adff942000000b00346bda84bf9sm22478146wrr.78.2024.04.26.05.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:20:12 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: 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, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski Subject: [PATCH v3 3/6] scsi: ufs: host: ufs-exynos: add EXYNOS_UFS_OPT_TIMER_TICK_SELECT option Date: Fri, 26 Apr 2024 13:20:01 +0100 Message-ID: <20240426122004.2249178-4-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog In-Reply-To: <20240426122004.2249178-1-peter.griffin@linaro.org> References: <20240426122004.2249178-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-20240426_052015_790666_0BF739D5 X-CRM114-Status: GOOD ( 11.73 ) 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 This option is intended to be set for SoCs that have HCI_V2P1_CTRL register and can select their tick source via IA_TICK_SEL bit. Source clock selection for timer tick 0x0 = Bus clock (aclk) 0x1 = Function clock (mclk) Signed-off-by: Peter Griffin Acked-by: Krzysztof Kozlowski Tested-by: Will McVicker --- drivers/ufs/host/ufs-exynos.c | 9 +++++++++ drivers/ufs/host/ufs-exynos.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 66e52c3607e2..66093a905986 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -50,6 +50,8 @@ #define HCI_ERR_EN_N_LAYER 0x80 #define HCI_ERR_EN_T_LAYER 0x84 #define HCI_ERR_EN_DME_LAYER 0x88 +#define HCI_V2P1_CTRL 0x8C +#define IA_TICK_SEL BIT(16) #define HCI_CLKSTOP_CTRL 0xB0 #define REFCLKOUT_STOP BIT(4) #define MPHY_APBCLK_STOP BIT(3) @@ -1005,6 +1007,13 @@ static void exynos_ufs_fit_aggr_timeout(struct exynos_ufs *ufs) { u32 val; + /* Select function clock (mclk) for timer tick */ + if (ufs->opts & EXYNOS_UFS_OPT_TIMER_TICK_SELECT) { + val = hci_readl(ufs, HCI_V2P1_CTRL); + val |= IA_TICK_SEL; + hci_writel(ufs, val, HCI_V2P1_CTRL); + } + val = exynos_ufs_calc_time_cntr(ufs, IATOVAL_NSEC / CNTR_DIV_VAL); hci_writel(ufs, val & CNT_VAL_1US_MASK, HCI_1US_TO_CNT_VAL); } diff --git a/drivers/ufs/host/ufs-exynos.h b/drivers/ufs/host/ufs-exynos.h index 0fc21b6bbfcd..acf07cc54684 100644 --- a/drivers/ufs/host/ufs-exynos.h +++ b/drivers/ufs/host/ufs-exynos.h @@ -222,6 +222,7 @@ struct exynos_ufs { #define EXYNOS_UFS_OPT_USE_SW_HIBERN8_TIMER BIT(4) #define EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR BIT(5) #define EXYNOS_UFS_OPT_UFSPR_SECURE BIT(6) +#define EXYNOS_UFS_OPT_TIMER_TICK_SELECT BIT(7) }; #define for_each_ufs_rx_lane(ufs, i) \ From patchwork Fri Apr 26 12:20:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13644702 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 5BCE3C04FFE for ; Fri, 26 Apr 2024 12:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dmpmLCxBrJr/kpyN4BOfzhJSZzVltqeTVVaaqqZFrZI=; b=eX6iI+/1ZGR3df fEfYzH6jJd033s3AFxmqQcZG8BpIAGjcYDHvyg+9jlMJPWJP/6zgik/+850/JWza8U+whBVPOcgzu OiFznfxOWw+vTF+kuH6NcG30M4Q+uMVHx1IOzvcLi0Jij8qv+cP+94kluDQm7P6DvkuEEuIAqJVb2 3XMhdanEV8Oy1FYr4dkPqxCYFkyyX2186nZeEl2+YPp7e4z0Ur+oGrsPGn+dY8A0QndyI92pvCjsF I09sjUhTYwUJqOcz0eBEQkomoit624NyS6ovHRDh1kVreOSQg+hUBYXtnxnXOEShyxdns5Uk9gX7f r2CTulSvaDHDe+ltZlNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZ2-0000000CRxu-3jeT; Fri, 26 Apr 2024 12:20:28 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KYr-0000000CRrc-3Ran for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2024 12:20:20 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-34c0f5f5cd0so1427255f8f.2 for ; Fri, 26 Apr 2024 05:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714134014; x=1714738814; 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=s/GoVzExBpe8QxX9A9OVe1Uavi5SgYLv/AxKVNUl0KE=; b=I+hKlgc7jLHsUgkydVJ33I6x8tfF2QsfrN5s2Sq9vPijQf/P4PUmtfJ+sJ3wlheei5 7a2IYWRnTjTjqqHSCHaKwIZKKZEbMrMWI0me2fQKmzwRdBm6hQ3ij+aCDSctYi6yvBRQ bTykC8eP9onC6mzQF54RtLtvj2cyfBAAFMatjyM5UEdWx9HJBBIgFqzxh+1CYbL2QFwS I4rWTYDLJmeO8jueU75MdSJj3l3jRdo6QyZHh6tih8uN040Bfby0GNDE+axqFKNMO5d1 Dkc1y7/oumdQoUUsFuARv9bP6GVe5wE7225QRCsSBEh1O1UJ4wRYjGqRD1EWtDg9QQal Bczg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714134014; x=1714738814; 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=s/GoVzExBpe8QxX9A9OVe1Uavi5SgYLv/AxKVNUl0KE=; b=Imu68yyq5Qo2e7b8vuz8NxYUDVABd0aqoN5G38t+yIyvkzvZoTOhGcA0FiupxWfalw FeP9Z4JRHtyT0QWRrdllZZnOFvqa0sIQ2GF4Enho6v2p++ZBpE8ASGFLAdtkuEoBWc6J kYxiBg56cQR3VH64RrgSuVgrhytix/NK1Ev9vmre9JIcBnDRdI754vjhRXAc+DNGZEqI +3RggYVtu2qPLUR740diT/V2rg0uk16rYojgkmzsf6Ggq35H8SQRAG7ypYtwO6cM6NFc 7uLOW7Lw4dO+uOVbTpVyJdzG/yZBsRNzkkdfxUPCkBNemWfAh/Dd9ccDnBvXFRnoZ0Ps QiWQ== X-Forwarded-Encrypted: i=1; AJvYcCX9ZKOhrrhKmiG5hcFFd4uKYhkPz0aL54MMHtC2XcaQqhYHSC9S9IaD0+Vxp1UDFZcVaweemxlKjs7wOXUWePlTCjyWBnK/eZRY6tAK7aIWnzdYxp0= X-Gm-Message-State: AOJu0YzDwXfq7OVlBH/3KNOd1ebYJ7kZIAkcmCx6OJRTsg4ZgbelJWSZ id4PhqEyYQclihAYJBTGW3zJeYOCYEe+hQE4AGPufoPQqrZMJWGGna1/u1hxqTc= X-Google-Smtp-Source: AGHT+IG8i83ojCM1oXNScY2W5iBraTj3fEifxmmTUKGEf+srJSEE4C+rnvkyLZ6DswUhCabT5iITlQ== X-Received: by 2002:a5d:6c61:0:b0:34a:5640:45e1 with SMTP id r1-20020a5d6c61000000b0034a564045e1mr2398002wrz.45.1714134014345; Fri, 26 Apr 2024 05:20:14 -0700 (PDT) Received: from gpeter-l.lan ([2a0d:3344:2e8:8510:63cc:9bae:f542:50e4]) by smtp.gmail.com with ESMTPSA id q2-20020adff942000000b00346bda84bf9sm22478146wrr.78.2024.04.26.05.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:20:14 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: 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, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski Subject: [PATCH v3 4/6] scsi: ufs: host: ufs-exynos: allow max frequencies up to 267Mhz Date: Fri, 26 Apr 2024 13:20:02 +0100 Message-ID: <20240426122004.2249178-5-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog In-Reply-To: <20240426122004.2249178-1-peter.griffin@linaro.org> References: <20240426122004.2249178-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-20240426_052018_049133_2DFF304F X-CRM114-Status: GOOD ( 12.14 ) 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 Platforms such as Tensor gs101 the pclk frequency is 267Mhz. Increase PCLK_AVAIL_MAX so we don't fail the frequency check. Signed-off-by: Peter Griffin Acked-by: Krzysztof Kozlowski Tested-by: Will McVicker --- drivers/ufs/host/ufs-exynos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-exynos.h b/drivers/ufs/host/ufs-exynos.h index acf07cc54684..7acc13914100 100644 --- a/drivers/ufs/host/ufs-exynos.h +++ b/drivers/ufs/host/ufs-exynos.h @@ -116,7 +116,7 @@ struct exynos_ufs; #define PA_HIBERN8TIME_VAL 0x20 #define PCLK_AVAIL_MIN 70000000 -#define PCLK_AVAIL_MAX 167000000 +#define PCLK_AVAIL_MAX 267000000 struct exynos_ufs_uic_attr { /* TX Attributes */ From patchwork Fri Apr 26 12:20:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13644719 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 E092DC19F4F for ; Fri, 26 Apr 2024 12:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N+nf59ovcMVRxUpHnEMGGTU7xqVhUUQvNq1KFIdMcPI=; b=dcmOgYw73C4+NJ uno/TrUe5mJ7LCQ4Di+CA08ODzc8pOmTZ2enDTE/VXx1S3Q9PBnM/Oiprg4fjEgKEqlGPfVWXeqe+ 4bnJz1em5m+LYQnjaFy7JWzXagEKDad8kF+cweYAs7RYkpzEN9Zdc3Da3gq6PtFmzBlLrJY32baft IhejVKyxmt7Y2Y+2A5TvGs3laPabZucfxraNWXGa+zF52mo1rjN9qWITS8kR4YrO5ncHINvlbYac9 XKXGeec+syRgLWnXKPhsFE234qmuDDvbGI+Naf2J5kiv/YViwt/zKdsjv5qL5MCXj4oFG6mUW2eSZ I0g06AdY9ZYa4dkYNkZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZm-0000000CSP8-23DB; Fri, 26 Apr 2024 12:21:14 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZ4-0000000CRsg-10I7 for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2024 12:20:32 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-34b64b7728cso1696041f8f.0 for ; Fri, 26 Apr 2024 05:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714134016; x=1714738816; 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=Wg6doAvmwMbN07RQYwiVhFUbCIPMhfuvbRuHOazCfig=; b=UEPvfM/zaNTSWkayEDQwW3WkSxD8BKkI2zrXjLUmnQm/3m+m7379GVG/Sckteq0Gk4 msIi+baUHxZV+X2JwTqymfg5ZJa1i0WtfrAV7GOk5EXXQLrrnw0WfoI7V9uFOBA7hmsW 5NrRQp6Rx+vhvVFY31EEMLuKhg+6A/i9wDSDWSa9YdG327n13Bra0Jl26qSofmL6J4WU xbx5scOPyX3l9+tpmwFfTnhA1ID714WuHW03D1k5onjkLtBUv5mGbl/o7lc0IfBlGjBz EHnvwmwx8854gajWUpjh3UILaNpd2113rv2vUjpoT9ocMacsW7WTcFFceiv8sIxn6eHE wwEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714134016; x=1714738816; 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=Wg6doAvmwMbN07RQYwiVhFUbCIPMhfuvbRuHOazCfig=; b=bCrd3Fiv70uNFJTXb81rDJGQEBpuEOtdoimVMZ3XaZO1WIEcPwBHR0URCejHNdF0pn LNc48J0/wtyWbWZJKd2CSReiKil/ndL7tDZ9SxdaiFogvs/Wu5HM2Lsyn0tPq4fnCoQL JbZfAgzV5GwWoLGRRIl+ogDozbhlieJ0K8uddhcZGncKFL38MnHtC+3tsHGy5bYHOaTv pSu2fMjXn4xeEWEP15jgoqpeXwmXWnIVdYNYmR/OasyRCPO+RrtDmd8hUSZENbrXTrAl YVYPHc1WXdlXvhAma+6EXKknJG5Ac5EIZY/lGPEgI1AsgVFY203ajsIHse1g4bjkwGkE neRg== X-Forwarded-Encrypted: i=1; AJvYcCUvLzGj3fCxVXOUtjHs1u6rcbqzigiyL5JcMYpzM53kg1M+fy8ZrNfEmqdu9+69IkG6Q7JSAMsgZCXQAq5cubhU1CtttaB67/a7P6dB00Ix/Sxox8c= X-Gm-Message-State: AOJu0YxLl4pzBPLfPGvTX3Ya4xFYFXlpqoR5BqECxPvMkSy/bkUK+qQo 08DYzQfcA6Zf8ic6pB1uGXt1Xan6hjqcEM7zAN3VOgu8Mq6v3Kb7TVJkZu8EOhE= X-Google-Smtp-Source: AGHT+IFPwolxzCboIWuNQSJZ2XhYWLaaMBqWMqD+P8Hwf2SoPTkZkMnz+PbJcqdGhuszLk7XVCKSZg== X-Received: by 2002:a5d:6a8a:0:b0:34b:e446:3e0 with SMTP id s10-20020a5d6a8a000000b0034be44603e0mr1814853wru.47.1714134016110; Fri, 26 Apr 2024 05:20:16 -0700 (PDT) Received: from gpeter-l.lan ([2a0d:3344:2e8:8510:63cc:9bae:f542:50e4]) by smtp.gmail.com with ESMTPSA id q2-20020adff942000000b00346bda84bf9sm22478146wrr.78.2024.04.26.05.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:20:15 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: 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, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski Subject: [PATCH v3 5/6] scsi: ufs: host: ufs-exynos: add some pa_dbg_ register offsets into drvdata Date: Fri, 26 Apr 2024 13:20:03 +0100 Message-ID: <20240426122004.2249178-6-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog In-Reply-To: <20240426122004.2249178-1-peter.griffin@linaro.org> References: <20240426122004.2249178-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-20240426_052030_424262_E5C06F66 X-CRM114-Status: GOOD ( 14.56 ) 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 This allows these registers to be at different offsets or not exist at all on some SoCs variants. Signed-off-by: Peter Griffin Acked-by: Krzysztof Kozlowski Tested-by: Will McVicker --- drivers/ufs/host/ufs-exynos.c | 38 ++++++++++++++++++++++++----------- drivers/ufs/host/ufs-exynos.h | 6 +++++- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index 66093a905986..c086630a96e8 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -308,8 +308,9 @@ static int exynosauto_ufs_post_pwr_change(struct exynos_ufs *ufs, static int exynos7_ufs_pre_link(struct exynos_ufs *ufs) { + struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; + u32 val = attr->pa_dbg_opt_suite1_val; struct ufs_hba *hba = ufs->hba; - u32 val = ufs->drv_data->uic_attr->pa_dbg_option_suite; int i; exynos_ufs_enable_ov_tm(hba); @@ -326,12 +327,13 @@ static int exynos7_ufs_pre_link(struct exynos_ufs *ufs) UIC_ARG_MIB_SEL(TX_HIBERN8_CONTROL, i), 0x0); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_TXPHY_CFGUPDT), 0x1); udelay(1); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), val | (1 << 12)); + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), + val | (1 << 12)); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_SKIP_RESET_PHY), 0x1); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_SKIP_LINE_RESET), 0x1); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_LINE_RESET_REQ), 0x1); udelay(1600); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), val); + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), val); return 0; } @@ -923,14 +925,19 @@ static int exynos_ufs_phy_init(struct exynos_ufs *ufs) static void exynos_ufs_config_unipro(struct exynos_ufs *ufs) { + struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; struct ufs_hba *hba = ufs->hba; - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_CLK_PERIOD), - DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + if (attr->pa_dbg_clk_period_off) + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_clk_period_off), + DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTRAILINGCLOCKS), ufs->drv_data->uic_attr->tx_trailingclks); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), - ufs->drv_data->uic_attr->pa_dbg_option_suite); + + if (attr->pa_dbg_opt_suite1_off) + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), + attr->pa_dbg_opt_suite1_val); } static void exynos_ufs_config_intr(struct exynos_ufs *ufs, u32 errs, u8 index) @@ -1488,10 +1495,11 @@ static int exynosauto_ufs_vh_init(struct ufs_hba *hba) static int fsd_ufs_pre_link(struct exynos_ufs *ufs) { - int i; + struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; struct ufs_hba *hba = ufs->hba; + int i; - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_CLK_PERIOD), + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_clk_period_off), DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); ufshcd_dme_set(hba, UIC_ARG_MIB(0x201), 0x12); ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x40); @@ -1515,7 +1523,9 @@ static int fsd_ufs_pre_link(struct exynos_ufs *ufs) ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x0); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_AUTOMODE_THLD), 0x4E20); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OPTION_SUITE), 0x2e820183); + + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), + 0x2e820183); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0x0); exynos_ufs_establish_connt(ufs); @@ -1651,7 +1661,9 @@ static struct exynos_ufs_uic_attr exynos7_uic_attr = { .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_option_suite = 0x30103, + .pa_dbg_clk_period_off = PA_DBG_CLK_PERIOD, + .pa_dbg_opt_suite1_val = 0x30103, + .pa_dbg_opt_suite1_off = PA_DBG_OPTION_SUITE, }; static const struct exynos_ufs_drv_data exynosauto_ufs_drvs = { @@ -1725,7 +1737,9 @@ static struct exynos_ufs_uic_attr fsd_uic_attr = { .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_option_suite = 0x2E820183, + .pa_dbg_clk_period_off = PA_DBG_CLK_PERIOD, + .pa_dbg_opt_suite1_val = 0x2E820183, + .pa_dbg_opt_suite1_off = PA_DBG_OPTION_SUITE, }; static const struct exynos_ufs_drv_data fsd_ufs_drvs = { diff --git a/drivers/ufs/host/ufs-exynos.h b/drivers/ufs/host/ufs-exynos.h index 7acc13914100..f30423223474 100644 --- a/drivers/ufs/host/ufs-exynos.h +++ b/drivers/ufs/host/ufs-exynos.h @@ -145,7 +145,11 @@ struct exynos_ufs_uic_attr { /* Common Attributes */ unsigned int cmn_pwm_clk_ctrl; /* Internal Attributes */ - unsigned int pa_dbg_option_suite; + unsigned int pa_dbg_clk_period_off; + unsigned int pa_dbg_opt_suite1_val; + unsigned int pa_dbg_opt_suite1_off; + unsigned int pa_dbg_opt_suite2_val; + unsigned int pa_dbg_opt_suite2_off; /* Changeable Attributes */ unsigned int rx_adv_fine_gran_sup_en; unsigned int rx_adv_fine_gran_step; From patchwork Fri Apr 26 12:20:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13644718 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 46A05C4345F for ; Fri, 26 Apr 2024 12:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UyHWZGd50X1J+N91rE2WQFX1bPoK/lWfgBLBAOnFaQw=; b=rGCFD84YdV6lof BzgFle60EraR8rFkm8odXG6OwY/XDKZN/c1PEPKy4zlHaaT61e+wk567kZNlHW96lc3mbA1RDG50l 5KBH8KJWeIR+P32BY05tDVHER091OVoF2waprxcQVoiwCQIEbkGWh6qoN6t3q6vQqEuou7TPx9TvY sic4XXHR+bgIPvfDYm7iuwtxAhvbxrLcIRhL4+alwbPT0+PV8PjYO8U+Ivlv+K3DNGcKMQApDm0PP gFDkV/eQUwiwMqPICvKvwQeW8BB3RZkLeCP3m6//cgBp03tmctJkR3XnyaYMA24Zp3nUT8XKjWsj7 0Y70t+uSXEQC8wPTc1Rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZn-0000000CSQK-4BOp; Fri, 26 Apr 2024 12:21:16 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0KZG-0000000CRt1-3Gqc for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2024 12:20:47 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3476dcd9c46so1545938f8f.0 for ; Fri, 26 Apr 2024 05:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714134018; x=1714738818; 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=YA/3tT3fr7pWJ8UM5dniRKuE+JDGAM81Xu5sX8YLlYU=; b=kxhUbV86MxVI75hPu4t7DATQughvCHwSUjCsBhop8vlTl31zWR3Cf5VJznmIKJX9yF wekyYm2ukimyZkox8OA3WtX+mzFkCnxfUDk3AF9L+C4AOk2wKYIG+H6JLykiswQzG3fp 5CwEKLwVmah//Efd6KxetUCqQYATPKUsPcZeOLvD+N0xDhkxJvPaz2u9Db50JgbKRlK6 k282DG2O5xpwsLiHHkaqu1dgpRPdrq7EWAsZLXnWYUov+AqSinQeAmRZ+W+CKMnu7z42 E0I78ZdAGnHIzMoxNsFD+h9GYAIu8JW4XS1eBQlxwfWzWvzXJLbb6fHzH/+OWVXDUruA vMig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714134018; x=1714738818; 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=YA/3tT3fr7pWJ8UM5dniRKuE+JDGAM81Xu5sX8YLlYU=; b=a+dJUmhSTmYtHyu2H5aYzbHehkvSLctLquGjlBFi85k2gvh6I/7q7MjupSP1/m1kXw T+SEI6fAMNrD2/X62UoSCpfI8CPybQxY+4vQ037OPrVMbgQwrSX0OPrG4l/D00sOU5NC /nFuTyYCGxFSfuiXqu3f0sBvHqXQCzL3MOp7sRfYbz3wtdsA62eR8lluG6dHAdt+l2gj dwPW/Rzt5NLnKU9kVJG0veGrFDE7c6uRTHeagbm7SAzREWl0G998MxOSgf6tTyS63tIZ EMlufgurafGJn8BGdF0kqZSVct5jEG3GCOlixnp/Dvfo2w7n3aWDupsHbs2zNv//tvaG 31iw== X-Forwarded-Encrypted: i=1; AJvYcCVPA8LNIv0Q5cHzzZADKIMWdQ0pqtrxBg1ZIBmyHrHht5g5hLGufF4ebSkOTn7lvxoBeKSqNOqkx3CK++Hof+yZmum9Cyfbg/PXikDCzlQUkbqAKpw= X-Gm-Message-State: AOJu0Yxcz4zPm9qAVMQJnYSiChkPAQPse7eYyZs8SLIEh993OrA6Py11 Ogymn0KCBXsTw2e0Mv3k9cyHQIn7QzKrS1V2xKj/RtB5OLCKlTNrChk+4BPEKMo= X-Google-Smtp-Source: AGHT+IH4O0sGSqEk8pxHBCAwMP3CtuoSOPkPl7glPSkJZHmcm/yzfgFCqa1Pc81kOWCHo+Vd1F1Mjg== X-Received: by 2002:a5d:550f:0:b0:34c:5e02:786d with SMTP id b15-20020a5d550f000000b0034c5e02786dmr1109899wrv.4.1714134017888; Fri, 26 Apr 2024 05:20:17 -0700 (PDT) Received: from gpeter-l.lan ([2a0d:3344:2e8:8510:63cc:9bae:f542:50e4]) by smtp.gmail.com with ESMTPSA id q2-20020adff942000000b00346bda84bf9sm22478146wrr.78.2024.04.26.05.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 05:20:17 -0700 (PDT) From: Peter Griffin To: alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com Cc: 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, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, kernel-team@android.com, Peter Griffin , Krzysztof Kozlowski Subject: [PATCH v3 6/6] scsi: ufs: host: ufs-exynos: Add support for Tensor gs101 SoC Date: Fri, 26 Apr 2024 13:20:04 +0100 Message-ID: <20240426122004.2249178-7-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog In-Reply-To: <20240426122004.2249178-1-peter.griffin@linaro.org> References: <20240426122004.2249178-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-20240426_052043_034595_F70BE071 X-CRM114-Status: GOOD ( 18.98 ) 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 Add a dedicated compatible and drv_data with associated hooks for gs101 SoC found on Pixel 6. Note we make use of the previously added EXYNOS_UFS_OPT_UFSPR_SECURE option, to skip initialisation of UFSPR registers as these are only accessible via SMC call. EXYNOS_UFS_OPT_TIMER_TICK_SELECT option is also set to select tick source. This has been done so as not to effect any existing platforms. DBG_OPTION_SUITE on gs101 has different address offsets to other SoCs so these register offsets now come from uic_attr struct. Signed-off-by: Peter Griffin Acked-by: Krzysztof Kozlowski Tested-by: Will McVicker --- drivers/ufs/host/ufs-exynos.c | 146 ++++++++++++++++++++++++++++++++++ drivers/ufs/host/ufs-exynos.h | 14 ++++ 2 files changed, 160 insertions(+) diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index c086630a96e8..d66dccdc82db 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -61,6 +61,7 @@ #define CLK_STOP_MASK (REFCLKOUT_STOP | REFCLK_STOP |\ UNIPRO_MCLK_STOP | MPHY_APBCLK_STOP|\ UNIPRO_PCLK_STOP) +/* HCI_MISC is also known as HCI_FORCE_HCS */ #define HCI_MISC 0xB4 #define REFCLK_CTRL_EN BIT(7) #define UNIPRO_PCLK_CTRL_EN BIT(6) @@ -138,6 +139,9 @@ enum { /* * UNIPRO registers */ +#define UNIPRO_DME_POWERMODE_REQ_LOCALL2TIMER0 0x7888 +#define UNIPRO_DME_POWERMODE_REQ_LOCALL2TIMER1 0x788c +#define UNIPRO_DME_POWERMODE_REQ_LOCALL2TIMER2 0x7890 #define UNIPRO_DME_POWERMODE_REQ_REMOTEL2TIMER0 0x78B8 #define UNIPRO_DME_POWERMODE_REQ_REMOTEL2TIMER1 0x78BC #define UNIPRO_DME_POWERMODE_REQ_REMOTEL2TIMER2 0x78C0 @@ -938,6 +942,10 @@ static void exynos_ufs_config_unipro(struct exynos_ufs *ufs) if (attr->pa_dbg_opt_suite1_off) ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite1_off), attr->pa_dbg_opt_suite1_val); + + if (attr->pa_dbg_opt_suite2_off) + ufshcd_dme_set(hba, UIC_ARG_MIB(attr->pa_dbg_opt_suite2_off), + attr->pa_dbg_opt_suite2_val); } static void exynos_ufs_config_intr(struct exynos_ufs *ufs, u32 errs, u8 index) @@ -1589,6 +1597,96 @@ static int fsd_ufs_pre_pwr_change(struct exynos_ufs *ufs, return 0; } +static inline u32 get_mclk_period_unipro_18(struct exynos_ufs *ufs) +{ + return (16 * 1000 * 1000000UL / ufs->mclk_rate); +} + +static int gs101_ufs_pre_link(struct exynos_ufs *ufs) +{ + struct ufs_hba *hba = ufs->hba; + int i; + u32 tx_line_reset_period, rx_line_reset_period; + + rx_line_reset_period = (RX_LINE_RESET_TIME * ufs->mclk_rate) + / NSEC_PER_MSEC; + tx_line_reset_period = (TX_LINE_RESET_TIME * ufs->mclk_rate) + / NSEC_PER_MSEC; + + unipro_writel(ufs, get_mclk_period_unipro_18(ufs), COMP_CLK_PERIOD); + + ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x40); + + for_each_ufs_rx_lane(ufs, i) { + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_RX_CLK_PRD, i), + DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_RX_CLK_PRD_EN, i), 0x0); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_RX_LINERESET_VALUE2, i), + (rx_line_reset_period >> 16) & 0xFF); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_RX_LINERESET_VALUE1, i), + (rx_line_reset_period >> 8) & 0xFF); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_RX_LINERESET_VALUE0, i), + (rx_line_reset_period) & 0xFF); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x2f, i), 0x69); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x84, i), 0x1); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x25, i), 0xf6); + } + + for_each_ufs_tx_lane(ufs, i) { + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_TX_CLK_PRD, i), + DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_TX_CLK_PRD_EN, i), + 0x02); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_TX_LINERESET_PVALUE2, i), + (tx_line_reset_period >> 16) & 0xFF); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_TX_LINERESET_PVALUE1, i), + (tx_line_reset_period >> 8) & 0xFF); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(VND_TX_LINERESET_PVALUE0, i), + (tx_line_reset_period) & 0xFF); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x04, i), 1); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x7F, i), 0); + } + + ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x0); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0x0); + ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID), 0x0); + ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID_VALID), 0x1); + ufshcd_dme_set(hba, UIC_ARG_MIB(T_PEERDEVICEID), 0x1); + ufshcd_dme_set(hba, UIC_ARG_MIB(T_CONNECTIONSTATE), CPORT_CONNECTED); + ufshcd_dme_set(hba, UIC_ARG_MIB(0xA006), 0x8000); + + return 0; +} + +static int gs101_ufs_post_link(struct exynos_ufs *ufs) +{ + struct ufs_hba *hba = ufs->hba; + + exynos_ufs_enable_dbg_mode(hba); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_SAVECONFIGTIME), 0x3e8); + exynos_ufs_disable_dbg_mode(hba); + + return 0; +} + +static int gs101_ufs_pre_pwr_change(struct exynos_ufs *ufs, + struct ufs_pa_layer_attr *pwr) +{ + struct ufs_hba *hba = ufs->hba; + + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA0), 12000); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA1), 32000); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA2), 16000); + unipro_writel(ufs, 8064, UNIPRO_DME_POWERMODE_REQ_LOCALL2TIMER0); + unipro_writel(ufs, 28224, UNIPRO_DME_POWERMODE_REQ_LOCALL2TIMER1); + unipro_writel(ufs, 20160, UNIPRO_DME_POWERMODE_REQ_LOCALL2TIMER2); + unipro_writel(ufs, 12000, UNIPRO_DME_POWERMODE_REQ_REMOTEL2TIMER0); + unipro_writel(ufs, 32000, UNIPRO_DME_POWERMODE_REQ_REMOTEL2TIMER1); + unipro_writel(ufs, 16000, UNIPRO_DME_POWERMODE_REQ_REMOTEL2TIMER2); + + return 0; +} + static const struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .name = "exynos_ufs", .init = exynos_ufs_init, @@ -1715,6 +1813,34 @@ static const struct exynos_ufs_drv_data exynos_ufs_drvs = { .post_pwr_change = exynos7_ufs_post_pwr_change, }; +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, + .pa_dbg_opt_suite2_off = PA_GS101_DBG_OPTION_SUITE2, +}; + static struct exynos_ufs_uic_attr fsd_uic_attr = { .tx_trailingclks = 0x10, .tx_dif_p_nsec = 3000000, /* unit: ns */ @@ -1758,7 +1884,27 @@ static const struct exynos_ufs_drv_data fsd_ufs_drvs = { .pre_pwr_change = fsd_ufs_pre_pwr_change, }; +static const struct exynos_ufs_drv_data gs101_ufs_drvs = { + .uic_attr = &gs101_uic_attr, + .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | + UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR | + UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR | + 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 | + EXYNOS_UFS_OPT_UFSPR_SECURE | + EXYNOS_UFS_OPT_TIMER_TICK_SELECT, + .drv_init = exynosauto_ufs_drv_init, + .pre_link = gs101_ufs_pre_link, + .post_link = gs101_ufs_post_link, + .pre_pwr_change = gs101_ufs_pre_pwr_change, +}; + static const struct of_device_id exynos_ufs_of_match[] = { + { .compatible = "google,gs101-ufs", + .data = &gs101_ufs_drvs }, { .compatible = "samsung,exynos7-ufs", .data = &exynos_ufs_drvs }, { .compatible = "samsung,exynosautov9-ufs", diff --git a/drivers/ufs/host/ufs-exynos.h b/drivers/ufs/host/ufs-exynos.h index f30423223474..1646c4a9bb08 100644 --- a/drivers/ufs/host/ufs-exynos.h +++ b/drivers/ufs/host/ufs-exynos.h @@ -9,6 +9,12 @@ #ifndef _UFS_EXYNOS_H_ #define _UFS_EXYNOS_H_ +/* + * Component registers + */ + +#define COMP_CLK_PERIOD 0x44 + /* * UNIPRO registers */ @@ -29,6 +35,14 @@ #define PA_DBG_OPTION_SUITE 0x9564 #define PA_DBG_OPTION_SUITE_DYN 0x9565 +/* + * Note: GS101_DBG_OPTION offsets below differ from the TRM + * but match the downstream driver. Following the TRM + * results in non-functioning UFS. + */ +#define PA_GS101_DBG_OPTION_SUITE1 0x956a +#define PA_GS101_DBG_OPTION_SUITE2 0x956d + /* * MIBs for Transport Layer debug registers */