From mboxrd@z Thu Jan 1 00:00:00 1970 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 28252C44500 for ; Mon, 6 Jul 2026 22:36:41 +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: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:In-Reply-To:References: List-Owner; bh=peYaCA6o2KqlA8q8EG4Q1xh4FufuCwV98pIg+Boq72c=; b=Knp/CRF9Ndhnc7 U6eXye3v4b5PowQnQWg/1cvC2vpkceFvNW42EfH2x5MtAsABdcrE5TK7PTFVLv+gWnDmDBUHPoS2O LSLsHRUtyDZ5XqMGCfd0mjI83TaqD7QiUqPsHs6zVVLbrZIrydoetjO8tZ1bw5fHyt7Lg2OgBx7XQ PKXCfyhlvqs0FqQWmeRf2mQuctMM4KgPpKH9EGc/q4d3LLmj7ZZqa2icLftdwURSrczIVW0PA5ccB goqIyVMhpxpDBqpxxlV5HLYik5K5V/fnvNq1+d17mVor4UNvJfHMrIGEx8xFH7eGfmWalOfUHjAX5 JOzMMw3VfBrapNZE0xyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wgrvc-0000000Dj3Z-1uDw; Mon, 06 Jul 2026 22:36:40 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wgrvY-0000000Dj0t-2TRc for linux-phy@lists.infradead.org; Mon, 06 Jul 2026 22:36:38 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-493b27c7451so466265e9.0 for ; Mon, 06 Jul 2026 15:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783377394; x=1783982194; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=15lXngfbV3oHOC8Vn3lhHZSCcqaMFAt4guZPgjqF3Ck=; b=CZY9EZb7oRHkolW6jEO9Ri4eCEB2HW+7AfVvVJcpzE0VWT+Mie0NLy5adDZ6C7P5lP uO+PVlhO1qGeks2NjpvS7ym3RuGypls2i9iaZ5LZHttmBmvAOmihBfC6tm61NjUztzsU iz5OcIzp9kSQKxZWhME8zLvotBqUT492BLfEYiD8revsRvEPD+JoxdcRotR2LzfKtNmV HauYbxlp7stFfX+dlw7itO2lux8gazG1MJm93AX7E/3QHuSRQ9UcA53G1QebfZjDbv7a ZaSn1Cd8pRqUUq/R0e6J0o9PYPBdrCFHDOe3rzUZvgd5otIGpk/jbKb+spqCsaWyNRjC UhuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783377394; x=1783982194; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=15lXngfbV3oHOC8Vn3lhHZSCcqaMFAt4guZPgjqF3Ck=; b=ERl3INphbxL9X6Kb3DYvf43N+7lkzTXK0znL55Zl39Jfe6dOwb+BhjrBUUUiz2mbzU onUeB7QYB6WjZ5Hyj8scv5AWOVEeGJwVvk0K/4Okf+iVEyGXnkD/p2HeGnujpGG3vG7A GYdjNBRuDVyJ9bxlfO27JxysZ20TiOSIQtQuu8dM3tk2Ya2Vb0NYOhrZwiOoVzuk58fN 6PDL+/p4ZvCOuTWi4c0uH3rSGZsBMup2XMVF8wzZDlEUaTH+o2eLoEmHr0B2CTJRfaDs MstalGE6k8FPfgf1CmU2ZRdshydviB02atul3jMpKqxa7AWBWb0P0CUCciAi3F4pZl6q k4nQ== X-Forwarded-Encrypted: i=1; AHgh+Rq7Bi4fpZ7d7aRemI4RL7rfxnoVohJ4GHOpukJ7BfYAer7Jez9HKIOrpIeHUfjIugG0tgjVirCvbQU=@lists.infradead.org X-Gm-Message-State: AOJu0Yz/AMjsMJtejAwQbZydzdjw7IsDMnTO3PNkd+R5Y9uU1w4ob1+X HNNbcGF801rumUIUIUdHlxylrvru1kwltPIiFS/2QwXetx1idiUz7f5p X-Gm-Gg: AfdE7clkAYTzE95z0rCxvxy+YG6aOW4yrOd7mZhHuLD7TXDocb1KtvGmoVfb29P0oXI P2UAiwTVfQV6WjgLoiq0UlCcDzkaBA9depDl+FHqt3k7Bhhsk6RWIrKcl24TABGLxdvxJa3lsl3 fuOYLW59ztQv68Wj2BGuFE6UCYOyImhdC0j4KbGQfa0K2Benasf+QfBejTsBys1G8G1lhw6RmYn RfgTZq1hgacrmmOHhyPZDOdlWCeJnqpGcv1MqjkYt6oVRxeR/hHNTfVZVXOf4HzJNp6O8Zmo9e6 aI1DffvQfr20pIL19IDWrmboNK4MC9z4gvoXmKiZQ7RK4xQvqVdfPgVjIPUnwzujZwKwDQCA9Ev EliBuCC7Yok0LpqqUx3poftuaSz1E6sBkwGOBpsi4JsPjzMcNxZvJtOSWIALT16rXoEsNShG2C5 6eRFAvEKr4rZ3ipQ37oIbEIEqwuV413aLp041HG7BPMIMFoQivd6PGqav8QKXSuA== X-Received: by 2002:a05:600c:1595:b0:490:55d9:149a with SMTP id 5b1f17b1804b1-493e104d170mr977625e9.18.1783377394164; Mon, 06 Jul 2026 15:36:34 -0700 (PDT) Received: from turbine.fritz.box (p5785b224.dip0.t-ipconnect.de. [87.133.178.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47a9e4d6da9sm27491387f8f.12.2026.07.06.15.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 15:36:33 -0700 (PDT) From: Andreas Zdziarstek To: Vinod Koul , Neil Armstrong Cc: Heiko Stuebner , Jonas Karlman , Frank Wang , Louis Chauvet , Luca Ceresoli , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, linux-phy@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Andreas Zdziarstek Subject: [RFC PATCH v1 0/2] phy: rockchip: inno-usb2: fix USB gadget hot-plug on peripheral-only OTG ports Date: Tue, 7 Jul 2026 00:36:25 +0200 Message-ID: <20260706223627.113814-1-andreas.zdziarstek@gmail.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260706_153636_642811_0A01E086 X-CRM114-Status: GOOD ( 21.38 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Hi All, I had an interesting time trying out the USB OTG micro-USB port on the Odroid-M1S (Rockchip RK3566) on the mainline Kernel. My intention was to set up a cdc_ncm+cdc_acm peripheral gadget as a hot-pluggable debug port. For the most part that went swimmingly. Just not quite with the hot-plugging. The apparent first problem was that peripheral mode only works if the host is connected at boot time of the RK3566 Kernel, regardless if the dr_mode settings is "otg" or "peripheral". When no connection is present at boot, gadget setup fails with a "failed to enable ep0out" error and the port seems to end up in an unrecoverable state afterwards. I investigated a little as to why. With my very limited understanding of the subsystems involved, I think I have identified some problems. All seem largely related to each other. * The M1S references its 5V OTG VBUS switch as phy-supply of the OTG port in its DT. The phy core unconditionally enables that on phy power_on. From then on it powers its own VBUSDET input, making further cable VBUS detection impossible. Also, apparently, after reading the schematic, that means even with a cable connected at boot (and peripheral mode therefore working), the board will try to back-power the host. Seems my host port is pretty robust, luckily. * The inno-usb2 driver seems to generally lack DRP power supply VBUS switching support? At least PHY and VBUS supply are semantically treated the same. * The inno-usb2 driver's state machine powers off the Phy in several places: on an initial no-VBUS sample, on DCP detection and on disconnect. That seems to happen unrelated to controller-initiated phy_power_on/off calls and looks like the main cause the gadget setup fails and then borks the controller state. My proposed fixes are in two places: * set the micro-USB M1S port to "peripheral" in DTS and remove the supply node. The board has two USB-A host ports, so device mode is the most likely usage scenario for the microUSB and real compliant DRP does not seem to be in the cards in the current state. Also, this fixes the potentially harmful back-powering issue. (2nd patch) * keep the inno-usb2 phy driver from autonomously powering off when in peripheral mode. This makes hot-plugging and gadget-setup without a connected cable work. (1st patch) This "works great for me". No issues whatsoever with the M1S in device mode. I can plug/unplug/replug at will at any time, rock solid. However, I am also doubting myself if I have completely misunderstood the whole Dual-Role status quo and should have just done something differently. Also even if I am right about the problems, I would agree with anyone saying that this isn't the "proper" fix for the whole situation. It seems the rockchip vendor kernel is doing DRP related stuff differently, e.g. an additional vbus-supply setting in DT with apparent support for VBUS role-switching. Fully automatic OTG with gadget support *should* be possible to do. Possibly a lot of work, though. Still, I would say having a solid peripheral-only option including hot-plugging is an improvement to the status-quo. Host-only configs in other DTs should be unaffected as the inno-usb2 changes won't matter there. The autonomous power-off will still happen, for better or worse. Would love to get some insights on this from the experts. Cheers, Andy Andreas Zdziarstek (2): phy: rockchip: inno-usb2: keep peripheral-only OTG port active arm64: dts: rockchip: fix gadget hot-plug on ODROID-M1S micro-USB .../boot/dts/rockchip/rk3566-odroid-m1s.dts | 2 +- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 27 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) -- 2.53.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy