From owner-freebsd-arm@freebsd.org Thu Mar 30 21:27:18 2017 Return-Path: Delivered-To: freebsd-arm@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 75554D24B04 for ; Thu, 30 Mar 2017 21:27:18 +0000 (UTC) (envelope-from rj@obsigna.com) Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12ABDFB7 for ; Thu, 30 Mar 2017 21:27:17 +0000 (UTC) (envelope-from rj@obsigna.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1490909235; l=2698; s=domk; d=obsigna.com; h=To:References:Content-Transfer-Encoding:Cc:Date:In-Reply-To:From: Subject:Mime-Version:Content-Type; bh=muWCnLQXnNC12Lrj5kfW3IYWHvD6qLCOClNkoJE2f54=; b=HPhdj2TCQbanvbnQ2orcIcVScFzXd2gXEHuRd9uGyV9fMio0u/AnfMvwiW6iW8MESu 07t9cgB0UQt8UZ85zzCrKv/iiC+tUXTzZzY7RQDIMX6toywZE/QBybkjrJbyDKfKhtaz ++3p38sUjNcf9sNN3FgVX1qpiCVpX8W+wCiUY= X-RZG-AUTH: :O2kGeEG7b/pS1EK7WHa0hxqKZr4lnx6UhT0M0o35iAdWtoM07Gt3wQHFGh0i99LiI4M= X-RZG-CLASS-ID: mo00 Received: from mail.obsigna.com (bb02b5db.virtua.com.br [187.2.181.219]) by smtp.strato.de (RZmta 40.4 DYNA|AUTH) with ESMTPSA id d06a02t2ULRFNRx (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 30 Mar 2017 23:27:15 +0200 (CEST) Received: from rolf.projectworld.net (rolf.projectworld.net [192.168.222.15]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id C83C17506DAD; Thu, 30 Mar 2017 18:27:12 -0300 (BRT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Enabling ADC on a Beaglebone Black running FreeBSD 12.0-CURRENT (BEAGLEBONE) From: "Dr. Rolf Jansen" In-Reply-To: <20170330223534.0ccc82eec0bf820651604cd7@bidouilliste.com> Date: Thu, 30 Mar 2017 18:27:11 -0300 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <0C4DCBB9-2642-4B0F-B15B-4139D5D8B249@obsigna.com> <271AFD8F-BD2C-445C-AB95-D7D07593E487@obsigna.com> <5D2FEB0D-64F3-488C-8458-85E7DF10EFB7@obsigna.com> <20170330202858.GA22253@bluezbox.com> <20170330223534.0ccc82eec0bf820651604cd7@bidouilliste.com> To: Emmanuel Vadot X-Mailer: Apple Mail (2.1878.6) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2017 21:27:18 -0000 Am 30.03.2017 um 17:35 schrieb Emmanuel Vadot : > On Thu, 30 Mar 2017 13:28:58 -0700 > Oleksandr Tymoshenko wrote: >=20 >> Dr. Rolf Jansen (rj@obsigna.com) wrote: >>> Today I updated once again my Beaglebone Black by >>> merging-in the latest FreeBSD 12.0-CURRENT (BEAGLEBONE) >>> snapshot, and once again I enabled the ADCs on the >>> Beaglebone in the device tree blob am335x-boneblack.dtb, >>> and the ADC is still working fine. >>>=20 >>> Even if it is not that a big hassle to modify the device >>> tree blob, I am curious on why the ADC has been disabled >>> in the blob in the first place, end even more, given the >>> fact that the device ti_adc driver is built-in to kernel >>> and once enabled, the ADC is functional. >>>=20 >>> Didn't it work at some time in the past? Now it is. >>>=20 >>> What is missing to activate the ADC in the device tree >>> blob by default? >>=20 >> Few months ago FreeBSD switched to using upstream DTB files >> instead of custom-made ones. For some reason ADC is disabled >> in upstream. If you're running recent FreeBSD you can use >> dtb overlays to enable ADC without hassle of maintaining >> custom dts file. You can do following: >>=20 >> 1. Create am335x-beaglebone-tscadc.dts with following >> content: >>=20 >> /dts-v1/; >> /plugin/; >>=20 >> / { >> compatible =3D "ti,am335x-bone-green", "ti,am335x-bone-black", = "ti,am335x-bone", "ti,am33xx"; >>=20 >> fragment@0 { >> target =3D <&tscadc>; >> __overlay__ { >> status =3D "okay"; >> adc { >> ti,adc-channels =3D <0 1 2 3 4 5 6>; >> }; >> }; >> }; >> }; >>=20 >> 2. Compile overlay: >> $ dtc -I dts -O dtb -o am335x-beaglebone-tscadc.dtbo = am335x-beaglebone-tscadc.dts >>=20 >> 3. Copy it to /boot/dtb/ directory on your BBB >>=20 >> 4. Enable overlay in /boot/loader.conf by adding following line: >>=20 >> fdt_overlays=3D"am335x-beaglebone-tscadc.dtbo" >>=20 >> --=20 >> gonzo >=20 > I guess that ADC uses pins that can be used for other purpose so they > didn't enabled it by default ? If it's not the case they should be > enable by default. AFAIK, the ADC pins are dedicated ones. See here: http://beagleboard.org/support/bone101 In every pinout scheme for the different programmable modes, the ADC = pins are shown invariably at the same positions.=20 > Note 1 : You need to use a recent dtc (i.e. the latest dtc imported in = HEAD) I use the latest one which came with the FreeBSD 12.0-CURRENT = (BEAGLEBONE) snapshot, and it works. > Note 2 : We really need to add some dtbo facility for people in the = buildkernel process. :-Q Best regards Rolf=