| 727 | | # clone repo |
| 728 | | git clone https://github.com/openthread/openthread |
| 729 | | cd openthread |
| 730 | | # build the spi-hdlc-adapter tool |
| 731 | | gcc tools/spi-hdlc-adapter/spi-hdlc-adapter.c -o spi-hdlc-adapter |
| 732 | | ./spi-hdlc-adapter -v /dev/spidev1.2 |
| 733 | | # FSA2_GPIO2 (GPIO4_24) is W_DISABLE2# used as BT_18_4_RST |
| 734 | | # FSA2_ALERT (GPIO4_4) is SPI_INT |
| 735 | | echo 120 > /sys/class/gpio/export |
| 736 | | echo 100 > /sys/class/gpio/export |
| 737 | | ./spi-hdlc-adapter --gpio-res=/sys/class/gpio/gpio120 --gpio-int=/sys/class/gpio/gpio100 --spi-align-allowance=16 -v /dev/spidev1.2 |
| 738 | | Cntl-C |
| 739 | | echo 120 > /sys/class/gpio/unexport |
| 740 | | echo 100 > /sys/class/gpio/unexport |
| 741 | | |
| 742 | | # build oc-cli |
| 743 | | apt-get --no-install-recommends install -y g++ lsb-release cmake ninja-build shellcheck |
| 744 | | # build POSIX CLI |
| 745 | | # FSA2_GPIO2 (GPIO4_24) is W_DISABLE2# used as BT_18_4_RST |
| 746 | | # FSA2_ALERT (GPIO4_4) is SPI_INT |
| 747 | | ./build/posix/src/posix/ot-cli -v -d3 'spinel+spi:///dev/spidev1.2?gpio-reset-device=/dev/gpiochip3&gpio-reset-line=24&gpio-int-device=/dev/gpiochip3&gpio-int-line=4&spi-mode=0&spi-speed=1000000&spi-reset-delay=0&spi-align-allowance=16' |
| 748 | | }}} |
| 749 | | |
| 750 | | device-tree for GW8201-A+GW7020+GW16FE0-A revision in FSA1 socket: |
| 751 | | {{{#!bash |
| | 727 | # clone the meta-nxp-connectivity layer which contains patches |
| | 728 | git clone https://github.com/nxp-imx/meta-nxp-connectivity.git |
| | 729 | cd meta-nxp-connectivity.git |
| | 730 | # clone openthread |
| | 731 | git clone https://github.com/openthread/openthread openthread-iwxxx |
| | 732 | cd openthread-iwxxx |
| | 733 | # checkout the base version that NXP's patches apply to |
| | 734 | git checkout d31bcee81230bd82764838c76c9f291ba64814dd |
| | 735 | # apply NXP patches |
| | 736 | for file in ../meta-nxp-openthread/recipes-openthread/openthread-iwxxx/files/otpatches-082-d31bcee/*.patch; do git apply "$file"; done |
| | 737 | # download required toolchains |
| | 738 | ./script/bootstrap |
| | 739 | # build |
| | 740 | ./script/cmake-build posix ./script/cmake-build posix \ |
| | 741 | -DOT_APP_CLI=ON \ |
| | 742 | -DOT_APP_NCP=OFF \ |
| | 743 | -DOT_DAEMON=ON \ |
| | 744 | -DOT_FTD=ON \ |
| | 745 | -DOT_POSIX_RCP_SPI_BUS=ON |
| | 746 | ls ./build/posix/src/posix/ |
| | 747 | # run the ot daemon |
| | 748 | ./meta-nxp-connectivity/openthread-iwxxx/build/posix/src/posix/ot-daemon -v -d7 'spinel+spi:///dev/spidev1.1?gpio-reset-device=/dev/gpiochip3&gpio-reset-line=24&gpio-int-device=/dev/gpiochip3&gpio-int-line=4&spi-mode=0&spi-speed=10000000&spi-reset-delay=500&spi-align-allowance=16&gpio-int-active-low=1&spi-cs-delay-us=10' |
| | 749 | # check status (shows GPIO's being used and interrupts) |
| | 750 | grep THREAD /sys/kernel/debug/gpio /proc/interrupts |
| | 751 | # in another thread use ot-ctl to communicate with the daemon |
| | 752 | ./meta-nxp-connectivity/openthread-iwxxx/build/posix/src/posix/ot-ctl version |
| | 753 | }}} |
| | 754 | * note the GPIO device and line number must be specified on in the URL for the spinel over SPI userspace driver. These GPIO's can very from board to board and socket to socket. |
| | 755 | |
| | 756 | device-tree overlays: |
| | 757 | * GW8101 + GW16FE0 in FSA1: |
| | 758 | {{{#!bash |
| | 759 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| | 760 | /* |
| | 761 | * Copyright 2026 Gateworks Corporation |
| | 762 | * |
| | 763 | * The u-blox MAYA M.2 on a GW16FE0 FSA to M.2 E-Key adapter on a GW81xx-2x: |
| | 764 | * - GPIO1_IO13__GPIO1_IO13 FSA1_GPIO1 W_DISABLE1# PD# (input to Maya) |
| | 765 | * - SAI2_TXFS__GPIO4_IO24 FSA1_GPIO2 W_DISABLE2# BT_15.4_RST (input to May |
| | 766 | a) |
| | 767 | * - GPIO1_IO04__GPIO1_IO04 FSA1_GPIO3 N/C |
| | 768 | * - SAI1_RXD2__GPIO4_IO04 FSA1_GPIO4 ALERT# / SPI_INT# (output from Maya) |
| | 769 | * - UART3 (4-wire) used for Bluetooth |
| | 770 | * - SDHC1 4-bit SDIO used for WiFi (up to SDR104 with 208MHz clock) |
| | 771 | * - SPI2 used for 802.15.4 Thread radio |
| | 772 | * - I2C3 has io-expander with some outputs to enable SPI |
| | 773 | * |
| | 774 | */ |
| | 775 | |
| | 776 | #include <dt-bindings/gpio/gpio.h> |
| | 777 | |
| | 778 | #include <dt-bindings/clock/imx8mp-clock.h> |
| | 779 | #include "imx8mp-pinfunc.h" |
| | 780 | |
| | 781 | /dts-v1/; |
| | 782 | /plugin/; |
| | 783 | |
| 754 | | pinctrl-names = "default"; |
| 755 | | pinctrl-0 = <&pinctrl_uart3>; |
| 756 | | /* reparent clock for up to 4mbd support */ |
| 757 | | assigned-clocks = <&clk IMX8MP_CLK_UART3>; |
| 758 | | assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>; |
| 759 | | uart-has-rtscts; |
| 760 | | status = "okay"; |
| 761 | | |
| 762 | | bluetooth { |
| 763 | | compatible = "nxp,88w8987-bt"; |
| 764 | | fw-init-baudrate = <3000000>; |
| 765 | | }; |
| | 786 | pinctrl-names = "default"; |
| | 787 | pinctrl-0 = <&pinctrl_uart3>; |
| | 788 | /* reparent clock for up to 4mbd support */ |
| | 789 | assigned-clocks = <&clk IMX8MP_CLK_UART3>; |
| | 790 | assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>; |
| | 791 | uart-has-rtscts; |
| | 792 | status = "okay"; |
| | 793 | |
| | 794 | bluetooth { |
| | 795 | compatible = "nxp,88w8987-bt"; |
| | 796 | fw-init-baudrate = <3000000>; |
| | 797 | }; |
| 802 | | |
| 803 | | wlanwake_hog { |
| | 845 | }; |
| | 846 | }; |
| | 847 | |
| | 848 | &iomuxc { |
| | 849 | pinctrl_fsa1_spi: fsa1spigrp { |
| | 850 | fsl,pins = < |
| | 851 | MX8MP_IOMUXC_GPIO1_IO13__GPIO1_IO13 0x146 |
| | 852 | MX8MP_IOMUXC_SAI2_TXFS__GPIO4_IO24 0x106 |
| | 853 | MX8MP_IOMUXC_SAI1_RXD2__GPIO4_IO04 0x146 |
| | 854 | >; |
| | 855 | }; |
| | 856 | |
| | 857 | pinctrl_uart3: uart3grp { |
| | 858 | fsl,pins = < |
| | 859 | MX8MP_IOMUXC_UART3_TXD__UART3_DCE_TX 0x140 |
| | 860 | MX8MP_IOMUXC_UART3_RXD__UART3_DCE_RX 0x140 |
| | 861 | MX8MP_IOMUXC_ECSPI1_MISO__UART3_DCE_CTS 0x140 |
| | 862 | MX8MP_IOMUXC_ECSPI1_SS0__UART3_DCE_RTS 0x140 |
| | 863 | >; |
| | 864 | }; |
| | 865 | }; |
| | 866 | }}} |
| | 867 | * GW8201-A+GW7020+GW16FE0-A revision in FSA1 socket: |
| | 868 | {{{#!bash |
| | 869 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| | 870 | /* |
| | 871 | * Copyright 2026 Gateworks Corporation |
| | 872 | * |
| | 873 | * The u-blox MAYA M.2 on a GW16FE0 FSA to M.2 E-Key adapter on a GW82xx-2x: |
| | 874 | * - GPIO1_IO13__GPIO1_IO13 FSA1_GPIO1 W_DISABLE1# PD# (input to Maya) |
| | 875 | * - SAI2_TXFS__GPIO4_IO24 FSA1_GPIO2 W_DISABLE2# BT_15.4_RST (input to May |
| | 876 | a) |
| | 877 | * - GPIO1_IO04__GPIO1_IO04 FSA1_GPIO3 N/C |
| | 878 | * - SAI1_RXD2__GPIO4_IO04 FSA1_GPIO4 ALERT# / SPI_INT# (output from Maya) |
| | 879 | * - UART3 (4-wire) used for Bluetooth |
| | 880 | * - SDHC1 4-bit SDIO used for WiFi (up to SDR104 with 208MHz clock) |
| | 881 | * - SPI2 used for 802.15.4 Thread radio |
| | 882 | * - I2C3 has io-expander with some outputs to enable SPI |
| | 883 | * |
| | 884 | */ |
| | 885 | |
| | 886 | #include <dt-bindings/gpio/gpio.h> |
| | 887 | |
| | 888 | #include <dt-bindings/clock/imx8mp-clock.h> |
| | 889 | #include "imx8mp-pinfunc.h" |
| | 890 | |
| | 891 | /dts-v1/; |
| | 892 | /plugin/; |
| | 893 | |
| | 894 | /* Bluetooth */ |
| | 895 | &uart3 { |
| | 896 | pinctrl-names = "default"; |
| | 897 | pinctrl-0 = <&pinctrl_uart3>; |
| | 898 | /* reparent clock for up to 4mbd support */ |
| | 899 | assigned-clocks = <&clk IMX8MP_CLK_UART3>; |
| | 900 | assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>; |
| | 901 | uart-has-rtscts; |
| | 902 | status = "okay"; |
| | 903 | |
| | 904 | bluetooth { |
| | 905 | compatible = "nxp,88w8987-bt"; |
| | 906 | fw-init-baudrate = <3000000>; |
| | 907 | }; |
| | 908 | }; |
| | 909 | |
| | 910 | |
| | 911 | /* Thread */ |
| | 912 | &ecspi2 { |
| | 913 | #address-cells = <1>; |
| | 914 | #size-cells = <0>; |
| | 915 | |
| | 916 | /* ublox MAYA in FSA2 (CS2) */ |
| | 917 | spidev@2 { |
| | 918 | pinctrl-names = "default"; |
| | 919 | pinctrl-0 = <&pinctrl_fsa2_spi>; |
| | 920 | reg = <2>; |
| | 921 | compatible = "lwn,bk4"; |
| | 922 | spi-max-frequency = <25000000>; |
| | 923 | }; |
| | 924 | }; |
| | 925 | |
| | 926 | /* I2C port expander */ |
| | 927 | &fsa1 { |
| | 928 | #address-cells = <1>; |
| | 929 | #size-cells = <0>; |
| | 930 | |
| | 931 | gpio@21 { |
| | 932 | compatible = "nxp,pcal9554b"; |
| | 933 | reg = <0x21>; |
| | 934 | gpio-controller; |
| | 935 | #gpio-cells = <2>; |
| | 936 | gpio-line-names = |
| | 937 | "spien", "thread_rst#", "wake_wlan", "wake_btthread", |
| | 938 | "btthread_reset_in", "", "", "", ""; |
| | 939 | |
| | 940 | /* must be enabled for SPI */ |
| | 941 | spien_hog { |