TL-WR1043: switch

Stefan Bethke stb at lassitu.de
Sat Dec 3 21:36:43 UTC 2011


Am 03.12.2011 um 16:47 schrieb Adrian Chadd:

> Hi,
> 
> Initial comments (yes, I broke my own rule..)
> 
> * Don't get rid of SCL_PIN / SDA_PIN: instead rename them to
> blah_PIN_DEFAULT, and use those defines instead of hardcoding 0 and 1.
> I have a "thing" for avoiding hard-coded constants, and this makes it
> more obvious that those 0/1 values are pins rather than true/false.
> * We should break this out into separate diffs - let's focus right now
> on fixing/extending the i2c bus code to work with the "strict" flag
> you've introduced.  The rest of the diff is GPIO stuff. That way we
> can commit it in two parts.

http://www.lassitu.de/freebsd/iicbus-optional-relaxed-bus-semantics.patch

> Stuff to look at later:
> 
> * The gpio default stuff is fine (but luis has send me some alternate
> hint code to look at too!) - however, the capabilities are either in
> or out. What about pullup, pulldown, etc?

I'd be happy to review and test luis' code.

The code that I added does instantiate each pin with DEFAULT_CAPS (read and write), sets the name and sets the pin to either read or write.  From ar71xx_gpio.c and ar71xxreg.h it seems that these devices only support input and output and no other modes.

> * Is there any way to make that "configure GPIO from hint" function
> generic? Or should we worry about that later on? (eg so the rt305x CPU
> support from ray@ can also use this?)

sys/dev/gpio/gpiobus.c has no method to set the pin capabilities, only to report the ones the underlying device offers.  So every driver needs to do it's confuration itself.  The code itself certainly could be factored out.

> And my final question:
> 
> Does this actually now work for mainipulating the switch phy? If so:
> 
> * how does it work;

I have a userland program that can read and write switch registers (and PHY registers through that interface).  See below.

> * do we get per-physical-switch-port statistics somehow?

They're there, and the OpenWrt driver has code to read them.  I haven't gotten round to implement that.

> * how do I tinker with it next week when I'm over in Melbourne,
> talking about this stuff to a group of researchers that want to use
> the 1043nd? :)

http://www.lassitu.de/freebsd/rtl8366ctl.tbz

From the enclosed README:
> At this stage, the control program can talk to the switch, and
> - print out some configuration information;
> - print out some phy information;
> - read and write arbitrary switch registers;
> - read and write arbitrary phy registers.
> 
> Configuration actions are not implemented yet.

I'll try and whip up a command to configure VLANs.


Stefan

-- 
Stefan Bethke <stb at lassitu.de>   Fon +49 151 14070811





More information about the freebsd-embedded mailing list