From patchwork Tue Apr 23 20:50: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: 13640713 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 60293C04FFE for ; Tue, 23 Apr 2024 20:51:34 +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=tmdXX0CgZhPskA gNld1d3heK3fclDvGwsSNBAfRjqaQeIm28XGp2ILcmrXlG4lBifTlnDcvYk3DZ7VwEjvNPRYrrqD0 Q0q1zu2YSvcD1LR81JYNOwuxHDBvm1VY1uoeVu88DKoqvJW3DqHkiutNgh+mbmYLzvQwpWzg+5E/2 5KFgAXT0ucHAI6BQ8ltEjzwsbtK4eJhcTzHKQGBOmsk0PZxt5v7+MSE5z3r0K1RNWZOPQgFHjB43d rl1h98OU3yXVac4WGwg0YK9jvQFiTdi3PyKa16/b8uuCwkO4KWJn81BtfRxS2/p4Pi4p6/DZiEZv/ fTUHi9+HQ0rv8OToRT9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzN6l-00000001TH7-3liX; Tue, 23 Apr 2024 20:51:19 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzN5z-00000001Slk-2FOv for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 20:50:33 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4196c62bb4eso34085275e9.2 for ; Tue, 23 Apr 2024 13:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713905430; x=1714510230; 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=tUfZ0PUZsqIQ1hPR2YUYMm5/Afdu18m1GT3TUtJElTidDG9cKaANHZPdKZHadcdSni T4Pyyerpyz72la6fE0/YmRPMVBJ8fVmsE3QZ7i9OXZK5MQ9TGRFNfpfisGFn1y7rvQcg n0BSyfDtUiEJlyRXVaEnxc1ZLU5VBLPdr0E+dU6OXwvu30nkU86J46y3ncLoas36fWg0 /g54CMdWIWoPWhe+OiVLCZLK/LHnehiwq+n7pIJc0dzIPZLwAkE6iJ7QbClUkmkAza4h HQSZoHeyGnQbaORe/KBWAG6CvSQHDI3znRRXwikiWQTDnB4OZ1tDiBBsq3Ax50D7vg5B KcNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713905430; x=1714510230; 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=T1iCgbZhMLUAfnzuTwBLsqyxZ93cxfUBT/5QzEK2nTkJDI8NyV95H7Hb0FSKzgld9k xdq6Klp7QabNiSpq9XSC+qJLdrnwIOzoUbh/eDn8H8B4x79pxJ8Qx970aZz5P9lt7mVB C8jmYhHCFRmojKnj1IuCP8XtLe0IFu3VHrixnFOTT5bEolmpuhVd+SNTkH2wzjfxoWeD RPH3+X9gOaKvS7knnqWPm6B1HN5MOvCsQc6YjhS391QBnbyy/0hSV2SVUMy6ZjruHeN5 nGd2Moj1wrqoxj/QUAOZ0XAOQhPx0gKNcuVNA9ioK32nAXpHLnUe+7hr20HA462TDnNV 0qmg== X-Forwarded-Encrypted: i=1; AJvYcCXPAkgb2gA3czsCvDgrdpCm0Up85/4BvxeR7FtOY04QT3w5iTzqjfLFnyE9XbvFxS/OPmMB95rc8/a/GM2V4hKDs2rCMqDg9lu2rJtiQXcBavjwMFs= X-Gm-Message-State: AOJu0YyAKa11mFUVLcQfT8tTrd3C2M+Q9FSyKi0jk/xlhZ+Fr8XeakKz al6A+m8+6Nd+9LU92DReHkJd5QByKxyb2eVO5r3pGsk1yL3OK3CTDQ3raFJN+7w= X-Google-Smtp-Source: AGHT+IGaC6Vi359eexueF4iWi9nmGX5wxuCM1Fm/OruWavgWB268ofzG0ipJO8D32PKK0SvENR0WUA== X-Received: by 2002:a05:600c:2991:b0:418:9d5a:f680 with SMTP id r17-20020a05600c299100b004189d5af680mr254261wmd.25.1713905429971; Tue, 23 Apr 2024 13:50:29 -0700 (PDT) Received: from gpeter-l.lan ([2a0d:3344:2e8:8510:4269:2542:5a09:9ca1]) by smtp.gmail.com with ESMTPSA id bg5-20020a05600c3c8500b00419f419236fsm13065443wmb.41.2024.04.23.13.50.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 13:50:29 -0700 (PDT) From: Peter Griffin To: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vkoul@kernel.org, kishon@kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, s.nawrocki@samsung.com, cw00.choi@samsung.com, jejb@linux.ibm.com, martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, ebiggers@kernel.org Cc: linux-scsi@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tudor.ambarus@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, Peter Griffin , Krzysztof Kozlowski Subject: [PATCH v2 09/14] scsi: ufs: host: ufs-exynos: add EXYNOS_UFS_OPT_TIMER_TICK_SELECT option Date: Tue, 23 Apr 2024 21:50:01 +0100 Message-ID: <20240423205006.1785138-10-peter.griffin@linaro.org> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog In-Reply-To: <20240423205006.1785138-1-peter.griffin@linaro.org> References: <20240423205006.1785138-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-20240423_135031_850147_D7202515 X-CRM114-Status: GOOD ( 11.74 ) 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) \