[U-Boot] [PATCH] skat91: add support for SK-AT91SAM9/SIM508 board
Vladimir Zapolskiy
vz at mleia.com
Wed Jan 11 21:56:45 CET 2012
On 11.01.2012 22:53, Marek Vasut wrote:
>> This change adds complete support for Starterkit SK-AT91SAM9/SIM508
>> board.
>>
>> Signed-off-by: Vladimir Zapolskiy<vz at mleia.com>
>> ---
>> MAINTAINERS | 4 +
>> board/starterkit/skat91_sim508/Makefile | 44 ++++++
>> board/starterkit/skat91_sim508/partition.c | 39 +++++
>> board/starterkit/skat91_sim508/skat91_sim508.c | 124 ++++++++++++++++
>> boards.cfg | 2 +
>> include/configs/skat91_sim508.h | 181
>> ++++++++++++++++++++++++ 6 files changed, 394 insertions(+), 0
>> deletions(-)
>> create mode 100644 board/starterkit/skat91_sim508/Makefile
>> create mode 100644 board/starterkit/skat91_sim508/partition.c
>> create mode 100644 board/starterkit/skat91_sim508/skat91_sim508.c
>> create mode 100644 include/configs/skat91_sim508.h
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 4bf12b5..bcd330a 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -914,6 +914,10 @@ Sughosh Ganu<urwithsughosh at gmail.com>
>>
>> hawkboard ARM926EJS (OMAP-L138)
>>
>> +Vladimir Zapolskiy<vz at mleia.com>
>> +
>> + skat91_sim508 ARM926EJS (AT91SAM9260 SoC)
>> +
>> -------------------------------------------------------------------------
>>
>> Unknown / orphaned boards:
>> diff --git a/board/starterkit/skat91_sim508/Makefile
>> b/board/starterkit/skat91_sim508/Makefile new file mode 100644
>> index 0000000..77965f8
>> --- /dev/null
>> +++ b/board/starterkit/skat91_sim508/Makefile
>> @@ -0,0 +1,44 @@
>> +#
>> +# Copyright (C) 2011 by Vladimir Zapolskiy<vz at mleia.com>
>> +# Copyright (C) 2008, Guennadi Liakhovetski<lg at denx.de>
>> +#
>> +# See file CREDITS for list of people who contributed to this
>> +# project.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation; either version 2 of
>> +# the License, or (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program; if not, write to the Free Software
>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
>> +# MA 02110-1301, USA.
>> +#
>> +
>> +include $(TOPDIR)/config.mk
>> +
>> +LIB = $(obj)lib$(BOARD).o
>> +
>> +COBJS := skat91_sim508.o partition.o
>> +
>> +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
>> +OBJS := $(addprefix $(obj),$(COBJS))
>> +SOBJS := $(addprefix $(obj),$(SOBJS))
>> +
>> +$(LIB): $(obj).depend $(OBJS) $(SOBJS)
>> + $(call cmd_link_o_target, $(OBJS) $(SOBJS))
>> +
>> +#########################################################################
>> +
>> +# defines $(obj).depend target
>> +include $(SRCTREE)/rules.mk
>> +
>> +sinclude $(obj).depend
>> +
>> +#########################################################################
>> diff --git a/board/starterkit/skat91_sim508/partition.c
>> b/board/starterkit/skat91_sim508/partition.c new file mode 100644
>> index 0000000..f82046d
>> --- /dev/null
>> +++ b/board/starterkit/skat91_sim508/partition.c
>> @@ -0,0 +1,39 @@
>> +/*
>> + * StarterKit SK-AT91SAM9/SIM508 board support, dataflash partitions
>> + *
>> + * Copyright (C) 2011 Vladimir Zapolskiy<vz at mleia.com>
>> + *
>> + * 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., 51 Franklin Street, Fifth Floor, Boston,
>> + * MA 02110-1301, USA.
>> + */
>> +
>> +#include<common.h>
>> +#include<config.h>
>> +#include<asm/hardware.h>
>> +#include<dataflash.h>
>> +
>> +AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS];
>> +
>> +struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = {
>> + { CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0, 0 },
>> +};
>> +
>> +/* define the area offsets */
>> +dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
>> + { 0x00000000, 0x00003FFF, FLAG_PROTECT_SET, 0, "Bootstrap" },
>> + { 0x00004000, 0x00007FFF, FLAG_PROTECT_CLEAR, 0, "Environment" },
>> + { 0x00008000, 0x00037FFF, FLAG_PROTECT_SET, 0, "U-Boot" },
>> + { 0x00038000, 0x0041FFFF, FLAG_PROTECT_CLEAR, 0, "Kernel" },
>> +};
>> diff --git a/board/starterkit/skat91_sim508/skat91_sim508.c
>> b/board/starterkit/skat91_sim508/skat91_sim508.c new file mode 100644
>> index 0000000..bcd6a94
>> --- /dev/null
>> +++ b/board/starterkit/skat91_sim508/skat91_sim508.c
>> @@ -0,0 +1,124 @@
>> +/*
>> + * StarterKit SK-AT91SAM9/SIM508 board support
>> + *
>> + * Copyright (C) 2011 Vladimir Zapolskiy<vz at mleia.com>
>> + *
>> + * 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., 51 Franklin Street, Fifth Floor, Boston,
>> + * MA 02110-1301, USA.
>> + */
>> +
>> +#include<common.h>
>> +#include<netdev.h>
>> +
>> +#include<asm/arch/at91sam9260_matrix.h>
>> +#include<asm/arch/at91sam9_smc.h>
>> +#include<asm/arch/at91_pmc.h>
>> +#include<asm/arch/at91_pio.h>
>> +#include<asm/arch/at91_rstc.h>
>> +#include<asm/arch/at91_common.h>
>> +#include<asm/arch/gpio.h>
>> +#include<asm/io.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +#ifdef CONFIG_CMD_NAND
>> +static void skat91_sim508_nand_hw_init(void)
>> +{
>> + struct at91_pmc *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
>> + struct at91_smc *smc = (at91_smc_t *)ATMEL_BASE_SMC;
>> + struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
>> + unsigned long csa;
>> +
>> + /* Assign CS3 to NAND/SmartMedia Interface */
>> + csa = readl(&matrix->ebicsa);
>> + csa |= AT91_MATRIX_CS3A_SMC_SMARTMEDIA;
>> + writel(csa,&matrix->ebicsa);
>
> setbits_le32()
>
Ok, thanks.
>> +
>> + /* Configure SMC CS3 for NAND/SmartMedia */
>> + writel(AT91_SMC_SETUP_NWE(1) | AT91_SMC_SETUP_NCS_WR(0) |
>> + AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
>> + &smc->cs[3].setup);
>> +
>> + writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(3) |
>> + AT91_SMC_PULSE_NRD(3) | AT91_SMC_PULSE_NCS_RD(3),
>> + &smc->cs[3].pulse);
>> +
>> + writel(AT91_SMC_CYCLE_NWE(5) | AT91_SMC_CYCLE_NRD(5),
>> + &smc->cs[3].cycle);
>> +
>> + writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
>> + AT91_SMC_MODE_EXNW_DISABLE |
>> + AT91_SMC_MODE_DBW_8 |
>> + AT91_SMC_MODE_TDF_CYCLE(2),
>> + &smc->cs[3].mode);
>> +
>> + writel(1<< ATMEL_ID_PIOC,&pmc->pcer);
>> +
>> + /* Configure RDY/BSY */
>> + at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1);
>> +
>> + /* Enable NandFlash */
>> + at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
>> +}
>> +#endif
>> +
>> +#ifdef CONFIG_MACB
>> +static void skat91_sim508_macb_hw_init(void)
>> +{
>> + at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
>> +
>> + /* Enable EMAC clock */
>> + writel(1<< ATMEL_ID_EMAC0,&pmc->pcer);
>> +
>> + at91_macb_hw_init();
>> +}
>> +
>> +int board_eth_init(bd_t *bis)
>> +{
>> + return macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC0, 0x01);
>> +}
>> +#endif
>> +
>> +int board_early_init_f(void)
>> +{
>> + at91_seriald_hw_init();
>> +
>> + return 0;
>> +}
>> +
>> +int board_init(void)
>> +{
>> + /* Enable Ctrlc */
>> + console_init_f();
>> +
>> + /* adress of boot parameters */
>> + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>> +
>> +#ifdef CONFIG_CMD_NAND
>> + skat91_sim508_nand_hw_init();
>> +#endif
>> +#ifdef CONFIG_MACB
>> + skat91_sim508_macb_hw_init();
>> +#endif
>> + return 0;
>> +}
>> +
>> +int dram_init(void)
>> +{
>> + gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
>> + CONFIG_SYS_SDRAM_SIZE);
>> +
>> + return 0;
>> +}
>> diff --git a/boards.cfg b/boards.cfg
>> index 0b32532..6dd2269 100644
>> --- a/boards.cfg
>> +++ b/boards.cfg
>> @@ -118,6 +118,8 @@ cpu9G20_nand_128M arm arm926ejs
>> cpu9260 eukrea pm9261 arm
>> arm926ejs pm9261 ronetix at91
>> pm9261:AT91SAM9261 pm9263 arm arm926ejs
>> pm9263 ronetix at91 pm9263:AT91SAM9263 pm9g45
>> arm arm926ejs pm9g45 ronetix
>> at91 pm9g45:AT91SAM9G45 +skat91_sim508 arm
>> arm926ejs skat91_sim508 starterkit at91
>> skat91_sim508:AT91SAM9260,SYS_USE_NANDFLASH +skat91_sim508_dataflash
>> arm arm926ejs skat91_sim508 starterkit at91
>> skat91_sim508:AT91SAM9260,SYS_USE_DATAFLASH_CS0 cam_enc_4xx
>> arm arm926ejs cam_enc_4xx ait davinci
>> cam_enc_4xx da830evm arm arm926ejs da8xxevm
>> davinci davinci da850_am18xxevm arm
>> arm926ejs da8xxevm davinci davinci diff --git
>> a/include/configs/skat91_sim508.h b/include/configs/skat91_sim508.h new
>> file mode 100644
>> index 0000000..da939c7
>> --- /dev/null
>> +++ b/include/configs/skat91_sim508.h
>> @@ -0,0 +1,181 @@
>> +/*
>> + * Starterkit SK-AT91SAM9/SIM508 board configuration file
>> + *
>> + * Copyright (C) 2011 Vladimir Zapolskiy<vz at mleia.com>
>> + *
>> + * 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., 51 Franklin Street, Fifth Floor, Boston,
>> + * MA 02110-1301, USA.
>> + */
>> +
>> +#ifndef __CONFIG_SKAT91_SIM508_H__
>> +#define __CONFIG_SKAT91_SIM508_H__
>> +
>> +#include<asm/sizes.h>
>> +#include<asm/hardware.h>
>> +
>> +/* Define SK-AT91SAM9/SIM508 machine type by hand */
>> +#define MACH_TYPE_SKAT91_SIM508 2789
>> +#define CONFIG_MACH_TYPE MACH_TYPE_SKAT91_SIM508
>> +
>> +#define CONFIG_SYS_ICACHE_OFF
>> +#define CONFIG_SYS_DCACHE_OFF
>> +#define CONFIG_SKIP_LOWLEVEL_INIT
>> +#define CONFIG_BOARD_EARLY_INIT_F
>> +
>> +/* ARM asynchronous clock */
>> +#define CONFIG_SYS_AT91_SLOW_CLOCK 32768
>> +#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000
>> +#define CONFIG_SYS_HZ 1000
>> +
>> +/* SoC configurations */
>> +#define CONFIG_ARCH_CPU_INIT
>> +
>> +/* Memory configurations */
>> +#define CONFIG_NR_DRAM_BANKS 1
>> +#define CONFIG_STACKSIZE SZ_32K
>> +#define CONFIG_SYS_MALLOC_LEN SZ_1M
>> +#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_CS1
>> +#define CONFIG_SYS_SDRAM_SIZE SZ_64M
>> +#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
>> +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_TEXT_BASE - SZ_1M)
>> +
>> +#define CONFIG_SYS_TEXT_BASE 0x23F00000
>> +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_MEMTEST_START + SZ_32K)
>> +
>> +#define CONFIG_SYS_INIT_RAM_SIZE SZ_4K
>> +#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_SDRAM_BASE + \
>> + CONFIG_SYS_INIT_RAM_SIZE - \
>> + GENERATED_GBL_DATA_SIZE)
>> +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_GBL_DATA_OFFSET
>> +
>> +/* Hardware drivers */
>> +#define CONFIG_AT91_GPIO
>> +
>> +/* Serial driver */
>> +#define CONFIG_ATMEL_USART
>> +#define CONFIG_USART_BASE ATMEL_BASE_DBGU
>> +#define CONFIG_USART_ID ATMEL_ID_SYS
>> +#define CONFIG_BAUDRATE 115200
>> +#define CONFIG_SYS_BAUDRATE_TABLE { 115200 , 57600, 38400, 19200, 9600 }
>> +
>> +/* DataFlash */
>> +#define CONFIG_CMD_FLASH
>> +#define CONFIG_ATMEL_DATAFLASH_SPI
>> +#define CONFIG_HAS_DATAFLASH
>> +#define CONFIG_SYS_SPI_WRITE_TOUT (5 * CONFIG_SYS_HZ)
>> +#define CONFIG_SYS_MAX_DATAFLASH_BANKS 1
>> +#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 0xC0000000
>> +#define AT91_SPI_CLK 15000000
>> +#define DATAFLASH_TCSS (0x1a<< 16)
>> +#define DATAFLASH_TCHS (0x01<< 24)
>> +
>> +/* NOR flash - no real flash on this board */
>> +#define CONFIG_SYS_NO_FLASH
>> +
>> +/* NAND Flash */
>> +#define CONFIG_CMD_NAND
>> +#define CONFIG_NAND_ATMEL
>> +#define CONFIG_SYS_MAX_NAND_DEVICE 1
>> +#define CONFIG_SYS_NAND_BASE ATMEL_BASE_CS3
>> +#define CONFIG_SYS_NAND_DBW_8 1
>> +#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTC, 13
>> +#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTC, 14
>> +#define CONFIG_SYS_NAND_MASK_ALE (1<< 21)
>> +#define CONFIG_SYS_NAND_MASK_CLE (1<< 22)
>> +
>> +/* Ethernet */
>> +#define CONFIG_MACB
>> +#define CONFIG_RMII
>> +#define CONFIG_NET_RETRY_COUNT 20
>> +
>> +#define CONFIG_PHYLIB
>> +#define CONFIG_PHY_MICREL
>> +
>> +/* U-Boot General Configurations */
>> +#define CONFIG_SYS_LONGHELP
>> +#define CONFIG_SYS_PROMPT "=> "
>> +#define CONFIG_SYS_CBSIZE 1024 /* Console I/O buffer size */
>> +#define CONFIG_SYS_PBSIZE \
>> + (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
>> +#define CONFIG_SYS_MAXARGS 16
>> +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
>> +
>> +#define CONFIG_AUTO_COMPLETE
>> +#define CONFIG_CMDLINE_EDITING
>> +#define CONFIG_VERSION_VARIABLE
>> +#define CONFIG_DISPLAY_CPUINFO
>> +#define CONFIG_DOS_PARTITION
>> +
>> +#if defined(CONFIG_SYS_USE_DATAFLASH_CS0)
>> +#define CONFIG_ENV_IS_IN_DATAFLASH
>> +#define CONFIG_SYS_MONITOR_BASE \
>> + (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8000)
>> +#define CONFIG_ENV_OFFSET 0x4000
>> +#define CONFIG_ENV_ADDR \
>> + (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
>> +#define CONFIG_ENV_SIZE SZ_16K
>> +#define CONFIG_BOOTCOMMAND "cp.b 0xC0038000 0x20400000 0x170000; bootm"
>> +#define CONFIG_BOOTARGS "console=ttyS0,115200 "
> \
>> + "root=/dev/mtdblock0 " \
>> + "mtdparts=atmel_nand:-(root) " \
>> + "rw rootfstype=jffs2"
>> +#elif defined(CONFIG_SYS_USE_NANDFLASH)
>> +#define CONFIG_ENV_IS_IN_NAND
>> +#define CONFIG_ENV_OFFSET 0x020000 /* Erase size */
>> +#define CONFIG_ENV_SIZE SZ_128K /* Erase size */
>> +#define CONFIG_BOOTCOMMAND "nand read 0x20400000 0x80000 0x200000; bootm"
>> +#define CONFIG_BOOTARGS "console=ttyS0,115200 "
> \
>> + "root=/dev/mtdblock5 " \
>> + "mtdparts=atmel_nand:128k(bootstrap)ro,"\
>> + "256k(uboot)ro,128k(env)ro," \
>> + "2M(linux),-(root) " \
>> + "rw rootfstype=jffs2"
>> +#else
>> +#define CONFIG_ENV_IS_NOWHERE
>> +#define CONFIG_ENV_SIZE SZ_128K
>> +#define CONFIG_BOOTARGS "console=ttyS2,115200n8"
>> +#endif
>> +
>> +/* U-Boot Commands */
>> +#include<config_cmd_default.h>
>> +#undef CONFIG_CMD_FPGA
>> +#undef CONFIG_CMD_IMI
>> +#undef CONFIG_CMD_IMLS
>> +#undef CONFIG_CMD_LOADS
>> +
>> +#define CONFIG_CMD_CACHE
>> +#define CONFIG_CMD_PING
>> +#define CONFIG_CMD_DHCP
>> +
>> +/* BOOTP options */
>> +#define CONFIG_BOOTP_BOOTFILESIZE
>> +#define CONFIG_BOOTP_BOOTPATH
>> +#define CONFIG_BOOTP_GATEWAY
>> +#define CONFIG_BOOTP_HOSTNAME
>> +
>> +/* Boot Linux */
>> +#define CONFIG_CMDLINE_TAG
>> +#define CONFIG_SETUP_MEMORY_TAGS
>> +#define CONFIG_ZERO_BOOTDELAY_CHECK
>> +#define CONFIG_BOOTDELAY 3
>> +
>> +#define CONFIG_BOOTFILE "uImage"
>> +#define CONFIG_LOADADDR 0x20400000
>> +#define CONFIG_EXTRA_ENV_SETTINGS \
>> + "ethaddr=00:01:02:B4:36:65\0" \
>> + "ipaddr=192.168.3.2\0" \
>> + "serverip=192.168.3.1\0" \
>> +
Forgot to remove CONFIG_EXTRA_ENV_SETTINGS, I'll do it in the next patch
version.
>> +#endif /* __CONFIG_SKAT91_SIM508_H__ */
>
> Otherwise seems fine
Nice, thanks a lot.
--
With best wishes,
Vladimir
More information about the U-Boot
mailing list