Nanopi Neo I2C

lyd mc alydiomc at yahoo.com
Sat Aug 11 16:46:24 UTC 2018


 
Thanks Danny and Ian!
Regards,Alyd
    On Saturday, August 11, 2018, 11:50:37 PM GMT+8, Daniel Braniss <danny at cs.huji.ac.il> wrote:  
 
 

> On 11 Aug 2018, at 18:21, lyd mc via freebsd-arm <freebsd-arm at freebsd.org> wrote:
> 
> Hi Ian,
> The iic bus seem to be working on linux image. I can detect the device at 0x18.
> root at nanopi-neo:~/prog/I2C #  i2c -f /dev/iic0 -s
> Hardware may not support START/STOP scanning; trying less-reliable read method.
> Scanning I2C devices on /dev/iic0: <none found>
> 
> some kdump output of above command:  871 i2c      CALL  ioctl(0x3,I2CRSTCARD,0xbfbfec64)
>    871 i2c      RET  ioctl 0
>    871 i2c      CALL  ioctl(0x3,I2CSTART,0xbfbfec64)
>    871 i2c      RET  ioctl -1 errno 2 No such file or directory
>    871 i2c      CALL  ioctl(0x3,I2CSTOP,0xbfbfec64)
>    871 i2c      RET  ioctl 0
> .<snip>  871 i2c      CALL  ioctl(0x3,I2CRSTCARD,0xbfbfec64)
>    871 i2c      RET  ioctl 0
>    871 i2c      CALL  ioctl(0x3,I2CRDWR,0xbfbfec50)
>    871 i2c      RET  ioctl -1 errno 2 No such file or directory
>    871 i2c      CALL  ioctl(0x3,I2CRSTCARD,0xbfbfec64)
>    871 i2c      RET  ioctl 0
>    871 i2c      CALL  ioctl(0x3,I2CRDWR,0xbfbfec50)
>    871 i2c      RET  ioctl -1 errno 2 No such file or directory
> Seems I2CRSTCARD and I2CSTOP are the only working ioctl on me.
> I activated i2c0 using below dts code:
>                i2c at 1c2ac00 {
> 
>                        compatible = "allwinner,sun6i-a31-i2c";
>                        reg = <0x1c2ac00 0x400>;
>                        interrupts = <0x0 0x6 0x4>;
>                        clocks = <0x1d 0x3b>;
>                        resets = <0x1d 0x2e>;
>                        pinctrl-names = "default";
>                        pinctrl-0 = <0x20>;
>                        status = "okay";
>                        #address-cells = <0x1>;
>                        #size-cells = <0x0>;
>                        phandle = <0x41>;
> 
> 
> Regards,Alyd
>    On Saturday, August 11, 2018, 11:04:54 PM GMT+8, Ian Lepore <ian at freebsd.org> wrote:  
> 
> On Sat, 2018-08-11 at 11:49 +0000, lyd mc via freebsd-arm wrote:
>> Hi List,
>> Can you help me make I2C work in this board?
>> I can detect the controller but cannot access it through iic ioctl. 
>> 
>> root at nanopi-neo:~/prog/I2C # dmesg |grep iic
>> iichb0: <Allwinner Integrated I2C Bus Controller> mem 0x1c2ac00-
>> 0x1c2afff irq 34 on simplebus0
>> iicbus0: <OFW I2C bus> on iichb0
>> iichb1: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b000-
>> 0x1c2b3ff irq 35 on simplebus0
>> iicbus1: <OFW I2C bus> on iichb1
>> iichb2: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b400-
>> 0x1c2b7ff irq 36 on simplebus0
>> iicbus2: <OFW I2C bus> on iichb2
>> iic0: <I2C generic I/O> on iicbus0
>> iic1: <I2C generic I/O> on iicbus1
>> iic2: <I2C generic I/O> on iicbus2
>> 
>> kdump output:
>> 
>>  1290 mcp      NAMI  "/dev/iic0"
>>  1290 mcp      RET  openat 3
>>  1290 mcp      CALL  ioctl(0x3,I2CRDWR,0xbfbfecd4)
>>  1290 mcp      RET  ioctl -1 errno 2 No such file or directory
>> 
>> This seems to work on my RPI.
>> 
> 
> In this case, I wonder if the "errno 2" is not ENOENT, but
> rather IIC_ENOACK which has not been translated to a proper errno
> before returning. IIC_ENOACK is basically a timeout and can happen if
> the slave address is wrong, or if the pinmux is wrong so that the bus
> is electrically inactive.
> 
> Is the bus working in general? Do any devices show up on a scan with
> 
>  i2c -f /dev/iic0 -s
> 
> -- Ian
> 

the driver has timing issues (among others :-). I’m cc’ing the guys I got a ‘working’  twsi stuff 
to see if I can pass it on.

danny
  


More information about the freebsd-arm mailing list