From patchwork Tue May 21 11:58:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10953513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F137912 for ; Tue, 21 May 2019 12:02:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EA4A2893F for ; Tue, 21 May 2019 12:02:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82DAD289D3; Tue, 21 May 2019 12:02:54 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16D7E2893F for ; Tue, 21 May 2019 12:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbfEUMCx (ORCPT ); Tue, 21 May 2019 08:02:53 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47091 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbfEUMCx (ORCPT ); Tue, 21 May 2019 08:02:53 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190521120251euoutp028bbc3518e0c094b503c3992e527833dc~gsRQ3i1g-2223422234euoutp02H for ; Tue, 21 May 2019 12:02:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190521120251euoutp028bbc3518e0c094b503c3992e527833dc~gsRQ3i1g-2223422234euoutp02H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1558440171; bh=LICT6p63z28m+QBvow/NtYuLWxdakRY3i+TlswUz6bc=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=G9NVtCSbhZzYqEVop3794RGRuL0A3NkxorqZULqyTH86ltmFYpFuZExyHNPb5sb65 NqsOgr2/ZAtLOKih99P3GkmQsoGq3GKmpt0QiEMl81cA3nm2NV+hraDDB9PzHbRSjo KeYYJgDrDLt99+ZjdRIGGiFQWbOYIZWdYj4UeJ/Q= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190521120250eucas1p1e0980b40c4b574111e72b1da9e5960cd~gsRQA9xsh0539705397eucas1p1w; Tue, 21 May 2019 12:02:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id B1.EF.04298.AE8E3EC5; Tue, 21 May 2019 13:02:50 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190521120249eucas1p2e4a8fec922fa78783d7d3fed785f3e3b~gsRPRCFfS0974209742eucas1p2m; Tue, 21 May 2019 12:02:49 +0000 (GMT) X-AuditID: cbfec7f2-3615e9c0000010ca-b0-5ce3e8ea7c4c Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 54.62.04146.9E8E3EC5; Tue, 21 May 2019 13:02:49 +0100 (BST) MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset="UTF-8" Received: from AMDC2765.DIGITAL.local ([106.120.51.73]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PRU006F4RY90T20@eusync4.samsung.com>; Tue, 21 May 2019 13:02:49 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Greg Kroah-Hartman , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Markus Reichl , =?utf-8?b?TcOlbnMgUnVsbGfDpXJk?= , Krzysztof Kozlowski , Peter Chen , Alan Stern , Rob Herring Subject: [PATCH 3/5] usb: exynos: add support for getting PHYs from the standard dt array Date: Tue, 21 May 2019 13:58:47 +0200 Message-id: <20190521115849.9882-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190521115849.9882-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIKsWRmVeSWpSXmKPExsWy7djP87qvXjyOMXi1gcdi44z1rBbzj5xj tWhevJ7N4vz5DewWl3fNYbOYcX4fk8WiZa3MFi+P/GC0WHvkLrvFj4fTmSz+3LvDatG69wi7 xYTfF9gceD1u3an32LSqk81j/9w17B5vTp9i99j4bgeTx+y7Pxg9+rasYvT4vEkugCOKyyYl NSezLLVI3y6BK2PHiTVMBY0iFRNO32RtYDwk0MXIySEhYCJxdu1yxi5GLg4hgRWMEh83dTNB OJ8ZJS5PW88MU3Wo9wYzRGIZo8S3U13sIAleAUGJH5PvsXQxcnAwC8hLHLmUDRJmFtCU2Lp7 PViJkMB/RomnUyJAbDYBQ4mut11sILaIgIPEkqV32EBmMgucY5ZY/LODCSQhLBAtsefeZbBm FgFViS0tLxghdtlIrF98B+ogeYnVGw6A2ZwCthLzm56DHSch8JtNon/2MTaIIheJ0wu/s0PY MhKdHQeZIIqaGSUenlvLDuH0AP3ZNIMRospa4vDxi6wQP/BJTNo2nRnkNQkBXomONiGIEg+J xomPWCBBMYFR4tbijUwTGKVnIYXGLERozEIKjQWMzKsYxVNLi3PTU4sN81LL9YoTc4tL89L1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4SmfFs8yv5oJcWi5/zhCfdfeRrevOPgcvLk9W/LMTig7NjVDZH/6z7ksHM GKDTFfOVo4LTxJWbVYmlOCPRUIu5qDgRABVdqLqNAgAA X-CMS-MailID: 20190521120249eucas1p2e4a8fec922fa78783d7d3fed785f3e3b CMS-TYPE: 201P X-CMS-RootMailID: 20190521120249eucas1p2e4a8fec922fa78783d7d3fed785f3e3b References: <20190521115849.9882-1-m.szyprowski@samsung.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/usb/host/ehci-exynos.c | 14 +++++++++++++- drivers/usb/host/ohci-exynos.c | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 3a29a1a8519c..2a551a807ec0 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -50,10 +50,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) + 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) { diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 905c6317e0c3..195ea5fa021e 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -39,10 +39,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) + 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) {