Help, please, with getting a custom I2C real time clock module to load
Lee D
embaudarm at gmail.com
Mon Feb 26 16:27:40 UTC 2018
On Sun, Feb 25, 2018 at 12:23 PM, Ian Lepore <ian at freebsd.org> wrote:
> On Sun, 2018-02-25 at 09:48 -0500, Lee D wrote:
>> 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.
>
> Right here is where the disconnect is happening. It's the ofw_iicbus
> driver that needs to declared in the first DRIVER_MODULE() instead of
> iicbus, because ofw_iicbus is the one that knows to look in the fdt
> data for slave devices and add them as children of the bus. But, the
> extern declarations needed to do that didn't exist until I added them
> last week in r329526.
>
> What i2c drivers have been doing in the past, and the way to work
> around it in the 11.x code you're dealing with, is to leverage one of
> the DRIVER_MODULE() declarations that already exists in ofw_iicbus, by
> naming your driver "iichb" instead of "i2c". Like this:
>
> static driver_t i2c_driver = {
> "iichb",
> i2c_methods,
> sizeof(struct i2c_softc),
> };
>
> Or you could import r329526 into the kernel source you're using and
> rebuild the kernel. I do intend to MFC that change to 11-stable (in
> fact, I should probably do that today).
>
> When you've got these new drivers working, please consider putting them
> up for review at https://reviews.freebsd.org and we'll get them
> committed to freebsd.
>
> -- Ian
>
Thanks so much for the advice, I was able to get the RTC driver to
load using the iichb trick. I would be happy to contribute the code
assuming I can get it to work. I will probably move to 11.1 in the
near future.
Lee
More information about the freebsd-hackers
mailing list