Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5059863yba; Mon, 13 May 2019 04:49:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3T7pLQrpa0+pR/CAskoXbaidHQrikKWUNVG53ZlV1EXr/mGvD1O73vDwpO6uL88a9BrFR X-Received: by 2002:aa7:8c48:: with SMTP id e8mr32596981pfd.80.1557748162837; Mon, 13 May 2019 04:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557748162; cv=none; d=google.com; s=arc-20160816; b=F1D4CQurVV6Ji0w+coue+eCirwsuRNeYLDrgnD9NVdZ6XJDzeopFuaSXAMttzUBGbZ rouSFdGxChQUJmXvRJ4RmTliPhEqiszaMdf2L7FhP50Jt2R6bOHQUDQAjVkTYa6HpTvi iemqxiWGR1tWnwGcvulfbIqRJSX8X5gA0MAbijlZe0fze2T0AYx9wW4Mpk+WK2rCaGZw mNewqyjPxTvu3978SEN+ceRlyOjkNQMpglx/5sOX1aMJYY4ttALYPszX2EVMM5rnRVDu rI2jxtdebUSfSJ6B3OKiaxFhM4lHynLESRQE9Hpo4oaQK4S72F9y9fSfyhmPUUj6bWXd 9pPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from; bh=1xzBNoRWVmq8t2D452MmvtUO2bMNMI0azbyzOvIKcYA=; b=Tad+4wwZECf9OebeuSe5eHM3DRIuKjDklmoqR+Iwn+Br631uZjCwiMmlvKbzbQlxan y3yaib4tpcr4+FWbLhTEjRcpmSOA6LxzWhGH9TfIsucFWCqwXyCfErAz1Vj24LyEXxAY 5E1rsZ5UmPUMHFhYxUAwBT2uCYER0Paox9xxovmGWF2wkD8MzSmpTd+AxfCt/wNe7//O Iop5NeC1IaeNsm6i53UbWoOFq8hyRm9iN0kWBRgnmF588/RoJ0EfF2Vwxg/IxEdHcWHw jt/cemasRFq74BMR+ekcr7unZ7suaV7mgsk5zRzzVXruFU3NdnHildLGznlfd4Ye7ENx cNUg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h22si774862pfj.52.2019.05.13.04.49.06; Mon, 13 May 2019 04:49:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728885AbfEMKEB convert rfc822-to-8bit (ORCPT + 99 others); Mon, 13 May 2019 06:04:01 -0400 Received: from unicorn.mansr.com ([81.2.72.234]:36202 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727690AbfEMKEA (ORCPT ); Mon, 13 May 2019 06:04:00 -0400 Received: by unicorn.mansr.com (Postfix, from userid 51770) id 74D29149B5; Mon, 13 May 2019 11:03:58 +0100 (BST) From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Marek Szyprowski 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 Subject: Re: [PATCH v3] usb: core: verify devicetree nodes for USB devices References: <20190509084726.5405-1-m.szyprowski@samsung.com> <7c5579d2-634a-d705-a451-563939957d57@samsung.com> Date: Mon, 13 May 2019 11:03:58 +0100 In-Reply-To: <7c5579d2-634a-d705-a451-563939957d57@samsung.com> (Marek Szyprowski's message of "Fri, 10 May 2019 11:43:41 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- M?ns Rullg?rd