DIR-825B1 iicbus thing

Luiz Otavio O Souza lists.br at gmail.com
Sat Sep 7 17:31:19 UTC 2013


On 7 September 2013 14:06, Sean Bruno <sean_bruno at yahoo.com> wrote:

> On Sat, 2013-09-07 at 10:02 -0700, Sean Bruno wrote:
> > > Humm and 0x00a0 also seems wrong for DIR825:
> > > +# Pin 5  - WPS (LED blue)     --> works
> > > +# Pin 6  - RTL8366RB switch data line
> > > +# Pin 7  - Planet (LED orange)--> works
> > > +# Pin 8  - RTL8366RB switch clock line
> > >  If i'm not mistaken the correct mask is 0x140 (for pin 6 and pin 8)
> > > and then set the correct pin index for sda and scl.
> > >
> > >
> >
> > I don't come up with 0x140 for bit 6 and bit 8 being set, I get 0xa0.
> > setting 0x140 would enable bit 7 and 9.  Right?
> >
> > Sean
>
> Yeah, its 0x0a here.  If I set 0x140 I conflict with pin 7:
>
> gpio0: <Atheros AR71XX GPIO driver> on apb0
> gpio0: [GIANT-LOCKED]
> gpio0: function_set: 0x0
> gpio0: function_clear: 0x0
> gpio0: gpio pinmask=0x9ff
> gpioc0: <GPIO controller> on gpio0
> gpiobus0: <GPIO bus> on gpio0
> gpioiic0: warning: pin 6 is already mapped
> gpioled0: <GPIO led> at pin(s) 0 on gpiobus0
> gpioled1: <GPIO led> at pin(s) 1 on gpiobus0
> gpioled2: <GPIO led> at pin(s) 2 on gpiobus0
> gpioled3: <GPIO led> at pin(s) 4 on gpiobus0
> gpioled4: <GPIO led> at pin(s) 6 on gpiobus0
> gpioled5: <GPIO led> at pin(s) 11 on gpiobus0
>
>

Right, the GPIO pins start at 0, the pins 6 and 8 used by switch are
actually the pins 5 and 7.

But when it comes to specifying pin masks you always need to think as pin +
1 to cover the pin 0 case which is going to be represented by the first bit
(or simply, pinmask == 1 << pin).

For your case you need a mask which covers pins (1 << 5) | (1 << 7) ==
0xa0. So yes, your pinmask is correct, sorry for the confusion.

Luiz


More information about the freebsd-embedded mailing list