From patchwork Sat Oct 12 03:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 1996330 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XQT9N2WVpz1xtp for ; Sat, 12 Oct 2024 14:13:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8CE4388A47; Sat, 12 Oct 2024 05:13:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id DC9B088A3C; Sat, 12 Oct 2024 05:13:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from CHN02-SH0-obe.outbound.protection.partner.outlook.cn (mail-sh0chn02on2072d.outbound.protection.partner.outlook.cn [IPv6:2406:e500:4420:2::72d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A0B4788A47 for ; Sat, 12 Oct 2024 05:13:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=minda.chen@starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WSE2nLmwES0BSg1BF49TOJIXFiaCipGGAd15TGylFA1vwmdRRKoVcxfS35wMk59/kzLPDsTdL6NUp6ePakLPfYqTWtLfrhacr17hWL9McRXdAKKaogvlBstD+VxKwe9EHrsZaNwV0cFEvOvmq1/inlPwer3sHZoyw5KzcHtragwhKZvegpZGJkz48vPuPwvIAeHjjHR5oJupsJ1WHgHspXeXLx47yZpjk37rOj9JBnA4V5CZNHzbup6wu4y72PM8FoE5rQ1ElrtmZ5dUW9FwxA2fg3EexS2fkVQVwGPWxVReG0DMkIi1HfH7B1879smyb1POAWwG12jE5ix2gR8ZgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Gyl3NbSkB+9G8rmD5hvrNfIv5u86y1+SOdHIgUcBQwQ=; b=YxkogTTSMFh1lBrkIB0vUwvzTYcflynizlCj5p4KgYAjD9kgG1kPvz3TYuHT5izKl5G6JZjPFmaEZ1l72MZcm9SPMU1YSLgVaLTy1CctYTYsNLvow6VJJkisbV03oaoZCqPrU6mBLSIK4TI/aZ3/BmZRS7Ktlf0nN7IupxCyRMUa1DPbmqFgrLvwjmtCtskI80O7cxUqPPae/VdSY+dY5eSE483coLtnuT2SdAAVFvwxMwdNb4+x4dLUrScJeLh7Sa0HzzMduxAnSSl9XYjIWkGHpsl9szZx8OPwc26cQBX+wQ3LVtmZvDC2rC44KiypguuVflA+2cuLKcb43qSUBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from BJSPR01MB0850.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:1d::17) by BJSPR01MB0850.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:1d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Sat, 12 Oct 2024 03:13:44 +0000 Received: from BJSPR01MB0850.CHNPR01.prod.partner.outlook.cn ([fe80::480b:a135:6e33:10ff]) by BJSPR01MB0850.CHNPR01.prod.partner.outlook.cn ([fe80::480b:a135:6e33:10ff%5]) with mapi id 15.20.8048.017; Sat, 12 Oct 2024 03:13:43 +0000 From: Minda Chen To: Marek Vasut , Tom Rini , Roger Quadros , Rick Chen , Leo , Neil Armstrong , Alexey Romanov , Sumit Garg , Mark Kettenis , Nishanth Menon Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , E Shattow , Minda Chen Subject: [PATCH v5 1/8] usb: cdns3: Set USB PHY mode in cdns3_drd_update_mode() Date: Sat, 12 Oct 2024 11:13:21 +0800 Message-Id: <20241012031328.4268-2-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241012031328.4268-1-minda.chen@starfivetech.com> References: <20241012031328.4268-1-minda.chen@starfivetech.com> X-ClientProxiedBy: SHXPR01CA0017.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1b::26) To BJSPR01MB0850.CHNPR01.prod.partner.outlook.cn (2406:e500:c211:1d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BJSPR01MB0850:EE_ X-MS-Office365-Filtering-Correlation-Id: 67351af7-1020-44d6-8d43-08dcea6be111 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; ARA:13230040|41320700013|366016|1800799024|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: esQOyZQ1cnaca4Rby77NWSY0hnlDVlqEWizrKoOoEKNF9Rgw89GuA4zx/NgeSX+38PWFoXrkyOelgZJjR6HOeNpSn728yILOBhQIFIjl+FV2BK6ekanaBH2JY5VMvC7lAXICV8QOW4b88edAhIOtGRSBXOBKbgdohk0LT0Q1WktkWFb7ezkVc1xqgxeECC14JZpcxScDtAxUYQtXze4Rsa7EXHPPyhr48BS3Mff4gv7/vfJb+F7F/vlTw85WAek/ytqZp5e7lvJjA4m+4UoK68PoJYVZMLgp5GZUodewjWp+Wclc0nOG8p7zVtzgyqqsnySTGxEBJFcr9mzh94w1QhjYyln+RLrC3dpSQGHDfnaQZeafHXS3P74qse/qDt82FJccZg4CHKPlUR1IfjkzHZ2pGpY3XGRa+SFiMOnS7ddEIc16HofHUoAOiT/y3ynNAHJy1WalQWbXdlywoQtVQUuCgpSPK9eTab+Ily71XTAI1We0uJmuIM7ALyDY5aN6be+24xNZ/eXfGs8ig4nv3wmi05XI95vR4IP7QOXJTw3yqe1gx0nIc7FZobINmQk+FvKFZh1vg2ToNpOIC6O8S2ZlVqrh0FGd9Y6TYH1oeyMsrfatX4s+uRlGSaqGALGjty0IZ+8cG9FsnniYA3XjFw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BJSPR01MB0850.CHNPR01.prod.partner.outlook.cn; PTR:; CAT:NONE; SFS:(13230040)(41320700013)(366016)(1800799024)(52116014)(7416014)(921020)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qxru6IdwWmsOXeGPcTFP/zW12LHX29Dx72HsHyxBHh+WsjG+Fw8Ed+Ng2R4JT/3j3HSsN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00OJZyqzrs52wjpLmE6sai5oo+S1fSDoRFwXp75fsox9Z7hAp1INAZg1EDPPmhb7mJnI4yipkh960mWRVFAylu3cqTXHrr2+xEYTENRe1R9FE1Q7zc7ZWjrJyivXyE9l6m2gxSd6LMaRuy2qQ0zZ9vqASUirYR2kzwk2dv2/fUoV2i8uyq97u3p7bKlaiT6Ks09P0tDmFI7+jdi10uNBNyiEJlrkQuvpZUuR9gpG8ajAJlosAFejuterhIhI/V5OSHanIep0xwaPNDKsvFF/1oZo618jeSjO4vN51H7eVEVW0woGCb6YXSAV4gWEwn8PRuS19tp1jCmZybDIPdz2p3aPOfKrDk97abLc1/GM+ZPt4MTIa576zNfQGyKjHml1TEb9BfjO2ZnLidmnO0F/RjDpMEAytgYX1IVqIq3nLJ/x9hPWYNvyQLBTkWwAbfCL35N2AB/udA/g== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67351af7-1020-44d6-8d43-08dcea6be111 X-MS-Exchange-CrossTenant-AuthSource: BJSPR01MB0850.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 03:13:43.9170 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gIWcyocUWi/YJgQ3gStbTdvQhOSWbel9AtKbzrPUNCadj4a2Nr674fMhgLTfIUZq8e5Pgq7uhFDxUuQkoldEQhqn5lzeFGZh0I2yo+gSPZA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BJSPR01MB0850 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean USB PHY maybe need to set PHY mode in different USB dr mode. So translate USB PHY mode to generic PHY mode and call generic_phy_set_mode(). Signed-off-by: Minda Chen Reviewed-by: Marek Vasut --- drivers/usb/cdns3/drd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c index 47874fec29e..cbb13342343 100644 --- a/drivers/usb/cdns3/drd.c +++ b/drivers/usb/cdns3/drd.c @@ -217,15 +217,19 @@ static int cdns3_init_otg_mode(struct cdns3 *cdns) int cdns3_drd_update_mode(struct cdns3 *cdns) { int ret = 0; + int mode; switch (cdns->dr_mode) { case USB_DR_MODE_PERIPHERAL: + mode = PHY_MODE_USB_DEVICE; ret = cdns3_set_mode(cdns, USB_DR_MODE_PERIPHERAL); break; case USB_DR_MODE_HOST: + mode = PHY_MODE_USB_HOST; ret = cdns3_set_mode(cdns, USB_DR_MODE_HOST); break; case USB_DR_MODE_OTG: + mode = PHY_MODE_USB_OTG; ret = cdns3_init_otg_mode(cdns); break; default: @@ -234,6 +238,16 @@ int cdns3_drd_update_mode(struct cdns3 *cdns) return -EINVAL; } + ret = generic_phy_set_mode(&cdns->usb2_phy, mode, 0); + if (ret) { + dev_err(cdns->dev, "Set usb 2.0 PHY mode failed %d\n", ret); + return ret; + } + + ret = generic_phy_set_mode(&cdns->usb3_phy, mode, 0); + if (ret) + dev_err(cdns->dev, "Set usb 3.0 PHY mode failed %d\n", ret); + return ret; }