Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Dec 2011 10:19:53 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Stefan Bethke <stb@lassitu.de>
Cc:        freebsd-embedded@FreeBSD.org
Subject:   Re: ar71xx_gpio.c touches SPI_CS1 and 2?
Message-ID:  <2B6F6CAC-F4EF-4958-A435-579A69862AE5@bsdimp.com>
In-Reply-To: <A78C6CC2-A6C9-42CC-B128-871C34C201CD@lassitu.de>
References:  <A78C6CC2-A6C9-42CC-B128-871C34C201CD@lassitu.de>

index | next in thread | previous in thread | raw e-mail


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



help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2B6F6CAC-F4EF-4958-A435-579A69862AE5>