[U-Boot] [PATCH] Support for the Calao TNY-A9260/TNY-A9G20 boards

Jean-Christophe PLAGNIOL-VILLARD
2009-08-01T14:15:32Z

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.