Re: [U-Boot] [PATCH V2] arm: timer and interrupt init rework

2009-05-04 Thread Michael Roth
Wolfgang Denk schrieb:

> What is "slow clock"?

On (some) ARM SoC there are two oscillators: A "slow" free running
oscillator typically with a dedicated 32 kHz crystal and the "main"
oscillator with a dedicated crystal in the MHz range.

The processor starts with the slow slock enabled and init code needs
to set up PLLs and muxes etc. to enable the main oscillator and switch
to derived clocks like master clock, cpu clock, IO clock and so on.


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] at91: Factored out common serial hardware initialization

2009-02-06 Thread Michael Roth
Created a new function at91_serial_hw_init() which sets up the
dedicated PIO pins of several at91 SoC according to CONFIG_USARTx.

Please note that the used pins for serial communication varies on
different at91 SoC independently of the logic functionality equality
of the serial hardware.  But for each serial channel there is only
one possibility for IO pin multiplexing so there is no need for board
specific PIO setup.  So the usage of SoC specific PIO setup is advisable.

Signed-off-by: Michael Roth 
---
 board/afeb9260/afeb9260.c |   30 +---
 board/atmel/at91cap9adk/at91cap9adk.c |   30 +---
 board/atmel/at91sam9260ek/at91sam9260ek.c |   30 +---
 board/atmel/at91sam9261ek/at91sam9261ek.c |   30 +---
 board/atmel/at91sam9263ek/at91sam9263ek.c |   30 +---
 board/atmel/at91sam9rlek/at91sam9rlek.c   |   30 +---
 cpu/arm926ejs/at91/Makefile   |   20 +++
 cpu/arm926ejs/at91/at91cap9_serial.c  |   53 +
 cpu/arm926ejs/at91/at91sam9260_serial.c   |   53 +
 cpu/arm926ejs/at91/at91sam9261_serial.c   |   53 +
 cpu/arm926ejs/at91/at91sam9263_serial.c   |   53 +
 cpu/arm926ejs/at91/at91sam9rl_serial.c|   53 +
 include/asm-arm/arch-at91/at91_serial.h   |   25 +
 13 files changed, 322 insertions(+), 168 deletions(-)
 create mode 100644 cpu/arm926ejs/at91/at91cap9_serial.c
 create mode 100644 cpu/arm926ejs/at91/at91sam9260_serial.c
 create mode 100644 cpu/arm926ejs/at91/at91sam9261_serial.c
 create mode 100644 cpu/arm926ejs/at91/at91sam9263_serial.c
 create mode 100644 cpu/arm926ejs/at91/at91sam9rl_serial.c
 create mode 100644 include/asm-arm/arch-at91/at91_serial.h

diff --git a/board/afeb9260/afeb9260.c b/board/afeb9260/afeb9260.c
index 32445ab..95950c7 100644
--- a/board/afeb9260/afeb9260.c
+++ b/board/afeb9260/afeb9260.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -44,33 +45,6 @@ DECLARE_GLOBAL_DATA_PTR;
  * Miscelaneous platform dependent initialisations
  */
 
