From owner-freebsd-arm@freebsd.org Fri Jun 7 11:33:01 2019 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68A6215AA0E1 for ; Fri, 7 Jun 2019 11:33:01 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [195.149.99.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "raven.bwct.de", Issuer "raven.bwct.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 08FFD6FC30; Fri, 7 Jun 2019 11:32:59 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from mail.cicely.de ([10.1.1.37]) by raven.bwct.de (8.15.2/8.15.2) with ESMTPS id x57BONlU048106 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Jun 2019 13:24:24 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cicely.de; s=default; t=1559906665; bh=YabiD4CcdmfXy/2jDrIPnY80329AGjmTKhY7RhRdfEw=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To; b=MsEnLBEC1HkXu/hXzeYZgoR06vZFE3mzhYo733mK49HjZgCsIsQEpMY5T8JVpZjrs /eX8PUJGiqvc800pwO/KvYTd3e0KRyFE+hev8gugz8topY3YZ1Ln+jFsVBlNQb5bTu ICFDas7ii6WLPL/K6c1RSk4Q55oXF9ST92ukdvRw= Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by mail.cicely.de (8.14.5/8.14.4) with ESMTP id x57BOB9G067732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 7 Jun 2019 13:24:11 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.15.2/8.15.2) with ESMTP id x57BOAfk080100; Fri, 7 Jun 2019 13:24:10 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.15.2/8.15.2/Submit) id x57BO9oa080099; Fri, 7 Jun 2019 13:24:09 +0200 (CEST) (envelope-from ticso) Date: Fri, 7 Jun 2019 13:24:09 +0200 From: Bernd Walter To: Nicola Mingotti Cc: Ian Lepore , Sergey Manucharian , nmingott@gmail.com, freebsd-arm@freebsd.org Subject: Re: How to set PWM tunable name to ehrpwm.1 ? Message-ID: <20190607112409.GO40697@cicely7.cicely.de> Reply-To: ticso@cicely.de References: <68790975-a5a5-2138-ca89-117878d6cf2d@gmail.com> <20190606220639.GE13546@eldorado> <8126fa4ae0ca650ca12f28dd538e6e8c4e81b432.camel@freebsd.org> <2852b9da-e647-69a7-3218-88cfa500eadc@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2852b9da-e647-69a7-3218-88cfa500eadc@gmail.com> X-Operating-System: FreeBSD cicely7.cicely.de 12.0-STABLE amd64 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-2.9 required=4.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9 autolearn=ham version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on spamd.cicely.de X-Rspamd-Queue-Id: 08FFD6FC30 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cicely.de header.s=default header.b=MsEnLBEC X-Spamd-Result: default: False [-0.98 / 15.00]; HAS_REPLYTO(0.00)[ticso@cicely.de]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[cicely.de:+]; MX_GOOD(-0.01)[mx1.bwct.de]; NEURAL_HAM_SHORT(-0.40)[-0.404,0]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:21461, ipnet:195.149.99.0/24, country:DE]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.86)[-0.858,0]; R_DKIM_ALLOW(-0.20)[cicely.de:s=default]; RCVD_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.90)[-0.904,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(-0.00)[country: DE(-0.01)]; DMARC_NA(0.00)[cicely.de]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.99.149.195.list.dnswl.org : 127.0.20.0]; R_SPF_NA(0.00)[] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2019 11:33:01 -0000 On Fri, Jun 07, 2019 at 02:08:32AM -0700, Nicola Mingotti wrote: > > > On 6/6/19 3:40 PM, Ian Lepore wrote: > >On Thu, 2019-06-06 at 16:06 -0600, Sergey Manucharian wrote: > >>Excerpts from Nicola Mingotti's message from Thu 06-Jun-19 12:33: > >>>In my BeagleBone Black, FreeBSD-12 RELEASE, i created two > >>>overlays, > >>>pwm.dtso and pwm1.dtso. They enable the PWM pins p9.21, p9.22 and > >>>respectively p9.14, p9.16. DTSO files are below. > >>> > >>>If I load both the DTBO at boot I see > >>>correctly|ehrpwm.0|and|ehrpwm.1|, > >>>associated to the correct pins. But, if i remove the > >>>overlay|pwm.dtbo|then i seen only|ehrpwm.0|in|sysctl -a|, which is > >>>not > >>>what i want, i would like to see the name|ehrpwm.1|. > >>> > >>>This is important because i must be 100% sure a certain pin > >>>corresponds > >>>the a certain tunable.This must be true even if i remove non > >>>relevant > >>>overlays in the future. I guess there must be some parameter in the > >>>DTSO > >>>which i don't know, i hope you can give me some directions about > >>>that. > >>It is not related to your DTBO's. That's how everything works (at > >>least > >>by default). You will see the same naming issue with serial ports, > >>for > >>example. And not just in BBB. > >> > >>E.g. when I have enabled uart0 and uart2 they are named ttyu0 and > >>ttyu1, > >>if I have only uart2, it becomes ttyu0. > >> > >>It's easier if there is a device node in /dev, so you can create a > >>symlink > >>with a fixed name (I have a script called by devd for my multiple > >>serial > >>ports). However, that's not the case with PWM... > >> > >>Maybe there is an option to use persistent names for devices that > >>somebody > >>can point to. > >> > >Nope, there's no magic thing you're missing that fixes this. Devices > >get named-and-numbered based on the order of instantiation. > > > >Since what really matters here is the sysctl names, we could change the > >driver to install the sysctl nodes using the fdt device node names > >instead of the freebsd newbus device names. Hmm, actually, since > >people may be relying on the current names, I guess what we'd have to > >do is install another set of sysctl names based on fdt name (basically > >a set of alias names). > > > >-- Ian > > > > I see, I agree changing the default naming scheme may damage who is > relaying on it. It is not a good idea. Maybe it could be implemented in > release 13. > > To Sergey. I used devd in the past, it works well. But i would prefer > not to use it in this case, even if I had a /dev/xyz file available. The > reason is that the /dev/xyz file would appear before the the devd daemon > starts up (i guess), so the case would not stricly be covered by what > the devd man page says devd should do. > $> man devd > => " ... Whenever a device is added to or removed from the device tree ... " > > To Ian. The idea of the alias seems good. I don't know at all what you > can manage to do at the kernel level with the tunables. I imagine > something like |dev.alias.am335x_ehrpwm.1| which actually refers to > |EHRPWM1| not the second |ehrpwm| that got plugged into the system via > overlay. > > Thank you for your answers I don't know if it would work for you, but I'm a happy user of devd for such things. This is devinfo -rv on a Pine64: ... uart0 pnpinfo name=serial@1c28000 compat=snps,dw-apb-uart ... I assume it is similar to what you should see on the beaglebone. It should be easy to identify a specific device via the name= entry. Messages to devd gets queued up and it shouldn't matter if the device is already attached when devd starts. This is what I use for USB uarts: attach 0 { device-name "uftdi[0-9]+"; match "sernum" "FTYY82HD"; match "interface" "0"; action "rm /dev/manson_psu5; ln -s /dev/cua$ttyname /dev/manson_psu5"; }; Since uart(4) doen't offer a nice $ttyname, you have to convert the device-name into the matching cuau* entry. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.