All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
@ 2009-07-21 15:53 Albin Tonnerre
  2009-07-21 17:40 ` Wolfgang Denk
  0 siblings, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-07-21 15:53 UTC (permalink / raw)
  To: u-boot

The Calao TNY-A9260 board is a board manufactured and sold by Calao
Systems <http://www.calao-systems.com>. Its components are very
similar to the AT91SAM9260EK board, so its configuration is based on
the configuration of this board. There are however some differences:
different clocks, no LCD, no ethernet. It also uses SPI EEPROM to store
the environment.
The SPI chip is a STM95080, and as it's used in a number of CALAO boards
which should be supported soon, the corresponding spi_read and spi_write
functions have been put in drivers/spi/eeprom_m95xxx.c
---
 MAINTAINERS                              |    4 +
 MAKEALL                                  |    1 +
 Makefile                                 |   12 +++
 board/calao/tny_a9260/Makefile           |   55 ++++++++++
 board/calao/tny_a9260/config.mk          |    1 +
 board/calao/tny_a9260/spi.c              |   49 +++++++++
 board/calao/tny_a9260/tny_a9260.c        |  102 +++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 drivers/spi/Makefile                     |    1 +
 drivers/spi/eeprom_m95xxx.c              |  114 +++++++++++++++++++++
 include/configs/tny_a9260.h              |  158 ++++++++++++++++++++++++++++++
 11 files changed, 498 insertions(+), 1 deletions(-)
 create mode 100644 board/calao/tny_a9260/Makefile
 create mode 100644 board/calao/tny_a9260/config.mk
 create mode 100644 board/calao/tny_a9260/spi.c
 create mode 100644 board/calao/tny_a9260/tny_a9260.c
 create mode 100644 drivers/spi/eeprom_m95xxx.c
 create mode 100644 include/configs/tny_a9260.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 575a7ec..1ba1921 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -624,6 +624,10 @@ Peter Pearse <peter.pearse@arm.com>
 	versatile	ARM926EJ-S
 	versatile	ARM926EJ-S
 
+Albin Tonnerre <albin.tonnerre@free-electrons.com>
+
+	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
+
 Dave Peverley <dpeverley@mpc-data.co.uk>
 
 	omap730p2	ARM926EJS
diff --git a/MAKEALL b/MAKEALL
index 020ff73..59b65d2 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -599,6 +599,7 @@ LIST_at91="			\
 	m501sk			\
 	pm9261			\
 	pm9263			\
+	tny_a9260	\
 "
 
 #########################################################################
diff --git a/Makefile b/Makefile
index 25a6254..d05abd9 100644
--- a/Makefile
+++ b/Makefile
@@ -2807,6 +2807,18 @@ at91sam9g45ekes_config	:	unconfig
 pm9263_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
 
+tny_a9260_nandflash_config \
+tny_a9260_eeprom_config \
+tny_a9260_config	:	unconfig
+	@if [ "$(findstring _nandflash,$@)" ] ; then \
+		$(XECHO) "#define CONFIG_ENV_IS_IN_NAND"		>>$(obj)include/config.h ; \
+		$(XECHO) "... with environment variable in NAND FLASH" ; \
+	else \
+		$(XECHO) "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
+		$(XECHO) "... with environment variable in SPI EEPROM CS1" ; \
+	fi;
+	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
+
 ########################################################################
 ## ARM Integrator boards - see doc/README-integrator for more info.
 integratorap_config	\
diff --git a/board/calao/tny_a9260/Makefile b/board/calao/tny_a9260/Makefile
new file mode 100644
index 0000000..21f5ed1
--- /dev/null
+++ b/board/calao/tny_a9260/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= tny_a9260.o
+COBJS-$(CONFIG_ATMEL_SPI)	+= spi.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/calao/tny_a9260/config.mk b/board/calao/tny_a9260/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/calao/tny_a9260/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/calao/tny_a9260/spi.c b/board/calao/tny_a9260/spi.c
new file mode 100644
index 0000000..e02955f
--- /dev/null
+++ b/board/calao/tny_a9260/spi.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2009 Albin Tonnerre <albin.tonnerre@free-electrons.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/hardware.h>
+#include <asm/arch/at91_spi.h>
+#include <asm/arch/gpio.h>
+#include <spi.h>
+
+#define TNY_A9260_CS_PIN	AT91_PIN_PC11
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c
new file mode 100644
index 0000000..cedcdbd
--- /dev/null
+++ b/board/calao/tny_a9260/tny_a9260.c
@@ -0,0 +1,102 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009 Albin Tonnerre <albin.tonnerre@free-electrons.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/at91sam9260.h>
+#include <asm/arch/at91sam9260_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void tny_a9260_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_CS3A_SMC_SMARTMEDIA);
+
+	/* Configure SMC CS3 for NAND/SmartMedia */
+	at91_sys_write(AT91_SMC_SETUP(3),
+		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC_PULSE(3),
+		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+	at91_sys_write(AT91_SMC_CYCLE(3),
+		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+	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_(2));
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+
+	/* Configure RDY/BSY */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+	/* Enable NandFlash */
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();
+
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	at91_serial_hw_init();
+	tny_a9260_nand_hw_init();
+	at91_spi0_hw_init(1 << 5 | 1 << 1);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	gd->bd->bi_dram[0].size = get_ram_size(PHYS_SDRAM, PHYS_SDRAM_SIZE);
+	return 0;
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index 5309ba2..f86cb99 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -75,7 +75,7 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index a9f67a0..35c9e02 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
+COBJS-$(CONFIG_M95XXX_SPI) += eeprom_m95xxx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/spi/eeprom_m95xxx.c b/drivers/spi/eeprom_m95xxx.c
new file mode 100644
index 0000000..0b9f983
--- /dev/null
+++ b/drivers/spi/eeprom_m95xxx.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2009 Albin Tonnerre <albin.tonnerre@free-electrons.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 <spi.h>
+
+#define SPI_EEPROM_WREN		0x06
+#define SPI_EEPROM_RDSR		0x05
+#define SPI_EEPROM_READ		0x03
+#define SPI_EEPROM_WRITE	0x02
+
+#ifndef CONFIG_DEFAULT_SPI_BUS
+#define CONFIG_DEFAULT_SPI_BUS 0
+#endif
+
+#ifndef CONFIG_DEFAULT_SPI_MODE
+#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
+#endif
+
+ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	u8 cmd = SPI_EEPROM_READ;
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	/* command */
+	if(spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN))
+		return -1;
+
+	/* if alen == 3, addr[0] is the block number, we never use it here. All we
+	 * need are the lower 16 bits*/
+	if (alen == 3)
+		addr++;
+
+	/* address, and data */
+	if(spi_xfer(slave, 16, addr, NULL, 0))
+		return -1;
+	if(spi_xfer(slave, 8*len, NULL, buffer, SPI_XFER_END))
+		return -1;
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
+
+ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	int i;
+	char buf[3];
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	buf[0] = SPI_EEPROM_WREN;
+	if(spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	buf[0] = SPI_EEPROM_WRITE;
+
+	/* As for reading, drop addr[0] if alen is 3 */
+	if (alen == 3) {
+		alen--;
+		addr++;
+	}
+
+	memcpy(buf+1, addr, alen);
+	/* command + addr, then data */
+	if(spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN))
+		return -1;
+	if(spi_xfer(slave, len*8, buffer, NULL, SPI_XFER_END))
+		return -1;
+
+	for (i = 0; i < 1000; i++) {
+		buf[0] = SPI_EEPROM_RDSR;
+		buf[1] = 0;
+		spi_xfer(slave, 16, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END);
+
+		if (!(buf[1] & 1)) {
+			break;
+		}
+		udelay(1000);
+	}
+	if (i >= 1000) {
+		printf ("*** spi_write: Time out while writing!\n");
+	}
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
new file mode 100644
index 0000000..1dcbb97
--- /dev/null
+++ b/include/configs/tny_a9260.h
@@ -0,0 +1,158 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009 Albin Tonnerre <albin.tonnerre@free-electrons.com>
+ *
+ * Configuation settings for the Calao TNY-A9260 board
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+/* ARM asynchronous clock */
+#define AT91_MAIN_CLOCK		12000000	/* 12 MHz crystal */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core	*/
+
+#define CONFIG_AT91SAM9260	1	/* It's an Atmel AT91SAM9260 SoC*/
+
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART	1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3		1	/* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY	3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_USB
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
+#define AT91_SPI_CLK			15000000
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_M95XXX_SPI
+#define CONFIG_SYS_EEPROM_SIZE 0x10000
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
+
+/* NAND flash */
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE		1
+#define CONFIG_SYS_NAND_BASE			0x40000000
+#define CONFIG_SYS_NAND_DBW_8			1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
+#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
+
+/* NOR flash - no real flash on this board */
+#define CONFIG_SYS_NO_FLASH			1
+
+#define CONFIG_DOS_PARTITION		1
+#define CONFIG_CMD_FAT			1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Env in EEPROM, bootstrap + u-boot in NAND*/
+#ifdef CONFIG_ENV_IS_IN_EEPROM
+#define CONFIG_ENV_OFFSET		0x20
+#define CONFIG_ENV_SIZE		0x1000
+#endif
+
+/* Env, bootstrap and u-boot in NAND */
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x60000
+#define CONFIG_ENV_OFFSET_REDUND 0x80000
+#define CONFIG_ENV_SIZE 0x20000
+#endif
+
+#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
+#define CONFIG_BOOTARGS     "console=ttyS0,115200 " \
+                            "root=/dev/mtdblock1 " \
+                            "mtdparts=atmel_nand:16M(kernel)ro," \
+                            "120M(rootfs),-(other) " \
+                            "rw rootfstype=jffs2"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT		"U-Boot> "
+#define CONFIG_SYS_CBSIZE		256
+#define CONFIG_SYS_MAXARGS		16
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP		1
+#define CONFIG_CMDLINE_EDITING	1
+
+#define ROUND(A, B)		(((A) + (B)) & ~((B) - 1))
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
  2009-07-21 15:53 [U-Boot] [PATCH] Support for the Calao TNY-A9260 board Albin Tonnerre
@ 2009-07-21 17:40 ` Wolfgang Denk
  2009-07-21 18:02   ` Albin Tonnerre
  2009-07-24  8:32   ` [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
  0 siblings, 2 replies; 36+ messages in thread
From: Wolfgang Denk @ 2009-07-21 17:40 UTC (permalink / raw)
  To: u-boot

Dear Albin Tonnerre,

In message <1248191599-23258-1-git-send-email-albin.tonnerre@free-electrons.com> you wrote:
> The Calao TNY-A9260 board is a board manufactured and sold by Calao
> Systems <http://www.calao-systems.com>. Its components are very
> similar to the AT91SAM9260EK board, so its configuration is based on
> the configuration of this board. There are however some differences:
> different clocks, no LCD, no ethernet. It also uses SPI EEPROM to store
> the environment.
> The SPI chip is a STM95080, and as it's used in a number of CALAO boards
> which should be supported soon, the corresponding spi_read and spi_write
> functions have been put in drivers/spi/eeprom_m95xxx.c
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 575a7ec..1ba1921 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -624,6 +624,10 @@ Peter Pearse <peter.pearse@arm.com>
>  	versatile	ARM926EJ-S
>  	versatile	ARM926EJ-S
>  
> +Albin Tonnerre <albin.tonnerre@free-electrons.com>
> +
> +	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
> +
>  Dave Peverley <dpeverley@mpc-data.co.uk>
>  
>  	omap730p2	ARM926EJS

Please keep list of names alphabetically sorted.

> diff --git a/MAKEALL b/MAKEALL
> index 020ff73..59b65d2 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -599,6 +599,7 @@ LIST_at91="			\
>  	m501sk			\
>  	pm9261			\
>  	pm9263			\
> +	tny_a9260	\
>  "
>  
>  #########################################################################
> diff --git a/Makefile b/Makefile
> index 25a6254..d05abd9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2807,6 +2807,18 @@ at91sam9g45ekes_config	:	unconfig
>  pm9263_config	:	unconfig
>  	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
>  
> +tny_a9260_nandflash_config \
> +tny_a9260_eeprom_config \
> +tny_a9260_config	:	unconfig
> +	@if [ "$(findstring _nandflash,$@)" ] ; then \
> +		$(XECHO) "#define CONFIG_ENV_IS_IN_NAND"		>>$(obj)include/config.h ; \
> +		$(XECHO) "... with environment variable in NAND FLASH" ; \
> +	else \
> +		$(XECHO) "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
> +		$(XECHO) "... with environment variable in SPI EEPROM CS1" ; \
> +	fi;
> +	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91

Do we need such verbosity? And is there really only a single
environment variable as the message claims?

...
> +int dram_init(void)
> +{
> +	gd->bd->bi_dram[0].start = PHYS_SDRAM;
> +	gd->bd->bi_dram[0].size = get_ram_size(PHYS_SDRAM, PHYS_SDRAM_SIZE);
> +	return 0;

Hm... no error checking here?

...
> diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
> new file mode 100644
> index 0000000..1dcbb97
> --- /dev/null
> +++ b/include/configs/tny_a9260.h
...
> +#define ROUND(A, B)		(((A) + (B)) & ~((B) - 1))

Please do not redefine. 

Don't you get a warning message at least?

Best regards,

Wolfgang Denk

-- 
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: wd at denx.de
Documentation is the castor oil of programming.
Managers know it must be good because the programmers hate it so much.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
  2009-07-21 17:40 ` Wolfgang Denk
@ 2009-07-21 18:02   ` Albin Tonnerre
  2009-07-22  7:33     ` Wolfgang Denk
  2009-07-24  8:32   ` [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-07-21 18:02 UTC (permalink / raw)
  To: u-boot

On Tue, Jul 21, 2009 at 07:40:39PM +0200, Wolfgang Denk wrote :
> >  #########################################################################
> > diff --git a/Makefile b/Makefile
> > index 25a6254..d05abd9 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -2807,6 +2807,18 @@ at91sam9g45ekes_config	:	unconfig
> >  pm9263_config	:	unconfig
> >  	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
> >  
> > +tny_a9260_nandflash_config \
> > +tny_a9260_eeprom_config \
> > +tny_a9260_config	:	unconfig
> > +	@if [ "$(findstring _nandflash,$@)" ] ; then \
> > +		$(XECHO) "#define CONFIG_ENV_IS_IN_NAND"		>>$(obj)include/config.h ; \
> > +		$(XECHO) "... with environment variable in NAND FLASH" ; \
> > +	else \
> > +		$(XECHO) "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
> > +		$(XECHO) "... with environment variable in SPI EEPROM CS1" ; \
> > +	fi;
> > +	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
> 
> Do we need such verbosity? And is there really only a single
> environment variable as the message claims?
> 

I just copied what's currently done for a number of at91-based boards, but fair
enough, I'll remove it.

> ...
> > +int dram_init(void)
> > +{
> > +	gd->bd->bi_dram[0].start = PHYS_SDRAM;
> > +	gd->bd->bi_dram[0].size = get_ram_size(PHYS_SDRAM, PHYS_SDRAM_SIZE);
> > +	return 0;
> 
> Hm... no error checking here?
>

Will fix, thanks

> ...
> > diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
> > new file mode 100644
> > index 0000000..1dcbb97
> > --- /dev/null
> > +++ b/include/configs/tny_a9260.h
> ...
> > +#define ROUND(A, B)		(((A) + (B)) & ~((B) - 1))
> 
> Please do not redefine. 
> 
> Don't you get a warning message at least?

ROUND doesn't seem to be defined anywhere except in include/configs, at least in
the master branch. Is there another branch where ROUND is defined in some common
place, so that I rebase my patch on this ?

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090721/f03e92e6/attachment.pgp 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
  2009-07-21 18:02   ` Albin Tonnerre
@ 2009-07-22  7:33     ` Wolfgang Denk
  2009-07-22  8:16       ` Albin Tonnerre
  0 siblings, 1 reply; 36+ messages in thread
From: Wolfgang Denk @ 2009-07-22  7:33 UTC (permalink / raw)
  To: u-boot

Dear Albin Tonnerre,

In message <20090721180214.GA6415@pc-ras4041.res.insa> you wrote:
> 
> > > +++ b/include/configs/tny_a9260.h
> > ...
> > > +#define ROUND(A, B)		(((A) + (B)) & ~((B) - 1))
> > 
> > Please do not redefine. 
> > 
> > Don't you get a warning message at least?
>
> ROUND doesn't seem to be defined anywhere except in include/configs, at least in
> the master branch. Is there another branch where ROUND is defined in some common
> place, so that I rebase my patch on this ?

Please check again; this patch was posted last Friday:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/64071

Best regards,

Wolfgang Denk

-- 
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: wd at denx.de
Status quo. Latin for "the mess we're in."

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
  2009-07-22  7:33     ` Wolfgang Denk
@ 2009-07-22  8:16       ` Albin Tonnerre
  2009-07-22  9:47         ` Wolfgang Denk
  0 siblings, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-07-22  8:16 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

On Wed, Jul 22, 2009 at 09:33:15AM +0200, Wolfgang Denk wrote :
> Please check again; this patch was posted last Friday:
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/64071

I'm not sure how to use this patch. Including <common.h> from
include/configs/tny_a9260.h makes the compile fail. Am I overlooking something
here ?

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090722/a84a32d3/attachment.pgp 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
  2009-07-22  8:16       ` Albin Tonnerre
@ 2009-07-22  9:47         ` Wolfgang Denk
  2009-07-22 11:03           ` Albin Tonnerre
  0 siblings, 1 reply; 36+ messages in thread
From: Wolfgang Denk @ 2009-07-22  9:47 UTC (permalink / raw)
  To: u-boot

Dear Albin Tonnerre,

In message <20090722081651.GA13794@pc-ras4041.res.insa> you wrote:
> 
> On Wed, Jul 22, 2009 at 09:33:15AM +0200, Wolfgang Denk wrote :
> > Please check again; this patch was posted last Friday:
> > http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/64071
> 
> I'm not sure how to use this patch. Including <common.h> from

Just rebase your tree against current mainline.

> include/configs/tny_a9260.h makes the compile fail. Am I overlooking something
> here ?

You should not have to include <common.h>; it's already included
virtually everywhere.

Best regards,

Wolfgang Denk

-- 
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: wd at denx.de
It may be bad manners to talk with your mouth full, but it isn't  too
good either if you speak when your head is empty.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
  2009-07-22  9:47         ` Wolfgang Denk
@ 2009-07-22 11:03           ` Albin Tonnerre
  2009-07-22 11:13             ` Wolfgang Denk
  0 siblings, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-07-22 11:03 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

On Wed, Jul 22, 2009 at 11:47:36AM +0200, Wolfgang Denk wrote :
> Just rebase your tree against current mainline.

Ah, it's in git now, thanks.

> > include/configs/tny_a9260.h makes the compile fail. Am I overlooking something
> > here ?
> 
> You should not have to include <common.h>; it's already included
> virtually everywhere.

cpu/arm926ejs/start.S includes directly <config.h>, which in turns includes the
config file, but nowhere is common.h included, leading to

start.S:168: Error: garbage following instruction -- `sub r0,r0,#ROUND(3*0x1000+128*1024,0x1000)'

What's the best way to fix this ?

Cheers,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090722/43c46098/attachment.pgp 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260 board
  2009-07-22 11:03           ` Albin Tonnerre
@ 2009-07-22 11:13             ` Wolfgang Denk
  0 siblings, 0 replies; 36+ messages in thread
From: Wolfgang Denk @ 2009-07-22 11:13 UTC (permalink / raw)
  To: u-boot

Dear Albin Tonnerre,

In message <20090722110303.GC13794@pc-ras4041.res.insa> you wrote:
> 
> > You should not have to include <common.h>; it's already included
> > virtually everywhere.
>
> cpu/arm926ejs/start.S includes directly <config.h>, which in turns includes the
> config file, but nowhere is common.h included, leading to
>
> start.S:168: Error: garbage following instruction -- `sub r0,r0,#ROUND(3*0x> 1000+128*1024,0x1000)'

Arghh.. Seems the mising feedback for the patch was caused by nobody
actually testing it, not by nobody having any problems with it. Sorry
for that.

> What's the best way to fix this ?

Hm... give me a few minutes to think about this.

Best regards,

Wolfgang Denk

-- 
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: wd at denx.de
How much net work could a network work, if a network could net work?

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-07-21 17:40 ` Wolfgang Denk
  2009-07-21 18:02   ` Albin Tonnerre
@ 2009-07-24  8:32   ` Albin Tonnerre
  2009-08-01 14:15     ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-07-24  8:32 UTC (permalink / raw)
  To: u-boot

The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by Calao
Systems <http://www.calao-systems.com>. Their components are very
similar to the AT91SAM9260EK board, so their configuration is based on
the configuration of this board. There are however some differences:
different clocks, no LCD, no ethernet. They also uses SPI EEPROM to store
the environment.
The SPI chip is a STM95080, and as it's used in a number of CALAO boards
which should be supported soon, the corresponding spi_read and spi_write
functions have been put in drivers/spi/eeprom_m95xxx.c

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
Changelog since v1:
 - Make the Makefile less verbose
 - Add error checking for the result of get_ram_size
 - Remove definition of the ROUND macro in configs/tny_a9260.h
 - Move the MAINTAINERS entry to the correct place
 - Add support for TNY-A9G20 in the process. The board is similar
   to the TNY-A9260 except for the CPU, so this only adds a couple
   ifdefs
 - Minor formatting changes in comments

 MAINTAINERS                              |    4 +
 MAKEALL                                  |    1 +
 Makefile                                 |   18 ++++
 board/calao/tny_a9260/Makefile           |   55 ++++++++++
 board/calao/tny_a9260/config.mk          |    1 +
 board/calao/tny_a9260/spi.c              |   50 +++++++++
 board/calao/tny_a9260/tny_a9260.c        |  110 ++++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 drivers/spi/Makefile                     |    1 +
 drivers/spi/eeprom_m95xxx.c              |  115 +++++++++++++++++++++
 include/configs/tny_a9260.h              |  165 ++++++++++++++++++++++++++++++
 11 files changed, 521 insertions(+), 1 deletions(-)
 create mode 100644 board/calao/tny_a9260/Makefile
 create mode 100644 board/calao/tny_a9260/config.mk
 create mode 100644 board/calao/tny_a9260/spi.c
 create mode 100644 board/calao/tny_a9260/tny_a9260.c
 create mode 100644 drivers/spi/eeprom_m95xxx.c
 create mode 100644 include/configs/tny_a9260.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 17b2f9c..54477b3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -675,6 +675,10 @@ Andrea Scian <andrea.scian@dave-tech.it>
 
 	B2		ARM7TDMI (S3C44B0X)
 
+Albin Tonnerre <albin.tonnerre@free-electrons.com>
+
+	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
+
 Greg Ungerer <greg.ungerer@opengear.com>
 
 	cm4008		ks8695p
diff --git a/MAKEALL b/MAKEALL
index d38904a..20b22a6 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -602,6 +602,7 @@ LIST_at91="			\
 	m501sk			\
 	pm9261			\
 	pm9263			\
+	tny_a9260	\
 "
 
 #########################################################################
diff --git a/Makefile b/Makefile
index 2320db6..d9a093d 100644
--- a/Makefile
+++ b/Makefile
@@ -2811,6 +2811,24 @@ at91sam9g45ekes_config	:	unconfig
 pm9263_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
 
+tny_a9g20_nandflash_config \
+tny_a9g20_eeprom_config \
+tny_a9g20_config \
+tny_a9260_nandflash_config \
+tny_a9260_eeprom_config \
+tny_a9260_config	:	unconfig
+	@if [ "$(findstring _nandflash,$@)" ] ; then \
+		echo "#define CONFIG_ENV_IS_IN_NAND"	>>$(obj)include/config.h ; \
+	else \
+		echo "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
+	fi;
+	@if [ "$(findstring _a9g20,$@)" ] ; then \
+		echo "#define CONFIG_TNY_A9G20"	>>$(obj)include/config.h ; \
+	else \
+		echo "#define CONFIG_TNY_A9260"	>>$(obj)include/config.h ; \
+	fi;
+	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
+
 ########################################################################
 ## ARM Integrator boards - see doc/README-integrator for more info.
 integratorap_config	\
diff --git a/board/calao/tny_a9260/Makefile b/board/calao/tny_a9260/Makefile
new file mode 100644
index 0000000..21f5ed1
--- /dev/null
+++ b/board/calao/tny_a9260/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= tny_a9260.o
+COBJS-$(CONFIG_ATMEL_SPI)	+= spi.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/calao/tny_a9260/config.mk b/board/calao/tny_a9260/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/calao/tny_a9260/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/calao/tny_a9260/spi.c b/board/calao/tny_a9260/spi.c
new file mode 100644
index 0000000..2db9f84
--- /dev/null
+++ b/board/calao/tny_a9260/spi.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/hardware.h>
+#include <asm/arch/at91_spi.h>
+#include <asm/arch/gpio.h>
+#include <spi.h>
+
+#define TNY_A9260_CS_PIN	AT91_PIN_PC11
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c
new file mode 100644
index 0000000..6a97cc4
--- /dev/null
+++ b/board/calao/tny_a9260/tny_a9260.c
@@ -0,0 +1,110 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/at91sam9260.h>
+#include <asm/arch/at91sam9_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void tny_a9260_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_CS3A_SMC_SMARTMEDIA);
+
+	/* Configure SMC CS3 for NAND/SmartMedia */
+	at91_sys_write(AT91_SMC_SETUP(3),
+		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC_PULSE(3),
+		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+	at91_sys_write(AT91_SMC_CYCLE(3),
+		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+	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_(2));
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+
+	/* Configure RDY/BSY */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+	/* Enable NandFlash */
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();
+
+#if defined(CONFIG_TNY_A9260)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
+#elif defined(CONFIG_TNY_A9G20)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
+#endif
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	at91_serial_hw_init();
+	tny_a9260_nand_hw_init();
+	at91_spi0_hw_init(1 << 5 | 1 << 1);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
+		return -1;
+
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index 5309ba2..f86cb99 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -75,7 +75,7 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index a9f67a0..35c9e02 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
+COBJS-$(CONFIG_M95XXX_SPI) += eeprom_m95xxx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/spi/eeprom_m95xxx.c b/drivers/spi/eeprom_m95xxx.c
new file mode 100644
index 0000000..9298c9f
--- /dev/null
+++ b/drivers/spi/eeprom_m95xxx.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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 <spi.h>
+
+#define SPI_EEPROM_WREN		0x06
+#define SPI_EEPROM_RDSR		0x05
+#define SPI_EEPROM_READ		0x03
+#define SPI_EEPROM_WRITE	0x02
+
+#ifndef CONFIG_DEFAULT_SPI_BUS
+#define CONFIG_DEFAULT_SPI_BUS 0
+#endif
+
+#ifndef CONFIG_DEFAULT_SPI_MODE
+#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
+#endif
+
+ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	u8 cmd = SPI_EEPROM_READ;
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	/* command */
+	if(spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN))
+		return -1;
+
+	/* if alen == 3, addr[0] is the block number, we never use it here. All we
+	 * need are the lower 16 bits*/
+	if (alen == 3)
+		addr++;
+
+	/* address, and data */
+	if(spi_xfer(slave, 16, addr, NULL, 0))
+		return -1;
+	if(spi_xfer(slave, 8*len, NULL, buffer, SPI_XFER_END))
+		return -1;
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
+
+ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	int i;
+	char buf[3];
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	buf[0] = SPI_EEPROM_WREN;
+	if(spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	buf[0] = SPI_EEPROM_WRITE;
+
+	/* As for reading, drop addr[0] if alen is 3 */
+	if (alen == 3) {
+		alen--;
+		addr++;
+	}
+
+	memcpy(buf+1, addr, alen);
+	/* command + addr, then data */
+	if(spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN))
+		return -1;
+	if(spi_xfer(slave, len*8, buffer, NULL, SPI_XFER_END))
+		return -1;
+
+	for (i = 0; i < 1000; i++) {
+		buf[0] = SPI_EEPROM_RDSR;
+		buf[1] = 0;
+		spi_xfer(slave, 16, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END);
+
+		if (!(buf[1] & 1)) {
+			break;
+		}
+		udelay(1000);
+	}
+	if (i >= 1000) {
+		printf ("*** spi_write: Time out while writing!\n");
+	}
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
new file mode 100644
index 0000000..ac4422a
--- /dev/null
+++ b/include/configs/tny_a9260.h
@@ -0,0 +1,165 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
+ *
+ * Configuation settings for the Calao TNY-A9260 board
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+
+/* ARM asynchronous clock */
+#define AT91_MAIN_CLOCK		12000000	/* 12 MHz crystal */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core	*/
+
+#if defined(CONFIG_TNY_A9260)
+#define CONFIG_AT91SAM9260	1	/* It's an Atmel AT91SAM9260 SoC*/
+#elif defined(CONFIG_TNY_A9G20)
+#define CONFIG_AT91SAM9G20
+#else
+#error "Unknown board"
+#endif
+
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART	1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3		1	/* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY	3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_USB
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
+#define AT91_SPI_CLK			15000000
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_M95XXX_SPI
+#define CONFIG_SYS_EEPROM_SIZE 0x10000
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
+
+/* NAND flash */
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE		1
+#define CONFIG_SYS_NAND_BASE			0x40000000
+#define CONFIG_SYS_NAND_DBW_8			1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
+#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
+
+/* NOR flash - no real flash on this board */
+#define CONFIG_SYS_NO_FLASH			1
+
+#define CONFIG_DOS_PARTITION		1
+#define CONFIG_CMD_FAT			1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Env in EEPROM, bootstrap + u-boot in NAND*/
+#ifdef CONFIG_ENV_IS_IN_EEPROM
+#define CONFIG_ENV_OFFSET		0x20
+#define CONFIG_ENV_SIZE		0x1000
+#endif
+
+/* Env, bootstrap and u-boot in NAND */
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x60000
+#define CONFIG_ENV_OFFSET_REDUND 0x80000
+#define CONFIG_ENV_SIZE 0x20000
+#endif
+
+#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
+#define CONFIG_BOOTARGS     "console=ttyS0,115200 " \
+                            "root=/dev/mtdblock1 " \
+                            "mtdparts=atmel_nand:16M(kernel)ro," \
+                            "120M(rootfs),-(other) " \
+                            "rw rootfstype=jffs2"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT		"U-Boot> "
+#define CONFIG_SYS_CBSIZE		256
+#define CONFIG_SYS_MAXARGS		16
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP		1
+#define CONFIG_CMDLINE_EDITING	1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-07-24  8:32   ` [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
@ 2009-08-01 14:15     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-03  7:54       ` Albin Tonnerre
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-01 14:15 UTC (permalink / raw)
  To: u-boot

On 10:32 Fri 24 Jul     , Albin Tonnerre wrote:
> The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by Calao
> Systems <http://www.calao-systems.com>. Their components are very
> similar to the AT91SAM9260EK board, so their configuration is based on
> the configuration of this board. There are however some differences:
> different clocks, no LCD, no ethernet. They also uses SPI EEPROM to store
> the environment.
eeprom for the env?
why not in the same storage as u-boot
> The SPI chip is a STM95080, and as it's used in a number of CALAO boards
> which should be supported soon, the corresponding spi_read and spi_write
> functions have been put in drivers/spi/eeprom_m95xxx.c
> 
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> ---
> Changelog since v1:
>  - Make the Makefile less verbose
>  - Add error checking for the result of get_ram_size
>  - Remove definition of the ROUND macro in configs/tny_a9260.h
>  - Move the MAINTAINERS entry to the correct place
>  - Add support for TNY-A9G20 in the process. The board is similar
>    to the TNY-A9260 except for the CPU, so this only adds a couple
>    ifdefs
>  - Minor formatting changes in comments
please split in two patch one the the eeprom and one for the board
> 
>  MAINTAINERS                              |    4 +
>  MAKEALL                                  |    1 +
>  Makefile                                 |   18 ++++
>  board/calao/tny_a9260/Makefile           |   55 ++++++++++
>  board/calao/tny_a9260/config.mk          |    1 +
>  board/calao/tny_a9260/spi.c              |   50 +++++++++
>  board/calao/tny_a9260/tny_a9260.c        |  110 ++++++++++++++++++++
>  cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
>  drivers/spi/Makefile                     |    1 +
>  drivers/spi/eeprom_m95xxx.c              |  115 +++++++++++++++++++++
>  include/configs/tny_a9260.h              |  165 ++++++++++++++++++++++++++++++
>  11 files changed, 521 insertions(+), 1 deletions(-)
>  create mode 100644 board/calao/tny_a9260/Makefile
>  create mode 100644 board/calao/tny_a9260/config.mk
>  create mode 100644 board/calao/tny_a9260/spi.c
>  create mode 100644 board/calao/tny_a9260/tny_a9260.c
>  create mode 100644 drivers/spi/eeprom_m95xxx.c
>  create mode 100644 include/configs/tny_a9260.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 17b2f9c..54477b3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -675,6 +675,10 @@ Andrea Scian <andrea.scian@dave-tech.it>
>  
>  	B2		ARM7TDMI (S3C44B0X)
>  
> +Albin Tonnerre <albin.tonnerre@free-electrons.com>
> +
> +	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
> +
>  Greg Ungerer <greg.ungerer@opengear.com>
>  
>  	cm4008		ks8695p
> diff --git a/MAKEALL b/MAKEALL
> index d38904a..20b22a6 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -602,6 +602,7 @@ LIST_at91="			\
>  	m501sk			\
>  	pm9261			\
>  	pm9263			\
> +	tny_a9260	\
>  "
>  
>  #########################################################################
> diff --git a/Makefile b/Makefile
> index 2320db6..d9a093d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2811,6 +2811,24 @@ at91sam9g45ekes_config	:	unconfig
>  pm9263_config	:	unconfig
>  	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
>  
> +tny_a9g20_nandflash_config \
> +tny_a9g20_eeprom_config \
> +tny_a9g20_config \
> +tny_a9260_nandflash_config \
> +tny_a9260_eeprom_config \
> +tny_a9260_config	:	unconfig
please add
	@mkdir $(obj)include
otherwise the out of tree build will not work
> +	@if [ "$(findstring _nandflash,$@)" ] ; then \
> +		echo "#define CONFIG_ENV_IS_IN_NAND"	>>$(obj)include/config.h ; \
> +	else \
> +		echo "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
> +	fi;
> +	@if [ "$(findstring _a9g20,$@)" ] ; then \
> +		echo "#define CONFIG_TNY_A9G20"	>>$(obj)include/config.h ; \
> +	else \
> +		echo "#define CONFIG_TNY_A9260"	>>$(obj)include/config.h ; \
> +	fi;
> +	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
> +
>  ########################################################################
>  ## ARM Integrator boards - see doc/README-integrator for more info.
>  integratorap_config	\
<snip>
> +
> +int board_init(void)
> +{
> +	/* Enable Ctrlc */
> +	console_init_f();
> +
> +#if defined(CONFIG_TNY_A9260)
> +	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
> +#elif defined(CONFIG_TNY_A9G20)
> +	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
> +#endif
> +	/* adress of boot parameters */
> +	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
> +
> +	at91_serial_hw_init();
> +	tny_a9260_nand_hw_init();
> +	at91_spi0_hw_init(1 << 5 | 1 << 1);
you can remove the 1 << 1 as the dataflash driver is deprecated now
> +	return 0;
> +}
> +
> +int dram_init(void)
> +{
> +	gd->bd->bi_dram[0].start = PHYS_SDRAM;
> +	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
> +		return -1;
> +
> +	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
> +	return 0;
> +}
> diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
> index 5309ba2..f86cb99 100644
<qnip>
> +
> +/* SPI EEPROM */
> +#define CONFIG_SPI
> +#define CONFIG_CMD_SPI
> +#define CONFIG_ATMEL_SPI
> +#define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
> +#define AT91_SPI_CLK			15000000
no need please remove
> +
> +#define CONFIG_CMD_EEPROM
> +#define CONFIG_M95XXX_SPI
> +#define CONFIG_SYS_EEPROM_SIZE 0x10000
> +#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
> +
> +/* NAND flash */
> +#define CONFIG_CMD_NAND
> +#define CONFIG_NAND_ATMEL
> +#define CONFIG_SYS_MAX_NAND_DEVICE		1
> +#define CONFIG_SYS_NAND_BASE			0x40000000
> +#define CONFIG_SYS_NAND_DBW_8			1
> +/* our ALE is AD21 */
> +#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
> +/* our CLE is AD22 */
> +#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
> +#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
> +#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
> +
> +/* NOR flash - no real flash on this board */
> +#define CONFIG_SYS_NO_FLASH			1
> +
> +#define CONFIG_DOS_PARTITION		1
> +#define CONFIG_CMD_FAT			1
> +
> +#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
> +
> +#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
> +#define CONFIG_SYS_MEMTEST_END			0x23e00000
> +
> +/* Env in EEPROM, bootstrap + u-boot in NAND*/
> +#ifdef CONFIG_ENV_IS_IN_EEPROM
> +#define CONFIG_ENV_OFFSET		0x20
> +#define CONFIG_ENV_SIZE		0x1000
> +#endif
> +
> +/* Env, bootstrap and u-boot in NAND */
> +#ifdef CONFIG_ENV_IS_IN_NAND
> +#define CONFIG_ENV_OFFSET 0x60000
> +#define CONFIG_ENV_OFFSET_REDUND 0x80000
> +#define CONFIG_ENV_SIZE 0x20000
> +#endif
> +
> +#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
> +#define CONFIG_BOOTARGS     "console=ttyS0,115200 " \
whispace please fix and so on
> +                            "root=/dev/mtdblock1 " \
> +                            "mtdparts=atmel_nand:16M(kernel)ro," \
> +                            "120M(rootfs),-(other) " \
> +                            "rw rootfstype=jffs2"
> +
> +#define CONFIG_BAUDRATE		115200
> +#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
> +
Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-01 14:15     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-03  7:54       ` Albin Tonnerre
  2009-08-04 19:45         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-03  7:54 UTC (permalink / raw)
  To: u-boot

On Sat, Aug 01, 2009 at 04:15:32PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> On 10:32 Fri 24 Jul     , Albin Tonnerre wrote:
> > The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by Calao
> > Systems <http://www.calao-systems.com>. Their components are very
> > similar to the AT91SAM9260EK board, so their configuration is based on
> > the configuration of this board. There are however some differences:
> > different clocks, no LCD, no ethernet. They also uses SPI EEPROM to store
> > the environment.
> eeprom for the env?
> why not in the same storage as u-boot

Storing the environment in the NAND is also an option, as you can see in the
board configuration.

> please add
> 	@mkdir $(obj)include
> otherwise the out of tree build will not work

So I guess all the other at91-based boards need fixing too ? They don't seem to
do that.

> > +	at91_serial_hw_init();
> > +	tny_a9260_nand_hw_init();
> > +	at91_spi0_hw_init(1 << 5 | 1 << 1);
> you can remove the 1 << 1 as the dataflash driver is deprecated now

I'm not sure what you mean. There's no dataflash on this board. From what I can
see, 1 << 1 is required to set the PC5 pin on the B peripheral controller, and
PC5 happens to be the chip select pin for the on-board SPI EEPROM. Am I missing
something here ?

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-03  7:54       ` Albin Tonnerre
@ 2009-08-04 19:45         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-05 17:16           ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-04 19:45 UTC (permalink / raw)
  To: u-boot

On 09:54 Mon 03 Aug     , Albin Tonnerre wrote:
> On Sat, Aug 01, 2009 at 04:15:32PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> > On 10:32 Fri 24 Jul     , Albin Tonnerre wrote:
> > > The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by Calao
> > > Systems <http://www.calao-systems.com>. Their components are very
> > > similar to the AT91SAM9260EK board, so their configuration is based on
> > > the configuration of this board. There are however some differences:
> > > different clocks, no LCD, no ethernet. They also uses SPI EEPROM to store
> > > the environment.
> > eeprom for the env?
> > why not in the same storage as u-boot
> 
> Storing the environment in the NAND is also an option, as you can see in the
> board configuration.
> 
> > please add
> > 	@mkdir $(obj)include
> > otherwise the out of tree build will not work
???
all other at91 board do it
> 
> So I guess all the other at91-based boards need fixing too ? They don't seem to
> do that.
> 
> > > +	at91_serial_hw_init();
> > > +	tny_a9260_nand_hw_init();
> > > +	at91_spi0_hw_init(1 << 5 | 1 << 1);
> > you can remove the 1 << 1 as the dataflash driver is deprecated now
> 
> I'm not sure what you mean. There's no dataflash on this board. From what I can
> see, 1 << 1 is required to set the PC5 pin on the B peripheral controller, and
> PC5 happens to be the chip select pin for the on-board SPI EEPROM. Am I missing
> something here ?
this is for hardware chip select which we do not use as we use gpio instead

Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM
  2009-08-04 19:45         ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-05 17:16           ` Albin Tonnerre
  2009-08-05 17:16             ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
  2009-08-05 19:24             ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-05 17:16 UTC (permalink / raw)
  To: u-boot

This chip is used in a number of boards manufactured by Calao-Systems
which should be supported soon. This driver provides the necessary
spi_read and spi_write functions necessary to communicate with the chip.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
 drivers/spi/Makefile        |    1 +
 drivers/spi/eeprom_m95xxx.c |  115 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/eeprom_m95xxx.c

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index a9f67a0..35c9e02 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
 COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
+COBJS-$(CONFIG_M95XXX_SPI) += eeprom_m95xxx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/spi/eeprom_m95xxx.c b/drivers/spi/eeprom_m95xxx.c
new file mode 100644
index 0000000..9298c9f
--- /dev/null
+++ b/drivers/spi/eeprom_m95xxx.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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 <spi.h>
+
+#define SPI_EEPROM_WREN		0x06
+#define SPI_EEPROM_RDSR		0x05
+#define SPI_EEPROM_READ		0x03
+#define SPI_EEPROM_WRITE	0x02
+
+#ifndef CONFIG_DEFAULT_SPI_BUS
+#define CONFIG_DEFAULT_SPI_BUS 0
+#endif
+
+#ifndef CONFIG_DEFAULT_SPI_MODE
+#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
+#endif
+
+ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	u8 cmd = SPI_EEPROM_READ;
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	/* command */
+	if(spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN))
+		return -1;
+
+	/* if alen == 3, addr[0] is the block number, we never use it here. All we
+	 * need are the lower 16 bits*/
+	if (alen == 3)
+		addr++;
+
+	/* address, and data */
+	if(spi_xfer(slave, 16, addr, NULL, 0))
+		return -1;
+	if(spi_xfer(slave, 8*len, NULL, buffer, SPI_XFER_END))
+		return -1;
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
+
+ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	int i;
+	char buf[3];
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	buf[0] = SPI_EEPROM_WREN;
+	if(spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	buf[0] = SPI_EEPROM_WRITE;
+
+	/* As for reading, drop addr[0] if alen is 3 */
+	if (alen == 3) {
+		alen--;
+		addr++;
+	}
+
+	memcpy(buf+1, addr, alen);
+	/* command + addr, then data */
+	if(spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN))
+		return -1;
+	if(spi_xfer(slave, len*8, buffer, NULL, SPI_XFER_END))
+		return -1;
+
+	for (i = 0; i < 1000; i++) {
+		buf[0] = SPI_EEPROM_RDSR;
+		buf[1] = 0;
+		spi_xfer(slave, 16, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END);
+
+		if (!(buf[1] & 1)) {
+			break;
+		}
+		udelay(1000);
+	}
+	if (i >= 1000) {
+		printf ("*** spi_write: Time out while writing!\n");
+	}
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-05 17:16           ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
@ 2009-08-05 17:16             ` Albin Tonnerre
  2009-08-05 19:30               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-05 19:24             ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-05 17:16 UTC (permalink / raw)
  To: u-boot

The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
Calao Systems <http://www.calao-systems.com>. Their components are very
similar to the AT91SAM9260EK board, so their configuration is based on
the configuration of this board. There are however some differences:
different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
store the environment.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
 MAINTAINERS                              |    4 +
 MAKEALL                                  |    1 +
 Makefile                                 |   19 ++++
 board/calao/tny_a9260/Makefile           |   55 ++++++++++
 board/calao/tny_a9260/config.mk          |    1 +
 board/calao/tny_a9260/spi.c              |   50 +++++++++
 board/calao/tny_a9260/tny_a9260.c        |  110 ++++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 include/configs/tny_a9260.h              |  164 ++++++++++++++++++++++++++++++
 9 files changed, 405 insertions(+), 1 deletions(-)
 create mode 100644 board/calao/tny_a9260/Makefile
 create mode 100644 board/calao/tny_a9260/config.mk
 create mode 100644 board/calao/tny_a9260/spi.c
 create mode 100644 board/calao/tny_a9260/tny_a9260.c
 create mode 100644 include/configs/tny_a9260.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 620604c..79873f3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -681,6 +681,10 @@ Andrea Scian <andrea.scian@dave-tech.it>
 
 	B2		ARM7TDMI (S3C44B0X)
 
+Albin Tonnerre <albin.tonnerre@free-electrons.com>
+
+	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
+
 Greg Ungerer <greg.ungerer@opengear.com>
 
 	cm4008		ks8695p
diff --git a/MAKEALL b/MAKEALL
index dd0b761..7a583df 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -607,6 +607,7 @@ LIST_at91="			\
 	m501sk			\
 	pm9261			\
 	pm9263			\
+	tny_a9260	\
 "
 
 #########################################################################
diff --git a/Makefile b/Makefile
index 8096f91..f3e7aa3 100644
--- a/Makefile
+++ b/Makefile
@@ -2838,6 +2838,25 @@ at91sam9g45ekes_config	:	unconfig
 pm9263_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
 
+tny_a9g20_nandflash_config \
+tny_a9g20_eeprom_config \
+tny_a9g20_config \
+tny_a9260_nandflash_config \
+tny_a9260_eeprom_config \
+tny_a9260_config	:	unconfig
+	@mkdir -p $(obj)include
+	@if [ "$(findstring _nandflash,$@)" ] ; then \
+		echo "#define CONFIG_ENV_IS_IN_NAND"	>>$(obj)include/config.h ; \
+	else \
+		echo "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
+	fi;
+	@if [ "$(findstring _a9g20,$@)" ] ; then \
+		echo "#define CONFIG_TNY_A9G20"	>>$(obj)include/config.h ; \
+	else \
+		echo "#define CONFIG_TNY_A9260"	>>$(obj)include/config.h ; \
+	fi;
+	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
+
 ########################################################################
 ## ARM Integrator boards - see doc/README-integrator for more info.
 integratorap_config	\
diff --git a/board/calao/tny_a9260/Makefile b/board/calao/tny_a9260/Makefile
new file mode 100644
index 0000000..21f5ed1
--- /dev/null
+++ b/board/calao/tny_a9260/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= tny_a9260.o
+COBJS-$(CONFIG_ATMEL_SPI)	+= spi.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/calao/tny_a9260/config.mk b/board/calao/tny_a9260/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/calao/tny_a9260/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/calao/tny_a9260/spi.c b/board/calao/tny_a9260/spi.c
new file mode 100644
index 0000000..2db9f84
--- /dev/null
+++ b/board/calao/tny_a9260/spi.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/hardware.h>
+#include <asm/arch/at91_spi.h>
+#include <asm/arch/gpio.h>
+#include <spi.h>
+
+#define TNY_A9260_CS_PIN	AT91_PIN_PC11
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c
new file mode 100644
index 0000000..d51ca15
--- /dev/null
+++ b/board/calao/tny_a9260/tny_a9260.c
@@ -0,0 +1,110 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/at91sam9260.h>
+#include <asm/arch/at91sam9_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void tny_a9260_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_CS3A_SMC_SMARTMEDIA);
+
+	/* Configure SMC CS3 for NAND/SmartMedia */
+	at91_sys_write(AT91_SMC_SETUP(3),
+		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC_PULSE(3),
+		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+	at91_sys_write(AT91_SMC_CYCLE(3),
+		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+	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_(2));
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+
+	/* Configure RDY/BSY */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+	/* Enable NandFlash */
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();
+
+#if defined(CONFIG_TNY_A9260)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
+#elif defined(CONFIG_TNY_A9G20)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
+#endif
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	at91_serial_hw_init();
+	tny_a9260_nand_hw_init();
+	at91_spi0_hw_init(1 << 5);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
+		return -1;
+
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index 5309ba2..f86cb99 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -75,7 +75,7 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
new file mode 100644
index 0000000..9c8f201
--- /dev/null
+++ b/include/configs/tny_a9260.h
@@ -0,0 +1,164 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
+ *
+ * Configuation settings for the Calao TNY-A9260 board
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+
+/* ARM asynchronous clock */
+#define AT91_MAIN_CLOCK		12000000	/* 12 MHz crystal */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core	*/
+
+#if defined(CONFIG_TNY_A9260)
+#define CONFIG_AT91SAM9260	1	/* It's an Atmel AT91SAM9260 SoC*/
+#elif defined(CONFIG_TNY_A9G20)
+#define CONFIG_AT91SAM9G20
+#else
+#error "Unknown board"
+#endif
+
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART	1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3		1	/* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY	3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_USB
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_M95XXX_SPI
+#define CONFIG_SYS_EEPROM_SIZE 0x10000
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
+
+/* NAND flash */
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE		1
+#define CONFIG_SYS_NAND_BASE			0x40000000
+#define CONFIG_SYS_NAND_DBW_8			1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
+#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
+
+/* NOR flash - no real flash on this board */
+#define CONFIG_SYS_NO_FLASH			1
+
+#define CONFIG_DOS_PARTITION		1
+#define CONFIG_CMD_FAT			1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Env in EEPROM, bootstrap + u-boot in NAND*/
+#ifdef CONFIG_ENV_IS_IN_EEPROM
+#define CONFIG_ENV_OFFSET		0x20
+#define CONFIG_ENV_SIZE		0x1000
+#endif
+
+/* Env, bootstrap and u-boot in NAND */
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x60000
+#define CONFIG_ENV_OFFSET_REDUND 0x80000
+#define CONFIG_ENV_SIZE 0x20000
+#endif
+
+#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
+#define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
+							"root=/dev/mtdblock1 " \
+							"mtdparts=atmel_nand:16M(kernel)ro," \
+							"120M(rootfs),-(other) " \
+							"rw rootfstype=jffs2"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT		"U-Boot> "
+#define CONFIG_SYS_CBSIZE		256
+#define CONFIG_SYS_MAXARGS		16
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP		1
+#define CONFIG_CMDLINE_EDITING	1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM
  2009-08-05 17:16           ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
  2009-08-05 17:16             ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
@ 2009-08-05 19:24             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-07 10:40               ` Albin Tonnerre
  1 sibling, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-05 19:24 UTC (permalink / raw)
  To: u-boot

On 19:16 Wed 05 Aug     , Albin Tonnerre wrote:
> This chip is used in a number of boards manufactured by Calao-Systems
> which should be supported soon. This driver provides the necessary
> spi_read and spi_write functions necessary to communicate with the chip.
> 
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> ---
>  drivers/spi/Makefile        |    1 +
>  drivers/spi/eeprom_m95xxx.c |  115 +++++++++++++++++++++++++++++++++++++++++++
not sure it's the right place
drivers mtd will better IMHO
as in drivers/spi it will more for spi host drivers
and not eeprom
>  2 files changed, 116 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/spi/eeprom_m95xxx.c
> 
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index a9f67a0..35c9e02 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -33,6 +33,7 @@ COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o
>  COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
>  COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
>  COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
> +COBJS-$(CONFIG_M95XXX_SPI) += eeprom_m95xxx.o
>  
>  COBJS	:= $(COBJS-y)
>  SRCS	:= $(COBJS:.o=.c)
> diff --git a/drivers/spi/eeprom_m95xxx.c b/drivers/spi/eeprom_m95xxx.c
> new file mode 100644
> index 0000000..9298c9f
> --- /dev/null
> +++ b/drivers/spi/eeprom_m95xxx.c
> @@ -0,0 +1,115 @@
> +/*
> + * Copyright (C) 2009
> + * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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 <spi.h>
> +
> +#define SPI_EEPROM_WREN		0x06
> +#define SPI_EEPROM_RDSR		0x05
> +#define SPI_EEPROM_READ		0x03
> +#define SPI_EEPROM_WRITE	0x02
> +
> +#ifndef CONFIG_DEFAULT_SPI_BUS
> +#define CONFIG_DEFAULT_SPI_BUS 0
> +#endif
> +
> +#ifndef CONFIG_DEFAULT_SPI_MODE
> +#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
> +#endif
> +
> +ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
> +{
> +	struct spi_slave *slave;
> +	u8 cmd = SPI_EEPROM_READ;
> +
> +	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
> +			CONFIG_DEFAULT_SPI_MODE);
> +	spi_claim_bus(slave);
> +
> +	/* command */
> +	if(spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN))
> +		return -1;
> +
> +	/* if alen == 3, addr[0] is the block number, we never use it here. All we
> +	 * need are the lower 16 bits*/
please use the syle of comment
/*
 *
 */
> +	if (alen == 3)
> +		addr++;
> +
> +	/* address, and data */
> +	if(spi_xfer(slave, 16, addr, NULL, 0))
> +		return -1;
> +	if(spi_xfer(slave, 8*len, NULL, buffer, SPI_XFER_END))
please add a space before and after the '*'
> +		return -1;
> +
> +	spi_release_bus(slave);
> +	spi_free_slave(slave);
> +	return len;
> +}
> +
> +ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
> +{
> +	struct spi_slave *slave;
> +	int i;
> +	char buf[3];
> +
> +	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
> +			CONFIG_DEFAULT_SPI_MODE);
> +	spi_claim_bus(slave);
> +
> +	buf[0] = SPI_EEPROM_WREN;
> +	if(spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END))
> +		return -1;
> +
> +	buf[0] = SPI_EEPROM_WRITE;
> +
> +	/* As for reading, drop addr[0] if alen is 3 */
> +	if (alen == 3) {
> +		alen--;
> +		addr++;
> +	}
> +
> +	memcpy(buf+1, addr, alen);
please add a space before and after the '+'
> +	/* command + addr, then data */
> +	if(spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN))
> +		return -1;
> +	if(spi_xfer(slave, len*8, buffer, NULL, SPI_XFER_END))
please add a space before and after the '*'
> +		return -1;
> +
> +	for (i = 0; i < 1000; i++) {
why 1000?
> +		buf[0] = SPI_EEPROM_RDSR;
> +		buf[1] = 0;
> +		spi_xfer(slave, 16, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END);
> +
Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-05 17:16             ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
@ 2009-08-05 19:30               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-05 19:45                 ` Albin Tonnerre
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-05 19:30 UTC (permalink / raw)
  To: u-boot

Some general comment
please add space before and after '*' & co
and the ligne length limit in 80 chars
> +/* Env, bootstrap and u-boot in NAND */
> +#ifdef CONFIG_ENV_IS_IN_NAND
> +#define CONFIG_ENV_OFFSET 0x60000
> +#define CONFIG_ENV_OFFSET_REDUND 0x80000
> +#define CONFIG_ENV_SIZE 0x20000
> +#endif
> +
> +#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
> +#define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
> +							"root=/dev/mtdblock1 " \
> +							"mtdparts=atmel_nand:16M(kernel)ro," \
> +							"120M(rootfs),-(other) " \
> +							"rw rootfstype=jffs2"
here as example
> +
> +#define CONFIG_BAUDRATE		115200
> +#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
> +
> +#define CONFIG_SYS_PROMPT		"U-Boot> "
> +#define CONFIG_SYS_CBSIZE		256
> +#define CONFIG_SYS_MAXARGS		16
> +#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
> +#define CONFIG_SYS_LONGHELP		1
> +#define CONFIG_CMDLINE_EDITING	1
> +
> +/*
> + * Size of malloc() pool
> + */
> +#define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
> +#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
> +
> +#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
here too etc..
> +
> +#ifdef CONFIG_USE_IRQ
> +#error CONFIG_USE_IRQ not supported
> +#endif
Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-05 19:30               ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-05 19:45                 ` Albin Tonnerre
  2009-08-05 19:58                   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-05 19:45 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 05, 2009 at 09:30:11PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> Some general comment
> please add space before and after '*' & co
> and the ligne length limit in 80 chars

Fine. Please note that you could have pointed this out earlier, though. That
would have saved both of us some time.

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-05 19:45                 ` Albin Tonnerre
@ 2009-08-05 19:58                   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-07 10:37                     ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-05 19:58 UTC (permalink / raw)
  To: u-boot

On 21:45 Wed 05 Aug     , Albin Tonnerre wrote:
> On Wed, Aug 05, 2009 at 09:30:11PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> > Some general comment
> > please add space before and after '*' & co
> > and the ligne length limit in 80 chars
> 
> Fine. Please note that you could have pointed this out earlier, though. That
> would have saved both of us some time.
this part was updated between the 2 versions of the patch
so I put a comment

if you have one line which is a few more than 80 chars ok
but now you increase it's number so I notice you about it

otherwise the patch is clean

Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM
  2009-08-05 19:58                   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-07 10:37                     ` Albin Tonnerre
  2009-08-07 10:37                       ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
  2009-08-07 10:52                       ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-07 10:37 UTC (permalink / raw)
  To: u-boot

This chip is used in a number of boards manufactured by Calao-Systems
which should be supported soon. This driver provides the necessary
spi_read and spi_write functions necessary to communicate with the chip.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
 drivers/mtd/spi/Makefile        |    1 +
 drivers/mtd/spi/eeprom_m95xxx.c |  117 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/eeprom_m95xxx.c

diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index 27dcbff..e3e0292 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
 COBJS-$(CONFIG_SPI_FLASH_SPANSION)	+= spansion.o
 COBJS-$(CONFIG_SPI_FLASH_SST)	+= sst.o
 COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
+COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/mtd/spi/eeprom_m95xxx.c b/drivers/mtd/spi/eeprom_m95xxx.c
new file mode 100644
index 0000000..59f80e3
--- /dev/null
+++ b/drivers/mtd/spi/eeprom_m95xxx.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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 <spi.h>
+
+#define SPI_EEPROM_WREN		0x06
+#define SPI_EEPROM_RDSR		0x05
+#define SPI_EEPROM_READ		0x03
+#define SPI_EEPROM_WRITE	0x02
+
+#ifndef CONFIG_DEFAULT_SPI_BUS
+#define CONFIG_DEFAULT_SPI_BUS 0
+#endif
+
+#ifndef CONFIG_DEFAULT_SPI_MODE
+#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
+#endif
+
+ssize_t spi_read (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	u8 cmd = SPI_EEPROM_READ;
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	/* command */
+	if(spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN))
+		return -1;
+
+	/*
+	 * if alen == 3, addr[0] is the block number, we never use it here. All we
+	 * need are the lower 16 bits
+	 */
+	if (alen == 3)
+		addr++;
+
+	/* address, and data */
+	if(spi_xfer(slave, 16, addr, NULL, 0))
+		return -1;
+	if(spi_xfer(slave, 8 * len, NULL, buffer, SPI_XFER_END))
+		return -1;
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
+
+ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
+{
+	struct spi_slave *slave;
+	int i;
+	char buf[3];
+
+	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
+			CONFIG_DEFAULT_SPI_MODE);
+	spi_claim_bus(slave);
+
+	buf[0] = SPI_EEPROM_WREN;
+	if(spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END))
+		return -1;
+
+	buf[0] = SPI_EEPROM_WRITE;
+
+	/* As for reading, drop addr[0] if alen is 3 */
+	if (alen == 3) {
+		alen--;
+		addr++;
+	}
+
+	memcpy(buf + 1, addr, alen);
+	/* command + addr, then data */
+	if(spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN))
+		return -1;
+	if(spi_xfer(slave, len * 8, buffer, NULL, SPI_XFER_END))
+		return -1;
+
+	reset_timer_masked();
+	do {
+		buf[0] = SPI_EEPROM_RDSR;
+		buf[1] = 0;
+		spi_xfer(slave, 16, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END);
+
+		if (!(buf[1] & 1))
+			break;
+
+	} while (get_timer_masked() < CONFIG_SYS_SPI_WRITE_TOUT);
+
+	if (buf[1] & 1)
+		printf ("*** spi_write: Time out while writing!\n");
+
+	spi_release_bus(slave);
+	spi_free_slave(slave);
+	return len;
+}
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-07 10:37                     ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
@ 2009-08-07 10:37                       ` Albin Tonnerre
  2009-08-07 10:54                         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-09 20:38                         ` Wolfgang Denk
  2009-08-07 10:52                       ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 2 replies; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-07 10:37 UTC (permalink / raw)
  To: u-boot

