Re: [U-Boot] [PATCH] omap: mmc: Raise timeout value to 20ms

2012-01-04 Thread Peter Bigot
On Tue, Jan 3, 2012 at 2:50 PM, Peter Bigot big...@acm.org wrote:
 On Tue, Jan 3, 2012 at 2:24 PM, Tom Rini tr...@ti.com wrote:
 With certain SD cards the code detects a timeout when the hardware
 has not timed out.  We change the timeout used to match the kernel
 which gives software 20ms to detect a timeout.  We also define to
 match the kernel and expand the previously incorrect comment.
 Finally, we let get_timer() perform subtraction for us as it offers.

 This doesn't work for me with the SanDisk 4GB card on the
 BeagleBoard-xM.  I updated the recipe to remove Andreas' original
 patch, substituted the new one, and I get the following, which is the
 behavior before I used Andreas' patch except that now it takes about
 20 seconds for each timeout message to print.

I got this to work with two changes:

* s/MMC_TIMEOUT_USEC/MMC_TIMEOUT_MSEC/g and define MMC_TIMEOUT_MSEC
20, since get_timer does operate on msec in the current meta-ti
BeagleBoard-xM

* The patch below, which is what I think fixes the real problem (that
PSTATE.CMDI is still lit up when the function is entered).

diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index c38b9e6..62b659a 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -198,7 +198,8 @@ static int mmc_send_cmd(struct mmc *mmc, struct
mmc_cmd *cmd,
ulong start;

start = get_timer(0);
-   while ((readl(mmc_base-pstate)  DATI_MASK) == DATI_CMDDIS) {
+#define CMDI_MASK  (0x1  0)
+   while ((readl(mmc_base-pstate)  (DATI_MASK | CMDI_MASK))) {
if (get_timer(0) - start  MAX_RETRY_MS) {
printf(%s: timedout waiting for cmddis!\n, __func__);
return TIMEOUT;

Peter
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 02/14] devki8000: add config for spl command

2012-01-04 Thread Stefano Babic
From: Simon Schwarz simonschwarz...@googlemail.com

This adds some configs for devkit8000 to use the new spl command

Signed-off-by: Simon Schwarz simonschwarz...@gmail.com
CC: Tom Rini tom.r...@gmail.com
CC: Stefano Babic sba...@denx.de
CC: Wolfgang Denk w...@denx.de
---
V10 changes:
This is new in V10 was split from other patch

 include/configs/devkit8000.h |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h
index 2b6a6ee..e323877 100644
--- a/include/configs/devkit8000.h
+++ b/include/configs/devkit8000.h
@@ -351,4 +351,12 @@
 #define CONFIG_SYS_SPL_MALLOC_START0x80208000
 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x10/* 1 MB */
 
+/* SPL OS boot options */
+#define CONFIG_CMD_SPL
+#define CONFIG_CMD_SPL_WRITE_SIZE   0x400 /* 1024 byte */
+#define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\
+   0x40)
+#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x28
+#define CONFIG_SYS_SPL_ARGS_ADDR(PHYS_SDRAM_1 + 0x100)
+
 #endif /* __CONFIG_H */
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 01/14] Add cmd_spl command

2012-01-04 Thread Stefano Babic
From: Simon Schwarz simonschwarz...@googlemail.com

This adds a spl command to the u-boot.

Related config:
CONFIG_CMD_CPL
activate/deactivate the command
CONFIG_CMD_SPL_NAND_OFS
Offset in NAND to use

Signed-off-by: Simon Schwarz simonschwarz...@gmail.com
CC: Tom Rini tom.r...@gmail.com
CC: Stefano Babic sba...@denx.de
CC: Wolfgang Denk w...@denx.de
---
V2 changes:
CHG corrected bootm call. Now bootm is called with five parameters including
Address of FDT in RAM. This fixes the hang on savebp fdt call.
ADD debug output of the actual bootm parameter call
CHG help message

V3 changes:
FIX added missing brackets

V4 changes:
CHG Corrected argument number in comments
CHG added check for CONFIG_OF_LIBFDT
CHG squashed the README to this commit
DEL define description from commit message - unused in this patch
CHG renamed to spl now with subcommand export, very different now
ADD New call style with subcommands.
CHG added printf where the image is located
CHG Patched README to reflect changes
CHG parameter count
CHG usage message

V5 changes:
nothing

V6 changes:
nothing

V7 changes:
FIX multiline comment style, cosmetic changes
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113499)
REBASE on u-boot

V8 changes:
nothing

V9 changes:
nothing

V10 changes:
CHG list is now terminated by NULL not \0
ADD static modifiers to most of cmd_spl.c functions
DEL board changes
ADD include protection to cmd_spl.h
DEL not used enum image_tyep
CHG some cosmetic
CHG images extern moved from cmd_spl.h to image.h

V11 changes:
nothing

V12 changes:
nothing

 common/Makefile |1 +
 common/cmd_spl.c|  229 +++
 doc/README.commands.spl |   31 +++
 include/cmd_spl.h   |   30 ++
 include/image.h |2 +
 5 files changed, 293 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_spl.c
 create mode 100644 doc/README.commands.spl
 create mode 100644 include/cmd_spl.h

diff --git a/common/Makefile b/common/Makefile
index 1be7236..91f3f2e 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -165,6 +165,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o
 endif
 COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
 COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
+COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o
 
 # others
 ifdef CONFIG_DDR_SPD
diff --git a/common/cmd_spl.c b/common/cmd_spl.c
new file mode 100644
index 000..deab8e9
--- /dev/null
+++ b/common/cmd_spl.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2011
+ * Corscience GmbH  Co. KG - Simon Schwarz schw...@corscience.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 common.h
+#include command.h
+#include cmd_spl.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Calls bootm with the parameters given */
+static int call_bootm(int argc, char * const argv[], char *subcommand[])
+{
+   char *bootm_argv[5];
+   char command[] = do_bootm;
+
+   int i = 0;
+   int ret = 0;
+
+   /* create paramter array */
+   bootm_argv[0] = command;
+   switch (argc) {
+   case 3:
+   bootm_argv[4] = argv[2]; /* fdt addr */
+   case 2:
+   bootm_argv[3] = argv[1]; /* initrd addr */
+   case 1:
+   bootm_argv[2] = argv[0]; /* kernel addr */
+   }
+
+
+   /*
+* - do the work -
+* exec subcommands of do_bootm to init the images
+* data structure
+*/
+   while (subcommand[i] != NULL) {
+   bootm_argv[1] = subcommand[i];
+   debug(args: %s, %s, %s, %s, %s, %d\n, bootm_argv[0],
+   bootm_argv[1], bootm_argv[2], bootm_argv[3],
+   bootm_argv[4], argc);
+   ret = do_bootm(find_cmd(do_bootm), 0, argc+2,
+   bootm_argv);
+   debug(Subcommand retcode: %d\n, ret);
+   i++;
+   }
+
+   if (ret) {
+   printf(ERROR prep subcommand failed!\n);
+   return -1;
+   }
+
+   return 0;
+}
+
+/* assemble the bootm paramteres for fdt creation */
+static int spl_export_fdt(int argc, char * const argv[])
+{
+#ifdef CONFIG_OF_LIBFDT
+   /* Create subcommand string */
+   char *subcommand[] = {
+  

[U-Boot] SPL Linux Boot - updated

2012-01-04 Thread Stefano Babic
Hi,

here an updated version of the patchset to boot Linux directly from SPL.
It fixes the (minor) comments received in version 11.

List of changes:

- drop commented lines into arch/arm/cpu/armv7/Makefile after checking build
  for OMAP4/5
- use CONFIG_SPL_I2C_SUPPORT to protect I2C code
- fix TAB / spaces issues (codestyle)
- add missing include to fix OMAP4/5 build
- use a different GPIO on the twister board to select image to boot

[PATCH V12 01/14] Add cmd_spl command
[PATCH V12 02/14] devki8000: add config for spl command
[PATCH V12 03/14] omap-common: Add NAND SPL linux booting
[PATCH V12 04/14] devkit8000/spl: init GPMC for dm9000 in SPL
[PATCH V12 05/14] omap-common/spl: Add linux boot to SPL
[PATCH V12 06/14] omap/spl: change output of spl_parse_image_header
[PATCH V12 07/14] devkit8000: Implement and activate direct OS boot
[PATCH V12 08/14] Add cache functions to SPL for armv7
[PATCH V12 09/14] OMAP3: SPL: do not call I2C init if no I2C is set.
[PATCH V12 10/14] OMAP3: move SPL files to be used by other
[PATCH V12 11/14] TI: SPL: make SPL available for other SOCs as TI
[PATCH V12 12/14] SPL: call cleanup_before_linux() before booting
[PATCH V12 13/14] Fix build OMAP4/5
[PATCH V12 14/14] OMAP3: twister: add support to boot Linux from SPL
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 03/14] omap-common: Add NAND SPL linux booting

2012-01-04 Thread Stefano Babic
From: Simon Schwarz simonschwarz...@googlemail.com

This implements booting of Linux from NAND in SPL

Related config parameters:
CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPL
CONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is
normally RAM-start + 0x100 (on ARM)

Signed-off-by: Simon Schwarz simonschwarz...@gmail.com
CC: Tom Rini tom.r...@gmail.com
CC: Stefano Babic sba...@denx.de
CC: Wolfgang Denk w...@denx.de
---
V2 changes:
nothing

V3 changes:
nothing

V4 changes:
ADD define description to commit message
CHG renaming some defines - renaming SAVEBP SPL

V5 changes:
nothing

V6 changes:
nothing

V7 changes:
nothing

V8 changes:
FIX multiline comment style
REBASE on u-boot

V9 changes:
nothing

V10 changes:
ADD unused __attribute__ to src and dst because they provoked a warning
if SPL os boot was not active

V11 changes:
nothing

V12 changes:
nothing

 arch/arm/cpu/armv7/omap-common/spl_nand.c |   66 ++---
 1 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/spl_nand.c 
b/arch/arm/cpu/armv7/omap-common/spl_nand.c
index 38d06b1..2a66214 100644
--- a/arch/arm/cpu/armv7/omap-common/spl_nand.c
+++ b/arch/arm/cpu/armv7/omap-common/spl_nand.c
@@ -24,6 +24,7 @@
 #include asm/u-boot.h
 #include asm/utils.h
 #include asm/arch/sys_proto.h
+#include asm/io.h
 #include nand.h
 #include version.h
 #include asm/omap_common.h
@@ -32,6 +33,9 @@
 void spl_nand_load_image(void)
 {
struct image_header *header;
+   int *src __attribute__((unused));
+   int *dst __attribute__((unused));
+
switch (omap_boot_mode()) {
case NAND_MODE_HW_ECC:
debug(spl: nand - using hw ecc\n);
@@ -45,26 +49,56 @@ void spl_nand_load_image(void)
 
/*use CONFIG_SYS_TEXT_BASE as temporary storage area */
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
+#ifdef CONFIG_SPL_OS_BOOT
+   if (!spl_uboot_key()) {
+   /*
+* load parameter image
+* load to temp position since nand_spl_load_image reads
+* a whole block which is typically larger than
+* CONFIG_CMD_SAVEBP_WRITE_SIZE therefore may overwrite
+* following sections like BSS
+*/
+   nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS,
+   CONFIG_CMD_SPL_WRITE_SIZE,
+   (void *)CONFIG_SYS_TEXT_BASE);
+   /* copy to destintion */
+   for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR,
+   src = (int *)CONFIG_SYS_TEXT_BASE;
+   src  (int *)(CONFIG_SYS_TEXT_BASE +
+   CONFIG_CMD_SPL_WRITE_SIZE);
+   src++, dst++) {
+   writel(readl(src), dst);
+   }
 
+   /* load linux */
+   nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
+   CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+   spl_parse_image_header(header);
+   nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
+   spl_image.size, (void *)spl_image.load_addr);
+   } else
+#endif
+   {
 #ifdef CONFIG_NAND_ENV_DST
-   nand_spl_load_image(CONFIG_ENV_OFFSET,
-   CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
-   spl_parse_image_header(header);
-   nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size,
-   (void *)image_load_addr);
+   nand_spl_load_image(CONFIG_ENV_OFFSET,
+   CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+   spl_parse_image_header(header);
+   nand_spl_load_image(CONFIG_ENV_OFFSET, spl_image.size,
+   (void *)spl_image.load_addr);
 #ifdef CONFIG_ENV_OFFSET_REDUND
-   nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND,
-   CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
-   spl_parse_image_header(header);
-   nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size,
-   (void *)image_load_addr);
+   nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND,
+   CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+   spl_parse_image_header(header);
+   nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, spl_image.size,
+   (void *)spl_image.load_addr);
 #endif
 #endif
-   /* Load u-boot */
-   nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
-   CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
-   spl_parse_image_header(header);
-   nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
-   spl_image.size, (void *)spl_image.load_addr);
+   /* Load u-boot */
+   nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+   

[U-Boot] [PATCH V12 04/14] devkit8000/spl: init GPMC for dm9000 in SPL

2012-01-04 Thread Stefano Babic
From: Simon Schwarz simonschwarz...@googlemail.com

Linux crashes if the GPMC isn't configured for the dm9000.

Signed-off-by: Simon Schwarz simonschwarz...@gmail.com
CC: Tom Rini tom.r...@gmail.com
CC: Stefano Babic sba...@denx.de
CC: Wolfgang Denk w...@denx.de
---
V2 changes:
nothing

V3 changes:
nothing

V4 changes:
noting

V5 changes:
nothing

V6 changes:
nothing

V7 changes:
FIX multiline comment style
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113500)

V8 changes:
REBASE on u-boot

V9 changes:
nothing

V10 changes:
use enable_gpmc_cs_config to config the GPMC for dm9000

 arch/arm/include/asm/omap_common.h  |2 +
 board/timll/devkit8000/devkit8000.c |   39 +++---
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index 1ec651b..62200e5 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -87,6 +87,8 @@ u32 omap_boot_mode(void);
 /* SPL common function s*/
 void spl_parse_image_header(const struct image_header *header);
 void omap_rev_string(char *omap_rev_string);
+int spl_uboot_key(void);
+void spl_board_prepare_for_linux(void);
 
 /* NAND SPL functions */
 void spl_nand_load_image(void);
diff --git a/board/timll/devkit8000/devkit8000.c 
b/board/timll/devkit8000/devkit8000.c
index b06aab6..05de3c1 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -63,6 +63,24 @@ int board_init(void)
return 0;
 }
 
+static u32 gpmc_net_config[GPMC_MAX_REG] = {
+   NET_GPMC_CONFIG1,
+   NET_GPMC_CONFIG2,
+   NET_GPMC_CONFIG3,
+   NET_GPMC_CONFIG4,
+   NET_GPMC_CONFIG5,
+   NET_GPMC_CONFIG6,
+   NET_GPMC_CONFIG7,
+};
+
+
+/* Configure GPMC registers for DM9000 */
+static void gpmc_dm9000_config(void)
+{
+   enable_gpmc_cs_config(gpmc_net_config, gpmc_cfg-cs[6],
+   CONFIG_DM9000_BASE, GPMC_SIZE_16M);
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -81,14 +99,7 @@ int misc_init_r(void)
 #endif
 
 #ifdef CONFIG_DRIVER_DM9000
-   /* Configure GPMC registers for DM9000 */
-   writel(NET_GPMC_CONFIG1, gpmc_cfg-cs[6].config1);
-   writel(NET_GPMC_CONFIG2, gpmc_cfg-cs[6].config2);
-   writel(NET_GPMC_CONFIG3, gpmc_cfg-cs[6].config3);
-   writel(NET_GPMC_CONFIG4, gpmc_cfg-cs[6].config4);
-   writel(NET_GPMC_CONFIG5, gpmc_cfg-cs[6].config5);
-   writel(NET_GPMC_CONFIG6, gpmc_cfg-cs[6].config6);
-   writel(NET_GPMC_CONFIG7, gpmc_cfg-cs[6].config7);
+   gpmc_dm9000_config();
 
/* Use OMAP DIE_ID as MAC address */
if (!eth_getenv_enetaddr(ethaddr, enetaddr)) {
@@ -139,6 +150,18 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_SPL_OS_BOOT
+/*
+ * Do board specific preperation before SPL
+ * Linux boot
+ */
+void spl_board_prepare_for_linux(void)
+{
+   gpmc_dm9000_config();
+}
+
+#endif
+
 /*
  * Routine: get_board_mem_timings
  * Description: If we use SPL then there is no x-loader nor config header
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 06/14] omap/spl: change output of spl_parse_image_header

2012-01-04 Thread Stefano Babic
From: Simon Schwarz simonschwarz...@googlemail.com

This only outputs Assuming u-boot.bin... if debug is active.

Signed-off-by: Simon Schwarz simonschwarz...@gmail.com
CC: Tom Rini tom.r...@gmail.com
CC: Stefano Babic sba...@denx.de
CC: Wolfgang Denk w...@denx.de
---
V11: no changes

V12: no changes

 arch/arm/cpu/armv7/omap-common/spl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/spl.c 
b/arch/arm/cpu/armv7/omap-common/spl.c
index 955a83b..1671a03 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -101,7 +101,7 @@ void spl_parse_image_header(const struct image_header 
*header)
/* Signature not found - assume u-boot.bin */
printf(mkimage signature not found - ih_magic = %x\n,
header-ih_magic);
-   puts(Assuming u-boot.bin ..\n);
+   debug(Assuming u-boot.bin ..\n);
/* Let's assume U-Boot will not be more than 200 KB */
spl_image.size = 200 * 1024;
spl_image.entry_point = CONFIG_SYS_TEXT_BASE;
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 05/14] omap-common/spl: Add linux boot to SPL

2012-01-04 Thread Stefano Babic
From: Simon Schwarz simonschwarz...@googlemail.com

This adds Linux booting to the SPL

This depends on CONFIG_MACH_TYPE patch by Igor Grinberg
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105809)

Related CONFIGs:
CONFIG_SPL_OS_BOOT
Activates/Deactivates the OS booting feature
CONFIG_SPL_OS_BOOT_KEY
defines the IO-pin number u-boot switch - if pressed u-boot is
booted
CONFIG_SYS_NAND_SPL_KERNEL_OFFS
Offset in NAND of direct boot kernel image to use in SPL
CONFIG_SYS_SPL_ARGS_ADDR
Address where the kernel boot arguments are expected - this is
normaly RAM-begin + 0x100

Signed-off-by: Simon Schwarz simonschwarz...@gmail.com
CC: Tom Rini tom.r...@gmail.com
CC: Stefano Babic sba...@denx.de
CC: Wolfgang Denk w...@denx.de
---
V2 changes:
nothing

V3 changes:
nothing

V4 changes:
CHG Using CONFIG_MACH_TYPE now.
DEL CONFIG_SYS_SPL_MACHID
CHG Use CONFIG_MACH_TYPE for machine id config - This makes the patch
depending on the patch linked above

V5 changes:
FIX compile errors for OMAP4
REBASE u-boot-ti adapted new general gpio interface

V6 changes:
nothing

V7 changes:
FIX multiline comment style
(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113501)

V8 changes:
REBASE on u-boot

V9 changes:
nothing

V10 changes:
CHG used short form to mark not returning function
DEL devkit8000 config changes from this patch
CHG spl_uboot_key renamed to spl_start_uboot and defined weak to be
implemented board specific
CHG If the Linux image for the direct OS boot is not found the SPL tries
to load a u-boot image
CHG %X in %p in debug message

V11 changes:
U-Boot was always started instead of Linux

 arch/arm/cpu/armv7/omap-common/spl.c  |   49 +-
 arch/arm/cpu/armv7/omap-common/spl_nand.c |   53 
 arch/arm/include/asm/omap_common.h|1 +
 3 files changed, 78 insertions(+), 25 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/spl.c 
b/arch/arm/cpu/armv7/omap-common/spl.c
index 9c35a09..955a83b 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -35,6 +35,7 @@
 #include i2c.h
 #include image.h
 #include malloc.h
+#include linux/compiler.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -64,6 +65,25 @@ void board_init_f(ulong dummy)
relocate_code(CONFIG_SPL_STACK, gdata, CONFIG_SPL_TEXT_BASE);
 }
 
+/*
+ * Default function to determine if u-boot or the OS should
+ * be started. This implementation always returns 1.
+ *
+ * Please implement your own board specific funcion to do this.
+ *
+ * RETURN
+ * 0 to not start u-boot
+ * positive if u-boot should start
+ */
+#ifdef CONFIG_SPL_OS_BOOT
+__weak int spl_start_uboot(void)
+{
+   printf(SPL: Please implement spl_start_uboot() for your board\n);
+   printf(SPL: Direct Linux boot not active!\n);
+   return 1;
+}
+#endif
+
 void spl_parse_image_header(const struct image_header *header)
 {
u32 header_size = sizeof(struct image_header);
@@ -91,7 +111,25 @@ void spl_parse_image_header(const struct image_header 
*header)
}
 }
 
-static void jump_to_image_no_args(void)
+/*
+ * This function jumps to an image with argument. Normally an FDT or ATAGS
+ * image.
+ * arg: Pointer to paramter image in RAM
+ */
+#ifdef CONFIG_SPL_OS_BOOT
+__noreturn void jump_to_image_linux(void *arg)
+{
+   debug(Entering kernel arg pointer: 0x%p\n, arg);
+   typedef void (*image_entry_arg_t)(int, int, void *)
+   __attribute__ ((noreturn));
+   image_entry_arg_t image_entry =
+   (image_entry_arg_t) spl_image.entry_point;
+   /* cleanup_before_linux(); */ /*write SPL function for that*/
+   image_entry(0, CONFIG_MACH_TYPE, arg);
+}
+#endif
+
+void jump_to_image_no_args(void)
 {
typedef void (*image_entry_noargs_t)(u32 *)__attribute__ ((noreturn));
image_entry_noargs_t image_entry =
@@ -105,8 +143,8 @@ static void jump_to_image_no_args(void)
u32 boot_params_ptr_addr = (u32)boot_params_ptr;
image_entry((u32 *)boot_params_ptr_addr);
 }
-
 void jump_to_image_no_args(void) __attribute__ ((noreturn));
+
 void board_init_r(gd_t *id, ulong dummy)
 {
u32 boot_device;
@@ -146,6 +184,13 @@ void board_init_r(gd_t *id, ulong dummy)
debug(Jumping to U-Boot\n);
jump_to_image_no_args();
break;
+#ifdef CONFIG_SPL_OS_BOOT
+   case IH_OS_LINUX:
+   debug(Jumping to Linux\n);
+   spl_board_prepare_for_linux();
+   jump_to_image_linux((void *)CONFIG_SYS_SPL_ARGS_ADDR);
+   break;
+#endif
default:
puts(Unsupported OS image.. Jumping nevertheless..\n);
jump_to_image_no_args();
diff --git a/arch/arm/cpu/armv7/omap-common/spl_nand.c 
b/arch/arm/cpu/armv7/omap-common/spl_nand.c
index 2a66214..1295e88 100644
--- a/arch/arm/cpu/armv7/omap-common/spl_nand.c
+++ 

[U-Boot] [PATCH V12 07/14] devkit8000: Implement and activate direct OS boot

2012-01-04 Thread Stefano Babic
From: Simon Schwarz simonschwarz...@googlemail.com

- Implements spl_start_uboot() for devkit8000
- Add configs to activate direct OS boot from SPL

Signed-off-by: Simon Schwarz simonschwarz...@gmail.com
CC: Tom Rini tom.r...@gmail.com
CC: Stefano Babic sba...@denx.de
CC: Wolfgang Denk w...@denx.de
---
V10 changes:
sliced from the implementation
added an implementation of spl_start_uboot for devkit8000

 board/timll/devkit8000/devkit8000.c |   18 ++
 include/configs/devkit8000.h|7 +--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/board/timll/devkit8000/devkit8000.c 
b/board/timll/devkit8000/devkit8000.c
index 05de3c1..6ca4fe2 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -41,6 +41,7 @@
 #include asm/arch/mem.h
 #include asm/mach-types.h
 #include devkit8000.h
+#include asm/gpio.h
 #ifdef CONFIG_DRIVER_DM9000
 #include net.h
 #include netdev.h
@@ -160,6 +161,23 @@ void spl_board_prepare_for_linux(void)
gpmc_dm9000_config();
 }
 