-static void afeb9260_serial_hw_init(void)
-{
-#ifdef CONFIG_USART0
-   at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
-   at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US0);
-#endif
-
-#ifdef CONFIG_USART1
-   at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
-   at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US1);
-#endif
-
-#ifdef CONFIG_USART2
-   at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
-   at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US2);
-#endif
-
-#ifdef CONFIG_USART3   /* DBGU */
-   at91_set_A_periph(AT91_PIN_PB14, 0);/* DRXD */
-   at91_set_A_periph(AT91_PIN_PB15, 1);/* DTXD */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
-#endif
-}
-
 static void afeb9260_nand_hw_init(void)
 {
unsigned long csa;
@@ -201,7 +175,7 @@ int board_init(void)
/* adress of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-   afeb9260_serial_hw_init();
+   at91_serial_hw_init();
 #ifdef CONFIG_CMD_NAND
afeb9260_nand_hw_init();
 #endif
diff --git a/board/atmel/at91cap9adk/at91cap9adk.c 
b/board/atmel/at91cap9adk/at91cap9adk.c
index f7d68b7..29b51ee 100644
--- a/board/atmel/at91cap9adk/at91cap9adk.c
+++ b/board/atmel/at91cap9adk/at91cap9adk.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,33 +48,6 @@ DECLARE_GLOBAL_DATA_PTR;
  * Miscelaneous platform dependent initialisations
  */
 
-static void at91cap9_serial_hw_init(void)
-{
-#ifdef CONFIG_USART0
-   at91_set_A_periph(AT91_PIN_PA22, 1);/* TXD0 */
-   at91_set_A_periph(AT91_PIN_PA23, 0);/* RXD0 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US0);
-#endif
-
-#ifdef CONFIG_USART1
-   at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
-   at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US1);
-#endif
-
-#ifdef CONFIG_USART2
-   at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
-   at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US2);
-#endif
-
-#ifdef CONFIG_USART3   /* DBGU */
-   at91_set_A_periph(AT91_PIN_PC30, 0);/* DRXD */
-   at91_set_A_periph(AT91_PIN_PC31, 1);/* DTXD */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
-#endif
-}
-
 static void at91cap9_slowclock_hw_init(void)

[U-Boot] [PATCH] at91: CONFIG_USART3 renamed to CONFIG_USART_DBGU

2009-02-06 Thread Michael Roth
In reality there are only three usarts on at91 SoC and one serial
debug port called DBGU which is a reduced functionality usart.

For reasons of clarity and consistency the prefix USART is maintained
independently the fact that normally the debug port is just called DBGU.

Signed-off-by: Michael Roth 
---
 drivers/serial/atmel_usart.c   |   23 ++-
 include/asm-arm/arch-at91/clk.h|5 +
 include/asm-arm/arch-at91/memory-map.h |8 
 include/configs/afeb9260.h |2 +-
 include/configs/at91cap9adk.h  |2 +-
 include/configs/at91sam9260ek.h|2 +-
 include/configs/at91sam9261ek.h|2 +-
 include/configs/at91sam9263ek.h|2 +-
 include/configs/at91sam9rlek.h |2 +-
 9 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index f3b146c..f310dcd 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -22,17 +22,22 @@
 #include 
 
 #if defined(CONFIG_USART0)
-# define USART_ID  0
-# define USART_BASEUSART0_BASE
+#  define GET_USART_CLK_RATE() get_usart_clk_rate(0)
+#  define USART_BASE   USART0_BASE
 #elif defined(CONFIG_USART1)
-# define USART_ID  1
-# define USART_BASEUSART1_BASE
+#  define GET_USART_CLK_RATE() get_usart_clk_rate(1)
+#  define USART_BASE   USART1_BASE
 #elif defined(CONFIG_USART2)
-# define USART_ID  2
-# define USART_BASEUSART2_BASE
+#  define GET_USART_CLK_RATE() get_usart_clk_rate(2)
+#  define USART_BASE   USART2_BASE
 #elif defined(CONFIG_USART3)
-# define USART_ID  3
-# define USART_BASEUSART3_BASE
+#  define GET_USART_CLK_RATE() get_usart_clk_rate(3)
+#  define USART_BASE   USART3_BASE
+#elif defined(CONFIG_USART_DBGU)
+#  define GET_USART_CLK_RATE() get_usart_dbgu_clk_rate()
+#  define USART_BASE   USART_DBGU_BASE
+#else
+#  error No CONFIG_USARTx defined!
 #endif
 
 #include "atmel_usart.h"
@@ -49,7 +54,7 @@ void serial_setbrg(void)
 * Baud Rate = --
 *16 * CD
 */
-   usart_hz = get_usart_clk_rate(USART_ID);
+   usart_hz = GET_USART_CLK_RATE();
divisor = (usart_hz / 16 + gd->baudrate / 2) / gd->baudrate;
usart3_writel(BRGR, USART3_BF(CD, divisor));
 }
diff --git a/include/asm-arm/arch-at91/clk.h b/include/asm-arm/arch-at91/clk.h
index 1b502c8..51a90a9 100644
--- a/include/asm-arm/arch-at91/clk.h
+++ b/include/asm-arm/arch-at91/clk.h
@@ -36,6 +36,11 @@ static inline unsigned long get_usart_clk_rate(unsigned int 
dev_id)
return AT91_MASTER_CLOCK;
 }
 
