Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1883545yba; Fri, 17 May 2019 07:03:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwL3yDau5H1MM+EMT1+1MqPcH65/etQ1/DWuINiQtPdbbo+cqQU3AG9PPnX8nhSpFdq8kz8 X-Received: by 2002:a62:fc56:: with SMTP id e83mr8550695pfh.27.1558101797051; Fri, 17 May 2019 07:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558101797; cv=none; d=google.com; s=arc-20160816; b=r1/GC6Sjb79LmYgVNXn0lJ2VQbLLhF5vc3P4CqwUjt0GgRoAcVunKfNUtnDjUjOKdE 2ulssyPhOb2w8UqKfulbmXSOGAtIebmXikuu8EuDUYndWypQ071qQ9+llwgoU9aYKhBK Tj3uSZgXMD2tu+SMTqyTr1f4Isw6prd+M1JJoC6mPY9GYTHYmZA5WL17T3oNQuXliK7K qbc4iY7kWB4ieZcpowaofiJHwUOxZlrryo/9c3oGFWSeNOBh7PfmIfXSVTdss0SFeN6S wYfeXrMEt8GpcXQTEkg3WLcNh3YizkOAPW3C/8AA1MUiZk+grRM2ZkUU8fMcRQopCiV4 Ditg== 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 :message-id:in-reply-to:subject:cc:to:from:date; bh=ypiLWgwslQYWGv463LEeqio3aDbCSfDlT6VW6nvXVro=; b=eq+ZhXpGCM0E1xshXFi249YE/Q0A+4EFHEqjMhxhVi9Os8itdUhpqMSgK2y7JpmRyx /pSqP2wKi99BC74dFakg+B3VPyx+eEZq48z7f3eWKxtVDqatZ1MOdnON+OGRKIIqY4wn STaEsf45nuILxJZ4crUMtVUnAMcOCbIYyfsNye7UBnw8auVzaD/GI63UsAzQpZf1GbZ4 G+K2mJgVcda7QHnZzlQWJ1muVjWql3H9KQTetrzc3S0Q4OtCAV5VfUNZ0oHjWLGY2W1W A6CayH3HvLBmV2tPBPLwPdy8D6ZGvAOy2g0N89ofuL/SUQAPSafrx/QEmOIDLZu061AQ u0MA== 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 h66si7763193pgc.418.2019.05.17.07.02.52; Fri, 17 May 2019 07:03:17 -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 S1728866AbfEQN45 (ORCPT + 99 others); Fri, 17 May 2019 09:56:57 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:41724 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728464AbfEQN45 (ORCPT ); Fri, 17 May 2019 09:56:57 -0400 Received: (qmail 1594 invoked by uid 2102); 17 May 2019 09:56:56 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 17 May 2019 09:56:56 -0400 Date: Fri, 17 May 2019 09:56:56 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Marek Szyprowski cc: linux-usb@vger.kernel.org, , , Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , Markus Reichl , =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= , Krzysztof Kozlowski , Peter Chen Subject: Re: [PATCH v4] usb: exynos: add workaround for the USB device bindings conflict In-Reply-To: <20190517105702.4522-1-m.szyprowski@samsung.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 May 2019, Marek Szyprowski wrote: > Commit 69bec7259853 ("USB: core: let USB device know device node") added > support for attaching devicetree node for USB devices. Those nodes are > children of their USB host controller. However Exynos EHCI and OHCI > driver bindings already define child-nodes for each physical root hub > port and assigns respective PHY controller and parameters to them. Those > bindings predates support for USB device tree nodes. > > To mitigate the side-effects of the conflict between those bindings, > lets reset Exynos host controller of_node pointer before registering it > to USB subsystem. This fixes the issue raised by the commit 01fdf179f4b0 > ("usb: core: skip interfaces disabled in devicetree"), which incorrectly > disabled some devices on Exynos based boards. > > Reported-by: Markus Reichl > Suggested-by: Måns Rullgård > Signed-off-by: Marek Szyprowski > --- > v4: > - moved workaround to Exynos OHCI/EHCI drivers as suggested by Måns > > v3: https://lkml.org/lkml/2019/5/9/119 > - replaced ad hoc checks by proper test for proper value of the > compatible string in drivers/usb/core/of.c > > v2: https://lkml.org/lkml/2019/5/8/321 > > v1: https://lkml.org/lkml/2019/5/7/715 > --- > drivers/usb/host/ehci-exynos.c | 10 ++++++++++ > drivers/usb/host/ohci-exynos.c | 10 ++++++++++ > 2 files changed, 20 insertions(+) > > diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c > index 8e3bab1e0c1f..b127642332ee 100644 > --- a/drivers/usb/host/ehci-exynos.c > +++ b/drivers/usb/host/ehci-exynos.c > @@ -39,6 +39,7 @@ static struct hc_driver __read_mostly exynos_ehci_hc_driver; > > struct exynos_ehci_hcd { > struct clk *clk; > + struct device_node *of_node; > struct phy *phy[PHY_NUMBER]; > }; > > @@ -203,6 +204,13 @@ static int exynos_ehci_probe(struct platform_device *pdev) > ehci = hcd_to_ehci(hcd); > ehci->caps = hcd->regs; > > + /* > + * Workaround: reset of_node pointer to avoid conflict between Exynos > + * EHCI port subnodes and generic USB device bindings > + */ > + exynos_ehci->of_node = pdev->dev.of_node; > + pdev->dev.of_node = NULL; > + > /* DMA burst Enable */ > writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); > You forgot to adjust the fail_add_hcd: error pathway in exynos_ehci_probe(). > @@ -231,6 +239,8 @@ static int exynos_ehci_remove(struct platform_device *pdev) > struct usb_hcd *hcd = platform_get_drvdata(pdev); > struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); > > + pdev->dev.of_node = exynos_ehci->of_node; > + > usb_remove_hcd(hcd); > > exynos_ehci_phy_disable(&pdev->dev); > diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c > index c0c4dcca6f3c..29f65963af3b 100644 > --- a/drivers/usb/host/ohci-exynos.c > +++ b/drivers/usb/host/ohci-exynos.c > @@ -30,6 +30,7 @@ static struct hc_driver __read_mostly exynos_ohci_hc_driver; > > struct exynos_ohci_hcd { > struct clk *clk; > + struct device_node *of_node; > struct phy *phy[PHY_NUMBER]; > }; > > @@ -170,6 +171,13 @@ static int exynos_ohci_probe(struct platform_device *pdev) > goto fail_io; > } > > + /* > + * Workaround: reset of_node pointer to avoid conflict between Exynos > + * OHCI port subnodes and generic USB device bindings > + */ > + exynos_ohci->of_node = pdev->dev.of_node; > + pdev->dev.of_node = NULL; > + > err = usb_add_hcd(hcd, irq, IRQF_SHARED); > if (err) { > dev_err(&pdev->dev, "Failed to add USB HCD\n"); And same here. Alan Stern > @@ -192,6 +200,8 @@ static int exynos_ohci_remove(struct platform_device *pdev) > struct usb_hcd *hcd = platform_get_drvdata(pdev); > struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); > > + pdev->dev.of_node = exynos_ohci->of_node; > + > usb_remove_hcd(hcd); > > exynos_ohci_phy_disable(&pdev->dev); >