The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
Calao Systems <http://www.calao-systems.com>. Their components are very
similar to the AT91SAM9260EK board, so their configuration is based on
the configuration of this board. There are however some differences:
different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
store the environment.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
 MAINTAINERS                              |    4 +
 MAKEALL                                  |    1 +
 Makefile                                 |   19 ++++
 board/calao/tny_a9260/Makefile           |   55 ++++++++++
 board/calao/tny_a9260/config.mk          |    1 +
 board/calao/tny_a9260/spi.c              |   50 +++++++++
 board/calao/tny_a9260/tny_a9260.c        |  110 ++++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 include/configs/tny_a9260.h              |  164 ++++++++++++++++++++++++++++++
 9 files changed, 405 insertions(+), 1 deletions(-)
 create mode 100644 board/calao/tny_a9260/Makefile
 create mode 100644 board/calao/tny_a9260/config.mk
 create mode 100644 board/calao/tny_a9260/spi.c
 create mode 100644 board/calao/tny_a9260/tny_a9260.c
 create mode 100644 include/configs/tny_a9260.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 620604c..79873f3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -681,6 +681,10 @@ Andrea Scian <andrea.scian@dave-tech.it>
 
 	B2		ARM7TDMI (S3C44B0X)
 
+Albin Tonnerre <albin.tonnerre@free-electrons.com>
+
+	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
+
 Greg Ungerer <greg.ungerer@opengear.com>
 
 	cm4008		ks8695p