+/*
+ * devkit8000 specific implementation of spl_start_uboot()
+ *
+ * RETURN
+ * 0 if the button is not pressed
+ * 1 if the button is pressed
+ */
+int spl_start_uboot(void)
+{
+   int val = 0;
+   if (!gpio_request(CONFIG_SPL_OS_BOOT_KEY, U-Boot key)) {
+   gpio_direction_input(CONFIG_SPL_OS_BOOT_KEY);
+   val = gpio_get_value(CONFIG_SPL_OS_BOOT_KEY);
+   gpio_free(CONFIG_SPL_OS_BOOT_KEY);
+   }
+   return !val;
+}
 #endif
 
 /*
diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h
index e323877..eb7c376 100644
--- a/include/configs/devkit8000.h
+++ b/include/configs/devkit8000.h
@@ -35,7 +35,7 @@
 #define CONFIG_OMAP1   /* in a TI OMAP core */
 #define CONFIG_OMAP34XX1   /* which is a 34XX */
 #define CONFIG_OMAP3_DEVKIT80001   /* working with DevKit8000 */
-
+#define CONFIG_MACH_TYPE   MACH_TYPE_DEVKIT8000
 /*
  * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
  * 64 bytes before this address should be set aside for u-boot.img's
@@ -327,7 +327,7 @@
 #define CONFIG_SPL_MAX_SIZE0xB400  /* 45 K */
 #define CONFIG_SPL_STACK   LOW_LEVEL_SRAM_STACK
 
-#define CONFIG_SPL_BSS_START_ADDR  0x8000 /*CONFIG_SYS_SDRAM_BASE*/
+#define CONFIG_SPL_BSS_START_ADDR   0x8500 /* leave space for 
bootargs*/
 #define CONFIG_SPL_BSS_MAX_SIZE0x8
 
 /* NAND boot config */
@@ -352,6 +352,9 @@
 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x10/* 1 MB */
 
 /* SPL OS boot options */
+#define CONFIG_SPL_OS_BOOT
+#define CONFIG_SPL_OS_BOOT_KEY 26
+
 #define CONFIG_CMD_SPL
 #define CONFIG_CMD_SPL_WRITE_SIZE   0x400 /* 1024 byte */
 #define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 08/14] Add cache functions to SPL for armv7

2012-01-04 Thread Stefano Babic
Signed-off-by: Stefano Babic sba...@denx.de
CC: Tom Rini tom.r...@gmail.com
CC: Wolfgang Denk w...@denx.de
CC: Simon Schwarz simonschwarz...@gmail.com
---

Changes since V11:

- enable cache files in Makefile after checking build for OMAP4/5

 arch/arm/cpu/armv7/Makefile |2 --
 arch/arm/cpu/armv7/cpu.c|2 ++
 arch/arm/lib/Makefile   |5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index f97fa3d..6b2addc 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -27,9 +27,7 @@ LIB   = $(obj)lib$(CPU).o
 
 START  := start.o
 
-ifndef CONFIG_SPL_BUILD
 COBJS  += cache_v7.o
-endif
 
 COBJS  += cpu.o
 COBJS  += syslib.o
diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c
index 662c496..c6fa8ef 100644
--- a/arch/arm/cpu/armv7/cpu.c
+++ b/arch/arm/cpu/armv7/cpu.c
@@ -52,7 +52,9 @@ int cleanup_before_linux(void)
 *
 * we turn off caches etc ...
 */
+#ifndef CONFIG_SPL_BUILD
disable_interrupts();
+#endif
 
/*
 * Turn off I-cache and invalidate it
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 300c8fa..39a9550 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -39,8 +39,6 @@ GLCOBJS   += div0.o
 
 COBJS-y+= board.o
 COBJS-y+= bootm.o
-COBJS-y+= cache.o
-COBJS-y+= cache-cp15.o
 COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
 COBJS-y+= interrupts.o
 COBJS-y+= reset.o
@@ -48,6 +46,9 @@ SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 endif
 
+COBJS-y+= cache.o
+COBJS-y+= cache-cp15.o
+
 SRCS   := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 09/14] OMAP3: SPL: do not call I2C init if no I2C is set.

2012-01-04 Thread Stefano Babic
Call i2c initialization in spl_board_init only if I2C
is configured for the board.

Signed-off-by: Stefano Babic sba...@denx.de
CC: Tom Rini tom.r...@gmail.com
CC: Wolfgang Denk w...@denx.de
CC: Simon Schwarz simonschwarz...@gmail.com
---

V12:
 - use CONFIG_SPL_I2C_SUPPORT to protect I2C code

 arch/arm/cpu/armv7/omap3/board.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 1f33c63..1f6a3e9 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -92,7 +92,9 @@ u32 omap_boot_device(void)
 
 void spl_board_init(void)
 {
+#ifdef CONFIG_SPL_I2C_SUPPORT
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
 }
 #endif /* CONFIG_SPL_BUILD */
 
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 10/14] OMAP3: move SPL files to be used by other architectures.

2012-01-04 Thread Stefano Babic
The SPL used on OMAPx can be reused by other SOCs from different
architectures. Move common files into common/ directory.

Signed-off-by: Stefano Babic sba...@denx.de
CC: Tom Rini tom.r...@gmail.com
CC: Wolfgang Denk w...@denx.de
CC: Simon Schwarz simonschwarz...@gmail.com
---

V12: no changes

 arch/arm/cpu/armv7/omap-common/Makefile|   10 --
 common/Makefile|4 
 {arch/arm/cpu/armv7/omap-common = common}/spl.c   |0
 .../arm/cpu/armv7/omap-common = common}/spl_mmc.c |0
 .../cpu/armv7/omap-common = common}/spl_nand.c|0
 5 files changed, 4 insertions(+), 10 deletions(-)
 rename {arch/arm/cpu/armv7/omap-common = common}/spl.c (100%)
 rename {arch/arm/cpu/armv7/omap-common = common}/spl_mmc.c (100%)
 rename {arch/arm/cpu/armv7/omap-common = common}/spl_nand.c (100%)

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile 
b/arch/arm/cpu/armv7/omap-common/Makefile
index a684611..e65e992 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -40,16 +40,6 @@ COBJS+= emif-common.o
 SOBJS  += lowlevel_init.o
 endif
 
-ifdef CONFIG_SPL_BUILD
-COBJS  += spl.o
-ifdef CONFIG_SPL_NAND_SUPPORT
-COBJS  += spl_nand.o
-endif
-ifdef CONFIG_SPL_MMC_SUPPORT
-COBJS  += spl_mmc.o
-endif
-endif
-
 ifndef CONFIG_SPL_BUILD
 ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
 COBJS  += mem-common.o
diff --git a/common/Makefile b/common/Makefile
index 91f3f2e..41b67ca 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -186,6 +186,10 @@ COBJS-$(CONFIG_MENU) += menu.o
 COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o
 COBJS-$(CONFIG_UPDATE_TFTP) += update.o
 COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
+else
+COBJS-y += spl.o
+COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
+COBJS-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
 endif
 
 COBJS-y += console.o
diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/common/spl.c
similarity index 100%
rename from arch/arm/cpu/armv7/omap-common/spl.c
rename to common/spl.c
diff --git a/arch/arm/cpu/armv7/omap-common/spl_mmc.c b/common/spl_mmc.c
similarity index 100%
rename from arch/arm/cpu/armv7/omap-common/spl_mmc.c
rename to common/spl_mmc.c
diff --git a/arch/arm/cpu/armv7/omap-common/spl_nand.c b/common/spl_nand.c
similarity index 100%
rename from arch/arm/cpu/armv7/omap-common/spl_nand.c
rename to common/spl_nand.c
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 12/14] SPL: call cleanup_before_linux() before booting Linux

2012-01-04 Thread Stefano Babic
Signed-off-by: Stefano Babic sba...@denx.de
CC: Tom Rini tom.r...@gmail.com
CC: Wolfgang Denk w...@denx.de
CC: Simon Schwarz simonschwarz...@gmail.com
---
 common/spl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/spl.c b/common/spl.c
index 5fdf3fb..cf5395e 100644
--- a/common/spl.c
+++ b/common/spl.c
@@ -125,7 +125,7 @@ __noreturn void jump_to_image_linux(void *arg)
__attribute__ ((noreturn));
image_entry_arg_t image_entry =
(image_entry_arg_t) spl_image.entry_point;
-   /* cleanup_before_linux(); */ /*write SPL function for that*/
+   cleanup_before_linux();
image_entry(0, CONFIG_MACH_TYPE, arg);
 }
 #endif
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 14/14] OMAP3: twister: add support to boot Linux from SPL

2012-01-04 Thread Stefano Babic
Signed-off-by: Stefano Babic sba...@denx.de
CC: Tom Rini tom.r...@gmail.com
CC: Wolfgang Denk w...@denx.de
CC: Simon Schwarz simonschwarz...@gmail.com
---

V12:
 - change GPIO to select U-Boot als image

 board/technexion/twister/twister.c |   23 +++
 include/configs/twister.h  |   12 
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/board/technexion/twister/twister.c 
b/board/technexion/twister/twister.c
index 950e76c..fc88301 100644
--- a/board/technexion/twister/twister.c
+++ b/board/technexion/twister/twister.c
@@ -114,3 +114,26 @@ int board_mmc_init(bd_t *bis)
return omap_mmc_init(0);
 }
 #endif
+
+#ifdef CONFIG_SPL_OS_BOOT
+/*
+ * Do board specific preperation before SPL
+ * Linux boot
+ */
+void spl_board_prepare_for_linux(void)
+{
+   /* init cs for extern lan */
+   enable_gpmc_cs_config(gpmc_smc911, gpmc_cfg-cs[5],
+   CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
+}
+int spl_start_uboot(void)
+{
+   int val = 0;
+   if (!gpio_request(CONFIG_SPL_OS_BOOT_KEY, U-Boot key)) {
+   gpio_direction_input(CONFIG_SPL_OS_BOOT_KEY);
+   val = gpio_get_value(CONFIG_SPL_OS_BOOT_KEY);
+   gpio_free(CONFIG_SPL_OS_BOOT_KEY);
+   }
+   return !val;
+}
+#endif
diff --git a/include/configs/twister.h b/include/configs/twister.h
index 64a886d..a852481 100644
--- a/include/configs/twister.h
+++ b/include/configs/twister.h
@@ -51,4 +51,16 @@
 #defineCONFIG_EXTRA_ENV_SETTINGS   CONFIG_TAM3517_SETTINGS \
bootcmd=run nandboot\0
 
+/* SPL OS boot options */
+#define CONFIG_CMD_SPL
+#define CONFIG_CMD_SPL_WRITE_SIZE  0x400 /* 1024 byte */
+#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS0x0020
+#define CONFIG_CMD_SPL_NAND_OFS(CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\
+   0x60)
+#define CONFIG_SPL_OS_BOOT
+#define CONFIG_SPL_OS_BOOT_KEY 55
+
+#define CONFIG_SYS_SPL_ARGS_ADDR   (PHYS_SDRAM_1 + 0x100)
+#define CONFIG_SPL_BOARD_INIT
+
 #endif /* __CONFIG_H */
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 13/14] Fix build OMAP4/5

2012-01-04 Thread Stefano Babic
Signed-off-by: Stefano Babic sba...@denx.de
---
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c 
b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index f65705d..4040d02 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -32,6 +32,7 @@
 #include asm/sizes.h
 #include asm/emif.h
 #include asm/omap_common.h
+#include spl.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V12 11/14] TI: SPL: make SPL available for other SOCs as TI

2012-01-04 Thread Stefano Babic
The SPL is developped first for TI-OMAPx. The patch
move OMAP specific function into OMAP directory.

Signed-off-by: Stefano Babic sba...@denx.de
CC: Tom Rini tom.r...@gmail.com
CC: Wolfgang Denk w...@denx.de
CC: Simon Schwarz simonschwarz...@gmail.com
---

V12: replace tab with space defining MMCSD_MODE_UNDEFINED

 arch/arm/cpu/armv7/omap-common/Makefile   |2 +
 arch/arm/cpu/armv7/omap-common/spl_omap.c |   71 +
 arch/arm/cpu/armv7/omap3/board.c  |4 ++
 arch/arm/include/asm/omap_common.h|   34 --
 common/spl.c  |1 +
 common/spl_mmc.c  |   21 ++---
 common/spl_nand.c |   14 +-
 include/spl.h |   68 +++
 8 files changed, 153 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/omap-common/spl_omap.c
 create mode 100644 include/spl.h

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile 
b/arch/arm/cpu/armv7/omap-common/Makefile
index e65e992..6fb544c 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -44,6 +44,8 @@ ifndef CONFIG_SPL_BUILD
 ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
 COBJS  += mem-common.o
 endif
+else
+COBJS  += spl_omap.o
 endif
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/armv7/omap-common/spl_omap.c 
b/arch/arm/cpu/armv7/omap-common/spl_omap.c
new file mode 100644
index 000..692d8c2
--- /dev/null
+++ b/arch/arm/cpu/armv7/omap-common/spl_omap.c
@@ -0,0 +1,71 @@
+/*
+ * (C) Copyright 2010
+ * Texas Instruments, www.ti.com
+ *
+ * Aneesh V ane...@ti.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 asm/u-boot.h
+#include asm/utils.h
+#include asm/arch/sys_proto.h
+#include mmc.h
+#include nand.h
+#include fat.h
+#include spl.h
+#include version.h
+#include asm/omap_common.h
+#include asm/arch/mmc_host_def.h
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+   switch (omap_boot_device()) {
+   case BOOT_DEVICE_MMC1:
+   omap_mmc_init(0);
+   break;
+   case BOOT_DEVICE_MMC2:
+   omap_mmc_init(1);
+   break;
+   }
+   return 0;
+}
+#endif
+
+#ifdef CONFIG_SPL_NAND_SUPPORT
+void spl_arch_nand_init(void)
+{
+   switch (omap_boot_mode()) {
+   case NAND_MODE_HW_ECC:
+   debug(spl: nand - using hw ecc\n);
+   gpmc_init();
+   nand_init();
+   break;
+   default:
+   puts(spl: ERROR: This bootmode is not implemented - hanging);
+   hang();
+   }
+}
+#endif
+
+u32 spl_boot_mode(void)
+{
+   return omap_boot_mode();
+}
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 1f6a3e9..11a6caa 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -42,6 +42,10 @@
 #include asm/omap_common.h
 #include i2c.h
 
+#ifdef CONFIG_SPL_BUILD
+#include spl.h
+#endif
+
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 static void omap3_setup_aux_cr(void);
diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index 8a7d1e5..e46e612 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -64,43 +64,9 @@ void preloader_console_init(void);
 #define BOOT_DEVICE_XIPWAIT7
 #endif
 
-/* Boot type */
-#defineMMCSD_MODE_UNDEFINED0
-#define MMCSD_MODE_RAW 1
-#define MMCSD_MODE_FAT 2
-#define NAND_MODE_HW_ECC   3
-
-struct spl_image_info {
-   const char *name;
-   u8 os;
-   u32 load_addr;
-   u32 entry_point;
-   u32 size;
-};
-
-extern struct spl_image_info spl_image;
-
-extern u32* boot_params_ptr;
 u32 omap_boot_device(void);
 u32 omap_boot_mode(void);
 
-/* SPL common function s*/
-void spl_parse_image_header(const struct image_header *header);
-void omap_rev_string(char *omap_rev_string);
-int spl_uboot_key(void);
-void spl_board_prepare_for_linux(void);
-int spl_start_uboot(void);
-
-/* NAND SPL functions */
-void spl_nand_load_image(void);
-
-/* MMC SPL functions */
-void 

[U-Boot] [PATCH V2 4/4] ARM: omap3: Added Teejet mt_ventoux

2012-01-04 Thread Stefano Babic
The mt_ventoux board is a custom board using
the Technexion TAM3517 module.

Signed-off-by: Stefano Babic sba...@denx.de
CC: Ilya Yanok ya...@emcraft.com
CC: Igor Grinberg grinb...@compulab.co.il
---

Changes since V1:

- CONFIG_FPGA must be enabled (S. Babic)
- reworking fpga functions (Igor Grinberg)
- drop clean / distclean from Makefile (Igor Grinberg)
- TAB / Spaces issue (Igor Grinberg)

 MAINTAINERS  |1 +
 board/teejet/mt_ventoux/Makefile |   38 +++
 board/teejet/mt_ventoux/mt_ventoux.c |  210 +
 board/teejet/mt_ventoux/mt_ventoux.h |  429 ++
 boards.cfg   |1 +
 include/configs/mt_ventoux.h |   58 +
 6 files changed, 737 insertions(+), 0 deletions(-)
 create mode 100644 board/teejet/mt_ventoux/Makefile
 create mode 100644 board/teejet/mt_ventoux/mt_ventoux.c
 create mode 100644 board/teejet/mt_ventoux/mt_ventoux.h
 create mode 100644 include/configs/mt_ventoux.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 4e3246d..d680eaf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -558,6 +558,7 @@ Stefano Babic sba...@denx.de
 
ea20davinci
flea3   i.MX35
+   mt_ventoux  omap3
mx35pdk i.MX35
mx51evk i.MX51
polaris xscale/pxa
diff --git a/board/teejet/mt_ventoux/Makefile b/board/teejet/mt_ventoux/Makefile
new file mode 100644
index 000..4c8db10
--- /dev/null
+++ b/board/teejet/mt_ventoux/Makefile
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+#
+# Based on ti/evm/Makefile
+#
+# 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.
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
diff --git a/board/teejet/mt_ventoux/mt_ventoux.c 
b/board/teejet/mt_ventoux/mt_ventoux.c
new file mode 100644
index 000..1d8de81
--- /dev/null
+++ b/board/teejet/mt_ventoux/mt_ventoux.c
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2011
+ * Stefano Babic, DENX Software Engineering, sba...@denx.de.
+ *
+ * Copyright (C) 2009 TechNexion Ltd.
+ *
+ * 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.
+ */
+
+#include common.h
+#include netdev.h
+#include fpga.h
+#include asm/io.h
+#include asm/arch/mem.h
+#include asm/arch/mux.h
+#include asm/arch/sys_proto.h
+#include asm/omap_gpio.h
+#include asm/arch/mmc_host_def.h
+#include i2c.h
+#include spartan3.h
+#include asm/gpio.h
+#include mt_ventoux.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_FPGA
+#error The Teejet mt_ventoux must have CONFIG_FPGA enabled
+#endif
+
+#define FPGA_RESET 62
+#define FPGA_PROG  116
+#define FPGA_CCLK  117
+#define FPGA_DIN   118
+#define FPGA_INIT  119
+#define FPGA_DONE  154
+
+/* Timing definitions for FPGA */
+static const u32 gpmc_fpga[] = {
+   FPGA_GPMC_CONFIG1,
+   FPGA_GPMC_CONFIG2,
+   FPGA_GPMC_CONFIG3,
+   FPGA_GPMC_CONFIG4,
+   FPGA_GPMC_CONFIG5,
+   FPGA_GPMC_CONFIG6,
+};
+
+static inline void fpga_reset(int nassert)
+{
+   gpio_set_value(FPGA_RESET, !nassert);
+}
+
+int fpga_pgm_fn(int nassert, int nflush, int cookie)
+{
+   debug(%s:%d: FPGA PROGRAM , __func__, __LINE__);
+
+   gpio_set_value(FPGA_PROG, !nassert);
+
+   return nassert;
+}
+
+int fpga_init_fn(int cookie)
+{
+   return !gpio_get_value(FPGA_INIT);
+}
+
+int fpga_done_fn(int cookie)
+{
+   return gpio_get_value(FPGA_DONE);
+}
+
+int 

Re: [U-Boot] [PATCH 02/17] x86: Speed up copy-to-RAM and clear BSS operations

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:21, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:
 The implementations of memcpy and memset are now the optimised versions
 from glibc, so use them instead of simple copy loops

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/x86/lib/board.c |   17 +
  1 files changed, 5 insertions(+), 12 deletions(-)

 diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
 index d742fec..ba6b59f 100644
 --- a/arch/x86/lib/board.c
 +++ b/arch/x86/lib/board.c
 @@ -188,26 +188,19 @@ static int calculate_relocation_address(void)

  static int copy_uboot_to_ram(void)
  {
 -   ulong *dst_addr = (ulong *)gd-relocaddr;
 -   ulong *src_addr = (ulong *)__text_start;
 -   ulong *end_addr = (ulong *)__data_end;
 +   size_t len = (size_t)(__data_end) - (size_t)(__text_start);
 
 Extra brackets here. Also is the type of these not char[] already? Same Q 
 below.

I removed the brackets for v2 - The cast is required because __data_end is
a ulong *

Actually:

size_t len = __data_end - __text_start;

works, but is dangerous - I have been caught out several times in this code
doing raw arithmetic, particularly using increment and decrement operators.
I prefer to make the casts explicit now

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 03/17] x86: Remove GDR related magic numbers

2012-01-04 Thread Graeme Russ
On 04/01/12 16:23, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/x86/cpu/start.S |3 ++-
  arch/x86/include/asm/processor.h |6 +-
  2 files changed, 7 insertions(+), 2 deletions(-)

 diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
 index f87633b..7f9b6a7 100644
 --- a/arch/x86/cpu/start.S
 +++ b/arch/x86/cpu/start.S
 @@ -29,6 +29,7 @@
  #include config.h
  #include version.h
  #include asm/global_data.h
 +#include asm/processor.h
  #include asm/processor-flags.h
  #include generated/asm-offsets.h

 @@ -58,7 +59,7 @@ _start:
/* This is the 32-bit cold-reset entry point */

/* Load the segement registes to match the gdt loaded in start16.S */
 -   movl$0x18, %eax
 +   movl$(GDT_ENTRY_32BIT_DS * 8), %eax
movw%ax, %fs
movw%ax, %ds
movw%ax, %gs
 diff --git a/arch/x86/include/asm/processor.h 
 b/arch/x86/include/asm/processor.h
 index 1e5dccd..203c63a 100644
 --- a/arch/x86/include/asm/processor.h
 +++ b/arch/x86/include/asm/processor.h
 @@ -24,9 +24,13 @@
  #ifndef __ASM_PROCESSOR_H_
  #define __ASM_PROCESSOR_H_ 1

 -#define GDT_ENTRY_32BIT_CS 2
 +#define GDT_ENTRY_NULL 0
 +#define GDT_ENTRY_UNUSED   (GDT_ENTRY_NULL + 1)
 +#define GDT_ENTRY_32BIT_CS (GDT_ENTRY_UNUSED + 1)
  #define GDT_ENTRY_32BIT_DS (GDT_ENTRY_32BIT_CS + 1)
  #define GDT_ENTRY_16BIT_CS (GDT_ENTRY_32BIT_DS + 1)
  #define GDT_ENTRY_16BIT_DS (GDT_ENTRY_16BIT_CS + 1)
 

 +#define GDT_NUM_ENTRIES(GDT_ENTRY_16BIT_DS + 1)
 +
 
 Ick - any reason not to use an enum here?

Done, but I still need a rouge #define for the assembler case above

Also, I added an X86_ prefix as per Linux headers and moved the size define
up from patch 7

Regards

Graeme

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 04/17] x86: Rework Global Descriptor Table loading

2012-01-04 Thread Graeme Russ
On 04/01/12 16:24, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 
 This probably needs a commit message?

Done

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 05/17] x86: Simplify Flash-to-RAM code execution transition

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:28, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 
 Commit message?

Added in v2

 
 ---
  arch/x86/cpu/start.S  |   20 +---
  arch/x86/include/asm/u-boot-x86.h |2 ++
  arch/x86/lib/board.c  |   25 ++---
  3 files changed, 29 insertions(+), 18 deletions(-)

 diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
 index 7f9b6a7..9592158 100644
 --- a/arch/x86/cpu/start.S
 +++ b/arch/x86/cpu/start.S
 @@ -96,32 +96,22 @@ car_init_ret:
