From patchwork Thu Dec 22 14:09:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 3225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp348173wrn; Thu, 22 Dec 2022 06:14:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXtbKnTJpMObY/RMQuECULazxzOPnlpDcQkc+OYJbkqke7C0f40iyiIQVfZdawqHtJkSFuHj X-Received: by 2002:a17:907:8c0c:b0:7c1:1901:a445 with SMTP id ta12-20020a1709078c0c00b007c11901a445mr4731406ejc.20.1671718454963; Thu, 22 Dec 2022 06:14:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671718454; cv=none; d=google.com; s=arc-20160816; b=PtdUve0U7qoLZZNMvrGdwCc1jfehe4KggQ3tMutWrVhV3jWYUhzOx/9YwKmiGSXBFQ 3jvw76J+A/gZeiTP7Jb2mhQpT2J7vGaHAOQRB1njwGPGh75JB+he6E7LzJmGCIaykFKZ 77wfuZD0Dk3/TrRnwKK00E8BARjfBr8KOrWgG5zO+WCeQ9CjE1/3be63wvV0LlF4A69d GbZNHsfSnHkqPlHNGQ3901QBKmTNiWgiaEOZeO5r2tYlw0cfdSSb8X5Z9/7nm/or79mN szpeKortSvdtyBaeqteyvByEtdxMhM5fptNEFcExByY+GAq3/vzngtgUCRr2XC7Oljdm xX9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=maKazkqxDXKNlbDmatrsJr0yRFC5v9vVzKjjcP/hqRY=; b=EtR2WqGu4gnIwMz+fEifK0sdENSV/0G2iI5Rwc80bxcqZf0SZsRmEYQ9EhevdZk9kX HvV+k58W54sRHtRk7S6qFmHmO9aKpTnxoqo79ONlDecvmdN81Qj86tWFtUBCzwPdIAGv E95r3V5mzdRIDc3gpSstDl/R7z595KSJGGgEVJ2bQUuwnr1gnzXIBDoSxU5749tyUz7I gzWniKf0Ms3QJHPM5pLn3ZhMMdp5BvUp75NPYTMX4k1IlOItLxQMkby2CHObS3dDJTSP Xl1hQYm83TzvYM95lyy5iemNDEPKqkQ/8KchXuLwmO6YALPenN6yVkCEqzHdpKUIWTem bRaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AABuUZlx; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt9-20020a170907728900b0073ce34d1a13si534601ejc.499.2022.12.22.06.13.48; Thu, 22 Dec 2022 06:14:14 -0800 (PST) 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=@linaro.org header.s=google header.b=AABuUZlx; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235400AbiLVOKS (ORCPT + 99 others); Thu, 22 Dec 2022 09:10:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbiLVOKP (ORCPT ); Thu, 22 Dec 2022 09:10:15 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 598622A24F for ; Thu, 22 Dec 2022 06:10:14 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id z8-20020a17090abd8800b00219ed30ce47so5815891pjr.3 for ; Thu, 22 Dec 2022 06:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=maKazkqxDXKNlbDmatrsJr0yRFC5v9vVzKjjcP/hqRY=; b=AABuUZlxOnwe7CqeZepSq1GN/aiZtuPS0RScE5ISqZpaE4eO0AzrRnghARB1/opFOZ 99f03JZBJ3vnV1InjXwuwVX9kQMp9bYfoquYv9yPKgo3yBP3rhluCA6xn+7gPKHy9Gut 5JNDL7oL4Df40SKYlFOPEtYi397zLzjv3t7wSfkLik38CZE7lOn85gQLL/WjKYppeRRJ AYiMX8q6m3skqJ6KngLXeMdceoqj8OZYj1pANHsYo33QmzYpwRKVbtzLnUYSym29UBGJ rl1rB2/Ka+htTkwGvU03F5fM4ocHG4FhfBadmcZRbGjvZ1vbeCpkjZGqEFXrpPVICmWn OnrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=maKazkqxDXKNlbDmatrsJr0yRFC5v9vVzKjjcP/hqRY=; b=EZCvRtmKVfC6PdGrz+HgA0oG49cQWMMAtzIDplXvPZmStgsHFfyWuEDVr+ieRmgqNt zPjkel3BkC6ssTJdwW+xcc6bwAJTB2Oc5wMJvsINR2JG+ugGrjE32lDfrlJV6PWLDfoG hp0e67pP/I2s8bBhXGcNn4MrLpKQxdNvOANjnJD6uAJ2YQExQ6kJYd/vyhv5GBtQW7Kb K+ZnS9L9hKdwwvfA1Kg0RGMqKyF0Jb/T1OHoTxj+NEqsJ5SGuM0sZFuLrN3l3CnTRjxY oyn+wbZnVyzmEDDnt+arF4n7LPV4pZP4sx6+mgQzojiJQZZYbBD95TVR8KnTISUBLnxu tIXw== X-Gm-Message-State: AFqh2kqxq9jIrxYlH5xgBudHrxggyFl7KfcrSwbLqfYqgNn5N6NosazQ XaraWqcLf+9EearsWVv7kHvR X-Received: by 2002:a05:6a21:3284:b0:ad:4a3e:a6e1 with SMTP id yt4-20020a056a21328400b000ad4a3ea6e1mr9736629pzb.11.1671718213733; Thu, 22 Dec 2022 06:10:13 -0800 (PST) Received: from localhost.localdomain ([117.217.177.177]) by smtp.gmail.com with ESMTPSA id f8-20020a655908000000b0047829d1b8eesm832031pgu.31.2022.12.22.06.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 06:10:12 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com, andersson@kernel.org, vkoul@kernel.org Cc: quic_cang@quicinc.com, quic_asutoshd@quicinc.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-scsi@vger.kernel.org, dmitry.baryshkov@linaro.org, ahalaney@redhat.com, abel.vesa@linaro.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, Manivannan Sadhasivam Subject: [PATCH v5 00/23] ufs: qcom: Add HS-G4 support Date: Thu, 22 Dec 2022 19:39:38 +0530 Message-Id: <20221222141001.54849-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752923850727533608?= X-GMAIL-MSGID: =?utf-8?q?1752923850727533608?= Hello, This series adds HS-G4 support to the Qcom UFS driver and PHY driver. The newer Qcom platforms support configuring the UFS controller and PHY in dual gears (i.e., controller/PHY can be configured to run in two gear speeds). This is accomplished by adding two different PHY init sequences to the PHY driver and the UFS driver requesting the one that's required based on the platform configuration. Initially the ufs-qcom driver will use the default gear G2 for enumerating the UFS device. Afer enumeration, the max gear supported by both the controller and device would be found out and that will be used thereafter. But for using the max gear after enumeration, the ufs-qcom driver requires the UFS device to be reinitialized. For this purpose, a separate quirk has been introduced in the UFS core along with a callback and those will be used by the ufs-qcom driver. This series has been tested on following platforms: * Qcom RB5 development platform powered by SM8250 SoC * SM8450 based dev board * Qdrive3/sa8540p-ride board based on SC8280XP (derivative) Merging Strategy: ----------------- The PHY patches are expected to go through PHY tree and UFS, MAINTAINERS patches are expected to go through SCSI tree. NOTE: Since this series targets multiple SoCs (base like SM8350) and (derivative like SC8280XP), testing on all of these platforms is really appreciated. Although, if the series works for base SoC, then for derivatives also it should work. Thanks, Mani Changes in v5: * Collected Review and tested-by tags * Reworded patch 18/23 (Bart) and also the comment for reinit_notify Changes in v4: * Dropped HS G3 specific setting from SM8350 default init sequence * Added G4 support to SM8350 and SC8280XP * Covered all qcom files under drivers/ufs/host in MAINTAINERS file * Added missing Suggested-by tags for Can Guo * Rebased on top of linux-next 20221201 Changes in v3: * Dropped the "device-max-gear" DT property and switched to reinitialization (Krzysztof) * Added HS-G4 support to all compatible SoCs (SM8150, SM8250 and SM8450). This will also benefit the derivative SoCs of these platforms like SC8180x, SC8280x etc... * Splitted the qmp_phy_init_tbl changes into separate patches (Vinod) * Collected reviews from Andrew H Changes in v2: * Collected reviews from Dmitry * Renamed "max-gear" property to "max-device-gear" * Used min() for deciding which gear to use instead of open comparision * Added comment about the old register name Manivannan Sadhasivam (23): phy: qcom-qmp-ufs: Remove _tbl suffix from qmp_phy_init_tbl definitions phy: qcom-qmp-ufs: Rename MSM8996 PHY definitions phy: qcom-qmp-ufs: Move register settings to qmp_phy_cfg_tbls struct phy: qcom-qmp-ufs: Add support for configuring PHY in HS Series B mode phy: qcom-qmp-ufs: Add support for configuring PHY in HS G4 mode phy: qcom-qmp-ufs: Move HS Rate B register setting to tbls_hs_b phy: qcom-qmp-ufs: Add HS G4 mode support to SM8150 SoC phy: qcom-qmp-ufs: Add HS G4 mode support to SM8250 SoC phy: qcom-qmp-ufs: Avoid setting HS G3 specific registers phy: qcom-qmp-ufs: Add HS G4 mode support to SM8350 SoC phy: qcom-qmp-ufs: Add HS G4 mode support to SM8450 SoC phy: qcom-qmp-ufs: Add HS G4 mode support to SC8280XP SoC scsi: ufs: ufs-qcom: Remove un-necessary goto statements scsi: ufs: ufs-qcom: Remove un-necessary WARN_ON() scsi: ufs: ufs-qcom: Use bitfields where appropriate scsi: ufs: ufs-qcom: Use dev_err_probe() for printing probe error scsi: ufs: ufs-qcom: Fix the Qcom register name for offset 0xD0 scsi: ufs: core: Add reinit_notify() callback scsi: ufs: core: Add support for reinitializing the UFS device scsi: ufs: ufs-qcom: Factor out the logic finding the HS Gear scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device scsi: ufs: ufs-qcom: Add support for finding max gear on new platforms MAINTAINERS: Add myself as the maintainer for Qcom UFS drivers MAINTAINERS | 8 + .../phy/qualcomm/phy-qcom-qmp-pcs-ufs-v5.h | 1 + drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 454 +++++++++++++----- drivers/ufs/core/ufshcd-priv.h | 6 + drivers/ufs/core/ufshcd.c | 63 ++- drivers/ufs/host/ufs-qcom.c | 170 +++---- drivers/ufs/host/ufs-qcom.h | 70 +-- include/ufs/ufshcd.h | 8 + 8 files changed, 532 insertions(+), 248 deletions(-)