Skip to contentSkip to conversation

at91: fixed 'esd gmbh' meesc and otc570 boards

PATCH New Daniel Gorsulowski 3 participants 4 messages Jan 21, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 at91: fixed 'esd gmbh' meesc and otc570 boards

---

There is still a bug in USART config. This patch is for reviewing only!

 board/esd/meesc/config.mk  |    1 -
 board/esd/meesc/meesc.c    |   39 +++++-----
 board/esd/otc570/config.mk |    1 -
 board/esd/otc570/otc570.c  |   51 +++++++------
 boards.cfg                 |    6 +-
 include/configs/meesc.h    |  150 ++++++++++++++++++++++---------------
 include/configs/otc570.h   |  179 +++++++++++++++++++++++++-------------------
 7 files changed, 241 insertions(+), 186 deletions(-)
 delete mode 100644 board/esd/meesc/config.mk
 delete mode 100644 board/esd/otc570/config.mk
board/esd/meesc/config.mk deleted +0 -1
deleted file mode 100644
index 2077692..0000000
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x21f00000
board/esd/meesc/meesc.c +20 -19
index 41fa3e1..46cd33c 100644
@@ -3,7 +3,7 @@
  * Stelian Pop <[email protected]>
  * Lead Tech Design <www.leadtechdesign.com>
  *
- * (C) Copyright 2009-2010
+ * (C) Copyright 2009-2011
  * Daniel Gorsulowski <[email protected]>
  * esd electronic system design gmbh <www.esd.eu>
  *
@@ -27,6 +27,7 @@
  */
 
 #include <common.h>
+#include <asm/io.h>
 #include <asm/arch/at91sam9263.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
@@ -36,7 +37,6 @@
 #include <asm/arch/at91_pio.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/io.h>
 #include <netdev.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -67,8 +67,8 @@ int get_hw_rev(void)
 static void meesc_nand_hw_init(void)
 {
 	unsigned long csa;
-	at91_smc_t 	*smc 	= (at91_smc_t *) AT91_SMC0_BASE;
-	at91_matrix_t 	*matrix = (at91_matrix_t *) AT91_MATRIX_BASE;
+	at91_smc_t 	*smc 	= (at91_smc_t *) ATMEL_BASE_SMC0;
+	at91_matrix_t 	*matrix = (at91_matrix_t *) ATMEL_BASE_MATRIX;
 
 	/* Enable CS3 */
 	csa = readl(&matrix->csa[0]) | AT91_MATRIX_CSA_EBI_CS3A;
@@ -88,7 +88,7 @@ static void meesc_nand_hw_init(void)
 	writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
 		AT91_SMC_MODE_EXNW_DISABLE |
 		AT91_SMC_MODE_DBW_8 |
-		AT91_SMC_MODE_TDF_CYCLE(2),
+		AT91_SMC_MODE_TDF_CYCLE(3),
 		&smc->cs[3].mode);
 
 	/* Configure RDY/BSY */
@@ -102,9 +102,9 @@ static void meesc_nand_hw_init(void)
 #ifdef CONFIG_MACB
 static void meesc_macb_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 	/* Enable clock */
-	writel(1 << AT91SAM9263_ID_EMAC, &pmc->pcer);
+	writel(1 << ATMEL_ID_EMAC, &pmc->pcer);
 	at91_macb_hw_init();
 }
 #endif
@@ -117,7 +117,7 @@ static void meesc_macb_hw_init(void)
  */
 static void meesc_ethercat_hw_init(void)
 {
-	at91_smc_t 	*smc1 	= (at91_smc_t *) AT91_SMC1_BASE;
+	at91_smc_t 	*smc1 	= (at91_smc_t *) ATMEL_BASE_SMC1;
 
 	/* Configure SMC EBI1_CS0 for EtherCAT */
 	writel(AT91_SMC_SETUP_NWE(0) | AT91_SMC_SETUP_NCS_WR(0) |
@@ -142,8 +142,9 @@ static void meesc_ethercat_hw_init(void)
 
 int dram_init(void)
 {
-	gd->bd->bi_dram[0].start = PHYS_SDRAM;
-	gd->bd->bi_dram[0].size = get_ram_size((long *) PHYS_SDRAM, (1 << 27));
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+	gd->bd->bi_dram[0].size = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE,
+					(1 << 27));
 	return 0;
 }
 
@@ -151,7 +152,7 @@ int board_eth_init(bd_t *bis)
 {
 	int rc = 0;
 #ifdef CONFIG_MACB
-	rc = macb_eth_initialize(0, (void *)AT91_EMAC_BASE, 0x00);
+	rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x00);
 #endif
 	return rc;
 }
