From nobody Mon Sep 29 20:17:09 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 C8DD6C25B0D for ; Tue, 16 Aug 2022 00:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350428AbiHPAXi (ORCPT ); Mon, 15 Aug 2022 20:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345410AbiHPARa (ORCPT ); Mon, 15 Aug 2022 20:17:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF62179E18; Mon, 15 Aug 2022 13:30:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D124861089; Mon, 15 Aug 2022 20:30:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB4E4C433C1; Mon, 15 Aug 2022 20:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595454; bh=VectoRnel6ZxlxWCEKAW8w1l70sUcU5royMSTDmQfLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GAFEqObxRHamco8jEcYDsDnHJ+IVaP3EABVSyqCHxBdremKXZgPGkDajXFoKhu453 HNzWSCWLKtQ3VZkekZ2R8UCLPaG59VXmlpYRNr+5XMB/K2O7+BY6r92rQExIF0Oh35 IWRLW0D+N0bCwQqVKFluZjVsd5I+rn3Q9KYuqICI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Geis , Samuel Holland , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 0770/1157] phy: rockchip-inno-usb2: Sync initial otg state Date: Mon, 15 Aug 2022 20:02:06 +0200 Message-Id: <20220815180510.296325766@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Geis [ Upstream commit 8dc60f8da22fdbaa1fafcfb5ff6d24bc9eff56aa ] The initial otg state for the phy defaults to device mode. The actual state isn't detected until an ID IRQ fires. Fix this by syncing the ID state during initialization. Fixes: 51a9b2c03dd3 ("phy: rockchip-inno-usb2: Handle ID IRQ") Signed-off-by: Peter Geis Reviewed-by: Samuel Holland Link: https://lore.kernel.org/r/20220622003140.30365-1-pgwipeout@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/ro= ckchip/phy-rockchip-inno-usb2.c index 6711659f727c..6e44069617df 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1162,6 +1162,12 @@ static int rockchip_usb2phy_otg_port_init(struct roc= kchip_usb2phy *rphy, EXTCON_USB_HOST, &rport->event_nb); if (ret) dev_err(rphy->dev, "register USB HOST notifier failed\n"); + + if (!of_property_read_bool(rphy->dev->of_node, "extcon")) { + /* do initial sync of usb state */ + ret =3D property_enabled(rphy->grf, &rport->port_cfg->utmi_id); + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); + } } =20 out: --=20 2.35.1