* [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
@ 2007-03-27 16:17 Ulf Samuelsson
2007-04-03 14:58 ` Peter Pearse
0 siblings, 1 reply; 3+ messages in thread
From: Ulf Samuelsson @ 2007-03-27 16:17 UTC (permalink / raw)
To: u-boot
Author: Ulf Samuelsson <ulf@atmel.com>
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
---------------------------------------------------------------------------------------------------------------------------------
diff -urN u-boot-1.2.0/board/at91rm9200dk/led.c u-boot-1.2.0-atmel/board/at91rm9200dk/led.c
--- u-boot-1.2.0/board/at91rm9200dk/led.c 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-1.2.0-atmel/board/at91rm9200dk/led.c 2007-03-27 10:40:35.000000000 +0200
@@ -0,0 +1,81 @@
+/*
+ * (C) Copyright 2006
+ * Atmel Nordic AB <www.atmel.com>
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * 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;
+}
diff -urN u-boot-1.2.0/board/at91rm9200dk/Makefile u-boot-1.2.0-atmel/board/at91rm9200dk/Makefile
--- u-boot-1.2.0/board/at91rm9200dk/Makefile 2007-03-27 09:30:38.000000000 +0200
+++ u-boot-1.2.0-atmel/board/at91rm9200dk/Makefile 2007-03-24 20:07:33.000000000 +0100
@@ -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))
diff -urN u-boot-1.2.0/board/at91rm9200dk/mux.c u-boot-1.2.0-atmel/board/at91rm9200dk/mux.c
--- u-boot-1.2.0/board/at91rm9200dk/mux.c 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-1.2.0-atmel/board/at91rm9200dk/mux.c 2007-03-24 20:07:33.000000000 +0100
@@ -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
+}
diff -urN u-boot-1.2.0/common/soft_i2c.c u-boot-1.2.0-atmel/common/soft_i2c.c
--- u-boot-1.2.0/common/soft_i2c.c 2007-01-07 00:13:11.000000000 +0100
+++ u-boot-1.2.0-atmel/common/soft_i2c.c 2007-03-24 20:07:33.000000000 +0100
@@ -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
diff -urN u-boot-1.2.0/include/cmd_confdefs.h u-boot-1.2.0-atmel/include/cmd_confdefs.h
--- u-boot-1.2.0/include/cmd_confdefs.h 2007-01-07 00:13:11.000000000 +0100
+++ u-boot-1.2.0-atmel/include/cmd_confdefs.h 2007-03-24 20:07:33.000000000 +0100
@@ -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
*/
diff -urN u-boot-1.2.0/include/configs/at91rm9200dk.h u-boot-1.2.0-atmel/include/configs/at91rm9200dk.h
--- u-boot-1.2.0/include/configs/at91rm9200dk.h 2007-01-07 00:13:11.000000000 +0100
+++ u-boot-1.2.0-atmel/include/configs/at91rm9200dk.h 2007-03-26 22:40:12.000000000 +0200
@@ -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
diff -urN u-boot-1.2.0/include/led.h u-boot-1.2.0-atmel/include/led.h
--- u-boot-1.2.0/include/led.h 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-1.2.0-atmel/include/led.h 2007-03-24 20:07:32.000000000 +0100
@@ -0,0 +1,45 @@
+/*
+ * (C) Copyright 2006
+ * Atmel Nordic AB <www.atmel.com>
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * 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
+ */
+
+ #ifndef __LED_H
+#define __LED_H
+
+#ifndef __ASSEMBLY__
+extern void LED_init (void);
+extern void red_LED_on(void);
+extern void red_LED_off(void);
+extern void green_LED_on(void);
+extern void green_LED_off(void);
+extern void yellow_LED_on(void);
+extern void yellow_LED_off(void);
+#else
+ .extern LED_init
+ .extern red_LED_on
+ .extern red_LED_off
+ .extern yellow_LED_on
+ .extern yellow_LED_off
+ .extern green_LED_on
+ .extern green_LED_off
+#endif
+#endif
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
2007-03-27 16:17 [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux Ulf Samuelsson
@ 2007-04-03 14:58 ` Peter Pearse
2007-04-11 13:14 ` [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIOcontrol " Ulf Samuelsson
0 siblings, 1 reply; 3+ messages in thread
From: Peter Pearse @ 2007-04-03 14:58 UTC (permalink / raw)
To: u-boot
> -----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 <ulf@atmel.com>
> 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
>
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIOcontrol for at91rm9200dk LEDs and Mux.
2007-04-03 14:58 ` Peter Pearse
@ 2007-04-11 13:14 ` Ulf Samuelsson
0 siblings, 0 replies; 3+ messages in thread
From: Ulf Samuelsson @ 2007-04-11 13:14 UTC (permalink / raw)
To: u-boot
>> [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux.
>>
>> Author: Ulf Samuelsson <ulf@atmel.com>
>> 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
>>
> 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?
>
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.
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-11 13:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-27 16:17 [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIO control for at91rm9200dk LEDs and Mux Ulf Samuelsson
2007-04-03 14:58 ` Peter Pearse
2007-04-11 13:14 ` [U-Boot-Users] "7.at91rm9200dk":(1 of 1) [PATCH][ARM] Add PIOcontrol " Ulf Samuelsson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.