ar71xx_gpio.c touches SPI_CS1 and 2?

Warner Losh imp at bsdimp.com
Sun Dec 4 17:21:53 UTC 2011


On Dec 4, 2011, at 5:14 AM, Stefan Bethke wrote:

> I was looking into why I can't manipulate the USB led on my TL-WR1043ND, and came across the SPI chip selects, which share GPIO 0 and 1, respectively.  The USB led is hooked up to GPIO 1.
> 
> sys/mips/atheros/ar71xx_gpio.c:ar71xx_gpio_attach(device_t dev) enables both chip selects, and detach disables them again.
> 
> Two points:
> 
> - how can we express different uses for those two pins on a per-board config?
> 
> - disabling the function is not correct for the gpio driver, I would think.  If you load and unload it as a module, I expect losing access to the flash.

When I was looking into this question for the Atmel chips, I was torn.  On the one hand, it would be nice if there was a pin mux device.  On the other hand, it didn't map well into the device model.  I finally settled on having per-board functions that setup the pins.  This is also the model followed by linux.  Either the boot loader or the board-dependent code would do the setup.

Warner



More information about the freebsd-embedded mailing list