TL-WR1043: switch
Stefan Bethke
stb at lassitu.de
Mon Nov 28 23:38:07 UTC 2011
Am 28.11.2011 um 23:29 schrieb Stefan Bethke:
> Am 28.11.2011 um 23:18 schrieb Stefan Bethke:
>
>> 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.
>>
>> 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.
>
> 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="gpiobus0"
hint.gpioiic.0.pins=0xc0000
I'm getting this:
gpio0: [GIANT-LOCKED]
gpioc0: <GPIO controller> on gpio0
gpiobus0: <GPIO bus> on gpio0
gpioled0: <GPIO led> at pin(s) 1 on gpiobus0
gpioled1: <GPIO led> at pin(s) 2 on gpiobus0
gpioled2: <GPIO led> at pin(s) 5 on gpiobus0
gpioled3: <GPIO led> at pin(s) 9 on gpiobus0
gpioiic0: <GPIO I2C bit-banging driver> at pin(s) 18-19 on gpiobus0
iicbb0: <I2C bit-banging driver> on gpioiic0
iicbus0: <Philips I2C bus> on iicbb0 master-only
iic0: <I2C generic I/O> on iicbus0
…
# i2c -a 4 -d r -c 2
error sending stop condtion
ioctl: error sending start condition#
# 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>
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
--
Stefan Bethke <stb at lassitu.de> Fon +49 151 14070811
More information about the freebsd-embedded
mailing list