From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71200C4320A for ; Thu, 22 Jul 2021 22:11:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39BBE6008E for ; Thu, 22 Jul 2021 22:11:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 39BBE6008E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rS5psJZ5qob/+fXEAtXL3Bes38SriNDAm/I2NAds1n8=; b=r9TPCpbHh0P9AF la055vJtK4KtSzFOXp59efigHAmwlis8vO7cttDN95t3cjtjzxj70KF5KgZXH+ccri9M6CtAC+qCP XpgkMn/981m7ReSBaVGluES8TEONwhh338jWcPPhdud2b34lWOHmk7BxfS3isu6uNErEC/Z0PV4zA MpazkA8F1cUkHyjcL2VizoNUcjRwKHKZNor6HgmxKCNVFdjl4GwSLgJWvKpskWkDOQ8MpCn79Bg5D Po0ToHVYJ6gRLLJH38R+I8q7MsDGSs1B0NzYylWB0Tq5Mro7zigxGvY4SIsJh4CygwkIm5Ta1Beb4 hxujAboCUdrY7s1fqReA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6gsh-002r1Q-Ok; Thu, 22 Jul 2021 22:09:27 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6gsc-002r0Y-Td for linux-arm-kernel@lists.infradead.org; Thu, 22 Jul 2021 22:09:24 +0000 Received: by mail-lf1-x12f.google.com with SMTP id s13so10759447lfi.12 for ; Thu, 22 Jul 2021 15:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sQcCO7T0VAeOgAPpjlMadGVJqKhrykjGpQRGvXrG7D4=; b=P9Ye/XTsfh014C3IkLuJWNzEvvbK5NNSjz9ggjj2gNq1gshduWRYIhCF9ETVibqLgf VUOYW7QWB0BjjkSn5AbCrOQNbD9ZIKHlpdqBHvpyDgyo+5YMUMp/zMNTs7Q0NGRkYmUn UydSeXEKwZEfSiLMUu3YT/kJERY1Xf5IAGg+uCgXSHZNYn8nFuLY82y1yU259oknri4f /cHM/1Mm07WZGR30SvqbasOvefUVihOjtIgxtZ63O+bik30eDhFg4s3SZ0SBBg0uczZt W17HyEPFGhdhC2Yz8/pADAbzaNwpobpWxWAhVec0q3nMI1iJji00nKG6c/V+CI6QfdxP Jdeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sQcCO7T0VAeOgAPpjlMadGVJqKhrykjGpQRGvXrG7D4=; b=RmiezaBsM8qiQ3UcVWq69hNgzw9/d+0vA6CMmfNk4hV/KgvkA5WvwZtvqfke127IXV UBvcwRFVMi/CSm5deajh+kxOtiAQ5sbo2mGQ0Ot421CHzcnNh7uf3nMWTU6zJZBcjR9k MUmlGAdw4gOJFErqBO4r0u9AoEN3oQGUK8K7IW4Pj3fiupXtX+U80Ado2LU/xleCpi3R QqrCWpx8JS0ITFoHxjp75A+GA6zOiI7Y1CFZg2BITdzSWchinvu7DgayEDhTwerrcwB6 61S/hXoNKIl5Cw/nDyeH//XMqNR/j5cUTP7Gxe9c+vYLh/6564pmwKzlEkrmnhpiiVh9 FhwQ== X-Gm-Message-State: AOAM533UDIubdLi/VCsaPTTi+mOWElLa2OdmPBdkFvQux5OnxxKkkGOy mq9mv87f38fV25S+sPODAaQ= X-Google-Smtp-Source: ABdhPJxSj5Qrch2X3G0CeHYQm8Cr6HGhrry0iOsxNObScS97gZBVYhJYtco3C8u1Bdcfc/l8coFAow== X-Received: by 2002:ac2:43a6:: with SMTP id t6mr980010lfl.194.1626991761252; Thu, 22 Jul 2021 15:09:21 -0700 (PDT) Received: from mobilestation ([95.79.127.110]) by smtp.gmail.com with ESMTPSA id g12sm3214158lja.13.2021.07.22.15.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 15:09:20 -0700 (PDT) Date: Fri, 23 Jul 2021 01:09:18 +0300 From: Serge Semin To: John Stultz 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 Subject: Re: [PATCH 29/29] arm64: dts: qcom: Harmonize DWC USB3 DT nodes name Message-ID: <20210722220918.l7j6zw3aaa27qato@mobilestation> References: <20210721100220.ddfxwugivsndsedv@mobilestation> <0064cb2c-5ca6-e693-2e89-8f045c8f7502@kernel.org> <20210721112531.xvu6ni5ksaehsrjh@mobilestation> <20210722181221.xh3r5kyu7zlcojjx@mobilestation> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210722_150923_023145_253F8654 X-CRM114-Status: GOOD ( 42.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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')" 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. > in the future, that would break too. > > thanks > -john _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel