From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Christophe PLAGNIOL-VILLARD Date: Thu, 30 Apr 2009 07:54:13 +0200 Subject: [U-Boot] [PATCH] ARM DaVinci:Adding DM365 Support In-Reply-To: <1241021958-22733-1-git-send-email-s-paulraj@ti.com> References: <1241021958-22733-1-git-send-email-s-paulraj@ti.com> Message-ID: <20090430055413.GA6263@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 12:19 Wed 29 Apr , s-paulraj at ti.com wrote: > Patch adds support for DaVinci DM365. > It does not have the DM9000 like the DM355 but has capability > for 4 BIT ECC correction just like DM355. > This patch lacks 2 features > > 1) No 4 BIT ECC correction. We will add support for 4 BIT ECC correction > to the NAND driver(davinci_nand.c) soon so that other device like > the DM355 can also use this feature. Other TI SOCs like DA830(Primus) > not yet part of the U-Boot GIT can also use this once support is added. > Some core NAND driver APIs were changed and are being used by TI in > our internal releases but those patches were not accepted when posted to > the MTD list. So this support will have to wait for some time. > > 2) I have managed to get EMAC working in my branch but i see that there are > patches where the location of the EMAC driver has changed along with a > few other changes. The EMAC on all TI SOCs like DM644x, DM6467, DM365 > and DA830 is simlar but not the same. So i need to come up with a patch > which will enable EMAC to work on all TI SOCs. > > Patches for the above features mentioned will be added soon. Patch for 4 BIT > ECC correction and EMAC should not take much time to submit but the feature > where we change the NAND read APIs to work along with the EMIF 2.3 IP present > in latest DaVinci SOCs will take some time. I'm not sure you really want all this comment will be in the final commit message > > Signed-off-by: Sandeep Paulraj > --- > MAKEALL | 1 + > Makefile | 3 + > board/davinci/dm365_evm/Makefile | 52 ++++++++++ > board/davinci/dm365_evm/board_init.S | 29 ++++++ > board/davinci/dm365_evm/config.mk | 39 ++++++++ > board/davinci/dm365_evm/dm365_evm.c | 97 +++++++++++++++++++ > board/davinci/dm365_evm/u-boot.lds | 52 ++++++++++ > cpu/arm926ejs/davinci/Makefile | 1 + > cpu/arm926ejs/davinci/dm365.c | 39 ++++++++ > include/asm-arm/arch-davinci/hardware.h | 3 + > include/configs/davinci_dm365_evm.h | 155 +++++++++++++++++++++++++++++++ > 11 files changed, 471 insertions(+), 0 deletions(-) > create mode 100644 board/davinci/dm365_evm/Makefile > create mode 100644 board/davinci/dm365_evm/board_init.S > create mode 100644 board/davinci/dm365_evm/config.mk > create mode 100755 board/davinci/dm365_evm/dm365_evm.c > create mode 100644 board/davinci/dm365_evm/u-boot.lds > create mode 100644 cpu/arm926ejs/davinci/dm365.c > create mode 100644 include/configs/davinci_dm365_evm.h > > diff --git a/MAKEALL b/MAKEALL > index c65f418..31cbaef 100755 > --- a/MAKEALL > +++ b/MAKEALL > @@ -529,6 +529,7 @@ LIST_ARM9=" \ > davinci_sonata \ > davinci_dm355evm \ > davinci_dm357_evm \ > + davinci_dm365_evm \ > " > > ######################################################################### > diff --git a/Makefile b/Makefile > index fb0ce64..6a8ffa0 100644 > --- a/Makefile > +++ b/Makefile > @@ -2796,6 +2796,9 @@ davinci_dm355evm_config : unconfig > davinci_dm357_evm_config : unconfig > @$(MKCONFIG) $(@:_config=) arm arm926ejs dm357_evm davinci davinci > > +davinci_dm365_evm_config : unconfig > + @$(MKCONFIG) $(@:_config=) arm arm926ejs dm365_evm davinci davinci > + > lpd7a400_config \ > lpd7a404_config: unconfig > @$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x > diff --git a/board/davinci/dm365_evm/Makefile b/board/davinci/dm365_evm/Makefile > new file mode 100644 > index 0000000..a0ed353 > --- /dev/null > +++ b/board/davinci/dm365_evm/Makefile > @@ -0,0 +1,52 @@ > +# > +# (C) Copyright 2000, 2001, 2002 > +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. > +# > +# Copyright (C) 2007 Sergey Kubushyn > +# > +# 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 := dm365_evm.o > +SOBJS := board_init.o > + > +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) > +OBJS := $(addprefix $(obj),$(COBJS)) > +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 > + > +######################################################################### > +# This is for $(obj).depend target > +include $(SRCTREE)/rules.mk > + > +sinclude $(obj).depend > + > +######################################################################### > diff --git a/board/davinci/dm365_evm/board_init.S b/board/davinci/dm365_evm/board_init.S > new file mode 100644 > index 0000000..22d8adc > --- /dev/null > +++ b/board/davinci/dm365_evm/board_init.S > @@ -0,0 +1,29 @@ > +/* > + * Copyright (C) 2007 Sergey Kubushyn > + * > + * Board-specific low level initialization code. Called at the very end > + * of cpu/arm926ejs/davinci/lowlevel_init.S. Just returns if there is no > + * initialization required. > + * > + * 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 > + > +.globl dv_board_init > +dv_board_init: > + > + mov pc, lr > diff --git a/board/davinci/dm365_evm/config.mk b/board/davinci/dm365_evm/config.mk > new file mode 100644 > index 0000000..aa89d0e > --- /dev/null > +++ b/board/davinci/dm365_evm/config.mk > @@ -0,0 +1,39 @@ > +# > +# (C) Copyright 2002 > +# Gary Jennejohn, DENX Software Engineering, > +# David Mueller, ELSOFT AG, > +# > +# (C) Copyright 2003 > +# Texas Instruments, > +# Swaminathan > +# > +# Davinci EVM board (ARM925EJS) cpu > +# see http://www.ti.com/ for more information on Texas Instruments > +# > +# Davinci EVM has 1 bank of 256 MB DDR RAM > +# Physical Address: > +# 8000'0000 to 9000'0000 > +# > +# Copyright (C) 2007 Sergey Kubushyn > +# > +# Visioneering Corp. Sonata board (ARM926EJS) cpu > +# > +# Sonata board has 1 bank of 128 MB DDR RAM > +# Physical Address: > +# 8000'0000 to 8800'0000 > +# > +# Razorstream, LLC. SCHMOOGIE board (ARM926EJS) cpu > +# > +# Schmoogie board has 1 bank of 128 MB DDR RAM > +# Physical Address: > +# 8000'0000 to 8800'0000 > +# > +# Linux-Kernel is expected to be at 8000'8000, entry 8000'8000 > +# (mem base + reserved) > +# > +# we load ourself to 8108 '0000 > +# > +# > + > +#Provide at least 16MB spacing between us and the Linux Kernel image > +TEXT_BASE = 0x81080000 > diff --git a/board/davinci/dm365_evm/dm365_evm.c b/board/davinci/dm365_evm/dm365_evm.c > new file mode 100755 > index 0000000..24b40d0 > --- /dev/null > +++ b/board/davinci/dm365_evm/dm365_evm.c > @@ -0,0 +1,97 @@ > +/* > + * > + * Copyright (C) 2009 Texas Instruments. > + * > + * ---------------------------------------------------------------------------- > + * > + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. > + * ---------------------------------------------------------------------------- > + * > + */ > +#include > +#include > +#include > +#include > + > +/******************************************* > + Routine: board_init > + Description: Board Initialization routine > +*******************************************/ > +int board_init(void) > +{ > + DECLARE_GLOBAL_DATA_PTR; > + > + /* arch number of DaVinci DM365 */ > + gd->bd->bi_arch_number = 1939; please use match type > + > + /* adress of boot parameters */ > + gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR; please use RAM_BASE + 0x100 style as the other arm boards > + > + /* Set the Bus Priority Register to appropriate value */ > + REG(VBPR) = 0x20; > + > + timer_init(); no need please remove > + > + return 0; > +} > + > + > +/****************************** > + Routine: misc_init_r > + Description: Misc. init > +******************************/ > +int misc_init_r(void) > +{ > + int i; > + u_int8_t tmp[20], buf[10]; > + > + /* Set Ethernet MAC address from EEPROM */ > + if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0x7f00, > + CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, 6)) { > + printf("\nEEPROM @ 0x%02x read FAILED!!!\n", > + CONFIG_SYS_I2C_EEPROM_ADDR); > + } else { > + tmp[0] = 0xff; > + for (i = 0; i < 6; i++) > + tmp[0] &= buf[i]; > + > + if ((tmp[0] != 0xff) && (getenv("ethaddr") == NULL)) { > + sprintf((char *)&tmp[0], > + "%02x:%02x:%02x:%02x:%02x:%02x", buf[0], > + buf[1], buf[2], buf[3], buf[4], buf[5]); > + setenv("ethaddr", (char *)&tmp[0]); > + } > + } Mike up the ethaddr api please took a look doc/README.enetaddr > + > + if (!eth_hw_init()) > + printf("ethernet init failed!\n"); if it's board specific please implement board_eth_init otherwise cpu_eth_init and please take a look on the last ben patches about it > + > + return 0; > +} > + > +/****************************** > + Routine: dram_init > + Description: Memory Info > +******************************/ > +int dram_init(void) > +{ > + DECLARE_GLOBAL_DATA_PTR; > + > + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; > + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; > + > + return 0; > +} > + > diff --git a/board/davinci/dm365_evm/u-boot.lds b/board/davinci/dm365_evm/u-boot.lds > new file mode 100644 > index 0000000..4d50f2c > --- /dev/null > +++ b/board/davinci/dm365_evm/u-boot.lds as mention on other patch the davinci seems to use all the same lds please unify it > @@ -0,0 +1,52 @@ > +/* > + * (C) Copyright 2002 > + * Gary Jennejohn, DENX Software Engineering, > + * > + * 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 > + > +#ifndef __CONFIG_H > +#define __CONFIG_H > +#include > + > +/*=======*/ > +/* Board */ > +/*=======*/ please use this multiline comment style /* * */ > +#define CFG_DM365_EVM > +#define CONFIG_SYS_USE_NAND > +#define CONFIG_SOC_DM365 > +/*===================*/ > +/* SoC Configuration */ > +/*===================*/ > +#define CONFIG_ARM926EJS /* arm926ejs CPU core */ > +#define CONFIG_SYS_CLK_FREQ 297000000 /* Arm Clock frequency */ > +#define CONFIG_SYS_TIMERBASE 0x01c21400 /* use timer 0 */ > +#define CONFIG_SYS_HZ_CLOCK 24000000 > +#define CONFIG_SYS_HZ 1000 > +/*====================================================*/ > +/* EEPROM definitions for the DM365 EVM */ > +/*====================================================*/ > +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 > +#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 > +#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 6 > +#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 20 > +/*=============*/ > +/* Memory Info */ > +/*=============*/ > +#define CONFIG_SYS_MALLOC_LEN (0x40000 + 128*1024) > +#define CONFIG_SYS_GBL_DATA_SIZE 128 > +#define CONFIG_SYS_MEMTEST_START 0x82000000 > +#define CONFIG_SYS_MEMTEST_END 0x90000000 > +#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ > +#define CONFIG_STACKSIZE (256*1024) /* regular stack */ please add a space before and after '*' > +#define PHYS_SDRAM_1 0x80000000 /* DDR Start */ > +#define PHYS_SDRAM_1_SIZE 0x8000000 /* DDR size 128MB */ > +/*====================*/ > +/* Serial Driver info */ > +/*====================*/ > +#define CONFIG_SYS_NS16550 > +#define CONFIG_SYS_NS16550_SERIAL > +#define CONFIG_SYS_NS16550_REG_SIZE -4 > +#define CONFIG_SYS_NS16550_COM1 0x01c20000 /* Base address of UART0 */ > +#define CONFIG_SYS_NS16550_CLK 24000000 CONFIG_SYS_HZ_CLOCK > +#define CONFIG_CONS_INDEX 1 /* use UART0 for console */ > +#define CONFIG_BAUDRATE 115200 /* Default baud rate */ > +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } > +/*===================*/ > +/* I2C Configuration */ > +/*===================*/ > +#define CONFIG_HARD_I2C > +#define CONFIG_DRIVER_DAVINCI_I2C > +#define CONFIG_SYS_I2C_SPEED 100000 > +#define CONFIG_SYS_I2C_SLAVE 10 > +/*==================================*/ > +/* Network & Ethernet Configuration */ > +/*==================================*/ > +#define CONFIG_DRIVER_TI_EMAC please take a look on ben patch > +#define CONFIG_MII > +#define CONFIG_BOOTP_DEFAULT > +#define CONFIG_BOOTP_DNS > +#define CONFIG_BOOTP_DNS2 > +#define CONFIG_BOOTP_SEND_HOSTNAME > +#define CONFIG_NET_RETRY_COUNT 10 > +/*=====================*/ > +/* Flash & Environment */ > +/*=====================*/ > +#define CONFIG_NAND_DAVINCI > +#undef CONFIG_ENV_IS_IN_FLASH > +#define CONFIG_SYS_NO_FLASH > +#define CONFIG_ENV_IS_IN_NAND /* U-Boot env in NAND Flash */ > +#define CONFIG_ENV_SECT_SIZE 0x40000 /* Env sector Size */ > +#define CONFIG_ENV_SIZE SZ_256K > +#define CONFIG_SKIP_LOWLEVEL_INIT /* U-Boot is loaded by a bootloader */ > +#define CONFIG_SKIP_RELOCATE_UBOOT /* to a proper address, init done */ > +#define CONFIG_SYS_NAND_BASE 0x02000000 > +#define CONFIG_SYS_NAND_HW_ECC > +#define CONFIG_SYS_MAX_NAND_DEVICE 2 > +#define CONFIG_ENV_OFFSET 0x3C0000 > +#define CONFIG_SYS_NAND_BASE_LIST {CONFIG_SYS_NAND_BASE, \ ^^^^^^ whitespace please fix > + CONFIG_SYS_NAND_BASE + 0x4000} > +#define DEF_BOOTM "" ??? > +/*==============================*/ > +/* U-Boot general configuration */ > +/*==============================*/ Best Regards, J.