Re: Kmod driver at iicbus. attach() and config_intrhook(9)
Alexander Mishin <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.arm |
|---|---|
| Message-ID | <[email protected]> |
Alexander Mishin писал 2020-09-04 10:00: > Ian Lepore писал 2020-09-03 18:48: >> On Thu, 2020-09-03 at 15:02 +0400, Alexander Mishin wrote: >>> Andriy Gapon писал 2020-09-03 11:29: >>> > On 02/09/2020 01:18, John-Mark Gurney wrote: >>> > > So my reading of the twsi driver is that it handles things correctly >>> > > allowing devices pre-interrupts to attach, and using interrupts for >>> > > transfers post-cold. >>> > >>> > I just want to note that twsi uses _completely_ different code for >>> > polled and >>> > interrupt modes. So, while either mode should be active at correct >>> > times, I >>> > cannot certify that the polled mode works correctly for all transfer >>> > types. >>> > I haven't reviewed the polled mode code. >>> >>> This adds some more light on my question. >>> >>> As a result: >>> For twsi I use iicbb_transfer() (as Emmanuel Vadot recommended to >>> someone on the mailing list). >>> It is definitely not works for my driver, until interrupts went >>> enabled. >>> But it works perfectly well with the config_intrhook(). >>> >>> I have never tried iicbus_write() at boot time yet, but I think I'll >>> try, just to know for the future. >>> >>> Thanks >>> >> All i2c slave drivers should be using iicbus_transfer_excl() or the >> iicdev_readfrom()/iicdev_writeto() helper functions. The only time to >> use iicbus_transfer() directly is when you need to conduct a dialog >> with one or more slaves using multiple transactions and it's important >> to keep the bus locked across the entire series of transactions for >> some reason (meaning you must handle the acquire/release bus stuff >> yourself). There is virtually never a reason to call the low-level >> start/stop/read/write functions directly. >> >> It's a pity that this stuff is so horribly documented. It has evolved >> extensively over the years, not always in good ways, and documentation >> and examples either don't exist or haven't kept up. >> >> Bottom line: if the twsi driver has the config_intrhook logic in it >> then your driver shouldn't need it. If you do need it, something is >> broken, either in your driver or in the twsi driver, and we should >> figure out what the real problem is. >> >> -- Ian > > Many, many thanks for such a portion of valuable information. > Went to look for examples in the kernel sources. > Yes! I found the iiconf.c with iicdev_(readto|writeto) and iicbus_transfer_excl definitions. "Well, now all ducks are ours!" Thanks once more _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-arm To unsubscribe, send any mail to "[email protected]"