2021-05-23 07:56 AM
Hello on my kernel module my probe funtion gets not called.
static const struct of_device_id stm32_match[] = {
{ .compatible = "st,stm32-uart", .data = &stm32f4_info},
{ .compatible = "st,stm32f7-uart", .data = &stm32f7_info},
{ .compatible = "st,stm32h7-uart", .data = &stm32h7_info},
{ .compatible = "st,stm32_usart_net",},
{},
};
static int stm_uart_probe(struct serdev_device *serdev)
{
printk("<1>Hello world 1.\n");
}
static void stm_uart_remove(struct serdev_device *serdev)
{
printk("<2>Bye world 2.\n");
}
static struct serdev_device_driver qca_uart_driver = {
.probe = stm_uart_probe,
.remove = stm_uart_remove,
.driver = {
.name = QCAUART_DRV_NAME,
.of_match_table = of_match_ptr(stm32_match),
},
};
module_serdev_device_driver(qca_uart_driver);
in my kernel log i can not find my my log. I presentation for the bluetooth example so i changed my device tree like this:
&usart3 {
compatible = "st,stm32-uart", "st,stm32f7-uart", "st,stm32h7-uart";
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart3_pins_b>;
pinctrl-1 = <&usart3_sleep_pins_b>;
pinctrl-2 = <&usart3_idle_pins_b>;
uart-has-rtscts;
status = "okay";
ethernet {
compatible = "st,stm32_usart_net";
local-mac-address = [ AB AB AB AB AB AB ];
current-speed = <10000000u>;
};
};
The orriginal configuration with let the usart show up as character device looked like this:
&usart3 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart3_pins_b>;
pinctrl-1 = <&usart3_sleep_pins_b>;
pinctrl-2 = <&usart3_idle_pins_b>;
uart-has-rtscts;
status = "okay";
};
Now my device will not be loaded as Character device and on the directories it shows up like this: /sys/devices/platform/soc/4000f000.serial
But thers no HCI Device. I orientated myself on this side https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/net/qca,qca7000.txt
I also kreated a Kconfig
config ST32_UART
tristate "STM32 UART support"
select usartNet
depends on SERIAL_DEV_BUS && OF
help
This UART protocol driver supports the STM32 Usart.
Currently the driver assumes these device UART settings:
Data bits: 8
Parity: None
Stop bits: 1
Flow control: None
To compile this driver as a module, choose M here. The module
will be called qcauart.
My Makefile
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /opt/st/stm32mp1/3.1-openstlinux-5.4-dunfell-mp1-20-11-12/stm32mp1-openstlinux-5-4-dunfell-mp1-20-11-12/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.4.56-r0/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules clean
else
obj-$(ST32_UART) += usartNet.o
obj-m := usartNet.o
endif
i build the module just by calling make. Then i insert it with insmod. But i do not get any logs.
And in the arch/arm64/configs/defconfig
i added
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y