Reputation: 331
Cannot get the UART 1 or UART4 working on freeBSD Beaglebone
FreeBSD beaglebone 11.3-RELEASE FreeBSD
I did following changes to am335x-boneblack.dts. Here is a diff file.
freebsd@beaglebone:~/dtb % diff ./am335x-boneblack-original.dts ./am335x-boneblack.dts
814a815,841
> pinmux_uart1_pins {
> pinctrl-single,pins = <0x184 0x8 0x180 0x28>;
> linux,phandle = <0xF1>;
> phandle = <0xF1>;
> };
>
> pinmux_uart4_pins {
> pinctrl-single,pins = <0x74 0xe 0x70 0x2e>;
> linux,phandle = <0xF2>;
> phandle = <0xF2>;
> };
>
>
> pinmux_serial1_pins {
> pinctrl-single,pins = <0x180 0x20 0x184 0x0>;
> linux,phandle = <0xD1>;
> phandle = <0xD1>;
> };
>
>
> pinmux_serial4_pins {
> pinctrl-single,pins = <0x070 0x26 0x074 0x06>;
> linux,phandle = <0xD4>;
> phandle = <0xD4>;
> };
>
>
1192c1219
< status = "disabled";
---
> status = "okay";
1205c1232
< status = "disabled";
---
> status = "okay";
1218c1245,1247
< status = "disabled";
---
> status = "okay";
> dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
> dma-names = "tx", "rx";
1229c1258,1260
< status = "disabled";
---
> status = "okay";
> dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
> dma-names = "tx", "rx";
2231a2263,2264
> uart1_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_uart1_pins";
> uart4_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_uart4_pins";
Now I even can see UARTS beinbg loaded by kernel
freebsd@beaglebone:~/dtb % dmesg | grep uart
uart0: <TI UART (16550 compatible)> mem 0x44e09000-0x44e0afff irq 11 on simplebus0
uart0: console (115384,n,8,1)
uart1: <TI UART (16550 compatible)> mem 0x48022000-0x48023fff irq 12 on simplebus0
uart2: <TI UART (16550 compatible)> mem 0x48024000-0x48025fff irq 13 on simplebus0
uart3: <TI UART (16550 compatible)> mem 0x481a6000-0x481a7fff irq 14 on simplebus0
uart4: <TI UART (16550 compatible)> mem 0x481a8000-0x481a9fff irq 15 on simplebus0
But I cannot receive / send anything. I strapped RX - TX on UART 4 (P9-11 P9-13) I checked the pins with gpioctl, and tried to cat/echo but the pins are dead. They act as gpio's
root@beaglebone:/home/freebsd/dtb # gpioctl -lv | grep 31
pin 31: 0 gpio_31<>, caps:<IN,OUT,PU,PD,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN>
root@beaglebone:/home/freebsd/dtb # gpioctl -lv | grep 30
pin 30: 0 gpio_30<>, caps:<IN,OUT,PU,PD,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN>
root@beaglebone:/home/freebsd/dtb #
root@beaglebone:/home/freebsd # stty -f /dev/cuau4
speed 9600 baud;
lflags: echoe echoke echoctl
oflags: tab0
cflags: cs8 -parenb clocal
root@beaglebone:/home/freebsd # stty -f /dev/ttyu4
speed 9600 baud;
lflags: echoe echoke echoctl
oflags: tab0
cflags: cs8 -parenb
The utility gpioctl does not have a uart mode aka Linux. I t hac IN OUT OD PP TS PU PD II IO which are usles for my case.
# Linux way of moding
config-pin p9.11 uart
config-pin p9.13 uart
Thank you.
Upvotes: 2
Views: 334
Reputation: 331
The dts works on version 11. Version 12 and 13 Does not work for me. Here is the patch file that makes UART4 working.
reebsd@beaglebone:~/dtb % diff -u am335x-boneblack-original.dts.orig /boot/dtb/am335x-boneblack.dts
--- am335x-boneblack-original.dts.orig 2019-07-05 05:41:32.905063000 +0000
+++ /boot/dtb/am335x-boneblack.dts 2019-09-17 03:08:26.704636000 +0000
@@ -812,6 +812,15 @@
phandle = <0x2d>;
};
+
+ pinmux_uart4_pins {
+ pinctrl-single,pins = <0x070 0x2e 0x074 0x06>;
+ linux,phandle = <0xce>;
+ phandle = <0xce>;
+ };
+
+
+
pinmux_clkout2_pin {
pinctrl-single,pins = <0x1b4 0x3>;
linux,phandle = <0x20>;
@@ -1189,7 +1198,7 @@
clock-frequency = <0x2dc6c00>;
reg = <0x48022000 0x2000>;
interrupts = <0x49>;
- status = "disabled";
+ status = "okay";
dmas = <0x29 0x1c 0x0 0x29 0x1d 0x0>;
dma-names = "tx", "rx";
linux,phandle = <0x84>;
@@ -1202,7 +1211,7 @@
clock-frequency = <0x2dc6c00>;
reg = <0x48024000 0x2000>;
interrupts = <0x4a>;
- status = "disabled";
+ status = "okay";
dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
dma-names = "tx", "rx";
linux,phandle = <0x85>;
@@ -1215,9 +1224,13 @@
clock-frequency = <0x2dc6c00>;
reg = <0x481a6000 0x2000>;
interrupts = <0x2c>;
- status = "disabled";
+ status = "okay";
+ dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
+ dma-names = "tx", "rx";
linux,phandle = <0x86>;
phandle = <0x86>;
+ pinctrl-0 = <0xce>;
+ pinctrl-names = "default";
};
serial@481a8000 {
@@ -1226,9 +1239,13 @@
clock-frequency = <0x2dc6c00>;
reg = <0x481a8000 0x2000>;
interrupts = <0x2d>;
- status = "disabled";
+ status = "okay";
+ dmas = <0x29 0x1e 0x0 0x29 0x1f 0x0>;
+ dma-names = "tx", "rx";
linux,phandle = <0x87>;
phandle = <0x87>;
+ pinctrl-names = "default";
+ pinctrl-0 = <0xce>;
};
serial@481aa000 {
@@ -2229,6 +2246,7 @@
i2c0_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins";
i2c2_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins";
uart0_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_uart0_pins";
+ uart4_pins = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_uart4_pins";
clkout2_pin = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_clkout2_pin";
cpsw_default = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/cpsw_default";
cpsw_sleep = "/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/cpsw_sleep";
freebsd@beaglebone:~/dtb %
freebsd@beaglebone:~/dtb %
freebsd@beaglebone:~/dtb % uname -a
FreeBSD beaglebone 11.3-RELEASE FreeBSD 11.3-RELEASE #0 r349754: Fri Jul 5 03:41:31 UTC 2019 [email protected]:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE arm
freebsd@beaglebone:~/dtb %
Upvotes: 2