Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Sep 2020 21:26:13 +0400
From:      Alexander Mishin <mishin@mh.net.ru>
To:        freebsd-arm@freebsd.org
Subject:   Re: Re: Re: Re: Kmod driver at iicbus. attach() and config_intrhook(9)
Message-ID:  <9d8f10750ab66598400c7c71e9815dff@mh.net.ru>
In-Reply-To: <20200901221839.GY4213@funkthat.com>
References:  <20200901221839.GY4213@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
John-Mark Gurney писал 2020-09-02 02:18:
> Alexander Mishin wrote this message on Sat, Aug 22, 2020 at 00:59 
> +0400:
>> Ian Lepore ?????????? 2020-08-21 02:51:
>> > On Thu, 2020-08-20 at 15:39 -0700, John-Mark Gurney wrote:
>> > ...........
>> Just to dot the i's, my SoC is allwinner (Orange PI PC). And the issue
>> at boot time really showed itself up until config_intrhook was used.
>> FreeBSD myhost.mh.net.ru 13.0-CURRENT FreeBSD 13.0-CURRENT #3 r364004
> 
> Maybe I misread this thread, but this implied to me that the device had
> to do the config_intrhook work in order to work on the twsi i2c bus
> driver, is this not the case?

No.
Not the twsi i2c bus driver but my driver for i2c capable device 
(bh1750fvi ic).
When I load my driver from /boot/loader.conf it is impossible to write 
or to read from the ic at attach().
I do not checked if my driver loaded this manner can to exchange the 
data with the ic after the boot process is over (I belive it does)

> 
> Alexander Mishin wrote this message on Tue, Sep 01, 2020 at 19:21 
> +0400:
>> Andriy Gapon ?????????? 2020-09-01 09:51:
>> > On 01/09/2020 03:26, John-Mark Gurney wrote:
>> >> Ok, then the OP shouldn't be having a problem then, maybe you can help
>> >> then figure it out then?
>> >
>> > Was there actually any problem?
>> > I thought that OP was just inquiring about the pattern commonly seen
>> > in the code.
>> >
>> > Alexander Mishin wrote:
>> >> But I see that some other devices (from /usr/src/sys/dev) uses
>> >> CONFIG_INTRHOOK(9)
>> >> on attach() for initialize themselfs.
>> >> I wonder if I need this too? ...or maybe... when I might need it?
>> 
>> Yes, exactly. And I quite understood about using config_intrhook(9),
>> thank you all!
>> ...but still interesting to read if the need for this would be removed
>> for the twsi controller.
> 
> 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.
> 
> So, your driver does not need to do any config_intrhook magic to make
> it work.

When the driver is loading at boottime I need to use config_intrhook() 
to check if my ic is connected by sending data to it.
Then I decide continue (or stop) further initialization.
I just had no idea before that there is any difference when and how I 
load the kernel driver.

> 
> If you run across any other i2c bus controllers than need it, then that
> controller should be fixed.

I got an answer to my question.
Thanks.



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