[RFC PATCH 0/2] Add serdev support for hci h4

Dominique Martinet
2022-11-08T06:11:10Z

Hello,

A couple of questions with this patch (hence status as RFC), first for
the dt bindings part:
- I have no idea what to do with the compatible name.
I am not affiliated with nxp (except as a customer), so I'm not entierly
comfortable just adding a new property in the nxp, namespace.
The h4 protocol is very generic and I'd think a name such as
'hci-h4,generic' make more sense as other boards would be able to
benefit from it without extra modifications... But that doesn't seem to
be how things are done with dt bindings, so can I just add an arbitrary
name?
- I've set Marcel (who maintains the hci_h4 driver) as maintainer of
he dt-bindings unilaterally without asking him for lack of a better
idea: Marcel, are you ok with that? My first idea was making it myself
but I don't really feel competent for this.

Second for the driver itself:
- I've just monkeyed the simplest serdev support I could come up with
and it appears to work (I'm trying to replace the following command:
btattach -B /dev/ttymxc0 -S 3000000 -P h4); perhaps there are other
settings you'd want?
I've also tried suspend and with no handler it appears to work with
an idle controller, but I'd assume we might want some pm handling at
some point if possible... Right now this is no worse than btattach,
but unlike btattach it's not easy to restart (unbind/bind the driver?)
so that might come up sooner or later; will be happy to look then.

I confirmed this works with the following dts fragment over
imx8mp.dtsi, on a board with the AW-XM458 NXP wireless+BT module.

--8<------
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
assigned-clocks = <&clk IMX8MP_CLK_UART1>;
assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
status = "okay";
fsl,dte-mode = <1>;
fsl,uart-has-rtscts;

bluetooth {
compatible = "nxp,aw-xm458-bt";
max-speed = <3000000>;
};
};

&iomuxc {
pinctrl_uart1: uart1grp {
fsl,pins = <
MX8MP_IOMUXC_UART1_RXD__UART1_DTE_TX 0x140
MX8MP_IOMUXC_UART1_TXD__UART1_DTE_RX 0x140
MX8MP_IOMUXC_UART3_RXD__UART1_DTE_RTS 0x140
MX8MP_IOMUXC_UART3_TXD__UART1_DTE_CTS 0x140
>;
};
}
--8<------

Dominique Martinet (2):
dt-bindings: net: h4-bluetooth: add new bindings for hci_h4
bluetooth/hci_h4: add serdev support

.../devicetree/bindings/net/h4-bluetooth.yaml | 49 ++++++++++++++
drivers/bluetooth/Kconfig | 1 +
drivers/bluetooth/hci_h4.c | 64 +++++++++++++++++++
3 files changed, 114 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/h4-bluetooth.yaml

--
2.35.1