From patchwork Fri Mar 22 08:51:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10865281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A282E14DE for ; Fri, 22 Mar 2019 08:51:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 803282A5AB for ; Fri, 22 Mar 2019 08:51:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73E8E2A5BF; Fri, 22 Mar 2019 08:51:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2E1452A5AB for ; Fri, 22 Mar 2019 08:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6azfn5NgkPs48EXfsGr+aYYEAFNquvMzHNMz0xGIQFU=; b=DEFv+vYrutZWE8 PNrxmMs2fbOjVXqxaNo4iYCSmi92R1S0I6Ez6jY0MmN3iZdxrLMEF48oufxh4DfUBVcWs0H25S7WK GoKPB1UD/RjKtS0q9k4xY0HBVlVym55TRF1IuroTDZ7Pw62fY++/+S9Q1EeJt2UwJNGp8Gh0yo8RD 2IcCcXheZe5tWv61hJ7PWdzyRDijG6jc88JbkbuyDdD+ecW2wGGtzhRhthejWSoawvsChH31nKs+G keK3jWI7/zClvcoLqT8B8to2+uwO+x8lZu44lV8AZFSU7OMB4yyC3DaLGdLG7CJgBDXx+LeRmp/6+ K5773SxjHZX8SKJi3nHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7Ftj-00009B-9O; Fri, 22 Mar 2019 08:51:31 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7Ftf-00007J-Bl for linux-arm-kernel@lists.infradead.org; Fri, 22 Mar 2019 08:51:29 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id C59C25F899; Fri, 22 Mar 2019 16:51:15 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Greg Kroah-Hartman , Kishon Vijay Abraham I Subject: [PATCH 1/2] phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs Date: Fri, 22 Mar 2019 16:51:07 +0800 Message-Id: <20190322085108.18693-2-wens@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190322085108.18693-1-wens@kernel.org> References: <20190322085108.18693-1-wens@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190322_015127_563966_DBE53B2F X-CRM114-Status: GOOD ( 10.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chen-Yu Tsai , Grygorii Strashko , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chen-Yu Tsai While only the first PHY supports mode switching, the remaining PHYs work in USB host mode. They should support set_mode with mode=USB_HOST instead of failing. This is especially needed now that the USB core does set_mode for all USB ports, which was added in commit b97a31348379 ("usb: core: comply to PHY framework"). Make set_mode with mode=USB_HOST a no-op instead of failing for the non-OTG USB PHYs. Fixes: 6ba43c291961 ("phy-sun4i-usb: Add support for phy_set_mode") Signed-off-by: Chen-Yu Tsai --- drivers/phy/allwinner/phy-sun4i-usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 5163097b43df..4bbd9ede38c8 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -485,8 +485,11 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy, struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); int new_mode; - if (phy->index != 0) + if (phy->index != 0) { + if (mode == PHY_MODE_USB_HOST) + return 0; return -EINVAL; + } switch (mode) { case PHY_MODE_USB_HOST: