From owner-freebsd-current@freebsd.org Wed Dec 20 23:21:19 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6181E85EA9 for ; Wed, 20 Dec 2017 23:21:19 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id AE07E67597 for ; Wed, 20 Dec 2017 23:21:19 +0000 (UTC) (envelope-from ian@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id AAA24E85EA7; Wed, 20 Dec 2017 23:21:19 +0000 (UTC) Delivered-To: current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA400E85EA6 for ; Wed, 20 Dec 2017 23:21:19 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E85667595 for ; Wed, 20 Dec 2017 23:21:19 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 72d94bdf-e5dc-11e7-93a5-cd02e7dc7692 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 72d94bdf-e5dc-11e7-93a5-cd02e7dc7692; Wed, 20 Dec 2017 23:21:04 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id vBKNLHNo002139; Wed, 20 Dec 2017 16:21:17 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1513812077.77378.10.camel@freebsd.org> Subject: Re: Onewire on BeagleBoneBlack example ? From: Ian Lepore To: Poul-Henning Kamp , current@freebsd.org Date: Wed, 20 Dec 2017 16:21:17 -0700 In-Reply-To: <73804.1513810688@critter.freebsd.dk> References: <97808.1513774311@critter.freebsd.dk> <73804.1513810688@critter.freebsd.dk> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Dec 2017 23:21:19 -0000 On Wed, 2017-12-20 at 22:58 +0000, Poul-Henning Kamp wrote: > -------- > In message <97808.1513774311@critter.freebsd.dk>, Poul-Henning Kamp writes: > > > > > Does anybody have a working example of getting onewire sensors > > working on beagleboneblack ? > Ok, with some hints from the usual IRC channel I managed to figure it out: > > cd /boot/dfb > mv am335x-boneblack.dtb _am335x-boneblack.dtb > dtc -I dtb -O dts -o am335x-boneblack.dts _am335x-boneblack.dtb > patch am335x-boneblack.dts (see below) > dtc -I dts -O dtb -o am335x-boneblack.dtb am335x-boneblack.dts > echo "owc_load=YES" >> /boot/loader.conf > echo "ow_load=YES" >> /boot/loader.conf > echo "ow_temp_load=YES" >> /boot/loader.conf > > The patching of am335x-boneblack.dts is black magic, but this patch > worked for me: > > root@beaglebone:/boot/dtb # diff -u *dts > --- _am335x-boneblack.dts       2017-07-21 11:24:18.229468000 +0000 > +++ am335x-boneblack.dts        2017-07-21 19:19:35.166447000 +0000 > @@ -2149,6 +2149,14 @@ > status = "disabled"; > }; >   > +       // first number (0x36, 0x4b) refers to "phandle" of gpio# > +       // second number is bit on that *cpu* GPIO > +       // not sure if the third matter, but 1 works. > +       onewire0 { compatible = "w1-gpio"; gpios = <0x36 30 1>; }; // P9::11 > +       onewire1 { compatible = "w1-gpio"; gpios = <0x36 31 1>; }; // P9::13 > +       onewire2 { compatible = "w1-gpio"; gpios = <0x4b 16 1>; }; // P9::15 > +       onewire3 { compatible = "w1-gpio"; gpios = <0x36 3 1>; };  // P9::21 > + > __symbols__ { > l4_wkup = "/ocp/l4_wkup@44c00000"; > wkup_m3 = "/ocp/l4_wkup@44c00000/wkup_m3@100000"; > > Either device tree overlays just plain don't work, I can't figure out how to > write them (p=0.5). > > I sure get why getting people hooked on FreeBSD with RPi's and > BeagleBones is not happening :-/ > That 3rd number in gpios= describes pin attributes: /* Bit 0 express polarity */ #define GPIO_ACTIVE_HIGH 0 #define GPIO_ACTIVE_LOW 1 /* Bit 1 express single-endedness */ #define GPIO_PUSH_PULL 0 #define GPIO_SINGLE_ENDED 2 If you #include in the dts source you can just use the symbolic names. For years, folks have been espousing the value of getting people hooked on freebsd via rpi and beaglebone, but somehow those folks never end up doing a lot of committing of arm code that advances that goal, they just keep saying what a laudable goal it is.  The people who do work on arm code mostly aren't all that interested in rpi or beaglebone, so we fight the fires that are reported, and commit code contributed by others, but don't do much optional work on them. -- Ian