From patchwork Sat Jan 18 10:22:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Simons X-Patchwork-Id: 13944109 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 AE998C02187 for ; Sat, 18 Jan 2025 10:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=g7KYYLVYAzSjQ+OOEOBYCeT9uSdwa/8OaOS+anJ2pbk=; b=wD2f7I4wO7tn5eaSsoOskuP5Kg Jgy3yhubrlo9ntIlXFHrvd2tNmcnLldPxdjOUuxGLh2MF7mvdfaaIdLSmKwTfBQ/i2Jfd05uQEF92 UL2EA/Imz5I3Ohj5NGHRa58RtlNtdOS9bpTFwNI3rRTADzwYInA/PjfruTjaB7Bpf9JbyTUmEwgaJ RCA+23RDnMVS1EzbiYkKs6S6kZrth7UgTJLHS4VcAQE9y3DK6BSFrmIbRBHmq9woGlRnHvasvDp6y VBUEnx/yqE8ffWdIqai3VRtRO00kcI73Iodsqx20wn4mthzZMDX32mZBP4BuxWAvs0uzhx2lOfxOK HbRUU2PQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tZ5zW-00000002BIZ-2Qhl; Sat, 18 Jan 2025 10:23:46 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tZ5yF-00000002B2G-21YZ; Sat, 18 Jan 2025 10:22:28 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-436326dcb1cso19450865e9.0; Sat, 18 Jan 2025 02:22:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737195745; x=1737800545; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=g7KYYLVYAzSjQ+OOEOBYCeT9uSdwa/8OaOS+anJ2pbk=; b=XrAR79iG2V6nkQYCiarSmznvkLE72SaPFg3lrNyoF0fpsJw4F2RsEKBOtrJUjU4Rzz 0zVVUZk9JWBZO28nIxREcJqQinK/yhxkDONrPEd6xihPR5atX2qNGJACSU8u+T5ALqrD kmiGWIbHlp6Bfv3AGT2f8vLW6DoeAaL2Ky1wFiL8Zi1on+GwRIPJoyAJtOyPYZAZpd9d h1UGIz4n+kq2iRg4XwDwXvcUel9K7fseBBCrfN1hhfZuPZacsqiTVSDKeeagCE4UNQRy gmi0BscpHY47Dxhq4tTQmnH3xdq+0b5TGKqxClHr94/Otf6r2QCO3QDCP6XhMJHzdeKR fQzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737195745; x=1737800545; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g7KYYLVYAzSjQ+OOEOBYCeT9uSdwa/8OaOS+anJ2pbk=; b=dUGYkaoieYtibOVqDQYKec5DsITbIK8nh+BtNSVjGNWtVW9zlWGLaNAsElP1oRDL+D lzYmRbhyYtm+pu0T5lNXkhB8Hll8pfMQS9vWi2FejYKDUywDXze/rK1i/ZHddlWknlIs gIJjIDgX0tUOXDkQG4DYM6W0dRmdtG07ITAShBdHSHly+LeHbO9DYhkVKR2KpJNXd3fX ajKX2KvIOBcci+5DVhpOxcTVmGaanCnPMgMuHuMnDiHJ8GfH6cQ7K1FQBtRnHVk49fXw COsAKRiuVm/ark0d2oXWR+UjEfzFCJDFpjIZkF6oz18lzTZIyef+L3cwdL4g4u0Rtr9/ IliQ== X-Forwarded-Encrypted: i=1; AJvYcCUAQcUyucieoXzBK316KBecz6xpcVJ8zw9CGPXmu5IulqcGF1y4gzPSEhoTA1KCC85B6CHNbuW+fV0q@lists.infradead.org, AJvYcCWztO1IXPaZsmNyhzO/PK+IDnBVyR3PjiK0HBiynNgcKRXj36SZOYydsy7/NKyLau7A29mCZSjwzkWgoxCWCKGQ@lists.infradead.org X-Gm-Message-State: AOJu0YzPJOkUDuGHny4i05e6/RdzpOXM/NcnkeV09kVJhIRW+5gnvZ5e 6BYD3+EeyzA2GMR019OU8CFVj7q1UsMWAuuRmlfP/8RxvtOoK0ke X-Gm-Gg: ASbGncudmuhOEQk1oZNGF4xDcwjqTmtK75PQIoAuguwfqQWu1pSRGFNJxp9rLf1I9Fh bOz8eAA1jYv2uh+JQyRcVt2PkGAjdZKGRLf9y/BHRRGGMrqFZkGj/0VTZh5IYQEYg1jbGEslaUD Ml19k2p9Zkk9KMncFRErziX/9LsZeUvFnI8a6SsCb3u5kvJ1lvVOodaC4FL0b37taGwDjhnGrVB 8Gfbn73W2tsP4uW5RmN+i1KwbWw9L6ROZIDx1cy2iaAmZuXj1hnOa4ObKIqGgrBU9Ny83UkgAgT IPM56XscoR8EK3l4P5UxnY5uJguHS4YNpD4eSqBaKbm1Clf5Lj72gIdY X-Google-Smtp-Source: AGHT+IEC8wg+03HMOeCQYRjaEL4hVw0Oam/RePsv5fuRPjO3sBxgUEwi9m+wMgy/eMHl2a2vGkenKA== X-Received: by 2002:a7b:c8c9:0:b0:436:fb02:e68 with SMTP id 5b1f17b1804b1-438913bdd6cmr55694025e9.2.1737195744926; Sat, 18 Jan 2025 02:22:24 -0800 (PST) Received: from localhost.localdomain (146.10-240-81.adsl-dyn.isp.belgacom.be. [81.240.10.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438904625f5sm64954515e9.28.2025.01.18.02.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2025 02:22:24 -0800 (PST) From: Philippe Simons To: Vinod Koul , Kishon Vijay Abraham I , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philippe Simons , linux-phy@lists.infradead.org (open list:GENERIC PHY FRAMEWORK), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Subject: [RFC PATCH 1/3] phy: don't let controllers change vbus reg Date: Sat, 18 Jan 2025 11:22:04 +0100 Message-ID: <20250118102207.9339-1-simons.philippe@gmail.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250118_022227_541357_20A9012A X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allwinners SoCs share phy0 between the MUSB controller and HCI controller. If we let these controllers independently power on the vbus on that phy, peripheral mode is dangerous because HCI never power down the phy, resulting in 5v being applied against the host 5v. Override power_on/off for phy0 in that case, and let regulator be enabled/disabled based on id_det only. Signed-off-by: Philippe Simons --- drivers/phy/allwinner/phy-sun4i-usb.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index b0f19e950..24fbabe7a 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -465,6 +465,10 @@ static int sun4i_usb_phy_power_on(struct phy *_phy) struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); int ret; + /* phy0 power is controlled by sun4i_usb_phy0_reroute and id_det state */ + if (phy->index == 0 && data->cfg->phy0_dual_route) + return 0; + if (!phy->vbus || phy->regulator_on) return 0; @@ -493,6 +497,10 @@ static int sun4i_usb_phy_power_off(struct phy *_phy) struct sun4i_usb_phy *phy = phy_get_drvdata(_phy); struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); + /* phy0 power is controlled by sun4i_usb_phy0_reroute and id_det state */ + if (phy->index == 0 && data->cfg->phy0_dual_route) + return 0; + if (!phy->vbus || !phy->regulator_on) return 0; @@ -573,9 +581,21 @@ static void sun4i_usb_phy0_reroute(struct sun4i_usb_phy_data *data, int id_det) if (id_det == 0) { /* Host mode. Route phy0 to EHCI/OHCI */ regval &= ~OTGCTL_ROUTE_MUSB; + + /* Enable VBUS reg */ + if (phy->vbus && !phy->regulator_on) { + regulator_enable(phy->vbus); + phy->regulator_on = true; + } } else { /* Peripheral mode. Route phy0 to MUSB */ regval |= OTGCTL_ROUTE_MUSB; + + /* Disable VBUS reg */ + if (phy->vbus && phy->regulator_on) { + regulator_disable(phy->vbus); + phy->regulator_on = false; + } } writel(regval, data->base + REG_PHY_OTGCTL); } @@ -603,6 +623,12 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) return; } + /* Disable internal VBUS reg if there is an external VBUS */ + if (vbus_det != 0 && phy->vbus && phy->regulator_on) { + regulator_disable(phy->vbus); + phy->regulator_on = false; + } + force_session_end = data->force_session_end; data->force_session_end = false; From patchwork Sat Jan 18 10:22:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Simons X-Patchwork-Id: 13944110 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 07572C02185 for ; Sat, 18 Jan 2025 10:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nC9ffH/nTNUFv6K8T3S/PFYpK8wABX0lQdic/jOeTiU=; b=nXuCxFzx4DqKSunIU+P8GA5pfC xdTJ+c4WWd1xc/EeKN12fee1ObtPTSCvSl1gzQbCRsba9WofaIfALphuij4LSaZ6K/1CK7O2nsZ4n cGkJFk8h/FMr8/XdEdSTLRtAYN5rMr6OkpdSuz4oYAcAEEGCZKa8hoWELxVW76N8XxrT85zKNNnWa EgjFLLkg36+FPzCurq4dKSmJgSFDpyrZSUZcyl+3ZRYbLPflVGdb/MN2PZ2yL0jHFbrqt/Qc/mEkg BVTEQ3OL+e1LdjxMwx7L74M2tvaL+yPPAdplg6ZD/77E7RzONFbb99I/dBmSFnNol0m92Y+CVQbK7 RGv4RkYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tZ60l-00000002BRf-1qGu; Sat, 18 Jan 2025 10:25:03 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tZ5yK-00000002B3F-1nBj; Sat, 18 Jan 2025 10:22:33 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43621d27adeso19245055e9.2; Sat, 18 Jan 2025 02:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737195751; x=1737800551; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=nC9ffH/nTNUFv6K8T3S/PFYpK8wABX0lQdic/jOeTiU=; b=WcAwtKEvV6dUw9tOzueX7AuZjhzKPt3fwlk1Rk3wPDbS4co7qpFX5zGakxo5lyo4A7 zBROxrWxniNx2wHqoF6ReoyoYLvPiEAq6f5bOu8tuPpmTZvzBHz3uNC8H3DQ9ZLOw6qn fnDG8oOtii5mDjTKRmoS3FWlMhOsU19zM2zOpcth/h7/tJtkQRwPCGYR7pinoYRfjOjs 8z5wsE7OjxTqJL+c/nR7skcqRK4RzCUGm7XETuYenO7b+Z1AXglRlVscb9MbEN6vXgD7 Ge/qvHm9O21XUobMMRr+iZv5rmu0oTF/KEzXxXBLGqa+3YEYYJXp7PvZptTDTk68QneS pRSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737195751; x=1737800551; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nC9ffH/nTNUFv6K8T3S/PFYpK8wABX0lQdic/jOeTiU=; b=N8+NyYT4kgVkSzcdWNmMfIQAo6QZb0+MBtKe8t70SxbFnkCkRBd4xtljgicWHSkq5u At5ItwR8HTZJqQZUg73UIQISfiWDjFPdjlUXfGHRjrpXPx5eZ7OwBMv4zaYspR54DED7 vhGA4tQPTOe3k31BN1+eddWZGII1NtPuQv39BlsEeySQr/O0rFNUXv7LvWjdk+IUCGFt db3QmfYhqWauw2ZFgDeTwHMLYwLKTJRveB/d5xfDHDrIxa65LTOJq01sw1SUQMIiT1yr ijcULpD4GIfWxspekTtBbnxKqoQjXjRE5LkSBQ20hdrQsSS3bf30B+TmJE0HsL1KJpY4 S/eA== X-Forwarded-Encrypted: i=1; AJvYcCWssA3sDrVBggD79wXTDQMPY1CLWXpxfzJru1qQJriL7VOMA+SwA0JumQbS405yj9GwJ2jMFESPQYZ5hvtMHtWj@lists.infradead.org, AJvYcCXSuXratiZvro2s1Ep2Vz/inhNyNr/x9nmBncUAtf0zWAgd9gE1MSzy1WXH/ZuQ2iTSOmRSEFCwnUe8@lists.infradead.org X-Gm-Message-State: AOJu0YzUjO2pHSbfHold1AQDZtcuMG/egi1KlkxGVr9T+3i6SgT+PIAj XrksdnQgU45B4M+0kgIqttIHyOUwSOl8PkPA0KCGEoXCws1DWdN1 X-Gm-Gg: ASbGncudpJcmHPkuUHh9SntTrzpVje7aRqS8Lkruj9qWT7KO6c2Y1dKQHxvqJ/9byDy 3Xgrvz5U5y+aN/VixDZ0RgO1hNiezMAwZTQX2r1n7RnePuUODhwcMPJRr5kQ8p/wEZqTzJ/xmuV 0zj8qE//Jrg66mIK2XQpyVnMdWN27wjJ/UoRlUR5bnS01j48gdn1VsXua7cmpvZuWww2Tl+bIyZ qK7YPidyzUG8K6LZ2KNxniBIDNsQR3mRUJbJUQh0Oy5NQpfRCY4vGr7Xf/FsaHYtzn8Xdvd8QqU wZSuEQWDc28IrIAEJb2ln0HtRmSPjOV3FwX5DmJDldB2NB1aEoYM3NY5/GoGj3swlY4= X-Google-Smtp-Source: AGHT+IEzVhZwb9RUCfq/ONUwCHiNJip3Q45A/4YRARL89NaJTkSBtQ24v5vFGO4m8bxs52aAynsUuQ== X-Received: by 2002:a05:600c:5101:b0:434:f925:f5c9 with SMTP id 5b1f17b1804b1-438913c85e0mr55777645e9.6.1737195750502; Sat, 18 Jan 2025 02:22:30 -0800 (PST) Received: from localhost.localdomain (146.10-240-81.adsl-dyn.isp.belgacom.be. [81.240.10.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438904625f5sm64954515e9.28.2025.01.18.02.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2025 02:22:30 -0800 (PST) From: Philippe Simons To: Vinod Koul , Kishon Vijay Abraham I , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philippe Simons , linux-phy@lists.infradead.org (open list:GENERIC PHY FRAMEWORK), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Subject: [RFC PATCH 2/3] phy: override dr_mode for phy0 Date: Sat, 18 Jan 2025 11:22:05 +0100 Message-ID: <20250118102207.9339-2-simons.philippe@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250118102207.9339-1-simons.philippe@gmail.com> References: <20250118102207.9339-1-simons.philippe@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250118_022232_467403_B9C19DF4 X-CRM114-Status: GOOD ( 11.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org PHY0 mode is fully determined by the selected mux route. Ignore changes requests from controllers. Signed-off-by: Philippe Simons --- drivers/phy/allwinner/phy-sun4i-usb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 24fbabe7a..f163b355e 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -544,6 +544,18 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy, return -EINVAL; } + if (data->cfg->phy0_dual_route) { + /* + For SoCs with dual route the PHY mode is fully determined by + the selected mux route (i.e. USB controller to use). + As both host (EHCI/OHCI) and peripheral (MUSB) controllers uses + the same PHY, both drivers can try to set PHY mode. + We need to ignore this requests, but not report error in case + of valid mode values. + */ + return 0; + } + if (new_mode != data->dr_mode) { dev_info(&_phy->dev, "Changing dr_mode to %d\n", new_mode); data->dr_mode = new_mode; From patchwork Sat Jan 18 10:22:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Simons X-Patchwork-Id: 13944111 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 D3038C02185 for ; Sat, 18 Jan 2025 10:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eiAkN9lM6+KhhfeepI/5N0TsoSs8qSwlei2DZBWENpE=; b=y7d6NbqP5dieYBBSTR6ZV/z+Mt 1Cqt/VJEFpR0QPkX64SXfGh/xaw1gyTT187IbWCU76UVqy6aN77Mo5aq3lhydvxip26MN8+mLg2UR fmwFSCT8SnmC47NrO9lYpCGQJCy6yV0w/sTaSzNqHkUiVDz+gHfPfdIPAZdwegyku5mhFuJj3Ua3k qWY95HIssrtDDHqbt16Hca1aqsw6gy3ReOPuWeez/lHgHvvvJAh8tr3e189DMvdxWmPnd4+/C1Aaw fCRdvH7aBDq6HwxR4oyti4Ab0Fc8VhXMIvYADET7XxstF2LvLkmeV5z7Wkau6VNiywhf5oEMb4U8f lrGyOknQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tZ620-00000002BZu-0EiN; Sat, 18 Jan 2025 10:26:20 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tZ5yL-00000002B3y-46NW for linux-arm-kernel@lists.infradead.org; Sat, 18 Jan 2025 10:22:35 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so28528255e9.1 for ; Sat, 18 Jan 2025 02:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737195752; x=1737800552; darn=lists.infradead.org; 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=eiAkN9lM6+KhhfeepI/5N0TsoSs8qSwlei2DZBWENpE=; b=lfcU8pB5JgtGEcksKAmHLD8wFL54fnAlBKc9uUNuWMILxtfoLHXjJR0RZMzFPkV9c1 M6QlwfQEa52VJVSi+7ey6X9j0LISG7M2kGKqPVoQklijbFI9HKdGcl19E609hQxzgPwn GhBFlZe7S1mIF+XgkUNv2bmVnl05XcMgvn3yDKJBMIS2F8VVyrqPMb60vVNK7FAwqmce 2mpv4nT6KiXlcBYzGWIFsTVA1sAWvBSZpoueBx/krqX8+Fq9GQVrsOGb7h6vZ0z99kIH fIOtC8sOmdqtzbLRFeON2jTZZxEsGfQLRaikzFk5btJ8LkQLwVrSGd0MuIM+bXQn3rql dLdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737195752; x=1737800552; 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=eiAkN9lM6+KhhfeepI/5N0TsoSs8qSwlei2DZBWENpE=; b=HY+F6mWKbxOoiDqbn1VyrNhi/3E54gQtnmFQ0CbfyI8mOsK9q7s24RA4d03Xmgg3zg nOJdT/Mo4yULg09atqHAU0uQjCmZx5uIZzNrNy2AbHEPLvoLFbmVD/0qes+XxfAXxopB BZgueee4zU6KUobAYqnfgQwSkWZoD1rnXwDwrq/fgpPoSX/GmvO5R+6ewQHvlFPkWjQT l7wjWUjMAOax2MWpOFZqEOGba+UYnSd58f67/iYqNRxXKGnMKQfGr1S3aZdg5BElBRxL HvS5gQd4L3BEZu76m+sX7hc/WOpqfYu4CoPmVSkEkF5aMo03sMShXXJc+JlR+AFrkjc9 tj8w== X-Forwarded-Encrypted: i=1; AJvYcCXXEi1THhsBIc0ulgbM2DPRSKKp7tL0Hcl0l+716VxVlxALgBw+OlG4CmLcwkAGmMIrB9RkbSTu+VPBfax07hxO@lists.infradead.org X-Gm-Message-State: AOJu0Yx7A52yjmaQjmeDcGdcLnbU98Mq8duoR7B32Zap7l6TmzD7ExbN yW59StNH8rYOzmrWbMXC7u2BbbbdQIBmzqxIqQoNRjIup+lcqJw+ X-Gm-Gg: ASbGnctZExe6WDScu209TEg3td5N0ZvH+RVA9TDfYMpulQiPwN81vmGcAdaHLUeJoTv /ZssbbKw75BX6hIM1Ctr6eJ/zY8YcZigA/Po97sXGPpgdMShhhkTIGlSjNL+OWBzjLYiV7Q55xf 2gQ3Cuax+0hGlDhtkVwhZwdeIzShykXPL6NUXBUh0a+RPNoAhtbDaoxlvBxkumDe/tMu35Gt3I6 iMaL64qJEsUVFlyJDfl+Gn2BcGDwJeA9IYFfZxQ1ItrmHi7HJ3BYUGeCVZAPgSYQC6uXSmiwXXg H/G0i4XFdnmwtiqJUd02X7CevHgquNmmd2S/ffm1AXn+vOj1tW5/w8gL X-Google-Smtp-Source: AGHT+IEg75B51PBOkr41mFVL8S0eZZqlWUj0q/2aF0Yoeffu4iW9O1RDKnjkpOJD7XMKrnqAu7NcQg== X-Received: by 2002:a05:600c:1c9d:b0:434:ffd7:6fd2 with SMTP id 5b1f17b1804b1-438913ca1ccmr55465325e9.7.1737195752087; Sat, 18 Jan 2025 02:22:32 -0800 (PST) Received: from localhost.localdomain (146.10-240-81.adsl-dyn.isp.belgacom.be. [81.240.10.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438904625f5sm64954515e9.28.2025.01.18.02.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2025 02:22:31 -0800 (PST) From: Philippe Simons To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Cc: Philippe Simons Subject: [RFC PATCH 3/3] arm64: dts: allwinner: h700: Enable USB OTG Date: Sat, 18 Jan 2025 11:22:06 +0100 Message-ID: <20250118102207.9339-3-simons.philippe@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250118102207.9339-1-simons.philippe@gmail.com> References: <20250118102207.9339-1-simons.philippe@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250118_022234_020057_5258ADFB X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org RG35XX have a GPIO controlled regulator for phy0 vbus, add it. Enable HCI0s controllers and otg for dr_mode. Add phy0 properties to descrive id_det, external vbus, and internal vbus Signed-off-by: Philippe Simons Reviewed-by: Jernej Skrabec --- .../sun50i-h700-anbernic-rg35xx-2024.dts | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts index 80ccab7b5..5a6ae42de 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts @@ -175,6 +175,16 @@ reg_vcc5v: regulator-vcc5v { /* USB-C power input */ regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; }; + + reg_usb0_vbus: regulator-usb0-vbus { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&pio 8 16 GPIO_ACTIVE_HIGH>; /* PI16 */ + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-name = "usb0-vbus"; + vin-supply = <®_boost>; + }; }; &cpu0 { @@ -337,12 +347,23 @@ &uart0 { status = "okay"; }; -/* the AXP717 has USB type-C role switch functionality, not yet described by the binding */ +/* the AXP717 has USB type-C role switch functionality */ &usbotg { - dr_mode = "peripheral"; /* USB type-C receptable */ + dr_mode = "otg"; /* USB type-C receptable */ + status = "okay"; +}; + +&ehci0 { + status = "okay"; +}; + +&ohci0 { status = "okay"; }; &usbphy { + usb0_id_det-gpios = <&pio 8 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PI4 */ + usb0_vbus_power-supply = <&usb_power>; + usb0_vbus-supply = <®_usb0_vbus>; status = "okay"; };