add icnova sam9g45 board
Subsystems (2)
PATCH 4/4 add icnova sam9g45 board
From: Marcel <[email protected]>
--- Makefile | 4 + board/in-circuit/icnova/Makefile | 54 ++++++ board/in-circuit/icnova/at91_nand.c | 131 +++++++++++++++ board/in-circuit/icnova/config.mk | 1 + board/in-circuit/icnova/flash2x8.c | 242 +++++++++++++++++++++++++++ board/in-circuit/icnova/icnova_arm.c | 259 +++++++++++++++++++++++++++++ board/in-circuit/icnova/nand.h | 2 + board/in-circuit/icnova/u-boot.lds | 73 ++++++++ include/configs/icnova_sam9g45.h | 305 ++++++++++++++++++++++++++++++++++ 9 files changed, 1071 insertions(+), 0 deletions(-) create mode 100644 board/in-circuit/icnova/Makefile create mode 100644 board/in-circuit/icnova/at91_nand.c create mode 100644 board/in-circuit/icnova/config.mk create mode 100644 board/in-circuit/icnova/flash2x8.c create mode 100644 board/in-circuit/icnova/icnova_arm.c create mode 100644 board/in-circuit/icnova/nand.h create mode 100644 board/in-circuit/icnova/u-boot.lds create mode 100644 include/configs/icnova_sam9g45.h
Makefile +4 -0
@@ -887,6 +887,10 @@ pm9g45_config : unconfig @mkdir -p $(obj)include @$(MKCONFIG) -a pm9g45 arm arm926ejs pm9g45 ronetix at91 +icnova_sam9g45_config : unconfig + @mkdir -p $(obj)include + @$(MKCONFIG) -a icnova_sam9g45 arm arm926ejs icnova in-circuit at91 + SBC35_A9G20_NANDFLASH_config \ SBC35_A9G20_EEPROM_config \ SBC35_A9G20_config : unconfig
board/in-circuit/icnova/Makefile new file +54 -0
54 lines not on this page · raw message
board/in-circuit/icnova/at91_nand.c new file +131 -0
131 lines not on this page · raw message
board/in-circuit/icnova/config.mk new file +1 -0
@@ -0,0 +1 @@ +CONFIG_SYS_TEXT_BASE = 0x73f00000
board/in-circuit/icnova/flash2x8.c new file +242 -0
242 lines not on this page · raw message
board/in-circuit/icnova/icnova_arm.c new file +259 -0
259 lines not on this page · raw message
board/in-circuit/icnova/nand.h new file +2 -0
@@ -0,0 +1,2 @@ + +void icnova_nand_hw_init (void );
board/in-circuit/icnova/u-boot.lds new file +73 -0
73 lines not on this page · raw message
include/configs/icnova_sam9g45.h new file +305 -0
305 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH 4/4 add icnova sam9g45 board
Dear Marcel Janssen,
Quoted 4 lines
From: Marcel<[email protected]>
Signed-off-by Marcel<[email protected]>---
Sorry, this patch has to be rejected for several reasond, see below.
Quoted 1 line
Makefile | 4 +
Nope, boards must be added to boards.cfg.
Quoted 2 lines
board/in-circuit/icnova/Makefile | 54 ++++++ board/in-circuit/icnova/at91_nand.c | 131 +++++++++++++++
Can you elaborate why the common atmel_nand code will not do?
Quoted 1 line
board/in-circuit/icnova/config.mk | 1 +
config.mk is not needed anymore.
Quoted 1 line
board/in-circuit/icnova/flash2x8.c | 242 +++++++++++++++++++++++++++
Same here: why can't the CFI code be used?
Quoted 18 lines
board/in-circuit/icnova/icnova_arm.c | 259 +++++++++++++++++++++++++++++ board/in-circuit/icnova/nand.h | 2 + board/in-circuit/icnova/u-boot.lds | 73 ++++++++ include/configs/icnova_sam9g45.h | 305 ++++++++++++++++++++++++++++++++++9 files changed, 1071 insertions(+), 0 deletions(-)create mode 100644 board/in-circuit/icnova/Makefile create mode 100644
board/in-circuit/icnova/at91_nand.ccreate mode 100644board/in-circuit/icnova/config.mkcreate mode 100644board/in-circuit/icnova/flash2x8.ccreate mode 100644board/in-circuit/icnova/icnova_arm.ccreate mode 100644board/in-circuit/icnova/nand.hcreate mode 100644board/in-circuit/icnova/u-boot.ldscreate mode 100644include/configs/icnova_sam9g45.hboard/in-circuit/icnova/at91_nand.c new file +0
-0
board/in-circuit/icnova/at91_nand.c line 53
Quoted 6 lines
board/in-circuit/icnova/at91_nand.c new file +6
-0+#define CFG_NAND_ALE 21 +#define CFG_NAND_CLE 22 +#define MASK_ALE (1<< CFG_NAND_ALE) +#define MASK_CLE (1<< CFG_NAND_CLE) +#define CFG_NAND_CE AT91_PIN_PC8 +#define CFG_NAND_RDY AT91_PIN_PC11
This clearly belongs into the board-configuration .h file.
Quoted 27 lines
board/in-circuit/icnova/at91_nand.c new file +27
-0+void icnova_nand_hw_init (void ) +{ +unsigned long csa; + +/* Enable CS3 */ + csa =at91_sys_read (AT91_MATRIX_EBICSA ); +at91_sys_write (AT91_MATRIX_EBICSA , + csa |AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA ); + +/* Configure SMC CS3 for NAND/SmartMedia */ +at91_sys_write (AT91_SMC_SETUP (3 ), +AT91_SMC_NWESETUP_ (8 ) |AT91_SMC_NCS_WRSETUP_ (0 ) | +AT91_SMC_NRDSETUP_ (8 ) |AT91_SMC_NCS_RDSETUP_ (0 )); +at91_sys_write (AT91_SMC_PULSE (3 ), +AT91_SMC_NWEPULSE_ (28 ) |AT91_SMC_NCS_WRPULSE_ (20 ) | +AT91_SMC_NRDPULSE_ (28 ) |AT91_SMC_NCS_RDPULSE_ (20 )); +at91_sys_write (AT91_SMC_CYCLE (3 ), +AT91_SMC_NWECYCLE_ (36 ) |AT91_SMC_NRDCYCLE_ (36 )); +at91_sys_write (AT91_SMC_MODE (3 ), +AT91_SMC_READMODE |AT91_SMC_WRITEMODE | +AT91_SMC_EXNWMODE_DISABLE | +#ifdef CONFIG_SYS_NAND_DBW_16 +AT91_SMC_DBW_16 | +#else /* CONFIG_SYS_NAND_DBW_8 */ +AT91_SMC_DBW_8 | +#endif +AT91_SMC_TDF_ (3 ));
board/in-circuit/icnova/at91_nand.c line 131
Quoted 10 lines
board/in-circuit/icnova/at91_nand.c new file +10
-0+ +at91_sys_write (AT91_PMC_PCER ,1 <<AT91SAM9G45_ID_PIOC ); + +/* Configure RDY/BSY */ +at91_set_gpio_input (CFG_NAND_RDY ,1 ); + +/* Enable NandFlash */ +at91_set_gpio_output (CFG_NAND_CE ,1 ); +} +
Have a look at the at91sam9260ek port in the rework tree how this should look like.
board/in-circuit/icnova/config.mk line 1
Quoted 3 lines
board/in-circuit/icnova/config.mk new file +1
-0+CONFIG_SYS_TEXT_BASE = 0x73f00000
Belongs into board-configuration .h
board/in-circuit/icnova/flash2x8.c line 24
Quoted 3 lines
board/in-circuit/icnova/flash2x8.c new file +1
-0+#ifndef CONFIG_ICNOVA_ARM9
What is that supposed to mean? Are there non-ARM9 boards handled by the same software?
board/in-circuit/icnova/flash2x8.c line 31
Quoted 7 lines
board/in-circuit/icnova/flash2x8.c new file +7
-0+#include <asm/cacheflush.h> +#include <asm/sections.h> +#else +#define dcache_flush_unlocked () while(0) +#define sync_write_buffer () while(0) +#define uncached (addr) addr +#endif
All those defines don't seem to make sense or belong into this file.
Quoted 1 line
+static void
flash_identify(uint16_t *flash, flash_info_t *info)
...
Quoted 1 line
+unsigned long
flash_init(void)
...
Quoted 1 line
+void
flash_print_info(flash_info_t *info)
...
Quoted 1 line
+int
flash_erase(flash_info_t *info, int s_first, int s_last)
...
Quoted 1 line
+int write_buff(flash_info_t *info, uchar *src,
... etc ...
All those seem to be more or less extract from the common flash code.
board/in-circuit/icnova/icnova_arm.c
Quoted 2 lines
board/in-circuit/icnova/icnova_arm.c new file +0
-0
Again: why emphase on the _arm here?
Quoted 1 line
+//#include<usb.h>
No C++ style comments, and no dead code!
Quoted 1 line
+#if defined(CONFIG_RESET_PHY_R)&&
defined(CONFIG_MACB)
We see the RESET_PHY stuff criss-cross copied all over AT91, but it appears that is required only by a few boards.
Make sure that, when you copy code, that you understands its function and the applicability to your hardware.
Quoted 1 line
+#if 0
Thought as much... RESET_PHY apparently is not needed. And #if dead code is not allowed.
Quoted 3 lines
board/in-circuit/icnova/icnova_arm.c new file +3
-0+ rstc =readl (AT91_BASE_SYS +AT91_RSTC_MR ); + +/* Need to reset PHY -> 500ms reset */
...
Quoted 23 lines
board/in-circuit/icnova/icnova_arm.c new file +23
-0+#endif +int checkboard (void ) +{ +char myboard =0 ; +#ifdef CONFIG_ICNOVA_ARM9 +printf ("Board : SAM9G45oem\n" ); +#endif +printf ("------------------------\n" ); +printf ("memory \n" ); +printf ("SDRAM base 0x%08x\n" ,CONFIG_SYS_SDRAM_BASE ); +printf ("NAND base 0x%08x\n" ,CONFIG_SYS_NAND_BASE ); +printf ("NOR base 0x%08x\n" ,CONFIG_SYS_FLASH_BASE ); +printf ("ENV addr 0x%08x\n" ,CONFIG_ENV_ADDR ); +printf ("------------------------\n" ); +printf ("Interfaces \n" ); +#ifdef CONFIG_MACB +printf ("Ethernet\n" ); +#endif +#ifdef CONFIG_USB_ATMEL +printf ("USB host\n" ); +#endif +#ifdef CONFIG_USB_GADGET +printf ("USB gadget : " );
board/in-circuit/icnova/icnova_arm.c line 175
Quoted 10 lines
board/in-circuit/icnova/icnova_arm.c new file +10
-0+#ifdef CONFIG_USBD_DFU +printf ("DFU\n" ); +#endif +#ifdef CONFIG_USB_ETHER +printf ("CDC\n" ); +#endif +#endif +printf ("------------------------\n" ); +printf ("\n" ); +return 0 ;
Such verbatim output is not required and most of it is handled by generic code already.
board/in-circuit/icnova/icnova_arm.c line 195
Quoted 6 lines
board/in-circuit/icnova/icnova_arm.c new file +6
-0+int board_init (void ) +{ +/* Enable Ctrlc */ +console_init_f (); + + gd->bd->bi_arch_number =MACH_TYPE_AT91SAM9G45EKES ;
Excuse me, is that board identical to at91sam9g45ek/es? If not, you need your own mach-id!
Wrong indentation with spaces.
board/in-circuit/icnova/icnova_arm.c line 224
Quoted 3 lines
board/in-circuit/icnova/icnova_arm.c new file +3
-0+int dram_init (void ) +{ + gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ;
This is already broken with relocation!
Quoted 8 lines
board/in-circuit/icnova/icnova_arm.c new file +8
-0+ gd->ram_size =get_ram_size ( + (void *)CONFIG_SYS_SDRAM_BASE , +CONFIG_SYS_SDRAM_SIZE ); +return 0 ; +} + +#ifdef CONFIG_RESET_PHY_R +void reset_phy (void )
board/in-circuit/icnova/icnova_arm.c line 242
Quoted 10 lines
board/in-circuit/icnova/icnova_arm.c new file +10
-0+{ +#ifdef CONFIG_MACB +/* +* Initialize ethernet HW addr prior to starting Linux, +* needed for nfsroot +*/ +//eth_init(gd->bd); +#endif +} +#endif
This is a completely dead function, and again C++ style comments are not allowed.
board/in-circuit/icnova/icnova_arm.c line 251
Quoted 9 lines
board/in-circuit/icnova/icnova_arm.c new file +9
-0+ +int board_eth_init (bd_t *bis) +{ +int rc =0 ; + +#if defined(CONFIG_USB_ETHER )&& defined(CONFIG_USB_GADGET_ATMEL_USBA ) + rc =usba_udc_probe (&brd); +if (!rc) + rc =usb_eth_initialize (bis);
Wrong indentation.
board/in-circuit/icnova/nand.h line 2
Quoted 8 lines
board/in-circuit/icnova/nand.h new file +2
-0@@ -0,0 +1,2 @@ + +void icnova_nand_hw_init (void );
A file for only one define? Probably that could go into the board-configuration. Or becomes obsolete if common NAND code is used. Or, like in other board ports, the NAND init goes into the main board file.
board/in-circuit/icnova/u-boot.lds
Quoted 2 lines
board/in-circuit/icnova/u-boot.lds new file +0
-0
Again, why does the common .lds file not do?
include/configs/icnova_sam9g45.h line 36
Quoted 3 lines
include/configs/icnova_sam9g45.h new file +1
-0+//#define DEBUG
Nope. (//)
Quoted 8 lines
include/configs/icnova_sam9g45.h new file +8
-0+#define CONFIG_ARM926EJS /* This is an ARM926EJS Core */ +#define CONFIG_ICNOVA_ARM9 /* It's an ICnova SAM9G45 OEM boardR */ +#define CONFIG_AT91SAM9G45 /* It's an Atmel AT91SAM9G45 SoC */ +#define CONFIG_AT91FAMILY +#define CONFIG_ARCH_AT91 +#define CONFIG_AT91_LEGACY/* needed for some defines */ +#define CONFIG_ARCH_CPU_INIT +#undef CONFIG_USE_IRQ/* we don't need IRQ/FIQ stuff */
include/configs/icnova_sam9g45.h line 54
Quoted 10 lines
include/configs/icnova_sam9g45.h new file +10
-0+ +/* this General purpose register is used to trigger +* u-boot to wait for connection. For example, this can +* be used to upgrade the application image in th efollowing way +* 1) host sets the GPBR via Linux. +* 2) host reboots the device +* 3) u-boot reads the GPBR +* 4) u-boot will wait for new firmware +*/ +#define CONFIG_USE_ATMEL_GPBR1 1
Does the mean to define GPBR1 to be defined or to the value of 1? We could add that GPBR1 use to at91_gpbr.h. Discussion is open here.
Quoted 1 line
+//#define
CONFIG_CMD_PORTIO
No //, no dead stuff.
include/configs/icnova_sam9g45.h line 96
Quoted 8 lines
include/configs/icnova_sam9g45.h new file +8
-0+ +/* Hardware drivers */ +#define CONFIG_AT91_GPIO +#define CONFIG_ATMEL_USART +#undef CONFIG_USART0 +#undef CONFIG_USART1 +#undef CONFIG_USART2 +#define CONFIG_USART3 /* USART 3 is DBGU */
This is broken.
Quoted 1 line
+#define
CONFIG_SYS_GBL_DATA_SIZE128 /* 128 bytes for initial data */
Broken.
Please have a look at the at91sam9260ek port how it should look like and read my post
Subject: [U-Boot] [STATUS: AT91/AVR32]
Message-ID: <[email protected]>
Date: Tue, 08 Feb 2011 16:35:16 +0100
Best Regards,
Reinhard
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 4/4 add icnova sam9g45 board
Dear Marcel Janssen,
Quoted 4 lines
Hi Remy and Reinhard,
Quoted 2 lines
To make it easy for you: It is up to you if you choose '
rework_110202'
...
Quoted 2 lines
It looks like if
at91sam9g45.hhas not been updated. Is that right ? If so, should all be changed toATMEL_IDandATMEL_BASE?
That is correct. Only 9260/1/3 are reworked so far.
If someone would rework the 9g45 in the spirit of the 9260 it would be great. Please as a separate patch. Same goes for the other SoCs ;)
Best Regards,
Reinhard
PATCH 4/4 add icnova sam9g45 board
Quoted 9 lines · Reinhard Meyer
Dear Marcel Janssen,
Quoted 4 lines
Hi Remy and Reinhard,
Quoted 2 lines
To make it easy for you: It is up to you if you choose '
rework_110202'...
Quoted 7 lines
Quoted 2 lines
It looks like if
at91sam9g45.hhas not been updated. Is that right ? If so, should all be changed toATMEL_IDandATMEL_BASE?That is correct. Only 9260/1/3 are reworked so far.
If someone would rework the 9g45 in the spirit of the 9260 it would be great. Please as a separate patch. Same goes for the other SoCs ;)
I did most of that. I just hit this :
drivers/mtd/cfi_flash.c:576: undefined reference to `reset_timer'
Any idea how to fix it ?
regards,
Marcel
PATCH 4/4 add icnova sam9g45 board
Dear Marcel Janssen,
Quoted 9 lines · Reinhard Meyer
Quoted 2 lines
If someone would rework the 9g45 in the spirit of the 9260 it would be great. Please as a separate patch. Same goes for the other SoCs ;)
I did most of that. I just hit this :
drivers/mtd/cfi_flash.c:576: undefined reference to `reset_timer'Any idea how to fix it ?
Basically the same way I fixed nand_base.c a while ago:
void nand_wait_ready(struct mtd_info *mtd)
{
struct nand_chip *chip = mtd->priv;
u32 timeo = (CONFIG_SYS_HZ * 20) / 1000;
u32 time_start;
time_start = get_timer(0);
/* wait until command is processed or timeout occures */
while (get_timer(time_start) < timeo) {
if (chip->dev_ready)
if (chip->dev_ready(mtd))
break;
}
}Best Regards,
Reinhard