I would like to create a simple linux module for rt-linux.I am using am5749 (custom board) ti-processor-sdk-linux-rt-am57xx-evm-06.03.00.106.So...I'm trying to compile many examples.It doesn't work with rt-linux.The probe function is never called. I would like to understand why the probe function that is part of many drivers is not called in rt and how to solve it. I would like to remake several drivers to work with rt-linux.
Here is the code of my skeleton module:
#include <linux/init.h>#include <linux/kernel.h>#include <linux/module.h>#include <linux/slab.h>#include <linux/err.h>#include <linux/i2c.h>#include <linux/of_device.h>static const struct of_device_id Some_i2c_dt_id[] = { { .compatible = "ti,Some_i2c"}, { },};static int Some_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id){ printk("Module is probed\n");}static int Some_i2c_remove(struct i2c_client *client){}static const struct i2c_device_id Some_i2c_id[] = { { "Some_i2c", 0 }, { },};MODULE_DEVICE_TABLE(i2c, Some_i2c_id);static struct i2c_driver Some_i2c_driver = { .driver = { .name = "Some_i2c", .owner = THIS_MODULE, .of_match_table = Some_i2c_dt_id, }, .id_table = Some_i2c_id, .probe = Some_i2c_probe, .remove = Some_i2c_remove,};static int __init Some_i2c_init( void ) { printk("Module is started\n"); return i2c_add_driver(&Some_i2c_driver);}static void __exit Some_i2c_exit( void ) { i2c_del_driver(&Some_i2c_driver); printk("Module is stoped\n");}module_init( Some_i2c_init );module_exit( Some_i2c_exit );MODULE_AUTHOR("Someone");MODULE_DESCRIPTION("Some_i2c_Driver");MODULE_LICENSE("GPL v2");
Here is the Makefile:
obj-m = module.oKDIR := /SDK/ti-processor-sdk-linux-rt-am57xx-evm-06.03.00.106/board-support/linux-rt-4.19.94+gitAUTOINC+a242ccf3f1-ga242ccf3f1/all: make -C $(KDIR) M=$(shell pwd) modulesclean: make -C $(KDIR) M=$(shell pwd) clean
After probe the message "Module is probed" should be displayed. I got it in non-rt linux.