From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: [1/2] phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs From: Chen-Yu Tsai Message-Id: <20190322085108.18693-2-wens@kernel.org> Date: Fri, 22 Mar 2019 16:51:07 +0800 To: Maxime Ripard , Greg Kroah-Hartman , Kishon Vijay Abraham I Cc: Chen-Yu Tsai , Grygorii Strashko , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org List-ID: RnJvbTogQ2hlbi1ZdSBUc2FpIDx3ZW5zQGNzaWUub3JnPgoKV2hpbGUgb25seSB0aGUgZmlyc3Qg UEhZIHN1cHBvcnRzIG1vZGUgc3dpdGNoaW5nLCB0aGUgcmVtYWluaW5nIFBIWXMKd29yayBpbiBV U0IgaG9zdCBtb2RlLiBUaGV5IHNob3VsZCBzdXBwb3J0IHNldF9tb2RlIHdpdGggbW9kZT1VU0Jf SE9TVAppbnN0ZWFkIG9mIGZhaWxpbmcuIFRoaXMgaXMgZXNwZWNpYWxseSBuZWVkZWQgbm93IHRo YXQgdGhlIFVTQiBjb3JlIGRvZXMKc2V0X21vZGUgZm9yIGFsbCBVU0IgcG9ydHMsIHdoaWNoIHdh cyBhZGRlZCBpbiBjb21taXQgYjk3YTMxMzQ4Mzc5ICgidXNiOgpjb3JlOiBjb21wbHkgdG8gUEhZ IGZyYW1ld29yayIpLgoKTWFrZSBzZXRfbW9kZSB3aXRoIG1vZGU9VVNCX0hPU1QgYSBuby1vcCBp bnN0ZWFkIG9mIGZhaWxpbmcgZm9yIHRoZQpub24tT1RHIFVTQiBQSFlzLgoKRml4ZXM6IDZiYTQz YzI5MTk2MSAoInBoeS1zdW40aS11c2I6IEFkZCBzdXBwb3J0IGZvciBwaHlfc2V0X21vZGUiKQpT aWduZWQtb2ZmLWJ5OiBDaGVuLVl1IFRzYWkgPHdlbnNAY3NpZS5vcmc+Ci0tLQogZHJpdmVycy9w aHkvYWxsd2lubmVyL3BoeS1zdW40aS11c2IuYyB8IDUgKysrKy0KIDEgZmlsZSBjaGFuZ2VkLCA0 IGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9kcml2ZXJzL3BoeS9h bGx3aW5uZXIvcGh5LXN1bjRpLXVzYi5jIGIvZHJpdmVycy9waHkvYWxsd2lubmVyL3BoeS1zdW40 aS11c2IuYwppbmRleCA1MTYzMDk3YjQzZGYuLjRiYmQ5ZWRlMzhjOCAxMDA2NDQKLS0tIGEvZHJp dmVycy9waHkvYWxsd2lubmVyL3BoeS1zdW40aS11c2IuYworKysgYi9kcml2ZXJzL3BoeS9hbGx3 aW5uZXIvcGh5LXN1bjRpLXVzYi5jCkBAIC00ODUsOCArNDg1LDExIEBAIHN0YXRpYyBpbnQgc3Vu NGlfdXNiX3BoeV9zZXRfbW9kZShzdHJ1Y3QgcGh5ICpfcGh5LAogCXN0cnVjdCBzdW40aV91c2Jf cGh5X2RhdGEgKmRhdGEgPSB0b19zdW40aV91c2JfcGh5X2RhdGEocGh5KTsKIAlpbnQgbmV3X21v ZGU7CiAKLQlpZiAocGh5LT5pbmRleCAhPSAwKQorCWlmIChwaHktPmluZGV4ICE9IDApIHsKKwkJ aWYgKG1vZGUgPT0gUEhZX01PREVfVVNCX0hPU1QpCisJCQlyZXR1cm4gMDsKIAkJcmV0dXJuIC1F SU5WQUw7CisJfQogCiAJc3dpdGNoIChtb2RlKSB7CiAJY2FzZSBQSFlfTU9ERV9VU0JfSE9TVDoK From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F5A7C43381 for ; Fri, 22 Mar 2019 08:51:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 00391218E2 for ; Fri, 22 Mar 2019 08:51:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DEFv+vYr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00391218E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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-Cx; 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40EEFC43381 for ; Fri, 22 Mar 2019 08:51:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 111B7218D3 for ; Fri, 22 Mar 2019 08:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553244687; bh=tuivY8FVXe+dDskDzGEI/mSiKa6zdBLHLrYDQLGYPtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s9/4AuL6nPIMZkQJQoq0VyFdPEPqDHXS4kfE6f9abhiy7TNb6eoy6m1UdtQmF5biw yZs5bqgaGBCHOcmt19Gh5FodAg9BJsdf03I69U+CfZecuAA3IPuui7g2PygbviMtTa e5GhJeBtx1VcQN+jsSVAEBhuQAC+j/MUKjFHZmQM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727797AbfCVIvT (ORCPT ); Fri, 22 Mar 2019 04:51:19 -0400 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:41772 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727538AbfCVIvS (ORCPT ); Fri, 22 Mar 2019 04:51:18 -0400 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 Cc: Chen-Yu Tsai , Grygorii Strashko , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: -- 2.20.1