linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serge Semin <fancer.lancer@gmail.com>
To: John Stultz <john.stultz@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>, Felipe Balbi <balbi@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Andy Gross <agross@kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux USB List <linux-usb@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Amit Pundir <amit.pundir@linaro.org>
Subject: Re: [PATCH 29/29] arm64: dts: qcom: Harmonize DWC USB3 DT nodes name
Date: Fri, 23 Jul 2021 01:09:18 +0300	[thread overview]
Message-ID: <20210722220918.l7j6zw3aaa27qato@mobilestation> (raw)
In-Reply-To: <CALAqxLUT0e+mHMVo685oVTxR8y76733cN0yciQ7ePS6GRE+_dg@mail.gmail.com>

On Thu, Jul 22, 2021 at 01:09:05PM -0700, John Stultz wrote:
> On Thu, Jul 22, 2021 at 12:17 PM Bjorn Andersson
> <bjorn.andersson@linaro.org> 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')"

Regards,
-Sergey

> 
> It seems much more straightforward to do an `ls /sys/class/udc/$GADGET_ADDR.*`
> 
> But again, if folks decide the names can be rearranged to usb.<addr>
> in the future, that would break too.
> 
> thanks
> -john

  reply	other threads:[~2021-07-22 22:09 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 11:59 [PATCH 00/29] dt-bindings: usb: Harmonize xHCI/EHCI/OHCI/DWC3 nodes name Serge Semin
2020-10-20 11:59 ` [PATCH 01/29] usb: dwc3: Discard synopsys,dwc3 compatibility string Serge Semin
2020-10-20 12:15   ` Andy Shevchenko
2020-10-20 12:28     ` Krzysztof Kozlowski
2020-10-20 12:33       ` Serge Semin
2020-10-20 12:27   ` Felipe Balbi
2020-10-20 11:59 ` [PATCH 02/29] arm: dts: keystone: Correct DWC USB3 compatible string Serge Semin
2020-10-20 12:30   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 03/29] arm: dts: am437x: " Serge Semin
2020-10-20 12:31   ` Krzysztof Kozlowski
2020-11-10 13:17     ` Tony Lindgren
2020-10-20 11:59 ` [PATCH 04/29] arm: dts: exynos: " Serge Semin
2020-10-26 18:55   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 05/29] arm64: dts: amlogic: meson-g12: Set FL-adj property value Serge Semin
2020-10-20 12:34   ` Krzysztof Kozlowski
2020-10-20 12:44     ` Serge Semin
2020-10-20 12:46       ` Krzysztof Kozlowski
2020-10-20 13:06   ` Neil Armstrong
2020-10-20 19:38   ` Martin Blumenstingl
2020-10-20 11:59 ` [PATCH 06/29] arc: dts: Harmonize EHCI/OHCI DT nodes name Serge Semin
2020-10-20 12:35   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 07/29] arm: dts: bcm53x: " Serge Semin
2020-10-20 12:34   ` Krzysztof Kozlowski
2020-10-22 20:43   ` Florian Fainelli
2020-10-20 11:59 ` [PATCH 08/29] arm: dts: stm32: " Serge Semin
2020-10-20 12:36   ` Krzysztof Kozlowski
2020-11-09 10:43     ` Alexandre Torgue
2020-10-20 11:59 ` [PATCH 09/29] arm: dts: hisi-x5hd2: " Serge Semin
2020-10-20 12:36   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 10/29] arm: dts: lpc18xx: " Serge Semin
2020-10-20 12:37   ` Krzysztof Kozlowski
2020-10-21 19:02   ` Vladimir Zapolskiy
2020-10-20 11:59 ` [PATCH 11/29] arm64: dts: hisi: " Serge Semin
2020-10-20 12:37   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 12/29] mips: dts: jz47x: " Serge Semin
2020-10-20 12:40   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 13/29] mips: dts: sead3: " Serge Semin
2020-10-20 12:37   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 14/29] mips: dts: ralink: mt7628a: " Serge Semin
2020-10-20 12:38   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 15/29] powerpc: dts: akebono: " Serge Semin
2020-10-20 12:38   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 16/29] arm: dts: bcm5301x: Harmonize xHCI " Serge Semin
2020-10-20 12:38   ` Krzysztof Kozlowski
2020-10-22 20:44   ` Florian Fainelli
2020-10-20 11:59 ` [PATCH 17/29] arm64: dts: marvell: cp11x: " Serge Semin
2020-10-20 12:40   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 18/29] arm: dts: marvell: armada-375: Harmonize DWC USB3 " Serge Semin
2020-10-20 12:43   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 19/29] arm: dts: exynos: " Serge Semin
2020-10-26 18:56   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 20/29] arm: dts: keystone: " Serge Semin
2020-10-20 12:41   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 21/29] arm: dts: ls1021a: " Serge Semin
2020-10-20 12:46   ` Krzysztof Kozlowski
2020-11-01  7:37   ` Shawn Guo
2020-10-20 11:59 ` [PATCH 22/29] arm: dts: omap5: " Serge Semin
2020-10-20 12:41   ` Krzysztof Kozlowski
2020-11-10 13:18     ` Tony Lindgren
2020-10-20 11:59 ` [PATCH 23/29] arm: dts: stih407-family: " Serge Semin
2020-10-20 12:41   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 24/29] arm64: dts: allwinner: h6: " Serge Semin
2020-10-20 12:42   ` Krzysztof Kozlowski
2020-10-22 16:13   ` Maxime Ripard
2020-10-20 11:59 ` [PATCH 25/29] arm64: dts: apm: " Serge Semin
2020-10-20 12:42   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 26/29] arm64: dts: exynos: " Serge Semin
2020-10-20 12:43   ` Krzysztof Kozlowski
2020-10-22 11:25     ` Serge Semin
2020-10-26 18:57   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 27/29] arm64: dts: layerscape: " Serge Semin
2020-10-20 12:47   ` Krzysztof Kozlowski
2020-11-01  7:37   ` Shawn Guo
2020-10-20 11:59 ` [PATCH 28/29] arm64: dts: hi3660: " Serge Semin
2020-10-20 12:44   ` Krzysztof Kozlowski
2020-10-20 11:59 ` [PATCH 29/29] arm64: dts: qcom: " Serge Semin
2020-10-20 12:44   ` Krzysztof Kozlowski
2020-11-02  7:34   ` Jun Li
2020-11-03 23:23     ` Bjorn Andersson
2020-11-10 12:12       ` Serge Semin
2021-07-14  0:07   ` John Stultz
2021-07-14  2:27     ` Bjorn Andersson
2021-07-21  7:39       ` Greg Kroah-Hartman
2021-07-14 12:48     ` Serge Semin
2021-07-14 14:59       ` Bjorn Andersson
2021-07-21  7:38       ` Greg Kroah-Hartman
2021-07-21 10:02         ` Serge Semin
2021-07-21 10:29           ` Greg Kroah-Hartman
2021-07-21 10:45             ` Krzysztof Kozlowski
2021-07-21 11:02               ` Greg Kroah-Hartman
2021-07-21 11:10                 ` Krzysztof Kozlowski
2021-07-21 11:25                   ` Serge Semin
2021-07-21 18:08                     ` John Stultz
2021-07-22 18:12                       ` Serge Semin
2021-07-22 19:17                         ` Bjorn Andersson
2021-07-22 20:09                           ` John Stultz
2021-07-22 22:09                             ` Serge Semin [this message]
2021-08-14  1:06                               ` John Stultz
2021-08-15 19:46                                 ` Serge Semin
2021-08-18  3:44                                   ` Bjorn Andersson
2021-08-19 11:03                                     ` Serge Semin
2021-07-22 21:54                           ` Serge Semin
2021-07-23  8:17                             ` Greg Kroah-Hartman
2021-07-21 20:09             ` Bjorn Andersson
2021-07-23  8:18               ` Greg Kroah-Hartman
2021-07-23 14:34                 ` Bjorn Andersson
2021-07-23 15:54                   ` Greg Kroah-Hartman
2021-07-23 19:54                     ` Bjorn Andersson
2021-07-24  7:50                       ` Greg Kroah-Hartman
2021-07-21  7:37     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210722220918.l7j6zw3aaa27qato@mobilestation \
    --to=fancer.lancer@gmail.com \
    --cc=agross@kernel.org \
    --cc=amit.pundir@linaro.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).