Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp137712ybi; Fri, 26 Jul 2019 07:20:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf+ZMZc1JurFnghlLo2qAGRks8q8ctd4pn44ZFmjbdGyzUOaKqs/da41VCYZH2vM6pFgpf X-Received: by 2002:a63:101b:: with SMTP id f27mr88180214pgl.291.1564150809956; Fri, 26 Jul 2019 07:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564150809; cv=none; d=google.com; s=arc-20160816; b=x8xrZQRGZeJtrjHWiDrKlwFPh9Iqs9kTkfZkK7Jn8NKQinsxHJvMUI3GyrQGrwYJMi tx/3HrLeNBF5woAbeOI7HmmLCb84q8neFkWae+wwZ+fmXLgBi/79OVN2XikhcOptNiW6 fDuhy69z8spfTJ4gOexToFU8qzDj36yo6VWJQcPyslzGZyJsXWzx55Re+nU5y4/mtH0F 0lAz9f+22azaoyzuoMo0sJBq0RwpEjjCXgeFtefKdvQJtjZpKneVO2PAM2xmLj/5jBNm 2PlIcuUt0P2gFDFx/f/nmCqsRUnDAysYLVeBGEKZqsOyD3zAMPLMMVOedJyXirEtEoev b2Fw== 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=OkAfLGsMJBlb35KcQ25c9Ofmz8ZrJ6lu69i1c9VmWNw=; b=J1l1shpJpo2JFbft35oskPxrzmVvMYYJzbl8H1TzSO1RuQfPfDSUOzSMGsC54VHF0U vQETimMKC2a4Fu8+aC7FgJluzI2/QYK8Os7lkE19JLwU++cxQCoqVhFQCT/scNJZGljL hzwGXQoZKsnlKRkIGDOGIfyYjF1fGVaLSeEqIazfkkj9LWTKcpRwh3YzAR3+cYw/jI8V lt3UChuGKGKtH6M+DEKLg1JNSaRCNmR93z+waC+UT5aAItRuXIiupxCdaZXDbCp4Ff4o 7yEjM1kJNtKhvQkRO2QhefLu9zAj7gN0PhYEmghxCr1jDGAiyOAgdAIyj6SEfzjx1pgJ pWAQ== 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 q67si32903331pgq.83.2019.07.26.07.19.53; Fri, 26 Jul 2019 07:20:09 -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 S1728318AbfGZORZ (ORCPT + 99 others); Fri, 26 Jul 2019 10:17:25 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:34022 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727358AbfGZORY (ORCPT ); Fri, 26 Jul 2019 10:17:24 -0400 Received: (qmail 1779 invoked by uid 2102); 26 Jul 2019 10:17:23 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 26 Jul 2019 10:17:23 -0400 Date: Fri, 26 Jul 2019 10:17:23 -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 , Rob Herring Subject: Re: [PATCH v2 2/3] usb: exynos: add support for getting PHYs from the standard dt array In-Reply-To: <20190726081453.9456-3-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, 26 Jul 2019, Marek Szyprowski wrote: > Add the code for getting generic PHYs from standard device tree array > from the main controller device node. This is a first step in resolving > the conflict between Exynos EHCI/OHCI sub-nodes and generic USB device > bindings. Later the sub-nodes currently used for assigning PHYs to root > ports of the controller will be removed making a place for the generic > USB device bindings nodes. > > Suggested-by: Måns Rullgård > Signed-off-by: Marek Szyprowski > --- Acked-by: Alan Stern > drivers/usb/host/ehci-exynos.c | 23 +++++++++++++++++++---- > drivers/usb/host/ohci-exynos.c | 23 +++++++++++++++++++---- > 2 files changed, 38 insertions(+), 8 deletions(-) > > diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c > index 3a29a1a8519c..01debfd03d4a 100644 > --- a/drivers/usb/host/ehci-exynos.c > +++ b/drivers/usb/host/ehci-exynos.c > @@ -41,6 +41,7 @@ struct exynos_ehci_hcd { > struct clk *clk; > struct device_node *of_node; > struct phy *phy[PHY_NUMBER]; > + bool legacy_phy; > }; > > #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd *)(hcd_to_ehci(hcd)->priv) > @@ -50,10 +51,22 @@ static int exynos_ehci_get_phy(struct device *dev, > { > struct device_node *child; > struct phy *phy; > - int phy_number; > + int phy_number, num_phys; > int ret; > > /* Get PHYs for the controller */ > + num_phys = of_count_phandle_with_args(dev->of_node, "phys", > + "#phy-cells"); > + for (phy_number = 0; phy_number < num_phys; phy_number++) { > + phy = devm_of_phy_get_by_index(dev, dev->of_node, phy_number); > + if (IS_ERR(phy)) > + return PTR_ERR(phy); > + exynos_ehci->phy[phy_number] = phy; > + } > + if (num_phys > 0) > + return 0; > + > + /* Get PHYs using legacy bindings */ > for_each_available_child_of_node(dev->of_node, child) { > ret = of_property_read_u32(child, "reg", &phy_number); > if (ret) { > @@ -84,6 +97,7 @@ static int exynos_ehci_get_phy(struct device *dev, > } > } > > + exynos_ehci->legacy_phy = true; > return 0; > } > > @@ -205,11 +219,12 @@ static int exynos_ehci_probe(struct platform_device *pdev) > ehci->caps = hcd->regs; > > /* > - * Workaround: reset of_node pointer to avoid conflict between Exynos > - * EHCI port subnodes and generic USB device bindings > + * Workaround: reset of_node pointer to avoid conflict between legacy > + * Exynos EHCI port subnodes and generic USB device bindings > */ > exynos_ehci->of_node = pdev->dev.of_node; > - pdev->dev.of_node = NULL; > + if (exynos_ehci->legacy_phy) > + pdev->dev.of_node = NULL; > > /* DMA burst Enable */ > writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); > diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c > index 905c6317e0c3..d5ce98e205c7 100644 > --- a/drivers/usb/host/ohci-exynos.c > +++ b/drivers/usb/host/ohci-exynos.c > @@ -32,6 +32,7 @@ struct exynos_ohci_hcd { > struct clk *clk; > struct device_node *of_node; > struct phy *phy[PHY_NUMBER]; > + bool legacy_phy; > }; > > static int exynos_ohci_get_phy(struct device *dev, > @@ -39,10 +40,22 @@ static int exynos_ohci_get_phy(struct device *dev, > { > struct device_node *child; > struct phy *phy; > - int phy_number; > + int phy_number, num_phys; > int ret; > > /* Get PHYs for the controller */ > + num_phys = of_count_phandle_with_args(dev->of_node, "phys", > + "#phy-cells"); > + for (phy_number = 0; phy_number < num_phys; phy_number++) { > + phy = devm_of_phy_get_by_index(dev, dev->of_node, phy_number); > + if (IS_ERR(phy)) > + return PTR_ERR(phy); > + exynos_ohci->phy[phy_number] = phy; > + } > + if (num_phys > 0) > + return 0; > + > + /* Get PHYs using legacy bindings */ > for_each_available_child_of_node(dev->of_node, child) { > ret = of_property_read_u32(child, "reg", &phy_number); > if (ret) { > @@ -73,6 +86,7 @@ static int exynos_ohci_get_phy(struct device *dev, > } > } > > + exynos_ohci->legacy_phy = true; > return 0; > } > > @@ -172,11 +186,12 @@ static int exynos_ohci_probe(struct platform_device *pdev) > } > > /* > - * Workaround: reset of_node pointer to avoid conflict between Exynos > - * OHCI port subnodes and generic USB device bindings > + * Workaround: reset of_node pointer to avoid conflict between legacy > + * Exynos OHCI port subnodes and generic USB device bindings > */ > exynos_ohci->of_node = pdev->dev.of_node; > - pdev->dev.of_node = NULL; > + if (exynos_ohci->legacy_phy) > + pdev->dev.of_node = NULL; > > err = usb_add_hcd(hcd, irq, IRQF_SHARED); > if (err) { >