diff --git a/MAKEALL b/MAKEALL
index dd0b761..7a583df 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -607,6 +607,7 @@ LIST_at91="			\
 	m501sk			\
 	pm9261			\
 	pm9263			\
+	tny_a9260	\
 "
 
 #########################################################################
diff --git a/Makefile b/Makefile
index 8096f91..f3e7aa3 100644
--- a/Makefile
+++ b/Makefile
@@ -2838,6 +2838,25 @@ at91sam9g45ekes_config	:	unconfig
 pm9263_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
 
+tny_a9g20_nandflash_config \
+tny_a9g20_eeprom_config \
+tny_a9g20_config \
+tny_a9260_nandflash_config \
+tny_a9260_eeprom_config \
+tny_a9260_config	:	unconfig
+	@mkdir -p $(obj)include
+	@if [ "$(findstring _nandflash,$@)" ] ; then \
+		echo "#define CONFIG_ENV_IS_IN_NAND"	>>$(obj)include/config.h ; \
+	else \
+		echo "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
+	fi;
+	@if [ "$(findstring _a9g20,$@)" ] ; then \
+		echo "#define CONFIG_TNY_A9G20"	>>$(obj)include/config.h ; \
+	else \
+		echo "#define CONFIG_TNY_A9260"	>>$(obj)include/config.h ; \
+	fi;
+	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
+
 ########################################################################
 ## ARM Integrator boards - see doc/README-integrator for more info.
 integratorap_config	\
