[U-Boot] [PATCH v2 16/17] SPEAr : spear1300 SoC support added

Vipin KUMAR vipin.kumar at st.com
Mon May 3 10:35:38 CEST 2010


On 5/3/2010 6:07 AM, Tom Rix wrote:
> Vipin KUMAR wrote:
>> SPEAr1300 SoC support contains basic spear1300 support along with the
>> usage of following drivers
>> - serial driver(UART)
>> - i2c driver
>> - smi driver
>> - nand driver(FSMC)
>> - usbd driver
>>
>> Signed-off-by: Vipin Kumar <vipin.kumar at st.com>
>> ---
>>  Makefile                                       |    6 +
> 
> Need MAINTAINERS MAKEALL
> 
OK. Would be done in patch v3

>>  arch/arm/include/asm/arch-spear13xx/hardware.h |    8 +-
>>  board/spear/common/Makefile                    |   10 +-
>>  board/spear/spear1300/Makefile                 |   51 ++++++
>>  board/spear/spear1300/config.mk                |   28 ++++
>>  board/spear/spear1300/spear1300.c              |   86 ++++++++++
>>  board/spear/spear1300/spr_lowlevel_init.S      |   38 +++++
>>  include/configs/spear13xx.h                    |  199
>> ++++++++++++++++++++++++
>>  8 files changed, 420 insertions(+), 6 deletions(-)
>>  create mode 100644 board/spear/spear1300/Makefile
>>  create mode 100644 board/spear/spear1300/config.mk
>>  create mode 100644 board/spear/spear1300/spear1300.c
>>  create mode 100644 board/spear/spear1300/spr_lowlevel_init.S
>>  create mode 100644 include/configs/spear13xx.h
>>
>> diff --git a/Makefile b/Makefile
>> index 7bfdfd3..0b6a151 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -3041,6 +3041,12 @@ spear320_config :    unconfig
>>  spear600_config :    unconfig
>>      @$(MKCONFIG) -n $@ -t $(@:_config=) spear6xx arm arm926ejs
>> $(@:_config=) spear spear
>>  
>> +spear1300_config \
>> +spear1300_nand_config \
>> +spear1300_usbtty_config \
>> +spear1300_usbtty_nand_config :    unconfig
>> +    @$(MKCONFIG) -n $@ -t $(@:_config=) spear13xx arm arm_cortexa8
>> spear1300 spear spear13xx
>> +
>>  suen3_config:    unconfig
>>      @$(MKCONFIG) $(@:_config=) arm arm926ejs km_arm keymile kirkwood
>>  
>> diff --git a/arch/arm/include/asm/arch-spear13xx/hardware.h
>> b/arch/arm/include/asm/arch-spear13xx/hardware.h
>> index 384260a..7a1cedb 100644
>> --- a/arch/arm/include/asm/arch-spear13xx/hardware.h
>> +++ b/arch/arm/include/asm/arch-spear13xx/hardware.h
>> @@ -24,10 +24,10 @@
>>  #ifndef _ASM_ARCH_HARDWARE_H
>>  #define _ASM_ARCH_HARDWARE_H
>>  
>> -#define CONFIG_SYS_USBD_BASE            (0xE1100000)
>> -#define CONFIG_SYS_PLUG_BASE            (0xE1200000)
>> -#define CONFIG_SYS_FIFO_BASE            (0xE1000800)
>> -#define CONFIG_SYS_SMI_BASE            (0xFC000000)
>> +#define CONFIG_SYS_USBD_BASE            (0xE3800000)
>> +#define CONFIG_SYS_PLUG_BASE            (0xE2800000)
>> +#define CONFIG_SYS_FIFO_BASE            (0xE3000800)
>> +#define CONFIG_SYS_SMI_BASE            (0xEA000000)
>>  #define CONFIG_SPEAR_TIMERBASE            (0xE0380000)
>>  #define CONFIG_SPEAR_MISCBASE            (0xE0700000)
>>  #define CONFIG_SYS_I2C_BASE            (0xE0280000)
>> diff --git a/board/spear/common/Makefile b/board/spear/common/Makefile
>> index 4f8959f..1ae4fd4 100644
>> --- a/board/spear/common/Makefile
>> +++ b/board/spear/common/Makefile
>> @@ -29,8 +29,14 @@ endif
>>  
>>  LIB    = $(obj)lib$(VENDOR).a
>>  
>> -COBJS    := spr_misc.o
>> -SOBJS    := spr_lowlevel_init.o
>> +COBJS-$(CONFIG_SPEAR3XX) += spr_misc.o
>> +COBJS-$(CONFIG_SPEAR600) += spr_misc.o
>> +
>> +SOBJS-$(CONFIG_SPEAR3XX) += spr_lowlevel_init.o
>> +SOBJS-$(CONFIG_SPEAR600) += spr_lowlevel_init.o
>> +
>> +COBJS    := $(COBJS-y)
>> +SOBJS    := $(SOBJS-y)
>>  
>>  SRCS    := $(SOBJS:.o=.S) $(COBJS:.o=.c)
>>  OBJS    := $(addprefix $(obj),$(COBJS))
>> diff --git a/board/spear/spear1300/Makefile
>> b/board/spear/spear1300/Makefile
>> new file mode 100644
>> index 0000000..fb66895
>> --- /dev/null
>> +++ b/board/spear/spear1300/Makefile
>> @@ -0,0 +1,51 @@
>> +#
>> +# (C) Copyright 2000-2004
>> +# Wolfgang Denk, DENX Software Engineering, wd 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., 59 Temple Place, Suite 330, Boston,
>> +# MA 02111-1307 USA
>> +#
>> +
>> +include $(TOPDIR)/config.mk
>> +
>> +LIB    = $(obj)lib$(BOARD).a
>> +
>> +COBJS    := spear1300.o
>> +SOBJS    := spr_lowlevel_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
>> +
>> +#########################################################################
>>
>> +
>> +# defines $(obj).depend target
>> +include $(SRCTREE)/rules.mk
>> +
>> +sinclude $(obj).depend
>> +
>> +#########################################################################
>>
>> diff --git a/board/spear/spear1300/config.mk
>> b/board/spear/spear1300/config.mk
>> new file mode 100644
>> index 0000000..0bbb40f
>> --- /dev/null
>> +++ b/board/spear/spear1300/config.mk
>> @@ -0,0 +1,28 @@
>> +#
>> +# (C) Copyright 2009
>> +# Vipin Kumar, ST Microelectronics <vipin.kumar at st.com>
>> +#
>> +# 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
>> +#
>> +
>> +#########################################################################
>>
>> +
>> +TEXT_BASE = 0x00700000
>> +
>> +ALL += $(obj)u-boot.img
>> diff --git a/board/spear/spear1300/spear1300.c
>> b/board/spear/spear1300/spear1300.c
>> new file mode 100644
>> index 0000000..89ddc9c
>> --- /dev/null
>> +++ b/board/spear/spear1300/spear1300.c
>> @@ -0,0 +1,86 @@
>> +/*
>> + * (C) Copyright 2009
>> + * Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com.
>> + *
>> + * 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 <common.h>
>> +#include <netdev.h>
>> +#include <nand.h>
>> +#include <asm/io.h>
>> +#include <linux/mtd/fsmc_nand.h>
>> +#include <asm/arch/hardware.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +int board_init(void)
>> +{
>> +    gd->bd->bi_arch_number = MACH_TYPE_SPEAR1300;
>> +    gd->bd->bi_boot_params = CONFIG_BOOT_PARAMS_ADDR;
>> +
>> +    return 0;
>> +}
>> +
>> +int dram_init(void)
>> +{
>> +    gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
>> +    gd->bd->bi_dram[0].size = get_ram_size(PHYS_SDRAM_1,
>> +                           PHYS_SDRAM_1_MAXSIZE);
>> +
>> +    return 0;
>> +}
>> +
>> +int misc_init_r(void)
>> +{
>> +    setenv("verify", "n");
>> +
>> +#if defined(CONFIG_SPEAR_USBTTY)
>> +    setenv("stdin", "usbtty");
>> +    setenv("stdout", "usbtty");
>> +    setenv("stderr", "usbtty");
>> +#endif
>> +    return 0;
>> +}
>> +
>> +/*
>> + * board_nand_init - Board specific NAND initialization
>> + * @nand:    mtd private chip structure
>> + *
>> + * Called by nand_init_chip to initialize the board specific functions
>> + */
>> +
>> +int board_nand_init(struct nand_chip *nand)
>> +{
>> +#if defined(CONFIG_NAND_FSMC)
>> +    return fsmc_nand_init(nand);
>> +#endif
> 
> Broken if CONFIG_NAND_FSMC is not set.
> 

OK. Adding a return -1 in case CONFIG_NAND_FSMC is not defined

>> +}
>> +
>> +#if defined(CONFIG_CMD_NET)
>> +int board_eth_init(bd_t *bis)
>> +{
>> +    /*
>> +     * Board specific ethernet initialization comes here. eg. gmac clock
>> +     * configuration etc
>> +     */
>> +
>> +    return designware_initialize(0, CONFIG_SPEAR_ETHBASE);
>> +}
>> +#endif
>> diff --git a/board/spear/spear1300/spr_lowlevel_init.S
>> b/board/spear/spear1300/spr_lowlevel_init.S
>> new file mode 100644
>> index 0000000..ba93922
>> --- /dev/null
>> +++ b/board/spear/spear1300/spr_lowlevel_init.S
>> @@ -0,0 +1,38 @@
>> +/*
>> + * (C) Copyright 2006
>> + * Vipin Kumar, ST Micoelectronics, vipin.kumar at st.com.
>> + *
>> + * 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 <config.h>
>> +
>> +/*
>> + * platform specific initializations are already done in Xloader
>> + * Initializations already done include
>> + * DDR, PLLs, IP's clock enable and reset release etc
>> + */
>> +.globl lowlevel_init
>> +lowlevel_init:
>> +    /* By default, U-Boot switches CPU to low-vector */
>> +    /* Revert this as we work in high vector even in U-Boot */
>> +    mrc    p15, 0, r0, c1, c0, 0
>> +    orr    r0, r0, #0x00002000
>> +    mcr    p15, 0, r0, c1, c0, 0
>> +    mov    pc, lr
>> diff --git a/include/configs/spear13xx.h b/include/configs/spear13xx.h
>> new file mode 100644
>> index 0000000..3880e0a
>> --- /dev/null
>> +++ b/include/configs/spear13xx.h
>> @@ -0,0 +1,199 @@
>> +/*
>> + * (C) Copyright 2009
>> + * Vipin Kumar, STMicroelectronics, <vipin.kumar at st.com>
>> + *
>> + * 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 __CONFIG_H
>> +#define __CONFIG_H
>> +
>> +#if defined(CONFIG_MK_spear1300)
>> +#define CONFIG_SPEAR13XX            1
>> +#define CONFIG_SPEAR1300            1
>> +#endif
>> +
>> +#if defined(CONFIG_MK_usbtty)
>> +#define CONFIG_SPEAR_USBTTY            1
>> +#endif
>> +
>> +#if defined(CONFIG_MK_nand)
>> +#define CONFIG_ENV_IS_IN_NAND            1
>> +#else
>> +#define CONFIG_ENV_IS_IN_FLASH            1
>> +#endif
>> +
>> +/* Ethernet configuration */
>> +#define CONFIG_MII
>> +#define CONFIG_DESIGNWARE_ETH
>> +#define CONFIG_NET_MULTI
>> +#define CONFIG_DW_ALTDESCRIPTOR            1
>> +#define CONFIG_PHY_RESET_DELAY            (10000)        /* in usec */
>> +
>> +/* USBD driver configuration */
>> +#define CONFIG_DW_UDC
>> +#define CONFIG_USB_DEVICE
>> +#define CONFIG_USB_TTY
>> +
>> +#define CONFIG_USBD_PRODUCT_NAME        "SPEAr SoC"
>> +#define CONFIG_USBD_MANUFACTURER        "ST Microelectronics"
>> +
>> +#define CONFIG_EXTRA_ENV_USBTTY            "usbtty=cdc_acm\0"
> 
> Should be conditional on CONFIG_SPEAR_USBTTY
> Similar changes for spear3xx and spear6xxx
> 

CONFIG_SPEAR_USBTTY is a special case where tty over usb terminal is
used for downloading and flashing images.
usbtty environment variable should normally also be set as cdc_acm to
make sure that we can switch to tty over usb terminal directly from
uboot prompt by simply running 
setenv stdout usbtty\; setenv stdin usbtty

So, I am not making it conditional to CONFIG_EXTRA_ENV_USBTTY

>> +
>> +/* Timer, HZ specific defines */
>> +#define CONFIG_SYS_HZ                (1000)
>> +
>> +/* Flash configuration */
>> +#define CONFIG_ST_SMI                1
>> +#define CONFIG_SYS_MAX_FLASH_BANKS        2
>> +#define CONFIG_SYS_FLASH_BASE            (0xE6000000)
>> +#define CONFIG_SYS_CS1_FLASH_BASE        (0xE7000000)
>> +#define CONFIG_SYS_FLASH_BANK_SIZE        (0x01000000)
>> +#define CONFIG_SYS_FLASH_ADDR_BASE        {CONFIG_SYS_FLASH_BASE, \
>> +                        CONFIG_SYS_CS1_FLASH_BASE}
>> +#define CONFIG_SYS_MAX_FLASH_SECT        128
>> +
>> +#define CONFIG_SYS_FLASH_EMPTY_INFO        1
>> +#define CONFIG_SYS_FLASH_ERASE_TOUT        (3 * CONFIG_SYS_HZ)
>> +#define CONFIG_SYS_FLASH_WRITE_TOUT        (3 * CONFIG_SYS_HZ)
>> +
>> +/*
>> + * Serial Configuration (PL011)
>> + */
>> +#define CONFIG_PL011_SERIAL
>> +#define CONFIG_SYS_SERIAL0            0xE0000000
>> +#define CONFIG_PL011_CLOCK            (48 * 1000 * 1000)
>> +#define CONFIG_CONS_INDEX            0
>> +#define CONFIG_BAUDRATE                115200
>> +#define CONFIG_SYS_BAUDRATE_TABLE        { 9600, 19200, 38400, \
>> +                        57600, 115200 }
>> +
>> +#define CONFIG_SYS_LOADS_BAUD_CHANGE
>> +#define CONFIG_PL01x_PORTS            {(void *)CONFIG_SYS_SERIAL0}
>> +
>> +/*
>> + * NAND FLASH Configuration
>> + */
>> +#define CONFIG_NAND_FSMC            1
>> +#define CONFIG_SYS_FSMC_NAND_LP            1
>> +#define CONFIG_SYS_FSMC_NAND_8BIT        1
>> +#define CONFIG_SYS_MAX_NAND_DEVICE        1
>> +#define CONFIG_MTD_NAND_VERIFY_WRITE        1
>> +#define CONFIG_SYS_NAND_BASE            (0xA0000000)
>> +
>> +/*
>> + * Command support defines
>> + */
>> +#define CONFIG_CMD_NAND
>> +#define CONFIG_CMD_MEMORY
>> +#define CONFIG_CMD_RUN
>> +#define CONFIG_CMD_NET
>> +#define CONFIG_CMD_MII
>> +#define CONFIG_CMD_PING
>> +#define CONFIG_CMD_DHCP
>> +
>> +/* This must be included AFTER the definition of CONFIG_COMMANDS (if
>> any) */
>> +#include <config_cmd_default.h>
>> +
>> +/*
>> + * Default Environment Varible definitions
>> + */
>> +#if defined(CONFIG_SPEAR_USBTTY)
>> +#define CONFIG_BOOTDELAY            -1
> 
> Add comment that this disables autoboot
> 
OK. Would be done in patch v3

