Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1259777lfc; Wed, 1 Jun 2022 13:22:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIc4oP2hOtzheZ5Kuf3I7OIPvPUBSBTUNNzifc4VeX3un8MrD1FBiZMumNrR4Uf0BLNAnL X-Received: by 2002:a17:902:f552:b0:163:f64a:6154 with SMTP id h18-20020a170902f55200b00163f64a6154mr1138966plf.147.1654114949367; Wed, 01 Jun 2022 13:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654114949; cv=none; d=google.com; s=arc-20160816; b=mBbyCL0/RxrKPj3aGma22117kZ5SuFlKt7FIqRliacYdwLo93AJeAOrUmNGZxaxeAH kr0f3PWvzsCkQPWID1LybLYlmuR4jL9gr7JBizj/uVka2pA/ayCf5eBo0tkmR2rkIYaR bua4e87yBnMHucg+tF0v7s3Fy6jA/EK5ljWgQ+PQWie4yR2gjoq9WAzXDlSyoDzi6Xl7 F1kdbFtQMMc8zG7zrMFTjC6BS2htpmO74PoznLsjLzHdp05UXsrEtzJQPR09B72Yw8jH oZP4End5pnTbE1GKPlA+bFUTA08nYNNR1mofdqqwHPdrJfbO9zwzW1YzsfrF0EtkisIx wHcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=MefAl/5CSsIqUvfBRB4GKDe7Rqk1CpPiQz9ZkrZGXIE=; b=hl0sa3FI2JklINq1s7sOEDJ34qGE1vxGWiv4Cwpn/8hiVVh+RRUG4P7ChwzeLFLoNn KKzPvKQVe5bDHOv0nnqJxsgVTOY0OsfyL6yYesn06I1ywF+6XGxO/bwlPCWNGToErfE1 TZYa8YYllzzQbC2R3QjY0n6mIN6YPu6MOy4e4LVTRm/I+5icSvWL+xDgMW2wozBNtLTx qUnMs5GKbNczHmKy/BonZ9p4cUN0auLqbh96DFUkBXAaDbR2WpaPW2ruF4UKd0xTujk3 9aYxIuANQYPIe8op/0n7xUs1l088KvDdC39F4nciDDrah7YPsI+WJLmPkfExxSLenHcu D5jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=PPleZt5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w12-20020a056a0014cc00b005106eb25aebsi3118542pfu.211.2022.06.01.13.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:22:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=PPleZt5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD1FB24AEFF; Wed, 1 Jun 2022 12:35:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243332AbiEaBXv (ORCPT + 99 others); Mon, 30 May 2022 21:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243343AbiEaBXt (ORCPT ); Mon, 30 May 2022 21:23:49 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE79940A08 for ; Mon, 30 May 2022 18:23:47 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220531012345epoutp02cbe599118aefb35b3e2d59be4960e7a0~0DA-67x6J2272322723epoutp02L for ; Tue, 31 May 2022 01:23:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220531012345epoutp02cbe599118aefb35b3e2d59be4960e7a0~0DA-67x6J2272322723epoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1653960225; bh=MefAl/5CSsIqUvfBRB4GKDe7Rqk1CpPiQz9ZkrZGXIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PPleZt5TQAtsKtiZuXchv6tZdo5NFykncyLLE3qbcgiV60bvVqmo8P9uoXKOTTfmp TGAuPwQCYBzvtaVq54GVJFd4zF0bHaTULHsAnoiVOBVjCWkzXYixj/QNpBKFeP+mq+ 1KIYn8BEA3G/ROxMJUkwwyX9XT664I+xoaoKJUx0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20220531012344epcas5p26f0aad0fa8e75fb16f6524ec14d2a028~0DA-BX9pa0088200882epcas5p2T; Tue, 31 May 2022 01:23:44 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.180]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LBvgK4WbLz4x9QN; Tue, 31 May 2022 01:23:41 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id FD.F5.09762.D1E65926; Tue, 31 May 2022 10:23:41 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20220531012341epcas5p19b15b4916b210687ab6b46d6da0b2273~0DA7aWj0v1064310643epcas5p1Q; Tue, 31 May 2022 01:23:41 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220531012341epsmtrp286fa393e34f482da8f4be33283dc110c~0DA7ZJrS72336523365epsmtrp2p; Tue, 31 May 2022 01:23:41 +0000 (GMT) X-AuditID: b6c32a4b-1fdff70000002622-ad-62956e1db12a Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 80.6F.11276.C1E65926; Tue, 31 May 2022 10:23:40 +0900 (KST) Received: from Jaguar.sa.corp.samsungelectronics.net (unknown [107.108.73.139]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220531012338epsmtip259f4afa19e18dfb4ce36a71e6ba5fe0c~0DA49MtAU1203612036epsmtip20; Tue, 31 May 2022 01:23:38 +0000 (GMT) From: Alim Akhtar To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, vkoul@kernel.org, avri.altman@wdc.com, bvanassche@acm.org, martin.petersen@oracle.com, chanho61.park@samsung.com, pankaj.dubey@samsung.com, Alim Akhtar , linux-fsd@tesla.com, Bharat Uppal Subject: [PATCH 2/6] phy: samsung-ufs: move cdr offset to drvdata Date: Tue, 31 May 2022 06:52:16 +0530 Message-Id: <20220531012220.80563-3-alim.akhtar@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220531012220.80563-1-alim.akhtar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIJsWRmVeSWpSXmKPExsWy7bCmpq5s3tQkg/9PFCwezNvGZvHy51U2 i2svL7BbTPvwk9ni8n5ti/lHzrFa9L14yGyx6fE1VouHr8ItL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ar/fp7nBc61KGYIlUqNFVb04LA2DlFiKMxINtZiLihMBI3njxucCAAA= X-CMS-MailID: 20220531012341epcas5p19b15b4916b210687ab6b46d6da0b2273 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220531012341epcas5p19b15b4916b210687ab6b46d6da0b2273 References: <20220531012220.80563-1-alim.akhtar@samsung.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move CDR lock offset to drv data so that it can be extended for other SoCs which are having CDR lock at different register offset. Cc: linux-fsd@tesla.com Signed-off-by: Bharat Uppal Signed-off-by: Alim Akhtar --- drivers/phy/samsung/phy-exynos7-ufs.c | 3 +++ drivers/phy/samsung/phy-exynosautov9-ufs.c | 2 ++ drivers/phy/samsung/phy-samsung-ufs.c | 3 ++- drivers/phy/samsung/phy-samsung-ufs.h | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/phy/samsung/phy-exynos7-ufs.c b/drivers/phy/samsung/phy-exynos7-ufs.c index 7c9008e163db..d1a37273cb1f 100644 --- a/drivers/phy/samsung/phy-exynos7-ufs.c +++ b/drivers/phy/samsung/phy-exynos7-ufs.c @@ -11,6 +11,8 @@ #define EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_MASK 0x1 #define EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_EN BIT(0) +#define PHY_CDR_LOCK_STATUS 0x5e + /* Calibration for phy initialization */ static const struct samsung_ufs_phy_cfg exynos7_pre_init_cfg[] = { PHY_COMN_REG_CFG(0x00f, 0xfa, PWR_MODE_ANY), @@ -74,4 +76,5 @@ const struct samsung_ufs_phy_drvdata exynos7_ufs_phy = { .en = EXYNOS7_EMBEDDED_COMBO_PHY_CTRL_EN, }, .has_symbol_clk = 1, + .cdr_lock_status_offset = PHY_CDR_LOCK_STATUS, }; diff --git a/drivers/phy/samsung/phy-exynosautov9-ufs.c b/drivers/phy/samsung/phy-exynosautov9-ufs.c index 36398a15c2db..1572b985c70d 100644 --- a/drivers/phy/samsung/phy-exynosautov9-ufs.c +++ b/drivers/phy/samsung/phy-exynosautov9-ufs.c @@ -10,6 +10,7 @@ #define EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CTRL 0x728 #define EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CTRL_MASK 0x1 #define EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CTRL_EN BIT(0) +#define EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS 0x5e #define PHY_TRSV_REG_CFG_AUTOV9(o, v, d) \ PHY_TRSV_REG_CFG_OFFSET(o, v, d, 0x50) @@ -64,4 +65,5 @@ const struct samsung_ufs_phy_drvdata exynosautov9_ufs_phy = { .en = EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CTRL_EN, }, .has_symbol_clk = 0, + .cdr_lock_status_offset = EXYNOSAUTOV9_EMBEDDED_COMBO_PHY_CDR_LOCK_STATUS, }; diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c index 602ddef259eb..8e5ae228daa7 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.c +++ b/drivers/phy/samsung/phy-samsung-ufs.c @@ -63,7 +63,8 @@ static int samsung_ufs_phy_wait_for_lock_acq(struct phy *phy) } err = readl_poll_timeout( - ufs_phy->reg_pma + PHY_APB_ADDR(PHY_CDR_LOCK_STATUS), + ufs_phy->reg_pma + + PHY_APB_ADDR(ufs_phy->drvdata->cdr_lock_status_offset), val, (val & PHY_CDR_LOCK_BIT), sleep_us, timeout_us); if (err) dev_err(ufs_phy->dev, diff --git a/drivers/phy/samsung/phy-samsung-ufs.h b/drivers/phy/samsung/phy-samsung-ufs.h index 91a0e9f94f98..965c79bbc278 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.h +++ b/drivers/phy/samsung/phy-samsung-ufs.h @@ -40,7 +40,6 @@ /* UFS PHY registers */ #define PHY_PLL_LOCK_STATUS 0x1e -#define PHY_CDR_LOCK_STATUS 0x5e #define PHY_PLL_LOCK_BIT BIT(5) #define PHY_CDR_LOCK_BIT BIT(4) @@ -109,6 +108,7 @@ struct samsung_ufs_phy_drvdata { u32 en; } isol; bool has_symbol_clk; + u32 cdr_lock_status_offset; }; struct samsung_ufs_phy { -- 2.25.1