"7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
Author: Ulf Samuelsson <[email protected]>
Date: 2007-03-27
Subject: "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
CHANGELOG:
[PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
Introduce a new command CFG_CMD_MUX 0x8000000000000000ULL
Patch generated from files:
board_at91rm9200dk_led.c.patch
board_at91rm9200dk_Makefile.patch
board_at91rm9200dk_mux.c.patch
common_soft_i2c.c.patch
include_cmd_confdefs.h.patch
include_configs_at91rm9200dk.h.patch
include_led.h.patch
Signed-off-by: Ulf Samuelsson---------------------------------------------------------------------------------------------------------------------------------
board/at91rm9200dk/led.c +81 -0
@@ -0,0 +1,81 @@ +/* +* (C) Copyright 2006 +* Atmel Nordic AB <www.atmel.com> +* Ulf Samuelsson <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <asm/arch/AT91RM9200.h> + +#define GREEN_LED AT91C_PIO_PB0 +#define YELLOW_LED AT91C_PIO_PB1 +#define RED_LED AT91C_PIO_PB2 + +void green_LED_on (void ) +{ +AT91PS_PIO PIOB =AT91C_BASE_PIOB ; +PIOB ->PIO_CODR =GREEN_LED ; +} + +void yellow_LED_on (void ) +{ +AT91PS_PIO PIOB =AT91C_BASE_PIOB ; +PIOB ->PIO_CODR =YELLOW_LED ; +} + +void red_LED_on (void ) +{ +AT91PS_PIO PIOB =AT91C_BASE_PIOB ; +PIOB ->PIO_CODR =RED_LED ; +} + +void green_LED_off (void ) +{ +AT91PS_PIO PIOB =AT91C_BASE_PIOB ; +PIOB ->PIO_SODR =GREEN_LED ; +} + +void yellow_LED_off (void ) +{ +AT91PS_PIO PIOB =AT91C_BASE_PIOB ; +PIOB ->PIO_SODR =YELLOW_LED ; +} + +void red_LED_off (void ) +{ +AT91PS_PIO PIOB =AT91C_BASE_PIOB ; +PIOB ->PIO_SODR =RED_LED ; +} + + +void LED_init (void ) +{ +DECLARE_GLOBAL_DATA_PTR ; +AT91PS_PIO PIOB =AT91C_BASE_PIOB ; +AT91PS_PMC PMC =AT91C_BASE_PMC ; +PMC ->PMC_PCER = (1 <<AT91C_ID_PIOB );/* Enable PIOB clock */ +/* Disable peripherals on LEDs */ +PIOB ->PIO_PER =AT91C_PIO_PB2 |AT91C_PIO_PB1 |AT91C_PIO_PB0 ; +/* Enable pins as outputs */ +PIOB ->PIO_OER =AT91C_PIO_PB2 |AT91C_PIO_PB1 |AT91C_PIO_PB0 ; +/* Turn all LEDs OFF */ +PIOB ->PIO_SODR =AT91C_PIO_PB2 |AT91C_PIO_PB1 |AT91C_PIO_PB0 ; +}
board/at91rm9200dk/Makefile +1 -1
@@ -25,7 +25,7 @@ LIB = $(obj)lib$(BOARD).a -COBJS := at91rm9200dk.o flash.o +COBJS := at91rm9200dk.o flash.o led.o mux.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/at91rm9200dk/mux.c +36 -0
@@ -0,0 +1,36 @@ +#include <config.h> +#include <common.h> +#include <asm/hardware.h> +#include <dataflash.h> + +int AT91F_GetMuxStatus (void ) { +#ifdef DATAFLASH_MMC_SELECT +AT91C_BASE_PIOB ->PIO_PER =DATAFLASH_MMC_SELECT ;/* Set in PIO mode */ +AT91C_BASE_PIOB ->PIO_OER =DATAFLASH_MMC_SELECT ;/* Configure in output */ + + +if (AT91C_BASE_PIOB ->PIO_ODSR &DATAFLASH_MMC_SELECT ) { +return 1 ; + }else { +return 0 ; + } +#endif +} + +void AT91F_SelectMMC (void ) { +#ifdef DATAFLASH_MMC_SELECT +AT91C_BASE_PIOB ->PIO_PER =DATAFLASH_MMC_SELECT ;/* Set in PIO mode */ +AT91C_BASE_PIOB ->PIO_OER =DATAFLASH_MMC_SELECT ;/* Configure in output */ +/* Set Output */ +AT91C_BASE_PIOB ->PIO_SODR =DATAFLASH_MMC_SELECT ; +#endif +} + +void AT91F_SelectSPI (void ) { +#ifdef DATAFLASH_MMC_SELECT +AT91C_BASE_PIOB ->PIO_PER =DATAFLASH_MMC_SELECT ;/* Set in PIO mode */ +AT91C_BASE_PIOB ->PIO_OER =DATAFLASH_MMC_SELECT ;/* Configure in output */ +/* Clear Output */ +AT91C_BASE_PIOB ->PIO_CODR =DATAFLASH_MMC_SELECT ; +#endif +}
common/soft_i2c.c +1 -1
@@ -29,7 +29,7 @@#ifdef CONFIG_MPC8260 /* only valid for MPC8260 */ #include <ioports.h> #endif -#ifdef CONFIG_AT91RM9200DK /* need this for the at91rm9200dk */ +#ifdef CONFIG_AT91RM9200 /* need this for the at91rm9200 */ #include <asm/io.h> #include <asm/arch/hardware.h> #endif
include/cmd_confdefs.h +3 -1
@@ -94,6 +94,7 @@#define CFG_CMD_EXT2 0x1000000000000000ULL/* EXT2 Support */ #define CFG_CMD_SNTP 0x2000000000000000ULL/* SNTP support */ #define CFG_CMD_DISPLAY 0x4000000000000000ULL/* Display support */ +#define CFG_CMD_MUX 0x8000000000000000ULL/* AT91 MMC/SPI Mux Support */ #define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFULL/* ALL commands */
@@ -141,7 +142,8 @@CFG_CMD_SPI | \CFG_CMD_UNIVERSE | \CFG_CMD_USB | \ - CFG_CMD_VFD ) +CFG_CMD_VFD | \ + CFG_CMD_MUX)/* Default configuration */
include/configs/at91rm9200dk.h +5 -0
@@ -150,6 +162,11 @@#define CONFIG_NET_RETRY_COUNT 20#define CONFIG_AT91C_USE_RMII +/* AC Characteristics */ +/* DLYBS = tCSS = 250ns min and DLYBCT = tCSH = 250ns */ +#define DATAFLASH_TCSS (0xC << 16) +#define DATAFLASH_TCHS (0x1 << 24) +#define CONFIG_HAS_DATAFLASH 1#define CFG_SPI_WRITE_TOUT (5*CFG_HZ)#define CFG_MAX_DATAFLASH_BANKS 2
include/led.h +45 -0
45 lines not on this page · raw message
Signature · 9 lines
Best Regards, Ulf Samuelsson -------------- next part -------------- A non-text attachment was scrubbed... Name: ulf.vcf Type: text/x-vcard Size: 301 bytes Desc: not available Url : http://lists.denx.de/pipermail/u-boot/attachments/20070327/bccb2768/attachment.vcf
Quoted 14 lines
-----Original Message-----
From: u-boot-users-bounces at lists.sourceforge.net [mailto:u-boot-users-bounces at lists.sourceforge.net] On Behalf Of Ulf Samuelsson
Sent: 27 March 2007 17:17
To: uboot
Subject: [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.Author: Ulf Samuelsson <[email protected]>
Date: 2007-03-27
Quoted 7 lines
Subject: "7.at91rm9200dk":(1 of 1) [PATCH][ARM]
Add PIO control for at91rm9200dk LEDs and Mux.CHANGELOG:
[PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
Introduce a new commandCFG_CMD_MUX0x8000000000000000ULL
Ulf
Thanks for your patch. It will be useful for other at91rm9200dk
users
to see your post.
However, I shall not be submitting it for inclusion in the main U-Boot tree.
Your patch removes the last remaing CFG_CMD bit for a board specific use.
Does at91rm9200dk already use CFG_CMD_BSP and CFG_CMD_PORTIO?
Regards
Peter Pearse
[U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIOcontrol for at91rm9200dk LEDs and Mux.
Quoted 17 lines
Quoted 5 lines
[PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
Author: Ulf Samuelsson <[email protected]>
Date: 2007-03-27Quoted 7 lines
Subject: "7.at91rm9200dk":(1 of 1) [PATCH][ARM]
Add PIO control for at91rm9200dk LEDs and Mux.CHANGELOG:
[PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux. Introduce a new commandCFG_CMD_MUX0x8000000000000000ULLUlf
Thanks for your patch. It will be useful for other at91rm9200dk users
to see your post.
Quoted 6 lines
However, I shall not be submitting it for inclusion in the main U-Boot tree.
Your patch removes the last remaing
CFG_CMDbit for a board specific use.Does at91rm9200dk already use
CFG_CMD_BSPandCFG_CMD_PORTIO?
The CFG_CMD_PORTIO is useful to wrap around bothe the "led" and the "mux" functions. These commands will then also generate do_portio_in and do_portio_out functions which are x86 specific.
If CONFIG_X86 is not set, the functions does not do anything. Most SoC's memory map this anyway so that means that you do not need port I/O.
Having commands which configures the board is however quite convenient since you typically have to do a few writes to enable/disable board specific.
My suggestion is that I use CFG_CMD_PORTIO to build the LED/MUX commands and then further qualify them inside with CONFIG_MUX and CONFIG_LED.
"cmd_portio.c" needs to change to ensure it is empty if CONFIG_X86 is not set. The last fix is of course non-ARM specific so other may want to comment.
Then again, there is not a single board using CFG_CMD_PORTIO, so the change should be quite OK.
Quoted 4 lines
Regards
Peter Pearse
Best Regards
Ulf Samuelsson ulf at atmel.com
Atmel Nordic AB
Mail: Box 2033, 174 02 Sundbyberg, Sweden Visit: Kavalleriv?gen 24, 174 58 Sundbyberg, Sweden
Phone +46 (8) 441 54 22 Fax +46 (8) 441 54 29
GSM +46 (706) 22 44 57