movw$0x85, %ax
jmp die

 -.globl relocate_code
 -.type relocate_code, @function
 -relocate_code:
 +.globl board_init_f_r_trampoline
 +.type board_init_f_r_trampoline, @function
 +board_init_f_r_trampoline:
/*
 * SDRAM has been initialised, U-Boot code has been copied into
 * RAM, BSS has been cleared and relocation adjustments have been
 * made. It is now time to jump into the in-RAM copy of U-Boot
 *
 * %eax = Address of top of stack
 
 *new* top of stack?

Changed to 'Address of top of new stack'

[snip]

 -
 -   /* Jump to in-RAM copy of board_init_r() */
 -   call*%ebp
 +   /* Re-enter U-Boot by calling board_init_f_r */
 +   callboard_init_f_r
 
 Isn't this a bit of a funny name? Why not call it something like
 call_board_init_r() ?

No, board_init_f_r is where we are still running from Flash, but RAM has
been initialised so we can actually use it for the stack and Global Data.
board_init_r is when we are running exclusively from RAM

[snip]

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/17] x86: Use fs for global data

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:36, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:
 Use the base address of the 'F' segment as a pointer to the global data
 structure. By adding the linear address (i.e. the 'D' segment address)
 as the first word of the global data structure, the address of the
 global data relative to the 'D' segment can be found simply, for
 example, by:

fs movl 0, %eax

 This makes the gd 'pointer' writable prior to relocation (by reloading
 the GDT) which brings x86 into line with all other arches
 
 What is the GDT?

Global Descriptor Table - It's a kind of lookup table which the x86 CPU
uses to calculate physical addresses relative to 'segments' - By placing
the start of the 'F' segment to the physical address of the global data
structure, and adding a self-referencing physical address to the global
data structure (as the first member), reading the first word of the 'F'
segment provides the physical address of the global data


 NOTE: Writing to the gd 'pointer' is expensive (but we only do it
 twice) but using it to access global data members (read and write) is
 still fairly cheap

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/x86/cpu/cpu.c |   53 --
  arch/x86/cpu/start.S   |8 -
  arch/x86/include/asm/global_data.h |   21 +
  arch/x86/include/asm/processor.h   |6 +++-
  arch/x86/include/asm/u-boot-x86.h  |2 +
  arch/x86/lib/board.c   |   56 
 +---
  6 files changed, 98 insertions(+), 48 deletions(-)

 diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
 index bf55c26..e7a5fc0 100644
 --- a/arch/x86/cpu/cpu.c
 +++ b/arch/x86/cpu/cpu.c
 @@ -90,6 +90,37 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
asm volatile(lgdtl %0\n : : m (gdt));
  }

 +void init_gd(gd_t *id, u64 *gdt_addr)
 +{
 +   id-gd_addr = (ulong)id;
 +   setup_gdt(id, gdt_addr);
 +}
 +
 +void setup_gdt(gd_t *id, u64 *gdt_addr)
 
 I will probably never understand this function but a comment might be nice.

Hmm, I guess I really don't know how to comment this to explain it clearly
- The GDT is a bit of a magical beast which you kind of have to learn by
osmosis ;)

 
 +{
 +   /* CS: code, read/execute, 4 GB, base 0 */
 +   gdt_addr[GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf);
 +
 +   /* DS: data, read/write, 4 GB, base 0 */
 +   gdt_addr[GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xf);
 +
 +   /* FS: data, read/write, 4 GB, base (Global Data Pointer) */
 +   gdt_addr[GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093, (ulong)id, 0xf);
 +
 +   /* 16-bit CS: code, read/execute, 64 kB, base 0 */
 
 Extra indent?

Removed

[snip]

 diff --git a/arch/x86/include/asm/processor.h 
 b/arch/x86/include/asm/processor.h
 index 203c63a..07897f9 100644
 --- a/arch/x86/include/asm/processor.h
 +++ b/arch/x86/include/asm/processor.h
 @@ -24,13 +24,17 @@
  #ifndef __ASM_PROCESSOR_H_
  #define __ASM_PROCESSOR_H_ 1

 +#define GDT_ENTRY_SIZE 8
 +
  #define GDT_ENTRY_NULL 0
  #define GDT_ENTRY_UNUSED   (GDT_ENTRY_NULL + 1)
  #define GDT_ENTRY_32BIT_CS (GDT_ENTRY_UNUSED + 1)
  #define GDT_ENTRY_32BIT_DS (GDT_ENTRY_32BIT_CS + 1)
 -#define GDT_ENTRY_16BIT_CS (GDT_ENTRY_32BIT_DS + 1)
 +#define GDT_ENTRY_32BIT_FS (GDT_ENTRY_32BIT_DS + 1)
 +#define GDT_ENTRY_16BIT_CS (GDT_ENTRY_32BIT_FS + 1)
  #define GDT_ENTRY_16BIT_DS (GDT_ENTRY_16BIT_CS + 1)

  #define GDT_NUM_ENTRIES(GDT_ENTRY_16BIT_DS + 1)
 +#define GDT_SIZE   (GDT_NUM_ENTRIES * GDT_ENTRY_SIZE)
 
 Wasn't this already done in an earlier patch?

I've moved this change into patch #3

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 09/17] x86: Create weak init_cache() function

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:38, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/x86/cpu/cpu.c|   18 +++---
  arch/x86/include/asm/u-boot-x86.h |1 +
  arch/x86/lib/board.c  |1 +
  3 files changed, 17 insertions(+), 3 deletions(-)

 diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
 index e7a5fc0..4351f20 100644
 --- a/arch/x86/cpu/cpu.c
 +++ b/arch/x86/cpu/cpu.c
 @@ -140,6 +140,14 @@ int cpu_init_f(void) __attribute__((weak, 
 alias(x86_cpu_init_f)));

  int x86_cpu_init_r(void)
  {
 +   /* Initialize core interrupt and exception functionality of CPU */
 +   cpu_init_interrupts();
 +   return 0;
 +}
 
 This doesn't seem to match the commit title.

Well git diffs do some weird things sometimes - if you look further down,
you'll see that there isn't actually a code change here

 
 +int cpu_init_r(void) __attribute__((weak, alias(x86_cpu_init_r)));
 +
 +void x86_enable_caches(void)
 +{
const u32 nw_cd_rst = ~(X86_CR0_NW | X86_CR0_CD);

/* turn on the cache and disable write through */
 @@ -147,12 +155,16 @@ int x86_cpu_init_r(void)
andl   %0, %%eax\n
movl   %%eax, %%cr0\n
wbinvd\n : : i (nw_cd_rst) : eax);
 +}
 +void enable_caches(void) __attribute__((weak, alias(x86_enable_caches)));
 +
 +int x86_init_cache(void)
 +{
 +   enable_caches();
 
 Does this enable both I and D caches?

Yes - In x86, the I  D caches are turned on and off simultaneously. Also,
some x86 CPU's only have a single unified cache anyway


 -   /* Initialize core interrupt and exception functionality of CPU */
 -   cpu_init_interrupts();
return 0;
  }
 -int cpu_init_r(void) __attribute__((weak, alias(x86_cpu_init_r)));
 +int init_cache(void) __attribute__((weak, alias(x86_init_cache)));

  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  {
 diff --git a/arch/x86/include/asm/u-boot-x86.h 
 b/arch/x86/include/asm/u-boot-x86.h
 index 5540d51..878a1ee 100644
 --- a/arch/x86/include/asm/u-boot-x86.h
 +++ b/arch/x86/include/asm/u-boot-x86.h
 @@ -39,6 +39,7 @@ int x86_cpu_init_f(void);
  int cpu_init_f(void);
  void init_gd(gd_t *id, u64 *gdt_addr);
  void setup_gdt(gd_t *id, u64 *gdt_addr);
 +int init_cache(void);

  /* cpu/.../timer.c */
  void timer_isr(void *);
 diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
 index 4e54dba..ffddfbe 100644
 --- a/arch/x86/lib/board.c
 +++ b/arch/x86/lib/board.c
 @@ -140,6 +140,7 @@ init_fnc_t *init_sequence_f[] = {

  init_fnc_t *init_sequence_r[] = {
copy_gd_to_ram,
 +   init_cache,
 
 Would enable_caches be a better name?

Getting the cache working is a two step process - init_cache() sets up the
cache regions, typically using the Memory Type Range Registers (MTRRs)

enable_caches() actually turns the CPU cache on

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 10/17] x86: Allow cache before copy to RAM

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:40, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/x86/lib/board.c |   15 ++-
  1 files changed, 10 insertions(+), 5 deletions(-)

 diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
 index ffddfbe..52e27e1 100644
 --- a/arch/x86/lib/board.c
 +++ b/arch/x86/lib/board.c
 @@ -131,16 +131,11 @@ init_fnc_t *init_sequence_f[] = {
console_init_f,
dram_init_f,
calculate_relocation_address,
 -   copy_uboot_to_ram,
 -   clear_bss,
 -   do_elf_reloc_fixups,

NULL,
  };

  init_fnc_t *init_sequence_r[] = {
 -   copy_gd_to_ram,
 -   init_cache,
cpu_init_r, /* basic cpu dependent setup */
board_early_init_r, /* basic board dependent setup */
dram_init,  /* configure available RAM banks */
 @@ -269,6 +264,16 @@ void board_init_f(ulong boot_flags)

  void board_init_f_r(void)
  {
 +   if (copy_gd_to_ram() != 0)
 +   hang();
 +
 +   if (init_cache() != 0)
 +   hang();
 +
 +   copy_uboot_to_ram();
 +   clear_bss();
 +   do_elf_reloc_fixups();
 
 Can you not just put these in the init list above? Why do they need to
 move back into this functoin?

board_init_f_r() is the intermediate step when we are running from Flash,
but with the stack and global data in RAM. If these functions are put in
init_sequence_f() we cannot enable the CPU cache (as the stack and global
data would get trashed). We can't put them in init_sequence_r because these
are the functions that actually copy U-Boot to RAM (and hence must be done
before init_sequence_r)

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V12 08/14] Add cache functions to SPL for armv7

2012-01-04 Thread Aneesh V

Hi Stefano,

On Wednesday 04 January 2012 09:25 AM, Stefano Babic wrote:

Signed-off-by: Stefano Babicsba...@denx.de
CC: Tom Rinitom.r...@gmail.com
CC: Wolfgang Denkw...@denx.de
CC: Simon Schwarzsimonschwarz...@gmail.com
---

Changes since V11:

- enable cache files in Makefile after checking build for OMAP4/5


How are you allocating memory for the page-tables(gd-tlb_addr)? Also
we need to take care of the complexities when u-boot runs after SPL.
Please have a look at this.

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/100012/match=spl+cache



  arch/arm/cpu/armv7/Makefile |2 --
  arch/arm/cpu/armv7/cpu.c|2 ++
  arch/arm/lib/Makefile   |5 +++--
  3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index f97fa3d..6b2addc 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -27,9 +27,7 @@ LIB   = $(obj)lib$(CPU).o

  START := start.o

-ifndef CONFIG_SPL_BUILD
  COBJS += cache_v7.o
-endif

  COBJS += cpu.o
  COBJS += syslib.o
diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c
index 662c496..c6fa8ef 100644
--- a/arch/arm/cpu/armv7/cpu.c
+++ b/arch/arm/cpu/armv7/cpu.c
@@ -52,7 +52,9 @@ int cleanup_before_linux(void)
 *
 * we turn off caches etc ...
 */
+#ifndef CONFIG_SPL_BUILD
disable_interrupts();
+#endif

/*
 * Turn off I-cache and invalidate it
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 300c8fa..39a9550 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -39,8 +39,6 @@ GLCOBJS   += div0.o

  COBJS-y   += board.o
  COBJS-y   += bootm.o
-COBJS-y+= cache.o
-COBJS-y+= cache-cp15.o
  COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
  COBJS-y   += interrupts.o
  COBJS-y   += reset.o
@@ -48,6 +46,9 @@ SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
  SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
  endif

+COBJS-y+= cache.o
+COBJS-y+= cache-cp15.o
+
  SRCS  := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
  OBJS  := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 11/17] CHECKPATCH: arch/x86/cpu/*

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:42, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 
 Seems a bit more than just checkpatch.

True - I'll change the name to 'Tweak IDT and GDT for alignment and
readability' - Saves me splitting the patch ;)

Regards,

Graeme

 
 Acked-by: Simon Glass s...@chromium.org
 
 Regards,
 Simon
 
 ---
  arch/x86/cpu/interrupts.c |2 +-
  arch/x86/cpu/start16.S|   57 
 +++-
  2 files changed, 46 insertions(+), 13 deletions(-)

 diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
 index e0958eb..43ec3f8 100644
 --- a/arch/x86/cpu/interrupts.c
 +++ b/arch/x86/cpu/interrupts.c
 @@ -174,7 +174,7 @@ struct desc_ptr {
unsigned short segment;
  } __packed;

 -struct idt_entry idt[256] __attribute__((aligned(16)));
 +struct idt_entry idt[256] __aligned(16);

  struct desc_ptr idt_ptr;

 diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S
 index 33e53cd..cc393ff 100644
 --- a/arch/x86/cpu/start16.S
 +++ b/arch/x86/cpu/start16.S
 @@ -86,7 +86,11 @@ gdt_ptr:
.word   0x20/* limit (32 bytes = 4 GDT entries) */
.long   BOOT_SEG + gdt  /* base */

 -   /* The GDT table ...
 +/* Some CPUs are picky about GDT alignment... */
 +.align 16
 +gdt:
 +   /*
 +* The GDT table ...
 *
 *   Selector   Type
 *   0x00   NULL
 @@ -94,17 +98,46 @@ gdt_ptr:
 *   0x10   32bit code
 *   0x18   32bit data/stack
 */
 +   /* The NULL Desciptor - Mandatory */
 +   .word   0x  /* limit_low */
 +   .word   0x  /* base_low */
 +   .byte   0x00/* base_middle */
 +   .byte   0x00/* access */
 +   .byte   0x00/* flags + limit_high */
 +   .byte   0x00/* base_high */

 -gdt:
 -   .word   0, 0, 0, 0  /* NULL  */
 -   .word   0, 0, 0, 0  /* unused */
 +   /* Unused Desciptor - (matches Linux) */
 +   .word   0x  /* limit_low */
 +   .word   0x  /* base_low */
 +   .byte   0x00/* base_middle */
 +   .byte   0x00/* access */
 +   .byte   0x00/* flags + limit_high */
 +   .byte   0x00/* base_high */

 -   .word   0x  /* 4Gb - (0x10*0x1000 = 4Gb) */
 -   .word   0   /* base address = 0 */
 -   .word   0x9B00  /* code read/exec */
 -   .word   0x00CF  /* granularity = 4096, 386 (+5th nibble of 
 limit) */
 +   /*
 +* The Code Segment Descriptor:
 +* - Base   = 0x
 +* - Size   = 4GB
 +* - Access = Present, Ring 0, Exec (Code), Readable
 +* - Flags  = 4kB Granularity, 32-bit
 +*/
 +   .word   0x  /* limit_low */
 +   .word   0x  /* base_low */
 +   .byte   0x00/* base_middle */
 +   .byte   0x9b/* access */
 +   .byte   0xcf/* flags + limit_high */
 +   .byte   0x00/* base_high */

 -   .word   0x  /* 4Gb - (0x10*0x1000 = 4Gb) */
 -   .word   0x0 /* base address = 0 */
 -   .word   0x9300  /* data read/write */
 -   .word   0x00CF  /* granularity = 4096, 386 (+5th nibble of 
 limit) */
 +   /*
 +* The Data Segment Descriptor:
 +* - Base   = 0x
 +* - Size   = 4GB
 +* - Access = Present, Ring 0, Non-Exec (Data), Writable
 +* - Flags  = 4kB Granularity, 32-bit
 +*/
 +   .word   0x  /* limit_low */
 +   .word   0x  /* base_low */
 +   .byte   0x00/* base_middle */
 +   .byte   0x93/* access */
 +   .byte   0xcf/* flags + limit_high */
 +   .byte   0x00/* base_high */
 --
 1.7.5.2.317.g391b14

 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot
 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 14/17] x86: Move setup_pcat_compatibility() out of board.c

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:48, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 
 Perhaps mention why? Anyway:

Added commit message 'This function simply does not belong in board.c'

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 16/17] x86: Simplify board.c

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:51, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/x86/include/asm/init_helpers.h  |   39 +
  arch/x86/include/asm/init_wrappers.h |   42 +
  arch/x86/lib/Makefile|2 +
  arch/x86/lib/board.c |  297 
 +-
  arch/x86/lib/init_helpers.c  |  142 
  arch/x86/lib/init_wrappers.c |  137 
 
 What is the rationale for putting these into separate files? If you
 didn't then they would be static and presumably less code size.

The rationale is to reduce board.c to a set of init function arrays, an
init function execution loop and three initialisation phase (_f, _f_r, and
_r) functions which should be a generic methodology for all architectures

 Also for the commit message, is this really a simplification? It looks
 more like you are splitting the code into separate functions.

I'll change to title and commit message

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 17/17] x86: Tweak initialisation procedure

2012-01-04 Thread Graeme Russ
Hi Simon,

On 04/01/12 16:52, Simon Glass wrote:
 Hi Graeme,
 
 On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ graeme.r...@gmail.com wrote:

 Signed-off-by: Graeme Russ graeme.r...@gmail.com
 ---
  arch/x86/include/asm/init_helpers.h |5 +
  arch/x86/include/asm/relocate.h |   33 ++
  arch/x86/lib/board.c|  188 
 +--
  arch/x86/lib/init_helpers.c |   75 ++
  arch/x86/lib/relocate.c |   32 +-
  5 files changed, 206 insertions(+), 127 deletions(-)
 
 Seems like a fairly major tweak :-) Should this commit be split,
 and/or perhaps explain the purpose in the commit message?

OK, 'tweak' was the wrong word. What this patch does is convert
init_sequence_f_r into an standard init processing loop and cleans up a few
comments along the way (I suppose they could be moved into one last
'documentation' patch)

I've renamed the patch

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V12 08/14] Add cache functions to SPL for armv7

2012-01-04 Thread Stefano Babic
On 04/01/2012 12:33, Aneesh V wrote:
 Hi Stefano,
 

Hi,

 On Wednesday 04 January 2012 09:25 AM, Stefano Babic wrote:
 Signed-off-by: Stefano Babicsba...@denx.de
 CC: Tom Rinitom.r...@gmail.com
 CC: Wolfgang Denkw...@denx.de
 CC: Simon Schwarzsimonschwarz...@gmail.com
 ---

 Changes since V11:

 - enable cache files in Makefile after checking build for OMAP4/5
 
 How are you allocating memory for the page-tables(gd-tlb_addr)? Also
 we need to take care of the complexities when u-boot runs after SPL.

I know, and the patch can be considered a preparation for adding d-cache
later - dcache is not enabled at all in this patchset. At the moment,
cleanup_before_linux() is called as in U-Boot, but caches are already
disabled. I know memory for the page tables must be reserved, but this
part is not yet done.

 Please have a look at this.
 
 http://article.gmane.org/gmane.comp.boot-loaders.u-boot/100012/match=spl+cache

I am aware of this. And this is also the reason I see caches as a
second-step approach. Firstly, we should have a way to boot linux
directly from SPL, without enabling cache. Then we have the possibility
to increase the mumber of our testers, because, as far as I know, only
me and Simon have tried with this patchset to get some measurement.

In my current tests on the twister board (AM3517 based), most time is
spent really to load the kernel (~2MB, with a lot of drivers..).
As answer to your point 1 in the previous thread, maybe it is really
worth to enable cache to speed up the loading part respecting enabling
DMA. Adding DMA means adding DMA support in each specific driver (NAND
vs MMC vs..), while with d-cache we have a solution working
independenlty from the supported media. But it makes sense to have a
large number of boards supporting direct booting before making some
wrong assumptions ;-)

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] MX28: Fix MXSBOOT segfault if no params specified

2012-01-04 Thread Stefano Babic
On 22/12/2011 20:55, Marek Vasut wrote:
 Signed-off-by: Marek Vasut marek.va...@gmail.com
 Cc: Wolfgang Denk w...@denx.de
 Cc: Stefano Babic sba...@denx.de
 ---
  tools/mxsboot.c |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
 
 diff --git a/tools/mxsboot.c b/tools/mxsboot.c
 index 176753d..8246831 100644

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] omap: mmc: Raise timeout value to 20ms

2012-01-04 Thread Andreas Müller
On Wednesday, January 04, 2012 01:22:29 AM you wrote:
 On Tue, Jan 3, 2012 at 2:50 PM, Peter Bigot big...@acm.org wrote:
  On Tue, Jan 3, 2012 at 2:24 PM, Tom Rini tr...@ti.com wrote:
  With certain SD cards the code detects a timeout when the hardware
  has not timed out.  We change the timeout used to match the kernel
  which gives software 20ms to detect a timeout.  We also define to
  match the kernel and expand the previously incorrect comment.
  Finally, we let get_timer() perform subtraction for us as it offers.
  
  This doesn't work for me with the SanDisk 4GB card on the
  BeagleBoard-xM.  I updated the recipe to remove Andreas' original
  patch, substituted the new one, and I get the following, which is the
  behavior before I used Andreas' patch except that now it takes about
  20 seconds for each timeout message to print.
(*)
 
 I got this to work with two changes:
 
 * s/MMC_TIMEOUT_USEC/MMC_TIMEOUT_MSEC/g and define MMC_TIMEOUT_MSEC
 20, since get_timer does operate on msec in the current meta-ti
 BeagleBoard-xM
 
 * The patch below, which is what I think fixes the real problem (that
 PSTATE.CMDI is still lit up when the function is entered).
 
 diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
 index c38b9e6..62b659a 100644
 --- a/drivers/mmc/omap_hsmmc.c
 +++ b/drivers/mmc/omap_hsmmc.c
 @@ -198,7 +198,8 @@ static int mmc_send_cmd(struct mmc *mmc, struct
 mmc_cmd *cmd,
 ulong start;
 
 start = get_timer(0);
 -   while ((readl(mmc_base-pstate)  DATI_MASK) == DATI_CMDDIS) {
 +#define CMDI_MASK  (0x1  0)
 +   while ((readl(mmc_base-pstate)  (DATI_MASK | CMDI_MASK))) {
 if (get_timer(0) - start  MAX_RETRY_MS) {
 printf(%s: timedout waiting for cmddis!\n,
 __func__); return TIMEOUT;
 
 Peter
Without having tested (have the hardware causing errors on monday next week): 
This version seems correct direction: We need to wait longer _before_ write 
action otherwise it is never finished - see (*). I am not an expert here but 
since this patch affects all mmc_cmds: Does this reduce performance?

Andreas
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] m28evk: Use GENERATED_GBL_DATA_SIZE

2012-01-04 Thread Stefano Babic
On 29/12/2011 14:35, Fabio Estevam wrote:
 Use GENERATED_GBL_DATA_SIZE for calculating CONFIG_SYS_INIT_SP_OFFSET.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V12 08/14] Add cache functions to SPL for armv7

2012-01-04 Thread Stefano Babic
On 04/01/2012 14:58, Simon Schwarz wrote:
 Hi Stefano,
 

Hi Simon,

 Just FYI: I already did this with DMA - the patch was rejected and I
 haven't worked on it since (as you already said it is some work...).

Yes, of course - it makes sense to find a solution that will be accepted
before implementing it - this is the reason I prepared a way to enable
caches, but I have not yet done and I will not do if this solution will
be rejected.

 It
 was really speeding up the copy process.

I am sure it is a big improvement...

 I have some meassurments on
 this and it would be really interesting to compare them with the d-cache
 solution.
 
 If you are interested I can send you my data - so you can compare it
 when you have d-cache ready.

Ok, understood. Let's see if we can merge soon the patchset into
mainline - that opens also the possibility to add further SOCs, not only
TI. And then we can proceed optimizing with DMA or d-cache.

Best regards,
Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 4/4] ARM: omap3: Added Teejet mt_ventoux

2012-01-04 Thread Tom Rini
On Wed, Jan 4, 2012 at 2:02 AM, Stefano Babic sba...@denx.de wrote:
 The mt_ventoux board is a custom board using
 the Technexion TAM3517 module.

 Signed-off-by: Stefano Babic sba...@denx.de
 CC: Ilya Yanok ya...@emcraft.com
 CC: Igor Grinberg grinb...@compulab.co.il
[snip]
 +#if defined(CONFIG_GENERIC_MMC)  defined(CONFIG_OMAP_HSMMC)  \
 +       !defined(CONFIG_SPL_BUILD)
 +int board_mmc_init(bd_t *bis)
 +{
 +       return omap_mmc_init(0);
 +}
 +#endif

CONFIG_OMAP_HSMMC requires CONFIG_GENERIC_MMC, don't need to check for
both, thanks.

-- 
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 4/4] ARM: omap3: Added Teejet mt_ventoux