@@ -225,7 +226,7 @@ int misc_init_r(void)
 {
 	char		*str;
 	char		buf[32];
-	at91_pmc_t	*pmc = (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	/*
 	 * Normally the processor clock has a divisor of 2.
@@ -248,22 +249,22 @@ int misc_init_r(void)
 
 int board_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	/* Peripheral Clock Enable Register */
-	writel(1 << AT91SAM9263_ID_PIOA |
-		1 << AT91SAM9263_ID_PIOB |
-		1 << AT91SAM9263_ID_PIOCDE |
-		1 << AT91SAM9263_ID_UHP,
+	writel(1 << ATMEL_ID_PIOA |
+		1 << ATMEL_ID_PIOB |
+		1 << ATMEL_ID_PIOCDE |
+		1 << ATMEL_ID_UHP,
 		&pmc->pcer);
 
 	/* initialize ET1100 Controller */
 	meesc_ethercat_hw_init();
 
 	/* adress of boot parameters */
-	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
-	at91_serial_hw_init();
+	at91_seriald_hw_init();
 #ifdef CONFIG_CMD_NAND
 	meesc_nand_hw_init();
 #endif
board/esd/otc570/config.mk deleted +0 -1
deleted file mode 100644
index e554a45..0000000
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x23f00000
board/esd/otc570/otc570.c +26 -25

141 lines not on this page · raw message

boards.cfg +4 -2
index 9b15026..77f3fc4 100644
@@ -83,8 +83,10 @@ at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel
 at91sam9xeek_dataflash_cs1   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
 top9000eval_xe               arm         arm926ejs   top9000             emk            at91        top9000:EVAL9000
 top9000su_xe                 arm         arm926ejs   top9000             emk            at91        top9000:SU9000
-meesc                        arm         arm926ejs   -                   esd            at91
-otc570                       arm         arm926ejs   -                   esd            at91
+meesc                        arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_NANDFLASH
+meesc_dataflash              arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_DATAFLASH
+otc570                       arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_NANDFLASH
+otc570_dataflash             arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_DATAFLASH
 pm9261                       arm         arm926ejs   -                   ronetix        at91
 pm9263                       arm         arm926ejs   -                   ronetix        at91
 da830evm                     arm         arm926ejs   da8xxevm            davinci        davinci
include/configs/meesc.h +89 -61

235 lines not on this page · raw message

include/configs/otc570.h +102 -77

287 lines not on this page · raw message

Signature · 1 line
1.5.3
#1 lore raw

PATCH 2/2 at91: fixed 'esd gmbh' meesc and otc570 boards

Dear Daniel Gorsulowski,

Quoted 4 lines

---

There is still a bug in USART config. This patch is for reviewing only!

I am really at a loss how that can be, since you correctly pass the DBGU address to the driver.

board/esd/meesc/config.mk

Quoted 14 lines
  board/esd/meesc/config.mk  |    1 -
  board/esd/meesc/meesc.c    |   39 +++++-----
  board/esd/otc570/config.mk |    1 -
  board/esd/otc570/otc570.c  |   51 +++++++------
  boards.cfg                 |    6 +-
  include/configs/meesc.h    |  150 ++++++++++++++++++++++---------------
  include/configs/otc570.h   |  179 +++++++++++++++++++++++++-------------------
  7 files changed, 241 insertions(+), 186 deletions(-)

delete mode 100644 board/esd/meesc/config.mk
delete mode 100644 board/esd/otc570/config.mk

board/esd/meesc/config.mk deleted +0 -0
deleted file mode 100644

OK

board/esd/meesc/meesc.c static void meesc_ethercat_hw_init(void)

Quoted 10 lines
board/esd/meesc/meesc.c +3 -2
index 41fa3e1..46cd33c 100644
...
-	gd->bd->bi_dram[0].start = PHYS_SDRAM;
-	gd->bd->bi_dram[0].size = get_ram_size((long *) PHYS_SDRAM, (1<<  27));
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+	gd->bd->bi_dram[0].size = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE,
+					(1<<  27));

Maybe there is a suitable SIZE_128MIB (didn't check) - would look more readable ;)

board/esd/otc570/config.mk

Quoted 2 lines
board/esd/otc570/config.mk deleted +0 -0
deleted file mode 100644

OK

Quoted 12 lines
board/esd/otc570/otc570.c +1 -1
index 410d8b4..c66f99e 100644
@@ -1,5 +1,5 @@
  /*
- * (C) Copyright 2010
+ * (C) Copyright 2010-2011
   * Daniel Gorsulowski<[email protected]>
   * esd electronic system design gmbh<www.esd.eu>
   *

board/esd/otc570/otc570.c line 31

Quoted 5 lines
board/esd/otc570/otc570.c +1 -0
@@ -27,6 +27,7 @@
   */
 
  #include<common.h>
+#include<asm/io.h>
  #include<asm/arch/at91sam9263.h>

including hardware.h does include above, don't include it directly.

Quoted 5 lines
board/esd/otc570/otc570.c +0 -0
  #include<asm/arch/at91sam9_smc.h>
  #include<asm/arch/at91_common.h>
@@ -36,7 +37,6 @@
  #include<asm/arch/at91_pio.h>
  #include<asm/arch/clk.h>

board/esd/otc570/otc570.c

Quoted 10 lines
board/esd/otc570/otc570.c +3 -3
  #include<asm/arch/hardware.h>
-#include<asm/arch/io.h>
  #include<atmel_lcdc.h>
  #include<lcd.h>
  #include<netdev.h>
-	gd->bd->bi_dram[0].start = PHYS_SDRAM;
-	gd->bd->bi_dram[0].size = get_ram_size((long *) PHYS_SDRAM, (1<<  27));
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+	gd->bd->bi_dram[0].size = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE,
+					(1<<  27));

Same as above (optional)

Quoted 5 lines
boards.cfg +0 -0
index 9b15026..77f3fc4 100644

boards.cfg at91sam9xeek_dataflash_cs0 arm arm926ejs at91sam9260ek atmel · line 89

Quoted 9 lines
boards.cfg +4 -2
@@ -83,8 +83,10 @@ at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel
  at91sam9xeek_dataflash_cs1   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
  top9000eval_xe               arm         arm926ejs   top9000             emk            at91        top9000:EVAL9000
  top9000su_xe                 arm         arm926ejs   top9000             emk            at91        top9000:SU9000
-meesc                        arm         arm926ejs   -                   esd            at91
-otc570                       arm         arm926ejs   -                   esd            at91
+meesc                        arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_NANDFLASH
+meesc_dataflash              arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_DATAFLASH
+otc570                       arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_NANDFLASH
+otc570_dataflash             arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_DATAFLASH

Apparently its always a sam9263, so please don't define it here. The defines in boards.cfg should only be used for differences between variants.

Quoted 15 lines
include/configs/meesc.h +1 -1
index a27b36b..dbb97ed 100644
@@ -3,7 +3,7 @@
   * Stelian Pop<[email protected]>
   * Lead Tech Design<www.leadtechdesign.com>
   *
- * (C) Copyright 2009-2010
+ * (C) Copyright 2009-2011
   * Daniel Gorsulowski<[email protected]>
   * esd electronic system design gmbh<www.esd.eu>
   *
@@ -31,49 +31,67 @@
  #ifndef __CONFIG_H

include/configs/meesc.h line 36

Quoted 10 lines
include/configs/meesc.h +3 -5
  #define __CONFIG_H
 
-/* Common stuff */
-#define CONFIG_MEESC			1	/* Board is esd MEESC */
-#define CONFIG_ARM926EJS		1	/* This is an ARM926EJS Core */
-#define CONFIG_AT91SAM9263		1	/* It's an AT91SAM9263 SoC */
-#define CONFIG_SYS_AT91_MAIN_CLOCK	16000000/* 16.0 MHz crystal */
+/*
+ * SoC must be defined first, before hardware.h is included.
+ * In this case SoC is defined in boards.cfg.

Please define SoC here.

include/configs/meesc.h line 83

Quoted 7 lines
include/configs/meesc.h +7 -0
+ */
+#include<asm/hardware.h>
+#define CONFIG_ATMEL_USART
+#define CONFIG_USART_BASE		ATMEL_BASE_DBGU
+#define CONFIG_USART_ID			ATMEL_ID_SYS
+#define CONFIG_BAUDRATE			115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200, 19200, 38400, 57600, 9600}

I can't see any error here...

include/configs/otc570.h

Quoted 4 lines
include/configs/otc570.h +0 -0
index ca3bf26..013c837 100644

Same comments apply here.

I'll run it through checkpatch.pl later.

Best Regards,
Reinhard

#2 lore raw

PATCH 2/2 at91: fixed 'esd gmbh' meesc and otc570 boards

Quoted 9 lines · Reinhard Meyer

Dear Daniel Gorsulowski,

board/esd/meesc/meesc.c static void meesc_ethercat_hw_init(void)

Quoted 7 lines

...

board/esd/meesc/meesc.c +3 -2
-	gd->bd->bi_dram[0].start = PHYS_SDRAM;
-	gd->bd->bi_dram[0].size = get_ram_size((long *) PHYS_SDRAM, (1<<  27));
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+	gd->bd->bi_dram[0].size = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE,
+					(1<<  27));

Maybe there is a suitable SIZE_128MIB (didn't check) - would look more readable ;)

AFAIK, Wolfgang wants to get rid of the sizes.h file. So I'll replace that with something like (128*1024*1024)

Quoted 14 lines
Quoted 14 lines
board/esd/otc570/otc570.c +1 -1
index 410d8b4..c66f99e 100644
@@ -1,5 +1,5 @@
  /*
- * (C) Copyright 2010
+ * (C) Copyright 2010-2011
   * Daniel Gorsulowski<[email protected]>
   * esd electronic system design gmbh<www.esd.eu>
   *
@@ -27,6 +27,7 @@
   */
 
Quoted 4 lines

board/esd/otc570/otc570.c line 31

Quoted 3 lines
board/esd/otc570/otc570.c +1 -0
  #include<common.h>
+#include<asm/io.h>
  #include<asm/arch/at91sam9263.h>

including hardware.h does include above, don't include it directly.

Ok, I'll remove this include

...

Quoted 8 lines
Quoted 8 lines
boards.cfg +0 -0
index 9b15026..77f3fc4 100644
@@ -83,8 +83,10 @@ at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel
  at91sam9xeek_dataflash_cs1   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
  top9000eval_xe               arm         arm926ejs   top9000             emk            at91        top9000:EVAL9000
  top9000su_xe                 arm         arm926ejs   top9000             emk            at91        top9000:SU9000
Quoted 8 lines

boards.cfg at91sam9xeek_dataflash_cs0 arm arm926ejs at91sam9260ek atmel · line 89

Quoted 6 lines
boards.cfg +4 -2
-meesc                        arm         arm926ejs   -                   esd            at91
-otc570                       arm         arm926ejs   -                   esd            at91
+meesc                        arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_NANDFLASH
+meesc_dataflash              arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_DATAFLASH
+otc570                       arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_NANDFLASH
+otc570_dataflash             arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_DATAFLASH

Apparently its always a sam9263, so please don't define it here. The defines in boards.cfg should only be used for differences between variants.

I'll move that to board config files

Quoted 17 lines
Quoted 17 lines
include/configs/meesc.h +1 -1
index a27b36b..dbb97ed 100644
@@ -3,7 +3,7 @@
   * Stelian Pop<[email protected]>
   * Lead Tech Design<www.leadtechdesign.com>
   *
- * (C) Copyright 2009-2010
+ * (C) Copyright 2009-2011
   * Daniel Gorsulowski<[email protected]>
   * esd electronic system design gmbh<www.esd.eu>
   *
@@ -31,49 +31,67 @@
  #ifndef __CONFIG_H
  #define __CONFIG_H
 
Quoted 9 lines

include/configs/meesc.h line 36

Quoted 8 lines
include/configs/meesc.h +3 -5
-/* Common stuff */
-#define CONFIG_MEESC			1	/* Board is esd MEESC */
-#define CONFIG_ARM926EJS		1	/* This is an ARM926EJS Core */
-#define CONFIG_AT91SAM9263		1	/* It's an AT91SAM9263 SoC */
-#define CONFIG_SYS_AT91_MAIN_CLOCK	16000000/* 16.0 MHz crystal */
+/*
+ * SoC must be defined first, before hardware.h is included.
+ * In this case SoC is defined in boards.cfg.

Please define SoC here.

See beyond...

...

Quoted 5 lines

I'll run it through checkpatch.pl later.

Best Regards,
Reinhard

Best regards,
Daniel

#3 lore raw

PATCH 2/2 at91: fixed 'esd gmbh' meesc and otc570 boards

Dear Daniel Gorsulowski,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Maybe there is a suitable SIZE_128MIB (didn't check) - would look more readable ;)

AFAIK, Wolfgang wants to get rid of the sizes.h file. So I'll replace

Correct.

Quoted 1 line

that with something like (128*1024*1024)

Fine - or use (128 << 20) which is equally good readable.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
There is an order of things in this universe.
	-- Apollo, "Who Mourns for Adonais?" stardate 3468.1