From patchwork Wed Dec 7 13:19:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 2721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp179267wrr; Wed, 7 Dec 2022 05:23:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf5d/xiZtQGyrasyk34tKD/SNotsP7Htg5yNzBzU4AZk9erAeOYjIi/mIyurQQliVV1CemLm X-Received: by 2002:a17:902:d302:b0:189:6077:5595 with SMTP id b2-20020a170902d30200b0018960775595mr62808026plc.84.1670419430083; Wed, 07 Dec 2022 05:23:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670419430; cv=none; d=google.com; s=arc-20160816; b=F74LOH6imGM87U7mqnT+jfRV4ey+cYrlo85oqVzcFM0yUntHpxRjN2N2Iot9FePmS3 uGrkHdSli58VGg9GH3iQibMgM84BimeDvg01Z4wjaDN/4hMXeRq+j8iaWykhlCIG5j5L FmezxG8D6DJT0m+6+J0q6i2njOV+9bPoYeJYDhEMisPRNhSA/M/oYegM/32Qp7u+wx2m 7E+UcX8W9/3t3qV+obx7BD294NRs/hgZxTH2tfdWJOadQdLnGlRUH46zEKOU1gVCIk7Y 63FRDUTgyiohoR/RKOchOKPKqVKZkjXTGtnqRfKoCSLWmOvXLrB6hWe82qtwWfoG83X5 6jQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Wpzxs2GGUB+9S+yFQOxBCtx2CCDpzanRLOYQwkhsv4k=; b=STxMQZgWIhQRAf0BU6IQnAoIZCmqpuGqhcINUQbP5TqpseRreGDfw2r1+20AkfSPja yd31IJZPUlsUrW8qkU5hQakEc5kpIhI/pN+X02A1JHi+/vJAodQAxuPY7bAwB3pWLOYh KCE763qtzWcI1LXrHsYHtSViuhKQfBrvUqrauf9Gc1rRk9nCKILz4VkNwr9Qz91HKzdx G8BCu7Vz5xNSVkEcij+iF/8ncDzhsfDw5oax48cMuj7n3zofWBWuklHkzv9av0v9D8xh 9tYiY7MN+JFgDL4odhJNg2uiYwnvFZJOxDw97d9S2Wponmo3U7HNtQu5g+peX+uB0P5r K/mg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p21-20020a170902b09500b0018863e1bc39si19574692plr.248.2022.12.07.05.23.34; Wed, 07 Dec 2022 05:23:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; 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 S229861AbiLGNTp (ORCPT + 99 others); Wed, 7 Dec 2022 08:19:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbiLGNTn (ORCPT ); Wed, 7 Dec 2022 08:19:43 -0500 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E92322B1A; Wed, 7 Dec 2022 05:19:41 -0800 (PST) Received: (Authenticated sender: foss@0leil.net) by mail.gandi.net (Postfix) with ESMTPSA id 4A39924000A; Wed, 7 Dec 2022 13:19:36 +0000 (UTC) From: Quentin Schulz To: Minas Harutyunyan , Greg Kroah-Hartman Cc: Quentin Schulz , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, William Wu , Bin Yang , Frank Wang Subject: [PATCH 0/3] usb: dwc2: fix USB peripheral role in dual-role mode on PX30 Date: Wed, 7 Dec 2022 14:19:15 +0100 Message-Id: <20221206-dwc2-gadget-dual-role-v1-0-36515e1092cd@theobroma-systems.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Mailer: b4 0.10.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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?1751561724458965076?= X-GMAIL-MSGID: =?utf-8?q?1751561724458965076?= From: Quentin Schulz On Theobroma Ringneck SoM, USB peripheral role when in dual-role mode does not work and displays the following error message: dwc2 ff300000.usb: dwc2_core_reset: HANG! Soft Reset timeout GRSTCTL_CSFTRST The USB sniffer shows nothing and dumping the host registers is stuck on HCDMA(0) register. Note that for some reason it works "fine" on PX30-EVB (there's another issue but not related to/fixed in this patch series). Since there's no documentation available for this IP, this patch series is basically just slightly adapted downstream BSP vendor kernel patches and I cannot unfortunately give more information than what I have. This patch series was tested on Theobroma Ringneck SoM on Haikou devkit and PX30 EVB. It fixes Ringneck support and does not break PX30-EVB's. For reference, the content of those commits can be found in tag linux-5.10-gen-rkr1, and the following commits have been used: 964d50060bf53a8defd1fc561b9261424f25ddad ad81c375602819a538ad68d979906c05663046e2 6e6adab8f735bc4fe27a67bdc3144d8fa89250d4 7c3a4e60247fd7f7b04d95d15cb12c63a5c20408 Note that Rockchip kernel called a slightly different implementation of __dwc2_lowlevel_hw_enable instead of dwc2_lowlevel_hw_enable but it seemed more right to me to call dwc2_lowlevel_hw_enable as done for the forced peripheral mode. I'm assuming the patch disabling phy initialization might need to be made Rockchip-specific? To: Minas Harutyunyan To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: William Wu Cc: Frank Wang Cc: Bin Yang Signed-off-by: Quentin Schulz --- Bin Yang (1): usb: dwc2: prevent core phy initialisation Quentin Schulz (2): usb: dwc2: disable lpm feature on Rockchip SoCs usb: dwc2: power on/off phy for peripheral mode in dual-role mode drivers/usb/dwc2/gadget.c | 6 ++++-- drivers/usb/dwc2/hcd.c | 7 +++++++ drivers/usb/dwc2/params.c | 4 ++++ drivers/usb/dwc2/platform.c | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) --- base-commit: 76dcd734eca23168cb008912c0f69ff408905235 change-id: 20221206-dwc2-gadget-dual-role-aac67e6d42fd Best regards,