Received: by 10.223.185.116 with SMTP id b49csp1031063wrg; Fri, 16 Feb 2018 11:08:06 -0800 (PST) X-Google-Smtp-Source: AH8x227Zb6GgSv7UdLTQN55Ad1KPhY4zOGa1ABiC8r3z3CUa3sL5yp9jD6prvdTCZc+nQaQ6zYRG X-Received: by 2002:a17:902:c81:: with SMTP id 1-v6mr6735166plt.281.1518808086075; Fri, 16 Feb 2018 11:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808086; cv=none; d=google.com; s=arc-20160816; b=aRNZgZ5zxFxq71uoLx8OnAD3vKXvYUic8eXpMwRtmEAR8Oki8DkYZsT4OwICCdRSd2 JauxCgyn6r9g967Q1JwK44NGtebI1IZ9lKiD5v3J95uIzs19gtpi+ngPzIkveAb2mkP2 oMTavbcALnY1ioyI0pa/ODJp7/cd33Ir7ZR9lWn198IVgCW5yiEBN2ibSN39DjIxzhwz R25uUjNUPC/fBluGvfZxlXqSS/ZIL7d0iKt+hYtvL1OGAOWvi4dNzkjNCsPmM4nf6pG9 soWdY7dhXiwIbgZP9lPkvh00Bwm8oSQ25nOUcaBWNl4vCuG6Vngn5RxPn/TEueRhc3eO P4Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=0a+aAm/q8DS/PPL8rhM3HEluRfo7lMPZwNV/kFSHb+Q=; b=p+ILBtgqK7SoNP0adP36EYWdVj/F/z1+7juorDEJbv5PdYz79V4RFztdLVKjSJZgpT 9VwPQIDbMN4p67/LQ0hrehyrCaOTmew3s0xIv9FFrIVCGrJFwx4UYePjOIgIyEWeT0XB 5KhCeY2MJqOT8DZ/fWjRnKsbfI7wYvJf416mcXld3n/X5y2WCA7c0acwfrHyxpmkl+mN SIPYSFhcGxqQTb2W9tF6H+6Ks1Rw9yg3OevhnX2mGJ61uKh7h/5hqV9MgioNGfnyNNt/ xpyX6ZaqI+6VubjbZbikC3C1c65S2d4l07xGv9yWqPLAGh0hqhSVQOXXJbew6nIwE871 yAXw== 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 e13-v6si1438544plo.242.2018.02.16.11.07.51; Fri, 16 Feb 2018 11:08:06 -0800 (PST) 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 S967751AbeBPMwo (ORCPT + 99 others); Fri, 16 Feb 2018 07:52:44 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40861 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967661AbeBPMwm (ORCPT ); Fri, 16 Feb 2018 07:52:42 -0500 Received: by mail-wm0-f66.google.com with SMTP id v10so2948040wmh.5; Fri, 16 Feb 2018 04:52:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0a+aAm/q8DS/PPL8rhM3HEluRfo7lMPZwNV/kFSHb+Q=; b=n4tJBBaYDIiFfjUf0d3eM7TS1TA8A+osfuD7ZThIHHYWKH233H0tRO9g3HrjHpG4mL +5Tj66CuLz5YMmtc0uo4F/EDuvnrd/1hdUWPun2RMBzPwnAE/QTuZWNEBJJKjkYJuXRn f5ikdEMv7TSxAP1ETqI9laKAm8GaM0Vs+0aHMsseW2n5B3JCQ3R3P8LCKHlprJ37inkh xxMbTmB/1QVQ3PHEP0wm/toI0921vgQ+ct6cZ7a5IQl9jBOhCO5+0sh+UHIxrBtTIyyw tc0opJrcRBFrK3uYlWzEdl/3anB3BVnP5N4pBkLI2FizxYPKpCahGD+npxv5atu08F/R XKyA== X-Gm-Message-State: APf1xPDwIZjip6JG5+psR4jM81VhqXcrlLH8KeIwrq42PDQYDew6ug0/ y6GoFRsfL2zi5QTvGSwR7NItEt8+ X-Received: by 10.80.143.38 with SMTP id 35mr7657755edy.183.1518785560428; Fri, 16 Feb 2018 04:52:40 -0800 (PST) Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com. [209.85.128.178]) by smtp.gmail.com with ESMTPSA id d30sm13451834edd.90.2018.02.16.04.52.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 04:52:40 -0800 (PST) Received: by mail-wr0-f178.google.com with SMTP id f8so2795880wrh.8; Fri, 16 Feb 2018 04:52:40 -0800 (PST) X-Received: by 10.223.135.18 with SMTP id a18mr5419494wra.126.1518785559609; Fri, 16 Feb 2018 04:52:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.134.148 with HTTP; Fri, 16 Feb 2018 04:52:19 -0800 (PST) In-Reply-To: References: <20180119092541.7508-1-wens@csie.org> <20180119144512.dqqbywavhwsyma2f@flea.lan> From: Chen-Yu Tsai Date: Fri, 16 Feb 2018 20:52:19 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] phy: allwinner: sun4i-usb: poll vbus changes on A23/A33 when driving VBUS To: Maxime Ripard , Hans de Goede Cc: linux-arm-kernel , linux-kernel , linux-sunxi , stable , Kishon Vijay Abraham I 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 On Fri, Feb 16, 2018 at 7:20 PM, Kishon Vijay Abraham I wrote: > > > On Friday 19 January 2018 08:15 PM, Maxime Ripard wrote: >> On Fri, Jan 19, 2018 at 05:25:41PM +0800, Chen-Yu Tsai wrote: >>> 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 >>> --- >>> >>> This list might get longer if the newer AXP8xx PMICs also have this >>> behavior. We could switch to a boolean in the per-compatible data, >>> or just always use polling. The yet-merged R40 support will have this >>> issue as well, as the R40 is paired with the AXP221. But for now, >>> I'd like to have something that is easier to backport to stable, so >>> we can at least fix this for the A23 and A33. >>> >>> Also, checkpatch.pl doesn't like the stable kernel prerequisite lines. >> >> Acked-by: Maxime Ripard > > merged, thanks! Thanks. After some more experimentation on the A83T/AXP813, it seems this is pretty standard behavior for the AXP PMICs. If one uses N_VBUSEN to enable VBUS, the user/system should already know that VBUS is on or present. The VBUS-related logic in the PMIC, save for the VBUS status bits, is disconnected in this case. So it looks like we either enable this workaround for most if not all of the Allwinner family, or fix this by polling in the power supply driver itself. This would require polling once every 50ms, which might be too much work for the system, but is necessary for VBUS detection to work properly for MUSB. Or we could limit polling to whenever the drivevbus regulator is enabled. This would involve creating a reference between the USB power supply and regulator in the device tree. (There doesn't seem to be a way to fetch a regulator directly by its device node.) The power supply would then register a notifier on the regulator for on/off events, and configure polling accordingly. Any suggestions? ChenYu