Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10703092rwp; Fri, 21 Jul 2023 03:44:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWQJnO/J2mJhXHpvv6MuKVnFezppChNbVeKjhFHYtOGWMXe9+9l7YDG6R1/t7y4UVjXx1o X-Received: by 2002:a05:6a20:4310:b0:11f:c1a1:8c with SMTP id h16-20020a056a20431000b0011fc1a1008cmr1830451pzk.54.1689936277177; Fri, 21 Jul 2023 03:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689936277; cv=none; d=google.com; s=arc-20160816; b=K4u2ZQzxKNreAE33CKNlrOvZ6GwWSaVkKs9y0Ob18nvZdKBYMA8Rt2W2sZmOdNHcly rKibhAsWp5x15/ZIFpL5bSKDZq51a3qyYZAagX1g/yqJixhb3sCAZtV0TsrywqTJMdet 22vLz7HSgoJ21nA99LR3p6hCT7+CnxuqdtuLbR06b+Rl8ssy7jm2G4NLMvBHMp12fpv8 ErbMWGNlg8zt47IR+2zNQYX5VjANvpGVL9V04WuyQi9dWXnsXej1dy47ecoZpT/9cUCj F99gVC+56rY80smGEmqk1geaZi953Bis3dapQh0+xlO+1fDjme6YljqnJyUsX2ebj7L2 3zBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=Q1E+qG/I5LqG/QR10OhDt5LssPoETA+6yM89kE5HJ/c=; fh=NY3KO6EpQNeCr4ZUTXdyAgVNSryAu5SvNRLP+HbVado=; b=Gka/pMvh1cyuGsQGJzQ14JwE9WZmIvIqo4zTd4puooZ9TGS1JMmomvG4IqCZQsVK24 dy1e9gzkekb04uqJZzCZsxunvijtQpm2zOTXDUSg3bhN6N5iT/JjRkaWhfuFysOvt6HX 4Wpz50tp1IAjF0sLvD1swdovJxGYGsHReg7RtrxFbCQxXXOUgxhkxGMhYJHHMZKO6FQy bP+rUIJ9vX+2tV9Md64JRYLq55vqfzBHcwhpGPVwUgU2wrCvd6z//Og4XCz8QopmNIBw 37EhasLAg2+/9wtc/DxWwd4J5n7DCjXI3PTC/NKzSy+mCwYcGXGZEUVVO8ZJA5Gkp3Sa gJrw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a636d0b000000b0055b76613808si2695398pgc.214.2023.07.21.03.44.24; Fri, 21 Jul 2023 03:44:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231266AbjGUJ7k (ORCPT + 99 others); Fri, 21 Jul 2023 05:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231158AbjGUJ7i (ORCPT ); Fri, 21 Jul 2023 05:59:38 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1133B30D4; Fri, 21 Jul 2023 02:59:28 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 80D8924E28E; Fri, 21 Jul 2023 17:59:26 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 21 Jul 2023 17:59:26 +0800 Received: from ubuntu.localdomain (113.72.147.86) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 21 Jul 2023 17:59:25 +0800 From: Minda Chen To: Pawel Laszczak , Greg Kroah-Hartman , Peter Chen , "Roger Quadros" CC: , , Minda Chen Subject: [PATCH v1] usb: cdns3: Add PHY mode switch to usb2 PHY Date: Fri, 21 Jul 2023 17:59:23 +0800 Message-ID: <20230721095923.20445-1-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [113.72.147.86] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 cdns3 just set PHY mode switch for USB3.0 PHY. If USB 2.0 PHY contains PHY mode switch setting, USB 2.0 PHY mode function can't be called. So add PHY mode switch function for USB 2.0 PHY. Signed-off-by: Minda Chen --- drivers/usb/cdns3/drd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c index d00ff98dffab..04b6d12f2b9a 100644 --- a/drivers/usb/cdns3/drd.c +++ b/drivers/usb/cdns3/drd.c @@ -196,6 +196,7 @@ int cdns_drd_host_on(struct cdns *cdns) if (ret) dev_err(cdns->dev, "timeout waiting for xhci_ready\n"); + phy_set_mode(cdns->usb2_phy, PHY_MODE_USB_HOST); phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_HOST); return ret; } @@ -216,6 +217,7 @@ void cdns_drd_host_off(struct cdns *cdns) readl_poll_timeout_atomic(&cdns->otg_regs->state, val, !(val & OTGSTATE_HOST_STATE_MASK), 1, 2000000); + phy_set_mode(cdns->usb2_phy, PHY_MODE_INVALID); phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID); } @@ -248,6 +250,7 @@ int cdns_drd_gadget_on(struct cdns *cdns) return ret; } + phy_set_mode(cdns->usb2_phy, PHY_MODE_USB_DEVICE); phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_DEVICE); return 0; } @@ -273,6 +276,7 @@ void cdns_drd_gadget_off(struct cdns *cdns) readl_poll_timeout_atomic(&cdns->otg_regs->state, val, !(val & OTGSTATE_DEV_STATE_MASK), 1, 2000000); + phy_set_mode(cdns->usb2_phy, PHY_MODE_INVALID); phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID); } EXPORT_SYMBOL_GPL(cdns_drd_gadget_off); -- 2.17.1