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: 124263 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp1688220edr; Fri, 12 Jan 2018 02:13:10 -0800 (PST) X-Google-Smtp-Source: ACJfBot7urNh+bQYefCJUd73UqhSTi+Khu4dnZXydg9+mUgDf4dJOPJ3d+FlE4Kr6zx70ZegGG4x X-Received: by 10.99.53.139 with SMTP id c133mr20570654pga.374.1515751990189; Fri, 12 Jan 2018 02:13:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515751990; cv=none; d=google.com; s=arc-20160816; b=unxHFnh+ovA8kpTgdpOQzP22xqUoY/KR/PPFvGd207r9wDU6sqmOEoVOURaAThnCbo jUmxuWKz6giqVDTtjgUchoSqalLQ1LTDLKv3ae58ohRM/GAIrdXpwEx3uxotWz+7H6+V qOQZx/lqYxwon9iKtz2VIJnhxFeqPxE1o4Vg+TFmGLRlMahUdD/vmLYqQSIdIgIgGk6u +V0jQ9QqhKBioL+yW2Kgeyzsh4U7ZOEIdAqTzCHxLQvGxoeEcvSGX8q9oHRuqkx7p4eA KEy608RKhBIDbTlNrA0YGLjg7VAgVowA+8yzMcoh56L/j1G2+OfqDZIJDCry3bj3cWgS emDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xcR+wTvdVhVqIIhrid2qxT5t3TnqR2ku/ZpHTHsK9H0=; b=XJlS4lGSL+c+7Dl93FfrN32E23v20iEy0rA4ZI+tYE53vMuwZSAkW4P1i7P8DMJIA+ brG+SQYzCygzq6akldTotXPPhXhQSt9Du3Yg0Ldo8OszoMngHCpm4n2UOaS3Gqu7msj+ UMpV05MzTLDvkK/T/OrDHkUQxr4w5fm9DzTUg3NsBriJN3sg5LqSpKgVpfX2R+2QmSu9 6ddIimXNu4oe6ZMs4x+M3AKrvoEQbxYp40gOhR3Zy6FDxlc8KT8HK+5F+8mtxlBh4o27 39KRUUKgX9UtZkJnWspqwEm3jNW2hrBH0s087xh45lEDAq8oRvg+hGNImcJfM5BxGGaO /Otw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 n9si6360836pgd.735.2018.01.12.02.13.09; Fri, 12 Jan 2018 02:13:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754532AbeALKNI (ORCPT + 6 others); Fri, 12 Jan 2018 05:13:08 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:62640 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754403AbeALKNE (ORCPT ); Fri, 12 Jan 2018 05:13:04 -0500 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 Cc: Florian Fainelli , John Youn , Rob Herring , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, Arnd Bergmann , stable@vger.kernel.org, Stefan Wahren , Felipe Balbi , Eric Anholt , Andrzej Pietrasiewicz , linux-kernel@vger.kernel.org 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== Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 --- 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(+) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Rob Herring 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)) {