Received: by 10.192.165.148 with SMTP id m20csp2546627imm; Sun, 22 Apr 2018 09:17:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/999FlnSCL2B0UmueyeC476pmXGp018PF48yRCli+JjpKR8q5CdTmuaVtXts+PlflV5vkg X-Received: by 2002:a17:902:294a:: with SMTP id g68-v6mr14378576plb.110.1524413842631; Sun, 22 Apr 2018 09:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524413842; cv=none; d=google.com; s=arc-20160816; b=xt54CXwE7RFacE1QqnbjhFP0cqeDjHqPhWZytaywqz6NtOg0iEiGOrjOcRM4EDlfrL Yc0MxsKxI+RcSct/yN2q//r28f5K23cVVvwED+goeFd1EXuDQxYbz5BgLsF5f+DLPARz 4RnDlv3HfVM+Coht6XtspOdqdqx6rhBG9Ik6HIN6ep+9hknSbaD+s44Czd9W0GrdAfEv QybwBaVS0Z3nBwJ5lddByh2m5txOXG7UhOmsD9smVd2CQARf7NF2netBtcW3FDc19GVA kHfI/3te5VsmGk30giC7UQouGZNZL2ubba1+MxbDSy/5TXyEd40LFuQBNp8rnme1dGmQ AYqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6ctqpjEm3KkhLDUdfOg6nfsIzRErv6ljpf08M8d+OXo=; b=q7lKFKZn4/R87kPKTdXo8cp1TyU+Ek9cvgpQpt0GmhU1U/bdDNxUSiQY04dhu78YID EkeD1FNgZPrM1KaxEJdG4Autax+AWSGPlKjb5J47SvDZ1eYjaqsoLfREqtTkJ/EkofLs U3K7MxL6vl+8fweuOgTCHiivHVasg+y+b1azOOZSkDE1I5CmLTknBKy71fbcUbSM199q TPm3qyi9WHm8c8uC6cYVF0Fc/WudR4wCV3Q74tZ8elX4aJtIGv9j7N3FbrodpMFDeCS5 jnDFOgM+4WCUPF55q76gN9ORwaT9fEiXoSKvE0f0w0t6fl/dvyzw48dsVGJs5NTYpkfS oO0Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5-v6si4399281pli.409.2018.04.22.09.17.08; Sun, 22 Apr 2018 09:17:22 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753983AbeDVQPD (ORCPT + 99 others); Sun, 22 Apr 2018 12:15:03 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44430 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753406AbeDVNzE (ORCPT ); Sun, 22 Apr 2018 09:55:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BF4EB951; Sun, 22 Apr 2018 13:55:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard , Kishon Vijay Abraham I Subject: [PATCH 4.16 018/196] phy: allwinner: sun4i-usb: poll vbus changes on A23/A33 when driving VBUS Date: Sun, 22 Apr 2018 15:50:38 +0200 Message-Id: <20180422135105.065588730@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen-Yu Tsai commit d7119224bfe6e8efbf821a52db7da9530d790f07 upstream. The AXP223 PMIC, like the AXP221, does not generate VBUS change interrupts when N_VBUSEN is used to drive VBUS for the OTG port on the board. This was not noticed until recently, as most A23/A33 boards use a GPIO pin that does not support interrupts for OTG ID detection. This forces the driver to use polling. However the A33-OlinuXino uses a pin that does support interrupts, so the driver uses them. However the VBUS interrupt never fires, and the driver never gets to update the VBUS status. This results in musb timing out waiting for VBUS to rise. This was worked around for the AXP221 by resorting to polling changes in commit 91d96f06a760 ("phy-sun4i-usb: Add workaround for missing Vbus det interrupts on A31"). This patch adds the A23 and A33 to the list of SoCs that need the workaround. Fixes: fc1f45ed3043 ("phy-sun4i-usb: Add support for the usb-phys on the sun8i-a33 SoC") Fixes: 123dfdbcfaf5 ("phy-sun4i-usb: Add support for the usb-phys on the sun8i-a23 SoC") Cc: # 4.3.x: 68dbc2ce77bb phy-sun4i-usb: Use of_match_node to get model specific config data Cc: # 4.3.x: 5cf700ac9d50 phy: phy-sun4i-usb: Fix optional gpios failing probe Cc: # 4.3.x: 04e59a0211ff phy-sun4i-usb: Fix irq free conditions to match request conditions Cc: # 4.3.x: 91d96f06a760 phy-sun4i-usb: Add workaround for missing Vbus det interrupts on A31 Cc: # 4.3.x Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Greg Kroah-Hartman Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/allwinner/phy-sun4i-usb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -410,11 +410,13 @@ static bool sun4i_usb_phy0_poll(struct s return true; /* - * The A31 companion pmic (axp221) does not generate vbus change - * interrupts when the board is driving vbus, so we must poll + * The A31/A23/A33 companion pmics (AXP221/AXP223) do not + * generate vbus change interrupts when the board is driving + * vbus using the N_VBUSEN pin on the pmic, so we must poll * when using the pmic for vbus-det _and_ we're driving vbus. */ - if (data->cfg->type == sun6i_a31_phy && + if ((data->cfg->type == sun6i_a31_phy || + data->cfg->type == sun8i_a33_phy) && data->vbus_power_supply && data->phys[0].regulator_on) return true; @@ -885,7 +887,7 @@ static const struct sun4i_usb_phy_cfg su static const struct sun4i_usb_phy_cfg sun8i_a23_cfg = { .num_phys = 2, - .type = sun4i_a10_phy, + .type = sun6i_a31_phy, .disc_thresh = 3, .phyctl_offset = REG_PHYCTL_A10, .dedicated_clocks = true,