+static inline unsigned long get_usart_dbgu_clk_rate(void)
+{
+   return AT91_MASTER_CLOCK;
+}
+
 static inline unsigned long get_lcdc_clk_rate(unsigned int dev_id)
 {
return AT91_MASTER_CLOCK;
diff --git a/include/asm-arm/arch-at91/memory-map.h 
b/include/asm-arm/arch-at91/memory-map.h
index 8015dad..0013022 100644
--- a/include/asm-arm/arch-at91/memory-map.h
+++ b/include/asm-arm/arch-at91/memory-map.h
@@ -26,9 +26,9 @@
 
 #include 
 
-#define USART0_BASE AT91_USART0
-#define USART1_BASE AT91_USART1
-#define USART2_BASE AT91_USART2
-#define USART3_BASE (AT91_BASE_SYS + AT91_DBGU)
+#define USART0_BASEAT91_USART0
+#define USART1_BASEAT91_USART1
+#define USART2_BASEAT91_USART2
+#define USART_DBGU_BASE(AT91_BASE_SYS + AT91_DBGU)
 
 #endif /* __ASM_ARM_ARCH_MEMORYMAP_H__ */
diff --git a/include/configs/afeb9260.h b/include/configs/afeb9260.h
index 9eed342..815483a 100644
--- a/include/configs/afeb9260.h
+++ b/include/configs/afeb9260.h
@@ -52,7 +52,7 @@
 #undef CONFIG_USART0
 #undef CONFIG_USART1
 #undef CONFIG_USART2
-#define CONFIG_USART3  1   /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU  1
 
 #define CONFIG_BOOTDELAY   3
 
diff --git a/include/configs/at91cap9adk.h b/include/configs/at91cap9adk.h
index 01da99b..39d13ee 100644
--- a/include/configs/at91cap9adk.h
+++ b/include/configs/at91cap9adk.h
@@ -56,7 +56,7 @@
 #undef CONFIG_USART0
 #undef CONFIG_USART1
 #undef CONFIG_USART2
-#define CONFIG_USART3  1   /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU  1
 
 /* LCD */
 #define CONFIG_LCD 1
diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index 2f1a41f..2b81cb0 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -56,7 +56,7 @@
 #undef CONFIG_USART0
 #undef CONFIG_USART1
 #undef CONFIG_USART2
-#define CONFIG_USART3  1   /* USART 3 is DBGU */
+#define CONFIG_USART_DBGU  1
 
 #define CONFIG_BOOTDELAY   3
 
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index ebecfa4..3db0cca 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -55,7 +55,7 @@
 #und

[U-Boot] [PATCH v2 0/2] at91: serial initialization cleanup

2009-02-06 Thread Michael Roth
Hello,

I took up the suggestions from Jean-Christophe and the discussion
in http://lists.denx.de/pipermail/u-boot/2008-November/043131.html
and reworked the patch so that cpu specfic code goes to specfic
files.  This results to less ifdefs.

An argument to at91_serial_hw_init() is not needed because all can
be done against CONFIG_USARTx in a91xyz_serial.c and atmel_usart.c.

Additionally I extended the patch to rename CONFIG_USART3
to CONFIG_USART_DBGU on at91 plattforms.


Michael Roth






___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] Stamp9261 board support

2009-02-05 Thread Michael Roth
Wolfgang Denk schrieb:

>> +int dram_init(void)
>> +{
>> +gd->bd->bi_dram[0].start = PHYS_SDRAM;
>> +gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
>> +return 0;
>> +}
> 
> You should auto-size the RAM instead of hardcoding it.

[...]

>> +#define CONFIG_NR_DRAM_BANKS1
>> +#define PHYS_SDRAM  0x2000
>> +#define PHYS_SDRAM_SIZE 0x0400  /* 64 megs */
> 
> Please use get_ram_size() instead.

On this board U-Boot runs from the same memory which get_ram_size()
should probe for its actual size.

