From owner-freebsd-ppc@FreeBSD.ORG Tue May 25 20:42:14 2010 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53A92106568C for ; Tue, 25 May 2010 20:42:14 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 02B5B8FC30 for ; Tue, 25 May 2010 20:42:13 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-8-131.flashcable.ch [91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id o4PKgAnw079864; Tue, 25 May 2010 22:42:11 +0200 (CEST) (envelope-from andreast-list@fgznet.ch) Message-ID: <4BFC3622.50609@fgznet.ch> Date: Tue, 25 May 2010 22:42:10 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: FreeBSD PowerPC ML References: <4BF58342.7010707@fgznet.ch> <4BF58FF6.4050202@fgznet.ch> <4BF5991A.9090602@fgznet.ch> In-Reply-To: <4BF5991A.9090602@fgznet.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: Subject: Re: iic/i2c debugging on PowerMac X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 May 2010 20:42:14 -0000 On 20.05.10 22:18, Andreas Tobler wrote: > On 20.05.10 21:39, Andreas Tobler wrote: >> On 20.05.10 21:16, Rafal Jaworowski wrote: >>> >>> On 2010-05-20, at 20:45, Andreas Tobler wrote: >>> >>>> Hi, >>>> >>>> I'm trying to access (read/write) an i2c device on my G5. The >>>> problem is, I do not know the right i2c address although I have it >>>> from the device-tree, it's 0x15e. >>>> >>>> I read about the i2c utilitiy which requires the iic driver >>>> compiled into the kernel. Done that and it seems it is there: >>>> >>>> unin0 iichb0 pnpinfo name=i2c compat=keywest-i2c iicbus0 iic0 at >>>> addr=0 fcu0 pnpinfo name=fan compat=fcu at addr=0x15e >>>> >>>> But I do not have this device entry in /dev. Trying to create one >>>> does not work. mknod /dev/iic0 c 103 0 mknod: /dev/iic0: No such >>>> file or directory >>>> >>>> This is a netboot environment, might this be the cause of not being >>>> able to create the device? Or do I have another issue? >>> >>> This shouldn't be related to the boot method. >>> >>> Do you see any failure output during iic attach (there should be a >>> diag error)? If not try to intstrument the iic_probe() routine and >>> see what happens. >> >> unin0: on nexus0 >> unin0: Version 179 >> iichb0: mem 0xf8001000-0xf8001fff irq 42 on unin0 >> iichb0: [ITHREAD] >> iicbus0: on iichb0 >> iicbus0: iic identify >> iic0: iic probe failure >> iic0: addr: 0x8a >> iicbus0: at addr 0 >> iic1: iic probe failure >> iic1: addr: 0x8a >> >> The same on this one: >> >> iichb1: mem 0x18000-0x18fff irq 282 on macio0 >> iichb1: [ITHREAD] >> iicbus1: on iichb1 >> iicbus1: iic identify >> iic1: iic probe failure >> iic1: addr: 0x8a >> iicbus1: at addr 0 >> >> Hm, I suspect that either the kiic has an issue or the iicbus_get_addr >> function is not working properly. > > Ok. I forced the iic_probe to accept the first device: > > iicbus0: on iichb0 > iicbus0: iic identify > iic0: on iicbus0 > > Fine. > > [andreast@bohrium] /home/andreast/> i2c -s -v > dev: /dev/iic0, addr: 0x0, r/w: r, offset: 0x00, width: 8, count: 1 > Error scanning I2C controller (/dev/iic0): Device not configured > > Hm. Going back upstairs, where is the iicbus_get_addr function > implemented/defined? > > I'm lost in this area since a few days and I do not know if I opened a > can of worms here. IOW, my thinking is ok, but I rely on things which do > not work. (kiic, iic, iicbus?) > > Thanks for any hints! Ok, no hints so far. My original issue happens on the ppc64 tree. Now I switched to -CURRENT and I see the same behavior on my G4 powerbook. I added the iic driver and I can attach it but when I try to 'access' it I get the same message: [andreast@wolfram] /home/andreast/> i2c -s Error scanning I2C controller (/dev/iic0): Device not configured Scanning I2C devices on /dev/iic0: The device is _here_: [andreast@wolfram] /home/andreast/> ll /dev/iic0 crw------- 1 root wheel 0, 48 May 25 22:18 /dev/iic0 And the snippet from the dmesg looks like this: iichb0: mem 0x18000-0x18fff irq 26 on macio0 iichb0: [ITHREAD] iicbus0: on iichb0 iic0: on iicbus0 I have no mods on the iic.c. Do I do something completely wrong? Or something else? As said, thanks for any hints. Andreas