From patchwork Wed Feb 8 19:01:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 13133596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D3A5C64EC7 for ; Wed, 8 Feb 2023 19:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N0gBh9k8RD94qwzOLb70TNSZqJ58kp2cI1yLnItT1QA=; b=EJF+7ZCSLveUPT iRy/JiNR1L65ZE1Uakb+HXB4OF+DTZep0vvHhIvHXWEGSNTzkDW37Yhw+tsjTkob7oRycVlqOswZp fUZoy3NmQOUngvdrOu5nBW+rUmSPTaj8aKGfNWKrjFw13jtK3lef/wLLSDUp24WiyUB49dsl6pxEq 1Zg2aHBmsNsjzVi16Kf8axuanlq6+DJOVfrX11XY4a1FcXBL4rMQVWQIjz/uKcQZXOj6P0A4rTAle X2DLuotnqkFgoxAVcf7uz430UyHBmGW/kB6g0fA8rr6eNoEc2IExmCJS3OCrkEdo6icvR3jedl/QE Ma7WRFljcHrh49qxkyVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPphz-00GhQX-TB; Wed, 08 Feb 2023 19:02:19 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pPphv-00GhMd-Ai for linux-phy@lists.infradead.org; Wed, 08 Feb 2023 19:02:16 +0000 Received: by mail-wm1-x333.google.com with SMTP id hn2-20020a05600ca38200b003dc5cb96d46so2187684wmb.4 for ; Wed, 08 Feb 2023 11:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ShO1VuIPcxLsmNvvc1MJjr+D91aZx/r3YaXr8Ck2/Xw=; b=Pffd+NUYTrdBf6OS/zrimTzpSsxUK9Oa4UsLrjTAjpf2uuOj4L+VNOJ4/ijSQWN8YT 6ZGlL1km2QAkS6w4WGxlpWv0o6s50r+tgNT/eBm+1BL3LStetLpt5yQnw8CoEuiD2WvL SgdsjBkan4mfH/dMfRjfWu2oK2xJqFNtmEACqA8cT2jp18UqiVd0fW/Prnm1FtO/Ppcn 2KMk2nFNlBTIeYxn+Hc/VTZMx6BFmYDMXv8Szhbk9E3kUYlN1s/pV7QhrcsNU2Q24bIO hrBFAiXAKO/0BbX/lcxsI2AA4w7D/7pbQZvW3z4cf9PufZXfOEjlVP8hszR5BzM6i6QJ HIBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ShO1VuIPcxLsmNvvc1MJjr+D91aZx/r3YaXr8Ck2/Xw=; b=iUViYWzqsqmsh8mPFhMaxiq/15wJcbMTlo3vMVtK4QcKsYJl7+OrjUQFQnRzATujng B6ubgeUMIEisX3sMBPQhL/p+kt1pdZoGG8JP9AHXf955N8oecVSV6MzCNeCzmncFw6yT vmTI/jwK0TUTkVPuTbxW7BNPDqBui07wwRMPeo+92L1n93vBhfsZr+XNa9QVT6FBDV2u q0uRNAqGWh6Kte2lQYe2f7mgyLkVqjigXocoXVMLj4WRTb8xQBADu5iq4pm2nfvLulvP vfYv8UhXsssU7RL7Q6XS+xShfYjoPJLJpfePNUkaYOMW8Z0INL6bobf6gyoFF8tDZlM+ Q58g== X-Gm-Message-State: AO0yUKXkZrFJ7CS0C8TTuVCoW0XNDbol9Zt3cHdF8NjD8lgdEoKmNnEt DMHjpN1VyDP21yXb89MXr55HOg== X-Google-Smtp-Source: AK7set8TMXWqK2emgHpNgwZVvuPtioeiotnNbzEk64A7LpqsiUOM53RVUUxR5LeWNdGd7EZdt4p8Xw== X-Received: by 2002:a05:600c:2b46:b0:3df:12ac:7cc9 with SMTP id e6-20020a05600c2b4600b003df12ac7cc9mr7718676wmf.15.1675882931691; Wed, 08 Feb 2023 11:02:11 -0800 (PST) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id n16-20020a1c7210000000b003dc1d668866sm2650327wmc.10.2023.02.08.11.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 11:02:11 -0800 (PST) From: Abel Vesa To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Lee Jones , Rob Herring , Krzysztof Kozlowski , "vkoul@kernel.org" , Kishon Vijay Abraham I , Johan Hovold Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, Linux Kernel Mailing List , Neil Armstrong Subject: [PATCH v5 5/7] phy: qcom: phy-qcom-snps-eusb2: Add support for eUSB2 repeater Date: Wed, 8 Feb 2023 21:01:58 +0200 Message-Id: <20230208190200.2966723-6-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230208190200.2966723-1-abel.vesa@linaro.org> References: <20230208190200.2966723-1-abel.vesa@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230208_110215_394991_2D3B4F31 X-CRM114-Status: GOOD ( 15.95 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Neil Armstrong For USB 2.0 compliance, eUSB2 needs a repeater. The PHY needs to initialize and reset it. So add repeater support Co-developed-by: Abel Vesa Signed-off-by: Abel Vesa Signed-off-by: Neil Armstrong --- The v4 is here: https://lore.kernel.org/all/20230207135551.1418637-6-abel.vesa@linaro.org/ Changes since v4: * none Changes since v3: * none drivers/phy/qualcomm/phy-qcom-snps-eusb2.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-snps-eusb2.c b/drivers/phy/qualcomm/phy-qcom-snps-eusb2.c index 40a421cf3dd9..ca1cfa53d90d 100644 --- a/drivers/phy/qualcomm/phy-qcom-snps-eusb2.c +++ b/drivers/phy/qualcomm/phy-qcom-snps-eusb2.c @@ -128,6 +128,8 @@ struct qcom_snps_eusb2_hsphy { struct regulator_bulk_data vregs[EUSB2_NUM_VREGS]; enum phy_mode mode; + + struct phy *repeater; }; static int qcom_snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int submode) @@ -136,7 +138,7 @@ static int qcom_snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int phy->mode = mode; - return 0; + return phy_set_mode_ext(phy->repeater, mode, submode); } static void qcom_snps_eusb2_hsphy_write_mask(void __iomem *base, u32 offset, @@ -234,6 +236,12 @@ static int qcom_snps_eusb2_hsphy_init(struct phy *p) if (ret) return ret; + ret = phy_init(phy->repeater); + if (ret) { + dev_err(&p->dev, "repeater init failed. %d\n", ret); + goto disable_vreg; + } + ret = clk_prepare_enable(phy->ref_clk); if (ret) { dev_err(&p->dev, "failed to enable ref clock, %d\n", ret); @@ -341,6 +349,8 @@ static int qcom_snps_eusb2_hsphy_exit(struct phy *p) regulator_bulk_disable(ARRAY_SIZE(phy->vregs), phy->vregs); + phy_exit(phy->repeater); + return 0; } @@ -354,6 +364,7 @@ static const struct phy_ops qcom_snps_eusb2_hsphy_ops = { static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; struct qcom_snps_eusb2_hsphy *phy; struct phy_provider *phy_provider; struct phy *generic_phy; @@ -385,6 +396,12 @@ static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev) if (ret) return dev_err_probe(dev, ret, "failed to get regulator supplies\n"); + + phy->repeater = devm_of_phy_get_by_index(dev, np, 0); + if (IS_ERR(phy->repeater)) + return dev_err_probe(dev, PTR_ERR(phy->repeater), + "failed to get repeater\n"); + generic_phy = devm_phy_create(dev, NULL, &qcom_snps_eusb2_hsphy_ops); if (IS_ERR(generic_phy)) { dev_err(dev, "failed to create phy %d\n", ret);