From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott McNutt Date: Tue, 20 Apr 2010 12:19:38 -0400 Subject: [U-Boot] [PATCH] nios2: add gpio based status led driver In-Reply-To: <4BCDC2C1.3040801@wytron.com.tw> References: <1269665654-2609-1-git-send-email-thomas@wytron.com.tw> <4BCDA9E3.70904@psyent.com> <4BCDC2C1.3040801@wytron.com.tw> Message-ID: <4BCDD41A.5040206@psyent.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Thomas Chou wrote: > On 04/20/2010 09:19 PM, Scott McNutt wrote: >>> +void __led_init(led_id_t mask, int state) >>> +{ >>> + gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1); >> >> >> The direction register only exists when the PIO core hardware >> is configured in bidirectional mode. > >> If the PIO core hardware is configured in output-only mode, >> reading from data returns an undefined value. >> >> As I recall, the older designs configured the LED PIO ports >> as output only ... which is why board/altera/common/epled.c >> was coded in such a manner. >> > Hi Scott, > > This is not for Altera PIO interface. I followed the gpio interface of > Linux, linux-2.6/Documentation/gpio.txt, and created a trivial bit > addressing gpio core, I don't think the Altera board tree is an appropriate place for code that supports custom logic blocks. If an Altera distribution provided a design that included this custom block in one of their board designs then it would probably be fine. I'm not sure where this should go ... maybe in the driver tree? Regards, --Scott