From patchwork Fri Jan 12 10:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10160181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D2B1060327 for ; Fri, 12 Jan 2018 10:13:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB15C28724 for ; Fri, 12 Jan 2018 10:13:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF4B4289C0; Fri, 12 Jan 2018 10:13:02 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 0A86C28724 for ; Fri, 12 Jan 2018 10:13:02 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=6qTOHBM9vCuW+dapoVUfcHXLgPIbnJkMpKBVCfnJqbM=; b=A3R esW2NqxoWrlYUazxUVrc/6Kp3GL/xWYoUjoyYfErbQNjiJTHZLqQNBupHYQ2cFgkR2Z2w0RhGxT6s hEPtTt2SQA3vRJpnJeYFIqR09KZs2GC6T/EZSL7m/jCSt9UwWEF+ZiHVrY2EgT9xJz/2MXSC7CmgM soNpVKfb15LIQXinke6amHoE3l1l9bxq3r3FLOMIM1+HAoxn7J8djPgnkxetWgljbnO7qRjSbgClZ 53/bZHTQR6PXqtK+Xm39s5O7b7QWIGCYElV0xStebz6lgm7rBVyEf+VezoNeEiG5P3D64cdVwbc91 O6rYJhgQ/26F2Nu3MeUNqjFKLHKZLyg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eZwKa-00076F-Pi; Fri, 12 Jan 2018 10:13:00 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eZwKW-00074v-Kv; Fri, 12 Jan 2018 10:12:59 +0000 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lx70L-1etzQA1Qhl-016cmL; Fri, 12 Jan 2018 11:12:27 +0100 From: Arnd Bergmann To: Greg Kroah-Hartman , Kishon Vijay Abraham I Subject: [PATCH] phy: work around 'phys' references to usb-nop-xceiv devices Date: Fri, 12 Jan 2018 11:12:05 +0100 Message-Id: <20180112101223.3661181-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:CpYvbAXKlmxiRdBWn0EGV5VAZ3A395wQdDJVg7Ed8uPWJ41do+D hDfximHg0RFalwHc5u7o8j85Sov9N9kDsx0oLgX2rbZvq/S1Oe/yt+8tAJsbyM8VFgHhkb/ h/etbKZ6zxcn1P5aXQtm1xXJ4SCasfEBV/LSH9WtiRd8dHho3xHt6tf5QzQVc50bi/eOC8G hMCEBeurN/Td/Xw1nAh8g== X-UI-Out-Filterresults: notjunk:1; V01:K0:3fnL1ykh8lo=:snTnMf7s5Syn6SnhPDDVbP lHwLYGiLfNesR2xZ/PjIG4KNA52UXE3QJ6rWMxchVnecdGDQMhy7QPTkyfvEpZ/6t+FS9BPc9 /4TeF+RbZ89MQnLkbFOtrPU3sy3QMswbyq7Vj9vWKqvuAPv5+3NoCNKRlHGkmqofB86YLFFOQ dMIu10FPYuFBEYNjr+r4REzfYeONXF08gbt6oLCTbjWkXUs16q0n7dsCBc9QFjmhWvaWF2lHW qBeQJ7fxK8etWArftisG0S89IGY+qM669XO44Kji2uxDa8+SyU3qWTiwfHFtbxMU+mWiwlVwu peRjQaws5nMXjIbLjDDQo3wJIoITlpxfK99ClfDJfLbOyVgdXsY/iqySr5iEnKC97Uf4EKZ2t 60ggKewI1BArExNgDrBBKQECLAF0xdViy57wYcS6CacNMRjrLxvRujEJYxsKozEj3vjEXsJ/6 CNt9/AwNBsMi7F7kcmz3OPRDd3SC/eWLVvV3imd7c2PUlqkLC8ugqM+N1k80wh+GOwBrwMs2N G1iE4SUJ861erYSXh61UOtPH5m6Dxz1EdyCbrGgdNwxWhcyhYuygPKdrAHwEHy32CQvEW2ZnC iS8nZ9pD8WMBsS5vQsktMdYzO2na0IXGmpOSnKkezl/OJAwsH3v8XDefjXdwa4QTgE6Qxqf+i bkewQQ5i7JQCcsCzETUaoPWZC0TwcMgkkY6GDFY6tuWInAjI9EFHx4lRfiSqq8joNK/bou0Pv 9m7d/7GSqAZ3AnuRWCZm+E1VaF0hArf4XbSOIw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180112_021257_032478_331029DC X-CRM114-Status: GOOD ( 16.70 ) 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: Stefan Wahren , devicetree@vger.kernel.org, Florian Fainelli , Arnd Bergmann , Felipe Balbi , John Youn , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Eric Anholt , Rob Herring , linux-rpi-kernel@lists.infradead.org, Andrzej Pietrasiewicz , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 Stefan Wahren reports a problem with a warning fix that was merged for v4.15: we had lots of device nodes with a 'phys' property pointing to a device node that is not compliant with the binding documented in Documentation/devicetree/bindings/phy/phy-bindings.txt This generally works because USB HCD drivers that support both the generic phy subsystem and the older usb-phy subsystem ignore most errors from phy_get() and related calls and then use the usb-phy driver instead. However, it turns out that making the usb-nop-xceiv device compatible with the generic-phy binding changes the phy_get() return code from -EINVAL to -EPROBE_DEFER, and the dwc2 usb controller driver for bcm2835 now returns -EPROBE_DEFER from its probe function rather than ignoring the failure, breaking all USB support on raspberry-pi when CONFIG_GENERIC_PHY is enabled. The same code is used in the dwc3 driver and the usb_add_hcd() function, so a reasonable assumption would be that many other platforms are affected as well. I have reviewed all the related patches and concluded that "usb-nop-xceiv" is the only USB phy that is affected by the change, and since it is by far the most commonly referenced phy, all the other USB phy drivers appear to be used in ways that are are either safe in DT (they don't use the 'phys' property), or in the driver (they already ignore -EPROBE_DEFER from generic-phy when usb-phy is available). To work around the problem, this adds a special case to _of_phy_get() so we ignore any PHY node that is compatible with "usb-nop-xceiv", as we know that this can never load no matter how much we defer. In the future, we might implement a generic-phy driver for "usb-nop-xceiv" and then remove this workaround. Since we generally want older kernels to also want to work with the fixed devicetree files, it would be good to backport the patch into stable kernels as well (3.13+ are possibly affected), even though they don't contain any of the patches that may have caused regressions. Fixes: 014d6da6cb25 ARM: dts: bcm283x: Fix DTC warnings about missing phy-cells Fixes: c5bbf358b790 arm: dts: nspire: Add missing #phy-cells to usb-nop-xceiv Fixes: 44e5dced2ef6 arm: dts: marvell: Add missing #phy-cells to usb-nop-xceiv Fixes: f568f6f554b8 ARM: dts: omap: Add missing #phy-cells to usb-nop-xceiv Fixes: d745d5f277bf ARM: dts: imx51-zii-rdu1: Add missing #phy-cells to usb-nop-xceiv Fixes: 915fbe59cbf2 ARM: dts: imx: Add missing #phy-cells to usb-nop-xceiv Link: https://marc.info/?l=linux-usb&m=151518314314753&w=2 Link: https://patchwork.kernel.org/patch/10158145/ Cc: stable@vger.kernel.org Cc: Stefan Wahren Cc: Felipe Balbi Cc: Eric Anholt Tested-by: Hans Verkuil Acked-by: Kishon Vijay Abraham I Signed-off-by: Arnd Bergmann Tested-by: Stefan Wahren Acked-by: Rob Herring --- Hans tested the earlier version of this patch, I'd like one more confirmation from Hans or Stefan (or anyone else) that this version addresses the regression as well before this gets merged. Greg, can you pick this up into usb-linus for v4.15 once the fix has been confirmed, or should I merge it through arm-soc? --- drivers/phy/phy-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index b4964b067aec..8f6e8e28996d 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -410,6 +410,10 @@ static struct phy *_of_phy_get(struct device_node *np, int index) if (ret) return ERR_PTR(-ENODEV); + /* This phy type handled by the usb-phy subsystem for now */ + if (of_device_is_compatible(args.np, "usb-nop-xceiv")) + return ERR_PTR(-ENODEV); + mutex_lock(&phy_provider_mutex); phy_provider = of_phy_provider_lookup(args.np); if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) {