From owner-freebsd-embedded@FreeBSD.ORG Mon Nov 28 23:38:07 2011 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFB47106564A for ; Mon, 28 Nov 2011 23:38:07 +0000 (UTC) (envelope-from stb@lassitu.de) Received: from gilb.zs64.net (gilb.zs64.net [IPv6:2001:470:1f0b:105e::1ea]) by mx1.freebsd.org (Postfix) with ESMTP id 983918FC0C for ; Mon, 28 Nov 2011 23:38:07 +0000 (UTC) Received: by gilb.zs64.net (Postfix, from stb@lassitu.de) id 7DD57113DDD for ; Tue, 29 Nov 2011 00:38:06 +0100 (CET) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Apple Message framework v1251.1) From: Stefan Bethke In-Reply-To: <3B3DB17D-BF87-40EE-B1C1-445F178E8844@lassitu.de> Date: Tue, 29 Nov 2011 00:38:05 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <5483EFA1-9D7B-4EE6-B888-F024BD1FF3A5@lassitu.de> References: <68ABED76-CB1F-405A-8036-EC254F7511FA@lassitu.de> <3B3DB17D-BF87-40EE-B1C1-445F178E8844@lassitu.de> To: freebsd-embedded@freebsd.org X-Mailer: Apple Mail (2.1251.1) Subject: Re: TL-WR1043: switch X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2011 23:38:07 -0000 Am 28.11.2011 um 23:29 schrieb Stefan Bethke: > Am 28.11.2011 um 23:18 schrieb Stefan Bethke: >=20 >> So with the GPIOs working, the next step would be to attach a = bit-banging I2C device to GPIO 18 and 19. My kernel foo is probably not = up to creating the appropriate newbus attachment myself. Anybody want = to give me a hint? I'd start by copying lpbb, replacing the parallel = port code with appropirate gpio calls. >>=20 >> I haven't taken a detailed look at the OpenWrt code, but the = datasheet for the RTL8366 can be googled, including a full register map = and a description of the VLAN configuration (which I'm most interested = in). With a working I2C bus, that shouldn't be too hard, I'd think. >=20 > Further looking around, we already have dev/gpio/gpioiic.c. I'll see = if I can get it to attach. With gpioiic and these hints: hint.gpioiic.0.at=3D"gpiobus0" hint.gpioiic.0.pins=3D0xc0000 I'm getting this: gpio0: [GIANT-LOCKED] gpioc0: on gpio0 gpiobus0: on gpio0 gpioled0: at pin(s) 1 on gpiobus0 gpioled1: at pin(s) 2 on gpiobus0 gpioled2: at pin(s) 5 on gpiobus0 gpioled3: at pin(s) 9 on gpiobus0 gpioiic0: at pin(s) 18-19 on gpiobus0 iicbb0: on gpioiic0 iicbus0: on iicbb0 master-only iic0: on iicbus0 =85 # i2c -a 4 -d r -c 2 error sending stop condtion ioctl: error sending start condition#=20 # i2c -r panic: rb_cpldbus: cannot serialize the access to device. KDB: enter: panic [ thread pid 753 tid 100043 ] Stopped at kdb_enter+0x4c: lui at,0x8054 db>=20 The panic comes from gpiobus.c Also, gpioiic.c assumes that SCL is pin 0 and SDA is pin 1. Are pins = addressed relative to the child device, or are the pin numbers absolute = wrt the actual gpio device? Stefan --=20 Stefan Bethke Fon +49 151 14070811