> Tom
> 
> 
>> +#else
>> +#define CONFIG_BOOTDELAY            1
>> +#endif
>> +
>> +/*
>> + * Environment placing
>> + */
>> +#if defined(CONFIG_ENV_IS_IN_FLASH)
>> +/*
>> + * Environment is in serial NOR flash
>> + */
>> +#define CONFIG_SYS_MONITOR_LEN            0x00040000
>> +#define CONFIG_ENV_SECT_SIZE            0x00010000
>> +#define CONFIG_FSMTDBLK                "/dev/mtdblock8 "
>> +
>> +#define CONFIG_BOOTCOMMAND            "bootm 0xe6050000"
>> +
>> +#define CONFIG_SYS_MONITOR_BASE            CONFIG_SYS_FLASH_BASE
>> +#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + \
>> +                        CONFIG_SYS_MONITOR_LEN)
>> +#elif defined(CONFIG_ENV_IS_IN_NAND)
>> +/*
>> + * Environment is in NAND
>> + */
>> +
>> +#define CONFIG_ENV_OFFSET            0x60000
>> +#define CONFIG_ENV_RANGE            0x10000
>> +#define CONFIG_FSMTDBLK                "/dev/mtdblock12 "
>> +
>> +#define CONFIG_BOOTCOMMAND            "nand read.jffs2 0x1600000 " \
>> +                        "0x80000 0x4C0000; " \
>> +                        "bootm 0x1600000"
>> +#endif
>> +
>> +#define CONFIG_BOOTARGS_NFS            "root=/dev/nfs ip=dhcp " \
>> +                        "console=ttyAMA0 init=/bin/sh"
>> +#define CONFIG_BOOTARGS                "console=ttyAMA0 mem=128M "  \
>> +                        "root="CONFIG_FSMTDBLK \
>> +                        "rootfstype=jffs2"
>> +
>> +#define CONFIG_ENV_SIZE                0x02000
>> +
>> +/* Miscellaneous configurable options */
>> +#define CONFIG_ARCH_CPU_INIT            1
>> +#define CONFIG_DISPLAY_CPUINFO            1
>> +
>> +#define CONFIG_BOOT_PARAMS_ADDR            0x00000100
>> +#define CONFIG_CMDLINE_TAG            1
>> +#define CONFIG_SETUP_MEMORY_TAGS        1
>> +#define CONFIG_MISC_INIT_R            1
>> +#define CONFIG_ZERO_BOOTDELAY_CHECK        1
>> +#define CONFIG_AUTOBOOT_KEYED            1
>> +#define CONFIG_AUTOBOOT_STOP_STR        " "
>> +#define CONFIG_AUTOBOOT_PROMPT            \
>> +        "Hit SPACE in %d seconds to stop autoboot.\n", bootdelay
>> +
>> +#define CONFIG_SYS_MEMTEST_START        0x00800000
>> +#define CONFIG_SYS_MEMTEST_END            0x04000000
>> +#define CONFIG_SYS_MALLOC_LEN            (1024*1024)
>> +#define CONFIG_SYS_GBL_DATA_SIZE        128
>> +#define CONFIG_IDENT_STRING            "-SPEAr"
>> +#define CONFIG_SYS_LONGHELP
>> +#define CONFIG_SYS_PROMPT            "u-boot> "
>> +#define CONFIG_CMDLINE_EDITING
>> +#define CONFIG_SYS_CBSIZE            256
>> +#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_SYS_LOAD_ADDR            0x00800000
>> +#define CONFIG_SYS_CONSOLE_INFO_QUIET        1
>> +#define CONFIG_SYS_64BIT_VSPRINTF        1
>> +
>> +#define CONFIG_EXTRA_ENV_SETTINGS        CONFIG_EXTRA_ENV_USBTTY
>> +
>> +/* Physical Memory Map */
>> +#define CONFIG_NR_DRAM_BANKS            1
>> +#define PHYS_SDRAM_1                0x00000000
>> +#define PHYS_SDRAM_1_MAXSIZE            0x40000000
>> +
>> +#endif
> 
> 



More information about the U-Boot mailing list