Currently, as far as I can see, the implementation of get_ram_size()
don't hit itself (by fortune?) while probing. But maybe the algorithm
will change in some feature.

Additionally the fixed RAM size is (implicit) needed in several
other places for example CONFIG_SYS_MEMTEST_END and lowlevel
initialization of SDRAM, relocation to TEXT_BASE and so on.

Normally autoconf is a good thing (TM) but in this case I'm not sure.


Michael Roth

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] at91: Factored out common serial hardware initialization

2009-02-05 Thread Michael Roth
Jean-Christophe PLAGNIOL-VILLARD schrieb:

> I've send similar patch before please use it

Can't find it.


Michael Roth

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] at91: Factored out common serial hardware initialization

2009-02-05 Thread Michael Roth
Created a new function at91_serial_hw_init() which sets up the
dedicated PIO pins of several at91 SoC according to CONFIG_USARTx.

Please note that the used pins for serial communication varies on
different at91 SoC independently of the logic functionality equality
of the serial hardware.

Signed-off-by: Michael Roth 
---
 board/afeb9260/afeb9260.c |   30 +-
 board/atmel/at91cap9adk/at91cap9adk.c |   30 +-
 board/atmel/at91sam9260ek/at91sam9260ek.c |   30 +-
 board/atmel/at91sam9261ek/at91sam9261ek.c |   30 +-
 board/atmel/at91sam9263ek/at91sam9263ek.c |   30 +-
 board/atmel/at91sam9rlek/at91sam9rlek.c   |   30 +-
 include/at91_serial.h |   23 
 lib_arm/Makefile  |1 +
 lib_arm/at91_serial.c |  168 +
 9 files changed, 204 insertions(+), 168 deletions(-)
 create mode 100644 include/at91_serial.h
 create mode 100644 lib_arm/at91_serial.c

diff --git a/board/afeb9260/afeb9260.c b/board/afeb9260/afeb9260.c
index 32445ab..ea90850 100644
--- a/board/afeb9260/afeb9260.c
+++ b/board/afeb9260/afeb9260.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
 #include 
 #include 
@@ -44,33 +45,6 @@ DECLARE_GLOBAL_DATA_PTR;
  * Miscelaneous platform dependent initialisations
  */
 
