Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2018 07:55:01 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        "Dr. Rolf Jansen" <rj@obsigna.com>, "Daniel O'Connor" <darius@dons.net.au>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: Beaglebone Black pinmuxing
Message-ID:  <CACNAnaE4d8i552jeGqYkBjxAeQNrodZ2WdN-D=Wv4q-UDWyKuQ@mail.gmail.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 16, 2018 at 7:42 AM, Dr. Rolf Jansen <rj@obsigna.com> wrote:
>> Am 15.08.2018 um 23:56 schrieb O'Connor, Daniel <darius@dons.net.au>:
>>
>> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaE4d8i552jeGqYkBjxAeQNrodZ2WdN-D=Wv4q-UDWyKuQ>