From owner-freebsd-embedded@FreeBSD.ORG Sun Dec 4 17:21:53 2011 Return-Path: Delivered-To: freebsd-embedded@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A300106566C for ; Sun, 4 Dec 2011 17:21:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 117B38FC17 for ; Sun, 4 Dec 2011 17:21:52 +0000 (UTC) Received: from [10.0.0.150] (150.imp.bsdimp.com [10.0.0.150] (may be forged)) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id pB4HJtEs032243 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Sun, 4 Dec 2011 10:19:58 -0700 (MST) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Sun, 4 Dec 2011 10:19:53 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <2B6F6CAC-F4EF-4958-A435-579A69862AE5@bsdimp.com> References: To: Stefan Bethke X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Sun, 04 Dec 2011 10:19:58 -0700 (MST) Cc: freebsd-embedded@FreeBSD.org Subject: Re: ar71xx_gpio.c touches SPI_CS1 and 2? X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 17:21:53 -0000 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. >=20 > sys/mips/atheros/ar71xx_gpio.c:ar71xx_gpio_attach(device_t dev) = enables both chip selects, and detach disables them again. >=20 > Two points: >=20 > - how can we express different uses for those two pins on a per-board = config? >=20 > - 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