diff --git a/board/calao/tny_a9260/Makefile b/board/calao/tny_a9260/Makefile
new file mode 100644
index 0000000..21f5ed1
--- /dev/null
+++ b/board/calao/tny_a9260/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= tny_a9260.o
+COBJS-$(CONFIG_ATMEL_SPI)	+= spi.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/calao/tny_a9260/config.mk b/board/calao/tny_a9260/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/calao/tny_a9260/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/calao/tny_a9260/spi.c b/board/calao/tny_a9260/spi.c
new file mode 100644
index 0000000..2db9f84
--- /dev/null
+++ b/board/calao/tny_a9260/spi.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/hardware.h>
+#include <asm/arch/at91_spi.h>
+#include <asm/arch/gpio.h>
+#include <spi.h>
+
+#define TNY_A9260_CS_PIN	AT91_PIN_PC11
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c
new file mode 100644
index 0000000..d51ca15
--- /dev/null
+++ b/board/calao/tny_a9260/tny_a9260.c
@@ -0,0 +1,110 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/at91sam9260.h>
+#include <asm/arch/at91sam9_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void tny_a9260_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_CS3A_SMC_SMARTMEDIA);
+
+	/* Configure SMC CS3 for NAND/SmartMedia */
+	at91_sys_write(AT91_SMC_SETUP(3),
+		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC_PULSE(3),
+		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+	at91_sys_write(AT91_SMC_CYCLE(3),
+		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+	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_(2));
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+
+	/* Configure RDY/BSY */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+	/* Enable NandFlash */
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();
+
+#if defined(CONFIG_TNY_A9260)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
+#elif defined(CONFIG_TNY_A9G20)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
+#endif
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	at91_serial_hw_init();
+	tny_a9260_nand_hw_init();
+	at91_spi0_hw_init(1 << 5);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
+		return -1;
+
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index 5309ba2..f86cb99 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -75,7 +75,7 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
new file mode 100644
index 0000000..8ca9788
--- /dev/null
+++ b/include/configs/tny_a9260.h
@@ -0,0 +1,164 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
+ *
+ * Configuation settings for the Calao TNY-A9260 board
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+
+/* ARM asynchronous clock */
+#define AT91_MAIN_CLOCK		12000000	/* 12 MHz crystal */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core */
+
+#if defined(CONFIG_TNY_A9260)
+#define CONFIG_AT91SAM9260	1	/* It's an Atmel AT91SAM9260 SoC*/
+#elif defined(CONFIG_TNY_A9G20)
+#define CONFIG_AT91SAM9G20
+#else
+#error "Unknown board"
+#endif
+
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART	1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3		1	/* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY	3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_USB
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5 * CONFIG_SYS_HZ)
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SPI_M95XXX
+#define CONFIG_SYS_EEPROM_SIZE 0x10000
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
+
+/* NAND flash */
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE		1
+#define CONFIG_SYS_NAND_BASE			0x40000000
+#define CONFIG_SYS_NAND_DBW_8			1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
+#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
+
+/* NOR flash - no real flash on this board */
+#define CONFIG_SYS_NO_FLASH			1
+
+#define CONFIG_DOS_PARTITION		1
+#define CONFIG_CMD_FAT			1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Env in EEPROM, bootstrap + u-boot in NAND*/
+#ifdef CONFIG_ENV_IS_IN_EEPROM
+#define CONFIG_ENV_OFFSET		0x20
+#define CONFIG_ENV_SIZE		0x1000
+#endif
+
+/* Env, bootstrap and u-boot in NAND */
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x60000
+#define CONFIG_ENV_OFFSET_REDUND 0x80000
+#define CONFIG_ENV_SIZE 0x20000
+#endif
+
+#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
+#define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
+				"root=/dev/mtdblock1 " \
+				"mtdparts=atmel_nand:16M(kernel)ro," \
+				"120M(rootfs),-(other) " \
+				"rw rootfstype=jffs2"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT	"U-Boot> "
+#define CONFIG_SYS_CBSIZE	256
+#define CONFIG_SYS_MAXARGS	16
+#define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP	1
+#define CONFIG_CMDLINE_EDITING	1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN	ROUND(3 * CONFIG_ENV_SIZE + 128 * 1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE	(32 * 1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM
  2009-08-05 19:24             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-07 10:40               ` Albin Tonnerre
  0 siblings, 0 replies; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-07 10:40 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 05, 2009 at 09:24:43PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> On 19:16 Wed 05 Aug     , Albin Tonnerre wrote:
> > +	for (i = 0; i < 1000; i++) {
> why 1000?

Oh, true. I meant to fix that and replace it with something similar to what
atmel_dataflash does, ie using CONFIG_SYS_SPI_WRITE_TOUT. Updated in the patch I
re-submitted.

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM
  2009-08-07 10:37                     ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
  2009-08-07 10:37                       ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
@ 2009-08-07 10:52                       ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-07 10:52 UTC (permalink / raw)
  To: u-boot

On 12:37 Fri 07 Aug     , Albin Tonnerre wrote:
> This chip is used in a number of boards manufactured by Calao-Systems
> which should be supported soon. This driver provides the necessary
> spi_read and spi_write functions necessary to communicate with the chip.
> 
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> ---
>  drivers/mtd/spi/Makefile        |    1 +
>  drivers/mtd/spi/eeprom_m95xxx.c |  117 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 118 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/mtd/spi/eeprom_m95xxx.c
looks fine

Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-07 10:37                       ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
@ 2009-08-07 10:54                         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-09 20:38                         ` Wolfgang Denk
  1 sibling, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-07 10:54 UTC (permalink / raw)
  To: u-boot

On 12:37 Fri 07 Aug     , Albin Tonnerre wrote:
> The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
> Calao Systems <http://www.calao-systems.com>. Their components are very
> similar to the AT91SAM9260EK board, so their configuration is based on
> the configuration of this board. There are however some differences:
> different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
> store the environment.
> 
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> ---
>  MAINTAINERS                              |    4 +
>  MAKEALL                                  |    1 +
>  Makefile                                 |   19 ++++
>  board/calao/tny_a9260/Makefile           |   55 ++++++++++
>  board/calao/tny_a9260/config.mk          |    1 +
>  board/calao/tny_a9260/spi.c              |   50 +++++++++
>  board/calao/tny_a9260/tny_a9260.c        |  110 ++++++++++++++++++++
>  cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
>  include/configs/tny_a9260.h              |  164 ++++++++++++++++++++++++++++++
>  9 files changed, 405 insertions(+), 1 deletions(-)
>  create mode 100644 board/calao/tny_a9260/Makefile
>  create mode 100644 board/calao/tny_a9260/config.mk
>  create mode 100644 board/calao/tny_a9260/spi.c
>  create mode 100644 board/calao/tny_a9260/tny_a9260.c
>  create mode 100644 include/configs/tny_a9260.h
> 
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-07 10:37                       ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
  2009-08-07 10:54                         ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-09 20:38                         ` Wolfgang Denk
  2009-08-09 22:40                           ` Albin Tonnerre
  2009-08-11 10:44                           ` [U-Boot] [PATCH] " Albin Tonnerre
  1 sibling, 2 replies; 36+ messages in thread
From: Wolfgang Denk @ 2009-08-09 20:38 UTC (permalink / raw)
  To: u-boot

Dear Albin Tonnerre,

In message <1249641457-16887-2-git-send-email-albin.tonnerre@free-electrons.com> you wrote:
> The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
> Calao Systems <http://www.calao-systems.com>. Their components are very
> similar to the AT91SAM9260EK board, so their configuration is based on
> the configuration of this board. There are however some differences:
> different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
> store the environment.
...
> --- a/Makefile
> +++ b/Makefile
> @@ -2838,6 +2838,25 @@ at91sam9g45ekes_config	:	unconfig
>  pm9263_config	:	unconfig
>  	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
>  
> +tny_a9g20_nandflash_config \
> +tny_a9g20_eeprom_config \
> +tny_a9g20_config \
> +tny_a9260_nandflash_config \
> +tny_a9260_eeprom_config \
> +tny_a9260_config	:	unconfig
> +	@mkdir -p $(obj)include
> +	@if [ "$(findstring _nandflash,$@)" ] ; then \
> +		echo "#define CONFIG_ENV_IS_IN_NAND"	>>$(obj)include/config.h ; \
> +	else \
> +		echo "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
> +	fi;
> +	@if [ "$(findstring _a9g20,$@)" ] ; then \
> +		echo "#define CONFIG_TNY_A9G20"	>>$(obj)include/config.h ; \
> +	else \
> +		echo "#define CONFIG_TNY_A9260"	>>$(obj)include/config.h ; \
> +	fi;
> +	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91

Please do not add such scripting to the top level Makefile. Perform it
in your board config file instead.

For an example, please see 
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/65499


Best regards,

Wolfgang Denk

-- 
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: wd at denx.de
A father doesn't destroy his children.
	-- Lt. Carolyn Palamas, "Who Mourns for Adonais?",
	   stardate 3468.1.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-09 20:38                         ` Wolfgang Denk
@ 2009-08-09 22:40                           ` Albin Tonnerre
  2009-08-11 10:44                           ` [U-Boot] [PATCH] " Albin Tonnerre
  1 sibling, 0 replies; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-09 22:40 UTC (permalink / raw)
  To: u-boot

On Sun, Aug 09, 2009 at 10:38:25PM +0200, Wolfgang Denk wrote :
> Dear Albin Tonnerre,

Hi Wolfgang,

> In message <1249641457-16887-2-git-send-email-albin.tonnerre@free-electrons.com> you wrote:
> > +tny_a9g20_nandflash_config \
> > +tny_a9g20_eeprom_config \
> > +tny_a9g20_config \
> > +tny_a9260_nandflash_config \
> > +tny_a9260_eeprom_config \
> > +tny_a9260_config	:	unconfig
> > +	@mkdir -p $(obj)include
> > +	@if [ "$(findstring _nandflash,$@)" ] ; then \
> > +		echo "#define CONFIG_ENV_IS_IN_NAND"	>>$(obj)include/config.h ; \
> > +	else \
> > +		echo "#define CONFIG_ENV_IS_IN_EEPROM"	>>$(obj)include/config.h ; \
> > +	fi;
> > +	@if [ "$(findstring _a9g20,$@)" ] ; then \
> > +		echo "#define CONFIG_TNY_A9G20"	>>$(obj)include/config.h ; \
> > +	else \
> > +		echo "#define CONFIG_TNY_A9260"	>>$(obj)include/config.h ; \
> > +	fi;
> > +	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
> 
> Please do not add such scripting to the top level Makefile. Perform it
> in your board config file instead.
> 
> For an example, please see 
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/65499

Thanks for the pointer. As the patch is already part of Jean-Christophe's ARM
pull request, do you mind if I provide a patch on top of the current one to fix
the issue, or do you want me to resubmit the whole patch ?

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-09 20:38                         ` Wolfgang Denk
  2009-08-09 22:40                           ` Albin Tonnerre
@ 2009-08-11 10:44                           ` Albin Tonnerre
  2009-08-17 21:41                             ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-11 10:44 UTC (permalink / raw)
  To: u-boot

The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
Calao Systems <http://www.calao-systems.com>. Their components are very
similar to the AT91SAM9260EK board, so their configuration is based on
the configuration of this board. There are however some differences:
different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
store the environment.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---

Changes since previous patch:
As per Wolfgang's comments, remove the scripting from the Makefile and do that
in the board config instead.

 MAINTAINERS                              |    4 +
 MAKEALL                                  |    1 +
 Makefile                                 |   10 ++
 board/calao/tny_a9260/Makefile           |   55 ++++++++++
 board/calao/tny_a9260/config.mk          |    1 +
 board/calao/tny_a9260/spi.c              |   50 +++++++++
 board/calao/tny_a9260/tny_a9260.c        |  110 +++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 include/configs/tny_a9260.h              |  170 ++++++++++++++++++++++++++++++
 9 files changed, 402 insertions(+), 1 deletions(-)
 create mode 100644 board/calao/tny_a9260/Makefile
 create mode 100644 board/calao/tny_a9260/config.mk
 create mode 100644 board/calao/tny_a9260/spi.c
 create mode 100644 board/calao/tny_a9260/tny_a9260.c
 create mode 100644 include/configs/tny_a9260.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 620604c..79873f3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -681,6 +681,10 @@ Andrea Scian <andrea.scian@dave-tech.it>
 
 	B2		ARM7TDMI (S3C44B0X)
 
+Albin Tonnerre <albin.tonnerre@free-electrons.com>
+
+	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
+
 Greg Ungerer <greg.ungerer@opengear.com>
 
 	cm4008		ks8695p
diff --git a/MAKEALL b/MAKEALL
index edebaea..5882ceb 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -607,6 +607,7 @@ LIST_at91="			\
 	m501sk			\
 	pm9261			\
 	pm9263			\
+	tny_a9260	\
 "
 
 #########################################################################
diff --git a/Makefile b/Makefile
index 54c0b67..55e9ccd 100644
--- a/Makefile
+++ b/Makefile
@@ -2838,6 +2838,16 @@ at91sam9g45ekes_config	:	unconfig
 pm9263_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
 
+tny_a9g20_nandflash_config \
+tny_a9g20_eeprom_config \
+tny_a9g20_config \
+tny_a9260_nandflash_config \
+tny_a9260_eeprom_config \
+tny_a9260_config	:	unconfig
+	@mkdir -p $(obj)include
+	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
+	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
+
 ########################################################################
 ## ARM Integrator boards - see doc/README-integrator for more info.
 integratorap_config	\
diff --git a/board/calao/tny_a9260/Makefile b/board/calao/tny_a9260/Makefile
new file mode 100644
index 0000000..21f5ed1
--- /dev/null
+++ b/board/calao/tny_a9260/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= tny_a9260.o
+COBJS-$(CONFIG_ATMEL_SPI)	+= spi.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/calao/tny_a9260/config.mk b/board/calao/tny_a9260/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/calao/tny_a9260/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/calao/tny_a9260/spi.c b/board/calao/tny_a9260/spi.c
new file mode 100644
index 0000000..2db9f84
--- /dev/null
+++ b/board/calao/tny_a9260/spi.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/hardware.h>
+#include <asm/arch/at91_spi.h>
+#include <asm/arch/gpio.h>
+#include <spi.h>
+
+#define TNY_A9260_CS_PIN	AT91_PIN_PC11
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c
new file mode 100644
index 0000000..d51ca15
--- /dev/null
+++ b/board/calao/tny_a9260/tny_a9260.c
@@ -0,0 +1,110 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/at91sam9260.h>
+#include <asm/arch/at91sam9_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void tny_a9260_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_CS3A_SMC_SMARTMEDIA);
+
+	/* Configure SMC CS3 for NAND/SmartMedia */
+	at91_sys_write(AT91_SMC_SETUP(3),
+		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC_PULSE(3),
+		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+	at91_sys_write(AT91_SMC_CYCLE(3),
+		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+	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_(2));
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+
+	/* Configure RDY/BSY */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+	/* Enable NandFlash */
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();
+
+#if defined(CONFIG_TNY_A9260)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
+#elif defined(CONFIG_TNY_A9G20)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
+#endif
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	at91_serial_hw_init();
+	tny_a9260_nand_hw_init();
+	at91_spi0_hw_init(1 << 5);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
+		return -1;
+
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index 5309ba2..f86cb99 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -75,7 +75,7 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
new file mode 100644
index 0000000..05caff4
--- /dev/null
+++ b/include/configs/tny_a9260.h
@@ -0,0 +1,170 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
+ *
+ * Configuation settings for the Calao TNY-A9260 board
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+#if defined(CONFIG_tny_a9260) || defined(CONFIG_tny_a9260_nandflash) || defined(CONFIG_tny_a9260_eeprom)
+#define CONFIG_TNY_A9260
+#define CONFIG_AT91SAM9260
+#elif defined(CONFIG_tny_a9g20) || defined(CONFIG_tny_a9g20_nandflash) || defined(CONFIG_tny_a9g20_eeprom)
+#define CONFIG_TNY_A9G20
+#define CONFIG_AT91SAM9G20
+#else
+#error "Unknown board"
+#endif
+
+#if defined(CONFIG_tny_a9260_nandflash) || defined(CONFIG_tny_a9g20_nandflash)
+#define CONFIG_ENV_IS_IN_NAND
+#else
+#define CONFIG_ENV_IS_IN_EEPROM
+#endif
+
+/* ARM asynchronous clock */
+#define AT91_MAIN_CLOCK		12000000	/* 12 MHz crystal */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core */
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART	1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3		1	/* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY	3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_USB
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5 * CONFIG_SYS_HZ)
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SPI_M95XXX
+#define CONFIG_SYS_EEPROM_SIZE 0x10000
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
+
+/* NAND flash */
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE		1
+#define CONFIG_SYS_NAND_BASE			0x40000000
+#define CONFIG_SYS_NAND_DBW_8			1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
+#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
+
+/* NOR flash - no real flash on this board */
+#define CONFIG_SYS_NO_FLASH			1
+
+#define CONFIG_DOS_PARTITION		1
+#define CONFIG_CMD_FAT			1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Env in EEPROM, bootstrap + u-boot in NAND*/
+#ifdef CONFIG_ENV_IS_IN_EEPROM
+#define CONFIG_ENV_OFFSET		0x20
+#define CONFIG_ENV_SIZE		0x1000
+#endif
+
+/* Env, bootstrap and u-boot in NAND */
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x60000
+#define CONFIG_ENV_OFFSET_REDUND 0x80000
+#define CONFIG_ENV_SIZE 0x20000
+#endif
+
+#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
+#define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
+				"root=/dev/mtdblock1 " \
+				"mtdparts=atmel_nand:16M(kernel)ro," \
+				"120M(rootfs),-(other) " \
+				"rw rootfstype=jffs2"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT	"U-Boot> "
+#define CONFIG_SYS_CBSIZE	256
+#define CONFIG_SYS_MAXARGS	16
+#define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP	1
+#define CONFIG_CMDLINE_EDITING	1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN	ROUND(3 * CONFIG_ENV_SIZE + 128 * 1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE	(32 * 1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-11 10:44                           ` [U-Boot] [PATCH] " Albin Tonnerre
@ 2009-08-17 21:41                             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-17 22:13                               ` Albin Tonnerre
  2009-08-19 19:14                               ` Albin Tonnerre
  0 siblings, 2 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-17 21:41 UTC (permalink / raw)
  To: u-boot

> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +#if defined(CONFIG_tny_a9260) || defined(CONFIG_tny_a9260_nandflash) || defined(CONFIG_tny_a9260_eeprom)
too long
and define must be upper case
> +#define CONFIG_TNY_A9260
> +#define CONFIG_AT91SAM9260
> +#elif defined(CONFIG_tny_a9g20) || defined(CONFIG_tny_a9g20_nandflash) || defined(CONFIG_tny_a9g20_eeprom)
ditto
> +#define CONFIG_TNY_A9G20
> +#define CONFIG_AT91SAM9G20
> +#else
> +#error "Unknown board"
> +#endif
> +
> +#if defined(CONFIG_tny_a9260_nandflash) || defined(CONFIG_tny_a9g20_nandflash)
> +#define CONFIG_ENV_IS_IN_NAND
> +#else
> +#define CONFIG_ENV_IS_IN_EEPROM
> +#endif
> +
Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-17 21:41                             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-17 22:13                               ` Albin Tonnerre
  2009-08-17 22:48                                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-19 19:14                               ` Albin Tonnerre
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-17 22:13 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 17, 2009 at 11:41:06PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> > +
> > +#ifndef __CONFIG_H
> > +#define __CONFIG_H
> > +
> > +#if defined(CONFIG_tny_a9260) || defined(CONFIG_tny_a9260_nandflash) || defined(CONFIG_tny_a9260_eeprom)
> too long
> and define must be upper case

Those defines are generated directly from the target names in the Makfile, and
are used for "internal" purposes only. Moving them to uppercase would mean
changing the target names from tny_a9g20_nandflash to TNY_A9G20_NANDFLASH, while
the existing Calao-provided BSP uses lowercase. I'd rather not change that.

By the way, I'd appreciate an answer on LED API matter

Cheers,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090818/0a1f3060/attachment.pgp 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-17 22:13                               ` Albin Tonnerre
@ 2009-08-17 22:48                                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-18  8:26                                   ` Albin Tonnerre
  0 siblings, 1 reply; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-17 22:48 UTC (permalink / raw)
  To: u-boot

On 00:13 Tue 18 Aug     , Albin Tonnerre wrote:
> On Mon, Aug 17, 2009 at 11:41:06PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> > > +
> > > +#ifndef __CONFIG_H
> > > +#define __CONFIG_H
> > > +
> > > +#if defined(CONFIG_tny_a9260) || defined(CONFIG_tny_a9260_nandflash) || defined(CONFIG_tny_a9260_eeprom)
> > too long
> > and define must be upper case
> 
> Those defines are generated directly from the target names in the Makfile, and
> are used for "internal" purposes only. Moving them to uppercase would mean
> changing the target names from tny_a9g20_nandflash to TNY_A9G20_NANDFLASH, while
> the existing Calao-provided BSP uses lowercase. I'd rather not change that.
you make them uppercase before put them in the config.h

Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-17 22:48                                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-18  8:26                                   ` Albin Tonnerre
  0 siblings, 0 replies; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-18  8:26 UTC (permalink / raw)
  To: u-boot

On Tue, Aug 18, 2009 at 12:48:02AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> On 00:13 Tue 18 Aug     , Albin Tonnerre wrote:
> > On Mon, Aug 17, 2009 at 11:41:06PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> > > > +
> > > > +#ifndef __CONFIG_H
> > > > +#define __CONFIG_H
> > > > +
> > > > +#if defined(CONFIG_tny_a9260) || defined(CONFIG_tny_a9260_nandflash) || defined(CONFIG_tny_a9260_eeprom)
> > > too long
> > > and define must be upper case
> > 
> > Those defines are generated directly from the target names in the Makfile, and
> > are used for "internal" purposes only. Moving them to uppercase would mean
> > changing the target names from tny_a9g20_nandflash to TNY_A9G20_NANDFLASH, while
> > the existing Calao-provided BSP uses lowercase. I'd rather not change that.
> you make them uppercase before put them in the config.h

Any hint about how to do that in a Makefile without using things like tr ?

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090818/c5c33807/attachment.pgp 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-17 21:41                             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-17 22:13                               ` Albin Tonnerre
@ 2009-08-19 19:14                               ` Albin Tonnerre
  2009-08-19 21:30                                 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-19 19:14 UTC (permalink / raw)
  To: u-boot

The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
Calao Systems <http://www.calao-systems.com>. Their components are very
similar to the AT91SAM9260EK board, so their configuration is based on
the configuration of this board. There are however some differences:
different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
store the environment.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
Changes since previous version:
 - As per Jean-Christophe's commentes, fix long lines and use uppercase for
   defines in include/configs/tny_a9260.h. Slightly rework the ifdef logic in
   the process
 - Add an entry in MAINTAINERS for the tny_a9g20 as weel, since both 9260 and
   9g20 are supported

 MAINTAINERS                              |    5 +
 MAKEALL                                  |    1 +
 Makefile                                 |   10 ++
 board/calao/tny_a9260/Makefile           |   55 ++++++++++
 board/calao/tny_a9260/config.mk          |    1 +
 board/calao/tny_a9260/spi.c              |   50 +++++++++
 board/calao/tny_a9260/tny_a9260.c        |  110 +++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 include/configs/tny_a9260.h              |  172 ++++++++++++++++++++++++++++++
 9 files changed, 405 insertions(+), 1 deletions(-)
 create mode 100644 board/calao/tny_a9260/Makefile
 create mode 100644 board/calao/tny_a9260/config.mk
 create mode 100644 board/calao/tny_a9260/spi.c
 create mode 100644 board/calao/tny_a9260/tny_a9260.c
 create mode 100644 include/configs/tny_a9260.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 620604c..91e2c7f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -681,6 +681,11 @@ Andrea Scian <andrea.scian@dave-tech.it>
 
 	B2		ARM7TDMI (S3C44B0X)
 
+Albin Tonnerre <albin.tonnerre@free-electrons.com>
+
+	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
+	tny_a9g20	ARM926EJS (AT91SAM9G20 SoC)
+
 Greg Ungerer <greg.ungerer@opengear.com>
 
 	cm4008		ks8695p
diff --git a/MAKEALL b/MAKEALL
index edebaea..5882ceb 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -607,6 +607,7 @@ LIST_at91="			\
 	m501sk			\
 	pm9261			\
 	pm9263			\
+	tny_a9260	\
 "
 
 #########################################################################
diff --git a/Makefile b/Makefile
index 329e0f5..2abaeeb 100644
--- a/Makefile
+++ b/Makefile
@@ -2838,6 +2838,16 @@ at91sam9g45ekes_config	:	unconfig
 pm9263_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
 
+TNY_A9G20_NANDFLASH_config \
+TNY_A9G20_EEPROM_config \
+TNY_A9G20_config \
+TNY_A9260_NANDFLASH_config \
+TNY_A9260_EEPROM_config \
+TNY_A9260_config	:	unconfig
+	@mkdir -p $(obj)include
+	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
+	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
+
 ########################################################################
 ## ARM Integrator boards - see doc/README-integrator for more info.
 integratorap_config	\
diff --git a/board/calao/tny_a9260/Makefile b/board/calao/tny_a9260/Makefile
new file mode 100644
index 0000000..21f5ed1
--- /dev/null
+++ b/board/calao/tny_a9260/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= tny_a9260.o
+COBJS-$(CONFIG_ATMEL_SPI)	+= spi.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/calao/tny_a9260/config.mk b/board/calao/tny_a9260/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/calao/tny_a9260/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/calao/tny_a9260/spi.c b/board/calao/tny_a9260/spi.c
new file mode 100644
index 0000000..2db9f84
--- /dev/null
+++ b/board/calao/tny_a9260/spi.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/hardware.h>
+#include <asm/arch/at91_spi.h>
+#include <asm/arch/gpio.h>
+#include <spi.h>
+
+#define TNY_A9260_CS_PIN	AT91_PIN_PC11
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c
new file mode 100644
index 0000000..d51ca15
--- /dev/null
+++ b/board/calao/tny_a9260/tny_a9260.c
@@ -0,0 +1,110 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/at91sam9260.h>
+#include <asm/arch/at91sam9_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void tny_a9260_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_CS3A_SMC_SMARTMEDIA);
+
+	/* Configure SMC CS3 for NAND/SmartMedia */
+	at91_sys_write(AT91_SMC_SETUP(3),
+		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC_PULSE(3),
+		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+	at91_sys_write(AT91_SMC_CYCLE(3),
+		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+	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_(2));
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+
+	/* Configure RDY/BSY */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+	/* Enable NandFlash */
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();
+
+#if defined(CONFIG_TNY_A9260)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
+#elif defined(CONFIG_TNY_A9G20)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
+#endif
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	at91_serial_hw_init();
+	tny_a9260_nand_hw_init();
+	at91_spi0_hw_init(1 << 5);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
+		return -1;
+
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index 5309ba2..f86cb99 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -75,7 +75,7 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
new file mode 100644
index 0000000..4ad081b
--- /dev/null
+++ b/include/configs/tny_a9260.h
@@ -0,0 +1,172 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
+ *
+ * Configuation settings for the Calao TNY-A9260 and TNY-A9G20 boards
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+#if defined(CONFIG_TNY_A9260_NANDFLASH) || defined(CONFIG_TNY_A9260_EEPROM)
+#define CONFIG_TNY_A9260
+#elif defined(CONFIG_TNY_A9G20_NANDFLASH) || defined(CONFIG_TNY_A9G20_EEPROM)
+#define CONFIG_TNY_A9G20
+#endif
+
+#ifdef CONFIG_TNY_A9260
+#define CONFIG_AT91SAM9260
+#else
+#define CONFIG_AT91SAM9G20
+#endif
+
+#if defined(CONFIG_TNY_A9260_NANDFLASH) || defined(CONFIG_TNY_A9G20_NANDFLASH)
+#define CONFIG_ENV_IS_IN_NAND
+#else
+#define CONFIG_ENV_IS_IN_EEPROM
+#endif
+
+/* ARM asynchronous clock */
+#define AT91_MAIN_CLOCK		12000000	/* 12 MHz crystal */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core */
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART	1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3		1	/* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY	3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_USB
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5 * CONFIG_SYS_HZ)
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SPI_M95XXX
+#define CONFIG_SYS_EEPROM_SIZE 0x10000
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
+
+/* NAND flash */
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE		1
+#define CONFIG_SYS_NAND_BASE			0x40000000
+#define CONFIG_SYS_NAND_DBW_8			1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
+#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
+
+/* NOR flash - no real flash on this board */
+#define CONFIG_SYS_NO_FLASH			1
+
+#define CONFIG_DOS_PARTITION		1
+#define CONFIG_CMD_FAT			1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Env in EEPROM, bootstrap + u-boot in NAND*/
+#ifdef CONFIG_ENV_IS_IN_EEPROM
+#define CONFIG_ENV_OFFSET		0x20
+#define CONFIG_ENV_SIZE		0x1000
+#endif
+
+/* Env, bootstrap and u-boot in NAND */
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x60000
+#define CONFIG_ENV_OFFSET_REDUND 0x80000
+#define CONFIG_ENV_SIZE 0x20000
+#endif
+
+#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
+#define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
+				"root=/dev/mtdblock1 " \
+				"mtdparts=atmel_nand:16M(kernel)ro," \
+				"120M(rootfs),-(other) " \
+				"rw rootfstype=jffs2"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT	"U-Boot> "
+#define CONFIG_SYS_CBSIZE	256
+#define CONFIG_SYS_MAXARGS	16
+#define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP	1
+#define CONFIG_CMDLINE_EDITING	1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN	ROUND(3 * CONFIG_ENV_SIZE + 128 * 1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE	(32 * 1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-19 19:14                               ` Albin Tonnerre
@ 2009-08-19 21:30                                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-20 13:43                                   ` Albin Tonnerre
  2009-08-20 14:04                                   ` [U-Boot] [PATCH v8] " Albin Tonnerre
  0 siblings, 2 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-19 21:30 UTC (permalink / raw)
  To: u-boot

On 21:14 Wed 19 Aug     , Albin Tonnerre wrote:
> The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
> Calao Systems <http://www.calao-systems.com>. Their components are very
> similar to the AT91SAM9260EK board, so their configuration is based on
> the configuration of this board. There are however some differences:
> different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
> store the environment.
> 
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> ---
please put the version in the subject to known which one is the last
> Changes since previous version:
>  - As per Jean-Christophe's commentes, fix long lines and use uppercase for
>    defines in include/configs/tny_a9260.h. Slightly rework the ifdef logic in
>    the process
>  - Add an entry in MAINTAINERS for the tny_a9g20 as weel, since both 9260 and
>    9g20 are supported
> 
>  MAINTAINERS                              |    5 +
>  MAKEALL                                  |    1 +
>  Makefile                                 |   10 ++
>  board/calao/tny_a9260/Makefile           |   55 ++++++++++
>  board/calao/tny_a9260/config.mk          |    1 +
>  board/calao/tny_a9260/spi.c              |   50 +++++++++
>  board/calao/tny_a9260/tny_a9260.c        |  110 +++++++++++++++++++
>  cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
>  include/configs/tny_a9260.h              |  172 ++++++++++++++++++++++++++++++
>  9 files changed, 405 insertions(+), 1 deletions(-)
>  create mode 100644 board/calao/tny_a9260/Makefile
>  create mode 100644 board/calao/tny_a9260/config.mk
>  create mode 100644 board/calao/tny_a9260/spi.c
>  create mode 100644 board/calao/tny_a9260/tny_a9260.c
>  create mode 100644 include/configs/tny_a9260.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 620604c..91e2c7f 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -681,6 +681,11 @@ Andrea Scian <andrea.scian@dave-tech.it>
>  
>  	B2		ARM7TDMI (S3C44B0X)
>  
> +Albin Tonnerre <albin.tonnerre@free-electrons.com>
> +
> +	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
> +	tny_a9g20	ARM926EJS (AT91SAM9G20 SoC)
> +
>  Greg Ungerer <greg.ungerer@opengear.com>
>  
>  	cm4008		ks8695p
> diff --git a/MAKEALL b/MAKEALL
> index edebaea..5882ceb 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -607,6 +607,7 @@ LIST_at91="			\
>  	m501sk			\
>  	pm9261			\
>  	pm9263			\
> +	tny_a9260	\
why not 9g20 too?
>  "
>  
>  #########################################################################
> diff --git a/Makefile b/Makefile
> index 329e0f5..2abaeeb 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2838,6 +2838,16 @@ at91sam9g45ekes_config	:	unconfig
>  pm9263_config	:	unconfig
>  	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
>  
> +TNY_A9G20_NANDFLASH_config \
> +TNY_A9G20_EEPROM_config \
> +TNY_A9G20_config \
> +TNY_A9260_NANDFLASH_config \
> +TNY_A9260_EEPROM_config \
> +TNY_A9260_config	:	unconfig
> +	@mkdir -p $(obj)include
> +	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
try somethink like this so you do not need to put the config name uppercase
	@echo -n "#define " >$(obj)include/config.h
	@echo    "$(@:_config=)" | tr [a-z] [A-Z] >> $(obj)include/config.h

please also remember that if you update the config you need to update the
MAKEALL too
> +	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
> +
Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-19 21:30                                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-08-20 13:43                                   ` Albin Tonnerre
  2009-08-20 14:44                                     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-20 14:04                                   ` [U-Boot] [PATCH v8] " Albin Tonnerre
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-20 13:43 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 19, 2009 at 11:30:05PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> On 21:14 Wed 19 Aug     , Albin Tonnerre wrote:
> > diff --git a/MAKEALL b/MAKEALL
> > index edebaea..5882ceb 100755
> > --- a/MAKEALL
> > +++ b/MAKEALL
> > @@ -607,6 +607,7 @@ LIST_at91="			\
> >  	m501sk			\
> >  	pm9261			\
> >  	pm9263			\
> > +	tny_a9260	\
> why not 9g20 too?

Oops. Thanks.

> >  #########################################################################
> > diff --git a/Makefile b/Makefile
> > index 329e0f5..2abaeeb 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -2838,6 +2838,16 @@ at91sam9g45ekes_config	:	unconfig
> >  pm9263_config	:	unconfig
> >  	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
> >  
> > +TNY_A9G20_NANDFLASH_config \
> > +TNY_A9G20_EEPROM_config \
> > +TNY_A9G20_config \
> > +TNY_A9260_NANDFLASH_config \
> > +TNY_A9260_EEPROM_config \
> > +TNY_A9260_config	:	unconfig
> > +	@mkdir -p $(obj)include
> > +	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
> try somethink like this so you do not need to put the config name uppercase
> 	@echo -n "#define " >$(obj)include/config.h
> 	@echo    "$(@:_config=)" | tr [a-z] [A-Z] >> $(obj)include/config.h

I think I'll go with uppercase. If the shell ends up being /bin/sh, it might not
provide the '-n' switch for echo, so I'd rather avoid it when possible.

Thanks for your comments,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090820/cdbc4a08/attachment.pgp 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH v8] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-19 21:30                                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-08-20 13:43                                   ` Albin Tonnerre
@ 2009-08-20 14:04                                   ` Albin Tonnerre
  2009-09-01 20:53                                     ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 36+ messages in thread
