From owner-freebsd-arm@freebsd.org Thu Aug 16 12:42:42 2018 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 A843710581CC for ; Thu, 16 Aug 2018 12:42:42 +0000 (UTC) (envelope-from rj@obsigna.com) Received: from mail.cyclaero.de (ec2-18-195-62-44.eu-central-1.compute.amazonaws.com [18.195.62.44]) (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 434E07FEB1 for ; Thu, 16 Aug 2018 12:42:41 +0000 (UTC) (envelope-from rj@obsigna.com) Received: from mail.obsigna.com (unknown [191.182.171.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.cyclaero.de (Postfix) with ESMTPSA id DA5245E; Thu, 16 Aug 2018 14:42:33 +0200 (CEST) Received: from rolf.projectworld.net (rolf.projectworld.net [192.168.222.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id 64F551350F91D; Thu, 16 Aug 2018 09:42:29 -0300 (BRT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Beaglebone Black pinmuxing From: "Dr. Rolf Jansen" In-Reply-To: <13360A40-3381-4AF9-8EC5-C8E9B00CCABD@dons.net.au> Date: Thu, 16 Aug 2018 09:42:28 -0300 Content-Transfer-Encoding: quoted-printable Message-Id: <56756FA3-8FD7-44A4-A2D8-054E7C86744B@obsigna.com> References: <13360A40-3381-4AF9-8EC5-C8E9B00CCABD@dons.net.au> To: freebsd-arm X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Aug 2018 12:42:42 -0000 > Am 15.08.2018 um 23:56 schrieb O'Connor, Daniel : >=20 > Hi, > I have a BBB with a GPS engine attached to UART4 (P9_11 - UART4 Rx, = P9_13 - UART4 Tx) but I am having trouble communicating with it. >=20 > I have tried both an overlay and editing the main DTS file directly = but while the UART is probed and attached I can't see any data coming = in, nor see any go out (by putting a 'scope probe on P9_13 while sending = data out cuau2). >=20 > By my reading of the TRM and some googling P9_13 is gpmc_wait0 who's = pinmux offset is 0x870, P9_11 is gpmc_wpn, offset 0x874. The pinmuxes = get 0x800 subtracted from this (based on what is already in the DTS = file) >=20 > This is the overlay source.. > root@generic:/ # cat /boot/dtb/overlays/am335x-beaglebone-uart4a.dtso > /dts-v1/; > /plugin/; >=20 > / { > compatible =3D "ti,am335x-bone-black", "ti,am335x-bone", = "ti,am33xx"; >=20 > fragment@1 { > target =3D <&uart4>; > __overlay__ { > status =3D "okay"; > pinctrl-names =3D "default"; > pinctrl-0 =3D < > 0x074 0x06 // = gpmc_wpn.uart4_txd_mux2 -> mode 6 > 0x070 0x2e // = gpmc_wait0.uart4_rxd_mux2 -> mode 6 >> ; > }; > }; > }; >=20 > Compiled with.. > dtc -@ -I dts -O dtb -o am335x-beaglebone-uart4a.dtbo = am335x-beaglebone-uart4a.dtso > And I put this in loader.conf > fdt_overlays=3D"am335x-beaglebone-uart4a" Hello, Only recently I need to pass over all the very same obstacles as you = need to do now, in order to get a DAC-I2C module enabled and working on = my BBB. In my case, the curial point was to get the pinmuxing straight = and correctly linked to the respective I2C node. My BeableBone Black is = running on FreeBSD 12-ALPHA1. Note, there are major differences in the = DT between 11 and 12, and therefore depending on your FreeBSD version = the following hints may not fully apply. 1. The overlay needs 2 fragments, one for the pinmuxing node and another one for node which would use the pins 2. The overlay must contain a __local_fixups__ section, because this will let the dtbo loader to link the custom pinmux correctly to your customized node 3. I am almost sure, that MODE6 is incorrect in your case, however, I am ready to learn otherwise. I looked up the modes for my project in the Database of Pins of the bonescript project on GitHup (which is maintained by one of the BBB developers): https://github.com/jadonk/bonescript/ P9_13 starts on line 1271 of the bone.js file: https://github.com/jadonk/bonescript/blob/master/src/bone.js#L1271 P9_11 starts on line 1226 of the bone.js file: https://github.com/jadonk/bonescript/blob/master/src/bone.js#L1226 AFAIK, the field options contains the array of pinmux modes, starting at 0. MODE6 is NA in the case of P9_13 and urat4_rxd in the case of P9_11. You said, you need gpmc_wpn and gpmc_wait0 respectively, and this would be MODE0 for both pins. 4. In order to find out the input/output flags, I consulted the file: = https://svnweb.freebsd.org/base/head/sys/gnu/dts/include/dt-bindings/pinct= rl/am33xx.h?view=3Dco Now, I guess, that P9_13 would be simply PIN_OUTPUT, which means flag = 0x00, and P19_11 would be PIN_INPUT =3D =3D (INPUT_EN | PULL_DISABLE) =3D =3D ((1 << 5)| (1 << 3)) =3D 0x28 Said all this, I suggest to try the following overlay - note, I am = definitely not the authoritative expert: /dts-v1/; /plugin/; / { compatible =3D "ti,am335x-bone-black", "ti,am335x-bone", = "ti,am33xx"; exclusive-use =3D "P9.11","P9.13","uart4"; fragment@0 { target =3D <&am33xx_pinmux>; __overlay__ { gpmc_uart4_pins: pinmux_gpmc_uart4_pins { pinctrl-single,pins =3D < 0x74 0x00 /* UART4_TXD, = PIN_OUTPUT | MODE0 */ 0x70 0x28 /* UART4_RXD, = PIN_INPUT | MODE0 */ >; }; }; }; fragment@1 { target =3D <&uart4>; __overlay__ { status =3D "okay"; pinctrl-names =3D "default"; pinctrl-0 =3D <&gpmc_uart4_pins>; }; }; __local_fixups__ { fragment@1 { __overlay__ { pinctrl-0 =3D <0x0>; }; }; }; }; Best regards Rolf=