Help, please, with getting a custom I2C real time clock module to load
Lee D
embaudarm at gmail.com
Sun Feb 25 14:49:41 UTC 2018
Hi Everyone,
I have written a new I2C driver (for the Xilinx Zynq) and a new real
time clock chip driver (for the ST M41T82) to use with hardware on my
custom board. This is for 11.0.1.
The I2C driver works fine, but I can't seem to get my RTC driver to
load. The m41t82_probe() function is never even called.
Both are loaded with kldload at the moment.
I think the problem is something in DRIVER_MODULE macro that is
preventing the kernel from even trying to let it probe. One clue is
that if I change "iicbus" to "simplebus" in the DRIVER_MODULE macro
of the RTC, it will then at least call m41t82_probe().
It's like the kernel thinks that I have no iicbus driver and thus
won't even try to load the RTC module.
I have turned on "device iic" and "device iicbus" in my kernel config
file.
No messages are given when I try to load the m41t82 module. It just
silently loads and does nothing.
Here is a code snippet from my I2C driver:
------------------------------------------
static driver_t i2c_driver = {
"i2c",
i2c_methods,
sizeof(struct i2c_softc),
};
static devclass_t i2c_devclass;
DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0);
DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0);
And here is a code snippet from my RTC driver:
----------------------------------------------
static device_method_t m41t82_methods[] = {
DEVMETHOD(device_probe, m41t82_probe),
DEVMETHOD(device_attach, m41t82_attach),
DEVMETHOD(device_detach, m41t82_detach),
DEVMETHOD(clock_gettime, m41t82_gettime),
DEVMETHOD(clock_settime, m41t82_settime),
DEVMETHOD_END
};
static driver_t m41t82_driver = {
"m41t82",
m41t82_methods,
sizeof(struct m41t82_softc),
};
static devclass_t m41t82_devclass;
DRIVER_MODULE(m41t82, iicbus, m41t82_driver, m41t82_devclass, NULL, NULL);
MODULE_VERSION(m41t82, 1);
MODULE_DEPEND(m41t82, iicbus, 1, 1, 1);
This is the relevant portion of my DTS file:
--------------------------------------------
ps7io at e0000000 {
device_type = "soc";
compatible = "simple-bus";
#address-cells = <0x1>;
#size-cells = <0x1>;
ranges = <0x0 0xe0000000 0x300000>;
... Other hardware ...
i2c at 4000 {
compatible = "xlnx,zy7_i2c";
status = "okay";
reg = <0x4000 0x1000>;
#address-cells = <0x1>;
#size-cells = <0x0>;
rtc at d0 {
status = "okay";
compatible = "st,m41t82";
reg = <0xd0>;
};
};
};
Any clues about how to go about debugging this problem would be very
helpful.
Thanks,
Lee
More information about the freebsd-hackers
mailing list