From owner-freebsd-arm@freebsd.org Thu Aug 16 12:55:24 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 E00A810586E4 for ; Thu, 16 Aug 2018 12:55:23 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91D0E8059D for ; Thu, 16 Aug 2018 12:55:23 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 2E3C21D7FE for ; Thu, 16 Aug 2018 12:55:23 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lj1-f171.google.com with SMTP id r13-v6so3553008ljg.10 for ; Thu, 16 Aug 2018 05:55:23 -0700 (PDT) X-Gm-Message-State: AOUpUlE1ssPhRbWvSWeGbwJXp0yH8T87xxmozflxbO8LV8bTqqyBT+sB CRjrsgDO9su115eDw0j0VRInxC4Foya/KjCF3uU= X-Google-Smtp-Source: AA+uWPyLY8EwKiX3At80amLR+fvMG89fj1VwokAf7NWWcxkUX2vDzcXrVVHCm7yZEeWvO2oh2E+YEkSE8cinJBFs6Js= X-Received: by 2002:a2e:498:: with SMTP id a24-v6mr22044401ljf.27.1534424121672; Thu, 16 Aug 2018 05:55:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:5742:0:0:0:0:0 with HTTP; Thu, 16 Aug 2018 05:55:01 -0700 (PDT) In-Reply-To: <56756FA3-8FD7-44A4-A2D8-054E7C86744B@obsigna.com> References: <13360A40-3381-4AF9-8EC5-C8E9B00CCABD@dons.net.au> <56756FA3-8FD7-44A4-A2D8-054E7C86744B@obsigna.com> From: Kyle Evans Date: Thu, 16 Aug 2018 07:55:01 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Beaglebone Black pinmuxing To: "Dr. Rolf Jansen" , "Daniel O'Connor" Cc: freebsd-arm Content-Type: text/plain; charset="UTF-8" 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:55:24 -0000 On Thu, Aug 16, 2018 at 7:42 AM, Dr. Rolf Jansen wrote: >> Am 15.08.2018 um 23:56 schrieb O'Connor, Daniel : >> >> 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. >> >> 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). >> >> 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) >> >> This is the overlay source.. >> root@generic:/ # cat /boot/dtb/overlays/am335x-beaglebone-uart4a.dtso >> /dts-v1/; >> /plugin/; >> >> / { >> compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; >> >> fragment@1 { >> target = <&uart4>; >> __overlay__ { >> status = "okay"; >> pinctrl-names = "default"; >> pinctrl-0 = < >> 0x074 0x06 // gpmc_wpn.uart4_txd_mux2 -> mode 6 >> 0x070 0x2e // gpmc_wait0.uart4_rxd_mux2 -> mode 6 >>> ; >> }; >> }; >> }; >> [Puts on overlay police hat =)] The above corresponds to: /dts-v1/; /plugin/; / { compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; }; &uart4 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = < 0x074 0x06 // gpmc_wpn.uart4_txd_mux2 -> mode 6 0x070 0x2e // gpmc_wait0.uart4_rxd_mux2 -> mode 6 >; }; > Said all this, I suggest to try the following overlay - note, I am definitely not the authoritative expert: > > /dts-v1/; > /plugin/; > > / { > compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; > > exclusive-use = "P9.11","P9.13","uart4"; > > fragment@0 { > target = <&am33xx_pinmux>; > __overlay__ { > gpmc_uart4_pins: pinmux_gpmc_uart4_pins { > pinctrl-single,pins = < > 0x74 0x00 /* UART4_TXD, PIN_OUTPUT | MODE0 */ > 0x70 0x28 /* UART4_RXD, PIN_INPUT | MODE0 */ > >; > }; > }; > }; > > fragment@1 { > target = <&uart4>; > __overlay__ { > status = "okay"; > pinctrl-names = "default"; > pinctrl-0 = <&gpmc_uart4_pins>; > }; > }; > > __local_fixups__ { > fragment@1 { > __overlay__ { > pinctrl-0 = <0x0>; > }; > }; > }; > }; > This one would be: /dts-v1/; /plugin/; / { compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; exclusive-use = "P9.11","P9.13","uart4"; }; &am33xx_pinmux { gpmc_uart4_pins: pinmux_gpmc_uart4_pins { pinctrl-single,pins = < 0x74 0x00 /* UART4_TXD, PIN_OUTPUT | MODE0 */ 0x70 0x28 /* UART4_RXD, PIN_INPUT | MODE0 */ >; }; }; &uart4 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&gpmc_uart4_pins>; }; Both of the above to be compiled with dtc -@ if you're using /usr/bin/dtc on x86 until [1] gets pulled upstream (though I may commit it to FreeBSD earlier if it doesn't get pulled before the freeze). -@ may not be a bad idea if you're planning on slapping other overlays on top so that they may also do symbol resolution on the overlay. We support this syntax for overlays now, and I highly recommend using it -- it's a pretty great quality of life improvement over hand-crafting fragments. =) [Takes off overlay police hat] Thanks, Kyle Evans [1] https://github.com/davidchisnall/dtc/pull/46