2012-01-04 Thread Stefano Babic
On 04/01/2012 15:25, Tom Rini wrote:
 On Wed, Jan 4, 2012 at 2:02 AM, Stefano Babic sba...@denx.de wrote:
 The mt_ventoux board is a custom board using
 the Technexion TAM3517 module.

 Signed-off-by: Stefano Babic sba...@denx.de
 CC: Ilya Yanok ya...@emcraft.com
 CC: Igor Grinberg grinb...@compulab.co.il
 [snip]
 +#if defined(CONFIG_GENERIC_MMC)  defined(CONFIG_OMAP_HSMMC)  \
 +   !defined(CONFIG_SPL_BUILD)
 +int board_mmc_init(bd_t *bis)
 +{
 +   return omap_mmc_init(0);
 +}
 +#endif
 
 CONFIG_OMAP_HSMMC requires CONFIG_GENERIC_MMC, don't need to check for
 both, thanks.

Right, I fix it.

Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] cmd_nand: add biterror insertion command for NAND Flash

2012-01-04 Thread Holger Brunck
From: Stefan Bigler stefan.big...@keymile.com

Initial implementation for unsafe feature for biterror insertion on
NAND-Flash devices. The code flips single bits in the data block of the
flash to simulate single bit-errors.
Tested with Samsung K9F1G08U0D and Micron MT29F1G08ABADAWP on
km_kirkwood boards.

Signed-off-by: Stefan Bigler stefan.big...@keymile.com
Cc: Holger Brunck holger.bru...@keymile.com
Cc: Valentin Longchamp valentin.longch...@keymile.com
Cc: Scott Wood scottw...@freescale.com
---
 common/cmd_nand.c |  131 +++-
 1 files changed, 128 insertions(+), 3 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 3e2edb8..3873d6f 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -96,6 +96,125 @@ static int nand_dump(nand_info_t *nand, ulong off, int 
only_oob, int repeat)
return 0;
 }
 
+#define MAX_WRITE_BLOCKS 64
+
+static int nand_biterror(nand_info_t *nand, ulong off, int bit)
+{
+   int ret = 0;
+   int block = 0;
+   ulong  block_off;
+   u_char * datbuf[MAX_WRITE_BLOCKS]; /* contains data and obb */
+   u_char * oobbuf[MAX_WRITE_BLOCKS]; /* not used */
+   u_char data;
+   int nbr_write_blocks = nand-erasesize / nand-writesize;
+   struct erase_info einfo;
+
+   if (nbr_write_blocks  MAX_WRITE_BLOCKS) {
+   puts(to many write blocks in one erase block\n);
+   return 1;
+   }
+
+   if ((bit  0) || (bit  7)) {
+   puts(bit position 0 to 7 is allowed\n);
+   return 1;
+   }
+
+   /* allocate memory */
+   memset(datbuf, 0, sizeof(datbuf));
+   memset(oobbuf, 0, sizeof(oobbuf));
+
+   for (block = 0; block  nbr_write_blocks; block++) {
+   datbuf[block] = malloc(nand-writesize + nand-oobsize);
+   oobbuf[block] = malloc(nand-oobsize);
+   if (!datbuf[block] || !oobbuf[block]) {
+   puts(No memory for page buffer\n);
+   ret = 1;
+   goto free_memory;
+   }
+   }
+
+   /* read out memory as first step */
+   block_off = off  (~(nand-erasesize - 1));
+   /* allign to eraseable block boundary */
+   for (block = 0; block  nbr_write_blocks; block++) {
+   struct mtd_oob_ops ops;
+
+   loff_t addr = (loff_t) block_off;
+   memset(ops, 0, sizeof(ops));
+   ops.datbuf = datbuf[block];
+   ops.oobbuf = oobbuf[block];
+   /* must exist, but oob data will be appended to ops.datbuf */
+   ops.len = nand-writesize;
+   ops.ooblen = nand-oobsize;
+   ops.mode = MTD_OOB_RAW;
+   ret = nand-read_oob(nand, addr, ops);
+   if (ret  0) {
+   printf(Error (%d) reading page %08lx\n,
+   ret, block_off);
+   ret = 1;
+   goto free_memory;
+   }
+   block_off += nand-writesize;
+   }
+
+   /* second step erase the block */
+   memset(einfo, 0, sizeof(einfo));
+   einfo.mtd = nand;
+   /* allign to eraseable block boundry */
+   einfo.addr = (loff_t) (off  (~(nand-erasesize - 1)));
+   einfo.len = nand-erasesize;
+   ret = nand_erase_nand(nand, einfo, 1);
+
+   if (ret  0) {
+   printf(Error (%d) nand_erase_nand page %08llx\n,
+   ret, einfo.addr);
+   ret = 1;
+   goto free_memory;
+   }
+
+   /* third step twist a bit in data part */
+   /* offset in the erasable block */
+   block_off = off  (nand-erasesize - 1);
+   data = datbuf[block_off/nand-writesize][block_off%nand-writesize];
+   data ^= (1  bit);
+   datbuf[block_off/nand-writesize][block_off%nand-writesize] = data;
+
+   printf(Flip data at 0x%lx with xor 0x%02x (bit=%d) to value=0x%02x\n,
+   off, (1  bit), bit, data);
+
+   /* write back twisted data and unmodified obb */
+   /* allign to eraseable block boundry */
+   block_off = off  (~(nand-erasesize - 1));
+   for (block = 0; block  nbr_write_blocks; block++) {
+   struct mtd_oob_ops ops;
+
+   loff_t addr = (loff_t) block_off;
+   memset(ops, 0, sizeof(ops));
+   ops.datbuf = datbuf[block];
+   ops.oobbuf = datbuf[block][nand-writesize];
+   ops.len = nand-writesize;
+   ops.ooblen = nand-oobsize;
+   ops.mode = MTD_OOB_RAW;
+   ret = nand-write_oob(nand, addr, ops);
+
+   if (ret  0) {
+   printf(Error (%d) write page %08lx\n, ret, block_off);
+   ret = 1;
+   goto free_memory;
+   }
+   block_off += nand-writesize;
+   }
+
+free_memory:
+   for (block = 0; block  nbr_write_blocks; 

Re: [U-Boot] [PATCH 3/3] mtd/nand : workaround for Freescale FCM to support large-page Nand chip

2012-01-04 Thread Matthew L. Creech
On Tue, Jan 3, 2012 at 6:58 PM, Scott Wood scottw...@freescale.com wrote:
 On page 93, it says Minimum required ECC: 4-bit ECC per 540 bytes of data.

 OK.  Is booting from a source other than NAND (at least enough to fit
 software BCH support) an option?


Not easily.  We were hoping to be able to use the existing design and
just substitute a new chip, and give the manufacturer a different
firmware image.  But it's starting to look like that might be the best
long-term option.  Booting directly from NAND has been more trouble
than it's worth in general, so we were already leaning toward having
our next design boot from a small NOR or EEPROM instead.

I'll also have our hardware guy take another look for 4k parts that
don't require 1-bit ECC (and thanks for the link).

Thanks Scott

-- 
Matthew L. Creech
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm/omap3: limit chip select iteration based on board config

2012-01-04 Thread Grant Erickson
On Jan 3, 2012, at 6:31 AM, Tom Rini wrote:
 On 12/22/2011 12:28 PM, Grant Erickson wrote:
 Only attempt to configure and add DRAM at chip select 1 if the board has 
 configured more than one bank of DRAM.
 
 This prevents boards that have CONFIG_NR_DRAM_BANKS set to 1 from getting an 
 incorrect DRAM size.
 
 Signed-off-by: Grant Erickson maratho...@gmail.com
 Cc: Tom Rini tr...@ti.com
 
 OK, what problem (and on what board) are you seeing?  Many boards only
 have CS0 populated with DRAM but when we try and configure CS1 the
 mem_ok() call fails and we don't try and use it, so we don't get a wrong
 amount of memory.  Thanks!

Tom:

This is on an OMAP3EVM-derived board with 64 MiB of fixed Micron MDDR DRAM.

The board is bootstrapped in second stage boot using X-Loader 1.46 (it'll move 
to U-Boot SPL really soon now). The original X-Loader 1.46 + U-Boot 2010.09 
went successfully as follows:

Texas Instruments X-Loader 1.46 (Dec 21 2011 - 21:23:39)

Reading boot sector

229792 bytes read
Loading from MMC0, file u-boot.img
   Image Name:   U-Boot 2010.09
   Created:  2011-12-22   5:12:46 UTC
   Image Type:   ARM U-Boot Firmware (uncompressed)
   Data Size:229728 Bytes = 224.3 KiB
   Load Address: 80e8
   Entry Point:  
   Verifying Checksum ... OK
   Loading Firmware ... OK

Starting Firmware ...

U-Boot 2010.09 (Dec 21 2011 - 21:11:09)

U-Boot code: 80E8 - 80EB8160  BSS: - 80EFA604
OMAP36XX/37XX-GP ES2.1, CPU-OPP2, L3-165MHz, Max CPU Clock 1 Ghz
I2C:   ready
RAM Configuration:
Bank #0: 8000 64 MiB
Bank #1: a000 0 Bytes
NAND:  256 MiB
In:serial
Out:   serial
Err:   serial
Board: Revision 6, Serial 10921256018
Build: development
Die ID #6f4400029e380160a7451000f006
Net:   No ethernet found.
### main_loop entered: bootdelay=1

### main_loop: bootcmd=run nandboot0 || run nandboot1 || run mmcboot 
|| reset
Hit any key to stop autoboot:  0 

With the same X-Loader but using U-Boot 2011.12-rc2 without the proposed patch, 
things failed as follows:

Texas Instruments X-Loader 1.46 (Dec 21 2011 - 21:23:39)

Reading boot sector

[ ... ]

U-Boot 2011.12-rc2 (Dec 21 2011 - 22:47:56)

U-Boot code: 80E8 - 80EC00E4  BSS: - 80F02800
OMAP36XX/37XX-GP ES1.2, CPU-OPP2, L3-165MHz, Max CPU Clock 1 Ghz
I2C:   ready
-- dram_init
-- get_sdr_cs_size
-- get_sdr_cs_size size 67108864
size0 67108864
-- get_sdr_cs_size
-- get_sdr_cs_size size 67108864
-- get_sdr_cs_size
-- get_sdr_cs_size size 67108864
size1 67108864
gd-ram_size 134217728
-- dram_init
monitor len: 00082800
ramsize: 0800
TLB table at: 87ff
Top of RAM usable for U-Boot at: 87ff
Reserving 522k for U-Boot at: 87f6d000
Reserving 512k for malloc() at: 87eed000
Reserving 32 Bytes for Board Info at: 87eecfe0
Reserving 120 Bytes for Global Data at: 87eecf68
New Stack Pointer is: 87eecf58
-- dram_init_banksize
-- get_sdr_cs_size
-- get_sdr_cs_size size 67108864
-- get_sdr_cs_size
-- get_sdr_cs_size size 67108864
size0 67108864
size1 67108864
-- dram_init_banksize
RAM Configuration:
Bank #0: 7461000a 1.1 GiB
Bank #1: 4806a000 1.1 GiB
relocation Offset is: 070ed000

[ Hangs ]

with the patch in place, things went successfully as follows:

Texas Instruments X-Loader 1.46 (Dec 21 2011 - 21:23:39)

Reading boot sector

[ ... ]

U-Boot 2011.12-rc2 (Dec 21 2011 - 23:54:24)

U-Boot code: 80E8 - 80EC018C  BSS: - 80F028A8
OMAP36XX/37XX-GP ES1.2, CPU-OPP2, L3-165MHz, Max CPU Clock 1 Ghz
I2C:   ready
-- dram_init
-- get_sdr_cs_size
-- get_sdr_cs_size size 67108864
size0 67108864
size1 67108864
gd-ram_size 67108864
-- dram_init
monitor len: 000828A8
ramsize: 0400
TLB table at: 83ff
Top of RAM usable for U-Boot at: 83ff
Reserving 522k for U-Boot at: 83f6d000
Reserving 512k for malloc() at: 83eed000
Reserving 24 Bytes for Board Info at: 83eecfe8
Reserving 120 Bytes for Global Data at: 83eecf70
New Stack Pointer is: 83eecf60
-- dram_init_banksize
-- get_sdr_cs_size
-- get_sdr_cs_size size 

Re: [U-Boot] [PATCH] arm/omap3: limit chip select iteration based on board config

2012-01-04 Thread Tom Rini
On 01/04/2012 09:10 AM, Grant Erickson wrote:
 On Jan 3, 2012, at 6:31 AM, Tom Rini wrote:
 On 12/22/2011 12:28 PM, Grant Erickson wrote:
 Only attempt to configure and add DRAM at chip select 1 if the board has 
 configured more than one bank of DRAM.

 This prevents boards that have CONFIG_NR_DRAM_BANKS set to 1 from getting 
 an incorrect DRAM size.

 Signed-off-by: Grant Erickson maratho...@gmail.com
 Cc: Tom Rini tr...@ti.com

 OK, what problem (and on what board) are you seeing?  Many boards only
 have CS0 populated with DRAM but when we try and configure CS1 the
 mem_ok() call fails and we don't try and use it, so we don't get a wrong
 amount of memory.  Thanks!
 
 Tom:
 
 This is on an OMAP3EVM-derived board with 64 MiB of fixed Micron MDDR DRAM.
 
 The board is bootstrapped in second stage boot using X-Loader 1.46 (it'll 
 move to U-Boot SPL really soon now). The original X-Loader 1.46 + U-Boot 
 2010.09 went successfully as follows:

X-Loader is misbehaving (and misconfiguring) here.  Actual OMAP3EVMs
also had this problem until the SPL switch.

-- 
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Please pull u-boot-ti/master

2012-01-04 Thread Tom Rini
Hi Albert,

This replaces the pull request I sent for u-boot-ti/next back around
Dec 23rd that wasn't pulled.

The following changes since commit a747cc0a8c55d69a56a6db80a35cdb48c853447d:
  Thierry Reding (1):
tegra2: Optimize out-of-tree build for Ventana.

are available in the git repository at:

  git://git.denx.de/u-boot-ti.git master

Aneesh V (1):
  omap4: fix boot issue on ES2.0 Panda

Christian Riesch (3):
  arm, davinci: Use a common configuration file for da850evm and
da850_am18xxevm
  da850evm: Remove CONFIG_SYS_xxCACHE_OFF defines
  arm, davinci: Change byte order of RTC kick register values

Peter Barada (1):
  ARMV7: Add support For Logic OMAP35x/DM37x modules

Peter Meerwald (1):
  beagle: add eeprom expansion board info for bct brettl3

Thomas Weber (1):
  OMAP3: Remove unused define CONFIG_OMAP3_*_DDR

 MAINTAINERS  |4 +
 arch/arm/cpu/armv7/omap4/hwinit.c|4 +-
 arch/arm/include/asm/arch-davinci/hardware.h |4 +-
 arch/arm/include/asm/arch-omap4/omap.h   |2 +-
 board/enbw/enbw_cmc/enbw_cmc.c   |4 +-
 board/logicpd/omap3som/Makefile  |   42 +++
 board/logicpd/omap3som/omap3logic.c  |  247 ++
 board/logicpd/omap3som/omap3logic.h  |   47 
 board/ti/beagle/beagle.c |4 +
 boards.cfg   |3 +-
 include/configs/cm_t35.h |3 -
 include/configs/da850_am18xxevm.h|  246 -
 include/configs/da850evm.h   |3 -
 include/configs/dig297.h |3 -
 include/configs/igep0020.h   |3 -
 include/configs/igep0030.h   |3 -
 include/configs/omap3_logic.h|  362 ++
 include/configs/omap3_mvblx.h|3 -
 include/configs/omap3_overo.h|3 -
 include/configs/omap3_pandora.h  |3 -
 include/configs/omap3_sdp3430.h  |3 -
 include/configs/omap3_zoom1.h|3 -
 include/configs/omap3_zoom2.h|3 -
 23 files changed, 715 insertions(+), 287 deletions(-)
 create mode 100644 board/logicpd/omap3som/Makefile
 create mode 100644 board/logicpd/omap3som/omap3logic.c
 create mode 100644 board/logicpd/omap3som/omap3logic.h
 delete mode 100644 include/configs/da850_am18xxevm.h
 create mode 100644 include/configs/omap3_logic.h

-- 
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm/omap3: limit chip select iteration based on board config

2012-01-04 Thread Grant Erickson
On Jan 4, 2012, at 8:14 AM, Tom Rini wrote:
 On 01/04/2012 09:10 AM, Grant Erickson wrote:
 On Jan 3, 2012, at 6:31 AM, Tom Rini wrote:
 On 12/22/2011 12:28 PM, Grant Erickson wrote:
 Only attempt to configure and add DRAM at chip select 1 if the board has 
 configured more than one bank of DRAM.
 
 This prevents boards that have CONFIG_NR_DRAM_BANKS set to 1 from getting 
 an incorrect DRAM size.
 
 Signed-off-by: Grant Erickson maratho...@gmail.com
 Cc: Tom Rini tr...@ti.com
 
 OK, what problem (and on what board) are you seeing?  Many boards only
 have CS0 populated with DRAM but when we try and configure CS1 the
 mem_ok() call fails and we don't try and use it, so we don't get a wrong
 amount of memory.  Thanks!
 
 Tom:
 
 This is on an OMAP3EVM-derived board with 64 MiB of fixed Micron MDDR DRAM.
 
 The board is bootstrapped in second stage boot using X-Loader 1.46 (it'll 
 move to U-Boot SPL really soon now). The original X-Loader 1.46 + U-Boot 
 2010.09 went successfully as follows:
 
 X-Loader is misbehaving (and misconfiguring) here.  Actual OMAP3EVM also had 
 this problem until the SPL switch.

Tom:

That makes sense; however, I have deployed boards in the field for which an 
in-place X-Loader update isn't trivial and for which interoperability is key. 
In light of that, are you willing to accept the patch?

* For CONFIG_NR_DRAM_BANKS set to 1, we get interop with old second 
stage boot such as X-Loader.

* For CONFIG_NR_DRAM_BANKS set to 2 (most boards) the behavior is 
exactly as it is without the patch.

What do you think?

Thanks,

Grant
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [GIT PULL] Pull request: u-boot-imx

2012-01-04 Thread Stefano Babic
Hi Albert,

please pull from u-boot-imx, thanks.

The following changes since commit a747cc0a8c55d69a56a6db80a35cdb48c853447d:

  tegra2: Optimize out-of-tree build for Ventana. (2011-12-24 10:23:32
+0100)

are available in the git repository at:
  git://www.denx.de/git/u-boot-imx.git master

Eric Nelson (1):
  i.mx6q: mx6qarm2: Enable the usboh3 clock

Fabio Estevam (6):
  net: imx: Add multi-FEC support for imx_get_mac_from_fuse
  mx28: Let imx_get_mac_from_fuse be common for mx28
  mx28: Let dram_init be common for mx28
  mx28evk: Add initial support for MX28EVK board
  mx28evk: Remove 'all' target from Makefile
  m28evk: Use GENERATED_GBL_DATA_SIZE

Jason Liu (4):
  i.mx: i.mx6q: Add the enet clock function
  fec: add the i.mx6q enet driver support
  i.mx6q: arm2: Add the enet function support
  i.mx6:imx6q: allign MAC address with burned-in ordering

Marek Vasut (1):
  MX28: Fix MXSBOOT segfault if no params specified

Veli-Pekka Peltola (1):
  mx28: remove omap specific config options

 MAINTAINERS|1 +
 arch/arm/cpu/arm1136/mx35/generic.c|2 +-
 arch/arm/cpu/arm926ejs/mx25/generic.c  |2 +-
 arch/arm/cpu/arm926ejs/mx27/generic.c  |2 +-
 arch/arm/cpu/arm926ejs/mx28/mx28.c |   67 +++
 arch/arm/cpu/arm926ejs/mx28/start.S|6 -
 arch/arm/cpu/armv7/mx6/clock.c |5 +
 arch/arm/cpu/armv7/mx6/soc.c   |   16 ++-
 arch/arm/include/asm/arch-mx28/sys_proto.h |2 +
 arch/arm/include/asm/arch-mx6/imx-regs.h   |4 +-
 board/denx/m28evk/m28evk.c |   53 +
 board/freescale/mx28evk/Makefile   |   47 
 board/freescale/mx28evk/iomux.c|  138 ++
 board/freescale/mx28evk/mx28evk.c  |  169
++
 board/freescale/mx28evk/u-boot.bd  |   14 +++
 board/freescale/mx6qarm2/imximage.cfg  |2 +-
 board/freescale/mx6qarm2/mx6qarm2.c|   90 ++
 boards.cfg |1 +
 drivers/net/fec_mxc.c  |   19 +++-
 drivers/net/fec_mxc.h  |9 +-
 include/configs/m28evk.h   |9 ++-
 include/configs/mx28evk.h  |  176

 include/configs/mx6qarm2.h |   12 ++-
 tools/mxsboot.c|3 +
 24 files changed, 769 insertions(+), 80 deletions(-)
 create mode 100644 board/freescale/mx28evk/Makefile
 create mode 100644 board/freescale/mx28evk/iomux.c
 create mode 100644 board/freescale/mx28evk/mx28evk.c
 create mode 100644 board/freescale/mx28evk/u-boot.bd
 create mode 100644 include/configs/mx28evk.h


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [GIT PULL] Pull request: u-boot-imx

2012-01-04 Thread Fabio Estevam
Hi Stefano,

On Wed, Jan 4, 2012 at 2:57 PM, Stefano Babic sba...@denx.de wrote:

 Fabio Estevam (6):
      net: imx: Add multi-FEC support for imx_get_mac_from_fuse
      mx28: Let imx_get_mac_from_fuse be common for mx28
      mx28: Let dram_init be common for mx28
      mx28evk: Add initial support for MX28EVK board
      mx28evk: Remove 'all' target from Makefile

Looks like the similar patch for m28evk is missing.

Please find it here: http://patchwork.ozlabs.org/patch/133542/

Regards,

Fabio Estevam
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_nand: add biterror insertion command for NAND Flash

2012-01-04 Thread Scott Wood
On 01/04/2012 09:32 AM, Holger Brunck wrote:
 From: Stefan Bigler stefan.big...@keymile.com
 
 Initial implementation for unsafe feature for biterror insertion on
 NAND-Flash devices. The code flips single bits in the data block of the
 flash to simulate single bit-errors.
 Tested with Samsung K9F1G08U0D and Micron MT29F1G08ABADAWP on
 km_kirkwood boards.

Do we still need dedicated code for this now that we have the ability to
do raw writes?

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [GIT PULL] Pull request: u-boot-imx

2012-01-04 Thread Stefano Babic
On 04/01/2012 18:41, Fabio Estevam wrote:
 Hi Stefano,
 
 On Wed, Jan 4, 2012 at 2:57 PM, Stefano Babic sba...@denx.de wrote:
 
 Fabio Estevam (6):
  net: imx: Add multi-FEC support for imx_get_mac_from_fuse
  mx28: Let imx_get_mac_from_fuse be common for mx28
  mx28: Let dram_init be common for mx28
  mx28evk: Add initial support for MX28EVK board
  mx28evk: Remove 'all' target from Makefile
 
 Looks like the similar patch for m28evk is missing.

That's right, thanks, I did not merge it.

 
 Please find it here: http://patchwork.ozlabs.org/patch/133542/

There is no drawbacks for the current pull request if the patch is
missing, and I merge the patch into my next branch for the next time.

Thanks,

Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] USB: move keyboard polling into kbd driver

2012-01-04 Thread Allen Martin
 This moves keyboard polling logic from USB HCD drivers into USB
 keyboard driver.  Remove usb_event_poll() as keyboard polling was
 the only user of this API.  With this patch USB keyboard works with
 EHCI controllers again.  Tested on a tegra2 seaboard.
 
 Signed-off-by: Allen Martin amar...@nvidia.com

ping, anyone have any comments/feedback?

-Allen

nvpublic

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] USB: reevaluate iomux stdin on USB kbd detect

