From patchwork Wed Jul 14 07:11:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9B8FC07E9A for ; Wed, 14 Jul 2021 07:12:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 935C96138C for ; Wed, 14 Jul 2021 07:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238129AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21068 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238222AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210714071203epoutp03e48f031f69f5ea583bf1c9bb13508e91~RlsdFXA5Y1977019770epoutp039 for ; Wed, 14 Jul 2021 07:12:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210714071203epoutp03e48f031f69f5ea583bf1c9bb13508e91~RlsdFXA5Y1977019770epoutp039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246723; bh=Usn14cwoAH2iGNudSDG44vuke1ctfhBYfcmgTwhyEoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sEni/bzWY6sa/y5uacWQmTB+ex0tNj4jWcyHxZrSj8/GBGkvxfXYcdkGTje2hf/W0 5UPiMY06ZUdPfxUGwWR8LWbcZ8YGY5p7hxwey0UWqEtiT9VTdkuCaIPwXtIyq3o3tU Grihzv5NZ1uv51fsicA3sFTuDdSLmO3+uROyvBds= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210714071202epcas2p338f6e55cf3802ef5bafa2f0171940f3d~Rlsch0ry52304323043epcas2p3f; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.188]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4GPpbM681yz4x9QR; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id E0.BF.09541.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210714071158epcas2p261e6c9157056fafca0f55aaf05cd68ef~RlsZHkV0m0402804028epcas2p2A; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210714071158epsmtrp1853274cc6ac7b287aac5f4311e561dea~RlsZGsLeJ1252112521epsmtrp1E; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) X-AuditID: b6c32a46-0abff70000002545-f0-60ee8e3f346f Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id C0.17.08289.E3E8EE06; Wed, 14 Jul 2021 16:11:58 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071158epsmtip259fe1822ef242cfdbbc48fc8d9453007~RlsY5xAno2465824658epsmtip2n; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 01/15] scsi: ufs: add quirk to handle broken UIC command Date: Wed, 14 Jul 2021 16:11:17 +0900 Message-Id: <20210714071131.101204-2-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIJsWRmVeSWpSXmKPExsWy7bCmha5937sEg97XGhYnn6xhs3gwbxub xcufV9kspn34yWzxaf0yVovL+7UtenY6W5yesIjJ4sn6WcwWi25sY7JYec3C4vz5DewWN7cc ZbGYcX4fk0X39R1sFsuP/2NyEPC4fMXb43JfL5PH5hVaHov3vGTy2LSqk81jwqIDjB4fn95i 8ejbsorR4/MmOY/2A91MAVxROTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5 ibmptkouPgG6bpk5QH8oKZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVUgtScgoMDQv0ihNz i0vz0vWS83OtDA0MjEyBKhNyMl5OnMdScIS3onnhTaYGxhncXYycHBICJhKtt9YxdTFycQgJ 7GCUeHrsAxuE84lR4vnxi+wQzmdGiYnXL7PDtFyYtYMVIrGLUeL15gaoqo+MEjd6/jKCVLEJ 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ejbsorR4/MmOY/2A91MAVxRXDYpqTmZZalF+nYJXBkvJ85jKTjCW9G88CZTA+MM7i5GTg4J AROJC7N2sHYxcnEICexglJhzbSo7REJW4tm7HVC2sMT9liOsILaQwHtGiVn3OUFsNgFdiS3P XzGCNIsI7GKUOHzmMDuIwyxwmVni27QrzCBVwgLeEttWP2ABsVkEVCXWdv5iA7F5BewlJjWt htogL3Fq2UEmEJtTwEHi4IYPjBDb7CX+bVsNVS8ocXLmE7A5zED1zVtnM09gFJiFJDULSWoB I9MqRsnUguLc9NxiwwKjvNRyveLE3OLSvHS95PzcTYzg2NLS2sG4Z9UHvUOMTByMhxglOJiV RHiXGr1NEOJNSaysSi3Kjy8qzUktPsQozcGiJM57oetkvJBAemJJanZqakFqEUyWiYNTqoFp vsLFgE8v4x90Suw8Y9vobT67+8Ph9ROZJtaHmxfumiQV/Xy/5APZlQfKXnffjzm3zaDh/c55 bnGh5wI2dTyIUW9s45+9eFlds8DmqgkfVxxkKH3QWnhvprpJYVqBwLNlxhyen5aefFjbnyiW eUS26A+X5SLL2Zs2CfiuTvXa/nV2n/ixzqs8v/Q4hHY8ENx39hL33jOyJ+x+yrP/1V94TJJp oWSR97/lZ48veP785d13B3hezeozM9c00Ft/psf/edjhVutXDVHvXq20OPB1WsDatN2b2M4F fe1b4Pmdt2vHjvfBUtUXfi/8YWr6TO+nBbeHQfP17fuuLddyEz6sHRmzztms/c29M2uchNY+ /a/EUpyRaKjFXFScCABon6BlHAMAAA== X-CMS-MailID: 20210714071158epcas2p261e6c9157056fafca0f55aaf05cd68ef X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071158epcas2p261e6c9157056fafca0f55aaf05cd68ef References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: jongmin jeong samsung ExynosAuto9 SoC has two types of host controller interface to support the virtualization of UFS Device. One is the physical host(PH) that the same as conventaional UFSHCI, and the other is the virtual host(VH) that support data transfer function only. In this structure, the virtual host does not support UIC command. To support this, we add the quirk and return 0 when the UIC command send function is called. Signed-off-by: jongmin jeong Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufshcd.c | 3 +++ drivers/scsi/ufs/ufshcd.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index b87ff68aa9aa..9702086e9860 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2350,6 +2350,9 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) int ret; unsigned long flags; + if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD) + return 0; + ufshcd_hold(hba, false); mutex_lock(&hba->uic_cmd_mutex); ufshcd_add_delay_before_dme_cmd(hba); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index c98d540ac044..e67b1fcfe1a2 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -567,6 +567,12 @@ enum ufshcd_quirks { * This quirk allows only sg entries aligned with page size. */ UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE = 1 << 14, + + /* + * This quirk needs to be enabled if the host controller does not + * support UIC command + */ + UFSHCD_QUIRK_BROKEN_UIC_CMD = 1 << 15, }; enum ufshcd_caps { From patchwork Wed Jul 14 07:11:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C734C11F66 for ; Wed, 14 Jul 2021 07:12:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 673C5613AA for ; Wed, 14 Jul 2021 07:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238244AbhGNHPQ (ORCPT ); Wed, 14 Jul 2021 03:15:16 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:31544 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238270AbhGNHPA (ORCPT ); Wed, 14 Jul 2021 03:15:00 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210714071204epoutp04d01163388ceb8f8e2b9d50389c443fd2~Rlsd9nJN-0822208222epoutp04J for ; Wed, 14 Jul 2021 07:12:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210714071204epoutp04d01163388ceb8f8e2b9d50389c443fd2~Rlsd9nJN-0822208222epoutp04J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246724; bh=B/muAc9TRv4pSpc80ShCQZ82fhjl/jURU5rQKCwXimc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nm5FHdubuDB8IKbEzHy44Wq/B2vCLoucGRwQyUlKTvnW+DPz8ckI5SaRSQDUz5YpY 8dMqEohLb0Aq6R+nkHzD6KcDQ9upGaUkVtBjfZ0aGwFbr0GDX/4HfoCLWZvzx9JGnS fxK9Vfoha9PpgwGtofmi9XCT2yYKQn8///QxygNU= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20210714071203epcas2p4d6495da02ba438ea6fd600e298bb2275~RlsdGfXH02506525065epcas2p40; Wed, 14 Jul 2021 07:12:03 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.191]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4GPpbM6SSpz4x9QS; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 41.42.09921.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210714071158epcas2p29900b577a489b760a1e67eba976fb815~RlsZNvzb_0402804028epcas2p2B; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210714071158epsmtrp1149b3eac8fe7d996561530c0ccbfc7ae~RlsZKIKKk1240112401epsmtrp1c; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) X-AuditID: b6c32a45-fb3ff700000026c1-0d-60ee8e3f51a9 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id D0.17.08289.E3E8EE06; Wed, 14 Jul 2021 16:11:58 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071158epsmtip2e80bd3368cfbcda389312564ef389bee~RlsY_9iR52386423864epsmtip2X; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 02/15] scsi: ufs: add quirk to enable host controller without ph configuration Date: Wed, 14 Jul 2021 16:11:18 +0900 Message-Id: <20210714071131.101204-3-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAJsWRmVeSWpSXmKPExsWy7bCmqa5937sEg32LjC1OPlnDZvFg3jY2 i5c/r7JZTPvwk9ni0/plrBaX92tb9Ox0tjg9YRGTxZP1s5gtFt3YxmSx8pqFxfnzG9gtbm45 ymIx4/w+Jovu6zvYLJYf/8fkIOBx+Yq3x+W+XiaPzSu0PBbvecnksWlVJ5vHhEUHGD0+Pr3F 4tG3ZRWjx+dNch7tB7qZAriicmwyUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTy EnNTbZVcfAJ03TJzgP5QUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQXl9gqpRak5BQYGhboFSfm Fpfmpesl5+daGRoYGJkCVSbkZDRe28dacJ634sjtc8wNjEu4uxg5OSQETCR+zXnA1sXIxSEk sINRYueRI0wQzidGicYlexghnM+MEj+ePGWDaelb95YVIrGLUeL9nW4WCOcjo8StuQeZQarY BHQltjx/BdYuAjJ41eK7YFXMAieZJU4vOMgOUiUskCzxevMPRhCbRUBV4ueayWA7eAXsJeZ8 O8wIsU9e4tSyg0wgNqeAg8TBDR8YIWoEJU7OfMICYjMD1TRvnc0MskBC4ASHxM+7X5ghml0k Zj9bxQ5hC0u8Or4FypaSeNnfxg7R0M0o0froP1RiNaNEZ6MPhG0v8Wv6FqBPOYA2aEqs36UP YkoIKEscuQW1l0+i4/B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LDjKB2JwCDhIHN3wAiwsB1fzbthqqXlDi5MwnYOcxA9U3b53NPIFRYBaS1CwkqQWM TKsYJVMLinPTc4sNC4zyUsv1ihNzi0vz0vWS83M3MYKjS0trB+OeVR/0DjEycTAeYpTgYFYS 4V1q9DZBiDclsbIqtSg/vqg0J7X4EKM0B4uSOO+FrpPxQgLpiSWp2ampBalFMFkmDk6pBqao WRc/rNXr3m/6TH/dybR7F5/pumzZcbd1jc7jnr/9LEvPnO5Lebrn6rtLj6Yuf8M0e/3+w+mC TxpfcReXMNSo5a5KZlL1EJ7HfHbLf+d9Okq1oYeehisabrgfKf4igkE5lrnjtWyLx2XZfwX/ bLLzcutfThHsy1JJmM/SnT7b9n3mEf/Ge7uWSziY57XecUw487hOImfDQr/zTUsdK38r/3Qw Pa5xu0XqW27uzDv2/9XUS3um8bEtFrJyemHEP2OCjDOD4flpoYyWFQenPZlest97aeJkm4R9 vKEW3oe+qzxIigtT/qv5477ZNodpySYsV+QvCVW35IS5Z3AdLepm++A9e4tWbrbYo426QUos xRmJhlrMRcWJAKZAMCQdAwAA X-CMS-MailID: 20210714071158epcas2p29900b577a489b760a1e67eba976fb815 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071158epcas2p29900b577a489b760a1e67eba976fb815 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: jongmin jeong samsung ExynosAuto SoC has two types of host controller interface to support the virtualization of UFS Device. One is the physical host(PH) that the same as conventaional UFSHCI, and the other is the virtual host(VH) that support data transfer function only. In this structure, the virtual host does not support like device management. This patch skips the physical host interface configuration part that cannot be performed in the virtual host. Suggested-by: Alim Akhtar Signed-off-by: jongmin jeong Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufshcd.c | 3 +++ drivers/scsi/ufs/ufshcd.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9702086e9860..0df337aa1e6f 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7988,6 +7988,9 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async) if (ret) goto out; + if (hba->quirks & UFSHCD_QUIRK_SKIP_PH_CONFIGURATION) + goto out; + /* Debug counters initialization */ ufshcd_clear_dbg_ufs_stats(hba); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index e67b1fcfe1a2..e18b12028796 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -573,6 +573,12 @@ enum ufshcd_quirks { * support UIC command */ UFSHCD_QUIRK_BROKEN_UIC_CMD = 1 << 15, + + /* + * This quirk needs to be enabled if the host controller cannot + * support physical host configuration. + */ + UFSHCD_QUIRK_SKIP_PH_CONFIGURATION = 1 << 16, }; enum ufshcd_caps { From patchwork Wed Jul 14 07:11:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96460C11F6B for ; Wed, 14 Jul 2021 07:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D4BE613AB for ; Wed, 14 Jul 2021 07:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238079AbhGNHPB (ORCPT ); Wed, 14 Jul 2021 03:15:01 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:31132 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238219AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210714071202epoutp043ecc5546af0087fbacb7269df8047662~RlscK6hti0784107841epoutp04N for ; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210714071202epoutp043ecc5546af0087fbacb7269df8047662~RlscK6hti0784107841epoutp04N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246722; bh=M6jwd/uFVXCcVX//Z5fosy/+SrI/tUr8RN1jeMDDCDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SvGHPaCY5prbULd1W5gcNS0DMZUA0HMdAmPLtVHso6REUtrn+m1hiPADkLnT9RWwp 6Y5bjBH0y8kXqZHeZFSAcSqSq2kn0dK/C/yTPDPAv851SDb6L2lKX1mNf1uCSdTPv5 nwQawMT5ykJn8nyQhYPPbibMQNqGiHEEla/c3xk0= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20210714071201epcas2p1c1ffde96c530964287da9c0912bcb486~Rlsbbcred0871808718epcas2p1p; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.40.189]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4GPpbM6b8yz4x9QH; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 74.3B.09541.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p36dc12e150a84ef4fa2516bc98169725b~RlsZYKZnP2179721797epcas2p3N; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp1e9b1dcf299604ae2ad5f6c9f92568a0d~RlsZXHRFu1252112521epsmtrp1G; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a47-609ff70000002545-90-60ee8e3f0e1d Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 52.43.08394.E3E8EE06; Wed, 14 Jul 2021 16:11:58 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071158epsmtip2cbab984d24c9777bc93844ceb8516dcb~RlsZEHu_Y2375923759epsmtip2_; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 03/15] scsi: ufs: ufs-exynos: change pclk available max value Date: Wed, 14 Jul 2021 16:11:19 +0900 Message-Id: <20210714071131.101204-4-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Te0xTVxzOube9vZDBrgXnodmjqZgJDmiLhaMRcJbodRjtnMsWko3e0Dsg 6yu9hczOOLZFJpYhPrJ2DInAhliW8UbAqTxHKjrYmAgICTNsWjJYhUWlTFnpxYz/vt85v+/7 zvc755C4+BdCQuYYrazFyOhlRLCgtSdKFZNSPKeVl9fHI/f09wSaKm8lkGfxFoG+8i7iaL6u WoiGr21BRe1qNFBSiaHpulIcVY62YujiCEKDg/UiNNbcJ0DOwasYst9uI9CF/qfYTooe/i2N Hi7+EqObaqLpqh89GN3oKiTokspOQD/4Y1xAFze7AL3Q+DL9Racd0wSn63dks4yOtUhZY6ZJ l2PMSpKlvZWhzlAlyBUxim0oUSY1MgY2SZa6TxOzO0fvzyGT5jH6XP+ShuE4WVzyDosp18pK s02cNUnGmnV6s0JhjuUYA5drzIrNNBm2K+RypcrfqdVnzzjHBOZe4UdTtwrwfDAqOAGCSEht hcXXL4lOgGBSTLUB+LtvHPDFPIBjLdUCvngI4OMJr+gZxbF8l+A3rgA44j0j5IsHAFY9ugNW uggqBjbfmwloha8Iu6omA1o45cbhwPmugFYYdRDWf3sjwBBQm+DS/DVsBYdQKfCsw4Pxfq/A 69VdARxE7YRd9V7A96yD7q+nAzFwf8/nLd/gKwaQukHCmco5IU9Oha4lH87jMDjT37waQgI9 JwtEPMEO4LG7y6sbtQAWfrqPxynQ52j2C5F+hyhY1xG3AiG1EfaOr/qGwuM9T0T8cgg8XiDm ia/CzkuO1Qm/BO1lC6unoeHi43aMn9YZv2vtX0QJkJauiVO6Jk7p/8bnAe4CL7BmzpDFckpz /NpLbgSBtx29pw04Z72x3QAjQTeAJC4LD/lOOasVh+iYwzbWYsqw5OpZrhuo/MM+hUvWZ5r8 n8NozVColAkJ8m0qpEpQItmGEFLUrRVTWYyV/ZBlzazlGQ8jgyT5WEOrU7vlQLjcXtR3p2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cv6 dUyQ2Our/s0O0yIM0kqU7acLz5BKWXH4aybnnz8tRvcn9b1n6jp2b3rL2vvRmZomxRePdbNM mG4oYZxqXVWmVMmjWCBgLL1xopvLCo0f/8Marl+qtucrP/DyyvXdjurCR5e8jUlb/fy22O7S nKjvhq2zCiKVc8MmR+f8yjH5LRolZs0UsjrpNs/+0iDxpfvi758xkHPYHi984eyPPidL/88d fx5YF+fEr7ovzNt2wkmEve3jVWeDK+dDdJ3qjhVa/XZg7po9QzQxcFNQfc1dsb+XWHgnpi9S YinOSDTUYi4qTgQA5NeRch0DAAA= X-CMS-MailID: 20210714071159epcas2p36dc12e150a84ef4fa2516bc98169725b X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p36dc12e150a84ef4fa2516bc98169725b References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To support 167MHz PCLK, we need to adjust the maximum value. Signed-off-by: Chanho Park Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufs-exynos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 67505fe32ebf..475a5adf0f8b 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -99,7 +99,7 @@ struct exynos_ufs; #define PA_HIBERN8TIME_VAL 0x20 #define PCLK_AVAIL_MIN 70000000 -#define PCLK_AVAIL_MAX 133000000 +#define PCLK_AVAIL_MAX 167000000 struct exynos_ufs_uic_attr { /* TX Attributes */ From patchwork Wed Jul 14 07:11:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376141 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA49EC11F67 for ; Wed, 14 Jul 2021 07:12:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE75B613AB for ; Wed, 14 Jul 2021 07:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238266AbhGNHO7 (ORCPT ); Wed, 14 Jul 2021 03:14:59 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21006 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238079AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210714071202epoutp034a5364b4731a263b05106e1781638ab6~RlscMMi9b1985919859epoutp03b for ; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210714071202epoutp034a5364b4731a263b05106e1781638ab6~RlscMMi9b1985919859epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246722; bh=YOZ5BNAbzYTzYNUSuiqBSwuF3vy175tJRdUfBrY/I+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7lD3mXD9lu9Hy9VkyalayzZmpOkkVWcXCuZFEQNO2qs/G7XiuwVB3sF0bqGHrNFP Wd+gU/jA3elW7zji4O1TDh1SuoeNw8Pev82AX66bjLrW7qjYGGC8qATBmHGrN71xfP rnTezbubDTqGwHwfVNOqvUjKtxdr2goSykMnJkRc= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20210714071201epcas2p11624130d2836aea5c7a0ec4787d240e2~Rlsbf2eyr0389603896epcas2p1-; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.190]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4GPpbM6Rmxz4x9QK; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 99.3D.09571.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p3fa23ac2a670e1c31deeac1c9332f76fe~RlsZaNsRO2291022910epcas2p3I; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp2143a1fa89189a4ef069edc5e723f94ae~RlsZZLk3A0755107551epsmtrp2k; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a48-1f5ff70000002563-05-60ee8e3f4280 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 13.17.08289.E3E8EE06; Wed, 14 Jul 2021 16:11:58 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071158epsmtip25c0331498ffa3602859a93afc0435a36~RlsZLsTA52386723867epsmtip2o; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 04/15] scsi: ufs: ufs-exynos: simplify drv_data retrieval Date: Wed, 14 Jul 2021 16:11:20 +0900 Message-Id: <20210714071131.101204-5-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Te0xTVxjPube9vbBUr8DcGXtQuugCS7GtFI9GRhmO3AWmZG77g2WDa7nh sb7S2/pgi2EYsDxE5oxi3RgDxhTMaGot6GA81AkzBjKqTiciUGYAy6uLwuZgLRcz/vt95/f9 vt/3feccEg+5QYSTuXoza9IzWikRLHBdjtoiS6iYypTfKFaiXs85Aj2odhFofOEmgU7MLOBo rrlBiAY63kDlF5PQ9cpaDHmabTiq/d2FobO3EOrrs4vQHedVAarq+xlDZbdbCfTDtUVMTdED 7hR6oOIIRp8/E03XtY1jtKOxhKArazsBPTt2V0BXOBsB7XO8Sh/uLMPSgtO123NYJos1SVi9 xpCVq8+Ol6bszkjKUMXJFTLFVrRFKtEzOjZeuiM1TZacq/XPIZXsZbQW/1Eaw3HSTW9uNxks ZlaSY+DM8VLWmKU1KhTGGI7RcRZ9dozGoNumkMuVKn9mpjZnuCPR+Nu6/Q32R0QB+HNNKQgi IRUL6x/6QACHUK0A2l3CUhDsx3MA1l84i/GBD0DPYC94ppicX8R4xSU/UXuAT5oFcL7jgTBA EJQMOh9OgAARFijbWDcoCAQ41YvD6zVdokBWKJUKv3VWLysE1AbY8pM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sEEXvGSVaN05lBUmwCehKbHn+ ihEkISKwi1Hi8JnD7CAOs8BlZolv064wg1QJC/hIzN8yD6yDRUBVYvtukDgHB6+AvcSsJguI DfISp5YdZAKxOQUcJA5u+MAIYgsBlfzbtpoNxOYVEJQ4OfMJ2HXMQPXNW2czT2AUmIUkNQtJ agEj0ypGydSC4tz03GLDAqO81HK94sTc4tK8dL3k/NxNjODI0tLawbhn1Qe9Q4xMHIyHGCU4 mJVEeJcavU0Q4k1JrKxKLcqPLyrNSS0+xCjNwaIkznuh62S8kEB6YklqdmpqQWoRTJaJg1Oq gWlmtugPt+lTnFueCl44LK8oeTn5Iu85LuG8v3ZqfLLvz97Y+jIiaNrKLR2ugqzfft7N6+wU 2BWx8fCr9dvbzrx7dcF9bZz/tjX8ioe9JgTPfWH5RHRXzY6DvlHxS9e8s2TV8NKoz/3hWpka q7t8ZugDaXb/jNeblTkm6S82V45/seifyXEN1bq27/GObB7Hv7bapzpFTJjVlhvRsqB0+qSF igfXiWz7dWrbnnnXzbUUZ828m7ftVvDhvzbTNribxoj84WsuPZpvvPRg3gnbZesCGV2kS3Vm qjB37mYUS7vUw/jY7+oewVrjQ+ZShrcZqq0n1YZN3sC0QFLNRWdPWMpksV8LJFY1OT3MjzVf q6/EUpyRaKjFXFScCABLISQnGwMAAA== X-CMS-MailID: 20210714071159epcas2p3fa23ac2a670e1c31deeac1c9332f76fe X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p3fa23ac2a670e1c31deeac1c9332f76fe References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The compatible field of exynos_ufs_drv_data is not necessary because of_device_id already has it. Thus, we don't need it anymore and we can get drv_data by device_get_match_data. Signed-off-by: Chanho Park Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufs-exynos.c | 10 +--------- drivers/scsi/ufs/ufs-exynos.h | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index cf46d6f86e0e..db5892901cc0 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -893,17 +893,10 @@ static int exynos_ufs_post_link(struct ufs_hba *hba) static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs *ufs) { struct device_node *np = dev->of_node; - struct exynos_ufs_drv_data *drv_data = &exynos_ufs_drvs; struct exynos_ufs_uic_attr *attr; int ret = 0; - while (drv_data->compatible) { - if (of_device_is_compatible(np, drv_data->compatible)) { - ufs->drv_data = drv_data; - break; - } - drv_data++; - } + ufs->drv_data = device_get_match_data(dev); if (ufs->drv_data && ufs->drv_data->uic_attr) { attr = ufs->drv_data->uic_attr; @@ -1258,7 +1251,6 @@ static struct exynos_ufs_uic_attr exynos7_uic_attr = { }; static struct exynos_ufs_drv_data exynos_ufs_drvs = { - .compatible = "samsung,exynos7-ufs", .uic_attr = &exynos7_uic_attr, .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR | diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 475a5adf0f8b..7bf2053f6e90 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -142,7 +142,6 @@ struct exynos_ufs_uic_attr { }; struct exynos_ufs_drv_data { - char *compatible; struct exynos_ufs_uic_attr *uic_attr; unsigned int quirks; unsigned int opts; @@ -191,7 +190,7 @@ struct exynos_ufs { struct ufs_pa_layer_attr dev_req_params; struct ufs_phy_time_cfg t_cfg; ktime_t entry_hibern8_t; - struct exynos_ufs_drv_data *drv_data; + const struct exynos_ufs_drv_data *drv_data; u32 opts; #define EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL BIT(0) From patchwork Wed Jul 14 07:11:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3673AC11F6A for ; Wed, 14 Jul 2021 07:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10425613C2 for ; Wed, 14 Jul 2021 07:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238281AbhGNHPA (ORCPT ); Wed, 14 Jul 2021 03:15:00 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21030 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238211AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210714071202epoutp032cb958740e8cd1a58d0f64cdd209ecca~Rlsci-3BJ1952519525epoutp035 for ; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210714071202epoutp032cb958740e8cd1a58d0f64cdd209ecca~Rlsci-3BJ1952519525epoutp035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246722; bh=kLp8JXy2THeuVplpTPaDlDYNhkGSfgHHsgtP8hixo6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAxIcD5wbvo/+EmyGUetwfeg3IYzfOA4MWiSXM7HVD/tcajcwhwKKzU/dEuZuRZqP xsvyhOPPfOyvWVlBL5deNbSAE7uUxD7F4tbq+BYLsQjufwqFtBLsjG5BZg2iEEP3NI h6VBVT9eFKQJ3De30bzMkVfeqdY9UoB+bXWczk1Q= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210714071201epcas2p3f38dd696582f064d8722919bf057f0c2~Rlsb3c9bK2291022910epcas2p3Y; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.187]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4GPpbM6T3wz4x9QC; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 31.42.09921.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p2ae981fb3b91b0eba23060de5de104ec0~RlsZfoYbW1836418364epcas2p2B; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp224c40fa2c30796e84eb7d3b2ac61cee2~RlsZdT0dZ0755107551epsmtrp2l; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a45-f9dff700000026c1-0c-60ee8e3fac1a Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 63.43.08394.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071158epsmtip2f0c19f0fdc5c5c4779c29d5edf3b471e~RlsZQonon2388323883epsmtip2S; Wed, 14 Jul 2021 07:11:58 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 05/15] scsi: ufs: ufs-exynos: get sysreg regmap for io-coherency Date: Wed, 14 Jul 2021 16:11:21 +0900 Message-Id: <20210714071131.101204-6-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLJsWRmVeSWpSXmKPExsWy7bCmua5937sEg5f7DSxOPlnDZvFg3jY2 i5c/r7JZTPvwk9ni0/plrBaX92tb9Ox0tjg9YRGTxZP1s5gtFt3YxmSx8pqFxfnzG9gtbm45 ymIx4/w+Jovu6zvYLJYf/8fkIOBx+Yq3x+W+XiaPzSu0PBbvecnksWlVJ5vHhEUHGD0+Pr3F 4tG3ZRWjx+dNch7tB7qZAriicmwyUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTy EnNTbZVcfAJ03TJzgP5QUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQXl9gqpRak5BQYGhboFSfm Fpfmpesl5+daGRoYGJkCVSbkZCxvf8dccECwYuKSz6wNjGv4uhg5OCQETCSWffHsYuTiEBLY wSjx+cMSFgjnE6PEzN/L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39R1sFsuP/2NyEPC4fMXb43JfL5PH5hVaHov3vGTy2LSqk81jwqIDjB4fn95i 8ejbsorR4/MmOY/2A91MAVxRXDYpqTmZZalF+nYJXBnL298xFxwQrJi45DNrA+Mavi5GTg4J AROJmV+2MHYxcnEICexmlJh4+hE7REJW4tm7HVC2sMT9liOsILaQwHtGiT9LSkFsNgFdiS3P X4E1iwjsYpQ4fOYwO4jDLHCZWeLbtCvMIFXCAsES2678AUpwcLAIqEo8PFIOEuYVsJeYfmAb C8QCeYlTyw4ygdicAg4SBzd8YIRYZi/xb9tqNoh6QYmTM5+A1TMD1Tdvnc08gVFgFpLULCSp BYxMqxglUwuKc9Nziw0LDPNSy/WKE3OLS/PS9ZLzczcxgiNLS3MH4/ZVH/QOMTJxMB5ilOBg VhLhXWr0NkGINyWxsiq1KD++qDQntfgQozQHi5I474Wuk/FCAumJJanZqakFqUUwWSYOTqkG JrE2w4re0JhvR37uFd2dLlCZaPFvygJWE5uVm/6Wu7gyWf/Yz/0tllkv5fAylfyJvJNlJdfv 57jJy7Ly/3GhR+e+7rRPSCoUuJh258LLhwobHBnMahzajU/mlB66rlQlMdNw7qIZJ1vOCq5p mJJcONFtXwTPZ6NCk/B1R1l3GNby3N7IcMnxX2nwbI+udbtVG5dkp//zvH/o5uYHRx617Sx+ KBJmrfDI73bYOw+Z+/dVP16OY2z7t4g5clH8VT63wwLmxdoh079c8lV21jknytExx9ll1o1J r23ji9OCd12tDVf6ua40WvTubTt9b/b9c/MKvKOZroQUPvwU/E9C+IThgj/mm5l6Nb89efzt uBJLcUaioRZzUXEiAFMj+RMbAwAA X-CMS-MailID: 20210714071159epcas2p2ae981fb3b91b0eba23060de5de104ec0 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p2ae981fb3b91b0eba23060de5de104ec0 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org UFS_EMBD sharability register of fsys block provides "sharability" setting of ufs-exynos. It can be set via syscon and regmap. Signed-off-by: Chanho Park --- .../devicetree/bindings/ufs/samsung,exynos-ufs.yaml | 5 +++++ drivers/scsi/ufs/ufs-exynos.c | 5 +++++ drivers/scsi/ufs/ufs-exynos.h | 1 + 3 files changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml index 38193975c9f1..d3e31b23b62d 100644 --- a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml +++ b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml @@ -54,6 +54,11 @@ properties: phy-names: const: ufs-phy + sysreg: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: phandle for FSYS sysreg interface, used to control + sysreg register bit for UFS IO Coherency + required: - compatible - reg diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index db5892901cc0..da02ad3b036c 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -906,6 +907,10 @@ static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs *ufs) goto out; } + ufs->sysreg = syscon_regmap_lookup_by_phandle(np, "sysreg"); + if (IS_ERR(ufs->sysreg)) + ufs->sysreg = NULL; + ufs->pclk_avail_min = PCLK_AVAIL_MIN; ufs->pclk_avail_max = PCLK_AVAIL_MAX; diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 7bf2053f6e90..a46f30639f38 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -191,6 +191,7 @@ struct exynos_ufs { struct ufs_phy_time_cfg t_cfg; ktime_t entry_hibern8_t; const struct exynos_ufs_drv_data *drv_data; + struct regmap *sysreg; u32 opts; #define EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL BIT(0) From patchwork Wed Jul 14 07:11:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D3C5C11F6B for ; Wed, 14 Jul 2021 07:12:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21A16613AA for ; Wed, 14 Jul 2021 07:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238234AbhGNHPN (ORCPT ); Wed, 14 Jul 2021 03:15:13 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:11763 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238265AbhGNHPA (ORCPT ); Wed, 14 Jul 2021 03:15:00 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210714071203epoutp02165ed209c0fb85db750817fef9987ee3~RlsdRt9532739527395epoutp02B for ; Wed, 14 Jul 2021 07:12:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210714071203epoutp02165ed209c0fb85db750817fef9987ee3~RlsdRt9532739527395epoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246723; bh=UtUs0ckI1WjMnBc4T0luZfxA+lX2d3D8Loe91SggtwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FvQ+wweWO5uEPyr2xRDuLkJ2/5Yo+cN0rRzSDt3rHIvFm0pWb71l37ktFqDpRj1yk wM5uSBeX92lEEhbStLrgPXVWZw/lUUuhBQSnwFq+l2CMZvfc7EQkR3S6UKjAQ9Q6nX MFti4gDGa/SxWOsv5VagNIR3gyrmFvZMqzPfxr6s= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20210714071202epcas2p23d205134a67fd0954415d1a520e9487c~RlscYmk5z0402804028epcas2p2R; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.191]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4GPpbN20jZz4x9Pw; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id A9.3D.09571.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p3d39f7e5cbd9a2b8addaa496a396213af~RlsZk8fOT2304323043epcas2p3F; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp2151ae4dbcbde4a57cea81574f66667ee~RlsZj7DHz0755107551epsmtrp2m; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a48-1dfff70000002563-06-60ee8e3fda68 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 34.17.08289.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip2e7df4a6e4267308d397cf34bad42c361~RlsZV3eJz2387023870epsmtip2D; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 06/15] scsi: ufs: ufs-exynos: add refclkout_stop control Date: Wed, 14 Jul 2021 16:11:22 +0900 Message-Id: <20210714071131.101204-7-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01TbUxTVxj23FtuL5CaS2HuSOJkV5mDpdASWg8Kg01CLgEzyPyjWwI3cNOS lbbrBYLLtoAT5aMwGGFAddOgqONDCFZgfvBRhA6YK6OgjgQ3DA2UDINgTDCOre3tNv4973ue 533e9z3nkLj0VyKUzNMVcEYdq6WJAFHvSIRKlljzNFveNBmLxhc7CPTH970Ecm3OEujbtU0c rXdd8UOOwXeQ6ccjaLK2BUOLXWYctTzqxdAPDxCy27vF6DfLqAg12QcwVPWwn0BXbVtYEsU4 ZtIYR001xty4FslcuuPCmJ62CoKpbRkCzDPnnIipsbQBZqPnDebsUBWWEXBCG6/h2FzOGMbp cvS5eTp1Ap32YdaRLKVKrpAp4tBBOkzH5nMJdHJ6hiwlT+uegw4rYrWF7lQGy/N09LvxR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cX4fk0X39R1sFsuP/2NyEPC4fMXb43JfL5PH5hVaHov3vGTy2LSqk81jwqIDjB4fn95i 8ejbsorR4/MmOY/2A91MAVxRXDYpqTmZZalF+nYJXBnHLv1jKjjMXnF16XP2Bsa1bF2MnBwS AiYSc6deYe5i5OIQEtjBKLFs0wlGiISsxLN3O9ghbGGJ+y1HWEFsIYH3jBKtf6xAbDYBXYkt z18xgjSLCOxilDh85jA7iMMscJlZ4ts0kLGcHMIC3hKXji0Bm8QioCpxfN9DsEm8AvYSk9/s h9ogL3Fq2UEmEJtTwEHi4IYPjBDb7CX+bVvNBlEvKHFy5hMWEJsZqL5562zmCYwCs5CkZiFJ LWBkWsUomVpQnJueW2xYYJSXWq5XnJhbXJqXrpecn7uJERxbWlo7GPes+qB3iJGJg/EQowQH s5II71KjtwlCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeS90nYwXEkhPLEnNTk0tSC2CyTJxcEo1 MC07d6W4pz/9Y0py9Pvp9SZXOi0OLLS77aMm8rUzQ/z0VPe38Z4HePeUP00M0UyVXzeTV153 4fzn84N8C+ZtOe0svddSz1nuTZSY8hXRNNdQi87MNuUp1efvuj8J9xWv1FgvbWAV9umBBeuL 19u4uq9cnpb+ahdfBI/6FqE7Vx7YMTk5nl6Tfcic8fTcEyItRv8WRJYfDeDLCxdQXrNfcvuZ BfdmrJ38PXK38b3YVUsOXy35MnHVsjtT//0w2qycoVykP1svZ86Mexl15o/m3Xs6yezpp3kP nALCJG70c69cavvS48rkOW+3X3ufVxF+x3Fd8Sa/Iz7qdeYnanuub3q1qYorrYGl9KeBdFGk e6ESS3FGoqEWc1FxIgDuo8WTHAMAAA== X-CMS-MailID: 20210714071159epcas2p3d39f7e5cbd9a2b8addaa496a396213af X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p3d39f7e5cbd9a2b8addaa496a396213af References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds REFCLKOUT_STOP control to CLK_STOP_MASK. It can en/disable reference clock out control for UFS device. Signed-off-by: Chanho Park Reviewed-by: Alim Akhtar --- drivers/scsi/ufs/ufs-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index da02ad3b036c..78cc5bda0a1f 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -49,10 +49,11 @@ #define HCI_ERR_EN_T_LAYER 0x84 #define HCI_ERR_EN_DME_LAYER 0x88 #define HCI_CLKSTOP_CTRL 0xB0 +#define REFCLKOUT_STOP BIT(4) #define REFCLK_STOP BIT(2) #define UNIPRO_MCLK_STOP BIT(1) #define UNIPRO_PCLK_STOP BIT(0) -#define CLK_STOP_MASK (REFCLK_STOP |\ +#define CLK_STOP_MASK (REFCLKOUT_STOP | REFCLK_STOP |\ UNIPRO_MCLK_STOP |\ UNIPRO_PCLK_STOP) #define HCI_MISC 0xB4 From patchwork Wed Jul 14 07:11:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BA6C11F72 for ; Wed, 14 Jul 2021 07:12:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C0F5613AA for ; Wed, 14 Jul 2021 07:12:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238251AbhGNHPF (ORCPT ); Wed, 14 Jul 2021 03:15:05 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:31112 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238240AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210714071201epoutp04d7989f9320964aa80ed7ca19c59e9a18~RlscE-ucw0822208222epoutp04F for ; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210714071201epoutp04d7989f9320964aa80ed7ca19c59e9a18~RlscE-ucw0822208222epoutp04F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246722; bh=nMElEhDOh+0gZSWQnKtzixOmaoeS4v1nCMxL6Kc/MxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ly2YSvKBFErC+am3j/bBAmpRh2JP3IfD6yr7CnVelvb0M+XlS7fD8LWqSPk4uCCzB z9zD4V4rw55wj96yX2f8PVNf6i5RxkkqpwNaeE1wJopbbGeyqaoeEXOp/T6SJ5HD9J zbF9A2nzsRn/9bFc1L1h/BBtsMuCu48DjFMcv9gs= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20210714071201epcas2p4371ef76c00a3c60871a13e33c945c8e2~RlsbTZVRh2506225062epcas2p4q; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.183]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4GPpbM6dFqz4x9QJ; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id B9.3D.09571.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p4c4eabf50abdaa46567fc5356bce8942b~RlsZsV7E52506525065epcas2p4l; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp1d193383e8c25893c979722203999b387~RlsZrR60q1252112521epsmtrp1I; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a48-1f5ff70000002563-07-60ee8e3f6b97 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 75.17.08289.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip2f1cf003de2a8bcbd415ae7b8d68b04e4~RlsZdI1oB1845718457epsmtip2x; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 07/15] scsi: ufs: ufs-exynos: add setup_clocks callback Date: Wed, 14 Jul 2021 16:11:23 +0900 Message-Id: <20210714071131.101204-8-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIJsWRmVeSWpSXmKPExsWy7bCmma5937sEgx+dJhYnn6xhs3gwbxub xcufV9kspn34yWzxaf0yVovL+7UtenY6W5yesIjJ4sn6WcwWi25sY7JYec3C4vz5DewWN7cc ZbGYcX4fk0X39R1sFsuP/2NyEPC4fMXb43JfL5PH5hVaHov3vGTy2LSqk81jwqIDjB4fn95i 8ejbsorR4/MmOY/2A91MAVxROTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5 ibmptkouPgG6bpk5QH8oKZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVUgtScgoMDQv0ihNz i0vz0vWS83OtDA0MjEyBKhNyMh5+WMhcMEGgYtOx1awNjOd4uxg5OSQETCTur1rK3sXIxSEk sINRom3zFGYI5xOjxMIVHVCZz4wSB/pOscK0HGvZzgSR2MUoMXnTLRYI5yOjxJ2vN1hAqtgE dCW2PH/FCJIQARm8avFdsCpmgZPMEqcXHGQHqRIW8JK49Hw7G4jNIqAqcez5BLAdvAL2Evt/ 7IXaJy9xatlBJhCbU8BB4uCGD4wQNYISJ2c+AdvGDFTTvHU22OUSAhc4JG4+P8AM0ewiceL7 ZihbWOLV8S3sELaUxMv+NnaIhm5GidZH/6ESqxklOht9IGx7iV/TtwBdwQG0QVNi/S59EFNC QFniyC2ovXwSHYf/skOEeSU62oQgGtUlDmyfzgJhy0p0z/kM9YqHxLw1F1khoTWZUeLtivus ExgVZiF5ZxaSd2YhLF7AyLyKUSy1oDg3PbXYqMAEOZI3MYLTtpbHDsbZbz/oHWJk4mA8xCjB wawkwrvU6G2CEG9KYmVValF+fFFpTmrxIUZTYGBPZJYSTc4HZo68knhDUyMzMwNLUwtTMyML JXFeDvZDCUIC6YklqdmpqQWpRTB9TBycUg1M8clxHTzCDonxfJW9bqpL5ql+qPw2y/akPKtO tcH/l1Yre/VUzxypXfpjqod2r+6No5vuHLFsZ57XtphrRUzm3blXp4Qkdopviq5yu/isLm+i smEUu5UCm6bhlgtbDK/rOPb2MNeViVxRmFe94NZ2IX3eW3N3CWf2VP40ZoiftLitdvapxpC4 L1P/34gT/ZXvll8qzxO48eOTGRsKntX7Kp1T/K4rN6tXpahbcEPl9wkPKjdKbpa5/cU7w37y vPwlZcl5KyrchK6//WOeZhtRUPYlQfn4g935wW7reX47fp70c/Gdz+Fd++6cWLp4rveX8Dxl o1tmFfNYDm78EdFir7h96fOtvaa1wVeFp+5SYinOSDTUYi4qTgQAkxJovGQEAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42LZdlhJXte+712CwZL5whYnn6xhs3gwbxub xcufV9kspn34yWzxaf0yVovL+7UtenY6W5yesIjJ4sn6WcwWi25sY7JYec3C4vz5DewWN7cc ZbGYcX4fk0X39R1sFsuP/2NyEPC4fMXb43JfL5PH5hVaHov3vGTy2LSqk81jwqIDjB4fn95i 8ejbsorR4/MmOY/2A91MAVxRXDYpqTmZZalF+nYJXBkPPyxkLpggULHp2GrWBsZzvF2MnBwS AiYSx1q2M3UxcnEICexglHi16AorREJW4tm7HewQtrDE/ZYjrBBF7xklPu5cxAySYBPQldjy /BUjSEJEYBejxOEzh9lBHGaBy8wS36ZdAasSFvCSuPR8OxuIzSKgKnHs+QSwFbwC9hL7f+yF WicvcWrZQSYQm1PAQeLghg+MILYQUM2/bavZIOoFJU7OfMICYjMD1Tdvnc08gVFgFpLULCSp BYxMqxglUwuKc9Nziw0LjPJSy/WKE3OLS/PS9ZLzczcxgqNLS2sH455VH/QOMTJxMB5ilOBg VhLhXWr0NkGINyWxsiq1KD++qDQntfgQozQHi5I474Wuk/FCAumJJanZqakFqUUwWSYOTqkG pgnW3vN3Jcfot+aIff+jurJNOV33wa/nJS+kJpbXbpY85h+ruMJ71iypcx339Q/r/7l075s3 y8pjhwp8tjBsX65iW73mqorfIYMjvi/EdrPlst1uYXjdNtfosU3NuvKPCcv3JyzTyLQM59W/ uHx7ofL0okQ7+f3nVSsTj6oXvLvXXHBq6U7uBydOnH7/4lQDS19C+/H+xW/mTrvV4bjgP6PH Vt65/JlqIdZbbS0mNEy+wDmB6Ykfy/Izt7srC7OaKnVfCsTHd2y7tfbi80f/T6+LvWfycF7n p+MS/5edlWC4/2SXJmceu+BO4U8f1zoVCG6sCH9yaMM9E7Hc/suBH8znRM+ZE6Af0LY/5kxc XKESS3FGoqEWc1FxIgCgC19JHQMAAA== X-CMS-MailID: 20210714071159epcas2p4c4eabf50abdaa46567fc5356bce8942b X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p4c4eabf50abdaa46567fc5356bce8942b References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds setup_clocks callback to control/gate clocks by ufshcd. To avoid calling before initialization, it needs to check whether ufs is null or not and call it initially from pre_link callback. Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufs-exynos.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 78cc5bda0a1f..530dab500d11 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -795,6 +795,27 @@ static void exynos_ufs_config_intr(struct exynos_ufs *ufs, u32 errs, u8 index) } } +static int exynos_ufs_setup_clocks(struct ufs_hba *hba, bool on, + enum ufs_notify_change_status status) +{ + struct exynos_ufs *ufs = ufshcd_get_variant(hba); + + if (!ufs) + return 0; + + if (on) { + if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL) + exynos_ufs_disable_auto_ctrl_hcc(ufs); + exynos_ufs_ungate_clks(ufs); + } else { + exynos_ufs_gate_clks(ufs); + if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL) + exynos_ufs_enable_auto_ctrl_hcc(ufs); + } + + return 0; +} + static int exynos_ufs_pre_link(struct ufs_hba *hba) { struct exynos_ufs *ufs = ufshcd_get_variant(hba); @@ -813,6 +834,8 @@ static int exynos_ufs_pre_link(struct ufs_hba *hba) exynos_ufs_config_phy_time_attr(ufs); exynos_ufs_config_phy_cap_attr(ufs); + exynos_ufs_setup_clocks(hba, true, POST_CHANGE); + if (ufs->drv_data->pre_link) ufs->drv_data->pre_link(ufs); @@ -1203,6 +1226,7 @@ static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .hce_enable_notify = exynos_ufs_hce_enable_notify, .link_startup_notify = exynos_ufs_link_startup_notify, .pwr_change_notify = exynos_ufs_pwr_change_notify, + .setup_clocks = exynos_ufs_setup_clocks, .setup_xfer_req = exynos_ufs_specify_nexus_t_xfer_req, .setup_task_mgmt = exynos_ufs_specify_nexus_t_tm_req, .hibern8_notify = exynos_ufs_hibern8_notify, From patchwork Wed Jul 14 07:11:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9D56C07E9A for ; Wed, 14 Jul 2021 07:12:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEF616138C for ; Wed, 14 Jul 2021 07:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238269AbhGNHPK (ORCPT ); Wed, 14 Jul 2021 03:15:10 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:31516 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238222AbhGNHO7 (ORCPT ); Wed, 14 Jul 2021 03:14:59 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210714071203epoutp04d1f5012878be2faeadbdf465a16f6a29~RlsdJKMlN0948909489epoutp04H for ; Wed, 14 Jul 2021 07:12:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210714071203epoutp04d1f5012878be2faeadbdf465a16f6a29~RlsdJKMlN0948909489epoutp04H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246723; bh=ZaMi4QacgtlRAgjhOjwhR1V6/hTtev/Lnt+7zdF5Yl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VFlG6ZZdKkqZ1dOCFvDFqx4vFtrYawuBUlI6x0g8mOkXcvcFvnhKn+UYiZvOwL3E9 H78ThUKHEHdWAEg7eErLtmumwF1LgY+cXLcCxidjnzeSgDm0P8zLwlGYlrK7tBBE6X xTL5HQGOPDdGxYUDg+w2ahLxSeXCXrujWN3oxw0c= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20210714071202epcas2p256dc6c6f6d4eba9c95a5c2b672c3fc18~RlscX_0F21657016570epcas2p2j; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.183]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4GPpbN4Txkz4x9Pv; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 42.BF.09541.F3E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p24b7be0cad31af09bc71c608f9b03fe36~RlsZ2TdkI0402804028epcas2p2E; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp24fd04a77a7de79fdd3d7aeb50520adfe~RlsZ1bWnb0755107551epsmtrp2p; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a46-095ff70000002545-f1-60ee8e3ff0b1 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B4.43.08394.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip2c1a4706c716236f06f9ff0501af836e7~RlsZixBcM2388323883epsmtip2T; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 08/15] scsi: ufs: ufs-exynos: correct timeout value setting registers Date: Wed, 14 Jul 2021 16:11:24 +0900 Message-Id: <20210714071131.101204-9-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Tf0xTVxjdfa+8Prp0PiobdywT8ohsshRoY/FqYLBJ8BlgqRIX48LKE54t WtqmP8hmwtTh5EeFwdyAVUYUAmrVwLBiITgLlSljG38UUXBsTGC1ZhAUNsY25lpel/Hf+e49 557zffdeEpd8R0SShTozZ9SxWpoQCbrcm5A0rXouL9HuBmhw+hKBJpu6CORbvkOguvllHD1p bwtBnhuvoZPd29FQTTOGptttOGq+14WhC6MIDQ93CNGYY0CAGoa/wpD1rpNA5279g6VRjGck k/FUV2HMlfNxTEuvD2M67RUEU9PsAszjmXEBU+2wA2ahcwNT5rJiStE+bbKGYws4YzSny9cX FOrUKXRmjmq7SpGUKJPKtqItdLSOLeJS6PQspTSjUOvvg44uZrUW/5KSNZnohNeTjXqLmYvW 6E3mFJozFGgNMpkh3sQWmSw6dXy+vmibLDFRrvAz87Saiqk7AsMF8r2eBi84ClqFlYAkIbUZ OscslUBESigngOWf+Ai+eALgqYFenC9+B9A1eFlQCUJXFd8vuYOs6wDOtTYJAxsS6jGAbbb9 AUxQUujwPgIBUnjgXHvLhCBQ4NQgDofO9K2ar6f2waYPLQGBgNoIj388QASwmEqFtu6nBO8W Bb9p68MCOJRKg30d84DnhMHBz6dXE+F+TunV06tRIfUtCXub3cGo6XCkpwPweD18dMsh5HEk XJi7TvACK4AfPXga3LgIYMWxLB6nwj/rHSGBoDi1Cbb3JPADi4E3x4O+z8Fy90pwjmJYfkLC C1+Brmv1wQQvQ2vjQghPYeD4Lwf5uZ0CsO+SG6sB0bY13djWdGP73/cMwO3gBc5gKlJzJrlB vvaCO8Hqu47LcIJPZ+fj+wFGgn4ASZwO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waIkznuh62S8kEB6YklqdmpqQWoRTJaJg1OqgUl9 1/qfJdLh8aePGrvtDf3K8qb6z/qCzXuzNx1cpBvxbm2i/OeNwvnf7htst/IQ65ATnNXs91LS 40yeqDH7y3knLR1lDl3f/2Dylmkaj4OusnqcnHslc4mH66yVFVm79jDKLjU7ZWYXFXax9+R6 q2+SsRK1C0PXtWsfydrta1fxVrn/vK3Xg+clhZ91TfuSL59vjbs/odtqmY3GD47nZ/4w6J7M /7UzMsT89/15b2e/7zuXvjNQ4qD3l327mTaGnKx4vkl07q8svp7GJc5W3wRE5vw/qxnDcOuH 02f1CW4WNy+eqHy9p+ohT/mH+mcl+xLW7i/N3WDK2f3Tq59njR3X7ibRyTtXGmXPXaJt6/NM iaU4I9FQi7moOBEA9rv3mhwDAAA= X-CMS-MailID: 20210714071159epcas2p24b7be0cad31af09bc71c608f9b03fe36 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p24b7be0cad31af09bc71c608f9b03fe36 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org PA_PWRMODEUSERDATA0 -> DL_FC0PROTTIMEOUTVAL PA_PWRMODEUSERDATA1 -> DL_TC0REPLAYTIMEOUTVAL PA_PWRMODEUSERDATA2 -> DL_AFC0REQTIMEOUTVAL Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufs-exynos.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 530dab500d11..60edd420095f 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -644,9 +644,9 @@ static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, } /* setting for three timeout values for traffic class #0 */ - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA0), 8064); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA1), 28224); - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA2), 20160); + ufshcd_dme_set(hba, UIC_ARG_MIB(DL_FC0PROTTIMEOUTVAL), 8064); + ufshcd_dme_set(hba, UIC_ARG_MIB(DL_TC0REPLAYTIMEOUTVAL), 28224); + ufshcd_dme_set(hba, UIC_ARG_MIB(DL_AFC0REQTIMEOUTVAL), 20160); return 0; out: From patchwork Wed Jul 14 07:11:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4634FC07E9A for ; Wed, 14 Jul 2021 07:12:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A269613AF for ; Wed, 14 Jul 2021 07:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238242AbhGNHPE (ORCPT ); Wed, 14 Jul 2021 03:15:04 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:11541 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238231AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210714071202epoutp023a1dff618d0c1d2a92918538986a9cda~Rlsc8UjpA2633126331epoutp02x for ; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210714071202epoutp023a1dff618d0c1d2a92918538986a9cda~Rlsc8UjpA2633126331epoutp02x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246722; bh=TzqmxWLzJw7YUlq6RtqJwNn05f8F68Wk3f4J2IILl0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YF7vEHwWuzoroWNWAdxsfy+S5hf/V7MMvt43QAMXvA/Sq7QfXz9C8m9N9JG1w7GNl Ec1QElUp0L+eeekWcIF71RoZBQE/rpv1lQhj+pi78AtKM+pEShvc5Hz00ntUEd1vEE KZdp6BFBVlqC++1sQby6YnrAmU7HBsKhOa9FdV/M= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20210714071202epcas2p4dbfd86dd70a50f1c9e943fbc84832e4c~RlscHFQB82506225062epcas2p4w; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.187]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4GPpbN24Ptz4x9QM; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 8D.3D.09571.04E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p4edc8104aad36d4d7a5bedb8328c0ab39~RlsZ4nEch2508225082epcas2p4h; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp1be28ec233f0bee98cf9d99e459a6f821~RlsZ3casT1240112401epsmtrp1f; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a48-1dfff70000002563-0a-60ee8e40c601 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B6.17.08289.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip2d56655535bfd69647c61476a6409819c~RlsZqL5-U2194721947epsmtip2k; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 09/15] scsi: ufs: ufs-exynos: support custom version of ufs_hba_variant_ops Date: Wed, 14 Jul 2021 16:11:25 +0900 Message-Id: <20210714071131.101204-10-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAJsWRmVeSWpSXmKPExsWy7bCmma5D37sEg74vPBYnn6xhs3gwbxub xcufV9kspn34yWzxaf0yVovL+7UtenY6W5yesIjJ4sn6WcwWi25sY7JYec3C4vz5DewWN7cc ZbGYcX4fk0X39R1sFsuP/2NyEPC4fMXb43JfL5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eHNtdtOj6V/MjHUl13/prN7o9PZEs8vZkUG+zpaGxlut8 cyWW4oxEQy3mouJEAICK4pwdAwAA X-CMS-MailID: 20210714071159epcas2p4edc8104aad36d4d7a5bedb8328c0ab39 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p4edc8104aad36d4d7a5bedb8328c0ab39 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org By default, ufs_hba_exynos_ops will be used but this patch supports to use custom version of ufs_hba_variant_ops because some variants of exynos-ufs will use only few callbacks. Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufs-exynos.c | 8 +++++++- drivers/scsi/ufs/ufs-exynos.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 60edd420095f..90c0d7c85a13 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -1238,8 +1238,14 @@ static int exynos_ufs_probe(struct platform_device *pdev) { int err; struct device *dev = &pdev->dev; + const struct ufs_hba_variant_ops *vops = &ufs_hba_exynos_ops; + const struct exynos_ufs_drv_data *drv_data = + device_get_match_data(dev); - err = ufshcd_pltfrm_init(pdev, &ufs_hba_exynos_ops); + if (drv_data && drv_data->vops) + vops = drv_data->vops; + + err = ufshcd_pltfrm_init(pdev, vops); if (err) dev_err(dev, "ufshcd_pltfrm_init() failed %d\n", err); diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index a46f30639f38..0938bd82763f 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -142,6 +142,7 @@ struct exynos_ufs_uic_attr { }; struct exynos_ufs_drv_data { + const struct ufs_hba_variant_ops *vops; struct exynos_ufs_uic_attr *uic_attr; unsigned int quirks; unsigned int opts; From patchwork Wed Jul 14 07:11:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2DB7C11F6D for ; Wed, 14 Jul 2021 07:12:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C066F613AA for ; Wed, 14 Jul 2021 07:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238214AbhGNHPC (ORCPT ); Wed, 14 Jul 2021 03:15:02 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:31202 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238242AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210714071202epoutp04d2377c8b3d4e5532f814f3b60acb9566~Rlsclf9Eg0784307843epoutp04M for ; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210714071202epoutp04d2377c8b3d4e5532f814f3b60acb9566~Rlsclf9Eg0784307843epoutp04M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246722; bh=rjwJ4dRGZpPwc9QzXTmfR3F2iqx4i1w0LwG82FMYvV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hMjA1ztkSTWWvEbmXa6KZ2GsxadASIoi6vTZPVDHOBkf+PZ+Lw2TAAC1C30oDRWGB YpGjbmmwFaZblaGS6rA3eZ3sHZui5EiBFjmGyNPMtmBWsLHnBWYcwdJ1etLVEaWDhr LiX3pliS36G8ngp4OwmH55b8ureLtYDMfJS+5esk= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210714071201epcas2p3455987b64ea4ba11125098109bfecff2~Rlsb1wLiU2304323043epcas2p3V; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.186]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4GPpbN24PTz4x9Q7; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 7D.3D.09571.04E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p24323976939fa21a5ed44d81649b33d85~RlsZ8YCVP1657016570epcas2p2Y; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp2ea346cb4701f1ec0dc1533ce0e7584d9~RlsZ7ZAxQ0755107551epsmtrp2q; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a48-1f5ff70000002563-0b-60ee8e40f224 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id E5.43.08394.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip2f9a530f2482a2b19f6aab1b9ec280ecc~RlsZvaC4r2465824658epsmtip2p; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 10/15] scsi: ufs: ufs-exynos: add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR option Date: Wed, 14 Jul 2021 16:11:26 +0900 Message-Id: <20210714071131.101204-11-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHJsWRmVeSWpSXmKPExsWy7bCmma5D37sEg12feSxOPlnDZvFg3jY2 i5c/r7JZTPvwk9ni0/plrBaX92tb9Ox0tjg9YRGTxZP1s5gtFt3YxmSx8pqFxfnzG9gtbm45 ymIx4/w+Jovu6zvYLJYf/8fkIOBx+Yq3x+W+XiaPzSu0PBbvecnksWlVJ5vHhEUHGD0+Pr3F 4tG3ZRWjx+dNch7tB7qZAriicmwyUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTy EnNTbZVcfAJ03TJzgP5QUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQXl9gqpRak5BQYGhboFSfm Fpfmpesl5+daGRoYGJkCVSbkZNx/eIC5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J4sn6WcwWi25sY7JYec3C4vz5DewWN7cc ZbGYcX4fk0X39R1sFsuP/2NyEPC4fMXb43JfL5PH5hVaHov3vGTy2LSqk81jwqIDjB4fn95i 8ejbsorR4/MmOY/2A91MAVxRXDYpqTmZZalF+nYJXBn3Hx5gLljBXfH3y3m2Bsb3nF2MnBwS AiYS13uOMnUxcnEICexmlJj85h4bREJW4tm7HewQtrDE/ZYjrBBF7xkl7lzrYQFJsAnoSmx5 /ooRJCEisItR4vCZw+wgDrPAZWaJb9OuMINUCQvES7Sf+s0IYrMIqErM2dcJFOfg4BVwkJja 7wCxQV7i1LKDTCA2J1D44IYPYOVCAvYS/7atBruIV0BQ4uTMJ2CLmYHqm7fOZp7AKDALSWoW ktQCRqZVjJKpBcW56bnFhgWGeanlesWJucWleel6yfm5mxjBsaWluYNx+6oPeocYmTgYDzFK cDArifAuNXqbIMSbklhZlVqUH19UmpNafIhRmoNFSZz3QtfJeCGB9MSS1OzU1ILUIpgsEwen VAPT4tzJHg/iO7ifx6eufTk5cL/U+cwDZ4VilC/OPdLP++vwNZeaGT0r3jAfrjV8qlJiy3B3 /vL7P/b+XlHj95w9e9LbLZUyCUvFphXwJjNmf5vxc6rMzgN93rIpB9aXHZl48qiugZx69Rmj k3MYdLo0rBQTPHu3Llm//eeq81s+vqiqefvw+/Ibz8taP2ar7ig/yb3W//Van7jbXPPFFPuy 9h1T/f793DWeHgGDtXzZO47JT9blSz4qzrI6rfq6bPXmh8b/HNmc2XNK9zv/epYqpfB1ws/v AdfEfXvbnjlHCjY8my945cfCil2x+Q9CmR+4n1717WlM6Je59w7O28EQveW179ItJb1X1i4T tIzQVVFiKc5INNRiLipOBAC3biX5HAMAAA== X-CMS-MailID: 20210714071159epcas2p24323976939fa21a5ed44d81649b33d85 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p24323976939fa21a5ed44d81649b33d85 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To skip exynos_ufs_config_phy_*_attr settings for exynos-ufs variant, this patch provides EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR as an opts flag. Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufs-exynos.c | 6 ++++-- drivers/scsi/ufs/ufs-exynos.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 90c0d7c85a13..9a5a7a5ffc4b 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -831,8 +831,10 @@ static int exynos_ufs_pre_link(struct ufs_hba *hba) /* m-phy */ exynos_ufs_phy_init(ufs); - exynos_ufs_config_phy_time_attr(ufs); - exynos_ufs_config_phy_cap_attr(ufs); + if (!(ufs->opts & EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR)) { + exynos_ufs_config_phy_time_attr(ufs); + exynos_ufs_config_phy_cap_attr(ufs); + } exynos_ufs_setup_clocks(hba, true, POST_CHANGE); diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 0938bd82763f..8695270d38d9 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -200,6 +200,7 @@ struct exynos_ufs { #define EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL BIT(2) #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 for_each_ufs_rx_lane(ufs, i) \ From patchwork Wed Jul 14 07:11:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00442C11F73 for ; Wed, 14 Jul 2021 07:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCB706138C for ; Wed, 14 Jul 2021 07:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238254AbhGNHPG (ORCPT ); Wed, 14 Jul 2021 03:15:06 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:11501 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238260AbhGNHO6 (ORCPT ); Wed, 14 Jul 2021 03:14:58 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210714071202epoutp0265667f8ebfb2ce06603fc72f3fb037fd~RlscZ-da12585925859epoutp02Z for ; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210714071202epoutp0265667f8ebfb2ce06603fc72f3fb037fd~RlscZ-da12585925859epoutp02Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246722; bh=nvto6MAUXII++5Qoedhxm85Le+YYY4cABecM5BXJJzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iojc/z+zYpxuuc6MgQaSxTR7/qZUYe0WGPIf79HRE9guw31GOB3H5Q0wWY59Nk8vj H9QkkT8hzuo0vanlrElEZAvMa2qkGxjvxu5dv7+0YwVFr/IPDhYo3kck+UuAPzIkiI C4/7N8DHWEFhX0v7I8ZhOA1pmffpG3mZfhr673sw= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20210714071201epcas2p129d3d6a7bb09f8b1dc60d66608cfc9c2~Rlsb6zCvB0378503785epcas2p1V; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.189]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4GPpbN24kSz4x9QT; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id AD.3D.09571.04E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p176be9a1310f8de27cfb3786fe86630d6~RlsaCVDse0389603896epcas2p18; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp2acd4da76b5105e118916978531021fef~RlsaBfUJv0755107551epsmtrp2r; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a48-1dfff70000002563-0d-60ee8e409716 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F5.43.08394.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip22a155e625a0f86962bd3e991f057bc5c~RlsZ07cbj1845718457epsmtip2y; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 11/15] scsi: ufs: ufs-exynos: factor out priv data init Date: Wed, 14 Jul 2021 16:11:27 +0900 Message-Id: <20210714071131.101204-12-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPJsWRmVeSWpSXmKPExsWy7bCmqa5D37sEg0X7eC1OPlnDZvFg3jY2 i5c/r7JZTPvwk9ni0/plrBaX92tb9Ox0tjg9YRGTxZP1s5gtFt3YxmSx8pqFxfnzG9gtbm45 ymIx4/w+Jovu6zvYLJYf/8fkIOBx+Yq3x+W+XiaPzSu0PBbvecnksWlVJ5vHhEUHGD0+Pr3F 4tG3ZRWjx+dNch7tB7qZAriicmwyUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTy EnNTbZVcfAJ03TJzgP5QUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQXl9gqpRak5BQYGhboFSfm Fpfmpesl5+daGRoYGJkCVSbkZOy4wF7wg7vi1sqtjA2Mnzm7GDk5JARMJO7197CA2EICOxgl nvandjFyAdmfGCWmr3vCBuF8Y5R4NH8jI0zH+oOt7BCJvYwSd25eZIFwPjJKLDi/HGwWm4Cu xJbnrxhBEiIgc1ctvgtWxSxwklni9IKD7CBVwgJeEm9PzQXrYBFQlVi/7QU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uLVyK2MD42fOLkZODgkB E4n1B1vZuxi5OIQEdjNK/P/UywaRkJV49m4HO4QtLHG/5QgrRNF7RonXL04ygSTYBHQltjx/ xQiSEBHYxShx+MxhsFHMApeZJb5Nu8IMUiUs4CXx9tRcFhCbRUBVYv22F2DdvAIOEr/+H2eF WCEvcWrZQbA4J1D84IYPjCC2kIC9xL9tq9kg6gUlTs58AjaHGai+eets5gmMArOQpGYhSS1g ZFrFKJlaUJybnltsWGCYl1quV5yYW1yal66XnJ+7iREcW1qaOxi3r/qgd4iRiYPxEKMEB7OS CO9So7cJQrwpiZVVqUX58UWlOanFhxilOViUxHkvdJ2MFxJITyxJzU5NLUgtgskycXBKNTBd Y4x7/1FrepS+0pGU9BiNsoijM9JLXF48Ljq67OZhrfWvl4UEzpzbWKtZbtVyguuLx/qJPun8 cz70TE74X2FxeIXhhLLtBYZ83DGue363m6yY4yfHY/jYgNn4LSdza+WTs3cmBWjqRDdPXp4r dHj2885Dj/rsf22KVVf5Jxz8ZEWv2X8H3Tmy3Vfcdt66ue9VgO85nf1ib4+wvQnWLP9YPN+S exurTh2f4ia5n678n/vtMudt+xtsfKdWR83ATva+8Jz9mQarbhfKa15sOLbpzY8aA9nYy/9+ /Q/Lz5tp/t3Oo+Bk00Z25VXFZ2xe+d6Tce/+YBllo8a2Oeb/9yVuh1M3aDw6XaAo5e4w97US S3FGoqEWc1FxIgBHFM/OHAMAAA== X-CMS-MailID: 20210714071159epcas2p176be9a1310f8de27cfb3786fe86630d6 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p176be9a1310f8de27cfb3786fe86630d6 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To be used this assignment code for other variant exynos-ufs driver, this patch factors out the codes as inline code. Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufs-exynos.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 9a5a7a5ffc4b..81b8b8d9915a 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -951,6 +951,18 @@ static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs *ufs) return ret; } +static inline void exynos_ufs_priv_init(struct ufs_hba *hba, + struct exynos_ufs *ufs) +{ + ufs->hba = hba; + ufs->opts = ufs->drv_data->opts; + ufs->rx_sel_idx = PA_MAXDATALANES; + if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX) + ufs->rx_sel_idx = 0; + hba->priv = (void *)ufs; + hba->quirks = ufs->drv_data->quirks; +} + static int exynos_ufs_init(struct ufs_hba *hba) { struct device *dev = hba->dev; @@ -1000,13 +1012,8 @@ static int exynos_ufs_init(struct ufs_hba *hba) if (ret) goto phy_off; - ufs->hba = hba; - ufs->opts = ufs->drv_data->opts; - ufs->rx_sel_idx = PA_MAXDATALANES; - if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX) - ufs->rx_sel_idx = 0; - hba->priv = (void *)ufs; - hba->quirks = ufs->drv_data->quirks; + exynos_ufs_priv_init(hba, ufs); + if (ufs->drv_data->drv_init) { ret = ufs->drv_data->drv_init(dev, ufs); if (ret) { From patchwork Wed Jul 14 07:11:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F9EDC11F67 for ; Wed, 14 Jul 2021 07:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27DE86138C for ; Wed, 14 Jul 2021 07:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238259AbhGNHPH (ORCPT ); Wed, 14 Jul 2021 03:15:07 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21280 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238229AbhGNHO7 (ORCPT ); Wed, 14 Jul 2021 03:14:59 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210714071203epoutp03d7fd2d39d52b67b94393a70750c308a9~RlsdJJfzf1985919859epoutp03e for ; Wed, 14 Jul 2021 07:12:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210714071203epoutp03d7fd2d39d52b67b94393a70750c308a9~RlsdJJfzf1985919859epoutp03e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246723; bh=VaR7GsTXdfN/ttujUGssJkAQBO+Bmj7HAq8hMUH+6Fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGWgTWsmF/VvVmMnVJbSfnrRafDqSZEzVIyOlY17K6s22vpMQkrI9DMfZovwXUDTm HrDjag+3NU9x3FPryhBD4XjRom6sWGVfebL806UhRh28kDGNnQbmtGNk+fLXG67+qv wtJ34ND1itr1U0/g46NaLbOOe7cHUPhCTVhEIwS0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20210714071202epcas2p42e31624eb436f28f5a604e79808c0d5c~Rlscby6QQ2506225062epcas2p4z; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.187]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4GPpbP0xlcz4x9Q1; Wed, 14 Jul 2021 07:12:01 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 63.4D.09571.04E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epcas2p428292c7d0e97533de65d92a029eece93~RlsaHVfYQ2508225082epcas2p4i; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp25bde34baab64b94dffc9d23e5f727942~RlsaGVSR20755107551epsmtrp2s; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a48-789f2a8000002563-10-60ee8e409f90 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 08.43.08394.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip21ff86311a69368dfbdc1fe0bf69ce1e6~RlsZ6I8_72386323863epsmtip2G; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 12/15] scsi: ufs: ufs-exynos: add pre/post_hce_enable drv callbacks Date: Wed, 14 Jul 2021 16:11:28 +0900 Message-Id: <20210714071131.101204-13-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPJsWRmVeSWpSXmKPExsWy7bCmha5D37sEg/MLFS1OPlnDZvFg3jY2 i5c/r7JZTPvwk9ni0/plrBaX92tb9Ox0tjg9YRGTxZP1s5gtFt3YxmSx8pqFxfnzG9gtbm45 ymIx4/w+Jovu6zvYLJYf/8fkIOBx+Yq3x+W+XiaPzSu0PBbvecnksWlVJ5vHhEUHGD0+Pr3F 4tG3ZRWjx+dNch7tB7qZAriicmwyUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTy EnNTbZVcfAJ03TJzgP5QUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQXl9gqpRak5BQYGhboFSfm Fpfmpesl5+daGRoYGJkCVSbkZOy93c9YsIq34vnspewNjDO4uxg5OCQETCTezE/qYuTiEBLY wSjRdn47E4TziVHi89vlzBDON0aJ5mfTgBxOsI7zE/9DVe1llLgw+Q0LhPORUWL7wYNgVWwC uhJbnr9iBEmIgAxetfguWBWzwElmidMLDrKDVAkLREgsuPKUDcRmEVCVWPRuASuIzSvgILFx 6yNWiH3yEqeWHWQCsTmB4gc3fGCEqBGUODnzCQuIzQxU07x1NtR9Fzgk3j3XhrBdJA5sP8kO YQtLvDq+BcqWkvj8bi8byEESAt2MEq2P/kMlVjNKdDb6QNj2Er+mb2EFBROzgKbE+l36kBBT ljhyC2otn0TH4b/sEGFeiY42IYhGdaCt01kgbFmJ7jmfoT7xkDjV8Z4VEliT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bzBEaBWUhSs5Ck FjAyrWKUTC0ozk3PLTYsMMxLLdcrTswtLs1L10vOz93ECI4uLc0djNtXfdA7xMjEwXiIUYKD WUmEd6nR2wQh3pTEyqrUovz4otKc1OJDjNIcLErivBe6TsYLCaQnlqRmp6YWpBbBZJk4OKUa mI5wrQ9e3up8lzO2vCT10wa9n/Es14J/nk7I33Ajc2v9I3mfiVl132RCTr3/4nqnK2nLxH1z Lt40alg7N8nkfWTU3i+C6x0TN27jZeVhjT8robPlTE6scSZbMsurPh7G368/78yRnvyrUXNX XYGTT2n5p96/HOe3h/berOWtvfrCtztog5jSOaZ/C/c/Pnjf0/3W5q+XZL4k7hIxUbnJmHnu ucplp4YD19Re5whHni6VCFiT5ZxUueadVszS3YGcNSwbt839rTvx9GKZjDKLP1+kZ/w76/Y5 9Igq95Vp/9JkL11hXPH5DIuV58TnEUr70i9me1deZ5Lokp//57rgHIl7QVPaTUvvllQYxBsx xCixFGckGmoxFxUnAgDRqKARHQMAAA== X-CMS-MailID: 20210714071159epcas2p428292c7d0e97533de65d92a029eece93 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071159epcas2p428292c7d0e97533de65d92a029eece93 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds driver-specific pre/post_hce_enable callbacks to execute extra initializations before and after hce_enable_notify callback. Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufs-exynos.c | 10 ++++++++++ drivers/scsi/ufs/ufs-exynos.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 81b8b8d9915a..9669afe8f1f4 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -1141,6 +1141,12 @@ static int exynos_ufs_hce_enable_notify(struct ufs_hba *hba, switch (status) { case PRE_CHANGE: + if (ufs->drv_data->pre_hce_enable) { + ret = ufs->drv_data->pre_hce_enable(ufs); + if (ret) + return ret; + } + ret = exynos_ufs_host_reset(hba); if (ret) return ret; @@ -1150,6 +1156,10 @@ static int exynos_ufs_hce_enable_notify(struct ufs_hba *hba, exynos_ufs_calc_pwm_clk_div(ufs); if (!(ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL)) exynos_ufs_enable_auto_ctrl_hcc(ufs); + + if (ufs->drv_data->post_hce_enable) + ret = ufs->drv_data->post_hce_enable(ufs); + break; } diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 8695270d38d9..9c44ca81020b 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -154,6 +154,8 @@ struct exynos_ufs_drv_data { struct ufs_pa_layer_attr *pwr); int (*post_pwr_change)(struct exynos_ufs *ufs, struct ufs_pa_layer_attr *pwr); + int (*pre_hce_enable)(struct exynos_ufs *ufs); + int (*post_hce_enable)(struct exynos_ufs *ufs); }; struct ufs_phy_time_cfg { From patchwork Wed Jul 14 07:11:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 126DDC11F77 for ; Wed, 14 Jul 2021 07:12:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC05A613AA for ; Wed, 14 Jul 2021 07:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238215AbhGNHPI (ORCPT ); Wed, 14 Jul 2021 03:15:08 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21284 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238230AbhGNHO7 (ORCPT ); Wed, 14 Jul 2021 03:14:59 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210714071204epoutp03e5a8a587e31888ffdffd1e28980cd59c~RlsedRMqP1952519525epoutp03_ for ; Wed, 14 Jul 2021 07:12:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210714071204epoutp03e5a8a587e31888ffdffd1e28980cd59c~RlsedRMqP1952519525epoutp03_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246724; bh=MmUgXvX/NpKO8lAywWMapzDS9Zdw8SpjRt0eU0Szou0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RhuGF2R2yO9zU9zGLoFiwkNCK44Ec4f1XZLSJFaNuQB4/2H159YD8+7GF1Ov5Hz4B 2Pt8ed2h1hcT7tUS5xdb+iH1EOl3H+pmuqzm+H2h9QrkEquQjndZ8+vUQ8AuQSXn4U oX0r+qw2ms1pdZAslFYojEUpVfEQWSIw5j1pjDIg= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210714071203epcas2p3ede78124bb1b8c601e646ae21207008d~RlsdxprqL2479924799epcas2p3F; Wed, 14 Jul 2021 07:12:03 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.183]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4GPpbN3vHyz4x9Q7; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 46.42.09921.04E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20210714071200epcas2p199f4f7b209e565c9a87440af319acda1~RlsaPPMf00378503785epcas2p1P; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210714071159epsmtrp132b31cd8928bc18899726060bb517692~RlsaLue9v1252112521epsmtrp1K; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) X-AuditID: b6c32a45-fb3ff700000026c1-0f-60ee8e405c13 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 18.43.08394.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip256806448f4e384e6ef7dcc09e6b467f7~RlsZ-Wbhq1845718457epsmtip2z; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 13/15] scsi: ufs: ufs-exynos: support exynosauto v9 ufs driver Date: Wed, 14 Jul 2021 16:11:29 +0900 Message-Id: <20210714071131.101204-14-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xbVRzHc+69tBe05q4gntVXd41uwxTauuIFKZCwx3XgQtwfG5jZ1nJH G0vb9YHvOB5uQDfAEbcJjFS6lYkzIKsMjNuguBQsExIcMAwZICqFbAOGIoWBLbeL/Pf5Pb7n m9/vnIOj/D6OANfqLYxJr9KRnAistWu7TJRafk8pHhoSUD2TlzjUWF0rh/It3eJQp2eXUGq+ yRlGDVx/mTrRnkZ5K+sRarKpGqXqh1sR6utBiurra+ZSt103MOps3zWEsg21cagGzyqSStAD v6bTA+UnEfryxRja8aMPoVsaSzl0ZX0HoOf+GMHoclcjoB+0PEcf77AhmRHZuiQNo8phTEJG rzbkaPW5cjJ9vyJNIYsXS0SSBOpVUqhX5TFycmdGpmi3VheYgxTmq3TWQCpTZTaTcclJJoPV wgg1BrNFTjLGHJ1RIjHGmlV5Zqs+N1ZtyEuUiMVSWaBTqdMUVM6jxuKY94+7U46CNbIMhOOQ 2AEvnipEykAEzifaALxw04mxwTyAtpPFHDb4B8De88PoI8mSZygkuQpge2E3N1jgE3MArtUc CDKHEEHXX9Mg2BQVPLfRMbp+Lkr0oNBr71xXRBL74Vf9y5wgY8SL8NvCqXULHpEK/WOFIbvn 4c/OTiTI4YF8Z/MsYHs2wZ4vJ7Ego4Geou9r0KABJHpxeH/qDsKKd0LPn6tcliPhtMcVYgH0 VRzjsgIbgJ9NrIUK3wBYWpDBcgr0n3GFlQE84LAdNv0QF0RIvAB/Ggn5PgFLuh5y2TQPlhzj s8KtsOPKGYzlZ6Gt9kEYyzR0OTyh/VYBeGmqDakEwuoN41RvGKf6f2M7QBtBNGM05+UyZqlR svGKW8D6y47Z1Qaq7s7GugGCAzeAOEpG8S5I7y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nliSmp2aWpBaBJNl4uCUamDS 8bHeLbvo98vKWNk6++3uYds68t9YBB2M9mHUYq2c9LN7593v/HzsYcd3q9zzuLbq6RzvKZKr FAuvRf7TO7ysrMV9l6igqfXLE7NLhcyTn+zd/KnbfG5CPWv+ohfafNwbjjfEsfee3/71lH+D gQt78nGD2rRXgSUnPlyL5wx7FOByqnJ+sPXDdeVfTjDFb82798oobObK6X8nxrO73OJd0rNb zv21t4lyyk0Dn0wJXT79xpcPtA0Wz8q9c2XO5pTWL9/jFhzrf6BUqMTx86uyvJr6LPfPeZtV tA8sKpiUz6S67UzdpYTjlxrVo+5JT/i4NXuVxtKLoqEOnDcOHVBr27+gPyuAKfeN8LQTlguU WIozEg21mIuKEwGtCctcHAMAAA== X-CMS-MailID: 20210714071200epcas2p199f4f7b209e565c9a87440af319acda1 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071200epcas2p199f4f7b209e565c9a87440af319acda1 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds to support ufs variant for ExynosAuto v9 SoC. This requires control UFS IP sharability register via syscon and regmap. Regarding uic_attr, most of values can be shared with exynos7 except tx_dif_p_nsec value. Signed-off-by: Chanho Park --- .../bindings/ufs/samsung,exynos-ufs.yaml | 1 + drivers/scsi/ufs/ufs-exynos.c | 96 +++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml index d3e31b23b62d..fa5247c4a44f 100644 --- a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml +++ b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml @@ -20,6 +20,7 @@ properties: compatible: enum: - samsung,exynos7-ufs + - samsung,exynosautov9-ufs reg: items: diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 9669afe8f1f4..200137e6ecce 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "ufshcd.h" #include "ufshcd-pltfrm.h" @@ -76,6 +77,12 @@ UIC_TRANSPORT_NO_CONNECTION_RX |\ UIC_TRANSPORT_BAD_TC) +/* FSYS UFS Shareability */ +#define UFS_WR_SHARABLE BIT(2) +#define UFS_RD_SHARABLE BIT(1) +#define UFS_SHARABLE (UFS_WR_SHARABLE | UFS_RD_SHARABLE) +#define UFS_SHAREABILITY_OFFSET 0x710 + enum { UNIPRO_L1_5 = 0,/* PHY Adapter */ UNIPRO_L2, /* Data Link */ @@ -151,6 +158,79 @@ 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) +{ + struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; + + /* IO Coherency setting */ + if (ufs->sysreg) { + return regmap_update_bits(ufs->sysreg, UFS_SHAREABILITY_OFFSET, + UFS_SHARABLE, UFS_SHARABLE); + } + + attr->tx_dif_p_nsec = 3200000; + + return 0; +} + +static int exynosauto_ufs_pre_link(struct exynos_ufs *ufs) +{ + struct ufs_hba *hba = ufs->hba; + int i; + + ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x40); + for_each_ufs_rx_lane(ufs, i) { + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x12, i), + DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x11, i), 0x0); + + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x1b, i), 0x2); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x1c, i), 0x8a); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x1d, i), 0xa3); + + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x1b, i), 0x2); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x1c, i), 0x8a); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x1d, i), 0xa3); + + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x2f, i), 0x79); + 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(0xaa, i), + DIV_ROUND_UP(NSEC_PER_SEC, ufs->mclk_rate)); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xa9, i), 0x02); + + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xab, i), 0x8); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xac, i), 0x22); + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xad, i), 0x8); + + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x04, i), 0x1); + } + + 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(0xa011), 0x8000); + + return 0; +} + +static int exynosauto_ufs_pre_pwr_change(struct exynos_ufs *ufs, + struct ufs_pa_layer_attr *pwr) +{ + struct ufs_hba *hba = ufs->hba; + + /* PACP_PWR_req and delivered to the remote DME */ + 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); + + return 0; +} + static int exynos7_ufs_pre_link(struct exynos_ufs *ufs) { struct ufs_hba *hba = ufs->hba; @@ -1305,6 +1385,20 @@ static struct exynos_ufs_uic_attr exynos7_uic_attr = { .pa_dbg_option_suite = 0x30103, }; +static struct exynos_ufs_drv_data exynosauto_ufs_drvs = { + .uic_attr = &exynos7_uic_attr, + .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | + UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR | + UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR | + 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_BROKEN_RX_SEL_IDX, + .drv_init = exynosauto_ufs_drv_init, + .pre_link = exynosauto_ufs_pre_link, + .pre_pwr_change = exynosauto_ufs_pre_pwr_change, +}; + static struct exynos_ufs_drv_data exynos_ufs_drvs = { .uic_attr = &exynos7_uic_attr, .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | @@ -1330,6 +1424,8 @@ static struct exynos_ufs_drv_data exynos_ufs_drvs = { static const struct of_device_id exynos_ufs_of_match[] = { { .compatible = "samsung,exynos7-ufs", .data = &exynos_ufs_drvs }, + { .compatible = "samsung,exynosautov9-ufs", + .data = &exynosauto_ufs_drvs }, {}, }; From patchwork Wed Jul 14 07:11:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD614C07E9C for ; Wed, 14 Jul 2021 07:12:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 92AB2613AA for ; Wed, 14 Jul 2021 07:12:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238229AbhGNHPO (ORCPT ); Wed, 14 Jul 2021 03:15:14 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:31536 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238264AbhGNHPA (ORCPT ); Wed, 14 Jul 2021 03:15:00 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210714071203epoutp040df9a046124cfb324881f56f0f5ba3cc~RlsdqMnEt0948109481epoutp04L for ; Wed, 14 Jul 2021 07:12:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210714071203epoutp040df9a046124cfb324881f56f0f5ba3cc~RlsdqMnEt0948109481epoutp04L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246723; bh=eEXKyWquYO93I+OzTLmzLBjuVcLUnA3wC2j+ojcvVPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lARgPA57FmwzRo7vYU3gLV4ERslI2kgA505NYVjHfBu1oHIJ/diJz68cYuPED0RMS T9ixNfDxzMjBXYgaymMeemJYJj6KaakZyEeGyTWgX3em7qRgOrZVifPdAVEWYggKbp COKqN42sl1p5aQuihmX4XQe/N5DdxJ0S8mO+kJQo= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210714071202epcas2p3fd292ed4e618ede3de2f33065d221ba2~Rlsc8MhMF2304323043epcas2p3k; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.186]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4GPpbN3z7xz4x9QR; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 56.42.09921.04E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20210714071200epcas2p3f76e68f6bbb4755574dba2055a8130ab~RlsaR7BUu2291022910epcas2p3M; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210714071200epsmtrp15ea9759ede4c81f84f7e2bc98eb566ff~RlsaQxRI41240112401epsmtrp1h; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) X-AuditID: b6c32a45-f9dff700000026c1-10-60ee8e40513b Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 18.17.08289.F3E8EE06; Wed, 14 Jul 2021 16:11:59 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip2056e1c26ec925e301ce4fcb97ea6a3ed~RlsaEMaC12386723867epsmtip2p; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 14/15] scsi: ufs: ufs-exynos: multi-host configuration for exynosauto Date: Wed, 14 Jul 2021 16:11:30 +0900 Message-Id: <20210714071131.101204-15-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAJsWRmVeSWpSXmKPExsWy7bCmqa5D37sEg53LpS1OPlnDZvFg3jY2 i5c/r7JZTPvwk9ni0/plrBaX92tb9Ox0tjg9YRGTxZP1s5gtFt3YxmSx8pqFxfnzG9gtbm45 ymIx4/w+Jovu6zvYLJYf/8fkIOBx+Yq3x+W+XiaPzSu0PBbvecnksWlVJ5vHhEUHGD0+Pr3F 4tG3ZRWjx+dNch7tB7qZAriicmwyUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTy EnNTbZVcfAJ03TJzgP5QUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQXl9gqpRak5BQYGhboFSfm Fpfmpesl5+daGRoYGJkCVSbkZGz9+ZGp4J1cxZcH09gaGPdLdjFyckgImEic2LmXHcQWEtjB KHHnl2EXIxeQ/YlR4sGvTcwQzmdGib3rjzPCdFz4tYwdIrGLUWLW7FlQzkdGid1XjrCCVLEJ 6Epsef6KESQhAjJ31eK7LCAOs8BJZonTCw6CbRQWiJK4sfEnM4jNIqAqsWpfKxOIzSvgINF0 5j4LxD55iVPLDoLFOYHiBzd8YISoEZQ4OfMJWA0zUE3z1tlgx0oInOGQeLalgQmi2UVixpup zBC2sMSr41vYIWwpiZf9bewQDd2MEq2P/kMlVjNKdDb6QNj2Er+mbwH6hwNog6bE+l36IKaE gLLEkVtQe/kkOg7/ZYcI80p0tAlBNKpLHNg+Hep8WYnuOZ9ZIWwPiXWL+qGhNZlR4ubSWSwT GBVmIXlnFpJ3ZiEsXsDIvIpRLL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YW1yal66XnJ+7iREcXVpaOxj3rPqgd4iRiYPxEKMEB7OS CO9So7cJQrwpiZVVqUX58UWlOanFhxilOViUxHkvdJ2MFxJITyxJzU5NLUgtgskycXBKNTDF Pl1yu8vn32uNbUbLLHl1ZbgXHN6od/NNypH5Mm4TzpgWRZ+bbyDvzH/S60vhlCRLq2WcT97v M5WJ/h4yvXHP//+bl5VZHps2edZ1qVytjHUWW87daZkvleo+NV36x4unQb8s32f+eMD0a7Wd v9Cx/x4bmX/+yfQ5fyuKj2O5JPOdI1JPXP93ndjy/qnDx1tyVr7Z1hJe176Ea/RY7roRc8Jq Iud84cY/2kcbE58+2rDIIvlseeHFla1RAZJSkktnrtlTzPQj6/bBg+KGep3OK9S8df6yOz7l +tf9+uvJhU8s1ZLU2nQ4Z3Kvz7mxj3/C/t4FnB1f9t3cMLX0Q7Ryx4sq7oe8Vzbuzu+Ij7nT rsRSnJFoqMVcVJwIANA4DDodAwAA X-CMS-MailID: 20210714071200epcas2p3f76e68f6bbb4755574dba2055a8130ab X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071200epcas2p3f76e68f6bbb4755574dba2055a8130ab References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org UFS controller of ExynosAuto v9 SoC supports multi-host interface for I/O virtualization. In general, we're using para-virtualized driver to support a block device by several virtual machines. However, it should be relayed by backend driver. Multi-host functionality extends the host controller by providing register interfaces that can be used by each VM's ufs drivers respectively. By this, we can provide direct access to the UFS device for multiple VMs. It's similar with SR-IOV of PCIe. We divide this M-HCI as PH(Physical Host) and VHs(Virtual Host). The PH supports all UFSHCI functions(all SAPs) same as conventional UFSHCI but the VH only supports data transfer function. Thus, except UTP_CMD_SAP and UTP_TMPSAP, the PH should handle all the physical features. This patch provides an initial implementation of PH part. M-HCI can support up to four interfaces but this patch initially supports only 1 PH and 1 VH. For this, we uses TASK_TAG[7:5] field so TASK_TAG[4:0] for 32 doorbel will be supported. After the PH is initiated, this will send a ready message to VHs through a mailbox register. The message handler is not fully implemented yet such as supporting reset / abort cases. Signed-off-by: Chanho Park --- drivers/scsi/ufs/ufs-exynos.c | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 200137e6ecce..5b293a4ac6ea 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -83,6 +83,21 @@ #define UFS_SHARABLE (UFS_WR_SHARABLE | UFS_RD_SHARABLE) #define UFS_SHAREABILITY_OFFSET 0x710 +/* Multi-host registers */ +#define MHCTRL 0xC4 +#define MHCTRL_EN_VH_MASK (0xE) +#define MHCTRL_EN_VH(vh) (vh << 1) +#define PH2VH_MBOX 0xD8 + +#define MH_MSG_MASK (0xFF) + +#define MH_MSG(id, msg) ((id << 8) | (msg & 0xFF)) +#define MH_MSG_PH_READY 0x1 +#define MH_MSG_VH_READY 0x2 + +#define HCI_MH_ALLOWABLE_TRAN_OF_VH 0x30C +#define HCI_MH_IID_IN_TASK_TAG 0X308 + enum { UNIPRO_L1_5 = 0,/* PHY Adapter */ UNIPRO_L2, /* Data Link */ @@ -173,6 +188,20 @@ static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) return 0; } +static int exynosauto_ufs_post_hce_enable(struct exynos_ufs *ufs) +{ + struct ufs_hba *hba = ufs->hba; + + /* Enable Virtual Host #1 */ + ufshcd_rmwl(hba, MHCTRL_EN_VH_MASK, MHCTRL_EN_VH(1), MHCTRL); + /* Default VH Transfer permissions */ + hci_writel(ufs, 0x03FFE1FE, HCI_MH_ALLOWABLE_TRAN_OF_VH); + /* IID information is replaced in TASKTAG[7:5] instead of IID in UCD */ + hci_writel(ufs, 0x1, HCI_MH_IID_IN_TASK_TAG); + + return 0; +} + static int exynosauto_ufs_pre_link(struct exynos_ufs *ufs) { struct ufs_hba *hba = ufs->hba; @@ -231,6 +260,20 @@ static int exynosauto_ufs_pre_pwr_change(struct exynos_ufs *ufs, return 0; } +static int exynosauto_ufs_post_pwr_change(struct exynos_ufs *ufs, + struct ufs_pa_layer_attr *pwr) +{ + struct ufs_hba *hba = ufs->hba; + u32 enabled_vh; + + enabled_vh = ufshcd_readl(hba, MHCTRL) & MHCTRL_EN_VH_MASK; + + /* Send physical host ready message to virtual hosts */ + ufshcd_writel(hba, MH_MSG(enabled_vh, MH_MSG_PH_READY), PH2VH_MBOX); + + return 0; +} + static int exynos7_ufs_pre_link(struct exynos_ufs *ufs) { struct ufs_hba *hba = ufs->hba; @@ -1395,8 +1438,10 @@ static struct exynos_ufs_drv_data exynosauto_ufs_drvs = { EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX, .drv_init = exynosauto_ufs_drv_init, + .post_hce_enable = exynosauto_ufs_post_hce_enable, .pre_link = exynosauto_ufs_pre_link, .pre_pwr_change = exynosauto_ufs_pre_pwr_change, + .post_pwr_change = exynosauto_ufs_post_pwr_change, }; static struct exynos_ufs_drv_data exynos_ufs_drvs = { From patchwork Wed Jul 14 07:11:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12376167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8ACDC11F67 for ; Wed, 14 Jul 2021 07:12:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5A9B6138C for ; Wed, 14 Jul 2021 07:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238237AbhGNHPR (ORCPT ); Wed, 14 Jul 2021 03:15:17 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:31548 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238272AbhGNHPA (ORCPT ); Wed, 14 Jul 2021 03:15:00 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210714071205epoutp048ff526133955f000de066b64c057fcb0~Rlsfksupr0942509425epoutp04V for ; Wed, 14 Jul 2021 07:12:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210714071205epoutp048ff526133955f000de066b64c057fcb0~Rlsfksupr0942509425epoutp04V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1626246725; bh=stJk41kM7OMhlXJlN10udW/YreVjbMV+Qbw3QGqr63o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k/aUtACIJnMX99bH4/sekatu62F2VQKtoPzl2y0y2eVvG8gUhyDo4SVPB2NcQfzM7 73eseawmxTvAfnQHxZhZt5fJHawBm49IzRI5Nb5s1PM4MaagSvmfZLbQpygeyo1Vce v7PDmva6Fn0+PdWYY/S0/SAkT/ve+LbnlnIyt6g8= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20210714071205epcas2p4417cb516fd55456366fc28a1129f3d70~Rlse-dNN62508225082epcas2p44; Wed, 14 Jul 2021 07:12:05 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.189]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4GPpbQ0L4Nz4x9Q7; Wed, 14 Jul 2021 07:12:02 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id D3.BF.09541.04E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20210714071200epcas2p413ca643dc459ee75ec7e5e4f8a6c05d7~RlsaWtfrl2508225082epcas2p4j; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210714071200epsmtrp2fc436150d4e963483f113e77fe096f35~RlsaVeqvf0755107551epsmtrp2t; Wed, 14 Jul 2021 07:12:00 +0000 (GMT) X-AuditID: b6c32a46-0abff70000002545-f8-60ee8e4086d0 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 28.17.08289.F3E8EE06; Wed, 14 Jul 2021 16:12:00 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210714071159epsmtip22f6575a10d01c8fef7499dc5233f7349~RlsaJCI_R2336023360epsmtip2c; Wed, 14 Jul 2021 07:11:59 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Alim Akhtar , "James E . J . Bottomley" , "Martin K . Petersen" Cc: Can Guo , Jaegeuk Kim , Kiwoong Kim , Avri Altman , Adrian Hunter , Christoph Hellwig , Bart Van Assche , jongmin jeong , Gyunghoon Kwon , linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, Chanho Park Subject: [PATCH v2 15/15] scsi: ufs: ufs-exynos: introduce exynosauto v9 virtual host Date: Wed, 14 Jul 2021 16:11:31 +0900 Message-Id: <20210714071131.101204-16-chanho61.park@samsung.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210714071131.101204-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAJsWRmVeSWpSXmKPExsWy7bCmma5D37sEg8n7lC1OPlnDZvFg3jY2 i5c/r7JZTPvwk9ni0/plrBaX92tb9Ox0tjg9YRGTxZP1s5gtFt3YxmSx8pqFxfnzG9gtbm45 ymIx4/w+Jovu6zvYLJYf/8fkIOBx+Yq3x+W+XiaPzSu0PBbvecnksWlVJ5vHhEUHGD0+Pr3F 4tG3ZRWjx+dNch7tB7qZAriicmwyUhNTUosUUvOS81My89JtlbyD453jTc0MDHUNLS3MlRTy EnNTbZVcfAJ03TJzgP5QUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQXl9gqpRak5BQYGhboFSfm Fpfmpesl5+daGRoYGJkCVSbkZFzoW8Ve8Fal4vaiU4wNjL1yXYwcHBICJhIbD+V0MXJxCAns YJSYsvIiG4TziVHi/b91TBDOZ6DM13fMXYycEB0Nk9khErsYJXY2bGeGcD4ySvxvOQ9WxSag K7Hl+StGkIQIyOBVi++ygDjMAieZJU4vOMgOUiUsEC5x4HQbWAeLgKrE2ge72UBsXgEHib/v VzJC7JOXOLXsIBOIzQkUP7jhAyNEjaDEyZlPWEBsZqCa5q2zwc6QEDjDIdHVshWq2UXiw/ld 7BC2sMSr41ugbCmJz+/2skE0dDNKtD76D5VYzSjR2egDYdtL/Jq+hRUUTswCmhLrd+lDgkxZ 4sgtqL18Eh2H/7JDhHklOtqEIBrVJQ5sn84CYctKdM/5zAphe0i829cNDa3JwEA5tJ15AqPC LCTvzELyziyExQsYmVcxiqUWFOempxYbFRghx/EmRnDS1nLbwTjl7Qe9Q4xMHIyHGCU4mJVE eJcavU0Q4k1JrKx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mVWpQfX1Sak1p8iFGag0VJnPdC18l4IYH0xJLU7NTUgtQimCwTB6dUA5N+ nNDT6zZbtrR5ie7O3JVr/cztucfdlFkGR75flPdPM2Fz7dnh8tC0OC0t4aMnQ0/k86UXa9br fb9y8oD7tVOveF4kr9/lHfV4q0+YR9FrZrX7JiLzfvka69kkyYcJbtvKaNIo321yMS6J611N 3Oqzzx3TvjLoF9T8bvcX0V/xzvO+37EglaY1x2dL3ZnoWMUmviN65UfP6XL9vPvbGNn9jpyN 4op//ttm9bJzZQb7ppYwXVCZ3PGjP37D7MOuRhsF3Q5knr8YYRFcqXlZQuGaw9asxd/2rW2/ 6rGq+jtHmbnnt79Ld194+CWyQCHydjSTUvTalVsSd/7UyBdavM/ulbi+uk3Prm01MfvqHyix FGckGmoxFxUnAgDVCJihHQMAAA== X-CMS-MailID: 20210714071200epcas2p413ca643dc459ee75ec7e5e4f8a6c05d7 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210714071200epcas2p413ca643dc459ee75ec7e5e4f8a6c05d7 References: <20210714071131.101204-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch introduces virtual host driver of exynosauto v9 ufs mHCI. VH(Virtual Host) only supports data transfer functions. So, most of physical features are broken. So, we need to set below quirks. - UFSHCD_QUIRK_BROKEN_UIC_CMD - UFSHCD_QUIRK_SKIP_PH_CONFIGURATION Before initialization, the VH is necessary to wait until PH is ready. It's implemented as polling at the moment. Signed-off-by: Chanho Park --- .../bindings/ufs/samsung,exynos-ufs.yaml | 1 + drivers/scsi/ufs/ufs-exynos.c | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml index fa5247c4a44f..9bd9ddc34791 100644 --- a/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml +++ b/Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml @@ -21,6 +21,7 @@ properties: enum: - samsung,exynos7-ufs - samsung,exynosautov9-ufs + - samsung,exynosautov9-ufs-vh reg: items: diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 5b293a4ac6ea..c277e1feded1 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -98,6 +98,8 @@ #define HCI_MH_ALLOWABLE_TRAN_OF_VH 0x30C #define HCI_MH_IID_IN_TASK_TAG 0X308 +#define PH_READY_TIMEOUT_MS (5 * MSEC_PER_SEC) + enum { UNIPRO_L1_5 = 0,/* PHY Adapter */ UNIPRO_L2, /* Data Link */ @@ -1362,6 +1364,68 @@ static int exynos_ufs_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) return 0; } +static int exynosauto_ufs_vh_link_startup_notify(struct ufs_hba *hba, + enum ufs_notify_change_status status) +{ + if (status == POST_CHANGE) { + ufshcd_set_link_active(hba); + ufshcd_set_ufs_dev_active(hba); + hba->wlun_dev_clr_ua = true; + } + + return 0; +} + +static int exynosauto_ufs_vh_wait_ph_ready(struct ufs_hba *hba) +{ + u32 mbox; + ktime_t start, stop; + + start = ktime_get(); + stop = ktime_add(start, ms_to_ktime(PH_READY_TIMEOUT_MS)); + + do { + mbox = ufshcd_readl(hba, PH2VH_MBOX); + if ((mbox & MH_MSG_MASK) == MH_MSG_PH_READY) + return 0; + + usleep_range(40, 50); + } while (ktime_before(ktime_get(), stop)); + + return -ETIME; +} + +static int exynosauto_ufs_vh_init(struct ufs_hba *hba) +{ + struct device *dev = hba->dev; + struct platform_device *pdev = to_platform_device(dev); + struct exynos_ufs *ufs; + int ret; + + ufs = devm_kzalloc(dev, sizeof(*ufs), GFP_KERNEL); + if (!ufs) + return -ENOMEM; + + /* exynos-specific hci */ + ufs->reg_hci = devm_platform_ioremap_resource_byname(pdev, "vs_hci"); + if (IS_ERR(ufs->reg_hci)) { + dev_err(dev, "cannot ioremap for hci vendor register\n"); + return PTR_ERR(ufs->reg_hci); + } + + ret = exynosauto_ufs_vh_wait_ph_ready(hba); + if (ret) + return ret; + + ufs->drv_data = device_get_match_data(dev); + if (!ufs->drv_data) + return -ENODEV; + + exynos_ufs_priv_init(hba, ufs); + + return 0; +} + static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .name = "exynos_ufs", .init = exynos_ufs_init, @@ -1376,6 +1440,12 @@ static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .resume = exynos_ufs_resume, }; +static struct ufs_hba_variant_ops ufs_hba_exynosauto_vh_ops = { + .name = "exynosauto_ufs_vh", + .init = exynosauto_ufs_vh_init, + .link_startup_notify = exynosauto_ufs_vh_link_startup_notify, +}; + static int exynos_ufs_probe(struct platform_device *pdev) { int err; @@ -1444,6 +1514,18 @@ static struct exynos_ufs_drv_data exynosauto_ufs_drvs = { .post_pwr_change = exynosauto_ufs_post_pwr_change, }; +static struct exynos_ufs_drv_data exynosauto_ufs_vh_drvs = { + .vops = &ufs_hba_exynosauto_vh_ops, + .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | + UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR | + UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR | + UFSHCI_QUIRK_BROKEN_HCE | + UFSHCD_QUIRK_BROKEN_UIC_CMD | + UFSHCD_QUIRK_SKIP_PH_CONFIGURATION | + UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING, + .opts = EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX, +}; + static struct exynos_ufs_drv_data exynos_ufs_drvs = { .uic_attr = &exynos7_uic_attr, .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | @@ -1471,6 +1553,8 @@ static const struct of_device_id exynos_ufs_of_match[] = { .data = &exynos_ufs_drvs }, { .compatible = "samsung,exynosautov9-ufs", .data = &exynosauto_ufs_drvs }, + { .compatible = "samsung,exynosautov9-ufs-vh", + .data = &exynosauto_ufs_vh_drvs }, {}, };