Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3084616rwb; Mon, 15 Aug 2022 17:45:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR4tlNuXwLfP4eerfomt2PMv+s8KU+so5LvIQsWnNUPdyIldhCxkroyKqS+NAjRIV28f5y3G X-Received: by 2002:a05:6402:177b:b0:43d:64c5:7799 with SMTP id da27-20020a056402177b00b0043d64c57799mr17199486edb.180.1660610708286; Mon, 15 Aug 2022 17:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610708; cv=none; d=google.com; s=arc-20160816; b=yfmwlih/eDM9jkT8RSkxEDa+GRmBXOOZbis9uudC9jRtUgUrGYSOOFmcP7qIsQa8rg 8uypd6OmYrb90S+2yTT+veAgZ/fuCpPmoktXkijZ2KklCt8VJ8J7WGO7ut/NwaaAJbhi 8laSa3+soNZXoM5/gZiLOyWQyllTIAh9/QmHy2siGjgfCJgt9Uf+USh4Gmc8eB7N205n iAGtincvvm6w37gFvRxAbUU6DLNjauPCCfAVzChEiMjx+xxrRCfgDCD+lWEgjSbvBubU h+uafWOLPxS5Prh0niZ6XEQrkhT5j8U/oD9/mMoqOmyxI3bnLFri/jT/GEMEeGlLvf08 AT7Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qxgw9CPNbYpZvbp4r7K5AlG5w5huS7i26k2xC1N+hZA=; b=PocWAw2/gL7AmofcHm0uAPrtvmpx2AiFPio7h9id5LQqnCjZ0cqPjD8D2nDex95yvA q9hdBD6LuMT+/r0W43pNTVqhZAeE/pBk9gOh/dskvn2uWhXpEwaiJbhz4McEF79KrrOQ w0G8t4yo9yG6C1XZh5BwQSez0kUPUvrgOmC/57A4pJfzlnEKLKPVl9p0/sh+hJ0Kzj6h 3Eh9kb7HbEZwTMrylRIJsMLq8npfraz/37fcQRAz4Raaw28C0V0k/e8wejJlW6Ky8AgZ HZTkc2hbgBllBVqUagULCdw+nr6Q+MbnGta01Yb61ttEtfMyiYKqBizILcSpW5HfMfqo LNgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GAFEqObx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a170906844b00b00730c7c8b7b7si7004566ejy.587.2022.08.15.17.44.42; Mon, 15 Aug 2022 17:45:08 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GAFEqObx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352055AbiHPAXa (ORCPT + 99 others); Mon, 15 Aug 2022 20:23:30 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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/rockchip/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 rockchip_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 = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); + } } out: -- 2.35.1