Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2265431iof; Wed, 8 Jun 2022 00:52:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiPAAnLqK9bDRECWbxf6G+isOKvslEXOxDx7mtbfWkoJsjHm12yKei+1WJsB9LmR5kqblH X-Received: by 2002:a62:ed0e:0:b0:4fa:11ed:2ad1 with SMTP id u14-20020a62ed0e000000b004fa11ed2ad1mr33644229pfh.34.1654674764140; Wed, 08 Jun 2022 00:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654674764; cv=none; d=google.com; s=arc-20160816; b=l68+PTPSqODlVL5TbdYmByI5EsFLR7Jj2R2pRoPuXde+iEo3n0bsiCZdqkyr68pnhW qGVIr/Iae+KI/x83jZtjKhwgEDOoOMO0dZ7jJ63Bhea4Dn2JsJnu0/33sz0GyH/zfXVT mdNbxEvRYDj3YpAQrw2yeAFsdl3S4cck4uX+WXbH9JA3B5L9VIJX7FIy+CUZOsmH2MPY jhRVd9cen+dgVrP+CPi9Ga/dqS+y+s5E9nmCrpgqGVDAue9QPVGlp8nw7hEYew6pa13I EUmz2Z4vIEtnJa3mffsBXyywIWj+92jCUUHiM67OcQRrL7OdVBjEUPZz86Owf7fxC1yM V7FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:thread-index :content-language:content-transfer-encoding:mime-version:message-id :date:subject:in-reply-to:cc:to:from:dkim-signature:dkim-filter; bh=YsxxJh3jyxEwSbPFZB5N8FabmeSNHiS+F1nRFzSyN/c=; b=hSs/+uuANE1BwRUsPR80ERQ6kKUuF24bjPecNoU9A+MeuhgUuMouGtW5nHMD99FyX4 tEGOyfjyG5Z5C3Cn2nneRzpSWd04vscJOVzgvsjLB5ZBBg4kMZFUDrvWxrWvQbeJxV1E 73y+cZJkEcU/LOaPFUIQhas/P2DLLjt+isBna9pcVzHWM4YJ3r/13Tmiv2a7uIvhHCLH ezA9y6KAgtd1/1agZbE5RT0KpPk2yc4cs6koJZMLL1KRpCs1BwRnisXCDOy2xuB/AUxv RGZR3C/U5mNdVG2cKb6JIxGragekY5jwsXw74jMNgkseWeset8WDJUuACffLs2/e9dUO Wadw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=fW9UXTlL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a17090302c700b00163ed1483a6si25331663plk.428.2022.06.08.00.52.31; Wed, 08 Jun 2022 00:52:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=fW9UXTlL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232181AbiFHEn4 (ORCPT + 99 others); Wed, 8 Jun 2022 00:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbiFHEhe (ORCPT ); Wed, 8 Jun 2022 00:37:34 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 404903E1C57 for ; Tue, 7 Jun 2022 19:24:44 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220608021709epoutp032aaf92c72955ad5ffe20110775444b2a~2g55SaGEj3201432014epoutp03P for ; Wed, 8 Jun 2022 02:17:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220608021709epoutp032aaf92c72955ad5ffe20110775444b2a~2g55SaGEj3201432014epoutp03P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1654654629; bh=YsxxJh3jyxEwSbPFZB5N8FabmeSNHiS+F1nRFzSyN/c=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=fW9UXTlLsOx8CUmrvk68VjC0AF/JfQQtNLvLmmmNw4QGf4m4IED4ZK83gSY5lzJYf 3yaen4gvSIXMgJKLfjRfB8EN0yYKhoUl0CXLhZYYEDeFRU0vObEwOxac4orM3WBwkW lW1ptHW6DO5cbByYjkt574+02gWD9mLMY5pb0ogw= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20220608021708epcas2p4a9366159637c54a705583cda2af6cffe~2g54xtGW61290612906epcas2p4G; Wed, 8 Jun 2022 02:17:08 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.92]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4LHrTH6b1lz4x9Pp; Wed, 8 Jun 2022 02:17:07 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 85.C7.10028.3A600A26; Wed, 8 Jun 2022 11:17:07 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20220608021707epcas2p12c3217dca29441c5c03c2c9cd102ae21~2g53yzDon1805318053epcas2p1K; Wed, 8 Jun 2022 02:17:07 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220608021707epsmtrp12f25343d6c7c6e284c7c4bc0a37a60dd~2g53x5xIK2303123031epsmtrp1T; Wed, 8 Jun 2022 02:17:07 +0000 (GMT) X-AuditID: b6c32a47-589ff7000000272c-b8-62a006a30124 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 65.08.11276.3A600A26; Wed, 8 Jun 2022 11:17:07 +0900 (KST) Received: from KORCO082417 (unknown [10.229.8.121]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220608021707epsmtip29fd738ec30b73ae952cb7c97c35b3e37~2g53fysAP2450424504epsmtip2b; Wed, 8 Jun 2022 02:17:07 +0000 (GMT) From: "Chanho Park" To: "'Alim Akhtar'" , , , , Cc: , , , , , , , , "'Bharat Uppal'" In-Reply-To: <20220603154714.30532-7-alim.akhtar@samsung.com> Subject: RE: [PATCH v2 6/7] ufs: host: ufs-exynos: add support for fsd ufs hci Date: Wed, 8 Jun 2022 11:17:07 +0900 Message-ID: <003501d87add$da15c310$8e414930$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: AQFSBQ9Zoh1+pG8sApsbls4ebot9jgJEDvu0Ahy3giCuLqahsA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOJsWRmVeSWpSXmKPExsWy7bCmhe5itgVJBtNOm1g8mLeNzeLlz6ts FtdeXmC3mPbhJ7PF/CPnWC36Xjxkttj0+BqrxeVdc9gsJqz6xmLRfX0Hm8Xy4/+YLBZt/cJu 0br3CLvFzjsnmB34PC5f8fbYtKqTzePOtT1sHpuX1Ht8fHqLxaNvyypGj8+b5DzaD3QzBXBE ZdtkpCampBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAJ2tpFCW mFMKFApILC5W0rezKcovLUlVyMgvLrFVSi1IySk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Buvmilg8mLeNzeLlz6ts FtdeXmC3mPbhJ7PF/CPnWC36Xjxkttj0+BqrxeVdc9gsJqz6xmLRfX0Hm8Xy4/+YLBZt/cJu 0br3CLvFzjsnmB34PC5f8fbYtKqTzePOtT1sHpuX1Ht8fHqLxaNvyypGj8+b5DzaD3QzBXBE cdmkpOZklqUW6dslcGV8+LOdreCFasXZdxdYGhhfy3cxcnBICJhIHNij2sXIxSEksJtRYvK8 y8xdjJxAcVmJZ+92sEPYwhL3W46wQhQ9Y5Q4/OoHC0iCTUBf4mXHNrCEiMAeRom2eafYQRxm gclMEpMavrJAtOxnlJi/aw8rSAungK3E2tU3weYKC/hJbP+1nQ3EZhFQkdh3ugEszitgKbH9 2EFGCFtQ4uTMJ2DrmAW0JXoftjLC2MsWvoa6VUHi59NlrBBxEYnZnW3MIL+JCDhJHPiiMIFR eBaSSbOQTJqFZNIsJN0LGFlWMUqmFhTnpucWGxYY5qWW6xUn5haX5qXrJefnbmIER6yW5g7G 7as+6B1iZOJgPMQowcGsJMIrGT4/SYg3JbGyKrUoP76oNCe1+BCjNAeLkjjvha6T8UIC6Ykl qdmpqQWpRTBZJg5OqQamOYXVMcy27sw3L3/flzVL/qUUd8OG7pSow5bTwmwj9zyZorzyJ5Pd hA1ZrLXqNXfPlKmkLpKdq3i+1Ek+LGlHN29kvu7xXp8t/mv83rIFy88SjNhqdjb2x75IMf8f tQ5+F5kYQgJX/wpYHJPttfit560l/3m8LP0sqxeUCa3l+HnGbB7vhL27osvaW1jkrj+pWd5c 5vFAf375RQbJsgg9v8snDc20FWtMem/4JITty3Iorb572yaM91Zru92H6QuPhLDNNRD2Or5z 75yrgscCAw8cPtouu6Xl0LqPWn+uup7qdg+ztep/HbeSUfSKcUBuFccFEdVS9sdF3psuJGpo TFm/ODz9mco/O7ayV0osxRmJhlrMRcWJAOzqsylHAwAA X-CMS-MailID: 20220608021707epcas2p12c3217dca29441c5c03c2c9cd102ae21 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220603154907epcas5p40d236cecf8d4a574d44d9a2b66f2caf0 References: <20220603154714.30532-1-alim.akhtar@samsung.com> <20220603154714.30532-7-alim.akhtar@samsung.com> X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Subject: =5BPATCH v2 6/7=5D ufs: host: ufs-exynos: add support for fsd uf= s hci >=20 > Adds support of UFS HCI which is found in Tesla Full Self-Driving (FSD) > SoC. >=20 > Signed-off-by: Bharat Uppal > Signed-off-by: Alim Akhtar > --- > drivers/ufs/host/ufs-exynos.c =7C 138 ++++++++++++++++++++++++++++++++++ > 1 file changed, 138 insertions(+) >=20 > diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.= c > index cc128aff8871..7e0ab8a8662e 100644 > --- a/drivers/ufs/host/ufs-exynos.c > +++ b/drivers/ufs/host/ufs-exynos.c > =40=40 -1474,6 +1474,102 =40=40 static int exynosauto_ufs_vh_init(struct = ufs_hba > *hba) > return 0; > =7D >=20 > +static int fsd_ufs_pre_link(struct exynos_ufs *ufs) =7B > + int i; > + struct ufs_hba *hba =3D ufs->hba; > + > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x9514), 1000000000L / ufs- > >mclk_rate); > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x201), 0x12); > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x40); > + > + for_each_ufs_tx_lane(ufs, i) =7B > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xAA, i), 1000000000L / > ufs->mclk_rate); Use NSEC_PER_SEC and DIV_ROUND_UP as well. > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x8F, i), 0x3F); > + =7D > + > + for_each_ufs_rx_lane(ufs, i) =7B > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x12, i), 1000000000L / > ufs->mclk_rate); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x5C, i), 0x38); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x0F, i), 0x0); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x65, i), 0x1); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x69, i), 0x1); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x21, i), 0x0); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x22, i), 0x0); > + =7D > + > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x0); > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x9536), 0x4E20); > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x9564), 0x2e820183); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0x0); > + > + exynos_ufs_establish_connt(ufs); > + > + return 0; > +=7D > + > +static int fsd_ufs_post_link(struct exynos_ufs *ufs) =7B > + int i; > + struct ufs_hba *hba =3D ufs->hba; > + u32 hw_cap_min_tactivate; > + u32 peer_rx_min_actv_time_cap; > + u32 max_rx_hibern8_time_cap; > + > + ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(0x8F, 4), > + &hw_cap_min_tactivate); /* HW Capability of > MIN_TACTIVATE */ > + ufshcd_dme_get(hba, UIC_ARG_MIB(0x15A8), > + &peer_rx_min_actv_time_cap); /* PA_TActivate */ > + ufshcd_dme_get(hba, UIC_ARG_MIB(0x15A7), > + &max_rx_hibern8_time_cap); /* PA_Hibern8Time */ > + > + if (peer_rx_min_actv_time_cap >=3D hw_cap_min_tactivate) > + ufshcd_dme_peer_set(hba, UIC_ARG_MIB(0x15A8), > + peer_rx_min_actv_time_cap + 1); > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x15A7), max_rx_hibern8_time_cap + > 1); > + > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x9529), 0x01); > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x15A4), 0xFA); > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x9529), 0x00); > + > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x40); > + > + for_each_ufs_rx_lane(ufs, i) =7B > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x35, i), 0x05); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x73, i), 0x01); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x41, i), 0x02); > + ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x42, i), 0xAC); > + =7D > + > + ufshcd_dme_set(hba, UIC_ARG_MIB(0x200), 0x0); > + > + return 0; > +=7D > + > +static int fsd_ufs_pre_pwr_change(struct exynos_ufs *ufs, > + struct ufs_pa_layer_attr *pwr) > +=7B > + struct ufs_hba *hba =3D ufs->hba; > + > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), 0x1); > + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), 0x1); > + 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); > + 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); If you set custom pwrmode setting, you'll need to set UFSHCD_QUIRK_SKIP_DEF= _UNIPRO_TIMEOUT_SETTING. > + > + unipro_writel(ufs, 8064, 0x7888); > + unipro_writel(ufs, 28224, 0x788C); > + unipro_writel(ufs, 20160, 0x7890); Duplicated setting with above dme_set calls. (DL_FC0PROTTIMEOUTVAL / DL_TC0= REPLAYTIMEOUTVAL / DL_AFC0REQTIMEOUTVAL) Unipro registers are mirrored and you can use unipro_* APIs but need to cho= ose one of them. > + unipro_writel(ufs, 12000, 0x78B8); > + unipro_writel(ufs, 32000, 0x78BC); > + unipro_writel(ufs, 16000, 0x78C0); Put some documents the register as DME_POWERMODE_REQ_REMOTEL2TIMER0/1/2 or = use macro for them. Best Regards, Chanho Park