Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4049811imm; Mon, 14 May 2018 01:39:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQXUPPddmXSwJ1rbWYXOFsV8U7VJ7Lqdt80MnPEWtM6THG+QMX4CI5ZKG23Sn1G4hq5gFD X-Received: by 2002:a62:8910:: with SMTP id v16-v6mr9361882pfd.13.1526287187470; Mon, 14 May 2018 01:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526287187; cv=none; d=google.com; s=arc-20160816; b=q78/nkvnb2VVsABRrHObM5ffc9Q+6FgJpbi56ZzvPhppWgotZj+QOEXFlWIy6Avj2C yP7nKWWmI1QHNs9yB34k7DsGWuq1/5uwpAiHe7rm1OYLkZ9GMCp/FHK+OHAlDlFggUXZ XT51nN+gUvINvFQ1Qc8qoLUptT79Lxa3KObxFyr1mSR8JKES+hTImo5uiWpxqF8Oq/p3 0WOMEFCvGLSpUv7rTiJZxeq6a1HKqSKIEy6cETNQByxgK1J7+7SK1EGSf+xjB2jd6xiU Gc77Pd+FUEfQgsSBrAuLFPbGTv7Zz1i9gV4cInKwVHxm//CbF8KrjSgFak+DvdrqXTuz OyNQ== 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:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter :arc-authentication-results; bh=2PoZkve4cni/YWyO10JBpQa/EnKa9XEZvmQyWWN0GZM=; b=PIU3dij/Ow2rwbIP4U8uEO5W0IIBfT9NqoiSqifyKQC/Y5smPr867gcgoTuhftVv20 Dod7xINJ60z97MkmrNKghp6tNLSfmUbykUWh/MdGM09XjiTYmuqjNix/K+BTBX5Pdjr9 oQ3vLEGEX8PPeeX+BhHal634TJOo2ON57MUR3BtgE2t01mB7rBJHtGnGnzRw092cmll0 +OiaIJGh12EW1Ly+5iSu5fiRaHb+CdPqXuVsKtUoVoCDtpFANvq8t/xZjpwZ3ZEL12ob V0oKHLSwdbTXRlLi0egWmkJlCJivdcHZpZa9yuBTDUbgyEY+tzHNhk9gk/MXWyoqJk5E Xkow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kiu69aXI; 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; 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 b40-v6si9045914plb.44.2018.05.14.01.39.33; Mon, 14 May 2018 01:39:47 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kiu69aXI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbeENIjL (ORCPT + 99 others); Mon, 14 May 2018 04:39:11 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:37032 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752241AbeENIjH (ORCPT ); Mon, 14 May 2018 04:39:07 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180514083905euoutp0183f021a95a44f5fe45ccd43089f1b768~udhJgSHtJ2248222482euoutp010 for ; Mon, 14 May 2018 08:39:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180514083905euoutp0183f021a95a44f5fe45ccd43089f1b768~udhJgSHtJ2248222482euoutp010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1526287145; bh=2PoZkve4cni/YWyO10JBpQa/EnKa9XEZvmQyWWN0GZM=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=kiu69aXI1mCTq7kknqE6ZJxeRKFjIzYkiEUCNLmuDY/6mYQ2rDudkiqEootgRiYA7 fnRH3grbE5yzc7KLhIkN2Cyvj9bXH1Wb4UmAI2PJDP85m23ZSsOIswcrxmyOeSCbHV 6490o9HDCB6Qbcia/259V1pVnAtk67hPIz8NZZQk= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180514083902eucas1p1c61bb58feb79cedb40e96841759234e5~udhHTGz4D1654316543eucas1p1K; Mon, 14 May 2018 08:39:02 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 00.DD.05700.52B49FA5; Mon, 14 May 2018 09:39:01 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180514083900eucas1p153e0fd426d99f8388e4664224440bc3b~udhFWh4bC1541515415eucas1p17; Mon, 14 May 2018 08:39:00 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180514083859eusmtrp218574e7f273c0e6414d9fbf054cc4bfd~udhEk6d4A1205912059eusmtrp2E; Mon, 14 May 2018 08:38:59 +0000 (GMT) X-AuditID: cbfec7f2-5ffe19c000011644-9a-5af94b25da8f Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 19.E1.04178.32B49FA5; Mon, 14 May 2018 09:38:59 +0100 (BST) Received: from [106.120.43.17] (unknown [106.120.43.17]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20180514083858eusmtip27ee1c1cc4128934f9450ff14f9a90601~udhD3YE1z0729907299eusmtip2h; Mon, 14 May 2018 08:38:58 +0000 (GMT) Subject: Re: [PATCH 1/2] USB: dwc3: get extcon device by OF graph bindings To: "open list:DESIGNWARE USB3 DRD IP DRIVER" Cc: Bartlomiej Zolnierkiewicz , Marek Szyprowski , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Felipe Balbi , Greg Kroah-Hartman , Inki Dae , Rob Herring , Mark Rutland , Krzysztof Kozlowski , Chanwoo Choi , Laurent Pinchart , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org From: Andrzej Hajda Message-ID: <1080506a-adaa-193b-24d5-a779486dacc8@samsung.com> Date: Mon, 14 May 2018 10:38:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180131155718.5237-2-a.hajda@samsung.com> Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0iTcRTtt+/pbPq5WV4faS2MnpYR8kEmEgUzjaIIYlA269OkOW3LR0UR +R4kpkXbtAwf+WixNHv4SvJJSk7N0iQzS1IjpXxEK7PcPiP/O/fce88958ePxsTdhBsdqTrD qVUKpZQU4o9aLOZN3sEW+ZYrAxvYcp2JYFtShim2d3qEYPOaOgg2scBEslmDmThrNt+n2PSr hRT7sjqXZHXmpwI2/04yxt5rGqDYot4uAZtc10QFOsiMt4xIlpOmJ2QVZemkrP6mkZJlVJYh 2VSF535SLvQ/wSkj4zj15oBjwpPlnXMo5ptrwjVLO3UJ9TlrkR0NzDbIqSjCtEhIi5kSBJa8 JIIvphEkTc5RfDGFoPTdFK5FtG2lfySa54sRlHxvWxgaRzCb0odbdSXMHkgvnKWs2JkJgt6P EzZZjOnAYfb9kK1BMuvg94M3pFVVxASAvl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Tl7DoItZhZQ l/gz7xIzhC0vsf3tHChbXOLWk/lMExiFZiFpn4WkZRaSlllIWhYwsqxiFEktLc5Nzy021CtO zC0uzUvXS87P3cQIjOJtx35u3sF4aWPwIUYBDkYlHt4VK39ECbEmlhVX5h5ilOBgVhLh3W30 M0qINyWxsiq1KD++qDQntfgQoynQcxOZpUST84EJJq8k3tDU0NzC0tDc2NzYzEJJnPe8QWWU kEB6YklqdmpqQWoRTB8TB6dUA6OewnF5kSbTpUz75d9cuTvj2R4de+WrO/tXLmBfHcpTmOlh NO9cpstc51Tn7V27pD+6hE+8ufkYu7WPq+7KLrPgj2veGWRtmnA08XmZTGbhjwgu2S72W8tk 8pdqz3qz7+r5zU0e5t2X9hvPUry8/taHxZXvIitO3U6R1/hYO13X77zPx/8yfbeVWIozEg21 mIuKEwGfh11u+AIAAA== X-CMS-MailID: 20180514083900eucas1p153e0fd426d99f8388e4664224440bc3b X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-MTR: 20180514083900eucas1p153e0fd426d99f8388e4664224440bc3b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180131155734eucas1p2b55ad1aab1d5086566dad7a79b25ccf3 X-RootMTR: 20180131155734eucas1p2b55ad1aab1d5086566dad7a79b25ccf3 References: <20180131155718.5237-1-a.hajda@samsung.com> <20180131155718.5237-2-a.hajda@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31.01.2018 16:57, Andrzej Hajda wrote: > extcon device is used to detect host/device connection. Since extcon > OF property is deprecated, alternative method should be added. > This method uses OF graph bindings to locate extcon. > > Signed-off-by: Andrzej Hajda Ping, 3.5 months passed. Regards Andrzej > --- > Hi all, > > This patch implements alternative method to get extcon from DWC3. > The code works but is hacky, as DWC3 must traverse different DT nodes > to get extcon, in case of TM2 it is USB-PHY and MUIC, but other > platforms can have different paths. > I would be glad if it can be merged as is for now, but additional work > must be done to make it generic. > I guess on DT binding side it is OK. So the problem should be addressed > in the code. > My rough idea is to implement kind of extcon aliases/forwarder mechanism, > ie. USB-PHY will expect on its output remote port extcon, and it should register > extcon-forwarder pointing to this extcon. This way DWC3 can look for the extcon > on its PHY phandle, and it will receive via forwarding mechanism extcon > exposed by MUIC. > As I said this is rough idea for discussion, other propositions are welcome. > > Regards > Andrzej > --- > drivers/usb/dwc3/drd.c | 41 ++++++++++++++++++++++++++++------------- > 1 file changed, 28 insertions(+), 13 deletions(-) > > diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c > index cc8ab9a8e9d2..eee2eca3d513 100644 > --- a/drivers/usb/dwc3/drd.c > +++ b/drivers/usb/dwc3/drd.c > @@ -8,6 +8,7 @@ > */ > > #include > +#include > > #include "debug.h" > #include "core.h" > @@ -38,24 +39,38 @@ static int dwc3_drd_notifier(struct notifier_block *nb, > return NOTIFY_DONE; > } > > +struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) > +{ > + struct device *dev = dwc->dev; > + struct device_node *np_phy, *np_conn; > + struct extcon_dev *edev; > + > + if (of_property_read_bool(dev->of_node, "extcon")) > + return extcon_get_edev_by_phandle(dwc->dev, 0); > + > + np_phy = of_parse_phandle(dev->of_node, "phys", 0); > + np_conn = of_graph_get_remote_node(np_phy, -1, -1); > + edev = extcon_get_edev_by_of_node(np_conn); > + of_node_put(np_conn); > + of_node_put(np_phy); > + > + return edev; > +} > + > int dwc3_drd_init(struct dwc3 *dwc) > { > int ret; > > - if (dwc->dev->of_node) { > - if (of_property_read_bool(dwc->dev->of_node, "extcon")) > - dwc->edev = extcon_get_edev_by_phandle(dwc->dev, 0); > - > - if (IS_ERR(dwc->edev)) > - return PTR_ERR(dwc->edev); > + dwc->edev = dwc3_get_extcon(dwc); > + if (IS_ERR(dwc->edev)) > + return PTR_ERR(dwc->edev); > > - dwc->edev_nb.notifier_call = dwc3_drd_notifier; > - ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, > - &dwc->edev_nb); > - if (ret < 0) { > - dev_err(dwc->dev, "couldn't register cable notifier\n"); > - return ret; > - } > + dwc->edev_nb.notifier_call = dwc3_drd_notifier; > + ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, > + &dwc->edev_nb); > + if (ret < 0) { > + dev_err(dwc->dev, "couldn't register cable notifier\n"); > + return ret; > } > > dwc3_drd_update(dwc);