Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752885AbaBEP5a (ORCPT ); Wed, 5 Feb 2014 10:57:30 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:28823 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752642AbaBEP5Y (ORCPT ); Wed, 5 Feb 2014 10:57:24 -0500 X-AuditID: cbfec7f4-b7f796d000005a13-e6-52f25f61bc2e From: Kamil Debski To: "'Olof Johansson'" Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, "'Kyungmin Park'" , "'Kishon Vijay Abraham I'" , Tomasz Figa , Sylwester Nawrocki , Marek Szyprowski , "'Vivek Gautam'" , mat.krawczuk@gmail.com, yulgon.kim@samsung.com, p.paneri@samsung.com, av.tikhomirov@samsung.com, "'Jingoo Han'" , "'Kumar Gala'" , "'Matt Porter'" , tjakobi@math.uni-bielefeld.de, "'Alan Stern'" References: <1391016574-25237-1-git-send-email-k.debski@samsung.com> <1391016574-25237-9-git-send-email-k.debski@samsung.com> In-reply-to: Subject: RE: [PATCH v6 8/8] usb: ehci-exynos: Change to use phy provided by the generic phy framework Date: Wed, 05 Feb 2014 16:57:20 +0100 Message-id: <054501cf228a$f45c61c0$dd152540$%debski@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac8dNG62pk4uYKMpQl6IThTxqp9ZvwFVKTtw Content-language: pl X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsVy+t/xa7qJ8Z+CDKbMM7RYsvsGq8X8I+dY LfrfLGS1aLtykN3i8sJLrBYXnvawWZxtegPk7prDZjHj/D4mi0XLWpkt1h65y25xtv82m8XE pmnsFqeuf2azOL+lk8ni8Jt2VosJvy+wWayf8ZrFom31B1aLjrMH2R1EPC739TJ57Jx1l93j zrU9bB5XTjSxevw7xu4x++4PRo++LasYPY7f2M7k8XmTXABnFJdNSmpOZllqkb5dAlfG8mPL WQrWqlUs/PeUpYGxQ6qLkZNDQsBEYtbn74wQtpjEhXvr2boYuTiEBJYyShx6doYZJCEk0MAk seB+YBcjBwebgKbEqnseIGERAVWJJ0+6WEHqmQWWs0pMXXGIFaL5GKPElHnfWEEaOAWCJX4v dgVpEBZIl7h/9ATYTBag5gn/z7OD2LwCDhJNd6+zQtiCEj8m32MBsZkFtCTW7zzOBGHLS2xe 85YZZKSEgLrEo7+6EDcYSWz/egmqRETibsNz1gmMQrOQTJqFZNIsJJNmIWlZwMiyilE0tTS5 oDgpPddQrzgxt7g0L10vOT93EyMkpr/sYFx8zOoQowAHoxIPb4foxyAh1sSy4srcQ4wSHMxK IrytsZ+ChHhTEiurUovy44tKc1KLDzEycXBKNTCqb2vfOfNM8a+p4vK7xE/wb6u4dbE/sUr6 UkFf5/+Z+seYe2Q79tRprO79nSOxM0HkyocbX/i4f02s7S9MjNnWZFEjbPRXPmJZWPvWJzYf nvtWrpnmZl8onOq16mHDtsfrhG4tTsjl93I0ebbqzuW6ltj5tg//nM5cq/FV3lV2zuKdkdtm TbBSYinOSDTUYi4qTgQA76FIfMcCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Olof, Thank you for your review. > From: Olof Johansson [mailto:olof@lixom.net] > Sent: Wednesday, January 29, 2014 9:55 PM > > Hi, > > On Wed, Jan 29, 2014 at 9:29 AM, Kamil Debski > wrote: > > Change the phy provider used from the old one using the USB phy > > framework to a new one using the Generic phy framework. > > > > Signed-off-by: Kamil Debski > > --- > > .../devicetree/bindings/usb/exynos-usb.txt | 13 +++ > > drivers/usb/host/ehci-exynos.c | 97 > +++++++++++++------- > > 2 files changed, 76 insertions(+), 34 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt > > b/Documentation/devicetree/bindings/usb/exynos-usb.txt > > index d967ba1..25e199a 100644 > > --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt > > +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt > > @@ -12,6 +12,10 @@ Required properties: > > - interrupts: interrupt number to the cpu. > > - clocks: from common clock binding: handle to usb clock. > > - clock-names: from common clock binding: Shall be "usbhost". > > + - port: if in the SoC there are EHCI phys, they should be listed > here. > > +One phy per port. Each port should have its reg entry with a > > +consecutive number. Also it should contain phys and phy-names > entries > > +specifying the phy used by the port. > > > > Optional properties: > > - samsung,vbus-gpio: if present, specifies the GPIO that @@ -27,6 > > +31,15 @@ Example: > > > > clocks = <&clock 285>; > > clock-names = "usbhost"; > > + > > + #address-cells = <1>; > > + #size-cells = <0>; > > + port@0 { > > + reg = <0>; > > + phys = <&usb2phy 1>; > > + phy-names = "host"; > > + status = "disabled"; > > + }; > > }; > > > > OHCI > > [...] > > > @@ -102,14 +132,26 @@ static int exynos_ehci_probe(struct > platform_device *pdev) > > "samsung,exynos5440-ehci")) > > goto skip_phy; > > > > - phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); > > - if (IS_ERR(phy)) { > > - usb_put_hcd(hcd); > > - dev_warn(&pdev->dev, "no platform data or transceiver > defined\n"); > > - return -EPROBE_DEFER; > > - } else { > > - exynos_ehci->phy = phy; > > - exynos_ehci->otg = phy->otg; > > + for_each_available_child_of_node(pdev->dev.of_node, child) { > > + err = of_property_read_u32(child, "reg", > &phy_number); > > + if (err) { > > + dev_err(&pdev->dev, "Failed to parse device > tree\n"); > > + of_node_put(child); > > + return err; > > + } > > + if (phy_number >= PHY_NUMBER) { > > + dev_err(&pdev->dev, "Failed to parse device > tree - number out of range\n"); > > + of_node_put(child); > > + return -EINVAL; > > + } > > + phy = devm_of_phy_get(&pdev->dev, child, 0); > > + of_node_put(child); > > + if (IS_ERR(phy)) { > > + dev_err(&pdev->dev, "Failed to get phy number > %d", > > + > phy_number); > > + return PTR_ERR(phy); > > + } > > + exynos_ehci->phy[phy_number] = phy; > > this looks like it is now breaking older device trees, where ports > might not be described. Since device tree interfaces need to be > backwards compatible, you still need to handle the old case of not > having ports described. > > There are two ways of doing this: > > 1. Fall back to the old behavior if there are no ports 2. Use a new > compatible value for the new model with port subnodes, and if the old > compatible value is used, then fall back to the old behavior. > > I'm guessing (1) might be easiest since you can check for the presence > of #address-cells to tell if this is just an old style node, or if it's > a new-style node without any ports below it. The ultimate goal is to remove the old phy driver. Unfortunately this has to be synced with the new USB3 phy driver by Vivek Gautam. I think he is also close to completion. What about this case? In the end the old driver will be removed and no longer be supported. Having backward compatibility in mind, it is possible to have the old and the new phy driver together in one kernel release. But do we want to have two drivers doing the same thing at the same time? Best wishes, -- Kamil Debski Samsung R&D Institute Poland -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/