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) \