From: wdenk Date: Sun, 27 Oct 2002 11:54:39 +0000 (+0000) Subject: * ARM: Do not include BSS segment in the calculation of the size of X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c62e0c69ee373a24d76df6e2505966ab17b100f5;p=users%2Frw%2Fppcboot.git * ARM: Do not include BSS segment in the calculation of the size of the write-protected part of the flash memory. * Allow printing of image timestamps even when no RTC support is available (option CONFIG_TIMESTAMP); fix byteorder problems in timestamp code. * Enable Modem Support on TRAB --- diff --git a/CHANGELOG b/CHANGELOG index 75fbda9..cbeadd6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,42 @@ +====================================================================== +Modifications since 1.2.1: +====================================================================== + +* ARM: Do not include BSS segment in the calculation of the size of + the write-protected part of the flash memory. + +* Allow printing of image timestamps even when no RTC support is + available (option CONFIG_TIMESTAMP); fix byteorder problems in + timestamp code. + +* Patch by David Müller, 12 Oct 2002: + - common/cmd_i2c.c + endian problem on ARM platform fixed (Not sure if i found all) + + - cpu/arm920t/Makefile + - cpu/arm920t/speed.c + provide interface to "clock maschine" of S3C24xx chips + + - cpu/arm920t/interrupts.c + make use of new "clocks" interface to simpifiy things + + - cpu/arm920t/serial.c + make use of new "clocks" interface to simplifiy things + + - lib_arm/board.c + move interrupt_init() up in table so udelay() is available + in env_init() + + - include/common.h + added "noreturn" attribute to hang() -> fixes compiler warning + added prototypes for functions defined in cpu/arm920t/speed.c + + - include/configs/smdk2400.h + - include/configs/smdk2410.h + - include/configs/trab.h + added CONFIG_PLL_INPUT_FREQ value used by cpu/arm920t/speed.c + + ====================================================================== Modifications for 1.2.1: ====================================================================== diff --git a/README b/README index 617b17f..ae5114b 100644 --- a/README +++ b/README @@ -581,6 +581,13 @@ The following options need to be configured: CONFIG_RTC_MC146818 - use MC146818 RTC CONFIG_RTC_DS1337 - use Maxim, Inc. DS1337 RTC +- Timestamp Support: + + When CONFIG_TIMESTAMP is selected, the timestamp + (date and time) of an image is printed by image + commands like bootm or iminfo. This option is + automatically enabled when you select CFG_CMD_DATE . + - Partition Support: CONFIG_MAC_PARTITION and/or CONFIG_DOS_PARTITION and/or CONFIG_ISO_PARTITION diff --git a/board/cradle/flash.c b/board/cradle/flash.c index bcaa82c..265b609 100644 --- a/board/cradle/flash.c +++ b/board/cradle/flash.c @@ -73,7 +73,7 @@ ulong flash_init(void) */ flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/cradle/ppcboot.lds b/board/cradle/ppcboot.lds index 2825f90..0a89b32 100644 --- a/board/cradle/ppcboot.lds +++ b/board/cradle/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/csb226/flash.c b/board/csb226/flash.c index a54e043..68f5fcb 100644 --- a/board/csb226/flash.c +++ b/board/csb226/flash.c @@ -70,7 +70,7 @@ ulong flash_init(void) */ flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/csb226/ppcboot.lds b/board/csb226/ppcboot.lds index 2825f90..0a89b32 100644 --- a/board/csb226/ppcboot.lds +++ b/board/csb226/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/dnp1110/flash.c b/board/dnp1110/flash.c index ecc154e..ca9aff9 100644 --- a/board/dnp1110/flash.c +++ b/board/dnp1110/flash.c @@ -105,7 +105,7 @@ ulong flash_init(void) */ flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/dnp1110/ppcboot.lds b/board/dnp1110/ppcboot.lds index 775987a..db329c5 100644 --- a/board/dnp1110/ppcboot.lds +++ b/board/dnp1110/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/ep7312/flash.c b/board/ep7312/flash.c index aec1637..f15ca9c 100644 --- a/board/ep7312/flash.c +++ b/board/ep7312/flash.c @@ -59,14 +59,14 @@ ulong flash_init (void) /* Protect monitor and environment sectors */ - flash_protect (FLAG_PROTECT_SET, - CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, - &flash_info[0]); - - flash_protect (FLAG_PROTECT_SET, - CFG_ENV_ADDR, - CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]); + flash_protect ( FLAG_PROTECT_SET, + CFG_FLASH_BASE, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, + &flash_info[0]); + + flash_protect ( FLAG_PROTECT_SET, + CFG_ENV_ADDR, + CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]); return size; } diff --git a/board/ep7312/ppcboot.lds b/board/ep7312/ppcboot.lds index 2daf047..e47e7b6 100644 --- a/board/ep7312/ppcboot.lds +++ b/board/ep7312/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/impa7/flash.c b/board/impa7/flash.c index e90ae33..e6494b8 100644 --- a/board/impa7/flash.c +++ b/board/impa7/flash.c @@ -72,7 +72,7 @@ ulong flash_init(void) */ flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/impa7/ppcboot.lds b/board/impa7/ppcboot.lds index 2daf047..e47e7b6 100644 --- a/board/impa7/ppcboot.lds +++ b/board/impa7/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/lart/flash.c b/board/lart/flash.c index 351b3e1..7b19524 100644 --- a/board/lart/flash.c +++ b/board/lart/flash.c @@ -105,7 +105,7 @@ ulong flash_init(void) */ flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/lart/ppcboot.lds b/board/lart/ppcboot.lds index 775987a..db329c5 100644 --- a/board/lart/ppcboot.lds +++ b/board/lart/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/lubbock/flash.c b/board/lubbock/flash.c index 0662597..84c09a8 100644 --- a/board/lubbock/flash.c +++ b/board/lubbock/flash.c @@ -73,7 +73,7 @@ ulong flash_init(void) */ flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/lubbock/ppcboot.lds b/board/lubbock/ppcboot.lds index 2825f90..0a89b32 100644 --- a/board/lubbock/ppcboot.lds +++ b/board/lubbock/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/shannon/flash.c b/board/shannon/flash.c index b11036e..8e0f752 100644 --- a/board/shannon/flash.c +++ b/board/shannon/flash.c @@ -124,7 +124,7 @@ ulong flash_init(void) #else flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/shannon/ppcboot.lds b/board/shannon/ppcboot.lds index 775987a..db329c5 100644 --- a/board/shannon/ppcboot.lds +++ b/board/shannon/ppcboot.lds @@ -44,6 +44,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/smdk2400/flash.c b/board/smdk2400/flash.c index 31cef07..c4d6bae 100644 --- a/board/smdk2400/flash.c +++ b/board/smdk2400/flash.c @@ -28,6 +28,7 @@ /* #define DEBUG */ #include +#include #define FLASH_BANK_SIZE 0x1000000 /* 2 x 8 MB */ #define MAIN_SECT_SIZE 0x40000 /* 2 x 128 kB */ @@ -92,7 +93,7 @@ ulong flash_init (void) */ flash_protect ( FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect ( FLAG_PROTECT_SET, diff --git a/board/smdk2400/ppcboot.lds b/board/smdk2400/ppcboot.lds index 1ac7596..94fda74 100644 --- a/board/smdk2400/ppcboot.lds +++ b/board/smdk2400/ppcboot.lds @@ -45,6 +45,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/smdk2410/flash.c b/board/smdk2410/flash.c index 3f12dac..c2ec235 100644 --- a/board/smdk2410/flash.c +++ b/board/smdk2410/flash.c @@ -113,7 +113,7 @@ ulong flash_init(void) flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect(FLAG_PROTECT_SET, diff --git a/board/smdk2410/ppcboot.lds b/board/smdk2410/ppcboot.lds index e25d261..8c9c218 100644 --- a/board/smdk2410/ppcboot.lds +++ b/board/smdk2410/ppcboot.lds @@ -45,6 +45,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/board/trab/flash.c b/board/trab/flash.c index 31ac571..2443777 100644 --- a/board/trab/flash.c +++ b/board/trab/flash.c @@ -24,6 +24,7 @@ /* #define DEBUG */ #include +#include ulong myflush (void); @@ -91,7 +92,7 @@ ulong flash_init (void) */ flash_protect ( FLAG_PROTECT_SET, CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, + CFG_FLASH_BASE + _armboot_end_data - _armboot_start, &flash_info[0]); flash_protect ( FLAG_PROTECT_SET, diff --git a/board/trab/ppcboot.lds b/board/trab/ppcboot.lds index 9dc8f73..567447c 100644 --- a/board/trab/ppcboot.lds +++ b/board/trab/ppcboot.lds @@ -55,6 +55,8 @@ SECTIONS . = ALIGN(4); .got : { *(.got) } + armboot_end_data = .; + . = ALIGN(4); .bss : { *(.bss) } diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 8c4699c..7940ff8 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -32,7 +32,7 @@ #include #include #include -#if (CONFIG_COMMANDS & CFG_CMD_DATE) +#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #include #endif @@ -736,18 +736,18 @@ static int image_info (ulong addr) void print_image_hdr (image_header_t *hdr) { -#if (CONFIG_COMMANDS & CFG_CMD_DATE) - time_t timestamp = (time_t)hdr->ih_time; +#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) + time_t timestamp = (time_t)ntohl(hdr->ih_time); struct rtc_time tm; #endif printf (" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name); -#if (CONFIG_COMMANDS & CFG_CMD_DATE) +#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) to_tm (timestamp, &tm); printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n", tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); -#endif /* CFG_CMD_DATE */ +#endif /* CFG_CMD_DATE, CONFIG_TIMESTAMP */ printf (" Image Type: "); print_type(hdr); printf ("\n"); printf (" Data Size: %d Bytes = ", ntohl(hdr->ih_size)); print_size (ntohl(hdr->ih_size), "\n"); diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 91e0464..fe5841e 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -85,6 +85,7 @@ #include #include #include +#include #if (CONFIG_COMMANDS & CFG_CMD_I2C) @@ -458,6 +459,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) if(i2c_read(chip, addr, alen, (char *)&data, size) != 0) { printf("\nError reading the chip,\n"); } else { + data = cpu_to_be32(data); if(size == 1) { printf(" %02lx", (data >> 24) & 0x000000FF); } else if(size == 2) { @@ -494,6 +496,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) } else if(size == 2) { data = data << 16; } + data = be32_to_cpu(data); nbytes = endp - console_buffer; if (nbytes) { #ifdef CONFIG_BOOT_RETRY_TIME diff --git a/cpu/arm720t/start.S b/cpu/arm720t/start.S index e10255a..17ebc54 100644 --- a/cpu/arm720t/start.S +++ b/cpu/arm720t/start.S @@ -83,8 +83,13 @@ _armboot_start: .word _start /* - * Note: armboot_end is defined by the (board-dependent) linker script + * Note: _armboot_end_data and _armboot_end are defined + * by the (board-dependent) linker script. + * _armboot_end_data is the first usable FLASH address after armboot */ +.globl _armboot_end_data +_armboot_end_data: + .word armboot_end_data .globl _armboot_end _armboot_end: .word armboot_end diff --git a/cpu/arm920t/Makefile b/cpu/arm920t/Makefile index 6926d7e..1d853ea 100644 --- a/cpu/arm920t/Makefile +++ b/cpu/arm920t/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = lib$(CPU).a START = start.o -OBJS = serial.o interrupts.o cpu.o +OBJS = serial.o interrupts.o cpu.o speed.o all: .depend $(START) $(LIB) diff --git a/cpu/arm920t/interrupts.c b/cpu/arm920t/interrupts.c index 4a622ab..7e4329a 100644 --- a/cpu/arm920t/interrupts.c +++ b/cpu/arm920t/interrupts.c @@ -40,16 +40,7 @@ #include extern void reset_cpu(ulong addr); -#if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) -extern void samsung_get_fclk(void); -/* this is the same as PCLK, needed to calculate timer_load_val */ -extern unsigned int samsung_uartclk; int timer_load_val = 0; -#endif - -/* for 10 ms clock period @ 50 MHz with 4 bit divider = 1/2 (default) */ -/* and prescaler = 16 */ -#define TIMER_LOAD_VAL 15625 /* macro to read the 16 bit timer */ #define READ_TIMER (rTCNTO4 & 0xffff) @@ -196,24 +187,17 @@ int interrupt_init (void) /* use PWM Timer 4 because it has no output */ /* prescaler for Timer 4 is 16 */ rTCFG0 = 0x0f00; -#if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) if (timer_load_val == 0) { - if (samsung_uartclk == 0) - samsung_get_fclk(); /* * for 10 ms clock period @ PCLK with 4 bit divider = 1/2 * (default) and prescaler = 16. Should be 10390 * @33.25MHz and 15625 @ 50 MHz */ - timer_load_val = samsung_uartclk/(2 * 16 * 100); + timer_load_val = get_PCLK()/(2 * 16 * 100); } /* load value for 10 ms timeout */ lastdec = rTCNTB4 = timer_load_val; -#elif defined(CONFIG_SMDK2410) - /* load value for 10 ms timeout, assumes PCLK is 30 MHz !! */ - lastdec = rTCNTB4 = TIMER_LOAD_VAL; -#endif /* auto load, manual update of Timer 4 */ rTCON = 0x600000; /* auto load, start Timer 4 */ @@ -247,11 +231,7 @@ void udelay (unsigned long usec) ulong tmo; tmo = usec / 1000; -#if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) tmo *= (timer_load_val * 100); -#elif defined(CONFIG_SMDK2410) - tmo *= CFG_HZ; -#endif tmo /= 1000; tmo += get_timer (0); @@ -276,11 +256,7 @@ ulong get_timer_masked (void) timestamp += lastdec - now; } else { /* we have an overflow ... */ -#if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) timestamp += lastdec + timer_load_val - now; -#elif defined(CONFIG_SMDK2410) - timestamp += lastdec + TIMER_LOAD_VAL - now; -#endif } lastdec = now; @@ -292,11 +268,7 @@ void udelay_masked (unsigned long usec) ulong tmo; tmo = usec / 1000; -#if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) tmo *= (timer_load_val * 100); -#elif defined(CONFIG_SMDK2410) - tmo *= CFG_HZ; -#endif tmo /= 1000; reset_timer_masked (); diff --git a/cpu/arm920t/serial.c b/cpu/arm920t/serial.c index 7cba3f2..2c1a948 100644 --- a/cpu/arm920t/serial.c +++ b/cpu/arm920t/serial.c @@ -19,31 +19,12 @@ */ #include -#include #if defined(CONFIG_S3C2400) || defined(CONFIG_TRAB) #include #elif defined(CONFIG_S3C2410) #include #endif -unsigned int br[] = { 1562, 780, 390, 194, 32, 15 }; - -#if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) -/* dynamically determine the clock values */ -static unsigned int samsung_fclk = 0; -unsigned int samsung_uartclk; -void samsung_get_fclk(void) -{ - unsigned int mpllcon = rMPLLCON; - unsigned int clkdivn = rCLKDIVN & 3; - int clk_factor[4] = {1, 2, 2, 4}; - - /* the S3C2400 uses a 12 MHz xtal */ - /* formula from page 6-22 */ - samsung_fclk = ((12000000 * (8 + ((mpllcon & 0xff000) >> 12)))/((2 + ((mpllcon & 0x1f0) >> 4)) * (1 << (mpllcon & 3)))); - samsung_uartclk = samsung_fclk/clk_factor[clkdivn]; -} -#endif void serial_setbrg (void) { @@ -52,32 +33,8 @@ void serial_setbrg (void) int i; unsigned int reg = 0; -#if defined(CONFIG_SMDK2400) || defined(CONFIG_TRAB) - if (samsung_fclk == 0 || samsung_uartclk == 0) - samsung_get_fclk(); - - /* value is calculated so : (int)(PCLK/16./baudrate) -1 */ - reg = samsung_uartclk/(16 * gd->baudrate) - 1; -#elif defined(CONFIG_SMDK2410) - /* this assumes a PCLK of 50.7 MHz */ /* value is calculated so : (int)(PCLK/16./baudrate) -1 */ - if (gd->baudrate == 1200) - reg = 2639; - else if (gd->baudrate == 9600) - reg = 329; - else if (gd->baudrate == 19200) - reg = 164; - else if (gd->baudrate == 38400) - reg = 82; - else if (gd->baudrate == 57600) - reg = 54; - else if (gd->baudrate == 115200) - reg = 27; - else - hang (); -#else -# error Bord config missing -#endif + reg = get_PCLK() / (16 * gd->baudrate) - 1; #ifdef CONFIG_SERIAL1 /* FIFO enable, Tx/Rx FIFO clear */ diff --git a/cpu/arm920t/speed.c b/cpu/arm920t/speed.c new file mode 100644 index 0000000..4901d9a --- /dev/null +++ b/cpu/arm920t/speed.c @@ -0,0 +1,96 @@ +/* + * (C) Copyright 2001-2002 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * (C) Copyright 2002 + * David Mueller, ELSOFT AG, d.mueller@elsoft.ch + * + * 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 + */ + +/* This code should work for both the S3C2400 and the S3C2410 + * as they seem to have the same PLL and clock machinery inside. + * The different address mapping is handled by the s3c24xx.h files below. + */ + +#include +#if defined(CONFIG_S3C2400) +#include +#elif defined(CONFIG_S3C2410) +#include +#endif + +#define MPLL 0 +#define UPLL 1 + +/* ------------------------------------------------------------------------- */ +/* NOTE: This describes the proper use of this file. + * + * CONFIG_PLL_INPUT_FREQ should be defined as the input frequency of the PLL. + * + * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of + * the specified bus in HZ. + */ +/* ------------------------------------------------------------------------- */ + +static ulong get_PLLCLK(int pllreg) +{ + ulong r, m, p, s; + + if (pllreg == MPLL) + r = rMPLLCON; + else if (pllreg == UPLL) + r = rUPLLCON; + else + hang(); + + m = ((r & 0xFF000) >> 12) + 8; + p = ((r & 0x003F0) >> 4) + 2; + s = r & 0x3; + + return((CONFIG_PLL_INPUT_FREQ * m) / (p << s)); +} + +/* return FCLK frequency */ +ulong get_FCLK(void) +{ + return(get_PLLCLK(MPLL)); +} + +/* return HCLK frequency */ +ulong get_HCLK(void) +{ + ulong clkdiv = rCLKDIVN; + + return((clkdiv & 0x2) ? get_FCLK()/2 : get_FCLK()); +} + +/* return PCLK frequency */ +ulong get_PCLK(void) +{ + ulong clkdiv = rCLKDIVN; + + return((clkdiv & 0x1) ? get_HCLK()/2 : get_HCLK()); +} + +/* return UCLK frequency */ +ulong get_UCLK(void) +{ + return(get_PLLCLK(UPLL)); +} diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S index 6208ba3..00b3082 100644 --- a/cpu/arm920t/start.S +++ b/cpu/arm920t/start.S @@ -84,8 +84,13 @@ _armboot_start: .word _start /* - * Note: armboot_end is defined by the (board-dependent) linker script + * Note: _armboot_end_data and _armboot_end are defined + * by the (board-dependent) linker script. + * _armboot_end_data is the first usable FLASH address after armboot */ +.globl _armboot_end_data +_armboot_end_data: + .word armboot_end_data .globl _armboot_end _armboot_end: .word armboot_end diff --git a/cpu/sa1100/start.S b/cpu/sa1100/start.S index b9e542e..6be0cef 100644 --- a/cpu/sa1100/start.S +++ b/cpu/sa1100/start.S @@ -85,8 +85,13 @@ _armboot_start: .word _start /* - * Note: armboot_end is defined by the (board-dependent) linker script + * Note: _armboot_end_data and _armboot_end are defined + * by the (board-dependent) linker script. + * _armboot_end_data is the first usable FLASH address after armboot */ +.globl _armboot_end_data +_armboot_end_data: + .word armboot_end_data .globl _armboot_end _armboot_end: .word armboot_end diff --git a/cpu/xscale/start.S b/cpu/xscale/start.S index c667f61..e491e26 100644 --- a/cpu/xscale/start.S +++ b/cpu/xscale/start.S @@ -76,8 +76,13 @@ _armboot_start: .word _start /* - * Note: armboot_end is defined by the (board-dependent) linker script + * Note: _armboot_end_data and _armboot_end are defined + * by the (board-dependent) linker script. + * _armboot_end_data is the first usable FLASH address after armboot */ +.globl _armboot_end_data +_armboot_end_data: + .word armboot_end_data .globl _armboot_end _armboot_end: .word armboot_end diff --git a/include/asm-arm/ppcboot-arm.h b/include/asm-arm/ppcboot-arm.h index b0adb50..536d312 100644 --- a/include/asm-arm/ppcboot-arm.h +++ b/include/asm-arm/ppcboot-arm.h @@ -30,11 +30,12 @@ #define _PPCBOOT_ARM_H_ 1 /* for the following variables, see start.S */ -extern ulong _armboot_start; /* code start */ -extern ulong _armboot_end; /* code end */ -extern ulong IRQ_STACK_START; /* top of IRQ stack */ -extern ulong FIQ_STACK_START; /* top of FIQ stack */ -extern ulong _armboot_real_end; /* first usable RAM address */ +extern ulong _armboot_start; /* code start */ +extern ulong _armboot_end_data; /* code + data end */ +extern ulong _armboot_end; /* BSS end */ +extern ulong IRQ_STACK_START; /* top of IRQ stack */ +extern ulong FIQ_STACK_START; /* top of FIQ stack */ +extern ulong _armboot_real_end; /* first usable RAM address */ /* cpu/.../cpu.c */ int cpu_init(void); diff --git a/include/common.h b/include/common.h index 16cd321..3c78d1c 100644 --- a/include/common.h +++ b/include/common.h @@ -92,7 +92,7 @@ int serial_buffered_getc (void); int serial_buffered_tstc (void); #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */ -void hang (void); +void hang (void) __attribute__ ((noreturn)); /* */ long int initdram (int); @@ -286,7 +286,12 @@ int prt_8260_clks (void); ulong get_OPB_freq (void); ulong get_PCI_freq (void); #endif - +#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) +ulong get_FCLK (void); +ulong get_HCLK (void); +ulong get_PCLK (void); +ulong get_UCLK (void); +#endif ulong get_bus_freq (ulong); #if defined(CONFIG_4xx) || defined(CONFIG_IOP480) diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h index 1f0e39c..0cd6e7f 100644 --- a/include/configs/smdk2400.h +++ b/include/configs/smdk2400.h @@ -42,6 +42,8 @@ #define CONFIG_S3C2400 1 /* in a SAMSUNG S3C2400 SoC */ #define CONFIG_SMDK2400 1 /* on an SAMSUNG SMDK2400 Board */ +/* input clock of PLL */ +#define CONFIG_PLL_INPUT_FREQ 12000000 /* SMDK2400 has 12 MHz input clock */ #undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */ #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ @@ -82,6 +84,8 @@ #define CONFIG_BAUDRATE 115200 +#define CONFIG_TIMESTAMP 1 /* Print timestamp info for images */ + #ifndef USE_920T_MMU #define CONFIG_COMMANDS_tmp (CONFIG_CMD_DFL & ~CFG_CMD_CACHE) #else diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h index 3603f4a..8cebbec 100644 --- a/include/configs/smdk2410.h +++ b/include/configs/smdk2410.h @@ -43,6 +43,10 @@ #define CONFIG_S3C2410 1 /* in a SAMSUNG S3C2410 SoC */ #define CONFIG_SMDK2410 1 /* on a SAMSUNG SMDK2410 Board */ +/* input clock of PLL */ +#define CONFIG_PLL_INPUT_FREQ 12000000/* the SMDK2410 has 12MHz input clock */ + + #define USE_920T_MMU 1 #undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */ diff --git a/include/configs/trab.h b/include/configs/trab.h index 1cc9008..b2046a7 100644 --- a/include/configs/trab.h +++ b/include/configs/trab.h @@ -41,6 +41,9 @@ #define CONFIG_TRAB 1 /* on a TRAB Board */ #undef CONFIG_TRAB_50MHZ /* run the CPU at 50 MHz */ +/* input clock of PLL */ +#define CONFIG_PLL_INPUT_FREQ 12000000 /* TRAB has 12 MHz input clock */ + #undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */ #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ @@ -69,7 +72,7 @@ #define CONFIG_HWFLOW /* include RTS/CTS flow control support */ -#undef CONFIG_MODEM_SUPPORT /* enable modem initialization stuff */ +#define CONFIG_MODEM_SUPPORT /* enable modem initialization stuff */ #define CONFIG_MODEM_KEY_MAGIC "23" /* hold down these keys to enable modem */ @@ -85,6 +88,8 @@ #define CONFIG_BAUDRATE 115200 +#define CONFIG_TIMESTAMP 1 /* Print timestamp info for images */ + #ifdef CONFIG_HWFLOW #define CONFIG_COMMANDS_ADD_HWFLOW CFG_CMD_HWFLOW #else @@ -99,12 +104,12 @@ #ifndef USE_920T_MMU #define CONFIG_COMMANDS ((CONFIG_CMD_DFL & ~CFG_CMD_CACHE) | \ - CFG_CMD_BSP | \ + CFG_CMD_BSP | \ CONFIG_COMMANDS_ADD_HWFLOW | \ CONFIG_COMMANDS_ADD_VFD ) #else -#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \ - CFG_CMD_BSP | \ +#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \ + CFG_CMD_BSP | \ CONFIG_COMMANDS_ADD_HWFLOW | \ CONFIG_COMMANDS_ADD_VFD ) #endif diff --git a/include/version.h b/include/version.h index 197f8c5..40ea9b1 100644 --- a/include/version.h +++ b/include/version.h @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000 + * (C) Copyright 2000-2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this @@ -24,6 +24,6 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -#define PPCBOOT_VERSION "PPCBoot 1.2.1" +#define PPCBOOT_VERSION "PPCBoot 1.2.2" #endif /* __VERSION_H__ */ diff --git a/lib_arm/board.c b/lib_arm/board.c index 7da0b1d..9ee6dc9 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -95,8 +95,8 @@ static int display_banner (void) { printf ("\n\n%s\n\n", version_string); - printf ("ARMBoot code: %08lx -> %08lx\n", - _armboot_start, _armboot_end); + printf ("ARMBoot code: %08lX -> %08lX BSS: -> %08lX\n", + _armboot_start, _armboot_end_data, _armboot_end); #ifdef CONFIG_USE_IRQ printf ("IRQ Stack: %08lx\n", IRQ_STACK_START); printf ("FIQ Stack: %08lx\n", FIQ_STACK_START); @@ -162,11 +162,11 @@ typedef int (init_fnc_t) (void); init_fnc_t *init_sequence[] = { cpu_init, /* basic cpu dependent setup */ board_init, /* basic board dependent setup */ + interrupt_init, /* set up exceptions */ env_init, /* initialize environment */ init_baudrate, /* initialze baudrate settings */ serial_init, /* serial communications setup */ display_banner, - interrupt_init, /* set up exceptions */ dram_init, /* configure available RAM banks */ display_dram_config, diff --git a/rtc/date.c b/rtc/date.c index 579af4d..b5f8c48 100644 --- a/rtc/date.c +++ b/rtc/date.c @@ -29,7 +29,7 @@ #include #include -#if (CONFIG_COMMANDS & CFG_CMD_DATE) +#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #define FEBRUARY 2 #define STARTOFTIME 1970