From: Albin Tonnerre @ 2009-08-20 14:04 UTC (permalink / raw)
  To: u-boot

The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
Calao Systems <http://www.calao-systems.com>. Their components are very
similar to the AT91SAM9260EK board, so their configuration is based on
the configuration of this board. There are however some differences:
different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
store the environment.

Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
---
 Changes in v7:
  - As per Jean-Christophe's commentes, fix long lines and use uppercase for
    defines in include/configs/tny_a9260.h. Slightly rework the ifdef logic in
    the process
  - Add an entry in MAINTAINERS for the tny_a9g20 as weel, since both 9260 and
    9g20 are supported

 Changes in v8:
  - Update MAKEALL to reflect the changes in Makefile, and add the tny_a9g20

 MAINTAINERS                              |    5 +
 MAKEALL                                  |    2 +
 Makefile                                 |   10 ++
 board/calao/tny_a9260/Makefile           |   55 ++++++++++
 board/calao/tny_a9260/config.mk          |    1 +
 board/calao/tny_a9260/spi.c              |   50 +++++++++
 board/calao/tny_a9260/tny_a9260.c        |  110 +++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
 include/configs/tny_a9260.h              |  172 ++++++++++++++++++++++++++++++
 9 files changed, 406 insertions(+), 1 deletions(-)
 create mode 100644 board/calao/tny_a9260/Makefile
 create mode 100644 board/calao/tny_a9260/config.mk
 create mode 100644 board/calao/tny_a9260/spi.c
 create mode 100644 board/calao/tny_a9260/tny_a9260.c
 create mode 100644 include/configs/tny_a9260.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 620604c..91e2c7f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -681,6 +681,11 @@ Andrea Scian <andrea.scian@dave-tech.it>
 
 	B2		ARM7TDMI (S3C44B0X)
 