-static void afeb9260_serial_hw_init(void)
-{
-#ifdef CONFIG_USART0
-   at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
-   at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US0);
-#endif
-
-#ifdef CONFIG_USART1
-   at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
-   at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US1);
-#endif
-
-#ifdef CONFIG_USART2
-   at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
-   at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US2);
-#endif
-
-#ifdef CONFIG_USART3   /* DBGU */
-   at91_set_A_periph(AT91_PIN_PB14, 0);/* DRXD */
-   at91_set_A_periph(AT91_PIN_PB15, 1);/* DTXD */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
-#endif
-}
-
 static void afeb9260_nand_hw_init(void)
 {
unsigned long csa;
@@ -201,7 +175,7 @@ int board_init(void)
/* adress of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-   afeb9260_serial_hw_init();
+   at91_serial_hw_init();
 #ifdef CONFIG_CMD_NAND
afeb9260_nand_hw_init();
 #endif
diff --git a/board/atmel/at91cap9adk/at91cap9adk.c 
b/board/atmel/at91cap9adk/at91cap9adk.c
index f7d68b7..0030e8c 100644
--- a/board/atmel/at91cap9adk/at91cap9adk.c
+++ b/board/atmel/at91cap9adk/at91cap9adk.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
 #include 
 #endif
@@ -47,33 +48,6 @@ DECLARE_GLOBAL_DATA_PTR;
  * Miscelaneous platform dependent initialisations
  */
 
-static void at91cap9_serial_hw_init(void)
-{
-#ifdef CONFIG_USART0
-   at91_set_A_periph(AT91_PIN_PA22, 1);/* TXD0 */
-   at91_set_A_periph(AT91_PIN_PA23, 0);/* RXD0 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US0);
-#endif
-
-#ifdef CONFIG_USART1
-   at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
-   at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US1);
-#endif
-
-#ifdef CONFIG_USART2
-   at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
-   at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US2);
-#endif
-
-#ifdef CONFIG_USART3   /* DBGU */
-   at91_set_A_periph(AT91_PIN_PC30, 0);/* DRXD */
-   at91_set_A_periph(AT91_PIN_PC31, 1);/* DTXD */
-   at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
-#endif
-}
-
 static void at91cap9_slowclock_hw_init(void)
 {
/*
@@ -367,7 +341,7 @@ int board_init(void)
/* adress of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-   at91cap9_serial_hw_init();
+   at91_serial_hw_init();
at91cap9_slowclock_hw_init();
at91cap9_nor_hw_init();
 #ifdef CONFIG_CMD_NAND
diff --git a/board/atmel/at91sam9260ek/at91sam9260ek.c 
b/board/atmel/at91sam9260ek/at91sam9260ek.c
index ef99b8b..6c6084d 100644
--- a/board/atmel/at91sam9260ek/at91sam9260ek.c
+++ b/board/atmel/at91sam9260ek/at91sam9260ek.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
 #include 
 #endif
@@ -43,33 +44,6 @@ DECLARE_GLOBAL_DATA_PTR;
  * Miscelaneous plat

Re: [U-Boot] [PATCH 1/2] Allow board specific overwriting of library code

2009-02-04 Thread Michael Roth
Michael Roth schrieb:

> Because the whole weak-linking looks like it is somewhat broken or at
> least very difficult to get it correctly.

Small example:

In board/atmel/at91sam9261ek there is:

led.c:
void red_LED_on(void)
...
void red_LED_off(void)
...

Makefile:

COBJS-y += led.o
...
OBJS:= $(addprefix $(obj),$(COBJS-y))
...
$(LIB): $(obj).depend $(OBJS) $(SOBJS)


And in lib_arm/board.c we have:

void inline __red_LED_on (void) {}
void inline red_LED_on (void) __attribute__((weak, 
alias("__red_LED_on")));
void inline __red_LED_off(void) {}
void inline red_LED_off(void)__attribute__((weak, 
alias("__red_LED_off")));


But as you can see from u-boot.map, the result is not as expected:

0x23f00340  0x35c lib_arm/libarm.a(board.o)
0x23f00390__red_LED_off
...
0x23f00390red_LED_off
...
0x23f0038cred_LED_on
0x23f0038c__red_LED_on


No single weak symbol from lib_arm/board.c get overridden from the
board specific led.c. Very annoying.


Michael Roth

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] Allow board specific overwriting of library code

2009-02-04 Thread Michael Roth
Wolfgang Denk schrieb:

> Why would that be needed?

Because the whole weak-linking looks like it is somewhat broken or at
least very difficult to get it correctly.


> Normally you deal with such issues in your linker script, i. e. in a
> board specific way without need to modify global files.

Yes, there are several possible solutions to address this issue. Until
now, there were discussed: CONFIG_XYZ and ifdef/endif and pre-build
objects (patch from Jean-Christophe) and my proposal.

Using a board specific linker script is another way.

However, because the problem regarding weak-linking is a global one,
maybe the circumvention should be global too.

But I don't know. I could also use a board specific linker script.


Michael Roth


(Email resend because of stupid user error by my...)


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] Stamp9261 board support

2009-02-04 Thread Michael Roth
Initial support for Taskit Stamp9261 board - based on an
AT91SAM9261 SoC from Atmel.

Currently only a Stamp9261 with 64MB RAM fitted together
with a Stamp-Adaptor on a Panel-Card EVB is supported.

Signed-off-by: Michael Roth 
---
 MAINTAINERS |4 +
 MAKEALL |1 +
 Makefile|3 +
 board/stamp9261/Makefile|   60 ++
 board/stamp9261/config.mk   |2 +
 board/stamp9261/led.c   |   77 
 board/stamp9261/lowlevel_init.S |  387 +++
 board/stamp9261/stamp9261.c |  139 ++
 include/configs/stamp9261.h |  199 
 9 files changed, 872 insertions(+), 0 deletions(-)
 create mode 100644 board/stamp9261/Makefile
 create mode 100644 board/stamp9261/config.mk
 create mode 100644 board/stamp9261/led.c
 create mode 100644 board/stamp9261/lowlevel_init.S
 create mode 100644 board/stamp9261/stamp9261.c
 create mode 100644 include/configs/stamp9261.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 38feac8..59cd536 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -607,6 +607,10 @@ Stefan Roese 
pdnb3   xscale
scpuxscale
 
+Michael Roth 
+
+   stamp9261   ARM926EJS (AT91SAM9261 SoC)
+
 Alessandro Rubini 
 Nomadik Linux Team 
 
diff --git a/MAKEALL b/MAKEALL
index cf05133..7a5bbbf 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -573,6 +573,7 @@ LIST_at91=" \
kb9202  \
mp2usb  \
m501sk  \
+   stamp9261   \
 "
 
 #
diff --git a/Makefile b/Makefile
index 50c9975..20cccf0 100644
--- a/Makefile
+++ b/Makefile
@@ -2831,6 +2831,9 @@ smdk2400_config   :   unconfig
 smdk2410_config:   unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0
 
+stamp9261_config:  unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm926ejs stamp9261 NULL at91
+
 SX1_stdout_serial_config \
 SX1_config:unconfig
@mkdir -p $(obj)include
diff --git a/board/stamp9261/Makefile b/board/stamp9261/Makefile
new file mode 100644
index 000..68c43a1
--- /dev/null
+++ b/board/stamp9261/Makefile
@@ -0,0 +1,60 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop 
+# Lead Tech Design 
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := stamp9261.o
+
+ECOBJS := led.o
+ESOBJS := lowlevel_init.o
+
+SRCS   := $(COBJS:.o=.c) $(ECOBJS:.o=.c) $(ESOBJS:.o=.S)
+COBJS  := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(COBJS)
+   $(AR) $(ARFLAGS) $@ $(COBJS)
+
+
+clean:
+   rm -f $(COBJS) $(SOBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
+
+
diff --git a/board/stamp9261/config.mk b/board/stamp9261/config.mk
new file mode 100644
index 000..6d8135a
--- /dev/null
+++ b/board/stamp9261/config.mk
@@ -0,0 +1,2 @@
+TEXT_BASE = 0x23f0
+EXTRABOARDOBJS = lowlevel_init.o led.o
diff --git a/board/stamp9261/led.c b/board/stamp9261/led.c
new file mode 100644
index 000..367db20
--- /dev/null
+++ b/board/stamp9261/led.c
@@ -0,0 +1,77 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop 
+ * Lead Tech Design 
+ *
+ * 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 Publ

[U-Boot] [PATCH 0/2] Initial Stamp9261 board support

2009-02-04 Thread Michael Roth
Hello,

this is a patch to support the Taskit Stamp9261 board.

If the EXTRABOARDOBJS patch is not acceptable please let me
know and maybe make a suggestion how to solve it.


Michael Roth



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] Allow board specific overwriting of library code

2009-02-04 Thread Michael Roth
Enables to overwrite any library code by defining EXTRABOARDOBJS
in the board specific config.mk.
Those listed object files get linked directly into the u-boot binary
right after the start objects and before any archives.

Signed-off-by: Michael Roth 
---
 Makefile |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 787c5f2..50c9975 100644
--- a/Makefile
+++ b/Makefile
@@ -273,6 +273,8 @@ LIBS := $(addprefix $(obj),$(LIBS))
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
+EXTRABOARDOBJS := $(addprefix $(obj)board/$(BOARDDIR)/,$(EXTRABOARDOBJS))
+
 # Add GCC lib
 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) 
-lgcc
 
@@ -294,7 +296,7 @@ ONENAND_IPL = onenand_ipl
 U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
 endif
 
-__OBJS := $(subst $(obj),,$(OBJS))
+__OBJS := $(subst $(obj),,$(OBJS)) $(subst $(obj),,$(EXTRABOARDOBJS))
 __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 
 #
@@ -338,7 +340,8 @@ $(obj)u-boot.sha1:  $(obj)u-boot.bin
 $(obj)u-boot.dis:  $(obj)u-boot
$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot:  depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) 
$(LDSCRIPT)
+$(obj)u-boot:  depend $(SUBDIRS) $(OBJS) $(EXTRABOARDOBJS) \
+   $(LIBBOARD) $(LIBS) $(LDSCRIPT)
UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
sed  -n -e 
's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
@@ -348,6 +351,11 @@ $(obj)u-boot:  depend $(SUBDIRS) $(OBJS) 
$(LIBBOARD) $(LIBS) $(LDSCRIPT)
 $(OBJS):   depend $(obj)include/autoconf.mk
$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
+$(EXTRABOARDOBJS): depend $(obj)include/autoconf.mk
+   $(MAKE) -C $(dir $(subst $(obj),,$@)) \
+   $(if $(REMOTE_BUILD), \
+   $(EXTRABOARDOBJS),$(notdir $(EXTRABOARDOBJS)))
+
 $(LIBS):   depend $(obj)include/autoconf.mk $(SUBDIRS)
$(MAKE) -C $(dir $(subst $(obj),,$@))
 
-- 
1.6.0.6

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Allow board specific overwriting of library code

2009-02-02 Thread Michael Roth

Hello,

recently there were some discussion how to support board specfic
lowlevel_init code on the at91 plattform. For example in Nov 2008
there was a discussion about CONFIG_USER_LOWLEVEL_INIT or so and
recently there was a patch proposal from Jean-Christophe to provide
a cmd_link_o_target macro that creates a combinend object file
instead an archive.

The combined object file was needed because weak linking somehow
doesn't work with archive files. Very annoying. 

I had large problems with weak linking regarding coloured LED support
on my board, too. I came to the conclusion that weak linking across
archives are somehow broken. However I was not able to create a
small test case to trigger this behavior (bug?) in gcc/bintuils.

Ok, so here my proposal that is generic and allows any library code
to get overwritten by board specific functions without defining any
weak symbols in the library code. It is based purely on sequence of
object files presented to 'ld'.

Please take a look and tell me your opinion.

I have patches to support a new board in my queue but I need any
possibility to provide a board specific lowlevel_init. Which solution
is selected plays no role to me.


Michael Roth

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/1] Allow board specific overwriting of library code

2009-02-02 Thread Michael Roth
Enables to overwrite any library code by defining EXTRABOARDOBJS
in the board specific config.mk.
Those listed object files get linked directly into the u-boot binary
right after the start objects and before any archives.

Signed-off-by: Michael Roth 
---
 Makefile |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 802a704..87975a1 100644
--- a/Makefile
+++ b/Makefile
@@ -273,6 +273,8 @@ LIBS := $(addprefix $(obj),$(LIBS))
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
+EXTRABOARDOBJS := $(addprefix $(obj)board/$(BOARDDIR)/,$(EXTRABOARDOBJS))
+
 # Add GCC lib
 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) 
-lgcc
 
@@ -294,7 +296,7 @@ ONENAND_IPL = onenand_ipl
 U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
 endif
 
-__OBJS := $(subst $(obj),,$(OBJS))
+__OBJS := $(subst $(obj),,$(OBJS)) $(subst $(obj),,$(EXTRABOARDOBJS))
 __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 
 #
@@ -338,7 +340,8 @@ $(obj)u-boot.sha1:  $(obj)u-boot.bin
 $(obj)u-boot.dis:  $(obj)u-boot
$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot:  depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) 
$(LDSCRIPT)
+$(obj)u-boot:  depend $(SUBDIRS) $(OBJS) $(EXTRABOARDOBJS) \
+   $(LIBBOARD) $(LIBS) $(LDSCRIPT)
UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
sed  -n -e 
's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
@@ -348,6 +351,11 @@ $(obj)u-boot:  depend $(SUBDIRS) $(OBJS) 
$(LIBBOARD) $(LIBS) $(LDSCRIPT)
 $(OBJS):   depend $(obj)include/autoconf.mk
$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
+$(EXTRABOARDOBJS): depend $(obj)include/autoconf.mk
+   $(MAKE) -C $(dir $(subst $(obj),,$@)) \
+   $(if $(REMOTE_BUILD), \
+   $(EXTRABOARDOBJS),$(notdir $(EXTRABOARDOBJS)))
+
 $(LIBS):   depend $(obj)include/autoconf.mk $(SUBDIRS)
$(MAKE) -C $(dir $(subst $(obj),,$@))
 
-- 
1.6.0.6

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Removed unused CONFIG_CMD_AT91_SPIMUX

2009-02-01 Thread Michael Roth
Jean-Christophe PLAGNIOL-VILLARD schrieb:
> On 18:18 Sun 01 Feb , Michael Roth wrote:
>> CONFIG_CMD_AT91_SPIMUX was introduced as CONFIG_CMD_MUX in
>> commit d4fc6012fd0a5c211b825691f44b06f8032c0551 and
>> renamed in commit 557ab89d294f08dd532f21d19861b40093200a33.
>>
>> However these were never used by any code.
> NAK I'm preparing a patch to re-add it

Er, unused since 16 months and never ever referenced or used by any code.


Michael Roth


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Removed unused CONFIG_CMD_AT91_SPIMUX

2009-02-01 Thread Michael Roth
CONFIG_CMD_AT91_SPIMUX was introduced as CONFIG_CMD_MUX in
commit d4fc6012fd0a5c211b825691f44b06f8032c0551 and
renamed in commit 557ab89d294f08dd532f21d19861b40093200a33.

However these were never used by any code.

Signed-off-by: Michael Roth 
---
 include/config_cmd_all.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h
index d771696..d382b4d 100644
--- a/include/config_cmd_all.h
+++ b/include/config_cmd_all.h
@@ -82,6 +82,5 @@
 #define CONFIG_CMD_USB /* USB Support  */
 #define CONFIG_CMD_VFD /* VFD support (TRAB)   */
 #define CONFIG_CMD_XIMG/* Load part of Multi Image */
-#define CONFIG_CMD_AT91_SPIMUX /* AT91 MMC/SPI Mux Support */
 
 #endif /* _CONFIG_CMD_ALL_H */
-- 
1.6.0.6

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Patches for new at91 board / lowlevel_init.S

2009-01-25 Thread Michael Roth
Jean-Christophe PLAGNIOL-VILLARD schrieb:

> I'll apply a patch that allow this at the beginning of the week
> with 2 boards that use it.

Ok, fine!  I will wait and then base my patch on your implementation.

Thank you!


Michael Roth

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Patches for new at91 board / lowlevel_init.S

2009-01-24 Thread Michael Roth
Hello,

I'm having patches for a new at91sam9261 based board in my queue I would
like to publish for the current merge window.

However, this patch needs a way to supply its own lowlevel_init.S
instead the at91 default.

A week ago I asked a question about that topic and there was a hint to
look for the ronetix patches and a note that the next U-Boot release
will contain a solution.

However, the mentioned ronetix patch followed a discussion about
possible ways to address this topic but as far I can see, no solution
was selected.

Additionally, in the current git tree there is still no solution for
this topic, too (or I'm missing something).

So my question is:

How should I proceed? Should I post my solution? Or should I wait a
couple of more days for an "official" solution?


Michael Roth

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] User supplied lowlevel initialization code on at91 plattforms

2009-01-18 Thread Michael Roth
Jean-Christophe PLAGNIOL-VILLARD schrieb:

> for the next release we will introduce a weak function that allow you to add
> your own init and example to board at91 from nor
> 
> please search on the ML Ronetix patch

Is a git repository with that patch available?


Michael Roth


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] User supplied lowlevel initialization code on at91 plattforms

2009-01-16 Thread Michael Roth
Hello,

I'm hacking U-Boot to a new at91sam9261 board and would like to include
a little bit low level init code (pll, sdram, etc.).

Normally, in U-Boot it is assumed that on at91 plattforms the bootstrap
code lives in dataflash which do the job.

On the board I'm hacking there isn't any dataflash but only nor flash
from that the board boots.

So my question is: How can I supply an self written lowlevel_init.S in
my board directoy that get linked instead the default
cpu/arm926ejs/at91/lowlevel_init.S code?

Are there any configuration variables to trick the U-Boot makefiles to
use my lowlevel_init.S?


Michael Roth

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot