From nobody Thu Dec 18 15:43:32 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE9EC7EE25 for ; Thu, 11 May 2023 21:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239328AbjEKVFZ (ORCPT ); Thu, 11 May 2023 17:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238792AbjEKVFN (ORCPT ); Thu, 11 May 2023 17:05:13 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A3F7EE9; Thu, 11 May 2023 14:05:11 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 2567B5FD62; Fri, 12 May 2023 00:05:10 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1683839110; bh=izMKXdTFH1h2UBa+MY3F3v9dqaNkzDFsQICpQYJio5U=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=lAqWEQ3PMUY37Xoo9RjMkqSYFW71Ex4lEIV5r5bPkbSm3VvjG6VN21slRxo3EtFPn NdCJ9UsMt+lb5YdHQLxs9aERJ/MIwokQFNHbCr+pQ5AKLS5NXKbUREgi0py/ifPm5n nV0vIAh783Roh1WO6WU4OjiXjxPCHLNhSNQbeFcdmJCs7H/AehdA0l3dgLy6PWjVm+ U3TIRhTuxct1FCuElre23kqogWOUp+7mUkZ4gi9CiBF3KNeho4wJv/TsKP8CYJlm5F aHCBdCx9cBFt5nMbdIlLeAyGEIE0cvEMHQ4npapWjZIomKzH1uRD0vNgVJaz0T23t2 0pBkT95bf2kLw== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Fri, 12 May 2023 00:05:10 +0300 (MSK) From: Dmitry Rokosov To: , , , , , , , , , , , CC: , , , , , , , , , , Dmitry Rokosov Subject: [PATCH v4 3/3] usb: dwc3-meson-g12a: support OTG switch for all IP versions Date: Fri, 12 May 2023 00:04:55 +0300 Message-ID: <20230511210455.6634-4-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230511210455.6634-1-ddrokosov@sberdevices.ru> References: <20230511210455.6634-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH02.sberdevices.ru (172.16.1.5) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/05/11 10:21:00 #21259776 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From now, the Amlogic A1 USB controller is capable of switching between host and gadget modes based on the status of the OTG_ID signal or via manual USB role change. Previously, only the Amlogic A1 IP version did not use OTG support for host only mode, but this is no longer applicable. Therefore, the 'otg_switch_supported' option can now be removed as it is no longer required. Signed-off-by: Dmitry Rokosov Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl --- drivers/usb/dwc3/dwc3-meson-g12a.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-mes= on-g12a.c index b282ad0e69c6..a13afdb219e8 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -140,7 +140,6 @@ static const char * const meson_a1_phy_names[] =3D { struct dwc3_meson_g12a; =20 struct dwc3_meson_g12a_drvdata { - bool otg_switch_supported; bool otg_phy_host_port_disable; struct clk_bulk_data *clks; int num_clks; @@ -189,7 +188,6 @@ static int dwc3_meson_gxl_usb_post_init(struct dwc3_mes= on_g12a *priv); */ =20 static const struct dwc3_meson_g12a_drvdata gxl_drvdata =3D { - .otg_switch_supported =3D true, .otg_phy_host_port_disable =3D true, .clks =3D meson_gxl_clocks, .num_clks =3D ARRAY_SIZE(meson_g12a_clocks), @@ -203,7 +201,6 @@ static const struct dwc3_meson_g12a_drvdata gxl_drvdata= =3D { }; =20 static const struct dwc3_meson_g12a_drvdata gxm_drvdata =3D { - .otg_switch_supported =3D true, .otg_phy_host_port_disable =3D true, .clks =3D meson_gxl_clocks, .num_clks =3D ARRAY_SIZE(meson_g12a_clocks), @@ -217,7 +214,6 @@ static const struct dwc3_meson_g12a_drvdata gxm_drvdata= =3D { }; =20 static const struct dwc3_meson_g12a_drvdata axg_drvdata =3D { - .otg_switch_supported =3D true, .clks =3D meson_gxl_clocks, .num_clks =3D ARRAY_SIZE(meson_gxl_clocks), .phy_names =3D meson_a1_phy_names, @@ -230,7 +226,6 @@ static const struct dwc3_meson_g12a_drvdata axg_drvdata= =3D { }; =20 static const struct dwc3_meson_g12a_drvdata g12a_drvdata =3D { - .otg_switch_supported =3D true, .clks =3D meson_g12a_clocks, .num_clks =3D ARRAY_SIZE(meson_g12a_clocks), .phy_names =3D meson_g12a_phy_names, @@ -242,7 +237,6 @@ static const struct dwc3_meson_g12a_drvdata g12a_drvdat= a =3D { }; =20 static const struct dwc3_meson_g12a_drvdata a1_drvdata =3D { - .otg_switch_supported =3D false, .clks =3D meson_a1_clocks, .num_clks =3D ARRAY_SIZE(meson_a1_clocks), .phy_names =3D meson_a1_phy_names, @@ -307,7 +301,7 @@ static int dwc3_meson_g12a_usb2_init_phy(struct dwc3_me= son_g12a *priv, int i, U2P_R0_POWER_ON_RESET, U2P_R0_POWER_ON_RESET); =20 - if (priv->drvdata->otg_switch_supported && i =3D=3D USB2_OTG_PHY) { + if (i =3D=3D USB2_OTG_PHY) { regmap_update_bits(priv->u2p_regmap[i], U2P_R0, U2P_R0_ID_PULLUP | U2P_R0_DRV_VBUS, U2P_R0_ID_PULLUP | U2P_R0_DRV_VBUS); @@ -490,7 +484,7 @@ static int dwc3_meson_g12a_otg_mode_set(struct dwc3_mes= on_g12a *priv, { int ret; =20 - if (!priv->drvdata->otg_switch_supported || !priv->phys[USB2_OTG_PHY]) + if (!priv->phys[USB2_OTG_PHY]) return -EINVAL; =20 if (mode =3D=3D PHY_MODE_USB_HOST) @@ -589,9 +583,6 @@ static int dwc3_meson_g12a_otg_init(struct platform_dev= ice *pdev, int ret, irq; struct device *dev =3D &pdev->dev; =20 - if (!priv->drvdata->otg_switch_supported) - return 0; - if (priv->otg_mode =3D=3D USB_DR_MODE_OTG) { /* Ack irq before registering */ regmap_update_bits(priv->usb_glue_regmap, USB_R5, @@ -841,8 +832,7 @@ static int dwc3_meson_g12a_remove(struct platform_devic= e *pdev) struct device *dev =3D &pdev->dev; int i; =20 - if (priv->drvdata->otg_switch_supported) - usb_role_switch_unregister(priv->role_switch); + usb_role_switch_unregister(priv->role_switch); =20 of_platform_depopulate(dev); =20 --=20 2.36.0