From patchwork Mon Oct 24 10:06:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358031wru; Mon, 24 Oct 2022 03:07:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HTPR0v8V/zyshOiIKf7EbEeoO1LpOC8MsMWNijAvo5qk1r8PyBmbvKlxK2D/xqQ+PXqbu X-Received: by 2002:a05:6a00:1ac8:b0:563:7d18:7a15 with SMTP id f8-20020a056a001ac800b005637d187a15mr32722352pfv.59.1666606059696; Mon, 24 Oct 2022 03:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606059; cv=none; d=google.com; s=arc-20160816; b=Ng0g2USt0GiwX20iaYlA1pzZRPWB8jg/BrH9hxnhCjRZGO8JnayMy/1aj+RYLbMNGC hn1iRBDH+6rjmms+3YcM87W+vQm2hGNPN399mMYcC6We36TaIfqZUeV/KWEvWR13AimY cvN9/H/QP6xAIaoifrbFzmhXx01dHp/uSYAE0lpsE1flACNBozP9an9Y9mBpIP0v6vXE RGnj4ojsseUKagngXb+umdYbt1wO19vTdVQzqk7bRk4RwfjlyhGXG7HV/9tQ/8o9V5el IMpACccxqs7cGPj7JSGw/UAJYO7J31N/O+hx3NGU/Ubf6EhOGAviCxKSIVzq4GawftC6 zkTA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+RvRdrAyO13Bx6rogoll9qsinZkX+yDNzbEPsFcJF8w=; b=LkepjQjiQweDQAmKcQfjuXH+r32uGUb9hqcRo0XXOVtECCuZpHHwl0KWo9OQ6xulA0 ByLoFvnFNmNLiRTSiKG1lS8MR2zeY+mDgizIOA4vMPFK5zXNCZvzloYyzkr0sb1ywugD bL47Xqkgqddq51m1YpNAe6lrxXeuUMX14/z5/bU691vvHU3qs2xAxqUKGk+EnOdASwit JqEN5b9oGcEkXou6Shf8mA0vObjby21yojp1LLN6XC+Q3LPqE3vs+sl4jZNdwqhy94Ae 68Q39BhawkTav+btUwHZnrLtT4fJThP/Frr9pA14GTyCRrENZwMj3EFLlc8830dHYl7T mkzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LbR7LDlS; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a170902eb8c00b00186748fe8e8si10461719plg.188.2022.10.24.03.07.25; Mon, 24 Oct 2022 03:07:39 -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=@kernel.org header.s=k20201202 header.b=LbR7LDlS; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbiJXKHK (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbiJXKHI (ORCPT ); Mon, 24 Oct 2022 06:07:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F466432; Mon, 24 Oct 2022 03:07:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE053611AD; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42B16C433B5; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=Blc66Ko1azHrb/nEVIdVCCRSopdMuUlafRjUOxGWY+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LbR7LDlSZk4rHgr+yNoQRlUV7hPaFX1hrAXCVoGz8fzsx2pt17hAar/UlV9UJ80Zi zRZeun+PffO3YmJaFNzuSq1nyAl6opCGKW7MvyFXqLR4PEHzrYNK7RSQhoteYWzQqL Gtha2VWTuKmWiYfUwdFjcCPk1dmXt99tBM7Vy9lAkqvHg9fWIVSKIrzQ+oTNsWTZta GABXjIvld32EoaoE7vx2j7pL6/5mWlqR6EKFzO+/CUfnIcG7lu+3v2q7oQYiVb73v0 QFkGCM78jfK+e/DNoj307aTKkt1aOLU5rwr97GAxvnE39ADY+JI1C1q1IHLl3vhgk5 YUPqpVvFQAXNw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM2-0005M6-Ob; Mon, 24 Oct 2022 12:06:46 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 01/13] phy: qcom-qmp-usb: fix sc8280xp PCS_USB offset Date: Mon, 24 Oct 2022 12:06:20 +0200 Message-Id: <20221024100632.20549-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563115521580346?= X-GMAIL-MSGID: =?utf-8?q?1747563115521580346?= The PCS_USB register block lives at an offset of 0x1000 from the PCS region on SC8280XP so add the missing offset to avoid corrupting unrelated registers on runtime suspend. Note that the current binding is broken as it does not describe the PCS_USB region and the PCS register size does not cover PCS_USB and the regions in between. As Linux currently maps full pages, simply adding the offset to driver works until the binding has been fixed. Fixes: c0c7769cdae2 ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy") Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index d0c433197080..82af28f4a91b 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -1682,6 +1682,7 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { .vreg_list = qmp_phy_vreg_l, .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .regs = qmp_v4_usb3phy_regs_layout, + .pcs_usb_offset = 0x1000, }; static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = { From patchwork Mon Oct 24 10:06:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358238wru; Mon, 24 Oct 2022 03:08:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HSYeCYw2fSV7NlxhmxA4e0xOKPD1xTQ5n3+fdYRka0hJ3MACCxQCv4HxP4eBHgcu8IXXD X-Received: by 2002:a17:902:aa8b:b0:178:8f1d:6936 with SMTP id d11-20020a170902aa8b00b001788f1d6936mr33002836plr.168.1666606095507; Mon, 24 Oct 2022 03:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606095; cv=none; d=google.com; s=arc-20160816; b=wzXx7tdzlpulkKw9UCxkP2bhAkg1AHa1eEFTePclFjSfEVSqSREmTGKKLd3Wy3x825 GfzUW6OIbU3+xhP5r8Uc95G44SWD4k3ECmo0A2wGabS67y1jUrmjhVnakruETX+d0jyy qUMpGVSrr3kGKqCUZO8lqMe7/5l7vW98SQ/vJVOgGIBQtoGylwR+mUfCWI1l0Ou16i59 9CTQJ3sVOw8Lx+q+jCQKmU2Y3f/rVLp/nrTsDh+/Bhg55OMoIoRR43FSHar9lHVlF3pd tYv9z1nB6w+n+ZWSyl0YrUIZnL3PQqKZ5IZNIO3WoRyIMfXATNf7PT/zow1oFoBVpdJu volQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f9wABXccudVlOwgMcwEWV88sN7XGeYtIQlVn0bzUVdI=; b=Oqs8ounyPXYbKNdYZJWHjPJv5jYc8UEv4jZWcK02R09eQMJwg2fmVnI8AhelgWTQSq unqgDWckhz2kW5+GguUD7zs+EWl6+N7M8tFqq4kZJuNVkhQT6/wWQHUxAUsZnHogFLrK YqO3+cR0GYKM6d+hjxvjmTyycGJOoB16oKuqHBnXpj0TiDwY/Voei4n2m0aRxuNeyYWo spYI5GwftsqhSgyAG7i+ZnK7f98yZgdY3/gsI8xsFn+pI1lLLZ48NuOQE4E/uydZ3SvZ vSARfonORyQgkieOLJnxjBJrLwhKmRIXl6UQegrgFNiAt9fOM3azzJ5jt7XbiEfSg87f qWOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=In6a8DMt; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a170902f70700b00172f32450b7si33478677plo.197.2022.10.24.03.08.01; Mon, 24 Oct 2022 03:08:15 -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=@kernel.org header.s=k20201202 header.b=In6a8DMt; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230133AbiJXKHb (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbiJXKHJ (ORCPT ); Mon, 24 Oct 2022 06:07:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B6E3BC59; Mon, 24 Oct 2022 03:07:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96850B810BC; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 369D3C433C1; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=+eicq563sf78FfC0LYPYXOJGdE04LCFvaivbb6IWJvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=In6a8DMtpy0CcgBzWqRRH6u57ckKOHV0BMtNxLYpyAH/5t3vvljW/XO6ZogicdFKw bG9cp6xuVHxwyC+VPQkpLtyJvRt6VJ2kWKCG1NJdTsA2ecwfewfO8LQAbiDnSQDlJv 66MaX0PCADuCPJHFKzYc+/RlnNwGPUPSUmt2HmSZk/N1goMLJyoc8zBKaWNI6R8MsH Vwu84sQt3+3wxcBEt5KCFNtxvJi+07Jc9Wfio2r+UCbyVScEWuEQ5XUhbci84UnFhq Vrl04+uZYx/t+1eFPaxhEf1pKZ0jYunftVV0dz8cxAAV6850AQzxwWISle6cr//0Fl DBFVWfS8skSQQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM2-0005M8-RK; Mon, 24 Oct 2022 12:06:46 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 02/13] phy: qcom-qmp-usb: sort device-id table Date: Mon, 24 Oct 2022 12:06:21 +0200 Message-Id: <20221024100632.20549-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563153511074329?= X-GMAIL-MSGID: =?utf-8?q?1747563153511074329?= Sort the device-id table by compatible string to make it easier to find and add new entries. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 82af28f4a91b..41a4548f3f99 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2503,14 +2503,20 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id, static const struct of_device_id qmp_usb_of_match_table[] = { { + .compatible = "qcom,ipq6018-qmp-usb3-phy", + .data = &ipq8074_usb3phy_cfg, + }, { .compatible = "qcom,ipq8074-qmp-usb3-phy", .data = &ipq8074_usb3phy_cfg, }, { .compatible = "qcom,msm8996-qmp-usb3-phy", .data = &msm8996_usb3phy_cfg, }, { - .compatible = "qcom,ipq6018-qmp-usb3-phy", - .data = &ipq8074_usb3phy_cfg, + .compatible = "qcom,msm8998-qmp-usb3-phy", + .data = &msm8998_usb3phy_cfg, + }, { + .compatible = "qcom,qcm2290-qmp-usb3-phy", + .data = &qcm2290_usb3phy_cfg, }, { .compatible = "qcom,sc7180-qmp-usb3-phy", .data = &sc7180_usb3phy_cfg, @@ -2527,8 +2533,11 @@ static const struct of_device_id qmp_usb_of_match_table[] = { .compatible = "qcom,sdm845-qmp-usb3-uni-phy", .data = &qmp_v3_usb3_uniphy_cfg, }, { - .compatible = "qcom,msm8998-qmp-usb3-phy", - .data = &msm8998_usb3phy_cfg, + .compatible = "qcom,sdx55-qmp-usb3-uni-phy", + .data = &sdx55_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sdx65-qmp-usb3-uni-phy", + .data = &sdx65_usb3_uniphy_cfg, }, { .compatible = "qcom,sm8150-qmp-usb3-phy", .data = &sm8150_usb3phy_cfg, @@ -2541,12 +2550,6 @@ static const struct of_device_id qmp_usb_of_match_table[] = { }, { .compatible = "qcom,sm8250-qmp-usb3-uni-phy", .data = &sm8250_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sdx55-qmp-usb3-uni-phy", - .data = &sdx55_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sdx65-qmp-usb3-uni-phy", - .data = &sdx65_usb3_uniphy_cfg, }, { .compatible = "qcom,sm8350-qmp-usb3-phy", .data = &sm8350_usb3phy_cfg, @@ -2556,9 +2559,6 @@ static const struct of_device_id qmp_usb_of_match_table[] = { }, { .compatible = "qcom,sm8450-qmp-usb3-phy", .data = &sm8350_usb3phy_cfg, - }, { - .compatible = "qcom,qcm2290-qmp-usb3-phy", - .data = &qcm2290_usb3phy_cfg, }, { }, }; From patchwork Mon Oct 24 10:06:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8305 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358266wru; Mon, 24 Oct 2022 03:08:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71LGTVuTCWAqsVQM6wx4zm8wtgRL23GCIQgxcQhAv/PpgBX+kZhPTZi4t3oT+trJ8azf5X X-Received: by 2002:a63:28c:0:b0:46e:9da9:80f8 with SMTP id 134-20020a63028c000000b0046e9da980f8mr18463263pgc.373.1666606099640; Mon, 24 Oct 2022 03:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606099; cv=none; d=google.com; s=arc-20160816; b=OtiBMQUZ+RiXndSYjXMQaKZ39LlqysMNYRpwpisp+qccyJeNUQGGDglSkRq00dMfZk 4GV6CaXGMsw57g1jwtcsjRVidsiIKtedf6GAlEwpkgEHQxTz3Kuq22aV8LSEGeLwrlaZ IP15fHVTXlP2YRJwBFGm96JZTP8XZIsHiI7WpEnzd1yk88x0jpfu2np887TZ4iaicq1S dZEb7/5LD67ghBdu2Mn9L6w8vf0r0CVY3HVlkv62WY7bHHQQBETPETReEacu5J0+gs62 +ELCjSuuJ8agvjUBY0lEw8AcPouXFzcS9Vssz4PRczYmJcH6uSXBlius0/wQh41oJ291 x4pQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lsiQRUN28RhqtXeRWizEKMUWUwF8M+z5pT0vB/heCVA=; b=mc/goP9rXnq6dFa4jyvrACC6wkR24zhQX17x6xgWD+nGGvF4zckJusUJpF0Jg6cHxV a2cUKGWBUNaR9mSyWekKoqMjsdsMgQ2QkadcuOdqiZwyFWNkuGkBzxtQTLaqff4nWuXv idIxbv84zPGNzEAKrk6GvJzdOM2reeJQNnJrM3ZCXBaiJpLLxCK9t0YMOKJh5uaAmcTa MSkbm8wBv1E2c3RBtO8G4izxyRPHqIP30fFcDl6HFkS06+vJMgIk30uBt+VuFEv4pyYm O+8Y99+3ETWS5VDK89cCbhJgru+DavXagwKegr9HlCkGHqko2Xefb79Ow/CcYdfK0/ku FoaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Ix2AL/EW"; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a17090ad78300b0020cedba54fcsi13384546pju.55.2022.10.24.03.08.06; Mon, 24 Oct 2022 03:08:19 -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=@kernel.org header.s=k20201202 header.b="Ix2AL/EW"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbiJXKH2 (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbiJXKHJ (ORCPT ); Mon, 24 Oct 2022 06:07:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B9CC19C33; Mon, 24 Oct 2022 03:07:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E0DFB61173; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40D1BC433D6; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=0hzUAeDiWrfZBYKIvIEdXlwF8MUsk8JJpNzgiTtrLCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ix2AL/EW5Arc0bYOZSRRKXdegUidwM6qgvI3WADFJgw1frJOwJ2uKKIHxKhUOkxzh SZvyMtBaPr+LeCeDdaKctPPwdw/WO+/GPE076jdpkoTGPKaoOEzwRsr2cseErs7vOj 7ZONirFV0gUBMDmqi/SYmlNj4bIhI5oJ1lGTCK757H8qD+3D2JsmmKdfepRSVcYo4/ E2MPguc6f7MhSyOAElLf8t7u+okJUudZlPb/bBdGoL/tW9ColaijE1nqDG6sKb17jx egWUIwPNzGpWhxuGmz6kx/N4QB6v2mQnG+YuQed6l3XdkHADWURGYBjXTsZJjgNsKn i288rQ6p71zFw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM2-0005MA-UC; Mon, 24 Oct 2022 12:06:46 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 03/13] phy: qcom-qmp-usb: move device-id table Date: Mon, 24 Oct 2022 12:06:22 +0200 Message-Id: <20221024100632.20549-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563157526631393?= X-GMAIL-MSGID: =?utf-8?q?1747563157526631393?= Move the device-id table below probe() and next to the driver structure to keep the driver callback functions grouped together. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 126 ++++++++++++------------ 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 41a4548f3f99..4591128743c7 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2501,69 +2501,6 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id, return 0; } -static const struct of_device_id qmp_usb_of_match_table[] = { - { - .compatible = "qcom,ipq6018-qmp-usb3-phy", - .data = &ipq8074_usb3phy_cfg, - }, { - .compatible = "qcom,ipq8074-qmp-usb3-phy", - .data = &ipq8074_usb3phy_cfg, - }, { - .compatible = "qcom,msm8996-qmp-usb3-phy", - .data = &msm8996_usb3phy_cfg, - }, { - .compatible = "qcom,msm8998-qmp-usb3-phy", - .data = &msm8998_usb3phy_cfg, - }, { - .compatible = "qcom,qcm2290-qmp-usb3-phy", - .data = &qcm2290_usb3phy_cfg, - }, { - .compatible = "qcom,sc7180-qmp-usb3-phy", - .data = &sc7180_usb3phy_cfg, - }, { - .compatible = "qcom,sc8180x-qmp-usb3-phy", - .data = &sm8150_usb3phy_cfg, - }, { - .compatible = "qcom,sc8280xp-qmp-usb3-uni-phy", - .data = &sc8280xp_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sdm845-qmp-usb3-phy", - .data = &qmp_v3_usb3phy_cfg, - }, { - .compatible = "qcom,sdm845-qmp-usb3-uni-phy", - .data = &qmp_v3_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sdx55-qmp-usb3-uni-phy", - .data = &sdx55_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sdx65-qmp-usb3-uni-phy", - .data = &sdx65_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sm8150-qmp-usb3-phy", - .data = &sm8150_usb3phy_cfg, - }, { - .compatible = "qcom,sm8150-qmp-usb3-uni-phy", - .data = &sm8150_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sm8250-qmp-usb3-phy", - .data = &sm8250_usb3phy_cfg, - }, { - .compatible = "qcom,sm8250-qmp-usb3-uni-phy", - .data = &sm8250_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sm8350-qmp-usb3-phy", - .data = &sm8350_usb3phy_cfg, - }, { - .compatible = "qcom,sm8350-qmp-usb3-uni-phy", - .data = &sm8350_usb3_uniphy_cfg, - }, { - .compatible = "qcom,sm8450-qmp-usb3-phy", - .data = &sm8350_usb3phy_cfg, - }, - { }, -}; -MODULE_DEVICE_TABLE(of, qmp_usb_of_match_table); - static const struct dev_pm_ops qmp_usb_pm_ops = { SET_RUNTIME_PM_OPS(qmp_usb_runtime_suspend, qmp_usb_runtime_resume, NULL) @@ -2665,6 +2602,69 @@ static int qmp_usb_probe(struct platform_device *pdev) return ret; } +static const struct of_device_id qmp_usb_of_match_table[] = { + { + .compatible = "qcom,ipq6018-qmp-usb3-phy", + .data = &ipq8074_usb3phy_cfg, + }, { + .compatible = "qcom,ipq8074-qmp-usb3-phy", + .data = &ipq8074_usb3phy_cfg, + }, { + .compatible = "qcom,msm8996-qmp-usb3-phy", + .data = &msm8996_usb3phy_cfg, + }, { + .compatible = "qcom,msm8998-qmp-usb3-phy", + .data = &msm8998_usb3phy_cfg, + }, { + .compatible = "qcom,qcm2290-qmp-usb3-phy", + .data = &qcm2290_usb3phy_cfg, + }, { + .compatible = "qcom,sc7180-qmp-usb3-phy", + .data = &sc7180_usb3phy_cfg, + }, { + .compatible = "qcom,sc8180x-qmp-usb3-phy", + .data = &sm8150_usb3phy_cfg, + }, { + .compatible = "qcom,sc8280xp-qmp-usb3-uni-phy", + .data = &sc8280xp_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sdm845-qmp-usb3-phy", + .data = &qmp_v3_usb3phy_cfg, + }, { + .compatible = "qcom,sdm845-qmp-usb3-uni-phy", + .data = &qmp_v3_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sdx55-qmp-usb3-uni-phy", + .data = &sdx55_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sdx65-qmp-usb3-uni-phy", + .data = &sdx65_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sm8150-qmp-usb3-phy", + .data = &sm8150_usb3phy_cfg, + }, { + .compatible = "qcom,sm8150-qmp-usb3-uni-phy", + .data = &sm8150_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sm8250-qmp-usb3-phy", + .data = &sm8250_usb3phy_cfg, + }, { + .compatible = "qcom,sm8250-qmp-usb3-uni-phy", + .data = &sm8250_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sm8350-qmp-usb3-phy", + .data = &sm8350_usb3phy_cfg, + }, { + .compatible = "qcom,sm8350-qmp-usb3-uni-phy", + .data = &sm8350_usb3_uniphy_cfg, + }, { + .compatible = "qcom,sm8450-qmp-usb3-phy", + .data = &sm8350_usb3phy_cfg, + }, + { }, +}; +MODULE_DEVICE_TABLE(of, qmp_usb_of_match_table); + static struct platform_driver qmp_usb_driver = { .probe = qmp_usb_probe, .driver = { From patchwork Mon Oct 24 10:06:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358168wru; Mon, 24 Oct 2022 03:08:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM770DA2zsDSrdTMocR5E5aPtcuaTsH0/+KN6Rw4+dQzQetbQIlYoMLT9QBSY1k1aBy9ezOm X-Received: by 2002:aa7:8d57:0:b0:562:b63c:c2ba with SMTP id s23-20020aa78d57000000b00562b63cc2bamr32914315pfe.29.1666606080531; Mon, 24 Oct 2022 03:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606080; cv=none; d=google.com; s=arc-20160816; b=GYasiLveRLvap5UvGevGu7XxyeIARoVmYiAaXl8UIPU+yDodlYIHeOYOE6c8es6z95 TqZ6LHGv4MD1Z+Sj7zQrPBv65KddCLKJUQ3ixtefPAAXeKqslxTjtX84U7A+TOX32Ggn ZDbTagADxHhIZQUQi5bPnz7LwdbKvuvHkxRIOhmRO5ToEX/RGQ4kxMaz9TnATqPouKvG bd7gSqHhgJK5XZAP+oTSLhy6pdky1YuNpoc+wQr8gK+plc0coshmSViWpVgm0vpniQAZ VCZt+iHUR1Uz/cgC3AneCAuD2EhUyHwhOj7gL6+pMkBOeRj5ZbVs9dfJp2/9ZHFDVNUk ZCnw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZFUg5nvYe2yIj3A+eAorzde9hCbouwbFZjgndplb06k=; b=lxAozlWWtuZxhBErykP1qK2UhuIn8OQqeIzcV8DggtKbOvH7flbYuJZpvJo+feViXF dLTFU45x3bgM3iG8pWQH3uv5psonF6rV7M9+ar3cA8LYgjALJfAX8PDJwJeIIUtpd8KA U1B7ULgJKap4CKxNGRFwUiNGyBpg4GsSmC/Gb4o1i8oZwI2OS2pHYJVEj5F5nFWie5ci Ydx9aH9NHc5z0JU57ec7L3UwkHK6Bb1Wik2OCQcSzjTwiokcFb565em8y1ZzhmO0bCQE sFBTHI2vNRFf3Yinc+q5lUYaNlOce2UvUIPHFjI0QTeugBZDknU3lHaSrZCiLoMoYFqH 21JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U6nZdQJj; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw15-20020a056a00450f00b00563ab8e5e43si32522896pfb.77.2022.10.24.03.07.47; Mon, 24 Oct 2022 03:08:00 -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=@kernel.org header.s=k20201202 header.b=U6nZdQJj; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230486AbiJXKHY (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230058AbiJXKHJ (ORCPT ); Mon, 24 Oct 2022 06:07:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5EED1FFAD; Mon, 24 Oct 2022 03:07:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E65E611B4; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 617D1C4314E; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=G5+tIT4Tgtl0OJ/ICDrVdGpu7q26bG2QKVMgBhfWtvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U6nZdQJjjaXnR4yXoW2TRRKm5wK4CAC18GyBVOuW2JMxYaIWmbijmjGvKWk7FVoWK n55Vurm3rBhQXEXY+7F61qK8/b3lfhhUQDjj/Hgrc5+jZCYKZk34ydrbLRb5DzNgh4 58xLwloBBxywELUwW1hYJfoKpWNM0GpbR1Wbnoa+UQ83WUrCTiN4429ofrcrbH5bxg 6eZprvjpJORdL8Y/w4+63NTkA7T7PrZzugJ05upBt9HLplA7CeiNLKE7fvIkVDtmZX duEdPA+2R7LmbEqIu6/Iywty2h0gI4XmN/FTz/8zPHc6r71CUmczfSUT0AReP9JsAr JCdnRNQk+Fvfg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005MC-0Q; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 04/13] phy: qcom-qmp-usb: move pm ops Date: Mon, 24 Oct 2022 12:06:23 +0200 Message-Id: <20221024100632.20549-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563137732918444?= X-GMAIL-MSGID: =?utf-8?q?1747563137732918444?= Move the PM ops structure next to the implementation to keep the driver callbacks grouped. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 4591128743c7..f28883e0d21e 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2280,6 +2280,11 @@ static int __maybe_unused qmp_usb_runtime_resume(struct device *dev) return 0; } +static const struct dev_pm_ops qmp_usb_pm_ops = { + SET_RUNTIME_PM_OPS(qmp_usb_runtime_suspend, + qmp_usb_runtime_resume, NULL) +}; + static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) { struct qcom_qmp *qmp = dev_get_drvdata(dev); @@ -2501,11 +2506,6 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id, return 0; } -static const struct dev_pm_ops qmp_usb_pm_ops = { - SET_RUNTIME_PM_OPS(qmp_usb_runtime_suspend, - qmp_usb_runtime_resume, NULL) -}; - static int qmp_usb_probe(struct platform_device *pdev) { struct qcom_qmp *qmp; From patchwork Mon Oct 24 10:06:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358346wru; Mon, 24 Oct 2022 03:08:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WQn5AKdteUblXr4Gi0UWWNJln0GW2SqsHT2SI4zjNFTW79F4iyxfY4AGjOq013rVYkjr7 X-Received: by 2002:a05:6a00:8cc:b0:52c:7ab5:2ce7 with SMTP id s12-20020a056a0008cc00b0052c7ab52ce7mr32620262pfu.28.1666606111372; Mon, 24 Oct 2022 03:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606111; cv=none; d=google.com; s=arc-20160816; b=xLlra4ZZSM3rt5JHxnH9k+dE/43DltMdYO5wEpOL70Q3sWSECPE9O8ON3i8FvYRj69 fLCRKxdzGL/A/gTb4+pgbaSdGCYVovFkjlfenROH6NcBnXKWoLJNJ7rplBHBtEf+N9MO AG1+BOizqC0drz5p43hKCuqRW/I/M+tk1Pp3RaowR65spgW4l3KdzNJRGszAAF5MNFwb 9IMnY+qXht/KVWWKYZqiRA0iC79xBVk9bEdgFC8E+IRhG/XCmt7rpqewyA++8Bgm2i7s yhElYxH75KJbkzNmzU63HG8gyokZqKExqeN4wCgP2Xx7kQFMhn6ot9ro8Yz7MdEpm+sQ PEkQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=URvnTqdYWxWQc8AEY0cgPJjNFENbyW06gbcGeHwP1t4=; b=WlKfZ8cSlBA1UkYo5nlgyE/HCtG35VVP4EMVlnQESQ3kgFhgl+qqCJa01R/BLLhmST PWtlgKK8i86K3DGwu4Tf98b/npoPlPw8LHv1pvOg+BLaz+5Z4/fAgB5CaKle0jT8epu5 E8JkLBKamZMbyereB5fo+BA+aH5sfChM9mOGQeOPKa4IpHonY/m+cfZedoUuS34H4inx ZXkG5j7VjoIj1/xBrLfwMOxEG0ak06LMEf+I627x11qMUGnukbTTIGO97XD8qU0BQQqs bZIv1klSCDq6fLG38HLdduCv9UH8Ta3kEjHW8zHlqJ4t/JrRKnwUdiIllIcUPwNi8IPy 98nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEyqi6ps; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x33-20020a056a0018a100b00536f8a6acadsi39533490pfh.2.2022.10.24.03.08.18; Mon, 24 Oct 2022 03:08:31 -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=@kernel.org header.s=k20201202 header.b=CEyqi6ps; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231134AbiJXKHp (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbiJXKHJ (ORCPT ); Mon, 24 Oct 2022 06:07:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1BE4B0EE; Mon, 24 Oct 2022 03:07:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 567ECB810B6; Mon, 24 Oct 2022 10:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 614BEC4314D; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=2GhMhkslokTG3+WOh0oyuUDp9Y0B+rgF74eN5kJB25Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEyqi6psw0XLgMGnPiLUf4DADekzH3lcvNs1XXUI1h1lv36gE0SrNI1+Pd8Q97lT3 cTQ+3U1q3VmtPgQmBVv9G6Jtaavos3gWgOFb4/NQGWM84CPU7VcGwq9T/sGJmU1fH0 Ux9ECluvYH1vsRnxoV04Dg/tPzuld4nHOkBQfJo82j7kmXbJQblGFmt3UvmTrM9Jdl qgFJrObBfzWx3053GvNLnpyqIQrxZEAUCpi+bX1vOxSsoaoyFqHyZNAac3wY8pVTus dBsdoDlrVsW2arplx/uqwbsjhJpSY0vXoM0EeBjLJzjs+pg6nXZVgAndEC2svAahQ4 xwkDEyP6Y8k4A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005ME-31; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 05/13] phy: qcom-qmp-usb: merge driver data Date: Mon, 24 Oct 2022 12:06:24 +0200 Message-Id: <20221024100632.20549-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563169848959318?= X-GMAIL-MSGID: =?utf-8?q?1747563169848959318?= The USB QMP PHY driver only manages a single PHY so merge the old qcom_qmp and qmp_phy structures and drop the PHY array. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 239 ++++++++++-------------- 1 file changed, 96 insertions(+), 143 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index f28883e0d21e..e009d63260e7 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -1453,60 +1453,30 @@ struct qmp_phy_cfg { unsigned int pcs_usb_offset; }; -/** - * struct qmp_phy - per-lane phy descriptor - * - * @phy: generic phy - * @cfg: phy specific configuration - * @serdes: iomapped memory space for phy's serdes (i.e. PLL) - * @tx: iomapped memory space for lane's tx - * @rx: iomapped memory space for lane's rx - * @pcs: iomapped memory space for lane's pcs - * @tx2: iomapped memory space for second lane's tx (in dual lane PHYs) - * @rx2: iomapped memory space for second lane's rx (in dual lane PHYs) - * @pcs_misc: iomapped memory space for lane's pcs_misc - * @pcs_usb: iomapped memory space for lane's pcs_usb - * @pipe_clk: pipe clock - * @qmp: QMP phy to which this lane belongs - * @mode: current PHY mode - */ -struct qmp_phy { - struct phy *phy; +struct qmp_usb { + struct device *dev; + const struct qmp_phy_cfg *cfg; + void __iomem *serdes; + void __iomem *pcs; + void __iomem *pcs_misc; + void __iomem *pcs_usb; void __iomem *tx; void __iomem *rx; - void __iomem *pcs; void __iomem *tx2; void __iomem *rx2; - void __iomem *pcs_misc; - void __iomem *pcs_usb; - struct clk *pipe_clk; - struct qcom_qmp *qmp; - enum phy_mode mode; -}; -/** - * struct qcom_qmp - structure holding QMP phy block attributes - * - * @dev: device - * @dp_com: iomapped memory space for phy's dp_com control block - * - * @clks: array of clocks required by phy - * @resets: array of resets required by phy - * @vregs: regulator supplies bulk data - * - * @phys: array of per-lane phy descriptors - */ -struct qcom_qmp { - struct device *dev; void __iomem *dp_com; + struct clk *pipe_clk; struct clk_bulk_data *clks; struct reset_control_bulk_data *resets; struct regulator_bulk_data *vregs; - struct qmp_phy **phys; + enum phy_mode mode; + + struct phy *phy; }; static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val) @@ -1976,10 +1946,10 @@ static void qmp_usb_configure(void __iomem *base, qmp_usb_configure_lane(base, tbl, num, 0xff); } -static int qmp_usb_serdes_init(struct qmp_phy *qphy) +static int qmp_usb_serdes_init(struct qmp_usb *qmp) { - const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *serdes = qphy->serdes; + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *serdes = qmp->serdes; const struct qmp_phy_init_tbl *serdes_tbl = cfg->serdes_tbl; int serdes_tbl_num = cfg->serdes_tbl_num; @@ -1990,10 +1960,9 @@ static int qmp_usb_serdes_init(struct qmp_phy *qphy) static int qmp_usb_init(struct phy *phy) { - struct qmp_phy *qphy = phy_get_drvdata(phy); - struct qcom_qmp *qmp = qphy->qmp; - const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *pcs = qphy->pcs; + struct qmp_usb *qmp = phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *pcs = qmp->pcs; void __iomem *dp_com = qmp->dp_com; int ret; @@ -2056,9 +2025,8 @@ static int qmp_usb_init(struct phy *phy) static int qmp_usb_exit(struct phy *phy) { - struct qmp_phy *qphy = phy_get_drvdata(phy); - struct qcom_qmp *qmp = qphy->qmp; - const struct qmp_phy_cfg *cfg = qphy->cfg; + struct qmp_usb *qmp = phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg = qmp->cfg; reset_control_bulk_assert(cfg->num_resets, qmp->resets); @@ -2071,19 +2039,18 @@ static int qmp_usb_exit(struct phy *phy) static int qmp_usb_power_on(struct phy *phy) { - struct qmp_phy *qphy = phy_get_drvdata(phy); - struct qcom_qmp *qmp = qphy->qmp; - const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *tx = qphy->tx; - void __iomem *rx = qphy->rx; - void __iomem *pcs = qphy->pcs; + struct qmp_usb *qmp = phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *tx = qmp->tx; + void __iomem *rx = qmp->rx; + void __iomem *pcs = qmp->pcs; void __iomem *status; unsigned int val; int ret; - qmp_usb_serdes_init(qphy); + qmp_usb_serdes_init(qmp); - ret = clk_prepare_enable(qphy->pipe_clk); + ret = clk_prepare_enable(qmp->pipe_clk); if (ret) { dev_err(qmp->dev, "pipe_clk enable failed err=%d\n", ret); return ret; @@ -2093,12 +2060,12 @@ static int qmp_usb_power_on(struct phy *phy) qmp_usb_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1); if (cfg->lanes >= 2) - qmp_usb_configure_lane(qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); + qmp_usb_configure_lane(qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); qmp_usb_configure_lane(rx, cfg->rx_tbl, cfg->rx_tbl_num, 1); if (cfg->lanes >= 2) - qmp_usb_configure_lane(qphy->rx2, cfg->rx_tbl, cfg->rx_tbl_num, 2); + qmp_usb_configure_lane(qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num, 2); qmp_usb_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); @@ -2122,27 +2089,27 @@ static int qmp_usb_power_on(struct phy *phy) return 0; err_disable_pipe_clk: - clk_disable_unprepare(qphy->pipe_clk); + clk_disable_unprepare(qmp->pipe_clk); return ret; } static int qmp_usb_power_off(struct phy *phy) { - struct qmp_phy *qphy = phy_get_drvdata(phy); - const struct qmp_phy_cfg *cfg = qphy->cfg; + struct qmp_usb *qmp = phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg = qmp->cfg; - clk_disable_unprepare(qphy->pipe_clk); + clk_disable_unprepare(qmp->pipe_clk); /* PHY reset */ - qphy_setbits(qphy->pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); + qphy_setbits(qmp->pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); /* stop SerDes and Phy-Coding-Sublayer */ - qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], + qphy_clrbits(qmp->pcs, cfg->regs[QPHY_START_CTRL], SERDES_START | PCS_START); /* Put PHY into POWER DOWN state: active low */ - qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + qphy_clrbits(qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); return 0; @@ -2175,22 +2142,22 @@ static int qmp_usb_disable(struct phy *phy) static int qmp_usb_set_mode(struct phy *phy, enum phy_mode mode, int submode) { - struct qmp_phy *qphy = phy_get_drvdata(phy); + struct qmp_usb *qmp = phy_get_drvdata(phy); - qphy->mode = mode; + qmp->mode = mode; return 0; } -static void qmp_usb_enable_autonomous_mode(struct qmp_phy *qphy) +static void qmp_usb_enable_autonomous_mode(struct qmp_usb *qmp) { - const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; - void __iomem *pcs_misc = qphy->pcs_misc; + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; + void __iomem *pcs_misc = qmp->pcs_misc; u32 intr_mask; - if (qphy->mode == PHY_MODE_USB_HOST_SS || - qphy->mode == PHY_MODE_USB_DEVICE_SS) + if (qmp->mode == PHY_MODE_USB_HOST_SS || + qmp->mode == PHY_MODE_USB_DEVICE_SS) intr_mask = ARCVR_DTCT_EN | ALFPS_DTCT_EN; else intr_mask = ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL; @@ -2211,11 +2178,11 @@ static void qmp_usb_enable_autonomous_mode(struct qmp_phy *qphy) qphy_clrbits(pcs_misc, QPHY_V3_PCS_MISC_CLAMP_ENABLE, CLAMP_EN); } -static void qmp_usb_disable_autonomous_mode(struct qmp_phy *qphy) +static void qmp_usb_disable_autonomous_mode(struct qmp_usb *qmp) { - const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; - void __iomem *pcs_misc = qphy->pcs_misc; + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; + void __iomem *pcs_misc = qmp->pcs_misc; /* Disable i/o clamp_n on resume for normal mode */ if (pcs_misc) @@ -2231,20 +2198,19 @@ static void qmp_usb_disable_autonomous_mode(struct qmp_phy *qphy) static int __maybe_unused qmp_usb_runtime_suspend(struct device *dev) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); - struct qmp_phy *qphy = qmp->phys[0]; - const struct qmp_phy_cfg *cfg = qphy->cfg; + struct qmp_usb *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; - dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qphy->mode); + dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->mode); - if (!qphy->phy->init_count) { + if (!qmp->phy->init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } - qmp_usb_enable_autonomous_mode(qphy); + qmp_usb_enable_autonomous_mode(qmp); - clk_disable_unprepare(qphy->pipe_clk); + clk_disable_unprepare(qmp->pipe_clk); clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); return 0; @@ -2252,14 +2218,13 @@ static int __maybe_unused qmp_usb_runtime_suspend(struct device *dev) static int __maybe_unused qmp_usb_runtime_resume(struct device *dev) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); - struct qmp_phy *qphy = qmp->phys[0]; - const struct qmp_phy_cfg *cfg = qphy->cfg; + struct qmp_usb *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; int ret = 0; - dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qphy->mode); + dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->mode); - if (!qphy->phy->init_count) { + if (!qmp->phy->init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; } @@ -2268,14 +2233,14 @@ static int __maybe_unused qmp_usb_runtime_resume(struct device *dev) if (ret) return ret; - ret = clk_prepare_enable(qphy->pipe_clk); + ret = clk_prepare_enable(qmp->pipe_clk); if (ret) { dev_err(dev, "pipe_clk enable failed, err=%d\n", ret); clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); return ret; } - qmp_usb_disable_autonomous_mode(qphy); + qmp_usb_disable_autonomous_mode(qmp); return 0; } @@ -2287,7 +2252,7 @@ static const struct dev_pm_ops qmp_usb_pm_ops = { static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); + struct qmp_usb *qmp = dev_get_drvdata(dev); int num = cfg->num_vregs; int i; @@ -2303,7 +2268,7 @@ static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) static int qmp_usb_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); + struct qmp_usb *qmp = dev_get_drvdata(dev); int i; int ret; @@ -2324,7 +2289,7 @@ static int qmp_usb_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) static int qmp_usb_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); + struct qmp_usb *qmp = dev_get_drvdata(dev); int num = cfg->num_clks; int i; @@ -2361,7 +2326,7 @@ static void phy_clk_release_provider(void *res) * clk | +-------+ | +-----+ * +---------------+ */ -static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np) +static int phy_pipe_clk_register(struct qmp_usb *qmp, struct device_node *np) { struct clk_fixed_rate *fixed; struct clk_init_data init = { }; @@ -2420,13 +2385,11 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np, return devm_of_iomap(dev, np, index, NULL); } -static -int qmp_usb_create(struct device *dev, struct device_node *np, int id, +static int qmp_usb_create(struct device *dev, struct device_node *np, void __iomem *serdes, const struct qmp_phy_cfg *cfg) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); + struct qmp_usb *qmp = dev_get_drvdata(dev); struct phy *generic_phy; - struct qmp_phy *qphy; bool exclusive = true; int ret; @@ -2439,81 +2402,75 @@ int qmp_usb_create(struct device *dev, struct device_node *np, int id, if (of_device_is_compatible(dev->of_node, "qcom,sm8350-qmp-usb3-uni-phy")) exclusive = false; - qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); - if (!qphy) - return -ENOMEM; - - qphy->cfg = cfg; - qphy->serdes = serdes; + qmp->cfg = cfg; + qmp->serdes = serdes; /* * Get memory resources for the PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx = devm_of_iomap(dev, np, 0, NULL); - if (IS_ERR(qphy->tx)) - return PTR_ERR(qphy->tx); + qmp->tx = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qmp->tx)) + return PTR_ERR(qmp->tx); - qphy->rx = devm_of_iomap(dev, np, 1, NULL); - if (IS_ERR(qphy->rx)) - return PTR_ERR(qphy->rx); + qmp->rx = devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qmp->rx)) + return PTR_ERR(qmp->rx); - qphy->pcs = qmp_usb_iomap(dev, np, 2, exclusive); - if (IS_ERR(qphy->pcs)) - return PTR_ERR(qphy->pcs); + qmp->pcs = qmp_usb_iomap(dev, np, 2, exclusive); + if (IS_ERR(qmp->pcs)) + return PTR_ERR(qmp->pcs); if (cfg->pcs_usb_offset) - qphy->pcs_usb = qphy->pcs + cfg->pcs_usb_offset; + qmp->pcs_usb = qmp->pcs + cfg->pcs_usb_offset; if (cfg->lanes >= 2) { - qphy->tx2 = devm_of_iomap(dev, np, 3, NULL); - if (IS_ERR(qphy->tx2)) - return PTR_ERR(qphy->tx2); + qmp->tx2 = devm_of_iomap(dev, np, 3, NULL); + if (IS_ERR(qmp->tx2)) + return PTR_ERR(qmp->tx2); - qphy->rx2 = devm_of_iomap(dev, np, 4, NULL); - if (IS_ERR(qphy->rx2)) - return PTR_ERR(qphy->rx2); + qmp->rx2 = devm_of_iomap(dev, np, 4, NULL); + if (IS_ERR(qmp->rx2)) + return PTR_ERR(qmp->rx2); - qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL); + qmp->pcs_misc = devm_of_iomap(dev, np, 5, NULL); } else { - qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); + qmp->pcs_misc = devm_of_iomap(dev, np, 3, NULL); } - if (IS_ERR(qphy->pcs_misc)) { + if (IS_ERR(qmp->pcs_misc)) { dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); - qphy->pcs_misc = NULL; + qmp->pcs_misc = NULL; } - qphy->pipe_clk = devm_get_clk_from_child(dev, np, NULL); - if (IS_ERR(qphy->pipe_clk)) { - return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk), - "failed to get lane%d pipe clock\n", id); + qmp->pipe_clk = devm_get_clk_from_child(dev, np, NULL); + if (IS_ERR(qmp->pipe_clk)) { + return dev_err_probe(dev, PTR_ERR(qmp->pipe_clk), + "failed to get pipe clock\n"); } generic_phy = devm_phy_create(dev, np, &qmp_usb_ops); if (IS_ERR(generic_phy)) { ret = PTR_ERR(generic_phy); - dev_err(dev, "failed to create qphy %d\n", ret); + dev_err(dev, "failed to create PHY: %d\n", ret); return ret; } - qphy->phy = generic_phy; - qphy->qmp = qmp; - qmp->phys[id] = qphy; - phy_set_drvdata(generic_phy, qphy); + qmp->phy = generic_phy; + phy_set_drvdata(generic_phy, qmp); return 0; } static int qmp_usb_probe(struct platform_device *pdev) { - struct qcom_qmp *qmp; struct device *dev = &pdev->dev; struct device_node *child; struct phy_provider *phy_provider; void __iomem *serdes; const struct qmp_phy_cfg *cfg = NULL; + struct qmp_usb *qmp; int num, id; int ret; @@ -2555,10 +2512,6 @@ static int qmp_usb_probe(struct platform_device *pdev) if (num > 1) return -EINVAL; - qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL); - if (!qmp->phys) - return -ENOMEM; - pm_runtime_set_active(dev); ret = devm_pm_runtime_enable(dev); if (ret) @@ -2572,7 +2525,7 @@ static int qmp_usb_probe(struct platform_device *pdev) id = 0; for_each_available_child_of_node(dev->of_node, child) { /* Create per-lane phy */ - ret = qmp_usb_create(dev, child, id, serdes, cfg); + ret = qmp_usb_create(dev, child, serdes, cfg); if (ret) { dev_err(dev, "failed to create lane%d phy, %d\n", id, ret); From patchwork Mon Oct 24 10:06:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358090wru; Mon, 24 Oct 2022 03:07:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qYI8PV/3fcIv3Z7i9iqybWptvU5J7U88pGDL6tq9txbTr2SqqzQPqVGIzc/NzjwZI64cM X-Received: by 2002:a05:6a00:1810:b0:56b:f29d:cc8e with SMTP id y16-20020a056a00181000b0056bf29dcc8emr1761516pfa.33.1666606072682; Mon, 24 Oct 2022 03:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606072; cv=none; d=google.com; s=arc-20160816; b=FFbMPjmIGTK2h81e8OgG47nLyoJD6Cn3hqjHGkVbwaym6kdYnTFzhd20uApbXOxyxC Ni39gAW6GSWLP/N6dXfR5ZQxU6lAe3lCtDPuGUL8fp3yjLHTeCeRmRpDwTD1AwdE37CQ HUG0hgfSt6+AjGwhhcxML9HKyjZ59i75Lsb8xucomvBVzghsW9gkf+AGvfVLPH+Awj/2 IkWggvlar1dQe8U/NnjhhDdAERlpKxrOnM1a7u4QL2kPnha1uKk248WFCr6TjcMJJMCi /oDUq9uaTrgH0YYd6rYxz4Ky26+mMECF2cfdFNquI+wx+Jlt+zIEtXmPIr9gILwcFzfx 6mmg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=faB9CZdL8RZ2VIntSoJV4V1o33EjKs7bwnXwYHjM8UA=; b=TZEGmbgS2uQAO+XpqP1rZt6wjvmjfyr+V1pbFkOqJKmmx7fj6LuX2OWgHY+z3Cyc8B Tr6l4KCG0KZS3/a3t08t6JDiQC6RtyhzKsKRuSL3c73fTh2YLnXCbHcVoGGHtJbVs+AJ 9HmrSA/X73yuu3dTrCUMcKhyS3I+mlaFUjxkyR42ZG56POqJOlFUIlh0CEw2YkYZDhcq DoXGCz0WsMIfw5Nq9eni8qLfNt+bLTYfbwLuMTs/Lbc8jHKWMqA7e0q6sWn5Hkuf4Naa /aETtUDRWJje87mbminuC+j/eYomjeW4599tNhWJzqsxv1Z5RUGt1Bud0/oqckwKfUQO prSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fZOzXIUk; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pt1-20020a17090b3d0100b002131d141ff5si1703500pjb.117.2022.10.24.03.07.39; Mon, 24 Oct 2022 03:07:52 -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=@kernel.org header.s=k20201202 header.b=fZOzXIUk; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230455AbiJXKHR (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229730AbiJXKHJ (ORCPT ); Mon, 24 Oct 2022 06:07:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E631E33E08; Mon, 24 Oct 2022 03:07:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 75E79611B3; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 538C9C4347C; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=PEit2jIpLlK9bUU+cJjrQ+dNfgmnYX9dhRSclH2YI4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZOzXIUkJ1DGrg56weHIwToQSxV84wnvlQoYIcee6JGfsA8tNIlh81YZYIAxgihTb /8gdvrJUgPgM4BW4uLNpgprFw1c0PtRCwL+ems5nP1z71FD9VO+0jA4ZtdZE1HMyHw sl7B5ZQVJrb+7VsPIlNgWpkZnDeJO6k57TGvqttN1CZ8KAWGMP5L0ZDuqoBftxOf/U ltIhNQrqjdy6BqGVSPvTHP4D8QwIdg0mjbh9S74ih3KCO2KVZInaBV49IVOzscC9h9 1n1/rC2oEPwXKxw3PNl99FQ5SdFte3bTbgQUnbNaaZIztRcGToqxxYgbpBfuPH7LLd Xhz+tSIHoZvFA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005MJ-5h; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 06/13] phy: qcom-qmp-usb: clean up device-tree parsing Date: Mon, 24 Oct 2022 12:06:25 +0200 Message-Id: <20221024100632.20549-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563129100603983?= X-GMAIL-MSGID: =?utf-8?q?1747563129100603983?= Since the QMP driver split there will be at most a single child node so drop the obsolete iteration construct. While at it, drop the verbose error logging that would have been printed also on probe deferrals. Note that there's no need to check if there are additional child nodes (the kernel is not a devicetree validator), but let's return an error if there are no child nodes at all for now. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 40 ++++++++----------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index e009d63260e7..ccb834a08d5b 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2471,7 +2471,6 @@ static int qmp_usb_probe(struct platform_device *pdev) void __iomem *serdes; const struct qmp_phy_cfg *cfg = NULL; struct qmp_usb *qmp; - int num, id; int ret; qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); @@ -2507,44 +2506,29 @@ static int qmp_usb_probe(struct platform_device *pdev) if (ret) return ret; - num = of_get_available_child_count(dev->of_node); - /* do we have a rogue child node ? */ - if (num > 1) + child = of_get_next_available_child(dev->of_node, NULL); + if (!child) return -EINVAL; pm_runtime_set_active(dev); ret = devm_pm_runtime_enable(dev); if (ret) - return ret; + goto err_node_put; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. */ pm_runtime_forbid(dev); - id = 0; - for_each_available_child_of_node(dev->of_node, child) { - /* Create per-lane phy */ - ret = qmp_usb_create(dev, child, serdes, cfg); - if (ret) { - dev_err(dev, "failed to create lane%d phy, %d\n", - id, ret); - goto err_node_put; - } - - /* - * Register the pipe clock provided by phy. - * See function description to see details of this pipe clock. - */ - ret = phy_pipe_clk_register(qmp, child); - if (ret) { - dev_err(qmp->dev, - "failed to register pipe clock source\n"); - goto err_node_put; - } - - id++; - } + ret = qmp_usb_create(dev, child, serdes, cfg); + if (ret) + goto err_node_put; + + ret = phy_pipe_clk_register(qmp, child); + if (ret) + goto err_node_put; + + of_node_put(child); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); From patchwork Mon Oct 24 10:06:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358076wru; Mon, 24 Oct 2022 03:07:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EwGNxdvW4FQyNxXCNputK1xbMfjW77xFi+7pw2XYojSjGvlgaXZn5jFZUmZ3M/8uy5hDS X-Received: by 2002:a63:fd48:0:b0:46e:d8b1:8243 with SMTP id m8-20020a63fd48000000b0046ed8b18243mr10259035pgj.350.1666606068976; Mon, 24 Oct 2022 03:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606068; cv=none; d=google.com; s=arc-20160816; b=pWkbNyMZLixBYi9rRWmDgka9AMqitcA3zVCzCNJD3tnReCtPDbSe+LjDLlnDWamwH2 idbeWs0LSHJts0nklEFV91h12p8sWbB7NuEOFQMAuPvS/5RCkMu9AgAs4C5uMpBHaExS uIyHKjmZgbdlxAYZVHP9zRaX2QKzwXjnW19fjOFdEB+qFThFQM6qX0/HIB2Fyc2Wmil2 aSlocBNHLv8M/o3fzOAmO2nfO24FuPmw+rzhwMW1l7q6saRIruKkgrosei/w3bBYF5i1 zumz9kHewNM8WvVogtICSHt5XbvGyckURiCvMqDjEp0SR9nnFuNxZIxlipaUveOlEhEV MUFw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eIoNzIIxLCemBII2dm3y3omH/aSOqwUUej7BbtWduyg=; b=vuUPdVLxgc62xlQmeSjc8gn1HX3GCi2cc7dUctS+f05TOWRQiGgP62s0QV7KepODdD rBpVKri0scOde85p0UzvhtclJu6DYePkNrI5kfl9ke5+m17V7tRcwKRZHIBg4Cw/WF7p oyjfKTYLnX+hhm2HBeAoUuZbbd+86Rs2juWckfGrgZh7ZTPxQrv1DMjS7/GElLD8A9Bh 2pl+X8Grzij/PltwSlpFKt7puXzODX9MitOU8C/wNcC6HYooKK9V6iFaTI9PZwMPFsUz l5ir0H7B9O9q9M/qpbFhPPyoG+xOvt4whKffhfUfmTxi2pXShjLVnUQxALSso25ZWDGv 5WSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JFaUB3fw; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a1709029b8300b0017c2a42fc8csi31549183plp.270.2022.10.24.03.07.35; Mon, 24 Oct 2022 03:07:48 -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=@kernel.org header.s=k20201202 header.b=JFaUB3fw; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230430AbiJXKHN (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230214AbiJXKHJ (ORCPT ); Mon, 24 Oct 2022 06:07:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BABB1A07B; Mon, 24 Oct 2022 03:07:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F188F611B0; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 501D9C43470; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=qT9xd2ZxMnnwGXQobvtyOi93Q/igV97gvEakODESvZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JFaUB3fwVC2/HyAJmEyBTK/n5dpGRbXpCoQKmWApXIrs9LkZ5U+U/KWYcySdW9fOf fB42xW8hU6Ln9IrgI3oSnfYR55CEag5BO6vHkDRH0TFC+NNu7azKp5wxcVFvumrXVo 34d8aLhqV4hm0m4xdR4UPECCNl59nc6daXQSYFgseDrCmkiBtTcoVOIj6W3Y2ftf2H lyRobXruCaCqKo4WTzE7iisplXY9p8vSALRWol0PiWFSXo/Cinrv3ibyES5Ff1dVlk hE7P+cAIojZnsIaR7AxrnkLO0l9J3pXfsQEf5LEfUWyvUO5jkH3R9NimJ1QFm8Mmjc fZk5LrVOOQosA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005MM-8D; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 07/13] phy: qcom-qmp-usb: clean up probe initialisation Date: Mon, 24 Oct 2022 12:06:26 +0200 Message-Id: <20221024100632.20549-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563125413294299?= X-GMAIL-MSGID: =?utf-8?q?1747563125413294299?= Stop abusing the driver data pointer and instead pass the driver state structure directly to the initialisation helpers during probe. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 46 ++++++++++++------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index ccb834a08d5b..2e603831e45e 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2250,9 +2250,10 @@ static const struct dev_pm_ops qmp_usb_pm_ops = { qmp_usb_runtime_resume, NULL) }; -static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) +static int qmp_usb_vreg_init(struct qmp_usb *qmp) { - struct qmp_usb *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + struct device *dev = qmp->dev; int num = cfg->num_vregs; int i; @@ -2266,9 +2267,10 @@ static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) return devm_regulator_bulk_get(dev, num, qmp->vregs); } -static int qmp_usb_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) +static int qmp_usb_reset_init(struct qmp_usb *qmp) { - struct qmp_usb *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + struct device *dev = qmp->dev; int i; int ret; @@ -2287,9 +2289,10 @@ static int qmp_usb_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) return 0; } -static int qmp_usb_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) +static int qmp_usb_clk_init(struct qmp_usb *qmp) { - struct qmp_usb *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + struct device *dev = qmp->dev; int num = cfg->num_clks; int i; @@ -2385,10 +2388,10 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np, return devm_of_iomap(dev, np, index, NULL); } -static int qmp_usb_create(struct device *dev, struct device_node *np, - void __iomem *serdes, const struct qmp_phy_cfg *cfg) +static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) { - struct qmp_usb *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + struct device *dev = qmp->dev; struct phy *generic_phy; bool exclusive = true; int ret; @@ -2402,8 +2405,6 @@ static int qmp_usb_create(struct device *dev, struct device_node *np, if (of_device_is_compatible(dev->of_node, "qcom,sm8350-qmp-usb3-uni-phy")) exclusive = false; - qmp->cfg = cfg; - qmp->serdes = serdes; /* * Get memory resources for the PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. @@ -2468,8 +2469,6 @@ static int qmp_usb_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *child; struct phy_provider *phy_provider; - void __iomem *serdes; - const struct qmp_phy_cfg *cfg = NULL; struct qmp_usb *qmp; int ret; @@ -2478,31 +2477,30 @@ static int qmp_usb_probe(struct platform_device *pdev) return -ENOMEM; qmp->dev = dev; - dev_set_drvdata(dev, qmp); - cfg = of_device_get_match_data(dev); - if (!cfg) + qmp->cfg = of_device_get_match_data(dev); + if (!qmp->cfg) return -EINVAL; - serdes = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(serdes)) - return PTR_ERR(serdes); + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(qmp->serdes)) + return PTR_ERR(qmp->serdes); - if (cfg->has_phy_dp_com_ctrl) { + if (qmp->cfg->has_phy_dp_com_ctrl) { qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(qmp->dp_com)) return PTR_ERR(qmp->dp_com); } - ret = qmp_usb_clk_init(dev, cfg); + ret = qmp_usb_clk_init(qmp); if (ret) return ret; - ret = qmp_usb_reset_init(dev, cfg); + ret = qmp_usb_reset_init(qmp); if (ret) return ret; - ret = qmp_usb_vreg_init(dev, cfg); + ret = qmp_usb_vreg_init(qmp); if (ret) return ret; @@ -2520,7 +2518,7 @@ static int qmp_usb_probe(struct platform_device *pdev) */ pm_runtime_forbid(dev); - ret = qmp_usb_create(dev, child, serdes, cfg); + ret = qmp_usb_create(qmp, child); if (ret) goto err_node_put; From patchwork Mon Oct 24 10:06:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358730wru; Mon, 24 Oct 2022 03:09:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5z1GS0PclLXIfcNPc5G1t31PyDm3/r0unQHOC2ValEFHWRpKgnWepjTiqEqNGk64ZYxCQY X-Received: by 2002:a17:90b:38d2:b0:20d:8f2a:c4ba with SMTP id nn18-20020a17090b38d200b0020d8f2ac4bamr37906516pjb.209.1666606178348; Mon, 24 Oct 2022 03:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606178; cv=none; d=google.com; s=arc-20160816; b=ff8974IUaJ7qumIQ1kkdp/kdx84qkWSubtZqCCLl+WEPzUET9HgQz2JLTnNm7J4owB uT13hCHniyl3Osb3i7Th3edsLIAJLWfUHf1ORG2RozU9xw9Ub9lch0Ifs8fxCgqUjT81 AgkmPs55uy4nBhDXGLAetb8OiqF+vOMOPYcTvDvI3gOEARiZU+/QQxWx97ZVSB8C9Ofv GKto+B16JqYwxSkSIYv9HZd59cLlJ9mEE3pVN8bWdWYUNa8XQWp/0VjPG5YhbcE+3hps EO3rjADSv/EFsoH5ZRFoj4j0zexelC7iBWOLA97Y4YeEDMZafnkZcFvfAVxfvlKU1/RS M4jA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r5Za0dLwXJA54sSYHj6c03JoddUDs70S66iGL7Z3DiI=; b=GAd4+OAfm+FugprLhxEJByOCMdjFJjvfPoYMiINXvY9fhDBT07XTdymjKNkKU/GNjx DBwI/DRlFp5vQbHymSxVHMd3JhHRTUue13U8yde8ZGXwaj6+duTqAcfRyjfPrzNi/0X+ ImyO7VodSat3F+V5lSvgLp5VCkFiI+8pEcmwRRtLfslvb6ep1ui1tmQvsr3lLYDGoxZn uGtrqvQsHzwftrY8AKeEc1EtBby0XOAikIKgaabmPTuse1rosUYG3kmJ62gF6u5gzAIm sjdEn6ZinUv04c2IPJPAeGPGVMJcgC8XCI9tn7NZkt2yPlaUtVSsrZtRGIh+rWcFHkmo gZ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TJAtkfLh; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a170902ea0500b0018010c3d7e3si27864967plg.404.2022.10.24.03.09.25; Mon, 24 Oct 2022 03:09:38 -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=@kernel.org header.s=k20201202 header.b=TJAtkfLh; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231231AbiJXKIK (ORCPT + 99 others); Mon, 24 Oct 2022 06:08:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230410AbiJXKHM (ORCPT ); Mon, 24 Oct 2022 06:07:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB954B98C; Mon, 24 Oct 2022 03:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 93091611BB; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2DFCC4FEB5; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=Tm4gmSInyHHH6+chy2xagbTkIvb1pK5cY/1WuEhyaH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TJAtkfLhiUdBvonF1zrurKl0vzN8LUXwdtbm0iFYw40NkNAewds8gGTeQjaKLmErG /Z2tBxodiExjto/QPHO7reX4OGgQmdYGSYTgnGihDodxotmVp6u8UmTirSLtEt0vY9 4SKzlj/LcTEBJjw8KTAUwLH9G5H07KvKkG7ZNmK6tOo3zatrE5CHJhuZ3k+sBm4R3z YCEftXnoWRuxCmZEhd6Zlb3Dk6HmaUS8ZKZq2u/NL1druWk4tnKPvR2BiXZP1hM0pa 62GqgB1Q3CfyGtGUeBUnxEK+mdGOVB4fbwqaW0LZ2uj7lIABVRyt1xseSvFf7XZUNb eicQwEgrym4rw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005MV-BS; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 08/13] phy: qcom-qmp-usb: rename PHY ops structure Date: Mon, 24 Oct 2022 12:06:27 +0200 Message-Id: <20221024100632.20549-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563240304919252?= X-GMAIL-MSGID: =?utf-8?q?1747563240304919252?= Rename the PHY operation structure so that it has a "phy_ops" suffix and move it next to the implementation. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 2e603831e45e..4a7b961d2965 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2149,6 +2149,13 @@ static int qmp_usb_set_mode(struct phy *phy, enum phy_mode mode, int submode) return 0; } +static const struct phy_ops qmp_usb_phy_ops = { + .init = qmp_usb_enable, + .exit = qmp_usb_disable, + .set_mode = qmp_usb_set_mode, + .owner = THIS_MODULE, +}; + static void qmp_usb_enable_autonomous_mode(struct qmp_usb *qmp) { const struct qmp_phy_cfg *cfg = qmp->cfg; @@ -2366,13 +2373,6 @@ static int phy_pipe_clk_register(struct qmp_usb *qmp, struct device_node *np) return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np); } -static const struct phy_ops qmp_usb_ops = { - .init = qmp_usb_enable, - .exit = qmp_usb_disable, - .set_mode = qmp_usb_set_mode, - .owner = THIS_MODULE, -}; - static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np, int index, bool exclusive) { @@ -2451,7 +2451,7 @@ static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) "failed to get pipe clock\n"); } - generic_phy = devm_phy_create(dev, np, &qmp_usb_ops); + generic_phy = devm_phy_create(dev, np, &qmp_usb_phy_ops); if (IS_ERR(generic_phy)) { ret = PTR_ERR(generic_phy); dev_err(dev, "failed to create PHY: %d\n", ret); From patchwork Mon Oct 24 10:06:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358374wru; Mon, 24 Oct 2022 03:08:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Vwz/CWJpHEq4vb9NnjWdOKfM9UM8+8nRVOFT2QLETl13VU3yPco6GJeOMFHlXQKJb/RaR X-Received: by 2002:a05:6a00:8cc:b0:52c:7ab5:2ce7 with SMTP id s12-20020a056a0008cc00b0052c7ab52ce7mr32620570pfu.28.1666606116358; Mon, 24 Oct 2022 03:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606116; cv=none; d=google.com; s=arc-20160816; b=mJJGfSOoc1d7oF9p2ipNAys25eeKgYy6FMiBGfXbY7L5eS7OKRYJOhOyWv6bguX0RO nMFmg78RhkG4peKBa2pK8WQPo9OkGYH9sueBwW0k5EDsFJoKhp54vK/bJT8KbIV9+Nuo DyyXtJrZYft3oIk37WxsbQp0cR2Hn2KUOc2DDVil3P3NEYBzvPEg4AV/PPJzuK6NsPkd Ni0F0Gc0oe2+mXdxOKx/fxb9uA+8dgQ+UyIhIqiFsgKUgDaWc2ElY3IHAg1PCcNYwtrl jmKpk9bN9dr97SGUBBUrhk0U6kPX5CbTsa9PxwCwfyHfw8EZ9YfaliMyAS9wfGnZHCry cb4g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=X6ZYAaAiHBvPMye8rW1S0tJodTkHsJEyHBPGEWF3rmQ=; b=qx1pZHUO9/AzIJt/xmLysOyC5zGGE1MlDAgt4okD+dPBdY/LTgVign3Smsa+XpVb1M 3QdHOm8Q8pA96pJptJsgAiKkMH16X06zLgs9EAUJ5kPNlKTshR+CG+0v94EqcSZ0Ipnk G3W29DV4k3/PHBlZ+mtgbJmgdPlL63AWp6lflllyy61B7U4XpPGlb3mZwWFSOb3t4v+c BvNfXsPAJDM6h3NfmmlgPefJ6D0cjfw0uCGzd/+kOMrrMgjChtOKiR8Sl3PckZDLB1Y5 55p4H23CpeUv2qxCg+bgg97MFBOX8mdG+TWtwC5PKusnWFUaQMWjltHgRFrXCTrviF2B 3FTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PJ4s9yS5; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a170902c61200b0017f641cac01si13187697plr.27.2022.10.24.03.08.23; Mon, 24 Oct 2022 03:08:36 -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=@kernel.org header.s=k20201202 header.b=PJ4s9yS5; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230517AbiJXKHs (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbiJXKHK (ORCPT ); Mon, 24 Oct 2022 06:07:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 299C84B4BD; Mon, 24 Oct 2022 03:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B748611B1; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC285C4167D; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=RyDjfkXeUvujKcmZYfnPRH9u4YqHbTjNf4y55UFXH7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJ4s9yS5XLqbbKHf7QVKqRWV34Bk3tWALy77F4xypyxAoETPSjyYm9xOEHRSy831Q ECeB62kLRjG93325RJisvz8fgPvHF5j1aH/a9CsMIxwu5wboyPujEQIhE+LARFPnf1 x6lYp3y4dEXfIPVP5ckkWKEIGZtJIW0fG8bYscJ8uDGIGLdbsNOEUGpK5jgZiA4fLp ZTPmgcqHN6ZOlUQiluAJuP3ph4I41h5yOVuFdIARu3uxft+rgn/nP+JEE8IZW3ctJ0 P9rBrgUEO0azPJx+sa/rBMRlegnMgCF3oRkPQ/iVNCLnU8Sfg1QmVixowPde5k+AXB 0zJmdC3DKCZ6A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005MY-EM; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 09/13] phy: qcom-qmp-usb: clean up PHY init Date: Mon, 24 Oct 2022 12:06:28 +0200 Message-Id: <20221024100632.20549-10-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563174791928994?= X-GMAIL-MSGID: =?utf-8?q?1747563174791928994?= Clean up the PHY initialisation somewhat by programming both tx and rx for the second lane after the first lane. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 4a7b961d2965..d5e62cfd93f8 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2058,14 +2058,12 @@ static int qmp_usb_power_on(struct phy *phy) /* Tx, Rx, and PCS configurations */ qmp_usb_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1); - - if (cfg->lanes >= 2) - qmp_usb_configure_lane(qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); - qmp_usb_configure_lane(rx, cfg->rx_tbl, cfg->rx_tbl_num, 1); - if (cfg->lanes >= 2) + if (cfg->lanes >= 2) { + qmp_usb_configure_lane(qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); qmp_usb_configure_lane(qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num, 2); + } qmp_usb_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); From patchwork Mon Oct 24 10:06:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp363572wru; Mon, 24 Oct 2022 03:21:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ad/0t9HsnM7UEKjOxrHS/5QHzONX4DfrGqGLMeqXFvfc5zzl/ePpcKfSutEOUWNn7tSUT X-Received: by 2002:a05:6a02:10e:b0:43b:e57d:2bfa with SMTP id bg14-20020a056a02010e00b0043be57d2bfamr27117366pgb.263.1666606874013; Mon, 24 Oct 2022 03:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606874; cv=none; d=google.com; s=arc-20160816; b=AJp62tQeiRa+SrryGB5Z7F+pg2f7JpmuD0CN/gfMeqqyCfo8oOEQSiSSyH/b4sspF6 EkgvQVCJt98boze13CgCnXvIeWfImYiHsuSZIgCGtdG0OSXYHdMpYJW1QsVH9Q/xCjcf 4PcxxhgXaxH2NHcVwZyXdmbkgKp7C4RixuaA5DcEOMh6zI4BXcZ1zQsZZ5uFE1LHcZkw p+wkFCl/lWJyhj5PGdkcCW6OM/bsDNcM/3VdNJQ+8v82Opt64qj3FKIH0QCyUSA2usXT d3679eZQNHBaRLc8zDdNn+7AY+esrEC456GcDrArKFRff/6urFpiOF1j77b8ZHyX+9dg rGcQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8jIGZeBPvQVC9gzBYxqAE9+loRMCIBQeQKP/p8GgU2g=; b=Pmengik9AzPsOyS2veJV2+/HHL/tf2kym34EZhI5BYhlkzVahaQ8uacMc+N58B1XTc vRkphoYe8Vx44PvXIb8ES2OtsmX3hIQPq/IopiwoNNBq/s6I3xV84Rns8Gcf7ZBdBEpA ym5/pGOybQfqZ6vOgD8U2SvOnA40xVWtntnZY8Yk5X+mMcz/ubO6j/RhxrnKhLumC6ut rlvEhNV5yomu1nLSo513M9ncvtZZchF1fzCphuNd5j/WT1g2zQ6ihmgju5DLe7xurIP4 JF0siF/LxZ4CgO109lx3iPTW0+8wRgwvidCcvI2yf4ItuN2zCgZ0+tgt4E1GTCeqLKBx LwNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jULMA8FG; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a056a00088500b00565c028c4edsi36342232pfj.355.2022.10.24.03.21.00; Mon, 24 Oct 2022 03:21:14 -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=@kernel.org header.s=k20201202 header.b=jULMA8FG; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbiJXKIU (ORCPT + 99 others); Mon, 24 Oct 2022 06:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbiJXKHK (ORCPT ); Mon, 24 Oct 2022 06:07:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 281466432; Mon, 24 Oct 2022 03:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F551611B9; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC24FC43160; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=oXPXYrr8xsw0e6647Mk5oRSxMADSBNVRiAcUXclN6lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jULMA8FGdLv7B22fUsU+M5jm6Fvcbi+Ft5Bwi0jKtGM0XSrzvckT8lwwhX6NQVWch ZhJZF8UywKd7zdm+DtFRkUWWx7VNt6NBQY+Mpkko00JMgDl0nEZncCsF8ts1ItrXzM DCU7kEvoa5ghCYJSLiRW6KvQCbtEt5LHwb1vDoPmR4VtvnvtZpH7suUU6E0vphBL5O AuALfv+Oay3i4ug6m4LsQW6EgIskAbfzBW59vYsrX9wrtjIitCAOpAs6VM0YzvCfaU g+n2bh12FcyQ7C0rbFFbwRDnWts86v9s2g3635O5S+ojlmZTpZs6EQRhFxUNNFxzTn IPWRck1LwyTBg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005Md-HG; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 10/13] dt-bindings: phy: qcom,qmp-usb: rename current bindings Date: Mon, 24 Oct 2022 12:06:29 +0200 Message-Id: <20221024100632.20549-11-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563969539279565?= X-GMAIL-MSGID: =?utf-8?q?1747563969539279565?= The current QMP USB PHY bindings are based on the original MSM8996 binding which provided multiple PHYs per IP block and these in turn were described by child nodes. Later QMP USB PHY blocks only provide a single PHY and the remnant child node does not really reflect the hardware. The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes. This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the per lane PCS registers). In preparation for adding new bindings for SC8280XP which further bindings can be based on, rename the current bindings after MSM8996 and add a reference to the SC8280XP bindings. Signed-off-by: Johan Hovold Reviewed-by: Krzysztof Kozlowski --- ...qcom,qmp-usb-phy.yaml => qcom,msm8996-qmp-usb-phy.yaml} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename Documentation/devicetree/bindings/phy/{qcom,qmp-usb-phy.yaml => qcom,msm8996-qmp-usb-phy.yaml} (97%) diff --git a/Documentation/devicetree/bindings/phy/qcom,qmp-usb-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb-phy.yaml similarity index 97% rename from Documentation/devicetree/bindings/phy/qcom,qmp-usb-phy.yaml rename to Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb-phy.yaml index 7acb4b7de7f9..a72e96f241d1 100644 --- a/Documentation/devicetree/bindings/phy/qcom,qmp-usb-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb-phy.yaml @@ -1,10 +1,10 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/phy/qcom,qmp-usb-phy.yaml# +$id: http://devicetree.org/schemas/phy/qcom,msm8996-qmp-usb-phy.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Qualcomm QMP PHY controller (USB) +title: Qualcomm QMP PHY controller (USB, MSM8996) maintainers: - Vinod Koul @@ -13,6 +13,9 @@ description: QMP PHY controller supports physical layer functionality for a number of controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB. + Note that these bindings are for SoCs up to SC8180X. For newer SoCs, see + qcom,sc8280xp-qmp-usb-phy.yaml. + properties: compatible: enum: From patchwork Mon Oct 24 10:06:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358501wru; Mon, 24 Oct 2022 03:09:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5c5yH583Sd97Iul2Jn1BllwR2EHrP/X3RfXxOsLW4lBXURSmdQ1U2rjoyKXHsW0KBpy784 X-Received: by 2002:a05:6a00:218d:b0:569:84e0:19e5 with SMTP id h13-20020a056a00218d00b0056984e019e5mr20883938pfi.11.1666606142738; Mon, 24 Oct 2022 03:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606142; cv=none; d=google.com; s=arc-20160816; b=JA1krE4VOzgFCj9u1WBFpdEG+iyVk+PjxbJ9DsmPS7my/kuFT+yKPmzDqfutqhMI7q infM2NKrpkbgi2HBinrVUiZj8igeMXXlx1HnC3ym1cJwJBdhFIploG2r9+AlXBaR8qFx lvgY07xM1fEu6LIvnAaQXwAVGUj0TsXCqrbRExxvJJKPxODUPy3vluaz4rO8QgurKEVC +PQDuejUjTrvWqXuHQF/qeWdqbZVlZmiW/conxga13zP08xsTk4H5IEMw9saN60PBTDl oQhIRyuPGa6QbA9pezASaJYuEgah4VQDpcAFgaQooPqNBVfRbyhQtD6roCq9sQREiuQc O9eQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TkCr3TJNl0Y8TpbXVJuUYEG6yDK9xr8PLC0LxKLkAAk=; b=yZJ2RwGLdB3I0lceOkcYI2sz9d0VeI712y3SuK8kss+gGks3ZkkUlh3SW35zNQYro7 bb8FW1muBp5B2HsbFAdWJwKVCQATWBRyggawFCUvyBxEXdRuATxfnDIGZXtsK0EN0atb GU/0fM8TnYol/22Or6xTJa0QAmbCiYttLJWv3C6gYm+LCIZjZfYSHveNSoymw75LbsLv fScUF0C5qikdXPYt+4/a6GPgefN+m0B2IKPOTmk6BXw+59HDojOmEeKCgswaKa5CdiYR XH9P+bjMss0WGhGmblDWdSerCh5KyGpYBRY6Hy7rh1xtZUfkH/g/0Z/3bZ8+IxZP0oGg knlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vFGJEgFG; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902e80600b001781f860a6dsi40755171plg.228.2022.10.24.03.08.50; Mon, 24 Oct 2022 03:09:02 -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=@kernel.org header.s=k20201202 header.b=vFGJEgFG; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230388AbiJXKIG (ORCPT + 99 others); Mon, 24 Oct 2022 06:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbiJXKHM (ORCPT ); Mon, 24 Oct 2022 06:07:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA3A33E08; Mon, 24 Oct 2022 03:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 160CA611C1; Mon, 24 Oct 2022 10:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFAE3C4FEBC; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=NJAwVbdMAk/rD+rBNAeavqkcMVTVV3xeAlC+sLKCmj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vFGJEgFGrFyQMn94qeHXpnc3Umc9LuEaJ7wPROSrdSViyuzzcgdIznrEOtfem896X NSKddvKSYYc94Do2ng6LjxRq33iCkR2VCo0ZHLMJERrT+2tCaHGos/LbZtn4b2qzro BI8l2U67Qq4Of5Ksc4logpZiPB6p8HkDaXL4MSwrZjogbHwncCIxkm730IN67cNiqc fyCNbl7S3o6emDXcVHbTX2J8PmzrNCgGUvZMBKg5OoRgCHg4X1j125+aMfeuft0YoU mJ7jFNN5iX4TFJl56kuCD+imG8QwV1wUbO6kJGdqkMAFWvy8P4J1W3KeL9QQU09q6a I6PWjm2JjDZcg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005Mx-KX; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 11/13] dt-bindings: phy: qcom,qmp-usb: fix sc8280xp binding Date: Mon, 24 Oct 2022 12:06:30 +0200 Message-Id: <20221024100632.20549-12-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563202591537999?= X-GMAIL-MSGID: =?utf-8?q?1747563202591537999?= The current QMP USB PHY bindings are based on the original MSM8996 PCIe PHY binding which provided multiple PHYs per IP block and these in turn were described by child nodes. The QMP USB PHY block only provide a single PHY and the remnant child node does not really reflect the hardware. The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes. This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers (e.g. does not include the per lane PCS registers). Note that PCS_USB region is also not described by the current bindings despite being used by the driver and this has led to people increasing the size of the PCS region in the devicetree so that it includes PCS_USB registers even though other regions like TX and RX may lie in between. Add a new binding for the QMP USB PHYs found on SC8280XP which further bindings can be based on. Note that this also fixes the SC8280XP "phy_phy" reset name. Also note that the current binding is simply removed instead of being deprecated as it was only recently merged and support for SC8280XP is still under development. And, specifically, there is no support in mainline for the multiport controller that uses these PHYs. Signed-off-by: Johan Hovold --- .../phy/qcom,msm8996-qmp-usb-phy.yaml | 13 --- .../phy/qcom,sc8280xp-qmp-usb-phy.yaml | 105 ++++++++++++++++++ 2 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb-phy.yaml diff --git a/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb-phy.yaml index a72e96f241d1..874c32b75428 100644 --- a/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-usb-phy.yaml @@ -26,7 +26,6 @@ properties: - qcom,qcm2290-qmp-usb3-phy - qcom,sc7180-qmp-usb3-phy - qcom,sc8180x-qmp-usb3-phy - - qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sdm845-qmp-usb3-phy - qcom,sdm845-qmp-usb3-uni-phy - qcom,sdx55-qmp-usb3-uni-phy @@ -204,7 +203,6 @@ allOf: compatible: contains: enum: - - qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sm8150-qmp-usb3-phy - qcom,sm8150-qmp-usb3-uni-phy - qcom,sm8250-qmp-usb3-uni-phy @@ -271,16 +269,6 @@ allOf: - const: phy_phy - const: phy - - if: - properties: - compatible: - contains: - enum: - - qcom,sc8280xp-qmp-usb3-uni-phy - then: - required: - - power-domains - - if: properties: compatible: @@ -352,7 +340,6 @@ allOf: contains: enum: - qcom,msm8996-qmp-usb3-phy - - qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sm8250-qmp-usb3-uni-phy - qcom,sm8350-qmp-usb3-uni-phy then: diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb-phy.yaml new file mode 100644 index 000000000000..95ee81d782f9 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb-phy.yaml @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/qcom,sc8280xp-qmp-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm QMP PHY controller (USB, SC8280XP) + +maintainers: + - Vinod Koul + +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB. + +properties: + compatible: + enum: + - qcom,sc8280xp-qmp-usb3-uni-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 5 + + clock-names: + items: + - const: aux + - const: ref_clk_src + - const: ref + - const: com_aux + - const: pipe + + power-domains: + maxItems: 1 + + resets: + maxItems: 2 + + reset-names: + items: + - const: phy + - const: phy_phy + + vdda-phy-supply: true + + vdda-pll-supply: true + + "#clock-cells": + const: 0 + + clock-output-names: + maxItems: 1 + + "#phy-cells": + const: 0 + +required: + - compatible + - reg + - clocks + - clock-names + - power-domains + - resets + - reset-names + - vdda-phy-supply + - vdda-pll-supply + - "#clock-cells" + - clock-output-names + - "#phy-cells" + +additionalProperties: false + +examples: + - | + #include + #include + + phy@88ef000 { + compatible = "qcom,sc8280xp-qmp-usb3-uni-phy"; + reg = <0x088ef000 0x2000>; + + clocks = <&gcc GCC_USB3_MP_PHY_AUX_CLK>, + <&rpmhcc RPMH_CXO_CLK>, + <&gcc GCC_USB3_MP0_CLKREF_CLK>, + <&gcc GCC_USB3_MP_PHY_COM_AUX_CLK>, + <&gcc GCC_USB3_MP_PHY_PIPE_0_CLK>; + clock-names = "aux", "ref_clk_src", "ref", "com_aux", + "pipe"; + + power-domains = <&gcc USB30_MP_GDSC>; + + resets = <&gcc GCC_USB3_UNIPHY_MP0_BCR>, + <&gcc GCC_USB3UNIPHY_PHY_MP0_BCR>; + reset-names = "phy", "phy_phy"; + + vdda-phy-supply = <&vreg_l3a>; + vdda-pll-supply = <&vreg_l5a>; + + #clock-cells = <0>; + clock-output-names = "usb2_phy0_pipe_clk"; + + #phy-cells = <0>; + }; From patchwork Mon Oct 24 10:06:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp359488wru; Mon, 24 Oct 2022 03:11:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YRb7C/Rt5MVAg2us0ImBmHgJcPwjfTX84Mp0zWdB9avnkL726ZanzBcTO6hS1kIGGkIXv X-Received: by 2002:a17:90b:4c52:b0:20d:7917:4cb3 with SMTP id np18-20020a17090b4c5200b0020d79174cb3mr73398763pjb.6.1666606259463; Mon, 24 Oct 2022 03:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606259; cv=none; d=google.com; s=arc-20160816; b=fUIoSQA7UrHDCitBZYYH88OMshtcjky18p99nXtqhaV1BDWno0/G2uxznltrVeSny3 939fhzPM0RW3r3Xh2ffl3ALC5X91TnU7emr6woMNgP0BpQvS1IOQfy5tolj9pVDJr1cR 3vmRcW6PJbP/KxoXZhfkl2f5it3FNjqNTgWaSx/jxo/uw4Adv2oCIhnz13h9zXayKO+1 Fx7ddg1SYcqenCQCdyInr1v2p45yHe3zKCcpOAWgYMIdamYmYGahF1GFkrMoMaB0uGvA w6OWxOqW0F6eGq0ZCD9Ys1WiMddQwsFiqRPoU9BmBbOWL6szlmYlQiOgX6HaSXV6ef0M h0zA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lakEvZmGFcyPhChqui6+5GMFmB0gOS0VlJ8tVaG1DuI=; b=u3JPhQNIZzIcOyQ/MeAcncXs3ZNQAEFTlTCKx6pDWHe8QL1BMRzul0cHQvICSnKQeV 7lRjpQ6I2A3nquww8DPUe2EMG9PgeTyIw3aeQEcOEX+s3NZwuQFwTeuqVYdx85CO47k0 p7LUmO4grJ4Ig959kXOyHAWmxZPY6q0yQAt/l5RfKOt0djZ+UCRzuGX2eiaUpnd9Zi4P KfFotkU5XH4C27J3dJb3I0NWkVEqqnJO4BYK5HM0lIFtq6m2cnSVVWe3LiL8SkAbNsXQ MGJ9gKc5nOncJ3HF/X8fcUOUWgn7rs3+9gAGW24f0yQEE0MJUyZt4QQff1MrXoB7Ui9X P6OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RwY2i3IM; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a634504000000b0046b0e168b1asi32985181pga.222.2022.10.24.03.10.45; Mon, 24 Oct 2022 03:10:59 -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=@kernel.org header.s=k20201202 header.b=RwY2i3IM; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbiJXKIA (ORCPT + 99 others); Mon, 24 Oct 2022 06:08:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbiJXKHM (ORCPT ); Mon, 24 Oct 2022 06:07:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8AC1FFAD; Mon, 24 Oct 2022 03:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A41F9611B8; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE9D8C4FF0E; Mon, 24 Oct 2022 10:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606023; bh=9PqNY1bKjgTkHZrkBU4jCqQFP+7L+LDLurdxgO2o+T8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RwY2i3IMVUE9BjguwXu76VXbqgXkFldCDLIjwXo87ydWd2ysnvDxXWvxseP2WsBWB pjrDiKpzZ+4HM6MtYOx41WGMSWbqygTk6X49FSRp35GHu3a21CI3vuyOg5KFPs/s4/ /fEDOYDLoKgmjIpmH8YBO+F+Dlv54dDfNQjrTRhaD2mOVFYbEtoFLnzl76jrKbfG+d oLG9i5xYqWw38ojw51W9P2mmA21inn4mzqAxbX3VX2+cfqLZo3fDHE3NyF/8wRwAf5 7AQgdMXkAq9KLN273eyR834QdO8bRi1V3nXdmJqHSCuvmJyCCIKNtIQbGZcxojg6qK TJ7P85Qvi3L/A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005N4-Nj; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 12/13] phy: qcom-qmp-usb: restructure PHY creation Date: Mon, 24 Oct 2022 12:06:31 +0200 Message-Id: <20221024100632.20549-13-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563324992041248?= X-GMAIL-MSGID: =?utf-8?q?1747563324992041248?= In preparation for supporting devicetree bindings which do not use a child node, move the PHY creation to probe() proper and parse the serdes and dp_com resources in what is now the legacy devicetree helper. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 46 ++++++++++++------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index d5e62cfd93f8..3f5e22b1d29e 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2386,13 +2386,22 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np, return devm_of_iomap(dev, np, index, NULL); } -static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) +static int qmp_usb_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np) { + struct platform_device *pdev = to_platform_device(qmp->dev); const struct qmp_phy_cfg *cfg = qmp->cfg; struct device *dev = qmp->dev; - struct phy *generic_phy; bool exclusive = true; - int ret; + + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(qmp->serdes)) + return PTR_ERR(qmp->serdes); + + if (cfg->has_phy_dp_com_ctrl) { + qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(qmp->dp_com)) + return PTR_ERR(qmp->dp_com); + } /* * FIXME: These bindings should be fixed to not rely on overlapping @@ -2449,16 +2458,6 @@ static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) "failed to get pipe clock\n"); } - generic_phy = devm_phy_create(dev, np, &qmp_usb_phy_ops); - if (IS_ERR(generic_phy)) { - ret = PTR_ERR(generic_phy); - dev_err(dev, "failed to create PHY: %d\n", ret); - return ret; - } - - qmp->phy = generic_phy; - phy_set_drvdata(generic_phy, qmp); - return 0; } @@ -2480,16 +2479,6 @@ static int qmp_usb_probe(struct platform_device *pdev) if (!qmp->cfg) return -EINVAL; - qmp->serdes = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(qmp->serdes)) - return PTR_ERR(qmp->serdes); - - if (qmp->cfg->has_phy_dp_com_ctrl) { - qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); - if (IS_ERR(qmp->dp_com)) - return PTR_ERR(qmp->dp_com); - } - ret = qmp_usb_clk_init(qmp); if (ret) return ret; @@ -2516,7 +2505,7 @@ static int qmp_usb_probe(struct platform_device *pdev) */ pm_runtime_forbid(dev); - ret = qmp_usb_create(qmp, child); + ret = qmp_usb_parse_dt_legacy(qmp, child); if (ret) goto err_node_put; @@ -2524,6 +2513,15 @@ static int qmp_usb_probe(struct platform_device *pdev) if (ret) goto err_node_put; + qmp->phy = devm_phy_create(dev, child, &qmp_usb_phy_ops); + if (IS_ERR(qmp->phy)) { + ret = PTR_ERR(qmp->phy); + dev_err(dev, "failed to create PHY: %d\n", ret); + goto err_node_put; + } + + phy_set_drvdata(qmp->phy, qmp); + of_node_put(child); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); From patchwork Mon Oct 24 10:06:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp358394wru; Mon, 24 Oct 2022 03:08:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kF8OvuhzNJQxRj/3T8n7PtdPSf0KMfF7DnwDzvW+hpb15MKuay4H28scSN3I64m39g8Hd X-Received: by 2002:a17:902:7c12:b0:186:8111:ade2 with SMTP id x18-20020a1709027c1200b001868111ade2mr15012971pll.111.1666606122098; Mon, 24 Oct 2022 03:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666606122; cv=none; d=google.com; s=arc-20160816; b=C86SiZt4LDevxL/vymKxzobF3762woFiCINbR10Jx58r7zhHq4ekru7Jecog6pDOUu mx5yBoH957Ajluw5ZiIsqQe1oCJ8kcPKSvLv7zLIEpIvWv2g71utjEzHLH3sCx5dOIye 9upxG9Hztqk6HYoyMTJVTIhWH8W5FyO04sRT3h7U3T+JsdevBwCPoK6Eo09vBfFQeFEL N9TghzQE7smYxiMmBvdpEJ1+ZoMXdT763wRJLilXriR8WrSelQYXZ028LSj/okbMdb2w 5SCC0hK+mrMAUhRpIuYIS7lpQJDjCVfP16uG+yEubFEMTrHJi8A3YTNtwqMIZOrD0JCz 4Y5Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RzhG1EbMO2Qvh0targbK20Ws/RNTSSAp5xFK/KV98gI=; b=Cd8Nb0/ox/JgURh7WLLL2H2mgnWLCy2qL8fyVgWLI3fneSIm+D2mH3/8pFdVMfbXPK Y23o83z7bmHKIm1ix9nZTP1w7h9WiLaVXtTn6OQrOeoepsV4/qvltBPldfLVATcm+ISd U8VtxAsbI8fXL/QLAn34J9z8BPL/i5irWv83GgYHz+fmXwy98SE4ti+V1uoBqDwcEyaV seOgVK3/Q/7rdHR+E+qiEmMOVLPJm20fA5vxOIotoh5/l/DbGscAsQvMZ/MKsz7mB4Il ZzrdlCD0AllDZchuqKl3GBQu2R0OBF+GBbw1FhA0FnDIvLttkHJHcYso7AhZ6AiyQ9/k JKvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ERG2y6T7; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 23-20020a630017000000b0046ec2ad4a97si10018151pga.163.2022.10.24.03.08.29; Mon, 24 Oct 2022 03:08:42 -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=@kernel.org header.s=k20201202 header.b=ERG2y6T7; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231131AbiJXKHx (ORCPT + 99 others); Mon, 24 Oct 2022 06:07:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbiJXKHL (ORCPT ); Mon, 24 Oct 2022 06:07:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8231A07B; Mon, 24 Oct 2022 03:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD09D611BE; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DC04C4FF19; Mon, 24 Oct 2022 10:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666606024; bh=VUmrOTJs2EFOchTZknb6MkKhbnENFHL5paq8fgMjNFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERG2y6T7SeqkM6IJuQ4pFxv9V4UIxlt0+QC3FUw1z6NJ1+yChd9gGYFHixQZEaKT+ JcTSehV/y2munWcaTrE1jOK7w7AcPhqEzCBAvrZIFhtmP8vHD32wOsib1lg2MyLufF A2o4kIRMP8/s/ZShQZAIOUTSwTQSLEZgPKWQ4KTBUcJy7P/hVSCjkB8R9TuFCzHVR4 uSZjVCQAyclqQ92tAXnKy9vsXsjPRmshyJXmPjYJ2CU4Lwjbay2IBMtdy2NIBvttMw ID48rtATIS5qexPUldTN+H5TjhFKCEpFAvEvKsPv2YrMgiNqTpq1WvTDbCVMA30DaG H7P9VsnEJGhFQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omuM3-0005N7-Qz; Mon, 24 Oct 2022 12:06:47 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 13/13] phy: qcom-qmp-usb: add support for updated sc8280xp binding Date: Mon, 24 Oct 2022 12:06:32 +0200 Message-Id: <20221024100632.20549-14-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024100632.20549-1-johan+linaro@kernel.org> References: <20221024100632.20549-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747563181192605447?= X-GMAIL-MSGID: =?utf-8?q?1747563181192605447?= Add support for the new SC8280XP binding. Note that the binding does not try to describe every register subregion and instead the driver holds the corresponding offsets. This includes the PCS_USB region which was initially overlooked. Note that the driver will no longer accept the old binding due to the fixed "phy_phy" reset name. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 82 ++++++++++++++++++++----- 1 file changed, 67 insertions(+), 15 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 3f5e22b1d29e..372f9853c749 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -1414,10 +1414,20 @@ static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x21), }; +struct qmp_usb_offsets { + u16 serdes; + u16 pcs; + u16 pcs_usb; + u16 tx; + u16 rx; +}; + /* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg { int lanes; + const struct qmp_usb_offsets *offsets; + /* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl; int serdes_tbl_num; @@ -1548,6 +1558,14 @@ static const char * const qmp_phy_vreg_l[] = { "vdda-phy", "vdda-pll", }; +static const struct qmp_usb_offsets qmp_usb_offsets_v5 = { + .serdes = 0, + .pcs = 0x0200, + .pcs_usb = 0x1200, + .tx = 0x0e00, + .rx = 0x1000, +}; + static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = { .lanes = 1, @@ -1637,6 +1655,8 @@ static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { .lanes = 1, + .offsets = &qmp_usb_offsets_v5, + .serdes_tbl = sc8280xp_usb3_uniphy_serdes_tbl, .serdes_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_serdes_tbl), .tx_tbl = sc8280xp_usb3_uniphy_tx_tbl, @@ -1647,12 +1667,11 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { .pcs_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_tbl), .clk_list = qmp_v4_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), + .reset_list = qcm2290_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(qcm2290_usb3phy_reset_l), .vreg_list = qmp_phy_vreg_l, .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .regs = qmp_v4_usb3phy_regs_layout, - .pcs_usb_offset = 0x1000, }; static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = { @@ -2461,11 +2480,41 @@ static int qmp_usb_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np) return 0; } +static int qmp_usb_parse_dt(struct qmp_usb *qmp) +{ + struct platform_device *pdev = to_platform_device(qmp->dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + const struct qmp_usb_offsets *offs = cfg->offsets; + struct device *dev = qmp->dev; + void __iomem *base; + + if (!offs) + return -EINVAL; + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + qmp->serdes = base + offs->serdes; + qmp->pcs = base + offs->pcs; + qmp->pcs_usb = base + offs->pcs_usb; + qmp->tx = base + offs->tx; + qmp->rx = base + offs->rx; + + qmp->pipe_clk = devm_clk_get(dev, "pipe"); + if (IS_ERR(qmp->pipe_clk)) { + return dev_err_probe(dev, PTR_ERR(qmp->pipe_clk), + "failed to get pipe clock\n"); + } + + return 0; +} + static int qmp_usb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *child; struct phy_provider *phy_provider; + struct device_node *np; struct qmp_usb *qmp; int ret; @@ -2491,9 +2540,16 @@ static int qmp_usb_probe(struct platform_device *pdev) if (ret) return ret; - child = of_get_next_available_child(dev->of_node, NULL); - if (!child) - return -EINVAL; + /* Check for legacy binding with child node. */ + np = of_get_next_available_child(dev->of_node, NULL); + if (np) { + ret = qmp_usb_parse_dt_legacy(qmp, np); + } else { + np = of_node_get(dev->of_node); + ret = qmp_usb_parse_dt(qmp); + } + if (ret) + goto err_node_put; pm_runtime_set_active(dev); ret = devm_pm_runtime_enable(dev); @@ -2505,15 +2561,11 @@ static int qmp_usb_probe(struct platform_device *pdev) */ pm_runtime_forbid(dev); - ret = qmp_usb_parse_dt_legacy(qmp, child); - if (ret) - goto err_node_put; - - ret = phy_pipe_clk_register(qmp, child); + ret = phy_pipe_clk_register(qmp, np); if (ret) goto err_node_put; - qmp->phy = devm_phy_create(dev, child, &qmp_usb_phy_ops); + qmp->phy = devm_phy_create(dev, np, &qmp_usb_phy_ops); if (IS_ERR(qmp->phy)) { ret = PTR_ERR(qmp->phy); dev_err(dev, "failed to create PHY: %d\n", ret); @@ -2522,14 +2574,14 @@ static int qmp_usb_probe(struct platform_device *pdev) phy_set_drvdata(qmp->phy, qmp); - of_node_put(child); + of_node_put(np); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); return PTR_ERR_OR_ZERO(phy_provider); err_node_put: - of_node_put(child); + of_node_put(np); return ret; }