| 40 | |
| 41 | == UART Information for GW73xx |
| 42 | |
| 43 | The UART3 (/dev/ttymxc2) on J10 on a GW73xx board is shared with the onboard Bluetooth module. |
| 44 | |
| 45 | This is defined in the device tree here: |
| 46 | [https://github.com/Gateworks/linux-venice/blob/v5.15.15-venice/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx.dtsi#L218] |
| 47 | |
| 48 | {{{ |
| 49 | /* bluetooth HCI */ |
| 50 | &uart3 { |
| 51 | pinctrl-names = "default"; |
| 52 | pinctrl-0 = <&pinctrl_uart3>, <&pinctrl_bten>; |
| 53 | cts-gpios = <&gpio5 8 GPIO_ACTIVE_LOW>; |
| 54 | rts-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>; |
| 55 | status = "okay"; |
| 56 | |
| 57 | bluetooth { |
| 58 | compatible = "brcm,bcm4330-bt"; |
| 59 | shutdown-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; |
| 60 | }; |
| 61 | }; |
| 62 | |
| 63 | }}} |
| 64 | |
| 65 | To understand this better, think of how it works: UART devices don't have any sort of magic device 'auto-detection' like enumerated busses such as PCI and USB do (which have a bus infrastructure to provide things like a class, manufacturer, and device ID). Therefore device-tree must be used to explain to the OS what is there and map it to a driver. This is what the 'compatible = "brcm,bcm4330-bt"' string does; there is a driver that matches that compatible string. |
| 66 | |
| 67 | It is possible to not see a /dev/ttymxc2 corresponding to schematic UART3 (NXP references hardware blocks as 1 based, Linux references them as 0 based) is indeed because the bluetooth HCI driver (hci_bcm) claims the UART such that Linux removes access from it to not conflict with it. The 'hci_bcm' driver won't fail to recognize the UART (ie if on a GW7300 which doesn't load that part) and remove it's claim on the device. Gateworks will not typically try to do things like removing that dynamically in the boot firmware via a dt fixup based on the model (because mapping model strings to what parts are loaded is a really bad idea). |
| 68 | |
| 69 | To remedy this, one can either comment out the 'bluetooth' node in the device-tree if using a custom kernel/dt or use a 'fix_fdt' script. |
| 70 | |
| 71 | - In Linux find the device path |
| 72 | {{{ |
| 73 | # find /proc/device-tree/ -name "bluetooth" |
| 74 | /proc/device-tree/soc@0/bus@30800000/spba-bus@30800000/serial@30880000/bluetooth |
| 75 | }}} |
| 76 | |
| 77 | - In U-Boot create a fixfdt script as documented on our wiki [http://trac.gateworks.com/wiki/linux/devicetree#fixfdtscript] |
| 78 | {{{ |
| 79 | u-boot=> setenv fixfdt 'fdt addr $fdt_addr_r; fdt resize; fdt set /soc@0/bus@30800000/spba-bus@30800000/serial@30880000/bluetooth status disabled' |
| 80 | }}} |
| 81 | |
| 82 | If the V2X support requires a kernel driver then it will need a device-tree binding of its own in which case one can use a dt overlay or customize the device tree. |