+Albin Tonnerre <albin.tonnerre@free-electrons.com>
+
+	tny_a9260	ARM926EJS (AT91SAM9260 SoC)
+	tny_a9g20	ARM926EJS (AT91SAM9G20 SoC)
+
 Greg Ungerer <greg.ungerer@opengear.com>
 
 	cm4008		ks8695p
diff --git a/MAKEALL b/MAKEALL
index edebaea..accb3bc 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -607,6 +607,8 @@ LIST_at91="			\
 	m501sk			\
 	pm9261			\
 	pm9263			\
+	TNY_A9260	\
+	TNY_A9G20	\
 "
 
 #########################################################################
diff --git a/Makefile b/Makefile
index 329e0f5..2abaeeb 100644
--- a/Makefile
+++ b/Makefile
@@ -2838,6 +2838,16 @@ at91sam9g45ekes_config	:	unconfig
 pm9263_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
 
+TNY_A9G20_NANDFLASH_config \
+TNY_A9G20_EEPROM_config \
+TNY_A9G20_config \
+TNY_A9260_NANDFLASH_config \
+TNY_A9260_EEPROM_config \
+TNY_A9260_config	:	unconfig
+	@mkdir -p $(obj)include
+	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
+	@$(MKCONFIG) -a tny_a9260 arm arm926ejs tny_a9260 calao at91
+
 ########################################################################
 ## ARM Integrator boards - see doc/README-integrator for more info.
 integratorap_config	\
