Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1784505yba; Fri, 17 May 2019 05:26:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiKVZpnrKnDEKBFHPDRc0bI2LBs0pn93QQCtfcZyzE8XrBdNl61E9wM+ax86JW9zxQ4YWw X-Received: by 2002:a17:902:4623:: with SMTP id o32mr38272275pld.276.1558095996614; Fri, 17 May 2019 05:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558095996; cv=none; d=google.com; s=arc-20160816; b=tmFsJHkCPZ/Bhix6WcbOEO0M0uzNamxM77WNHaLSx1pSvEzw06lndn00FwbY556jPs 6P+2FjVE/UUyH7pObojFzGzCRS9HC5YLkdO25dBMHujt1vjKKxWfrSdZFk2yCVFqnc6x 7eQuL9Ix6mCUAUNow9Qs08iQtDlzWeoq9tC6BokSKGxBKTlp2f9Y5HvKM2t0bSzvdeDW BJtN8U3dPisLDujWyW7Hwe357kQ8P8gmW9ARxIGCzx4YsLJWSukMTamOMUFYcolAc65r R8tAWXVSbm98SJgj6tCRQ3OjrFTrhv2xUXMslHLODkDVLnmU2yg6PUwVyxY41f70bwOY njtg== 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; bh=raW73Fmp0SchwvyAcfTJ/aArOV8157rWG22rbQpTcII=; b=hhUWJx35RucE18Z6O8gq3fPhlSGjVGgD+b3k4ALuBh83xY4c9XDbekKLr5KzubHxrj 5/Q1S5ztjq+fPpBSEt9/lVA4MyTyTmGDLyNuWN+kJp1aVa8XQQlRmVW3h7d6ZlIWxAk9 K+y6MPBJ0nAFL9h2rIXfphpvF7PKF9MPh/ztnbO3dU47UCGUWUlQO2gg+pbOoe16hqVV iZMErpEW4kyvXnsoIb/hLm1sZ7ryA0RYcR8WYXJThLjUKcoUGSNBXjPc/7xNYZmK3dpA zPfttTKjY39AoJsbzZGav+ncHmHP6jGzJot5c8wWdlJEXz75lg1DoJy++KY9EFQmlc3M e9KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jK5cIqgT; 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 d6si7656628pgv.583.2019.05.17.05.26.21; Fri, 17 May 2019 05:26:36 -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=jK5cIqgT; 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 S1728582AbfEQLTF (ORCPT + 99 others); Fri, 17 May 2019 07:19:05 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47597 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727763AbfEQLTF (ORCPT ); Fri, 17 May 2019 07:19:05 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190517111903euoutp02c0e4c298aebc839ce95949d0128087d0~fdF4u4Teq2610926109euoutp02E for ; Fri, 17 May 2019 11:19:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190517111903euoutp02c0e4c298aebc839ce95949d0128087d0~fdF4u4Teq2610926109euoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1558091943; bh=raW73Fmp0SchwvyAcfTJ/aArOV8157rWG22rbQpTcII=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=jK5cIqgTZPd/wjeFmVLeZCGs1yBj+jTY2mzN2FD7AKkxkDSTzKyKQWQHkD/UoAWad Vnfp0/IsDv5ls3Zb+KCTJHmr7f0J7gtsyOCVaaXNizahlmDutgtG1B4DlpPdB3Edzb InzZF8P5FucMalvZNFxaIXeLK2TUoWcIjfXI6skE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190517111903eucas1p1fff781e1b6f397c5e9e5d30dc38f7c36~fdF4KZYiK2057620576eucas1p1O; Fri, 17 May 2019 11:19:03 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F5.EC.04298.6A89EDC5; Fri, 17 May 2019 12:19:03 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190517111902eucas1p1f0c52ecf0e0d9aec090f6ad16ca5a7ef~fdF3W56Xo1808118081eucas1p1c; Fri, 17 May 2019 11:19:02 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190517111902eusmtrp10ae81b603f07d628d673ea91d5872b2a~fdF3I6P8c0771307713eusmtrp1S; Fri, 17 May 2019 11:19:02 +0000 (GMT) X-AuditID: cbfec7f2-f13ff700000010ca-5a-5cde98a6e00f Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 2B.13.04140.6A89EDC5; Fri, 17 May 2019 12:19:02 +0100 (BST) Received: from [106.120.50.25] (unknown [106.120.50.25]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190517111901eusmtip27dc496be6e0e5da702d85878731dd4c7~fdF2tPcl12007820078eusmtip2F; Fri, 17 May 2019 11:19:01 +0000 (GMT) Subject: Re: [PATCH v3] usb: core: verify devicetree nodes for USB devices To: =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= Cc: Peter Chen , "linux-usb@vger.kernel.org" , "linux-samsung-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , Markus Reichl , Krzysztof Kozlowski From: Marek Szyprowski Message-ID: <515ee8df-d186-45ec-698c-f2e68097159d@samsung.com> Date: Fri, 17 May 2019 13:18:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0iTYRTu3bft+zacvk5lB7WSgYFCmmjxiSJa/hgZYn/6kYNa+uElnbp5 LTAveFtiqZS2LC1xhpSXsWSJJpl4Sdq8BJq3mtiPhTPIBG9Ibp+W/55znuec5zxwKELcz/Ok UpTZjEqpSJPyhdzekW3T2fbGZfm5il1E9zR28ejS1i4+bTZ3k/RMXxOfbjS/59AvdWUEbR3e QvSWpYFD7y0v8iIFsvnFezJ9RxVfNvjsNSlbm/hEynrWjRxZjaEDyTb0p+LI68LwRCYtJZdR BUbcFCZ3Vo6RmVbv/M2KkCJkkGiQgAIcAm2WEqRBQkqMXyFoXhjgs8UfBMayWg5bbCAoaWnl HI1Yvu1wWaIdwZe5DtJOiLENQV1PjB274cugM83y7dgdnwejdsqxlsA6Anaa9Dw7wcdBoLFp HCIRjoCxvn7HIi72hYXipQMHivLAcni5cShxhfEnq1w7FmA/qLlf5TiIwKeh9O1TgsUSmF9t PjzURMLXiTAWR4Pu8xSPxW7wc9RAstgbJuqrHWEAlyKwmN6QbFGNYK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ToOcmMkuJJucD 00ZeSbyhqaG5haWhubG5sZmFkjhvh8DBGCGB9MSS1OzU1ILUIpg+Jg5OqQbGnVFiotsj8lqO b3/zvefKVSsxw0/rrc8ezBC6s31jmPbs5yWtzx6oJaadeyN+uq2kzLSOY+/r5XVMmRKH5p1+ vvvQwcwX25ckzVqtfLNx1+Yv/rt3HXd/vKScSfujr5WSAXNth6/UwdZq1TW3jh3i2KV8usRz 1qR95qvZ5x9V4Z9yes9S8WwzViWW4oxEQy3mouJEAF3HZcnjAgAA X-CMS-MailID: 20190517111902eucas1p1f0c52ecf0e0d9aec090f6ad16ca5a7ef X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190509084827eucas1p294962744fe70745c50b69a5349b5de68 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190509084827eucas1p294962744fe70745c50b69a5349b5de68 References: <20190509084726.5405-1-m.szyprowski@samsung.com> <7c5579d2-634a-d705-a451-563939957d57@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Måns On 2019-05-13 12:03, Måns Rullgård wrote: > Marek Szyprowski writes: >> Hi Peter, >> >> On 2019-05-10 05:10, Peter Chen wrote: >>> >>>> Marek Szyprowski writes: >>>>> Commit 69bec7259853 ("USB: core: let USB device know device node") >>>>> added support for attaching devicetree node for USB devices. The >>>>> mentioned commit however identifies the given USB device node only by the 'reg' >>>>> property in the host controller children nodes. The USB device node >>>>> however also has to have a 'compatible' property as described in >>>>> Documentation/devicetree/bindings/usb/usb-device.txt. Lack for the >>>>> 'compatible' property check might result in assigning a devicetree >>>>> node, which is not intended to be the proper node for the given USB device. >>>>> >>>>> This is important especially when USB host controller has child-nodes >>>>> for other purposes. For example, Exynos EHCI and OHCI drivers already >>>>> define child-nodes for each physical root hub port and assigns >>>>> respective PHY controller and parameters for them. Those binding >>>>> predates support for USB devicetree nodes. >>>>> >>>>> Checking for the proper compatibility string allows to mitigate the >>>>> conflict between USB device devicetree nodes and the bindings for USB >>>>> controllers with child nodes. It also fixes the side-effect of the >>>>> other commits, like 01fdf179f4b0 ("usb: core: skip interfaces disabled >>>>> in devicetree"), which incorrectly disables some devices on Exynos >>>>> based boards. >>> Hi Marek, >>> >>> The purpose of your patch is do not set of_node for device under USB >>> controller, right? >> Right. >> >>> I do not understand how 01fdf179f4b0 affect your boards, some nodes >>> under the USB controller with status is not "okay", but still want to >>> be enumerated? >> Please look at the ehci node in arch/arm/boot/dts/exynos4.dtsi and then >> at the changes to that node in arch/arm/boot/dts/exynos4412-odroidx.dts. >> Exynos EHCI controller has 3 subnodes, which matches to the physical >> ports of it and allows the driver to enable given PHY ports depending on >> which physical port is used on the particular board. All ports cannot >> not be enabled by default, because PHY controller has limited resources >> and shares them between USB host and USB device ports. > It seems like what's happening is that the Exynos port/phy nodes are > mistaken for standard USB device nodes attached to the root hub. The > problem is that hub port numbering starts at 1 while the Exynos nodes > start from 0. This causes attached devices to be associated with the > wrong DT node. > > Ignoring backwards compatibility, I can see a few ways of fixing this: > > - Add another child node, along side the port@N nodes, of the host > controller to represent the root hub. Nodes for attached devices > would then be descendants of this new node. > > - Change the Exynos HCD binding to use a more standard "phys" property > and get rid of the child nodes for this purpose. > > - Move the port@N nodes below a new dedicated child node of the HCD. > > The first is probably the easiest to implement since it doesn't require > any nasty hacks to avoid breaking existing device trees. I've posted a patch, which disables creating USB device nodes for Exynos HCD devices (by zeroing their of_node pointer). Then I will try to apply the second approach from the above list, but merging it to mainline will require a few more steps and some time. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland