From 6b7c0f5ebf767dec8cac0463867fbbeb5493eec3 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Mon, 25 Oct 2010 03:12:24 +0900 Subject: [PATCH] sh: Add support shmin board This adds support for the SHMIN SH7706 board(T-SH7706LAN). The CPU of this board is SH7706. There are SDRAM of 32M byte, Flash memory of 512K byte, Serial, 10Base Ether and MMC. http://web.kyoto-inet.or.jp/people/takagaki/T-SH7706/T-SH7706.htm Signed-off-by: Nobuhiro Iwamatsu --- MAINTAINERS | 1 + board/shmin/Makefile | 49 +++++++++++++++++++ board/shmin/config.mk | 27 +++++++++++ board/shmin/lowlevel_init.S | 36 ++++++++++++++ board/shmin/shmin.c | 108 +++++++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/shmin.h | 115 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 337 insertions(+) create mode 100644 board/shmin/Makefile create mode 100644 board/shmin/config.mk create mode 100644 board/shmin/lowlevel_init.S create mode 100644 board/shmin/shmin.c create mode 100644 include/configs/shmin.h diff --git a/MAINTAINERS b/MAINTAINERS index 553930a..d7cd09c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1011,6 +1011,7 @@ Nobuhiro Iwamatsu SH7763RDP SH7763 RSK7203 SH7203 AP325RXA SH7723 + SHMIN SH7706 Mark Jonas diff --git a/board/shmin/Makefile b/board/shmin/Makefile new file mode 100644 index 0000000..be04e2c --- /dev/null +++ b/board/shmin/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2010 Nobuhiro Iwamatsu +# Copyright (C) 2008 Renesas Solutions Corp. +# +# u-boot/board/shmin/Makefile +# +# 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 = lib$(BOARD).a + +OBJS := shmin.o +SOBJS := lowlevel_init.o + +LIB := $(addprefix $(obj),$(LIB)) +OBJS := $(addprefix $(obj),$(OBJS)) +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 .depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/shmin/config.mk b/board/shmin/config.mk new file mode 100644 index 0000000..eca20d4 --- /dev/null +++ b/board/shmin/config.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2010 Nobuhiro Iwamatsu +# +# u-boot/board/shmin/config.mk +# +# 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 + +# +# TEXT_BASE refers to image _after_ relocation. +# +# NOTE: Must match value used in u-boot.lds (in this directory). +# + +CONFIG_SYS_TEXT_BASE = 0x8DFC0000 diff --git a/board/shmin/lowlevel_init.S b/board/shmin/lowlevel_init.S new file mode 100644 index 0000000..b29da35 --- /dev/null +++ b/board/shmin/lowlevel_init.S @@ -0,0 +1,36 @@ +/* + * (C) Copyright 2008, 2010 Nobuhiro Iwamatsu + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include + +#include +#include + + + .global lowlevel_init + + .text + .align 2 + +lowlevel_init: + /* Use setting of original bootloader */ + rts + nop + .align 2 diff --git a/board/shmin/shmin.c b/board/shmin/shmin.c new file mode 100644 index 0000000..8742f10 --- /dev/null +++ b/board/shmin/shmin.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2007 - 2010 + * Nobuhiro Iwamatsu + * (C) Copyright 2000-2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * + * board/shmin/shmin.c + * + * 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 + * + * Copy board_flash_get_legacy() from board/freescale/m54455evb/m54455evb.c + */ + +#include +#include +#include + +int checkboard(void) +{ + puts("BOARD: T-SH7706LAN "); + if(readb(0xb0008006) == 0xab) + puts("v2\n"); + else + puts("v1\n"); + return 0; +} + +int board_init(void) +{ + writew(0x2980, BCR2); + return 0; +} + +int dram_init(void) +{ + DECLARE_GLOBAL_DATA_PTR; + + gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; + printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); + return 0; +} + +void led_set_state(unsigned short value) +{ + +} + +#if defined(CONFIG_FLASH_CFI_LEGACY) +#include +ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info) +{ + int sect[] = CONFIG_SYS_ATMEL_SECT; + int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ; + int i, j, k; + + if (base != CONFIG_SYS_ATMEL_BASE) + return 0; + + info->flash_id = 0x01000000; + info->portwidth = 1; + info->chipwidth = 1; + info->buffer_size = 1; + info->erase_blk_tout = 16384; + info->write_tout = 2; + info->buffer_write_tout = 5; + info->vendor = 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */ + info->cmd_reset = 0x00F0; + info->interface = FLASH_CFI_X8; + info->legacy_unlock = 0; + info->manufacturer_id = (u16) ATM_MANUFACT; + info->device_id = ATM_ID_LV040; + info->device_id2 = 0; + info->ext_addr = 0; + info->cfi_version = 0x3133; + info->cfi_offset = 0x0000; + info->addr_unlock1 = 0x00000555; + info->addr_unlock2 = 0x000002AA; + info->name = "CFI conformant"; + info->size = 0; + info->sector_count = CONFIG_SYS_ATMEL_TOTALSECT; + info->start[0] = base; + + for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) { + info->size += sect[i] * sectsz[i]; + for (j = 0; j < sect[i]; j++, k++) { + info->start[k + 1] = info->start[k] + sectsz[i]; + info->protect[k] = 0; + } + } + + return 1; +} +#endif /* CONFIG_FLASH_CFI_LEGACY */ diff --git a/boards.cfg b/boards.cfg index 94b8745..0574bb2 100644 --- a/boards.cfg +++ b/boards.cfg @@ -745,6 +745,7 @@ xilinx-ppc440-generic_flash powerpc ppc4xx ppc440-generic xilinx rsk7203 sh sh2 rsk7203 renesas - mpr2 sh sh3 mpr2 - - ms7720se sh sh3 ms7720se - - +shmin sh sh3 shmin - - espt sh sh4 espt - - ms7722se sh sh4 ms7722se - - ms7750se sh sh4 ms7750se - - diff --git a/include/configs/shmin.h b/include/configs/shmin.h new file mode 100644 index 0000000..42d6fe2 --- /dev/null +++ b/include/configs/shmin.h @@ -0,0 +1,115 @@ +/* + * Configuation settings for shmin (T-SH7706LAN) + * + * Copyright (C) 2010 Nobuhiro Iwamatsu + * + * 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 __SHMIN_H +#define __SHMIN_H + +#define CONFIG_SH 1 +#define CONFIG_SH3 1 +#define CONFIG_CPU_SH7706 1 +#define CONFIG_SHMIN 1 + +#define CONFIG_CMD_FLASH +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_NET +#define CONFIG_CMD_PING +#define CONFIG_CMD_NFS +#define CONFIG_CMD_ENV +#define CONFIG_CMD_SAVEENV + +#define CONFIG_BAUDRATE 115200 +#define CONFIG_BOOTARGS "console=ttySC0,115200" + +/* + * This board has original boot loader. If you write u-boot to 0x0, + * you should set undef. + */ +#define CONFIG_VERSION_VARIABLE +#undef CONFIG_SHOW_BOOT_PROGRESS + +/* system */ +#define SHMIN_SDRAM_BASE (0x8C000000) +#define SHMIN_FLASH_BASE_1 (0xA0000000) + +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */ +#define CONFIG_SYS_CBSIZE 256 /* Buffer size for input from the Console */ +#define CONFIG_SYS_PBSIZE 256 /* Buffer size for Console output */ +#define CONFIG_SYS_MAXARGS 16 /* max args accepted for monitor commands */ +/* Buffer size for Boot Arguments passed to kernel */ +#define CONFIG_SYS_BARGSIZE 512 +/* List of legal baudrate settings for this board */ +#define CONFIG_SYS_BAUDRATE_TABLE { 115200 } + +/* SCIF */ +#define CONFIG_SCIF_CONSOLE 1 +#define CONFIG_CONS_SCIF0 1 + +/* memory */ +#define CONFIG_SYS_SDRAM_BASE SHMIN_SDRAM_BASE +#define CONFIG_SYS_SDRAM_SIZE (32 * 1024 * 1024) +#define CONFIG_SYS_MEMTEST_START SHMIN_SDRAM_BASE +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + CONFIG_SYS_SDRAM_SIZE - (256 * 1024)) + +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 1 * 1024 * 1024) +#define CONFIG_SYS_MONITOR_BASE (SHMIN_FLASH_BASE_1 + CONFIG_ENV_SECT_SIZE) +#define CONFIG_SYS_MONITOR_LEN (128 * 1024) +#define CONFIG_SYS_MALLOC_LEN (256 * 1024) +#define CONFIG_SYS_GBL_DATA_SIZE 256 +#define CONFIG_SYS_BOOTMAPSZ (8 * 1024 * 1024) + +/* FLASH */ +#define CONFIG_SYS_FLASH_CFI +#define CONFIG_FLASH_CFI_DRIVER +#undef CONFIG_SYS_FLASH_QUIET_TEST +#define CONFIG_SYS_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */ +#define CONFIG_SYS_FLASH_BASE SHMIN_FLASH_BASE_1 +#define CONFIG_SYS_MAX_FLASH_SECT 11 +#define CONFIG_SYS_MAX_FLASH_BANKS 1 + +#define CONFIG_FLASH_CFI_LEGACY +#define CONFIG_SYS_ATMEL_BASE CONFIG_SYS_FLASH_BASE +#define CONFIG_SYS_ATMEL_TOTALSECT CONFIG_SYS_MAX_FLASH_SECT +#define CONFIG_SYS_ATMEL_REGION 4 +#define CONFIG_SYS_ATMEL_SECT {1, 2, 1, 7} +#define CONFIG_SYS_ATMEL_SECTSZ {0x4000, 0x2000, 0x8000, 0x10000} + +#define CONFIG_ENV_IS_IN_FLASH +#define CONFIG_ENV_SECT_SIZE (64 * 1024) +#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) +#define CONFIG_SYS_FLASH_ERASE_TOUT 120000 +#define CONFIG_SYS_FLASH_WRITE_TOUT 500 + +/* Board Clock */ +#define CONFIG_SYS_CLK_FREQ 33333333 +#define CONFIG_SYS_TMU_CLK_DIV 4 +#define CONFIG_SYS_HZ 1000 + +/* Network device */ +#define CONFIG_DRIVER_NE2000 +#define CONFIG_DRIVER_NE2000_BASE (0xb0000300) + +#endif /* __SHMIN_H */ -- 2.7.4