Re: [U-Boot] [PATCH 4/4] add icnova sam9g45 board
Dear Marcel Janssen, > On Tuesday, February 15, 2011 01:00:50 am Reinhard Meyer wrote: >> 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] add icnova sam9g45 board
On Tuesday, February 15, 2011 01:00:50 am Reinhard Meyer wrote: > Dear Marcel Janssen, > > > Hi Remy and Reinhard, > > > >> To make it easy for you: It is up to you if you choose ' > >> rework_110202' > > ... > > > It looks like if at91sam9g45.h has not been updated. Is that right ? > > If so, should all be changed to ATMEL_ID and ATMEL_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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] add icnova sam9g45 board
Dear Marcel Janssen, > Hi Remy and Reinhard, > >> To make it easy for you: It is up to you if you choose ' >> rework_110202' ... > It looks like if at91sam9g45.h has not been updated. Is that right ? > If so, should all be changed to ATMEL_ID and ATMEL_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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] add icnova sam9g45 board
Dear Marcel Janssen, > From: Marcel > > Signed-off-by: Marcel > --- Sorry, this patch has to be rejected for several reasond, see below. > Makefile |4 + Nope, boards must be added to boards.cfg. > 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? > board/in-circuit/icnova/config.mk|1 + config.mk is not needed anymore. > board/in-circuit/icnova/flash2x8.c | 242 +++ Same here: why can't the CFI code be used? > 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 > > diff --git a/board/in-circuit/icnova/at91_nand.c > b/board/in-circuit/icnova/at91_nand.c > new file mode 100644 > +#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. > +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)); > + > + 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. > diff --git a/board/in-circuit/icnova/config.mk > b/board/in-circuit/icnova/config.mk > new file mode 100644 > +CONFIG_SYS_TEXT_BASE = 0x73f0 Belongs into board-configuration .h > diff --git a/board/in-circuit/icnova/flash2x8.c > b/board/in-circuit/icnova/flash2x8.c > new file mode 100644 > +#ifndef CONFIG_ICNOVA_ARM9 What is that supposed to mean? Are there non-ARM9 boards handled by the same software? > +#include > +#include > +#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. > +static void flash_identify(uint16_t *flash, flash_info_t *info) ... > +unsigned long flash_init(void) ... > +void flash_print_info(flash_info_t *info) ... > +int flash_erase(flash_info_t *info, int s_first, int s_last) ... > +int write_buff(flash_info_t *info, uchar *src, ... etc ... All those seem to be more or less extract from the common flash code. > diff --git a/board/in-circuit/icnova/icnova_arm.c > b/board/in-circuit/icnova/icnova_arm.c > new file mode 100644 Again: why emphase on the _arm here? > +//#include No C++ style comments, and no dead code! > +#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. > +#if 0 Thought as much... RESET_PHY apparently is not needed. And #if dead code is not allowed. > + rstc = readl(AT91_BASE_SYS + AT91_RSTC_MR); > + > + /* Nee
[U-Boot] [PATCH 4/4] add icnova sam9g45 board
From: Marcel Signed-off-by: Marcel --- 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 diff --git a/Makefile b/Makefile index 05b404d..c3f72d5 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/board/in-circuit/icnova/Makefile b/board/in-circuit/icnova/Makefile new file mode 100644 index 000..00e1e2c --- /dev/null +++ b/board/in-circuit/icnova/Makefile @@ -0,0 +1,54 @@ +# +# (C) Copyright 2001-2006 +# Wolfgang Denk, DENX Software Engineering, w...@denx.de. +# +# Copyright (C) 2005-2006 Atmel Corporation +# +# (C) 2008 - 2010 Benjamin Tietz, In-Circuit benjamin.ti...@in-circuit.de +# +# 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 +include $(TOPDIR)/include/config.mk + +LIB:= $(obj)lib$(BOARD).o + +COBJS := $(BOARD).o flash.o + +COBJS := icnova_arm.o flash2x8.o +ifdef CONFIG_CMD_NAND +COBJS += at91_nand.o +endif + +COBJS-y += $(COBJS) +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) + +# $(obj).depend +$(LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# diff --git a/board/in-circuit/icnova/at91_nand.c b/board/in-circuit/icnova/at91_nand.c new file mode 100644 index 000..87e3b2e --- /dev/null +++ b/board/in-circuit/icnova/at91_nand.c @@ -0,0 +1,131 @@ +/* + * (C) 2010 + * Benjamin Tietz, In-Circuit + * + * (C) Copyright 2007-2008 + * Stelian Pop + * Lead Tech Design + * + * (C) Copyright 2006 ATMEL Rousset, Lacressonniere Nicolas + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* + * hardware specific access to control-lines + */ + +#define CFG_NAND_ALE 21 +#define CFG_NAND_CLE 22 +#defineMASK_ALE(1 << CFG_NAND_ALE) +#defineMASK_CLE(1 << CFG_NAND_CLE) +#define