2012-01-04 Thread Allen Martin
 If CONSOLE_MUX is enabled, reevaluate console stdin when USB keyboard
 device is detected.
 
 Signed-off-by: Allen Martin amar...@nvidia.com

ping, anyone have any comments/feedback?

-Allen

nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 01/17] x86: Import glibc memcpy implementation

2012-01-04 Thread Graeme Russ
Taken from glibc version 2.14.90

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - None

 arch/x86/include/asm/string.h |2 +-
 arch/x86/lib/string.c |   61 +
 2 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h
index 3aa6c11..0ad612f 100644
--- a/arch/x86/include/asm/string.h
+++ b/arch/x86/include/asm/string.h
@@ -14,7 +14,7 @@ extern char * strrchr(const char * s, int c);
 #undef __HAVE_ARCH_STRCHR
 extern char * strchr(const char * s, int c);

-#undef __HAVE_ARCH_MEMCPY
+#define __HAVE_ARCH_MEMCPY
 extern void * memcpy(void *, const void *, __kernel_size_t);

 #undef __HAVE_ARCH_MEMMOVE
diff --git a/arch/x86/lib/string.c b/arch/x86/lib/string.c
index f2ea7e4..1fde81b 100644
--- a/arch/x86/lib/string.c
+++ b/arch/x86/lib/string.c
@@ -85,3 +85,64 @@ void *memset(void *dstpp, int c, size_t len)

return dstpp;
 }
+
+#defineOP_T_THRES  8
+#define OPSIZ  (sizeof(op_t))
+
+#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes)\
+do { \
+   int __d0; \
+   asm volatile( \
+   /* Clear the direction flag, so copying goes forward.  */ \
+   cld\n   \
+   /* Copy bytes.  */\
+   rep\n   \
+   movsb : \
+   =D (dst_bp), =S (src_bp), =c (__d0) :   \
+   0 (dst_bp), 1 (src_bp), 2 (nbytes) :\
+   memory);\
+} while (0)
+
+#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes)   \
+do { \
+   int __d0; \
+   asm volatile( \
+   /* Clear the direction flag, so copying goes forward.  */ \
+   cld\n   \
+   /* Copy longwords.  */\
+   rep\n   \
+   movsl : \
+   =D (dst_bp), =S (src_bp), =c (__d0) :   \
+   0 (dst_bp), 1 (src_bp), 2 ((nbytes) / 4) :  \
+   memory);\
+   (nbytes_left) = (nbytes) % 4; \
+} while (0)
+
+void *memcpy(void *dstpp, const void *srcpp, size_t len)
+{
+   unsigned long int dstp = (long int)dstpp;
+   unsigned long int srcp = (long int)srcpp;
+
+   /* Copy from the beginning to the end.  */
+
+   /* If there not too few bytes to copy, use word copy.  */
+   if (len = OP_T_THRES) {
+   /* Copy just a few bytes to make DSTP aligned.  */
+   len -= (-dstp) % OPSIZ;
+   BYTE_COPY_FWD(dstp, srcp, (-dstp) % OPSIZ);
+
+   /* Copy from SRCP to DSTP taking advantage of the known
+* alignment of DSTP.  Number of bytes remaining is put
+* in the third argument, i.e. in LEN.  This number may
+* vary from machine to machine.
+*/
+   WORD_COPY_FWD(dstp, srcp, len, len);
+
+   /* Fall out and copy the tail.  */
+   }
+
+   /* There are just a few bytes to copy. Use byte memory operations. */
+   BYTE_COPY_FWD(dstp, srcp, len);
+
+   return dstpp;
+}
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 02/17] x86: Speed up copy-to-RAM and clear BSS operations

2012-01-04 Thread Graeme Russ
The implementations of memcpy and memset are now the optimised versions
from glibc, so use them instead of simple copy loops

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Removed unneeded brackets

 arch/x86/lib/board.c |   17 +
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index d742fec..f9eb15b 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -188,26 +188,19 @@ static int calculate_relocation_address(void)

 static int copy_uboot_to_ram(void)
 {
-   ulong *dst_addr = (ulong *)gd-relocaddr;
-   ulong *src_addr = (ulong *)__text_start;
-   ulong *end_addr = (ulong *)__data_end;
+   size_t len = (size_t)__data_end - (size_t)__text_start;

-   while (src_addr  end_addr)
-   *dst_addr++ = *src_addr++;
+   memcpy((void *)gd-relocaddr, (void *)__text_start, len);

return 0;
 }

 static int clear_bss(void)
 {
-   void *bss_start = __bss_start;
-   void *bss_end = __bss_end;
+   ulong dst_addr = (ulong)__bss_start + gd-reloc_off;
+   size_t len = (size_t)__bss_end - (size_t)__bss_start;

-   ulong *dst_addr = (ulong *)(bss_start + gd-reloc_off);
-   ulong *end_addr = (ulong *)(bss_end + gd-reloc_off);
-
-   while (dst_addr  end_addr)
-   *dst_addr++ = 0x;
+   memset((void *)dst_addr, 0x00, len);

return 0;
 }
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 03/17] x86: Remove GDR related magic numbers

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Use an enum
 - Add defined for GDT size (previously added in patch 7)
 - Use X86_ namespace (as per Linux headers)

 arch/x86/cpu/cpu.c   |8 
 arch/x86/cpu/start.S |3 ++-
 arch/x86/include/asm/processor.h |   23 +++
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 61d0b69..209ff29 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -63,13 +63,13 @@ static void reload_gdt(void)
 */
static const u64 boot_gdt[] __attribute__((aligned(16))) = {
/* CS: code, read/execute, 4 GB, base 0 */
-   [GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf),
+   [X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf),
/* DS: data, read/write, 4 GB, base 0 */
-   [GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xf),
+   [X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xf),
/* 16-bit CS: code, read/execute, 64 kB, base 0 */
-   [GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x109b, 0, 0x0),
+   [X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x109b, 0, 0x0),
/* 16-bit DS: data, read/write, 64 kB, base 0 */
-   [GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x1093, 0, 0x0),
+   [X86_GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x1093, 0, 0x0),
};
static struct gdt_ptr gdt;

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index f87633b..6027f54 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -29,6 +29,7 @@
 #include config.h
 #include version.h
 #include asm/global_data.h
+#include asm/processor.h
 #include asm/processor-flags.h
 #include generated/asm-offsets.h

@@ -58,7 +59,7 @@ _start:
/* This is the 32-bit cold-reset entry point */

/* Load the segement registes to match the gdt loaded in start16.S */
-   movl$0x18, %eax
+   movl$(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax
movw%ax, %fs
movw%ax, %ds
movw%ax, %gs
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 1e5dccd..aa8188e 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -24,9 +24,24 @@
 #ifndef __ASM_PROCESSOR_H_
 #define __ASM_PROCESSOR_H_ 1

-#define GDT_ENTRY_32BIT_CS 2
-#define GDT_ENTRY_32BIT_DS (GDT_ENTRY_32BIT_CS + 1)
-#define GDT_ENTRY_16BIT_CS (GDT_ENTRY_32BIT_DS + 1)
-#define GDT_ENTRY_16BIT_DS (GDT_ENTRY_16BIT_CS + 1)
+#define X86_GDT_ENTRY_SIZE 8
+
+#ifndef __ASSEMBLY__
+
+enum {
+   X86_GDT_ENTRY_NULL = 0,
+   X86_GDT_ENTRY_UNUSED,
+   X86_GDT_ENTRY_32BIT_CS,
+   X86_GDT_ENTRY_32BIT_DS,
+   X86_GDT_ENTRY_16BIT_CS,
+   X86_GDT_ENTRY_16BIT_DS,
+   X86_GDT_NUM_ENTRIES
+};
+#else
+/* NOTE: If the above enum is modified, this define must be checked */
+#define X86_GDT_ENTRY_32BIT_DS 3
+#endif
+
+#define X86_GDT_SIZE   (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)

 #endif
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 04/17] x86: Rework Global Descriptor Table loading

2012-01-04 Thread Graeme Russ
The inline assembler is ugly and uses hard coded magic numbers. Make it more
elegant to allow cleaner implementation of future GDT related patches. The
compiler seems smart enough to generate the same code anyway

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Rebased against revised patch #3
 - Use GDT size define instead of magic number
 - Added commit message

 arch/x86/cpu/cpu.c |   82 +--
 1 files changed, 53 insertions(+), 29 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 209ff29..8102fb9 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -55,35 +55,39 @@ struct gdt_ptr {
u32 ptr;
 } __packed;

-static void reload_gdt(void)
+static void load_ds(u32 segment)
 {
-   /*
-* There are machines which are known to not boot with the GDT
-* being 8-byte unaligned.  Intel recommends 16 byte alignment
-*/
-   static const u64 boot_gdt[] __attribute__((aligned(16))) = {
-   /* CS: code, read/execute, 4 GB, base 0 */
-   [X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf),
-   /* DS: data, read/write, 4 GB, base 0 */
-   [X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xf),
-   /* 16-bit CS: code, read/execute, 64 kB, base 0 */
-   [X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x109b, 0, 0x0),
-   /* 16-bit DS: data, read/write, 64 kB, base 0 */
-   [X86_GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x1093, 0, 0x0),
-   };
-   static struct gdt_ptr gdt;
-
-   gdt.len = sizeof(boot_gdt)-1;
-   gdt.ptr = (u32)boot_gdt;
-
-   asm volatile(lgdtl %0\n \
-movl $((2+1)*8), %%ecx\n \
-movl %%ecx, %%ds\n \
-movl %%ecx, %%es\n \
-movl %%ecx, %%fs\n \
-movl %%ecx, %%gs\n \
-movl %%ecx, %%ss \
-: : m (gdt) : ecx);
+   asm volatile(movl %0, %%ds : : r (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_es(u32 segment)
+{
+   asm volatile(movl %0, %%es : : r (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_fs(u32 segment)
+{
+   asm volatile(movl %0, %%fs : : r (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_gs(u32 segment)
+{
+   asm volatile(movl %0, %%gs : : r (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_ss(u32 segment)
+{
+   asm volatile(movl %0, %%ss : : r (segment * X86_GDT_ENTRY_SIZE));
+}
+
+static void load_gdt(const u64 *boot_gdt, u16 num_entries)
+{
+   struct gdt_ptr gdt;
+
+   gdt.len = (num_entries * 8) - 1;
+   gdt.ptr = (u32)boot_gdt;
+
+   asm volatile(lgdtl %0\n : : m (gdt));
 }

 int x86_cpu_init_f(void)
@@ -113,7 +117,27 @@ int x86_cpu_init_r(void)
movl   %%eax, %%cr0\n
wbinvd\n : : i (nw_cd_rst) : eax);

-   reload_gdt();
+   /*
+* There are machines which are known to not boot with the GDT
+* being 8-byte unaligned. Intel recommends 16 byte alignment
+*/
+   static const u64 boot_gdt[] __aligned(16) = {
+   /* CS: code, read/execute, 4 GB, base 0 */
+   [X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf),
+   /* DS: data, read/write, 4 GB, base 0 */
+   [X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xf),
+   /* 16-bit CS: code, read/execute, 64 kB, base 0 */
+   [X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x109b, 0, 0x0),
+   /* 16-bit DS: data, read/write, 64 kB, base 0 */
+   [X86_GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x1093, 0, 0x0),
+   };
+
+   load_gdt(boot_gdt, X86_GDT_NUM_ENTRIES);
+   load_ds(X86_GDT_ENTRY_32BIT_DS);
+   load_es(X86_GDT_ENTRY_32BIT_DS);
+   load_fs(X86_GDT_ENTRY_32BIT_DS);
+   load_gs(X86_GDT_ENTRY_32BIT_DS);
+   load_ss(X86_GDT_ENTRY_32BIT_DS);

/* Initialize core interrupt and exception functionality of CPU */
cpu_init_interrupts();
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 05/17] x86: Simplify Flash-to-RAM code execution transition

2012-01-04 Thread Graeme Russ
Move the relocation offset calculation out of assembler and into C. This
also paves the way for the upcoming init sequence simplification by adding
the board_init_f_r flash to RAM transitional function

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Added commit message
 - Minor adjustment to new stack address comment

 arch/x86/cpu/start.S  |   22 ++
 arch/x86/include/asm/u-boot-x86.h |2 ++
 arch/x86/lib/board.c  |   25 ++---
 3 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 6027f54..69a9b2c 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -96,32 +96,22 @@ car_init_ret:
movw$0x85, %ax
jmp die

-.globl relocate_code
-.type relocate_code, @function
-relocate_code:
+.globl board_init_f_r_trampoline
+.type board_init_f_r_trampoline, @function
+board_init_f_r_trampoline:
/*
 * SDRAM has been initialised, U-Boot code has been copied into
 * RAM, BSS has been cleared and relocation adjustments have been
 * made. It is now time to jump into the in-RAM copy of U-Boot
 *
-* %eax = Address of top of stack
-* %edx = Address of Global Data
-* %ecx = Base address of in-RAM copy of U-Boot
+* %eax = Address of top of new stack
 */

/* Setup stack in RAM */
movl%eax, %esp

-   /* Setup call address of in-RAM copy of board_init_r() */
-   movl$board_init_r, %ebp
-   addl(GENERATED_GD_RELOC_OFF)(%edx), %ebp
-
-   /* Setup parameters to board_init_r() */
-   movl%edx, %eax
-   movl%ecx, %edx
-
-   /* Jump to in-RAM copy of board_init_r() */
-   call*%ebp
+   /* Re-enter U-Boot by calling board_init_f_r */
+   callboard_init_f_r

 die:
hlt
diff --git a/arch/x86/include/asm/u-boot-x86.h 
b/arch/x86/include/asm/u-boot-x86.h
index 755f88a..c3d2277 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -61,5 +61,7 @@ u32 isa_map_rom(u32 bus_addr, int size);
 int video_bios_init(void);
 int video_init(void);

+void   board_init_f_r_trampoline(ulong) __attribute__ ((noreturn));
+void   board_init_f_r(void) __attribute__ ((noreturn));

 #endif /* _U_BOOT_I386_H_ */
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index f9eb15b..382ada7 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -253,10 +253,29 @@ void board_init_f(ulong boot_flags)

gd-flags |= GD_FLG_RELOC;

-   /* Enter the relocated U-Boot! */
-   relocate_code(gd-start_addr_sp, gd, gd-relocaddr);
+   /*
+* SDRAM is now initialised, U-Boot has been copied into SDRAM,
+* the BSS has been cleared etc. The final stack can now be setup
+* in SDRAM. Code execution will continue (momentarily) in Flash,
+* but with the stack in SDRAM and Global Data in temporary memory
+* (CPU cache)
+*/
+   board_init_f_r_trampoline(gd-start_addr_sp);
+
+   /* NOTREACHED - board_init_f_r_trampoline() does not return */
+   while (1)
+   ;
+}
+
+void board_init_f_r(void)
+{
+   /*
+* Transfer execution from Flash to RAM by calculating the address
+* of the in-RAM copy of board_init_r() and calling it
+*/
+   (board_init_r + gd-reloc_off)(gd, gd-relocaddr);

-   /* NOTREACHED - relocate_code() does not return */
+   /* NOTREACHED - board_init_r() does not return */
while (1)
;
 }
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/17] x86: Use fs for global data

2012-01-04 Thread Graeme Russ
Use the base address of the 'F' segment as a pointer to the global data
structure. By adding the linear address (i.e. the 'D' segment address) as
the first word of the global data structure, the address of the global data
relative to the 'D' segment can be found simply, for example, by:

fs movl 0, %eax

This makes the gd 'pointer' writable prior to relocation (by reloading the
Global Descriptor Table) which brings x86 into line with all other arches

NOTE: Writing to the gd 'pointer' is expensive (but we only do it
twice) but using it to access global data members (read and write) is
still fairly cheap

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Rebased against changes made to patch #3
 - Removed extra indent
 - Tweaked commit message

 arch/x86/cpu/cpu.c |   53 --
 arch/x86/cpu/start.S   |8 -
 arch/x86/include/asm/global_data.h |   21 +
 arch/x86/include/asm/processor.h   |1 +
 arch/x86/include/asm/u-boot-x86.h  |2 +
 arch/x86/lib/board.c   |   56 +---
 6 files changed, 94 insertions(+), 47 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 8102fb9..8c3b92c 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -90,6 +90,37 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
asm volatile(lgdtl %0\n : : m (gdt));
 }

+void init_gd(gd_t *id, u64 *gdt_addr)
+{
+   id-gd_addr = (ulong)id;
+   setup_gdt(id, gdt_addr);
+}
+
+void setup_gdt(gd_t *id, u64 *gdt_addr)
+{
+   /* CS: code, read/execute, 4 GB, base 0 */
+   gdt_addr[X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf);
+
+   /* DS: data, read/write, 4 GB, base 0 */
+   gdt_addr[X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xf);
+
+   /* FS: data, read/write, 4 GB, base (Global Data Pointer) */
+   gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093, (ulong)id, 
0xf);
+
+   /* 16-bit CS: code, read/execute, 64 kB, base 0 */
+   gdt_addr[X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x109b, 0, 0x0);
+
+   /* 16-bit DS: data, read/write, 64 kB, base 0 */
+   gdt_addr[X86_GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x1093, 0, 0x0);
+
+   load_gdt(gdt_addr, X86_GDT_NUM_ENTRIES);
+   load_ds(X86_GDT_ENTRY_32BIT_DS);
+   load_es(X86_GDT_ENTRY_32BIT_DS);
+   load_gs(X86_GDT_ENTRY_32BIT_DS);
+   load_ss(X86_GDT_ENTRY_32BIT_DS);
+   load_fs(X86_GDT_ENTRY_32BIT_FS);
+}
+
 int x86_cpu_init_f(void)
 {
const u32 em_rst = ~X86_CR0_EM;
@@ -117,28 +148,6 @@ int x86_cpu_init_r(void)
movl   %%eax, %%cr0\n
wbinvd\n : : i (nw_cd_rst) : eax);

-   /*
-* There are machines which are known to not boot with the GDT
-* being 8-byte unaligned. Intel recommends 16 byte alignment
-*/
-   static const u64 boot_gdt[] __aligned(16) = {
-   /* CS: code, read/execute, 4 GB, base 0 */
-   [X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf),
-   /* DS: data, read/write, 4 GB, base 0 */
-   [X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xf),
-   /* 16-bit CS: code, read/execute, 64 kB, base 0 */
-   [X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x109b, 0, 0x0),
-   /* 16-bit DS: data, read/write, 64 kB, base 0 */
-   [X86_GDT_ENTRY_16BIT_DS] = GDT_ENTRY(0x1093, 0, 0x0),
-   };
-
-   load_gdt(boot_gdt, X86_GDT_NUM_ENTRIES);
-   load_ds(X86_GDT_ENTRY_32BIT_DS);
-   load_es(X86_GDT_ENTRY_32BIT_DS);
-   load_fs(X86_GDT_ENTRY_32BIT_DS);
-   load_gs(X86_GDT_ENTRY_32BIT_DS);
-   load_ss(X86_GDT_ENTRY_32BIT_DS);
-
/* Initialize core interrupt and exception functionality of CPU */
cpu_init_interrupts();
return 0;
diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 69a9b2c..ee0dabe 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -31,7 +31,7 @@
 #include asm/global_data.h
 #include asm/processor.h
 #include asm/processor-flags.h
-#include generated/asm-offsets.h
+#include generated/generic-asm-offsets.h

 .section .text
 .code32
@@ -85,6 +85,12 @@ car_init_ret:
 */
movl$CONFIG_SYS_INIT_SP_ADDR, %esp

+   /* Initialise the Global Data Pointer */
+   movl$CONFIG_SYS_INIT_GD_ADDR, %eax
+   movl%eax, %edx
+   addl$GENERATED_GBL_DATA_SIZE, %edx
+   callinit_gd;
+
/* Set parameter to board_init_f() to boot flags */
xorl%eax, %eax
movw%bx, %ax
diff --git a/arch/x86/include/asm/global_data.h 
b/arch/x86/include/asm/global_data.h
index 05a2139..908a02c 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -36,6 +36,8 @@
 #ifndef __ASSEMBLY__

 typedefstruct global_data {
+   /* NOTE: gd_addr MUST be first member of struct global_data! */
+

[U-Boot] [PATCH v2 06/17] x86: Rework relocation calculations

2012-01-04 Thread Graeme Russ
This commit introduces no functional changes - It simply re-arranges the
calculations so that adding to them in future commits will be cleaner

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Fixed typo in title
 - Added commit message

 arch/x86/lib/board.c |   23 +++
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 382ada7..6f075b7 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -164,24 +164,23 @@ static int calculate_relocation_address(void)
ulong text_start = (ulong)__text_start;
ulong bss_end = (ulong)__bss_end;
ulong dest_addr;
-   ulong rel_offset;
-
-   /* Calculate destination RAM Address and relocation offset */
-   dest_addr = gd-ram_size;
-   dest_addr -= CONFIG_SYS_STACK_SIZE;
-   dest_addr -= (bss_end - text_start);

/*
-* Round destination address down to 16-byte boundary to keep
-* IDT and GDT 16-byte aligned
+* NOTE: All destination address are rounded down to 16-byte
+*   boundary to satisfy various worst-case alignment
+*   requirements
 */
-   dest_addr = ~15;

-   rel_offset = dest_addr - text_start;
+   /* Stack is at top of available memory */
+   dest_addr = gd-ram_size;
+   gd-start_addr_sp = dest_addr;

-   gd-start_addr_sp = gd-ram_size;
+   /* U-Boot is below the stack */
+   dest_addr -= CONFIG_SYS_STACK_SIZE;
+   dest_addr -= (bss_end - text_start);
+   dest_addr = ~15;
gd-relocaddr = dest_addr;
-   gd-reloc_off = rel_offset;
+   gd-reloc_off = (dest_addr - text_start);

return 0;
 }
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 08/17] x86: Set GD_FLG_RELOC after entering in-RAM copy of U-Boot

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - None

 arch/x86/lib/board.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index b64c2d3..3d82165 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -252,8 +252,6 @@ void board_init_f(ulong boot_flags)
hang();
}

-   gd-flags |= GD_FLG_RELOC;
-
/*
 * SDRAM is now initialised, U-Boot has been copied into SDRAM,
 * the BSS has been cleared etc. The final stack can now be setup
@@ -322,6 +320,8 @@ void board_init_r(gd_t *id, ulong dest_addr)
/* compiler optimization barrier needed for GCC = 3.4 */
__asm__ __volatile__( : : : memory);

+   gd-flags |= GD_FLG_RELOC;
+
gd-bd = bd_data;
memset(gd-bd, 0, sizeof(bd_t));
show_boot_progress(0x22);
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 10/17] x86: Allow cache before copy to RAM

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - None

 arch/x86/lib/board.c |   15 ++-
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 56acf35..a240d26 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -131,16 +131,11 @@ init_fnc_t *init_sequence_f[] = {
console_init_f,
dram_init_f,
calculate_relocation_address,
-   copy_uboot_to_ram,
-   clear_bss,
-   do_elf_reloc_fixups,

NULL,
 };

 init_fnc_t *init_sequence_r[] = {
-   copy_gd_to_ram,
-   init_cache,
cpu_init_r, /* basic cpu dependent setup */
board_early_init_r, /* basic board dependent setup */
dram_init,  /* configure available RAM banks */
@@ -269,6 +264,16 @@ void board_init_f(ulong boot_flags)

 void board_init_f_r(void)
 {
+   if (copy_gd_to_ram() != 0)
+   hang();
+
+   if (init_cache() != 0)
+   hang();
+
+   copy_uboot_to_ram();
+   clear_bss();
+   do_elf_reloc_fixups();
+
/*
 * Transfer execution from Flash to RAM by calculating the address
 * of the in-RAM copy of board_init_r() and calling it
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 09/17] x86: Create weak init_cache() and default enable_caches() functions

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Tweaked commit title

 arch/x86/cpu/cpu.c|   18 +++---
 arch/x86/include/asm/u-boot-x86.h |1 +
 arch/x86/lib/board.c  |1 +
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 8c3b92c..e9bb0d7 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -140,6 +140,14 @@ int cpu_init_f(void) __attribute__((weak, 
alias(x86_cpu_init_f)));

 int x86_cpu_init_r(void)
 {
+   /* Initialize core interrupt and exception functionality of CPU */
+   cpu_init_interrupts();
+   return 0;
+}
+int cpu_init_r(void) __attribute__((weak, alias(x86_cpu_init_r)));
+
+void x86_enable_caches(void)
+{
const u32 nw_cd_rst = ~(X86_CR0_NW | X86_CR0_CD);

/* turn on the cache and disable write through */
@@ -147,12 +155,16 @@ int x86_cpu_init_r(void)
andl   %0, %%eax\n
movl   %%eax, %%cr0\n
wbinvd\n : : i (nw_cd_rst) : eax);
+}
+void enable_caches(void) __attribute__((weak, alias(x86_enable_caches)));
+
+int x86_init_cache(void)
+{
+   enable_caches();

-   /* Initialize core interrupt and exception functionality of CPU */
-   cpu_init_interrupts();
return 0;
 }
-int cpu_init_r(void) __attribute__((weak, alias(x86_cpu_init_r)));
+int init_cache(void) __attribute__((weak, alias(x86_init_cache)));

 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
diff --git a/arch/x86/include/asm/u-boot-x86.h 
b/arch/x86/include/asm/u-boot-x86.h
index 5540d51..878a1ee 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -39,6 +39,7 @@ int x86_cpu_init_f(void);
 int cpu_init_f(void);
 void init_gd(gd_t *id, u64 *gdt_addr);
 void setup_gdt(gd_t *id, u64 *gdt_addr);
+int init_cache(void);

 /* cpu/.../timer.c */
 void timer_isr(void *);
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 3d82165..56acf35 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -140,6 +140,7 @@ init_fnc_t *init_sequence_f[] = {

 init_fnc_t *init_sequence_r[] = {
copy_gd_to_ram,
+   init_cache,
cpu_init_r, /* basic cpu dependent setup */
board_early_init_r, /* basic board dependent setup */
dram_init,  /* configure available RAM banks */
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 11/17] x86: Tweak IDT and GDT for alignment and readability

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Renamed to better reflect nature of changes

 arch/x86/cpu/interrupts.c |2 +-
 arch/x86/cpu/start16.S|   57 +++-
 2 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
index e0958eb..43ec3f8 100644
--- a/arch/x86/cpu/interrupts.c
+++ b/arch/x86/cpu/interrupts.c
@@ -174,7 +174,7 @@ struct desc_ptr {
unsigned short segment;
 } __packed;

-struct idt_entry idt[256] __attribute__((aligned(16)));
+struct idt_entry idt[256] __aligned(16);

 struct desc_ptr idt_ptr;

diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S
index 33e53cd..cc393ff 100644
--- a/arch/x86/cpu/start16.S
+++ b/arch/x86/cpu/start16.S
@@ -86,7 +86,11 @@ gdt_ptr:
.word   0x20/* limit (32 bytes = 4 GDT entries) */
.long   BOOT_SEG + gdt  /* base */

-   /* The GDT table ...
+/* Some CPUs are picky about GDT alignment... */
+.align 16
+gdt:
+   /*
+* The GDT table ...
 *
 *   Selector   Type
 *   0x00   NULL
@@ -94,17 +98,46 @@ gdt_ptr:
 *   0x10   32bit code
 *   0x18   32bit data/stack
 */
+   /* The NULL Desciptor - Mandatory */
+   .word   0x  /* limit_low */
+   .word   0x  /* base_low */
+   .byte   0x00/* base_middle */
+   .byte   0x00/* access */
+   .byte   0x00/* flags + limit_high */
+   .byte   0x00/* base_high */

-gdt:
-   .word   0, 0, 0, 0  /* NULL  */
-   .word   0, 0, 0, 0  /* unused */
+   /* Unused Desciptor - (matches Linux) */
+   .word   0x  /* limit_low */
+   .word   0x  /* base_low */
+   .byte   0x00/* base_middle */
+   .byte   0x00/* access */
+   .byte   0x00/* flags + limit_high */
+   .byte   0x00/* base_high */

-   .word   0x  /* 4Gb - (0x10*0x1000 = 4Gb) */
-   .word   0   /* base address = 0 */
-   .word   0x9B00  /* code read/exec */
-   .word   0x00CF  /* granularity = 4096, 386 (+5th nibble of 
limit) */
+   /*
+* The Code Segment Descriptor:
+* - Base   = 0x
+* - Size   = 4GB
+* - Access = Present, Ring 0, Exec (Code), Readable
+* - Flags  = 4kB Granularity, 32-bit
+*/
+   .word   0x  /* limit_low */
+   .word   0x  /* base_low */
+   .byte   0x00/* base_middle */
+   .byte   0x9b/* access */
+   .byte   0xcf/* flags + limit_high */
+   .byte   0x00/* base_high */

-   .word   0x  /* 4Gb - (0x10*0x1000 = 4Gb) */
-   .word   0x0 /* base address = 0 */
-   .word   0x9300  /* data read/write */
-   .word   0x00CF  /* granularity = 4096, 386 (+5th nibble of 
limit) */
+   /*
+* The Data Segment Descriptor:
+* - Base   = 0x
+* - Size   = 4GB
+* - Access = Present, Ring 0, Non-Exec (Data), Writable
+* - Flags  = 4kB Granularity, 32-bit
+*/
+   .word   0x  /* limit_low */
+   .word   0x  /* base_low */
+   .byte   0x00/* base_middle */
+   .byte   0x93/* access */
+   .byte   0xcf/* flags + limit_high */
+   .byte   0x00/* base_high */
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 12/17] CHECKPATCH: arch/x86/lib/*

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - None

 arch/x86/lib/bios.S|  134 +--
 arch/x86/lib/realmode_switch.S |   61 +++
 2 files changed, 122 insertions(+), 73 deletions(-)

diff --git a/arch/x86/lib/bios.S b/arch/x86/lib/bios.S
index ce8deb5..239aaa9 100644
--- a/arch/x86/lib/bios.S
+++ b/arch/x86/lib/bios.S
@@ -246,11 +246,9 @@ rm_int1f:
 rm_def_int:
iret

-
/*
-* All interrupt jumptable entries jump to here
-* after pushing the interrupt vector number onto the
-* stack.
+* All interrupt jumptable entries jump to here after pushing the
+* interrupt vector number onto the stack.
 */
 any_interrupt16:
MAKE_BIOS_STACK
@@ -272,7 +270,8 @@ gs  movwOFFS_VECTOR(%bp), %ax
je  Lint_1ah
movw$0x, %ax
jmp Lout
-Lint_10h:  /* VGA BIOS services */
+Lint_10h:
+   /* VGA BIOS services */
callbios_10h
jmp Lout
 Lint_11h:
@@ -281,35 +280,42 @@ Lint_11h:
 Lint_12h:
callbios_12h
jmp Lout
-Lint_13h:  /* BIOS disk services */
+Lint_13h:
+   /* BIOS disk services */
callbios_13h
jmp Lout
-Lint_15h:  /* Misc. BIOS services */
+Lint_15h:
+   /* Misc. BIOS services */
callbios_15h
jmp Lout
-Lint_16h:  /* keyboard services */
+Lint_16h:
+   /* keyboard services */
callbios_16h
jmp Lout
-Lint_1ah:  /* PCI bios */
+Lint_1ah:
+   /* PCI bios */
callbios_1ah
jmp Lout
 Lout:
cmpw$0, %ax
je  Lhandeled

-   /* Insert code for unhandeled INTs here.
+   /*
+* Insert code for unhandeled INTs here.
 *
-* ROLO prints a message to the console
-* (we could do that but then we're in 16bit mode
-* so we'll have to get back into 32bit mode
-* to use the console I/O routines (if we do this
-* we shuls make int 0x10 and int 0x16 work as well))
+* ROLO prints a message to the console we could do that but then
+* we're in 16bit mode so we'll have to get back into 32bit mode
+* to use the console I/O routines (if we do this we should make
+* int 0x10 and int 0x16 work as well)
 */
 Lhandeled:
RESTORE_CALLERS_STACK
-   addw$2,%sp  /* dump vector number */
-   iret/* return from interrupt */

+   /* dump vector number */
+   addw$2,%sp
+
+   /* return from interrupt */
+   iret

 /*
  
@@ -327,22 +333,24 @@ gsmovwOFFS_AX(%bp), %ax
je  Lvid_cfg
movw$0x, %ax
ret
-Lcur_pos:  /* Read Cursor Position and 
Size */
+Lcur_pos:
+   /* Read Cursor Position and Size */
 gs movw$0, OFFS_CX(%bp)
 gs movw$0, OFFS_DX(%bp)
xorw%ax, %ax
ret
-Lvid_state:/* Get Video State */
-gs movw$(80  8|0x03), OFFS_AX(%bp)   /* 80 columns, 80x25, 16 colors 
*/
+Lvid_state:
+   /* Get Video State - 80 columns, 80x25, 16 colors */
+gs movw$(80  8|0x03), OFFS_AX(%bp)
 gs movw$0, OFFS_BX(%bp)
xorw%ax, %ax
ret
-Lvid_cfg:  /* Video Subsystem Configuration (EGA/VGA) */
-gs movw$0x10, OFFS_BX(%bp) /* indicate CGA/MDA/HGA */
+Lvid_cfg:
+   /* Video Subsystem Configuration (EGA/VGA) - indicate CGA/MDA/HGA */
+gs movw$0x10, OFFS_BX(%bp)
xorw%ax, %ax
ret

-
 /*
  
  * BIOS interrupt 11h -- Equipment determination
@@ -355,7 +363,6 @@ gs  movw%ax, OFFS_AX(%bp)
xorw%ax, %ax
ret

-
 /*
  
  * BIOSinterrupt 12h -- Get Memory Size
@@ -370,16 +377,18 @@ csmovwram_in_64kb_chunks, %ax
 b12_more_than_640k:
movw$0x280, %ax
 b12_return:
-gs movw%ax, OFFS_AX(%bp)   /* return number of kilobytes 
in ax */
+   /* return number of kilobytes in ax */
+gs movw%ax, OFFS_AX(%bp)

 gs movwOFFS_FLAGS(%bp), %ax
-   andw$0xfffe, %ax/* clear carry -- function 
succeeded */
+
+   /* clear carry -- function succeeded */
+   andw$0xfffe, %ax
 gs movw%ax, OFFS_FLAGS(%bp)

xorw%ax, %ax
ret

-
 /*
  
  * BIOS interrupt 13h -- Disk services
@@ -394,12 +403,13 @@ gsmovwOFFS_AX(%bp), %ax
  

[U-Boot] [PATCH v2 13/17] x86: Move do_go_exec() out of board.c

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - None

 arch/x86/lib/Makefile   |1 +
 arch/x86/lib/board.c|   27 ---
 arch/x86/lib/cmd_boot.c |   64 +++
 3 files changed, 65 insertions(+), 27 deletions(-)
 create mode 100644 arch/x86/lib/cmd_boot.c

diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index d584aa4..7820895 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -32,6 +32,7 @@ SOBJS-$(CONFIG_SYS_X86_REALMODE)  += realmode_switch.o
 COBJS-$(CONFIG_SYS_PC_BIOS)+= bios_setup.o
 COBJS-y+= board.o
 COBJS-y+= bootm.o
+COBJS-y+= cmd_boot.o
 COBJS-y+= gcc.o
 COBJS-y+= interrupts.o
 COBJS-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index a240d26..aaffd1b 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -487,33 +487,6 @@ void hang(void)
;
 }

-unsigned long do_go_exec(ulong (*entry)(int, char * const []),
-int argc, char * const argv[])
-{
-   unsigned long ret = 0;
-   char **argv_tmp;
-
-   /*
-* x86 does not use a dedicated register to pass the pointer to
-* the global_data, so it is instead passed as argv[-1]. By using
-* argv[-1], the called 'Application' can use the contents of
-* argv natively. However, to safely use argv[-1] a new copy of
-* argv is needed with the extra element
-*/
-   argv_tmp = malloc(sizeof(char *) * (argc + 1));
-
-   if (argv_tmp) {
-   argv_tmp[0] = (char *)gd;
-
-   memcpy(argv_tmp[1], argv, (size_t)(sizeof(char *) * argc));
-
-   ret = (entry) (argc, argv_tmp[1]);
-   free(argv_tmp);
-   }
-
-   return ret;
-}
-
 void setup_pcat_compatibility(void)
__attribute__((weak, alias(__setup_pcat_compatibility)));

diff --git a/arch/x86/lib/cmd_boot.c b/arch/x86/lib/cmd_boot.c
new file mode 100644
index 000..a81a9a3
--- /dev/null
+++ b/arch/x86/lib/cmd_boot.c
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, graeme.r...@gmail.com
+ *
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, dan...@omicron.se
+ *
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH www.elinos.com
+ * Marius Groeger mgroe...@sysgo.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 common.h
+#include command.h
+#include malloc.h
+#include asm/u-boot-x86.h
+
+unsigned long do_go_exec(ulong (*entry)(int, char * const []),
+int argc, char * const argv[])
+{
+   unsigned long ret = 0;
+   char **argv_tmp;
+
+   /*
+* x86 does not use a dedicated register to pass the pointer to
+* the global_data, so it is instead passed as argv[-1]. By using
+* argv[-1], the called 'Application' can use the contents of
+* argv natively. However, to safely use argv[-1] a new copy of
+* argv is needed with the extra element
+*/
+   argv_tmp = malloc(sizeof(char *) * (argc + 1));
+
+   if (argv_tmp) {
+   argv_tmp[0] = (char *)gd;
+
+   memcpy(argv_tmp[1], argv, (size_t)(sizeof(char *) * argc));
+
+   ret = (entry) (argc, argv_tmp[1]);
+   free(argv_tmp);
+   }
+
+   return ret;
+}
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 14/17] x86: Move setup_pcat_compatibility() out of board.c

2012-01-04 Thread Graeme Russ
This function simply does not belong in board.c

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Added commit message

 arch/x86/lib/board.c  |7 ---
 arch/x86/lib/zimage.c |7 +++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index aaffd1b..416aa9e 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -486,10 +486,3 @@ void hang(void)
for (;;)
;
 }
-
-void setup_pcat_compatibility(void)
-   __attribute__((weak, alias(__setup_pcat_compatibility)));
-
-void __setup_pcat_compatibility(void)
-{
-}
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index bb40517..2214286 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -314,6 +314,13 @@ void boot_zimage(void *setup_base, void *load_address)
 #endif
 }

+void setup_pcat_compatibility(void)
+   __attribute__((weak, alias(__setup_pcat_compatibility)));
+
+void __setup_pcat_compatibility(void)
+{
+}
+
 int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
struct boot_params *base_ptr;
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 15/17] x86: Move relocation code out of board.c

2012-01-04 Thread Graeme Russ
Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - None

 arch/x86/lib/Makefile   |1 +
 arch/x86/lib/board.c|   69 +---
 arch/x86/lib/relocate.c |  115 +++
 3 files changed, 118 insertions(+), 67 deletions(-)
 create mode 100644 arch/x86/lib/relocate.c

diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 7820895..57b6896 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_SYS_GENERIC_TIMER) += pcat_timer.o
 COBJS-$(CONFIG_PCI) += pci.o
 COBJS-$(CONFIG_PCI) += pci_type1.o
 COBJS-$(CONFIG_SYS_X86_REALMODE)   += realmode.o
+COBJS-y+= relocate.o
 COBJS-y+= string.o
 COBJS-$(CONFIG_SYS_X86_ISR_TIMER)  += timer.o
 COBJS-$(CONFIG_VIDEO)  += video_bios.o
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 416aa9e..bebb347 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -41,7 +41,6 @@
 #include ide.h
 #include serial.h
 #include asm/u-boot-x86.h
-#include elf.h
 #include asm/processor.h

 #ifdef CONFIG_BITBANGMII
@@ -117,9 +116,6 @@ static void display_flash_config(ulong size)
 typedef int (init_fnc_t) (void);

 static int calculate_relocation_address(void);
-static int copy_uboot_to_ram(void);
-static int clear_bss(void);
-static int do_elf_reloc_fixups(void);
 static int copy_gd_to_ram(void);

 init_fnc_t *init_sequence_f[] = {
@@ -183,59 +179,6 @@ static int calculate_relocation_address(void)
return 0;
 }

-static int copy_uboot_to_ram(void)
-{
-   size_t len = (size_t)__data_end - (size_t)__text_start;
-
-   memcpy((void *)gd-relocaddr, (void *)__text_start, len);
-
-   return 0;
-}
-
-static int clear_bss(void)
-{
-   ulong dst_addr = (ulong)__bss_start + gd-reloc_off;
-   size_t len = (size_t)__bss_end - (size_t)__bss_start;
-
-   memset((void *)dst_addr, 0x00, len);
-
-   return 0;
-}
-
-static int do_elf_reloc_fixups(void)
-{
-   Elf32_Rel *re_src = (Elf32_Rel *)(__rel_dyn_start);
-   Elf32_Rel *re_end = (Elf32_Rel *)(__rel_dyn_end);
-
-   Elf32_Addr *offset_ptr_rom;
-   Elf32_Addr *offset_ptr_ram;
-
-   /* The size of the region of u-boot that runs out of RAM. */
-   uintptr_t size = (uintptr_t)__bss_end - (uintptr_t)__text_start;
-
-   do {
-   /* Get the location from the relocation entry */
-   offset_ptr_rom = (Elf32_Addr *)re_src-r_offset;
-
-   /* Check that the location of the relocation is in .text */
-   if (offset_ptr_rom = (Elf32_Addr *)CONFIG_SYS_TEXT_BASE) {
-
-   /* Switch to the in-RAM version */
-   offset_ptr_ram = (Elf32_Addr *)((ulong)offset_ptr_rom +
-   gd-reloc_off);
-
-   /* Check that the target points into .text */
-   if (*offset_ptr_ram = CONFIG_SYS_TEXT_BASE 
-   *offset_ptr_ram 
-   (CONFIG_SYS_TEXT_BASE + size)) {
-   *offset_ptr_ram += gd-reloc_off;
-   }
-   }
-   } while (re_src++  re_end);
-
-   return 0;
-}
-
 /* Load U-Boot into RAM, initialize BSS, perform relocation adjustments */
 void board_init_f(ulong boot_flags)
 {
@@ -270,17 +213,9 @@ void board_init_f_r(void)
if (init_cache() != 0)
hang();

-   copy_uboot_to_ram();
-   clear_bss();
-   do_elf_reloc_fixups();
-
-   /*
-* Transfer execution from Flash to RAM by calculating the address
-* of the in-RAM copy of board_init_r() and calling it
-*/
-   (board_init_r + gd-reloc_off)(gd, gd-relocaddr);
+   relocate_code(0, gd, 0);

-   /* NOTREACHED - board_init_r() does not return */
+   /* NOTREACHED - relocate_code() does not return */
while (1)
;
 }
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
new file mode 100644
index 000..badb5f8
--- /dev/null
+++ b/arch/x86/lib/relocate.c
@@ -0,0 +1,115 @@
+/*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, graeme.r...@gmail.com
+ *
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, dan...@omicron.se
+ *
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH www.elinos.com
+ * Marius Groeger mgroe...@sysgo.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
+ * 

[U-Boot] [PATCH v2 16/17] x86: Split init functions out of board.c

2012-01-04 Thread Graeme Russ
This patch moves towards reducing board.c to simply a set of init cores for
the three initialisation phases (Flash, Flash/RAM, and RAM), a set of three
init function arrays and a init function array processing function

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Changes patch title
 - Tweak commit message

 arch/x86/include/asm/init_helpers.h  |   39 +
 arch/x86/include/asm/init_wrappers.h |   42 +
 arch/x86/lib/Makefile|2 +
 arch/x86/lib/board.c |  297 +-
 arch/x86/lib/init_helpers.c  |  142 
 arch/x86/lib/init_wrappers.c |  137 
 6 files changed, 438 insertions(+), 221 deletions(-)
 create mode 100644 arch/x86/include/asm/init_helpers.h
 create mode 100644 arch/x86/include/asm/init_wrappers.h
 create mode 100644 arch/x86/lib/init_helpers.c
 create mode 100644 arch/x86/lib/init_wrappers.c

diff --git a/arch/x86/include/asm/init_helpers.h 
b/arch/x86/include/asm/init_helpers.h
new file mode 100644
index 000..14ef11a
--- /dev/null
+++ b/arch/x86/include/asm/init_helpers.h
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2011
+ * Graeme Russ, graeme.r...@gmail.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 _INIT_HELPERS_H_
+#define _INIT_HELPERS_H_
+
+int display_banner(void);
+int display_dram_config(void);
+int init_baudrate_f(void);
+
+int mem_malloc_init_r(void);
+int init_bd_struct_r(void);
+int flash_init_r(void);
+int init_ip_address_r(void);
+int status_led_set_r(void);
+int set_bootfile_r(void);
+int set_load_addr_r(void);
+
+#endif /* !_INIT_HELPERS_H_ */
diff --git a/arch/x86/include/asm/init_wrappers.h 
b/arch/x86/include/asm/init_wrappers.h
new file mode 100644
index 000..899ffb1
--- /dev/null
+++ b/arch/x86/include/asm/init_wrappers.h
@@ -0,0 +1,42 @@
+/*
+ * (C) Copyright 2011
+ * Graeme Russ, graeme.r...@gmail.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 _INIT_WRAPPERS_H_
+#define _INIT_WRAPPERS_H_
+
+int serial_initialize_r(void);
+int env_relocate_r(void);
+int pci_init_r(void);
+int jumptable_init_r(void);
+int pcmcia_init_r(void);
+int kgdb_init_r(void);
+int enable_interrupts_r(void);
+int eth_initialize_r(void);
+int reset_phy_r(void);
+int ide_init_r(void);
+int scsi_init_r(void);
+int doc_init_r(void);
+int bb_miiphy_init_r(void);
+int post_run_r(void);
+
+#endif /* !_INIT_WRAPPERS_H_ */
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 57b6896..51836da 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -34,6 +34,8 @@ COBJS-y   += board.o
 COBJS-y+= bootm.o
 COBJS-y+= cmd_boot.o
 COBJS-y+= gcc.o
+COBJS-y+= init_helpers.o
+COBJS-y+= init_wrappers.o
 COBJS-y+= interrupts.o
 COBJS-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o
 COBJS-$(CONFIG_SYS_GENERIC_TIMER) += pcat_timer.o
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index bebb347..89721c7 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -33,62 +33,12 @@

 #include common.h
 #include watchdog.h
-#include command.h
 #include stdio_dev.h
-#include version.h
-#include malloc.h
-#include net.h
-#include ide.h
-#include serial.h
 #include asm/u-boot-x86.h
 #include asm/processor.h

-#ifdef CONFIG_BITBANGMII
-#include miiphy.h
-#endif
-
-/
- * Init Utilities 

[U-Boot] [PATCH v2 17/17] x86: Convert board_init_f_r to a processing loop

2012-01-04 Thread Graeme Russ
Create an init function array for board_init_f_r - This finalises the
migration to a purely array based initialisation mechanism

Also tweak a few comments while we are at it so everything is 'correct'