diff --git a/board/calao/tny_a9260/Makefile b/board/calao/tny_a9260/Makefile
new file mode 100644
index 0000000..21f5ed1
--- /dev/null
+++ b/board/calao/tny_a9260/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop@leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= tny_a9260.o
+COBJS-$(CONFIG_ATMEL_SPI)	+= spi.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/calao/tny_a9260/config.mk b/board/calao/tny_a9260/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/calao/tny_a9260/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/calao/tny_a9260/spi.c b/board/calao/tny_a9260/spi.c
new file mode 100644
index 0000000..2db9f84
--- /dev/null
+++ b/board/calao/tny_a9260/spi.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/hardware.h>
+#include <asm/arch/at91_spi.h>
+#include <asm/arch/gpio.h>
+#include <spi.h>
+
+#define TNY_A9260_CS_PIN	AT91_PIN_PC11
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 1;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	at91_set_gpio_value(TNY_A9260_CS_PIN, 1);
+}
+
+void spi_init_f(void)
+{
+	/* everything done in board_init */
+}
diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c
new file mode 100644
index 0000000..d51ca15
--- /dev/null
+++ b/board/calao/tny_a9260/tny_a9260.c
@@ -0,0 +1,110 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.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/at91sam9260.h>
+#include <asm/arch/at91sam9_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
+#include <asm/arch/hardware.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static void tny_a9260_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_CS3A_SMC_SMARTMEDIA);
+
+	/* Configure SMC CS3 for NAND/SmartMedia */
+	at91_sys_write(AT91_SMC_SETUP(3),
+		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC_PULSE(3),
+		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+	at91_sys_write(AT91_SMC_CYCLE(3),
+		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+	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_(2));
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+
+	/* Configure RDY/BSY */
+	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+	/* Enable NandFlash */
+	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+
+int board_init(void)
+{
+	/* Enable Ctrlc */
+	console_init_f();
+
+#if defined(CONFIG_TNY_A9260)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260;
+#elif defined(CONFIG_TNY_A9G20)
+	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
+#endif
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	at91_serial_hw_init();
+	tny_a9260_nand_hw_init();
+	at91_spi0_hw_init(1 << 5);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
+		return -1;
+
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index 5309ba2..f86cb99 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -75,7 +75,7 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
new file mode 100644
index 0000000..4ad081b
--- /dev/null
+++ b/include/configs/tny_a9260.h
@@ -0,0 +1,172 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * Copyright (C) 2009
+ * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
+ *
+ * Configuation settings for the Calao TNY-A9260 and TNY-A9G20 boards
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+#if defined(CONFIG_TNY_A9260_NANDFLASH) || defined(CONFIG_TNY_A9260_EEPROM)
+#define CONFIG_TNY_A9260
+#elif defined(CONFIG_TNY_A9G20_NANDFLASH) || defined(CONFIG_TNY_A9G20_EEPROM)
+#define CONFIG_TNY_A9G20
+#endif
+
+#ifdef CONFIG_TNY_A9260
+#define CONFIG_AT91SAM9260
+#else
+#define CONFIG_AT91SAM9G20
+#endif
+
+#if defined(CONFIG_TNY_A9260_NANDFLASH) || defined(CONFIG_TNY_A9G20_NANDFLASH)
+#define CONFIG_ENV_IS_IN_NAND
+#else
+#define CONFIG_ENV_IS_IN_EEPROM
+#endif
+
+/* ARM asynchronous clock */
+#define AT91_MAIN_CLOCK		12000000	/* 12 MHz crystal */
+#define CONFIG_SYS_HZ		1000
+
+#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core */
+#define CONFIG_ARCH_CPU_INIT
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_ATMEL_USART	1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3		1	/* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY	3
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_IMLS
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_USB
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+
+/* SPI EEPROM */
+#define CONFIG_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_ATMEL_SPI
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5 * CONFIG_SYS_HZ)
+
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SPI_M95XXX
+#define CONFIG_SYS_EEPROM_SIZE 0x10000
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5
+
+/* NAND flash */
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE		1
+#define CONFIG_SYS_NAND_BASE			0x40000000
+#define CONFIG_SYS_NAND_DBW_8			1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE		(1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE		(1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN		AT91_PIN_PC14
+#define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
+
+/* NOR flash - no real flash on this board */
+#define CONFIG_SYS_NO_FLASH			1
+
+#define CONFIG_DOS_PARTITION		1
+#define CONFIG_CMD_FAT			1
+
+#define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
+
+#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END			0x23e00000
+
+/* Env in EEPROM, bootstrap + u-boot in NAND*/
+#ifdef CONFIG_ENV_IS_IN_EEPROM
+#define CONFIG_ENV_OFFSET		0x20
+#define CONFIG_ENV_SIZE		0x1000
+#endif
+
+/* Env, bootstrap and u-boot in NAND */
+#ifdef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET 0x60000
+#define CONFIG_ENV_OFFSET_REDUND 0x80000
+#define CONFIG_ENV_SIZE 0x20000
+#endif
+
+#define CONFIG_BOOTCOMMAND	"nboot 0x21000000 0 400000"
+#define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
+				"root=/dev/mtdblock1 " \
+				"mtdparts=atmel_nand:16M(kernel)ro," \
+				"120M(rootfs),-(other) " \
+				"rw rootfstype=jffs2"
+
+#define CONFIG_BAUDRATE		115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT	"U-Boot> "
+#define CONFIG_SYS_CBSIZE	256
+#define CONFIG_SYS_MAXARGS	16
+#define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP	1
+#define CONFIG_CMDLINE_EDITING	1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN	ROUND(3 * CONFIG_ENV_SIZE + 128 * 1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE	(32 * 1024)	/* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-20 13:43                                   ` Albin Tonnerre
@ 2009-08-20 14:44                                     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-08-20 14:44 UTC (permalink / raw)
  To: u-boot

On 15:43 Thu 20 Aug     , Albin Tonnerre wrote:
> On Wed, Aug 19, 2009 at 11:30:05PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote :
> > On 21:14 Wed 19 Aug     , Albin Tonnerre wrote:
> > > diff --git a/MAKEALL b/MAKEALL
> > > index edebaea..5882ceb 100755
> > > --- a/MAKEALL
> > > +++ b/MAKEALL
> > > @@ -607,6 +607,7 @@ LIST_at91="			\
> > >  	m501sk			\
> > >  	pm9261			\
> > >  	pm9263			\
> > > +	tny_a9260	\
> > why not 9g20 too?
> 
> Oops. Thanks.
> 
> > >  #########################################################################
> > > diff --git a/Makefile b/Makefile
> > > index 329e0f5..2abaeeb 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -2838,6 +2838,16 @@ at91sam9g45ekes_config	:	unconfig
> > >  pm9263_config	:	unconfig
> > >  	@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
> > >  
> > > +TNY_A9G20_NANDFLASH_config \
> > > +TNY_A9G20_EEPROM_config \
> > > +TNY_A9G20_config \
> > > +TNY_A9260_NANDFLASH_config \
> > > +TNY_A9260_EEPROM_config \
> > > +TNY_A9260_config	:	unconfig
> > > +	@mkdir -p $(obj)include
> > > +	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
> > try somethink like this so you do not need to put the config name uppercase
> > 	@echo -n "#define " >$(obj)include/config.h
> > 	@echo    "$(@:_config=)" | tr [a-z] [A-Z] >> $(obj)include/config.h
> 
> I think I'll go with uppercase. If the shell ends up being /bin/sh, it might not
> provide the '-n' switch for echo, so I'd rather avoid it when possible.
you can use \c too
but as you prefer

Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [U-Boot] [PATCH v8] Support for the Calao TNY-A9260/TNY-A9G20 boards
  2009-08-20 14:04                                   ` [U-Boot] [PATCH v8] " Albin Tonnerre
@ 2009-09-01 20:53                                     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 36+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-09-01 20:53 UTC (permalink / raw)
  To: u-boot

On 16:04 Thu 20 Aug     , Albin Tonnerre wrote:
> The Calao TNY-A9260 and TNY-9G20 are boards manufactured and sold by
> Calao Systems <http://www.calao-systems.com>. Their components are very
> similar to the AT91SAM9260EK board, so their configuration is based on
> the configuration of this board. There are however some differences:
> different clocks, no LCD, no ethernet. They also can use SPI EEPROM to
> store the environment.
> 
> Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
> ---
>  Changes in v7:
>   - As per Jean-Christophe's commentes, fix long lines and use uppercase for
>     defines in include/configs/tny_a9260.h. Slightly rework the ifdef logic in
>     the process
>   - Add an entry in MAINTAINERS for the tny_a9g20 as weel, since both 9260 and
>     9g20 are supported
> 
>  Changes in v8:
>   - Update MAKEALL to reflect the changes in Makefile, and add the tny_a9g20
> 
>  MAINTAINERS                              |    5 +
>  MAKEALL                                  |    2 +
>  Makefile                                 |   10 ++
>  board/calao/tny_a9260/Makefile           |   55 ++++++++++
>  board/calao/tny_a9260/config.mk          |    1 +
>  board/calao/tny_a9260/spi.c              |   50 +++++++++
>  board/calao/tny_a9260/tny_a9260.c        |  110 +++++++++++++++++++
>  cpu/arm926ejs/at91/at91sam9260_devices.c |    2 +-
>  include/configs/tny_a9260.h              |  172 ++++++++++++++++++++++++++++++
>  9 files changed, 406 insertions(+), 1 deletions(-)
>  create mode 100644 board/calao/tny_a9260/Makefile
>  create mode 100644 board/calao/tny_a9260/config.mk
>  create mode 100644 board/calao/tny_a9260/spi.c
>  create mode 100644 board/calao/tny_a9260/tny_a9260.c
>  create mode 100644 include/configs/tny_a9260.h
> 
applied to u-boot-arm

but merged manually

please next time when you add different board does it as a patch series
to avoid the manual merge

Best Regards,
J.

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2009-09-01 20:53 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-21 15:53 [U-Boot] [PATCH] Support for the Calao TNY-A9260 board Albin Tonnerre
2009-07-21 17:40 ` Wolfgang Denk
2009-07-21 18:02   ` Albin Tonnerre
2009-07-22  7:33     ` Wolfgang Denk
2009-07-22  8:16       ` Albin Tonnerre
2009-07-22  9:47         ` Wolfgang Denk
2009-07-22 11:03           ` Albin Tonnerre
2009-07-22 11:13             ` Wolfgang Denk
2009-07-24  8:32   ` [U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
2009-08-01 14:15     ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-03  7:54       ` Albin Tonnerre
2009-08-04 19:45         ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-05 17:16           ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
2009-08-05 17:16             ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
2009-08-05 19:30               ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-05 19:45                 ` Albin Tonnerre
2009-08-05 19:58                   ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-07 10:37                     ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Albin Tonnerre
2009-08-07 10:37                       ` [U-Boot] [PATCH 2/2] Support for the Calao TNY-A9260/TNY-A9G20 boards Albin Tonnerre
2009-08-07 10:54                         ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-09 20:38                         ` Wolfgang Denk
2009-08-09 22:40                           ` Albin Tonnerre
2009-08-11 10:44                           ` [U-Boot] [PATCH] " Albin Tonnerre
2009-08-17 21:41                             ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-17 22:13                               ` Albin Tonnerre
2009-08-17 22:48                                 ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-18  8:26                                   ` Albin Tonnerre
2009-08-19 19:14                               ` Albin Tonnerre
2009-08-19 21:30                                 ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-20 13:43                                   ` Albin Tonnerre
2009-08-20 14:44                                     ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-20 14:04                                   ` [U-Boot] [PATCH v8] " Albin Tonnerre
2009-09-01 20:53                                     ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-07 10:52                       ` [U-Boot] [PATCH 1/2] Add driver for the ST M95xxx SPI EEPROM Jean-Christophe PLAGNIOL-VILLARD
2009-08-05 19:24             ` Jean-Christophe PLAGNIOL-VILLARD
2009-08-07 10:40               ` Albin Tonnerre

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.