Dear Chander Kashyap, On 31 March 2011 18:14, Chander Kashyap <chander.kash...@linaro.org> wrote: > SMDKV310 board is based on Samsung S5PV310 SOC. This SOC is very much > similar to S5PC210. > > Signed-off-by: Chander Kashyap <chander.kash...@linaro.org> > Signed-off-by: Tushar Behera <tushar.beh...@linaro.org> > --- > board/samsung/smdkv310/Makefile | 46 +++ > board/samsung/smdkv310/config.mk | 1 + > board/samsung/smdkv310/lowlevel_init.S | 549 +++++++++++++++++++++++++++ > board/samsung/smdkv310/mem_setup.S | 632 > ++++++++++++++++++++++++++++++++ > board/samsung/smdkv310/smdkv310.c | 138 +++++++ > boards.cfg | 1 + > include/configs/smdkv310.h | 199 ++++++++++ > 7 files changed, 1566 insertions(+), 0 deletions(-) > create mode 100644 board/samsung/smdkv310/Makefile > create mode 100644 board/samsung/smdkv310/config.mk > create mode 100644 board/samsung/smdkv310/lowlevel_init.S > create mode 100644 board/samsung/smdkv310/mem_setup.S > create mode 100644 board/samsung/smdkv310/smdkv310.c > create mode 100644 include/configs/smdkv310.h
You missing MAINTAINER entry. > diff --git a/board/samsung/smdkv310/config.mk > b/board/samsung/smdkv310/config.mk > new file mode 100644 > index 0000000..19b9e2f > --- /dev/null > +++ b/board/samsung/smdkv310/config.mk > @@ -0,0 +1 @@ > +CONFIG_SYS_TEXT_BASE = 0x43e00000 Please remove this file. And move this define to config file. > diff --git a/board/samsung/smdkv310/lowlevel_init.S > b/board/samsung/smdkv310/lowlevel_init.S > new file mode 100644 > index 0000000..ead12b2 > --- /dev/null > +++ b/board/samsung/smdkv310/lowlevel_init.S > +#define MEM_DLLl_ON > + please remove this space. > + > +_TEXT_BASE: > + .word CONFIG_SYS_TEXT_BASE > + > + .globl lowlevel_init > +lowlevel_init: > + push {lr} ditto. > + > + > + /* r5 has always zero */ > + mov r5, #0 > + > + ldr r7, =S5PC210_GPIO_PART1_BASE > + ldr r6, =S5PC210_GPIO_PART2_BASE > + > + /* check reset status */ > + ldr r0, =(S5PC210_POWER_BASE + 0x81C) @ INFORM7 > + ldr r1, [r0] > + > + /* AFTR wakeup reset */ > + ldr r2, =S5P_CHECK_DIDLE > + cmp r1, r2 > + beq exit_wakeup > + > + /* Sleep wakeup reset */ > + ldr r2, =S5P_CHECK_SLEEP > + cmp r1, r2 > + beq wakeup_reset > + > + /* when we already run in ram, we don't need to relocate U-Boot. > + * and actually, memory controller must be configured before U-Boot > + * is running in ram. > + */ We don't allow this comment style. Please check it. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle > + ldr r0, =0x00ffffff /* r0 <- Mask Bits*/ > + bic r1, pc, r0 /* pc <- current addr of code */ > + /* r1 <- unmasked bits of pc */ > + > + ldr r2, _TEXT_BASE /* r2 <- original base addr in ram */ > + bic r2, r2, r0 /* r2 <- unmasked bits of r2*/ > + cmp r1, r2 /* compare r1, r2 */ > + beq 1f /* r0 == r1 then skip sdram init */ > + > + /* init system clock */ > + bl system_clock_init > + > + /* Memory initialize */ > + bl mem_ctrl_asm_init Is it OK that memory initialize on u-boot? Maybe only do on mmc spl? > + > +1: > + /* for UART */ > + bl uart_asm_init > + bl tzpc_init > + pop {pc} > + > +wakeup_reset: > + bl system_clock_init > + bl mem_ctrl_asm_init > + bl tzpc_init > + > +exit_wakeup: > + /*Load return address and jump to kernel*/ > + ldr r0, =(S5PC210_POWER_BASE + 0x800) @ INFORM0 > + > + /* r1 = physical address of s5pc210_cpu_resume function */ > + ldr r1, [r0] > + > + /* Jump to kernel*/ > + mov pc, r1 > + nop > + nop > + > +/* > + * system_clock_init: Initialize core clock and bus clock. > + * void system_clock_init(void) > + */ > +system_clock_init: > + push {lr} > + ldr r0, =S5PC210_CLOCK_BASE > + > + /* APLL(1), MPLL(1), CORE(0), HPM(0) */ > + ldr r1, =0x0101 > + ldr r2, =0x14200 @CLK_SRC_CPU > + str r1, [r0, r2] > + > + /* wait ?us */ > + mov r1, #0x10000 > +1: subs r1, r1, #1 > + bne 1b > + > + ldr r1, =0x0110 > + ldr r2, =0x0C210 @CLK_SRC_TOP0 > + str r1, [r0, r2] > + > + ldr r1, =0x00 > + ldr r2, =0x0C214 @CLK_SRC_TOP1_OFFSET > + str r1, [r0, r2] > + > + /* DMC */ > + ldr r1, =0x00 > + ldr r2, =0x10200 @CLK_SRC_DMC_OFFSET > + str r1, [r0, r2] > + > + /* SATA: SCLKMPLL(0), MMC[0:4]: SCLKMPLL(6) */ > + > + ldr r1, =0x066666 > + ldr r2, =0x0C240 @ CLK_SRC_FSYS > + str r1, [r0, r2] > + > + /*CLK_SRC_LEFTBUS */ > + ldr r1, =0x00 > + ldr r2, =0x04200 @CLK_SRC_LEFTBUS_OFFSET > + str r1, [r0, r2] > + > + /*CLK_SRC_RIGHTBUS */ > + ldr r1, =0x00 > + ldr r2, =0x08200 @CLK_SRC_RIGHTBUS_OFFSET > + str r1, [r0, r2] > + > + /* UART[0:4], PWM: SCLKMPLL(6) */ > + ldr r1, =0x06666666 > + ldr r2, =0x0C250 @CLK_SRC_PERIL0_OFFSET > + str r1, [r0, r2] > + > + /* wait ?us */ > + mov r1, #0x10000 > +4: subs r1, r1, #1 > + bne 4b > + > + /* CLK_DIV_CPU0: > + PCLK_DBG_RATIO[20] 0x1 > + ATB_RATIO[16] 0x3 > + PERIPH_RATIO[12] 0x3 > + COREM1_RATIO[8] 0x7 > + COREM0_RATIO[4] 0x3 > + */ Check the style. > + ldr r1, =0x0133730 > + ldr r2, =0x14500 @CLK_DIV_CPU0_OFFSET > + str r1, [r0, r2] > + > + /* CLK_DIV_CPU1 > + COPY_RATIO [0] 0x3 > + */ ditto. > diff --git a/board/samsung/smdkv310/mem_setup.S > b/board/samsung/smdkv310/mem_setup.S > new file mode 100644 > index 0000000..3ff486c > --- /dev/null > +++ b/board/samsung/smdkv310/mem_setup.S > @@ -0,0 +1,632 @@ > +/* > + * Memory setup for SMDKV310 board based on S5PC210 > + * > + * Copyright (C) 2011 Samsung Electronics > + * > + * 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> > + > +#define SET_MIU > + > +#define MEM_DLL > + > +#ifdef CONFIG_CLK_800_330_165 > +#define DRAM_CLK_330 > +#endif > +#ifdef CONFIG_CLK_1000_200_200 > +#define DRAM_CLK_200 > +#endif > +#ifdef CONFIG_CLK_1000_330_165 > +#define DRAM_CLK_330 > +#endif > +#ifdef CONFIG_CLK_1000_400_200 > +#define DRAM_CLK_400 > +#endif > + > + .globl mem_ctrl_asm_init > +mem_ctrl_asm_init: > + > + /* Async bridge configuration at CPU_core */ > + /* 1: half_sync */ > + /* 0: full_sync */ > + ldr r0, =0x10010350 > + mov r1, #1 > + str r1, [r0] > + > + ldr r0, =0x10000000 @CHIP_ID_BASE > + ldr r1, [r0] > + lsr r1, r1, #8 > + and r1, r1, #3 > + cmp r1, #2 > + bne v310 > + > + /* CLK_DIV_DMC0 on iROM DMC=50MHz for Init DMC */ > + ldr r0, =0x10030000 @CMU_BASE > + ldr r1, =0x13113113 > + ldr r2, =0x10500 @CLK_DIV_DMC0_OFFSET > + str r1, [r0, r2] > + > +#ifdef SET_MIU > + ldr r0, =0x10600000 @MIU_BASE > +#ifdef CONFIG_MIU_1BIT_INTERLEAVED > + ldr r1, =0x0000000c > + str r1, [r0, #0x400] @MIU_INTLV_CONFIG > + ldr r1, =0x40000000 > + str r1, [r0, #0x808] @MIU_INTLV_START_ADDR > + ldr r1, =0x5fffffff > + str r1, [r0, #0x810] @MIU_INTLV_END_ADDR > + ldr r1, =0x00000001 > + str r1, [r0, #0x800] @MIU_MAPPING_UPDATE > +#endif > +#ifdef CONFIG_MIU_2BIT_INTERLEAVED > + ldr r1, =0x2000150c > + str r1, [r0, #0x400] @MIU_INTLV_CONFIG > + ldr r1, =0x40000000 > + str r1, [r0, #0x808] @MIU_INTLV_START_ADDR > + ldr r1, =0x5fffffff > + str r1, [r0, #0x810] @MIU_INTLV_END_ADDR > + ldr r1, =0x00000001 > + str r1, [r0, #0x800] @MIU_MAPPING_UPDATE > +#endif > +#ifdef CONFIG_MIU_LINEAR > + ldr r1, =0x40000000 > + str r1, [r0, #0x818] @MIU_SINGLE_MAPPING0_START_ADDR > + ldr r1, =0x4fffffff > + str r1, [r0, #0x820] @MIU_SINGLE_MAPPING0_END_ADDR > + ldr r1, =0x50000000 > + str r1, [r0, #0x828] @MIU_SINGLE_MAPPING1_START_ADDR > + ldr r1, =0x5fffffff > + str r1, [r0, #0x830] @MIU_SINGLE_MAPPING1_END_ADDR] > + ldr r1, =0x00000006 > + str r1, [r0, #0x800] @MIU_MAPPING_UPDATE > +#endif > +#endif > + > +/*****************************************************************/ > +/*DREX0***********************************************************/ > +/*****************************************************************/ Check the style globally.. > diff --git a/board/samsung/smdkv310/smdkv310.c > b/board/samsung/smdkv310/smdkv310.c > new file mode 100644 > index 0000000..255ae88 > --- /dev/null > +++ b/board/samsung/smdkv310/smdkv310.c > @@ -0,0 +1,138 @@ > +/* > + * Copyright (C) 2011 Samsung Electronics > + * > + * 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 <asm/io.h> > +#include <netdev.h> > +#include <asm/arch/cpu.h> > +#include <asm/arch/gpio.h> > +#include <asm/arch/mmc.h> > + > +DECLARE_GLOBAL_DATA_PTR; > +struct s5pc210_gpio_part1 *gpio1; > +struct s5pc210_gpio_part2 *gpio2; > + > +static void smc9115_pre_init(void) > +{ > + unsigned int *ptr; > + /* gpio configuration */ > + > + writel(0x22222222, 0x11000000 + 0x120); NAK. What is 0x11000000 + 0x120? > + > + /* Ethernet needs bus width of 16 bits */ > + ptr = (unsigned int *) (S5PC210_SROMC_BASE + 0); > + *ptr = 0x9999; > + > + /* Select and configure the SROMC bank (Bank = 1)*/ > + ptr = (unsigned int *) (S5PC210_SROMC_BASE + 0x08); > + *ptr = 0xffffffff; NAK. Please use read/write function with structure. > +} > + > +int board_init(void) > +{ > + smc9115_pre_init(); > + > + gpio1 = (struct s5pc210_gpio_part1 *) S5PC210_GPIO_PART1_BASE; > + gpio2 = (struct s5pc210_gpio_part2 *) S5PC210_GPIO_PART2_BASE; > + > + gd->bd->bi_arch_number = MACH_TYPE; Please use MACH_TYPE_SMDKV310 directly. > + gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); > + return 0; > +} > + > +int dram_init(void) > +{ > + gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, > PHYS_SDRAM_1_SIZE) > + + get_ram_size((long *)PHYS_SDRAM_2, > PHYS_SDRAM_2_SIZE) > + + get_ram_size((long *)PHYS_SDRAM_3, > PHYS_SDRAM_3_SIZE) > + + get_ram_size((long *)PHYS_SDRAM_4, > PHYS_SDRAM_4_SIZE); > + > + return 0; > +} > + > +void dram_init_banksize(void) > +{ > + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; > + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; > + gd->bd->bi_dram[1].start = PHYS_SDRAM_2; > + gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; > + gd->bd->bi_dram[2].start = PHYS_SDRAM_3; > + gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE; > + gd->bd->bi_dram[3].start = PHYS_SDRAM_4; > + gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE; > +} > + > +int board_eth_init(bd_t *bis) > +{ > + int rc = 0; > +#ifdef CONFIG_SMC911X > + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); > +#endif > + return rc; > +} > + > +#ifdef BOARD_LATE_INIT > +int board_late_init(void) > +{ > + return 0; > +} > +#endif Just return 0? then, please remove it. Please don't make dead function. > + > +#ifdef CONFIG_DISPLAY_BOARDINFO > +int checkboard(void) > +{ > + unsigned int *ptr = (unsigned int *) S5PC210_PRO_ID; Please use readl function. > + if (((*ptr & 0x300) >> 8) == 2) Please add some descriptions. > + printf("\nBoard: SMDKC210\n"); > + else > + printf("\nBoard: SMDKV310\n"); > + > + return 0; > +} > +#endif > + > +#endif > diff --git a/boards.cfg b/boards.cfg > index 45c3102..8bb245d 100644 > --- a/boards.cfg > +++ b/boards.cfg > @@ -128,6 +128,7 @@ omap4_sdp4430 arm armv7 > sdp4430 ti > s5p_goni arm armv7 goni > samsung s5pc1xx > smdkc100 arm armv7 smdkc100 > samsung s5pc1xx > s5pc210_universal arm armv7 universal_c210 > samsung s5pc2xx > +smdkv310 arm armv7 smdkv310 > samsung s5pc2xx > harmony arm armv7 harmony > nvidia tegra2 > seaboard arm armv7 seaboard > nvidia tegra2 > actux1 arm ixp > diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h > new file mode 100644 > index 0000000..a80f902 > --- /dev/null > +++ b/include/configs/smdkv310.h > +/* High Level Configuration Options */ > +#define CONFIG_ARMV7 1 /*This is an ARM V7 CPU core > */ > +#define CONFIG_SAMSUNG 1 /* in a SAMSUNG core */ > +#define CONFIG_S5P 1 /* S5P Family */ > +#define CONFIG_S5PC210 1 /* which is in a S5PC210 SoC > */ > +#define CONFIG_SMDKV310 1 /* working within > SMDKV310*/ > +#define CONFIG_EVT1 1 /* EVT1 */ Is it need? > + > +#include <asm/arch/cpu.h> /* get chip and board defs */ > + > +#define CONFIG_ARCH_CPU_INIT > +#define CONFIG_DISPLAY_CPUINFO > +#define CONFIG_DISPLAY_BOARDINFO > + > +/* Keep L2 Cache Disabled */ > +#define CONFIG_L2_OFF 1 > + > +#define CONFIG_SYS_SDRAM_BASE 0x40000000 > + > +/* input clock of PLL: SMDKV310 has 24MHz input clock */ > +#define CONFIG_SYS_CLK_FREQ 24000000 > + > +#define CONFIG_SETUP_MEMORY_TAGS > +#define CONFIG_CMDLINE_TAG > +#define CONFIG_INITRD_TAG > +#define CONFIG_CMDLINE_EDITING > + > +/* Handling Sleep Mode*/ > +#define S5P_CHECK_SLEEP 0x00000BAD > +#define S5P_CHECK_DIDLE 0xBAD00000 > + > +/* Architecture magic and machine type */ > +#define MACH_TYPE 2925UL /* SMDKV310 machine ID */ Please remove it. Use MACH_TYPE_SMDKV310 define. > +#define UBOOT_MAGIC (0x43090000 | MACH_TYPE) What is it? > + > +/* Size of malloc() pool */ > +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (1 << 20)) > + > +/* size in bytes reserved for initial data */ > +#define CONFIG_SYS_GBL_DATA_SIZE 128 This define doesn't use anywhere. Please remove it. > + > +/* select serial console configuration */ > +#define CONFIG_SERIAL_MULTI 1 > +#define CONFIG_SERIAL1 1 /* use SERIAL 1 */ > +#define CONFIG_BAUDRATE 115200 > +#define S5PC210_UART1_OFFSET 0x010000 > + > +/* SMDKV310 has 4 bank of DRAM */ > +#define CONFIG_NR_DRAM_BANKS 4 > +#define SDRAM_BANK_SIZE (512 << 20) /* 512 MB */ > +#define PHYS_SDRAM_1 CONFIG_SYS_SDRAM_BASE > +#define PHYS_SDRAM_1_SIZE SDRAM_BANK_SIZE > +#define PHYS_SDRAM_2 (CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE) > +#define PHYS_SDRAM_2_SIZE SDRAM_BANK_SIZE > +#define PHYS_SDRAM_3 (CONFIG_SYS_SDRAM_BASE + 2 * SDRAM_BANK_SIZE) > +#define PHYS_SDRAM_3_SIZE SDRAM_BANK_SIZE > +#define PHYS_SDRAM_4 (CONFIG_SYS_SDRAM_BASE + 3 * SDRAM_BANK_SIZE) > +#define PHYS_SDRAM_4_SIZE SDRAM_BANK_SIZE > + remove space. > + > +/* FLASH and environment organization */ > +#define CONFIG_SYS_NO_FLASH 1 > +#undef CONFIG_CMD_IMLS > +#define CONFIG_IDENT_STRING " for SMDKC210/V310" > + > +/* base address for uboot */ > +#define CONFIG_SYS_PHY_UBOOT_BASE (CONFIG_SYS_SDRAM_BASE + 0x3e00000) > +#define CONFIG_SYS_MMC_UBOOT_START CONFIG_SYS_PHY_UBOOT_BASE > + > +#ifdef CONFIG_USE_IRQ > +#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */ > +#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */ > +#endif > + > +#define CONFIG_CLK_1000_400_200 > +#define CONFIG_BOOTM_LINUX 1 Already defined at config_cmd_default.h Please remove it. > +#define CONFIG_INCLUDE_TEST > +#define CONFIG_IMAGE_BOOT > +#define USE_MMC2 > +#define MMC_MAX_CHANNEL 4 What is these defines? > + > +#define CONFIG_ENV_IS_IN_MMC 1 > +#define CONFIG_SYS_MMC_ENV_DEV 0 > +#define CONFIG_ENV_SIZE (16 << 10) /* 16 KB */ > +#define RESERVE_BLOCK_SIZE (512) > +#define BL1_SIZE (16 << 10) /*16 K reserved for BL1*/ > +#define CONFIG_ENV_OFFSET (RESERVE_BLOCK_SIZE + BL1_SIZE) > +#define CONFIG_DOS_PARTITION 1 > + > +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - > 0x1000000) #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE) is better. > + > +#undef CONFIG_SKIP_RELOCATE_UBOOT > +#undef CONFIG_USE_NOR_BOOT > +#undef CONFIG_USE_IRQ > +#undef CONFIG_NO_SDMMC_DETECTION > +#undef CONFIG_USB_STORAGE remove these defines. Please don't make private defines if you don't have special reason. Thanks Minkyu Kang. -- from. prom. www.promsoft.net _______________________________________________ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev