From patchwork Wed Jan 11 23:12:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 135526 X-Patchwork-Delegate: andreas.biessmann@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BF081B6EF7 for ; Thu, 12 Jan 2012 10:12:51 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 11E43287C0; Thu, 12 Jan 2012 00:12:49 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J5cWYL6drNYP; Thu, 12 Jan 2012 00:12:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 577E2284C4; Thu, 12 Jan 2012 00:12:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4ACC6284C4 for ; Thu, 12 Jan 2012 00:12:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eOfFaeES-EH0 for ; Thu, 12 Jan 2012 00:12:43 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.mleia.com (li271-223.members.linode.com [178.79.152.223]) by theia.denx.de (Postfix) with ESMTPS id 4EB5328226 for ; Thu, 12 Jan 2012 00:12:42 +0100 (CET) Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id D910E18D6B; Wed, 11 Jan 2012 23:12:40 +0000 (GMT) From: Vladimir Zapolskiy To: u-boot@lists.denx.de Date: Thu, 12 Jan 2012 01:12:27 +0200 Message-Id: <1326323547-9350-1-git-send-email-vz@mleia.com> X-Mailer: git-send-email 1.7.5.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20120111_231240_921340_20F4B43D X-CRM114-Status: GOOD ( 60.38 ) Subject: [U-Boot] [PATCH v2] skat91: add support for SK-AT91SAM9/SIM508 board X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This change adds complete support for Starterkit SK-AT91SAM9/SIM508 board. Signed-off-by: Vladimir Zapolskiy Cc: Albert ARIBAUD Cc: Wolfgang Denk --- Changes from v1 to v2: * make use of setbits_le32() and similar helpers * phy address is defined explicitly * removed CONFIG_EXTRA_ENV_SETTINGS MAINTAINERS | 4 + board/starterkit/skat91_sim508/Makefile | 44 ++++++ board/starterkit/skat91_sim508/partition.c | 39 +++++ board/starterkit/skat91_sim508/skat91_sim508.c | 122 ++++++++++++++++ boards.cfg | 2 + include/configs/skat91_sim508.h | 178 ++++++++++++++++++++++++ 6 files changed, 389 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 hawkboard ARM926EJS (OMAP-L138) +Vladimir Zapolskiy + + 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 +# Copyright (C) 2008, Guennadi Liakhovetski +# +# 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 + * + * 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 +#include +#include +#include + +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..1ddafab --- /dev/null +++ b/board/starterkit/skat91_sim508/skat91_sim508.c @@ -0,0 +1,122 @@ +/* + * StarterKit SK-AT91SAM9/SIM508 board support + * + * Copyright (C) 2011 Vladimir Zapolskiy + * + * 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 +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +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; + + /* Assign CS3 to NAND/SmartMedia Interface */ + setbits_le32(&matrix->ebicsa, AT91_MATRIX_CS3A_SMC_SMARTMEDIA); + + /* 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, + CONFIG_PHY_ADDR); +} +#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..794b7d7 --- /dev/null +++ b/include/configs/skat91_sim508.h @@ -0,0 +1,178 @@ +/* + * Starterkit SK-AT91SAM9/SIM508 board configuration file + * + * Copyright (C) 2011 Vladimir Zapolskiy + * + * 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 +#include + +/* 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 +#define CONFIG_PHY_ADDR 0x01 + +/* U-Boot General Configurations */ +#define CONFIG_SYS_LONGHELP +#define CONFIG_SYS_PROMPT "=> " +#define CONFIG_SYS_CBSIZE 1024 +#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 +#define CONFIG_ENV_SIZE SZ_128K +#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 +#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 + +#endif /* __CONFIG_SKAT91_SIM508_H__ */