Signed-off-by: Graeme Russ graeme.r...@gmail.com
---
Changes for v2:
 - Renamed to a more apt name
 - Fix bug in set_reloc_flag_r
 - Re-instate gd-flags = boot_flags; in board_init_f
 - Added commit message

 arch/x86/include/asm/init_helpers.h |5 +
 arch/x86/include/asm/relocate.h |   33 ++
 arch/x86/lib/board.c|  186 +--
 arch/x86/lib/init_helpers.c |   75 ++
 arch/x86/lib/relocate.c |   32 +-
 5 files changed, 206 insertions(+), 125 deletions(-)
 create mode 100644 arch/x86/include/asm/relocate.h

diff --git a/arch/x86/include/asm/init_helpers.h 
b/arch/x86/include/asm/init_helpers.h
index 14ef11a..192f18e 100644
--- a/arch/x86/include/asm/init_helpers.h
+++ b/arch/x86/include/asm/init_helpers.h
@@ -27,7 +27,12 @@
 int display_banner(void);
 int display_dram_config(void);
 int init_baudrate_f(void);
+int calculate_relocation_address(void);

+int copy_gd_to_ram_f_r(void);
+int init_cache_f_r(void);
+
+int set_reloc_flag_r(void);
 int mem_malloc_init_r(void);
 int init_bd_struct_r(void);
 int flash_init_r(void);
diff --git a/arch/x86/include/asm/relocate.h b/arch/x86/include/asm/relocate.h
new file mode 100644
index 000..33129ef
--- /dev/null
+++ b/arch/x86/include/asm/relocate.h
@@ -0,0 +1,33 @@
+/*
+ * (C) Copyright 2011
+ * Graeme Russ, graeme.r...@gmail.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 _RELOCATE_H_
+#define _RELOCATE_H_
+
+#include common.h
+
+int copy_uboot_to_ram(void);
+int clear_bss(void);
+int do_elf_reloc_fixups(void);
+
+#endif /* !_RELOCATE_H_ */
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 89721c7..5f0b62c 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -35,7 +35,7 @@
 #include watchdog.h
 #include stdio_dev.h
 #include asm/u-boot-x86.h
-#include asm/processor.h
+#include asm/relocate.h

 #include asm/init_helpers.h
 #include asm/init_wrappers.h
@@ -43,31 +43,58 @@
 /*
  * Breath some life into the board...
  *
- * Initialize an SMC for serial comms, and carry out some hardware
- * tests.
+ * Getting the board up and running is a three-stage process:
+ *  1) Execute from Flash, SDRAM Uninitialised
+ * At this point, there is a limited amount of non-SDRAM memory
+ * (typically the CPU cache, but can also be SRAM or even a buffer of
+ * of some peripheral). This limited memory is used to hold:
+ *  - The initial copy of the Global Data Structure
+ *  - A temporary stack
+ *  - A temporary x86 Global Descriptor Table
+ *  - The pre-console buffer (if enabled)
  *
- * The first part of initialization is running from Flash memory;
- * its main purpose is to initialize the RAM so that we
- * can relocate the monitor code to RAM.
+ * The following is performed during this phase of execution:
+ *  - Core low-level CPU initialisation
+ *  - Console initialisation
+ *  - SDRAM initialisation
+ *
+ *  2) Execute from Flash, SDRAM Initialised
+ * At this point we copy Global Data from the initial non-SDRAM
+ * memory and set up the permanent stack in SDRAM. The CPU cache is no
+ * longer being used as temporary memory, so we can now fully enable
+ * it.
+ *
+ * The following is performed during this phase of execution:
+ *  - Create final stack in SDRAM
+ *  - Copy Global Data from temporary memory to SDRAM
+ *  - Enabling of CPU cache(s),
+ *  - Copying of U-Boot code and data from Flash to RAM
+ *  - Clearing of the BSS
+ *  - ELF relocation adjustments
+ *
+ *  3) Execute from SDRAM
+ * The following is performed during this phase of execution:
+ *  - All remaining initialisation
  */

 /*
- * All attempts to come up with a common initialization sequence
- * that works for all boards and architectures failed: some of the
- * requirements are just _too_ different. To get rid of the resulting
- * mess of board dependend #ifdef'ed code we now make the whole
- * initialization sequence 

Re: [U-Boot] [PATCH v2 02/17] x86: Speed up copy-to-RAM and clear BSS operations

2012-01-04 Thread Graeme Russ
Oops, after painstakingly setting In-Reply-To: I've gone and left
git-send-email chain-reply on :(

Sorry 'bout that

Regards,

Graeme

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] M28 U-Boot config

2012-01-04 Thread Marek Vasut
 Hi Marek,

Hello, please _ALWAYS_ CC the u-boot mailing list.
 
 in include/configs/m28evk.h:88 you define the U-Boot stack size:
 #define   CONFIG_STACKSIZE0x0001  /* 128 KB stack 
*/
 However, the actual size doesn't match the commented size.
 Did you mean this:
 #define   CONFIG_STACKSIZE0x0001  /* 64 KiB stack 
*/
 Or did you mean this:
 #define   CONFIG_STACKSIZE0x0002  /* 128 KiB 
 stack 
*/
 ?

This might be an issue. 128k stack is OK.

M

 
 Freescale used the latter.
 
 Cheers,
 
Robert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] mtd/nand: Fix IFC driver to support 2K NAND page

2012-01-04 Thread Scott Wood
On 12/27/2011 11:23 PM, Prabhakar Kushwaha wrote:
 1) OOB area should be updated irrespective of NAND page size. Earlier it was
 updated only for 512byte NAND page.
  
 2) During OOB update fbcr should be equal to OOB size.
 
 Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
 Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com

Same changes requested as in http://patchwork.ozlabs.org/patch/133501/

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] mtd/nand:Fix wrong address read in is_blank()

2012-01-04 Thread Scott Wood
On 12/27/2011 11:22 PM, Prabhakar Kushwaha wrote:
 IFC NAND Machine calculates ECC on 512byte sector. Same is taken care in 
 fsl_ifc_run_command() while ECC status verification. Here buffer number is 
 calculated assuming 512byte sector and same is passed to is_blank.
 However in is_blank() buffer address is calculated using mdt-writesize which 
 is
 wrong. It should be calculated on basis of ecc sector size.
 
 Also, in fsl_ifc_run_command() bufferpage is calculated on the basis of ecc 
 sector 
 size instead of hard coded value.
 
 Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
 Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
 ---

Same changes requested as in http://patchwork.ozlabs.org/patch/133500/

Also, please mention IFC in the subject.

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] add nand spl boot for qi_lb60 board

2012-01-04 Thread Scott Wood
On 01/01/2012 05:31 AM, Xiangfu Liu wrote:
 Hi Scott Wood
 
 this is the patch I try to add nand spl boot for qi_lb60 board
 
 this patch works fine under qi_lb60(ben nanonote) but there are three
 'extern' lines under: nand_spl/board/qi/qi_lb60/nand_spl.c
 
 those 'extern' lines already in jz4740.h, my question is when I remove
 those three lines under nand_spl/board/qi/qi_lb60/nand_spl.c, it will
 make u-boot-nand.bin break. can't boot the device anymore.

Are you *sure* that's the only difference between the working and
non-working versions?  Could you double-check?

By can't boot, you mean that it builds cleanly (no errors or
warnings), but nothing happens after power on?

 Please give me some advice how to debug the error.

JTAG?  Serial output?

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] add nand spl boot for qi_lb60 board

2012-01-04 Thread Scott Wood
On 01/04/2012 04:01 PM, Scott Wood wrote:
 On 01/01/2012 05:31 AM, Xiangfu Liu wrote:
 Hi Scott Wood

 this is the patch I try to add nand spl boot for qi_lb60 board

 this patch works fine under qi_lb60(ben nanonote) but there are three
 'extern' lines under: nand_spl/board/qi/qi_lb60/nand_spl.c

 those 'extern' lines already in jz4740.h, my question is when I remove
 those three lines under nand_spl/board/qi/qi_lb60/nand_spl.c, it will
 make u-boot-nand.bin break. can't boot the device anymore.
 
 Are you *sure* that's the only difference between the working and
 non-working versions?  Could you double-check?
 
 By can't boot, you mean that it builds cleanly (no errors or
 warnings), but nothing happens after power on?
 
 Please give me some advice how to debug the error.
 
 JTAG?  Serial output?

Or compare the resulting binaries, see what's actually changed.

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] mpc8313erdb: fix mtdparts address

2012-01-04 Thread Scott Wood
Fix a copy-and-paste error when adapting mpc8315erdb mtdparts
to mpc8313erdb.  mtdids was already using the proper address
on mpc8313erdb.

Signed-off-by: Scott Wood scottw...@freescale.com
---
 include/configs/MPC8313ERDB.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB.h
index 31503af..5fc83bb 100644
--- a/include/configs/MPC8313ERDB.h
+++ b/include/configs/MPC8313ERDB.h
@@ -266,7 +266,7 @@
 #define CONFIG_CMD_MTDPARTS
 #define MTDIDS_DEFAULT nand0=e280.flash
 #define MTDPARTS_DEFAULT   \
-   mtdparts=e060.flash:512k(uboot),128k(env),3m@1m(kernel),-(fs)
+   mtdparts=e280.flash:512k(uboot),128k(env),3m@1m(kernel),-(fs)
 
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
 #define CONFIG_MTD_NAND_VERIFY_WRITE
-- 
1.7.7.rc3.4.g8d714

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] NAND: Allow nand_ids and nand_bbt to be compiled in SPL

2012-01-04 Thread Scott Wood
On 12/05/2011 05:17 PM, Marek Vasut wrote:
 This will be beneficial for the PXA3XX NAND driver, which uses the NAND IDs to
 identify the chip and configure the controller accordingly.
 
 Signed-off-by: Marek Vasut marek.va...@gmail.com
 Cc: Scott Wood scottw...@freescale.com
 ---
  drivers/mtd/nand/Makefile |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index a63c0e4..46e79e3 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -35,10 +35,10 @@ COBJS-y   += nand_spl_load.o
  endif
  else
  COBJS-y += nand.o
 -COBJS-y += nand_bbt.o
 -COBJS-y += nand_ids.o
  COBJS-y += nand_util.o
  endif
 +COBJS-y += nand_bbt.o
 +COBJS-y += nand_ids.o
  COBJS-y += nand_ecc.o
  COBJS-y += nand_base.o
  

So, in theory with gc-sections this shouldn't increase the size of any
SPL that currently successfully links (at least in the absence of things
like weak symbols).  However, I observed a devkit8000 build go from this:

   textdata bss dec hex filename
  407091792  197764  240265   3aa89 /tmp/u-boot-arm/spl/u-boot-spl

to this:

   textdata bss dec hex filename
  422771792  197764  241833   3b0a9 /tmp/u-boot-arm/spl/u-boot-spl

I verified that --function-sections/-fdata-sections/--gc-sections are
being used on the SPL.  It looks like strings are not getting dropped.

If there's no way to fix this, this is going to be a big problem for the
existing users of nand_spl to migrate to the new SPL model, unless the
notion of include a bunch of stuff and let gc-sections take care of it
is dropped.

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] add nand spl boot for qi_lb60 board

2012-01-04 Thread Xiangfu Liu

Hi

yes. I have cpmpared this. but I can't find where is the problem.
attachment is the u-boot.map diff.

after remove those 'extern' the u-boot-nand-spl is exact same. binary file. map 
file both same.
but the u-boot.bin/map changed.

Please help me take a look.

thanks Scott.
xiangfu

On 01/05/2012 06:12 AM, Scott Wood wrote:

Or compare the resulting binaries, see what's actually changed.

-Scott


--- YES/u-boot.map	2012-01-01 20:41:57.020058001 +0800
+++ NO/u-boot.map	2012-01-01 20:41:13.068058002 +0800
@@ -1058,7 +1058,7 @@
 0x80118b20__ashrdi3
 0x80118b60. = ALIGN (0x4)
 
-.rodata 0x80118b60 0x5550
+.rodata 0x80118b60 0x5558
  *(SORT(.rodata*))
  .rodata0x80118b60   0xd0 common/libcommon.o
  .rodata0x80118c30   0x20 lib/libgeneric.o
@@ -1157,102 +1157,102 @@
  .rodata.tab_seq
 0x8011e04c0xc common/libcommon.o
  .rodata.version_string
-0x8011e058   0x38 common/libcommon.o
+0x8011e058   0x40 common/libcommon.o
 0x8011e058version_string
  .rodata.xyzModem_error
-0x8011e090   0x20 common/libcommon.o
+0x8011e098   0x20 common/libcommon.o
 
-.rel.dyn0x8011e0b00x0
+.rel.dyn0x8011e0b80x0
  .rel.dyn   0x0x0 arch/mips/cpu/xburst/start.o
-0x8011e0b0. = ALIGN (0x4)
+0x8011e0b8. = ALIGN (0x4)
 
-.data   0x8011e0b0 0x1978
+.data   0x8011e0b8 0x1978
  *(.data*)
- .data.uart 0x8011e0b00x4 arch/mips/cpu/xburst/libxburst.o
-0x8011e0b0uart
+ .data.uart 0x8011e0b80x4 arch/mips/cpu/xburst/libxburst.o
+0x8011e0b8uart
  .data.rel.init_sequence
-0x8011e0b4   0x28 arch/mips/lib/libmips.o
-0x8011e0b4init_sequence
+0x8011e0bc   0x28 arch/mips/lib/libmips.o
+0x8011e0bcinit_sequence
  .data.rel.boot_os
-0x8011e0dc   0x4c common/libcommon.o
+0x8011e0e4   0x4c common/libcommon.o
  .data.rel.local.cmd_bootm_sub
-0x8011e128   0x90 common/libcommon.o
- .data.do_echo  0x8011e1b80x4 common/libcommon.o
+0x8011e130   0x90 common/libcommon.o
+ .data.do_echo  0x8011e1c00x4 common/libcommon.o
  .data.dp_last_length
-0x8011e1bc0x4 common/libcommon.o
+0x8011e1c40x4 common/libcommon.o
  .data.load_addr
-0x8011e1c00x4 common/libcommon.o
-0x8011e1c0load_addr
+0x8011e1c80x4 common/libcommon.o
+0x8011e1c8load_addr
  .data.rel.cmd_env_sub
-0x8011e1c4   0xc0 common/libcommon.o
- .data.env_id   0x8011e2840x4 common/libcommon.o
+0x8011e1cc   0xc0 common/libcommon.o
+ .data.env_id   0x8011e28c0x4 common/libcommon.o
  .data.trim_threshold
-0x8011e2880x4 common/libcommon.o
+0x8011e2900x4 common/libcommon.o
  .data.rel.local.av_
-0x8011e28c  0x408 common/libcommon.o
+0x8011e294  0x408 common/libcommon.o
  .data.sbrk_base
-0x8011e6940x4 common/libcommon.o
+0x8011e69c0x4 common/libcommon.o
  .data.rel.local.env_name_spec
-0x8011e6980x4 common/libcommon.o
-0x8011e698env_name_spec
+0x8011e6a00x4 common/libcommon.o
+0x8011e6a0env_name_spec
  .data.rel.ro.local.uimage_comp
-0x8011e69c   0x48 common/libcommon.o
+0x8011e6a4   0x48 common/libcommon.o
  .data.rel.ro.local.uimage_type
-0x8011e6e4   0xc0 common/libcommon.o
+0x8011e6ec   0xc0 common/libcommon.o
  .data.rel.ro.local.uimage_arch
-0x8011e7a4   0xf0 common/libcommon.o
+0x8011e7ac   0xf0 common/libcommon.o
  .data.rel.ro.local.uimage_os
-0x8011e894   0x54 common/libcommon.o
+0x8011e89c   0x54 common/libcommon.o
  .data.rel.local.stdio_names
- 

[U-Boot] [PATCH v3 0/7] overo: add SPL support

2012-01-04 Thread Andreas Müller
V1 - V2
* cleanups: replace printf with one argument by puts [1-2]
* cleanups: remove unused macros and macro values / tabbing / remove FSF 
address [3]
* i2c: move all local variables to SRAM [4]
* OMAP SPL: call timer_init in s_init to make udelay work earlier [5]
* hint CONFIG_SYS_TEXT_BASE changed in commit message [6]
* remove log 'Texas Instruments Revision detection unimplemented' for overo [6]
* remove unintended whitespaces [6]
* send 'shut up' to TWL4030 to avoid corruption when reading board revision [6]
* use macros for overo revisions [6]
* don't separate SPL specific configurations [6]

V2 - V3
* modify omap_rev_string [6]
* CONFIG_SYS_TEXT_BASE back to 0x80008000 [7]
* modify CONFIG_SYS_SPL_MALLOC_START / CONFIG_SYS_SPL_MALLOC_SIZE / 
  CONFIG_SPL_BSS_START_ADDR to avoid conflicts with CONFIG_SYS_TEXT_BASE [7]

Andreas Müller (7):
  drivers/i2c/omap24xx_i2c.c: replace printf with one argument by puts
  board/overo/overo.c: replace printf with one argument by puts
  include/configs/omap3_overo.h: several cleanups
  drivers/i2c/omap24xx_i2c.c: move all local variables to SRAM
  OMAP SPL: call timer_init in s_init to make udelay work earlier
  omap_rev_string: output to stdout
  overo: add SPL support

 arch/arm/cpu/armv7/omap-common/hwinit-common.c |   10 +-
 arch/arm/cpu/armv7/omap-common/spl.c   |   12 +--
 arch/arm/cpu/armv7/omap3/board.c   |2 +
 arch/arm/include/asm/arch-omap3/mem.h  |   26 +
 arch/arm/include/asm/arch-omap4/sys_proto.h|2 +-
 arch/arm/include/asm/arch-omap5/sys_proto.h|2 +-
 arch/arm/include/asm/omap_common.h |2 +-
 board/overo/config.mk  |   28 --
 board/overo/overo.c|   79 ++--
 board/overo/overo.h|9 ++
 drivers/i2c/omap24xx_i2c.c |   25 +++--
 include/configs/omap3_overo.h  |  121 
 12 files changed, 217 insertions(+), 101 deletions(-)
 delete mode 100644 board/overo/config.mk

-- 
1.7.4.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 1/7] drivers/i2c/omap24xx_i2c.c: replace printf with one argument by puts

2012-01-04 Thread Andreas Müller
Signed-off-by: Andreas Müller schnitzelt...@gmx.de
---
 drivers/i2c/omap24xx_i2c.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index 4ae237a..271ed60 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -73,7 +73,7 @@ void i2c_init(int speed, int slaveadd)
fssclh -= I2C_HIGHSPEED_PHASE_ONE_SCLH_TRIM;
if (((fsscll  0) || (fssclh  0)) ||
((fsscll  255) || (fssclh  255))) {
-   printf(Error : I2C initializing first phase clock\n);
+   puts(Error : I2C initializing first phase clock\n);
return;
}
 
@@ -84,7 +84,7 @@ void i2c_init(int speed, int slaveadd)
hssclh -= I2C_HIGHSPEED_PHASE_TWO_SCLH_TRIM;
if (((fsscll  0) || (fssclh  0)) ||
((fsscll  255) || (fssclh  255))) {
-   printf(Error : I2C initializing second phase clock\n);
+   puts(Error : I2C initializing second phase clock\n);
return;
}
 
@@ -99,7 +99,7 @@ void i2c_init(int speed, int slaveadd)
fssclh -= I2C_FASTSPEED_SCLH_TRIM;
if (((fsscll  0) || (fssclh  0)) ||
((fsscll  255) || (fssclh  255))) {
-   printf(Error : I2C initializing clock\n);
+   puts(Error : I2C initializing clock\n);
return;
}
 
@@ -118,7 +118,7 @@ void i2c_init(int speed, int slaveadd)
writew(I2C_CON_EN, i2c_base-con);
while (!(readw(i2c_base-syss)  I2C_SYSS_RDONE)  timeout--) {
if (timeout = 0) {
-   printf(ERROR: Timeout in soft-reset\n);
+   puts(ERROR: Timeout in soft-reset\n);
return;
}
udelay(1000);
@@ -284,13 +284,13 @@ int i2c_read(uchar chip, uint addr, int alen, uchar 
*buffer, int len)
}
 
if (addr + len  256) {
-   printf(I2C read: address out of range\n);
+   puts(I2C read: address out of range\n);
return 1;
}
 
for (i = 0; i  len; i++) {
if (i2c_read_byte(chip, addr + i, buffer[i])) {
-   printf(I2C read: I/O error\n);
+   puts(I2C read: I/O error\n);
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
return 1;
}
-- 
1.7.4.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 3/7] include/configs/omap3_overo.h: several cleanups

2012-01-04 Thread Andreas Müller
* remove unused macros
* remove unused macro values
* align tabs
* remove Free Software Foundation address

Signed-off-by: Andreas Müller schnitzelt...@gmx.de
---
 include/configs/omap3_overo.h |   69 ++--
 1 files changed, 31 insertions(+), 38 deletions(-)

diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index 79eb466..8f2e69d 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -13,8 +13,7 @@
  *
  * 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
+ * Foundation, Inc.
  */
 
 #ifndef __CONFIG_H
@@ -23,41 +22,41 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP1   /* in a TI OMAP core */
-#define CONFIG_OMAP34XX1   /* which is a 34XX */
-#define CONFIG_OMAP3_OVERO 1   /* working with overo */
+#define CONFIG_OMAP/* in a TI OMAP core */
+#define CONFIG_OMAP34XX/* which is a 34XX */
+#define CONFIG_OMAP3_OVERO /* working with overo */
 
-#define CONFIG_SDRC/* The chip has SDRC controller */
+#define CONFIG_SDRC/* The chip has SDRC controller 
*/
 
-#include asm/arch/cpu.h  /* get chip and board defs */
+#include asm/arch/cpu.h  /* get chip and board defs */
 #include asm/arch/omap3.h
 
 /*
  * Display CPU and Board information
  */
-#define CONFIG_DISPLAY_CPUINFO 1
-#define CONFIG_DISPLAY_BOARDINFO   1
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
 
 /* Clock Defines */
 #define V_OSCK 2600/* Clock output from T2 */
 #define V_SCLK (V_OSCK  1)
 
-#undef CONFIG_USE_IRQ  /* no support for IRQs */
+#undef CONFIG_USE_IRQ  /* no support for IRQs */
 #define CONFIG_MISC_INIT_R
 
-#define CONFIG_CMDLINE_TAG 1   /* enable passing of ATAGs */
-#define CONFIG_SETUP_MEMORY_TAGS   1
-#define CONFIG_INITRD_TAG  1
-#define CONFIG_REVISION_TAG1
+#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
 
-#define CONFIG_OF_LIBFDT   1
+#define CONFIG_OF_LIBFDT
 
 /*
  * Size of malloc() pool
  */
-#define CONFIG_ENV_SIZE(128  10) /* 128 KiB */
+#define CONFIG_ENV_SIZE(128  10) /* 128 KiB */
/* Sector */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (128  10))
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (128  10))
 
 /*
  * Hardware drivers
@@ -66,7 +65,7 @@
 /*
  * NS16550 Configuration
  */
-#define V_NS16550_CLK  4800/* 48MHz (APLL96/2) */
+#define V_NS16550_CLK  4800/* 48MHz (APLL96/2) */
 
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
@@ -85,13 +84,10 @@
 #define CONFIG_BAUDRATE115200
 #define CONFIG_SYS_BAUDRATE_TABLE  {4800, 9600, 19200, 38400, 57600, \
115200}
-#define CONFIG_GENERIC_MMC 1
-#define CONFIG_MMC 1
-#define CONFIG_OMAP_HSMMC  1
-#define CONFIG_DOS_PARTITION   1
-
-/* DDR - I use Micron DDR */
-#define CONFIG_OMAP3_MICRON_DDR1
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC
+#define CONFIG_OMAP_HSMMC
+#define CONFIG_DOS_PARTITION
 
 /* commands to include */
 #include config_cmd_default.h
@@ -113,31 +109,29 @@
 #define CONFIG_CMD_NET /* bootp, tftpboot, rarpboot*/
 
 #define CONFIG_SYS_NO_FLASH
-#define CONFIG_HARD_I2C1
+#define CONFIG_HARD_I2C
 #define CONFIG_SYS_I2C_SPEED   10
 #define CONFIG_SYS_I2C_SLAVE   1
-#define CONFIG_SYS_I2C_BUS 0
-#define CONFIG_SYS_I2C_BUS_SELECT  1
-#define CONFIG_I2C_MULTI_BUS   1
-#define CONFIG_DRIVER_OMAP34XX_I2C 1
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_DRIVER_OMAP34XX_I2C
 
 /*
  * TWL4030
  */
-#define CONFIG_TWL4030_POWER   1
-#define CONFIG_TWL4030_LED 1
+#define CONFIG_TWL4030_POWER
+#define CONFIG_TWL4030_LED
 
 /*
  * Board NAND Info.
  */
-#define CONFIG_SYS_NAND_QUIET_TEST 1
+#define CONFIG_SYS_NAND_QUIET_TEST
 #define CONFIG_NAND_OMAP_GPMC
 #define CONFIG_SYS_NAND_ADDR   NAND_BASE   /* physical address */
/* to access nand */
 #define CONFIG_SYS_NAND_BASE   NAND_BASE   /* physical address */
/* to access nand */
/* at CS0 */
-#define 

[U-Boot] [PATCH v3 2/7] board/overo/overo.c: replace printf with one argument by puts

2012-01-04 Thread Andreas Müller
Signed-off-by: Andreas Müller schnitzelt...@gmx.de
---
 board/overo/overo.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/board/overo/overo.c b/board/overo/overo.c
index 3c60b06..4a20c7f 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -119,7 +119,7 @@ int get_board_revision(void)
   gpio_get_value(113)  1 |
   gpio_get_value(112);
} else {
-   printf(Error: unable to acquire board revision GPIOs\n);
+   puts(Error: unable to acquire board revision GPIOs\n);
revision = -1;
}
 
@@ -151,7 +151,7 @@ int get_sdio2_config(void)
 
gpio_direction_input(130);
} else {
-   printf(Error: unable to acquire sdio2 clk GPIOs\n);
+   puts(Error: unable to acquire sdio2 clk GPIOs\n);
sdio_direct = -1;
}
 
@@ -200,15 +200,15 @@ int misc_init_r(void)
 
switch (get_sdio2_config()) {
case 0:
-   printf(Tranceiver detected on mmc2\n);
+   puts(Tranceiver detected on mmc2\n);
MUX_OVERO_SDIO2_TRANSCEIVER();
break;
case 1:
-   printf(Direct connection on mmc2\n);
+   puts(Direct connection on mmc2\n);
MUX_OVERO_SDIO2_DIRECT();
break;
default:
-   printf(Unable to detect mmc2 connection type\n);
+   puts(Unable to detect mmc2 connection type\n);
}
 
switch (get_expansion_id()) {
@@ -269,10 +269,10 @@ int misc_init_r(void)
setenv(defaultdisplay, dvi);
break;
case GUMSTIX_NO_EEPROM:
-   printf(No EEPROM on expansion board\n);
+   puts(No EEPROM on expansion board\n);
break;
default:
-   printf(Unrecognized expansion board\n);
+   puts(Unrecognized expansion board\n);
}
 
if (expansion_config.content == 1)
-- 
1.7.4.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 4/7] drivers/i2c/omap24xx_i2c.c: move all local variables to SRAM

2012-01-04 Thread Andreas Müller
At old overo boards TWL4030 RTC irq is connected to gpio112. Unfortunately
this pin is also used for revision detection. Therefore we need to send
shut-up to TWL4030 to avoid reading wrong revision. In SPL this must
be done before SDRAM is set up because the type of SDRAM is revision dependent.
By this patch it is ensured that all variables used by omap24xx_i2c.c are
located in SRAM.

Signed-off-by: Andreas Müller schnitzelt...@gmx.de
---
 drivers/i2c/omap24xx_i2c.c |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index 271ed60..44290b4 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -35,10 +35,15 @@ static void wait_for_bb(void);
 static u16 wait_for_pin(void);
 static void flush_fifo(void);
 
-static struct i2c *i2c_base = (struct i2c *)I2C_DEFAULT_BASE;
-
-static unsigned int bus_initialized[I2C_BUS_MAX];
-static unsigned int current_bus;
+/*
+ * For SPL boot some boards need i2c before SDRAM is initialised so force
+ * variables to live in SRAM
+ */
+static struct i2c __attribute__ ((section (.data))) *i2c_base =
+   (struct i2c *)I2C_DEFAULT_BASE;
+static unsigned int __attribute__ ((section (.data))) 
bus_initialized[I2C_BUS_MAX] =
+   { [0 ... (I2C_BUS_MAX-1)] = 0 };
+static unsigned int __attribute__ ((section (.data))) current_bus = 0;
 
 void i2c_init(int speed, int slaveadd)
 {
-- 
1.7.4.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 5/7] OMAP SPL: call timer_init in s_init to make udelay work earlier

2012-01-04 Thread Andreas Müller
Signed-off-by: Andreas Müller schnitzelt...@gmx.de
---
 arch/arm/cpu/armv7/omap-common/spl.c |2 --
 arch/arm/cpu/armv7/omap3/board.c |2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/spl.c 
b/arch/arm/cpu/armv7/omap-common/spl.c
index 9c35a09..74fea4f 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -115,8 +115,6 @@ void board_init_r(gd_t *id, ulong dummy)
mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
CONFIG_SYS_SPL_MALLOC_SIZE);
 
-   timer_init();
-
 #ifdef CONFIG_SPL_BOARD_INIT
spl_board_init();
 #endif
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 1f33c63..871aa37 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -230,6 +230,8 @@ void s_init(void)
 
 #ifdef CONFIG_SPL_BUILD
preloader_console_init();
+
+   timer_init();
 #endif
 
if (!in_sdram)
-- 
1.7.4.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 6/7] omap_rev_string: output to stdout

2012-01-04 Thread Andreas Müller
* avoid potential buffer overflows
* allow SPL-build not to output Texas Instruments Revision detection 
unimplemented

Signed-off-by: Andreas Müller schnitzelt...@gmx.de
---
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |   10 --
 arch/arm/cpu/armv7/omap-common/spl.c   |   10 --
 arch/arm/include/asm/arch-omap4/sys_proto.h|2 +-
 arch/arm/include/asm/arch-omap5/sys_proto.h|2 +-
 arch/arm/include/asm/omap_common.h |2 +-
 5 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c 
b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
index f65705d..90ec44d 100644
--- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
@@ -104,14 +104,14 @@ u32 cortex_rev(void)
return rev;
 }
 
-void omap_rev_string(char *omap_rev_string)
+void omap_rev_string()
 {
u32 omap_rev = omap_revision();
u32 omap_variant = (omap_rev  0x)  16;
u32 major_rev = (omap_rev  0x0F00)  8;
u32 minor_rev = (omap_rev  0x00F0)  4;
 
-   sprintf(omap_rev_string, OMAP%x ES%x.%x, omap_variant, major_rev,
+   printf(OMAP%x ES%x.%x\n, omap_variant, major_rev,
minor_rev);
 }
 
@@ -251,10 +251,8 @@ u32 get_device_type(void)
  */
 int print_cpuinfo(void)
 {
-   char rev_string_buffer[50];
-
-   omap_rev_string(rev_string_buffer);
-   printf(CPU  : %s\n, rev_string_buffer);
+   puts(CPU  : );
+   omap_rev_string();
 
return 0;
 }
diff --git a/arch/arm/cpu/armv7/omap-common/spl.c 
b/arch/arm/cpu/armv7/omap-common/spl.c
index 74fea4f..fdce2dc 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -154,7 +154,6 @@ void board_init_r(gd_t *id, ulong dummy)
 void preloader_console_init(void)
 {
const char *u_boot_rev = U_BOOT_VERSION;
-   char rev_string_buffer[50];
 
gd = gdata;
gd-bd = bdata;
@@ -170,14 +169,13 @@ void preloader_console_init(void)
 
printf(\nU-Boot SPL %s (%s - %s)\n, u_boot_rev, U_BOOT_DATE,
U_BOOT_TIME);
-   omap_rev_string(rev_string_buffer);
-   printf(Texas Instruments %s\n, rev_string_buffer);
+   omap_rev_string();
 }
 
-void __omap_rev_string(char *str)
+void __omap_rev_string()
 {
-   sprintf(str, Revision detection unimplemented);
+   printf(Texas Instruments Revision detection unimplemented\n);
 }
 
-void omap_rev_string(char *str)
+void omap_rev_string()
__attribute__((weak, alias(__omap_rev_string)));
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h 
b/arch/arm/include/asm/arch-omap4/sys_proto.h
index 4146e21..7386adf 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -42,7 +42,7 @@ void sr32(void *, u32, u32, u32);
 u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
 void set_pl310_ctrl_reg(u32 val);
-void omap_rev_string(char *omap_rev_string);
+void omap_rev_string();
 void setup_clocks_for_console(void);
 void prcm_init(void);
 void bypass_dpll(u32 *const base);
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h 
b/arch/arm/include/asm/arch-omap5/sys_proto.h
index c31e18c..fd1ba39 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -42,7 +42,7 @@ void set_muxconf_regs_non_essential(void);
 void sr32(void *, u32, u32, u32);
 u32 wait_on_value(u32, u32, void *, u32);
 void sdelay(unsigned long);
-void omap_rev_string(char *omap_rev_string);
+void omap_rev_string();
 void setup_clocks_for_console(void);
 void prcm_init(void);
 void bypass_dpll(u32 *const base);
diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index 1ec651b..7e92ef2 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -86,7 +86,7 @@ u32 omap_boot_mode(void);
 
 /* SPL common function s*/
 void spl_parse_image_header(const struct image_header *header);
-void omap_rev_string(char *omap_rev_string);
+void omap_rev_string();
 
 /* NAND SPL functions */
 void spl_nand_load_image(void);
-- 
1.7.4.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 7/7] overo: add SPL support

2012-01-04 Thread Andreas Müller
* implementation based on ti beagleboard/omap3evm
* timing data and i2c workaround for revision 0 boards taken from x-loader
* run-tested with overo revision 0 and 1 / boot from NAND and SDcard
* run-tested with x-loader

Signed-off-by: Andreas Müller schnitzelt...@gmx.de
---
 arch/arm/include/asm/arch-omap3/mem.h |   26 +
 board/overo/config.mk |   28 --
 board/overo/overo.c   |   65 -
 board/overo/overo.h   |9 +
 include/configs/omap3_overo.h |   52 ++
 5 files changed, 151 insertions(+), 29 deletions(-)
 delete mode 100644 board/overo/config.mk

diff --git a/arch/arm/include/asm/arch-omap3/mem.h 
b/arch/arm/include/asm/arch-omap3/mem.h
index 5fd02d4..4ca929e 100644
--- a/arch/arm/include/asm/arch-omap3/mem.h
+++ b/arch/arm/include/asm/arch-omap3/mem.h
@@ -123,6 +123,32 @@ enum {
V_MCFG_BANKALLOCATION_RBC | \
V_MCFG_B32NOT16_32 | V_MCFG_DEEPPD_EN | V_MCFG_RAMTYPE_DDR
 
+/* Hynix part of Overo (165MHz optimized) 6.06ns */
+#define HYNIX_TDAL_165   6
+#define HYNIX_TDPL_165   3
+#define HYNIX_TRRD_165   2
+#define HYNIX_TRCD_165   3
+#define HYNIX_TRP_1653
+#define HYNIX_TRAS_165   7
+#define HYNIX_TRC_165   10
+#define HYNIX_TRFC_165  21
+#define HYNIX_V_ACTIMA_165 \
+   ACTIM_CTRLA(HYNIX_TRFC_165, HYNIX_TRC_165,  \
+   HYNIX_TRAS_165, HYNIX_TRP_165,  \
+   HYNIX_TRCD_165, HYNIX_TRRD_165, \
+   HYNIX_TDPL_165, HYNIX_TDAL_165)
+
+#define HYNIX_TWTR_165   1
+#define HYNIX_TCKE_165   1
+#define HYNIX_TXP_1652
+#define HYNIX_XSR_16524
+#define HYNIX_V_ACTIMB_165 \
+   ACTIM_CTRLB(HYNIX_TWTR_165, HYNIX_TCKE_165, \
+   HYNIX_TXP_165, HYNIX_XSR_165)
+
+#define HYNIX_RASWIDTH_165 0x2
+#define HYNIX_V_MCFG_165(size) MCFG((size), HYNIX_RASWIDTH_165)
+
 /* Hynix part of AM/DM37xEVM (200MHz optimized) */
 #define HYNIX_TDAL_200 6
 #define HYNIX_TDPL_200 3
diff --git a/board/overo/config.mk b/board/overo/config.mk
deleted file mode 100644
index e7c471c..000
--- a/board/overo/config.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Overo uses OMAP3 (ARM-CortexA8) cpu
-#
-# 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
-#
-# Physical Address:
-# 8000' (bank0)
-# A000/ (bank1)
-# Linux-Kernel is expected to be at 8000'8000, entry 8000'8000
-# (mem base + reserved)
-
-CONFIG_SYS_TEXT_BASE = 0x80008000
diff --git a/board/overo/overo.c b/board/overo/overo.c
index 4a20c7f..2534e47 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -31,6 +31,7 @@
 #include common.h
 #include netdev.h
 #include twl4030.h
+#include linux/mtd/nand.h
 #include asm/io.h
 #include asm/arch/mmc_host_def.h
 #include asm/arch/mux.h
@@ -100,6 +101,16 @@ int board_init(void)
 }
 
 /*
+ * Routine: omap_rev_string
+ * Description: For SPL builds output board rev
+ */
+#ifdef CONFIG_SPL_BUILD
+void omap_rev_string()
+{
+}
+#endif
+
+/*
  * Routine: get_board_revision
  * Description: Returns the board revision
  */
@@ -107,6 +118,20 @@ int get_board_revision(void)
 {
int revision;
 
+#ifdef CONFIG_DRIVER_OMAP34XX_I2C
+   unsigned char data;
+
+   /* board revisions = R2410 connect 4030 irq_1 to gpio112 */
+   /* these boards should return a revision number of 0  */
+   /* the code below forces a 4030 RTC irq to ensure that gpio112 is low */
+   i2c_set_bus_num(TWL4030_I2C_BUS);
+   data = 0x01;
+   i2c_write(0x4B, 0x29, 1, data, 1);
+   data = 0x0c;
+   i2c_write(0x4B, 0x2b, 1, data, 1);
+   i2c_read(0x4B, 0x2a, 1, data, 1);
+#endif
+
if (!gpio_request(112, ) 
!gpio_request(113, ) 
!gpio_request(115, )) {
@@ -126,6 +151,44 @@ int get_board_revision(void)
return revision;
 }
 
+#ifdef CONFIG_SPL_BUILD
+/*
+ * Routine: get_board_mem_timings
+ * Description: If we use SPL then there is no x-loader nor config header
+ * so we have to setup the DDR timings ourself on both banks.
+ */
+void get_board_mem_timings(u32 *mcfg, u32 

Re: [U-Boot] [PATCH] NAND: Allow nand_ids and nand_bbt to be compiled in SPL

2012-01-04 Thread Tom Rini
On Wed, Jan 4, 2012 at 4:56 PM, Scott Wood scottw...@freescale.com wrote:
 On 12/05/2011 05:17 PM, Marek Vasut wrote:
 This will be beneficial for the PXA3XX NAND driver, which uses the NAND IDs 
 to
 identify the chip and configure the controller accordingly.

 Signed-off-by: Marek Vasut marek.va...@gmail.com
 Cc: Scott Wood scottw...@freescale.com
 ---
  drivers/mtd/nand/Makefile |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index a63c0e4..46e79e3 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -35,10 +35,10 @@ COBJS-y   += nand_spl_load.o
  endif
  else
  COBJS-y += nand.o
 -COBJS-y += nand_bbt.o
 -COBJS-y += nand_ids.o
  COBJS-y += nand_util.o
  endif
 +COBJS-y += nand_bbt.o
 +COBJS-y += nand_ids.o
  COBJS-y += nand_ecc.o
  COBJS-y += nand_base.o


 So, in theory with gc-sections this shouldn't increase the size of any
 SPL that currently successfully links (at least in the absence of things
 like weak symbols).  However, I observed a devkit8000 build go from this:

   text    data     bss     dec     hex filename
  40709    1792  197764  240265   3aa89 /tmp/u-boot-arm/spl/u-boot-spl

 to this:

   text    data     bss     dec     hex filename
  42277    1792  197764  241833   3b0a9 /tmp/u-boot-arm/spl/u-boot-spl

 I verified that --function-sections/-fdata-sections/--gc-sections are
 being used on the SPL.  It looks like strings are not getting dropped.

 If there's no way to fix this, this is going to be a big problem for the
 existing users of nand_spl to migrate to the new SPL model, unless the
 notion of include a bunch of stuff and let gc-sections take care of it
 is dropped.

I'll confirm gc-sections/etc are not as awesome as we think.  You can
drop the size of current SPL builds (for say devkit8000) by taking
things that should be dropped for us and forcing them out with #ifndef
CONFIG_SPL_BUILD.

-- 
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/6] EEYNOS: Add SMDK5250 board support

2012-01-04 Thread Chander Kashyap
Dear Minkyu Kang,

On 27 December 2011 14:18, Chander Kashyap chander.kash...@linaro.org wrote:
 Dear minkyu Kang

 On 23 December 2011 11:21, Chander Kashyap chander.kash...@linaro.org wrote:
 Dear Minkyu Kang,

 On 23 December 2011 09:51, Minkyu Kang proms...@gmail.com wrote:

 Dear Chander Kashyap,

 On 22 December 2011 19:52, Chander Kashyap chander.kash...@linaro.org 
 wrote:
  SMDK5250 board is based on Samsungs EXYNOS5250 SoC.
 
  Signed-off-by: Chander Kashyap chander.kash...@linaro.org
  ---
   MAINTAINERS                                      |    1 +
   arch/arm/cpu/armv7/exynos/clock.c                |   24 +-
   arch/arm/include/asm/arch-exynos/clock.h         |  232 +
   arch/arm/include/asm/arch-exynos/clock_exynos4.h |  255 +
   arch/arm/include/asm/arch-exynos/clock_exynos5.h |  352 +
   arch/arm/include/asm/arch-exynos/cpu.h           |   71 ++--
   arch/arm/include/asm/arch-exynos/cpu_exynos4.h   |   51 ++
   arch/arm/include/asm/arch-exynos/cpu_exynos5.h   |   39 ++
   arch/arm/include/asm/arch-exynos/gpio.h          |   51 ++-
   board/samsung/smdk5250/Makefile                  |   48 ++
   board/samsung/smdk5250/lowlevel_init.S           |  524 
  +++
   board/samsung/smdk5250/mem_setup.S               |  600 
  ++
   board/samsung/smdk5250/smdk5250.c                |  125 +
   board/samsung/smdk5250/smdk5250_setup.h          |  583 
  +
   boards.cfg                                       |    1 +
   include/configs/smdk5250.h                       |  182 +++
   16 files changed, 2867 insertions(+), 272 deletions(-)
   create mode 100644 arch/arm/include/asm/arch-exynos/clock_exynos4.h
   create mode 100644 arch/arm/include/asm/arch-exynos/clock_exynos5.h
   create mode 100644 arch/arm/include/asm/arch-exynos/cpu_exynos4.h
   create mode 100644 arch/arm/include/asm/arch-exynos/cpu_exynos5.h
   create mode 100644 board/samsung/smdk5250/Makefile
   create mode 100644 board/samsung/smdk5250/lowlevel_init.S
   create mode 100644 board/samsung/smdk5250/mem_setup.S
   create mode 100644 board/samsung/smdk5250/smdk5250.c
   create mode 100644 board/samsung/smdk5250/smdk5250_setup.h
   create mode 100644 include/configs/smdk5250.h

 Please split this patch for board and SoC.

 Ok


 
  diff --git a/MAINTAINERS b/MAINTAINERS
  index a56ca10..abf88be 100644
  --- a/MAINTAINERS
  +++ b/MAINTAINERS
  @@ -704,6 +704,7 @@ Chander Kashyap k.chan...@samsung.com
 
         origen                  ARM ARMV7 (EXYNOS4210 SoC)
         SMDKV310                ARM ARMV7 (EXYNOS4210 SoC)
  +       SMDK5250                ARM ARMV7 (EXYNOS5250 SoC)
 
   Torsten Koschorrek koschor...@synertronixx.de
         scb9328         ARM920T (i.MXL)
  diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
  b/arch/arm/cpu/armv7/exynos/clock.c
  index b101f96..88e2fc0 100644
  --- a/arch/arm/cpu/armv7/exynos/clock.c
  +++ b/arch/arm/cpu/armv7/exynos/clock.c
  @@ -125,10 +125,14 @@ static unsigned long exynos_get_pwm_clk(void)
 
         if (s5p_get_cpu_rev() == 0) {
                 /*
  -                * CLK_SRC_PERIL0
  +                * CLK_SRC_{PERIL0 | PERIC0}
                  * PWM_SEL [27:24]
                  */
  +#ifdef CONFIG_EXYNOS5
  +               sel = readl(clk-src_peric0);
  +#else
                 sel = readl(clk-src_peril0);
  +#endif

 NAK.
 We don't allow to using ifdef for separating SoCs.
 Please refer s5pc1xx case for solve it.
 This comment apply to this patch globally.
 Please remove '#ifdef CONFIG_EXYNOS5'.

 I have tried to reuse the code. It is possible to remove
 #ifdef CONFIG_EXYNOS5' in clock.c with cpu_is_s5pcXXX check.
 Is it a acceptable solution? Or is it necessary to write SoC specific 
 function
 in clock.c as done in case of s5pc1xx/clock.c.

 Please Advice
 Removing CONFIG_EXYNOS5 and following s5pc1xx case will not allow to
 reuse the code in clock.c.
 What is the technical hindrance of not using ifdefs?

 What are yours comments regarding this issue?
Any comments regrading the above discussion ?

 Thanks.
 Minkyu Kang.
 --
 from. prom.
 www.promsoft.net




 --
 with warm regards,
 Chander Kashyap



 --
 with warm regards,
 Chander Kashyap



-- 
with warm regards,
Chander Kashyap
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/6] EEYNOS: Add SMDK5250 board support

2012-01-04 Thread Minkyu Kang
Dear Chander Kashyap,

On 27 December 2011 17:48, Chander Kashyap chander.kash...@linaro.org wrote:
   Torsten Koschorrek koschor...@synertronixx.de
         scb9328         ARM920T (i.MXL)
  diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
  b/arch/arm/cpu/armv7/exynos/clock.c
  index b101f96..88e2fc0 100644
  --- a/arch/arm/cpu/armv7/exynos/clock.c
  +++ b/arch/arm/cpu/armv7/exynos/clock.c
  @@ -125,10 +125,14 @@ static unsigned long exynos_get_pwm_clk(void)
 
         if (s5p_get_cpu_rev() == 0) {
                 /*
  -                * CLK_SRC_PERIL0
  +                * CLK_SRC_{PERIL0 | PERIC0}
                  * PWM_SEL [27:24]
                  */
  +#ifdef CONFIG_EXYNOS5
  +               sel = readl(clk-src_peric0);
  +#else
                 sel = readl(clk-src_peril0);
  +#endif

 NAK.
 We don't allow to using ifdef for separating SoCs.
 Please refer s5pc1xx case for solve it.
 This comment apply to this patch globally.
 Please remove '#ifdef CONFIG_EXYNOS5'.

 I have tried to reuse the code. It is possible to remove
 #ifdef CONFIG_EXYNOS5' in clock.c with cpu_is_s5pcXXX check.
 Is it a acceptable solution? Or is it necessary to write SoC specific 
 function
 in clock.c as done in case of s5pc1xx/clock.c.

 Please Advice
 Removing CONFIG_EXYNOS5 and following s5pc1xx case will not allow to
 reuse the code in clock.c.
 What is the technical hindrance of not using ifdefs?

No need to reuse the code, if SoCs are different.
If need, please separate the functions.

like this,

unsigned long get_arm_clk(void)
{
if (cpu_is_s5pc110())
return s5pc110_get_arm_clk();
else
return s5pc100_get_arm_clk();
}

Thanks.
Minkyu Kang
-- 
from. prom.
www.promsoft.net
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot