From 51fd9a7e01bd9ee5e09341131e157397c05b8a14 Mon Sep 17 00:00:00 2001 From: Stefano Babic Date: Wed, 20 Oct 2010 09:23:06 +0200 Subject: MX51: add CONFIG_SYS_TEXT_BASE to vision2 board, use general ld script Recent patch changed TEXT_BASE to CONFIG_SYS_TEXT_BASE and vision2 board was not updated. Signed-off-by: Stefano Babic diff --git a/board/ttcontrol/vision2/config.mk b/board/ttcontrol/vision2/config.mk index 59f3367..952037e 100644 --- a/board/ttcontrol/vision2/config.mk +++ b/board/ttcontrol/vision2/config.mk @@ -20,6 +20,6 @@ # MA 02111-1307 USA # -LDSCRIPT = $(CPUDIR)/$(SOC)/u-boot.lds -TEXT_BASE = 0x97800000 +CONFIG_SYS_TEXT_BASE = 0x97800000 IMX_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/imximage_hynix.cfg +ALL += $(obj)u-boot.imx -- cgit v0.10.2 From 95707aaa9ef2dd84649c257cdcf563641322c4d3 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Thu, 21 Oct 2010 09:11:47 +0800 Subject: MX5:use common u-boot.lds of cpu layer Remove u-boot.lds from mx5 and use the common u-boot.lds of cpu layer. This patch also fix the building errors: arch/arm/cpu/armv7/start.o: In function `_rel_dyn_start_ofs': arch/arm/cpu/armv7/start.S:283: undefined reference to `__rel_dyn_start' arch/arm/cpu/armv7/start.o: In function `_rel_dyn_end_ofs': arch/arm/cpu/armv7/start.S:283: undefined reference to `__rel_dyn_end' arch/arm/cpu/armv7/start.o: In function `_dynsym_start_ofs': arch/arm/cpu/armv7/start.S:283: undefined reference to `__dynsym_start' Signed-off-by: Jason Liu diff --git a/arch/arm/cpu/armv7/mx5/u-boot.lds b/arch/arm/cpu/armv7/mx5/u-boot.lds deleted file mode 100644 index 55d6599..0000000 --- a/arch/arm/cpu/armv7/mx5/u-boot.lds +++ /dev/null @@ -1,73 +0,0 @@ -/* - * January 2004 - Changed to support H4 device - * Copyright (c) 2004 Texas Instruments - * - * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, - * - * (C) Copyright 2009 Freescale Semiconductor, Inc. - * - * 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 - */ - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -SECTIONS -{ - . = 0x00000000; - - . = ALIGN(4); - .text : - { - arch/arm/cpu/armv7/start.o - *(.text) - } - - . = ALIGN(4); - .rodata : { *(.rodata) } - - . = ALIGN(4); - .data : { - *(.data) - __datarel_start = .; - *(.data.rel) - __datarelrolocal_start = .; - *(.data.rel.ro.local) - __datarellocal_start = .; - *(.data.rel.local) - __datarelro_start = .; - *(.data.rel.ro) - } - - __got_start = .; - . = ALIGN(4); - .got : { *(.got) } - __got_end = .; - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = ALIGN(4); - __bss_start = .; - .bss : { *(.bss) } - _end = .; -} diff --git a/board/freescale/mx51evk/config.mk b/board/freescale/mx51evk/config.mk index 716fca9..6e90671 100644 --- a/board/freescale/mx51evk/config.mk +++ b/board/freescale/mx51evk/config.mk @@ -20,7 +20,6 @@ # MA 02111-1307 USA # -LDSCRIPT = $(CPUDIR)/$(SOC)/u-boot.lds CONFIG_SYS_TEXT_BASE = 0x97800000 IMX_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/imximage.cfg ALL += $(obj)u-boot.imx -- cgit v0.10.2 From 81129d07a0e9f6e28029170b082d6f8810f72712 Mon Sep 17 00:00:00 2001 From: Matthias Weisser Date: Wed, 27 Oct 2010 16:34:38 +0200 Subject: imx25: Fix reset This patch fixes the reset command on imx25. The watchdog registers are 16 bits in size and not 32. This patch also adds the service register codes as constants. Signed-off-by: Matthias Weisser diff --git a/arch/arm/cpu/arm926ejs/mx25/reset.c b/arch/arm/cpu/arm926ejs/mx25/reset.c index 1e33150..1a43683 100644 --- a/arch/arm/cpu/arm926ejs/mx25/reset.c +++ b/arch/arm/cpu/arm926ejs/mx25/reset.c @@ -43,14 +43,14 @@ void reset_cpu (ulong ignored) { struct wdog_regs *regs = (struct wdog_regs *)IMX_WDT_BASE; /* Disable watchdog and set Time-Out field to 0 */ - writel (0x00000000, ®s->wcr); + writew(0, ®s->wcr); /* Write Service Sequence */ - writel (0x00005555, ®s->wsr); - writel (0x0000AAAA, ®s->wsr); + writew(WSR_UNLOCK1, ®s->wsr); + writew(WSR_UNLOCK2, ®s->wsr); /* Enable watchdog */ - writel (WCR_WDE, ®s->wcr); + writew(WCR_WDE, ®s->wcr); while (1) ; } diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h b/arch/arm/include/asm/arch-mx25/imx-regs.h index f709bd8..f5a2929 100644 --- a/arch/arm/include/asm/arch-mx25/imx-regs.h +++ b/arch/arm/include/asm/arch-mx25/imx-regs.h @@ -108,11 +108,11 @@ struct gpt_regs { /* Watchdog Timer (WDOG) registers */ struct wdog_regs { - u32 wcr; /* Control */ - u32 wsr; /* Service */ - u32 wrsr; /* Reset Status */ - u32 wicr; /* Interrupt Control */ - u32 wmcr; /* Misc Control */ + u16 wcr; /* Control */ + u16 wsr; /* Service */ + u16 wrsr; /* Reset Status */ + u16 wicr; /* Interrupt Control */ + u16 wmcr; /* Misc Control */ }; /* IIM control registers */ @@ -308,7 +308,9 @@ struct iim_regs { #define GPT_CTRL_TEN 1 /* Timer enable */ /* WDOG enable */ -#define WCR_WDE 0x04 +#define WCR_WDE 0x04 +#define WSR_UNLOCK1 0x5555 +#define WSR_UNLOCK2 0xAAAA /* FUSE bank offsets */ #define IIM0_MAC 0x1a -- cgit v0.10.2 From 9a0044183a148ab553e296848cbfa4338fc83323 Mon Sep 17 00:00:00 2001 From: Stefano Babic Date: Thu, 28 Oct 2010 11:08:52 +0200 Subject: MX51: remove warning in clock.c The patch removes the warning: clock.c:291: warning: initialization from incompatible pointer type after constification of args[] Signed-off-by: Stefano Babic diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c index 00f649c..0b04a88 100644 --- a/arch/arm/cpu/armv7/mx5/clock.c +++ b/arch/arm/cpu/armv7/mx5/clock.c @@ -269,7 +269,7 @@ u32 imx_get_fecclk(void) /* * Dump some core clockes. */ -int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { u32 freq; -- cgit v0.10.2 From 888b4f435f74ae8ba7a5df552b119ba25c7438dc Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Wed, 27 Oct 2010 23:36:04 +0800 Subject: mx51evk: Fix 2 hours reset issue The mx51evk u-boot has an issue that system will get reset every 2 hours. MC13892 has an inside charge timer which expires in 120 minutes. If ICHRG and CHGAUTOB are not set properly, this timer expiration will get system power recycled. Since mx51evk has no Li-Ion battery on board, the patch sets ICHRG in externally powered mode and sets CHGAUTOB bit to avoid automatic charging, so that system will not get reset by this timer expiration. The patch also corrects the bit field definition of register 48 (Charger 0) per latest MC13892 Reference Manual. Signed-off-by: Shawn Guo diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index c8d7d39..0b58b1b 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -188,10 +188,10 @@ static void power_init(void) val &= ~PWGT2SPIEN; pmic_reg_write(REG_POWER_MISC, val); - /* Write needed to update Charger 0 */ - pmic_reg_write(REG_CHARGE, VCHRG0 | VCHRG1 | VCHRG2 | - ICHRG0 | ICHRG1 | ICHRG2 | ICHRG3 | ICHRGTR0 | - OVCTRL1 | UCHEN | CHRGLEDEN | CYCLB); + /* Externally powered */ + val = pmic_reg_read(REG_CHARGE); + val |= ICHRG0 | ICHRG1 | ICHRG2 | ICHRG3 | CHGAUTOB; + pmic_reg_write(REG_CHARGE, val); /* power up the system first */ pmic_reg_write(REG_POWER_MISC, PWUP); diff --git a/include/mc13892.h b/include/mc13892.h index 791e3ec..61c3e6e 100644 --- a/include/mc13892.h +++ b/include/mc13892.h @@ -29,24 +29,24 @@ /* REG_CHARGE */ -#define VCHRG0 0 +#define VCHRG0 (1 << 0) #define VCHRG1 (1 << 1) #define VCHRG2 (1 << 2) #define ICHRG0 (1 << 3) #define ICHRG1 (1 << 4) #define ICHRG2 (1 << 5) #define ICHRG3 (1 << 6) -#define ICHRGTR0 (1 << 7) -#define ICHRGTR1 (1 << 8) -#define ICHRGTR2 (1 << 9) +#define TREN (1 << 7) +#define ACKLPB (1 << 8) +#define THCHKB (1 << 9) #define FETOVRD (1 << 10) #define FETCTRL (1 << 11) #define RVRSMODE (1 << 13) -#define OVCTRL0 (1 << 15) -#define OVCTRL1 (1 << 16) -#define UCHEN (1 << 17) +#define PLIM0 (1 << 15) +#define PLIM1 (1 << 16) +#define PLIMDIS (1 << 17) #define CHRGLEDEN (1 << 18) -#define CHRGRAWPDEN (1 << 19) +#define CHGTMRRST (1 << 19) #define CHGRESTART (1 << 20) #define CHGAUTOB (1 << 21) #define CYCLB (1 << 22) -- cgit v0.10.2 From 06982534b65f4ceddd124d0467c89dd7adf6d445 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Mon, 25 Oct 2010 23:20:30 +0800 Subject: mx51evk: consolidate env for mmcboot and netboot This patch is to consolidate default mx51evk env for two primary boot modes, mmcboot and netboot. It also cleans some unused env like netdev, uboot and redundant env like loadaddr since CONFIG_LOADADDR already defines it. Signed-off-by: Shawn Guo diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index f31fc4e..a39260c 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -125,18 +125,42 @@ #define CONFIG_LOADADDR 0x90800000 /* loadaddr env var */ -#define CONFIG_EXTRA_ENV_SETTINGS \ - "netdev=eth0\0" \ - "uboot_addr=0xa0000000\0" \ - "uboot=u-boot.bin\0" \ - "loadaddr=0x90800000\0" \ - "bootargs_base=setenv bootargs console=tty "\ - "console=ttymxc0,${baudrate}\0"\ - "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\ - "bootcmd=run bootcmd_net\0" \ - "bootcmd_net=run bootargs_base bootargs_nfs; " \ - "tftpboot ${loadaddr} ${kernel}; bootm\0" +#define CONFIG_EXTRA_ENV_SETTINGS \ + "script=boot.scr\0" \ + "uimage=uImage\0" \ + "mmcdev=0\0" \ + "mmcpart=2\0" \ + "mmcroot=/dev/mmcblk0p3 rw\0" \ + "mmcrootfstype=ext3 rootwait\0" \ + "mmcargs=setenv bootargs console=ttymxc0,${baudrate} " \ + "root=${mmcroot} " \ + "rootfstype=${mmcrootfstype}\0" \ + "loadbootscript=" \ + "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "bootscript=echo Running bootscript from mmc ...; " \ + "source\0" \ + "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ + "mmcboot=echo Booting from mmc ...; " \ + "run mmcargs; " \ + "bootm\0" \ + "netargs=setenv bootargs console=ttymxc0,${baudrate} " \ + "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ + "netboot=echo Booting from net ...; " \ + "run netargs; " \ + "dhcp ${uimage}; bootm\0" \ + +#define CONFIG_BOOTCOMMAND \ + "if mmc rescan ${mmcdev}; then " \ + "if run loadbootscript; then " \ + "run bootscript; " \ + "else " \ + "if run loaduimage; then " \ + "run mmcboot; " \ + "else run netboot; " \ + "fi; " \ + "fi; " \ + "else run netboot; fi" #define CONFIG_ARP_TIMEOUT 200UL @@ -144,6 +168,8 @@ * Miscellaneous configurable options */ #define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " #define CONFIG_SYS_PROMPT "MX51EVK U-Boot > " #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ -- cgit v0.10.2 From 1ab027cbf6536f40348699a7b7bfa8bbedf88c8e Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Thu, 28 Oct 2010 10:13:15 +0800 Subject: mx51evk: support new relocation scheme This patch is to fix build breakage and support new relocation scheme for mx51evk. - Correct IRAM base address and add size definition The IRAM starts from 0x1FFE0000 on final revsion i.mx51 than 0x1FFE8000 which is for older revision. - Include imx-regs.h in mx51evk.h Definitions like CSD0_BASE_ADDR and IRAM_BASE_ADDR can be referred to. - Define CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE They are used to define init RAM layout. - Remove comment for CONFIG_SYS_GBL_DATA_SIZE which has been buried by Wolfgang's commit below 25ddd1fb: Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value Signed-off-by: Shawn Guo diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h b/arch/arm/include/asm/arch-mx5/imx-regs.h index 3ddda40..0b6249a 100644 --- a/arch/arm/include/asm/arch-mx5/imx-regs.h +++ b/arch/arm/include/asm/arch-mx5/imx-regs.h @@ -26,7 +26,8 @@ /* * IRAM */ -#define IRAM_BASE_ADDR 0x1FFE8000 /* internal ram */ +#define IRAM_BASE_ADDR 0x1FFE0000 /* internal ram */ +#define IRAM_SIZE 0x00020000 /* 128 KB */ /* * Graphics Memory of GPU */ diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index 0b58b1b..2160d5a 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -52,9 +52,9 @@ u32 get_board_rev(void) int dram_init(void) { - gd->bd->bi_dram[0].start = PHYS_SDRAM_1; - gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, - PHYS_SDRAM_1_SIZE); + /* dram_init must store complete ramsize in gd->ram_size */ + gd->ram_size = get_ram_size((volatile void *)CONFIG_SYS_SDRAM_BASE, + PHYS_SDRAM_1_SIZE); return 0; } diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h index a39260c..f98438d 100644 --- a/include/configs/mx51evk.h +++ b/include/configs/mx51evk.h @@ -24,11 +24,11 @@ #ifndef __CONFIG_H #define __CONFIG_H +#include /* High Level Configuration Options */ #define CONFIG_MX51 /* in a mx51 */ -#define CONFIG_SKIP_RELOCATE_UBOOT #define CONFIG_SYS_MX5_HCLK 24000000 #define CONFIG_SYS_MX5_CLK32 32768 @@ -51,7 +51,6 @@ * Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * 1024 * 1024) -/* size in bytes reserved for initial data */ #define BOARD_LATE_INIT @@ -200,6 +199,15 @@ #define PHYS_SDRAM_1 CSD0_BASE_ADDR #define PHYS_SDRAM_1_SIZE (512 * 1024 * 1024) +#define CONFIG_SYS_SDRAM_BASE (PHYS_SDRAM_1) +#define CONFIG_SYS_INIT_RAM_ADDR (IRAM_BASE_ADDR) +#define CONFIG_SYS_INIT_RAM_SIZE (IRAM_SIZE) + +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + #define CONFIG_SYS_DDR_CLKSEL 0 #define CONFIG_SYS_CLKTL_CBCDR 0x59E35100 -- cgit v0.10.2