Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp469521img; Fri, 22 Mar 2019 01:52:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWM0sEFjhvH8xQBf47OAAKGvRpQ2mT9I5c24VZsT1EoF0c0ab1OPLdwgfAIdA/J9h8xToB X-Received: by 2002:a17:902:2bc9:: with SMTP id l67mr8267408plb.102.1553244748854; Fri, 22 Mar 2019 01:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553244748; cv=none; d=google.com; s=arc-20160816; b=dDYBdD/Xyc+doEYq+LKba3E52nopEp0zg3c8mi0EPzd9sSc2GoNIPIUYK5Aw/scXnq r0T15nSYT/eKSDIlSjOYFmnvzd36wo8T85dIljF4XdDcqjokvM3Eh6RoWtPQfPdSBRZO ExO5z+DNakPnVuwWv7tUSGhmSMpT6xJxJhh1jrwCZhSyEptGAcuAOBld1A7jlaAInbRe 2LBZNgyT89HfEWrRloIE42zSHIQA7zlWrLdO8daXYIePwEsZ/9IDB631GPOu1kvXVIa0 Rq6bnBZKzRF7fzmlfEhaqjw8zYcAS6nN4N/0EUIlnW8SG8wlAQ35D8foH/1/AZBiAiav wbpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3IjAci/AApv6TkLmiXF7ZTZ8bBdqcsRx3/DM6jtCvXU=; b=RfL0pMbUyEBAnkDQNgmvF3H4aNwE7C/X/vaoApxyO8M146G2xHWd8xXaM2KfvTUZVA CDpKFBs+NU8JUdzYX7hMJZyOzswTo/JYgfaWZnz51qFonBAD6BUcDL4qdN3VUjkWmhsg Hn0SNiBIfM3UqWDYBOfLX2BYaSU5SNHMQ8JB/j9H9NQnPZFKeWGdg2DqJ8n948s0AVVE yKSg0GF3hCPwHSlOpw/eWvH94YLdpGDNg6/K+yidJ7YLH05xseYRzUx0lD9ilwh8eXFv /NjpRCfnb1vXSPVohMafvNXL8AE9ecwnOmYSKTdRTNXiFwkSoPSIFl5F/nzmjE5aZUhA 7UDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si6764446plb.407.2019.03.22.01.52.07; Fri, 22 Mar 2019 01:52:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfCVIvS (ORCPT + 99 others); Fri, 22 Mar 2019 04:51:18 -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