Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp1242324pxb; Fri, 13 Aug 2021 18:08:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9AaauFX5NwilXpjRvkNBDrYEYm39RX648IGrJcGvIiFRSSaJC82gghUZAxl8aRGcOST9E X-Received: by 2002:a02:9a13:: with SMTP id b19mr4810579jal.37.1628903322392; Fri, 13 Aug 2021 18:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628903322; cv=none; d=google.com; s=arc-20160816; b=Wy1GdXYkQaVPMYX4eodqxLrFbsCDWt/24tLCA/XZxEmmRnAaoKNXFjfvwyLFWJD0pC S42YVhVf7aA+RYUKAdXD5rgIaSnzJmvcV56ACt0WtZJMlK3q9+TsL8hSxD1bS5dyb0JI BFsjn0ObbUazP/aTvnVY/cKO/F+YcHRrbw89of+Vji68hZVUcFFJzxbWtHaJw2sHgLYN QTJOYQXQHJqgyuZD5a+EUZJq6yE1dmwZM1Ubm0fCJ8TfNQkRSc0uZgopgzz1UjZgJ7r8 0DSUanbP2NbQs8VEvipkViDFH/JIdAp/PoqUdlIqq+w08ZpCUDeUxE5nJzyO0Nrzhf30 Q59w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AzF6zd9JjX8F2cTA3zVGcFIEpz9eK1G/eiStB2DECqY=; b=TO9wQFtP6ZV4oyt5Z8rFoOeZP8sj4da9Qo+herp0b33HJnX62fcFbjNzmuUZ+IlDk+ 1r+b5Lc1yDgx9zUCzarA2tl9hBMDo/EcSc4doRlg0GW/NW8F2UE2B7HZOkI8HR658drC k62nLdbNM5UkDkYj/RbbnYggbIWY3R3MKo5jHcUxPI/dzs38DiXZM+ddoryO5luXQA7T OIu0nz4jfLol2JiajA3jKmdHUFVPur7/wuv5j6dYqWH8rCOzdh76xKJyAqI5/JVrm0NY F7XbZvcFVP5sH7APNUmde/Y7CrDwIA85Tgqor2ka6b3/0DBbpUxMY8GEqcMZ2bJqd6Ci qFJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uq3XLk6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si3868178jak.108.2021.08.13.18.08.31; Fri, 13 Aug 2021 18:08:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uq3XLk6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235870AbhHNBHG (ORCPT + 99 others); Fri, 13 Aug 2021 21:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236141AbhHNBHF (ORCPT ); Fri, 13 Aug 2021 21:07:05 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0239C0617AD for ; Fri, 13 Aug 2021 18:06:37 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id w20so23185318lfu.7 for ; Fri, 13 Aug 2021 18:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AzF6zd9JjX8F2cTA3zVGcFIEpz9eK1G/eiStB2DECqY=; b=Uq3XLk6lrpFptnkzqvf21MBT0ct05kXZIy7vnGNZ4ojy8x26JVwiLYU0V03v8MZIHi 4fX6IB0zI4DIhX3wRjGxFFx8YAprU0uUcoFYDretIJV7d/gDwd9TGmAY2luBWFd1dqzr NlZaWPD2mJ+HoSGvljAGrxaY0CTUaodrYkheMq/B5vPPUWRl0bkN5MVfqaVGwNu8A4Ku Xj4/B0Z0Tf7JIAJg/3mQY95EegNhjOr7TBJaqyzcoEjw5D6mpEMs2MNy9rFVrBTzJIkq F4haaMx/EBYDgMaXn+24h2Y+VbkA/mSiVitpJZaQ0V9VpnuWsvUowTeQL6RwpRjbveEa YObQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AzF6zd9JjX8F2cTA3zVGcFIEpz9eK1G/eiStB2DECqY=; b=IYjGA3I52NtX3qC3Tjr38aJsUaAz71MjaocDZsBDGpe/J3Ym3OWJULqSrv2BTq4fUv 18Ovkj8cuTQWJR+e9N/HtvT4zYnrcJCjWq6xRv2vYrefp11T4AXRIor4a4NGiDhQ3yIa lykvBPMGUOEpeWpvSUeHjW6W22Nl8QVdSnUnrRtTST9q8jJVE84Loufk/998fy58B8DK 4Wft07OVpLsrSDs0EI8v0mJM4TUeexxclJqeIH9QxJeZlTkfLz+o126/geJANJxYjI1w BI4vMcEHfzAgugl0sknOsW9pIUh1TtqDDN3XIYlOwbZ0sTRUwOHo3lVJeQTvp8cpVZeu VrNg== X-Gm-Message-State: AOAM531ouzafq41Rs+MG/h1Veb99H6Eq9bPJ9+LBd2bhuKWkPpbDfjjy f8PvLCN8YTNYJk31aqqTVAxbZGUg9pfsPoXllHSNjg== X-Received: by 2002:a19:4890:: with SMTP id v138mr3484589lfa.626.1628903196300; Fri, 13 Aug 2021 18:06:36 -0700 (PDT) MIME-Version: 1.0 References: <20210721100220.ddfxwugivsndsedv@mobilestation> <0064cb2c-5ca6-e693-2e89-8f045c8f7502@kernel.org> <20210721112531.xvu6ni5ksaehsrjh@mobilestation> <20210722181221.xh3r5kyu7zlcojjx@mobilestation> <20210722220918.l7j6zw3aaa27qato@mobilestation> In-Reply-To: <20210722220918.l7j6zw3aaa27qato@mobilestation> From: John Stultz Date: Fri, 13 Aug 2021 18:06:24 -0700 Message-ID: Subject: Re: [PATCH 29/29] arm64: dts: qcom: Harmonize DWC USB3 DT nodes name To: Serge Semin Cc: Bjorn Andersson , Krzysztof Kozlowski , Greg Kroah-Hartman , Rob Herring , Felipe Balbi , Florian Fainelli , Andy Gross , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-arm-msm , Linux USB List , lkml , linux-arm-kernel , Amit Pundir Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 22, 2021 at 3:09 PM Serge Semin wrote: > On Thu, Jul 22, 2021 at 01:09:05PM -0700, John Stultz wrote: > > On Thu, Jul 22, 2021 at 12:17 PM Bjorn Andersson > > wrote: > > > > On Jul 21, 2021, 1:45 PM +0200, Krzysztof Kozlowski wrote: > > > > > I had impression that kernel defines interfaces which should be used and > > > > > are stable (e.g. syscalls, sysfs and so on). This case is example of > > > > > user-space relying on something not being marked as part of ABI. Instead > > > > > they found something working for them and now it is being used in "we > > > > > cannot break existing systems". Basically, AOSP unilaterally created a > > > > > stable ABI and now kernel has to stick to it. > > > > > > > > > > Really, all normal systems depend on aliases or names and here we have > > > > > dependency on device address. I proposed way how AOSP should be fixed. > > > > > Anything happened? Nope. > > > > > > > > First time he sent a possible solution for the problem: > > > > https://lore.kernel.org/lkml/20201221210423.GA2504@kozik-lap/ > > > > > > > > To sum up you could have used one of the more portable approaches > > > > 1. add an udc alias to the controller and use it then to refer to the > > > > corresponding USB controller > > > > > > Is there such a thing as "UDC alias"? Or are you suggesting that we > > > should add such feature? > > > > > > I think it would be wonderful if we could identify the UDCs on our > > > boards as "USB1" and "USB2", or "the one and only USB-C connector". But > > > unless that will fall back to the existing naming it would break John's > > > _existing_ userspace. > > > > > Well, I'd not hold up the existing userspace I'm using as sacrosanct > > (AOSP devices still usually don't have to work cross-kernel versions - > > devboards being the main exception). I'm fine if we can rework > > userland as proposed, so that the issues can be avoided, but I > > honestly don't have enough context to really understand what that > > looks like (no idea what udc aliases are). > > > > And whatever we do, the main constraint is that userland has to be > > able to work with existing LTS kernels and newer kernels. > > As I said in my response to Bjorn even if it is added to the kernel it > won't get to the official LTSes as it would be a new kernel feature. > New features aren't normally backported to the older kernels. > > > > > > > 2. search through DT-nodes looking for a specific compatible/reg > > > > DT-properties. > > > > > > > > > > We could define that this is the way, but again we didn't yesterday so > > > your proposal is not backwards compatible. > > > > > It may be backwards compatible, but I'm still not clear exactly how it > > would work. > > > > I guess if we look through all > > sys/bus/platform/devices/*/of_node/compatbile strings for the desired > > "snps,dwc3", then find which of the directories have the desired > > address in the string? (The suggestion for looking at reg seems > > better, but I don't get a char value out of the dwc3 of_node/reg > > file). > > The algorithm is simple: > 1) You know what USB controllers you have on your platform. They are > supposed to be compatible with snps,dwc3 string and have some pre-defined > base address. > 2) Find all the files in the directory /sys/class/udc/. > 3) Walk through all the directories in /sys/bus/platform/devices/ with > names found in 2) and stop on the device with matching compatible/base > address defined in 1). > > In my case the strings could be retrieved like this: > USB_NAME_COMPAT=$(/sys/bus/platform/devices/1f100000.usb/of_node/compatible | tr '\0' '\t' | cut -f1) > USB_DEVICE_ADDR="$(head -c 4 /sys/bus/platform/devices/1f100000.usb/of_node/reg | hexdump -ve '/1 "%02x"' | sed -e 's/^0*//g')" Hey Serge, I just wanted to follow up here. Amit has reworked the db845c AOSP userland so that it no longer uses the fixed node name, but instead probes for it: https://android-review.googlesource.com/c/device/linaro/dragonboard/+/1774872 Admittedly, it does take a short-cut. As your algorithm above, digging up the devices and finding the sys/bus path to read the reg value and pipe through hexdump (which android doesn't have) seemed overly obtuse when the address is in the node name itself (while the only way to be sure, one normally doesn't use spectroscopy to determine the value of a coin when you can read what's printed on it :). But, should the node naming be further changed at least the infrastructure we have can be reworked fairly easily to adapt now. In any case, as we can handle the name change now, if you want to resubmit your patch, we would no longer object (but can't promise no one else might be bitten). Sorry for the delay this caused, and we appreciate you working with us to find a solution. thanks -john