Nanopi Neo I2C

lyd mc alydiomc at yahoo.com
Tue Aug 14 20:48:47 UTC 2018


> 
> 
> > 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.

 >What timing issue and "other issues" are you talking about ?

> danny
Hi Manu,
Thanks for dropping by! Can you help me address my issue?
I already recompiled the with:1. TARGET_ARCH=armv6 (same issue)2. Disabled some i2c modules (same issue)    # I2C support
     device          iicbus
     device          iic
     device          twsi
     #device         rsb                     # Allwinner Reduced Serial Bus
     #device         p2wi                    # Allwinner Push-Pull Two Wire
     #device         axp209                  # AXP209 Power Management Unit
     #device         axp81x                  # AXP813/818 Power Management Unit
     #device         bcm2835_bsc
     #device         fsliic                  # Freescale i2c/iic
     #device         icee                    # AT24Cxxx and compatible EEPROMs
     #device         sy8106a                 # SY8106A Buck Regulator
     #device         ti_i2c
     #device         am335x_pmic             # AM335x Power Management IC (TPC65217)
     #device         am335x_rtc              # RTC support (power management only)
     #device         twl                     # TI TWLX0X0/TPS659x0 Power Management
     #device         twl_vreg                # twl voltage regulation
     #device         twl_clks                # twl external clocks
 

Regards,Alyd

    On Sunday, August 12, 2018, 12:53:18 PM GMT+8, Emmanuel Vadot <manu at bidouilliste.com> wrote:  
 
 On Sat, 11 Aug 2018 18:50:18 +0300
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.

 What timing issue and "other issues" are you talking about ?

> danny
> 
> _______________________________________________
> freebsd-arm at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org"


-- 
Emmanuel Vadot <manu at bidouilliste.com> <manu at freebsd.org>  


More information about the freebsd-arm mailing list