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: 164713 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1510763ili; Tue, 21 May 2019 05:02:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxM7ERPBfNXtaDikPGq3vI3tyybqIoMHDLAPgi9FTRUVux31V3zOzaY6WvLFCEvrOO81ww X-Received: by 2002:a62:1cd5:: with SMTP id c204mr47966843pfc.205.1558440173459; Tue, 21 May 2019 05:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558440173; cv=none; d=google.com; s=arc-20160816; b=osu3Thoos5/MYPwKfNBhloL2EWeCQ2bLXqNtZQhI0aWfif0SgIspEo1lV9K1+WNyEv bg075dmYU9GdGYNzUQw5QjdiPURT+PY36FYIQQOd7vL+6Dac1xLfbPdcAM2osK09t/Mg k6VG5T/pYAm0da0KG5LtL6HTcd0MbDGWev7uF2MydM3HafZP1yT6ZZX4AwIXpL/6uwWZ BXUvwH66L0dsiWnPgtKYK0yL43HDZ/fMduunf9BPcA6uZYrk82+rfRnqQFShqHiFxQii jM4DplJkHPovJTMEmq6XuZbbqSBIS4cpVXygGuKg1q2/leOqoAsqZG3MI6AidQqg8n3Q s//A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:content-transfer-encoding :mime-version:dkim-signature:dkim-filter; bh=LICT6p63z28m+QBvow/NtYuLWxdakRY3i+TlswUz6bc=; b=xGJUC41W+Plk/pCu3Bh/63/3Owg1xII3YNAQq02rhv7Q2zIBUMxrWD5DBiAJCua4uo VlidNOW36TRVM+GYFBZwkNh4K1yldAeSBkNbr/JvO329NjRV7+pztyb1e/WlyLFHRZka yhJxLye6cz01V6Wr4M9t2RAVv12uncEJmpQ6+b5lw/Y4OYN4UAxkfHbWZNltj51nL0PC UHMpGrpe6fRjk1mxNO/cUORIC2+1ccYiDakOCQvjMGdb+CylOKnwYa3ldp6e85fIkP1e RqPDfPsMnRfI8opljnPpLcEEZcYZHSJ80gismLFXJ4pvmK1dGWS8mEggaImXNWuoOdvF 7UDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=G9NVtCSb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o70si21984506pfa.33.2019.05.21.05.02.53; Tue, 21 May 2019 05:02:53 -0700 (PDT) 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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=G9NVtCSb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728151AbfEUMCw (ORCPT + 7 others); Tue, 21 May 2019 08:02:52 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:57727 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727251AbfEUMCw (ORCPT ); Tue, 21 May 2019 08:02:52 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190521120251euoutp01674142fd930a2041aeaa620c27381f9e~gsRQ3IXeO3228432284euoutp01r for ; Tue, 21 May 2019 12:02:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190521120251euoutp01674142fd930a2041aeaa620c27381f9e~gsRQ3IXeO3228432284euoutp01r 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 xomPWCBBMYFR4tbijUwTGKVnIYXGLERozEIKjQWMzKs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n6vNdZ9+O8Izpt qQlCQt69+msOyq4SmfFs8yv5oJcWi5/zhCfdfeRrevOPgcvLk9W/LMTig7NjVDZH/6z7ksHM GKDTFfOVo4LTxJWbVYmlOCPRUIu5qDgRABVdqLqNAgAA X-CMS-MailID: 20190521120249eucas1p2e4a8fec922fa78783d7d3fed785f3e3b CMS-TYPE: 201P X-CMS-RootMailID: 20190521120249eucas1p2e4a8fec922fa78783d7d3fed785f3e3b References: <20190521115849.9882-1-m.szyprowski@samsung.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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(-) -- 2.17.1 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) {