Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2018 10:57:10 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        gljennjohn@gmail.com, Lee D <embaudarm@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Help, please, with getting a custom I2C real time clock module to load
Message-ID:  <1519581430.91697.258.camel@freebsd.org>
In-Reply-To: <20180225184220.748e9d59@ernst.home>
References:  <CANC_bnOe1-%2BBQocKfNraJuq4UjbYe=ita=0qsy65EVMdhGQDLQ@mail.gmail.com> <20180225184220.748e9d59@ernst.home>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2018-02-25 at 18:42 +0100, Gary Jennejohn wrote:
> On Sun, 25 Feb 2018 09:48:58 -0500
> Lee D <embaudarm@gmail.com> 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.
> > 
> > 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);
> > 
> This should give you a clue:
> 
> grep DRIVER_MODULE /sys/dev/iicbus/iic.c
> DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, 0, 0);
> 

Nope, not applicable.  Lee's problem was due to not getting ofw_iicbus
connected to his new host controller driver so that the children of
iicbus would get enumerated.  iic.c is not an i2c host controller whose
child is an iicbus, it is itself a child of iicbus.

The real problem is that until last week it was impossible for an FDT-
based host controller driver to have the proper DRIVER_MODULE()
statement because some extern declarations were missing, and the way
existing drivers had been working around that was to set their name to
"iichb".

-- Ian

> grep DRIVER_MODULE /sys/dev/iicbus/rtc8583.c
> DRIVER_MODULE(rtc8583, iicbus, rtc8583_driver, rtc8583_devclass, NULL, NULL);
> 
> [snip]
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1519581430.91697.258.camel>