[U-Boot] [PATCH RESEND 2/2] mx5: Fix CONFIG_OF_LIBFDT redefined warning

2011-05-03 Thread Shawn Guo
With the following commit, CONFIG_OF_LIBFDT is redefined.

  2fa8ca98c37d5b1bb0328b19ddb7e9d162cd9683
  Add CONFIG_OF_LIBFDT to more boards.

Remove the duplicated definition to fix CONFIG_OF_LIBFDT redefined
warning.

Signed-off-by: Shawn Guo 
---
 include/configs/mx51evk.h |2 --
 include/configs/mx53evk.h |2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index febe8d8..207b20c 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -226,6 +226,4 @@
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV 0
 
-#define CONFIG_OF_LIBFDT
-
 #endif
diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
index 74aee89..78122a7 100644
--- a/include/configs/mx53evk.h
+++ b/include/configs/mx53evk.h
@@ -192,6 +192,4 @@
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV 0
 
-#define CONFIG_OF_LIBFDT
-
 #endif /* __CONFIG_H */
-- 
1.7.4.1

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


[U-Boot] [PATCH RESEND 1/2] mx5: Remove unnecessary CONFIG_SYS_BOOTMAPSZ definition

2011-05-03 Thread Shawn Guo
Since the following commit, definition CONFIG_SYS_BOOTMAPSZ is not
needed any more.

  ed59e58786cae9f8afcb575649afc65985beed4d
  Remove device tree booting dependency on CONFIG_SYS_BOOTMAPSZ

Signed-off-by: Shawn Guo 
---
Why resend?
The previous post does not apply on u-boot mainline, so rebase and
resend.

 include/configs/mx51evk.h |1 -
 include/configs/mx53evk.h |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index 6a785f8..febe8d8 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -227,6 +227,5 @@
 #define CONFIG_SYS_MMC_ENV_DEV 0
 
 #define CONFIG_OF_LIBFDT
-#define CONFIG_SYS_BOOTMAPSZ   0x80
 
 #endif
diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
index 5749a08..74aee89 100644
--- a/include/configs/mx53evk.h
+++ b/include/configs/mx53evk.h
@@ -193,6 +193,5 @@
 #define CONFIG_SYS_MMC_ENV_DEV 0
 
 #define CONFIG_OF_LIBFDT
-#define CONFIG_SYS_BOOTMAPSZ   0x80
 
 #endif /* __CONFIG_H */
-- 
1.7.4.1

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


[U-Boot] [GIT PULL] mpc83xx: restrict UTMI PHY configuration to 831x parts

2011-05-03 Thread Kim Phillips
Wolfgang Denk,

Please pull:

The following changes since commit
67a490d60d70f2b01d55976440ba30154af96965:

  atmel_nand: don't require CONFIG_SYS_NAND_ENABLE_PIN (2011-04-01
14:49:08 -0500)

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

Kim Phillips (1):
  mpc83xx: restrict UTMI PHY configuration to 831x parts

 arch/powerpc/cpu/mpc83xx/cpu_init.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

Thanks,

Kim

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


Re: [U-Boot] 8308 Clock issues - Not PCI_HOST

2011-05-03 Thread Kim Phillips
On Tue, 3 May 2011 15:26:16 -0700
Barry G  wrote:

> I am working on porting u-boot to our custom board.  Everything
> is working fine using my BSP except one common area in u-boot
> that I have had issues with and have fixed with the following
> patch:
> --- u-boot.without_b2040/arch/powerpc/cpu/mpc83xx/speed.c
> 2011-05-02 08:11:04.916529581 -0700
> +++ u-boot/arch/powerpc/cpu/mpc83xx/speed.c 2011-05-02
> 08:11:19.023546051 -0700
> @@ -156,6 +156,10 @@
> } else {
>  #if defined(CONFIG_83XX_PCICLK)
>   pci_sync_in = CONFIG_83XX_PCICLK;
> +#elif defined(CONFIG_83XX_CLKIN)
> +  /* 8308 doesn't have the HRCWH_PCI_HOST, but should
> + run off the CONFIG_83XX_CLKIN */
> + pci_sync_in = CONFIG_83XX_CLKIN / (1 + clkin_div);
>  #else
>   pci_sync_in = 0xDEADBEEF;
>  #endif
> 
> The issue is since the 8308 is using PCI express, the check
> for im->reset.rcwh & HRCWH_PCI_HOST fails (this bit isn't
> defined for the 8308) and I don't have the CONFIG_83XX_PCICLK
> defined.  I am not using PCI on the board.  Without my patch
> I end up with deadbeef and a board with really whacky clock
> frequencies :-)
> 
> Looking at the MPC8308RDB.h, I see they defined HRCWH_PCI_HOST
> even though it really isn't a standard PCI host.  I tried doing
> this but it didn't work on my 8308 (the test still doesn't see the
> bit set in the rcwh).

this is without a debugger connected, right?  does your
CONFIG_SYS_HRCW_HIGH include PCI1_ARBITER_ENABLE?  If not, can you
try matching that and more HRCW_HIGH and _LOW bits to those in the
existing 8308 boards using mpc8308_p1m.h and MPC8308RDB.h?

btw, the reset.rcwh read should be using some sort of accessor fn,
like __raw_readl.

> That all said, my patch works but seems kind of lame.  Is there
> a better way to fix this?  Has anyone else had this issue?

I don't have an 8308, but the comment above the HRCWH
setting in the 8308 config files suggest that others indeed have.

wrt to the proper patch, how about ifndef 8308 the
HRCW1_PCI_HOST condition altogether?  actually, looking at the 8308
manual, I don't even see the SPMR_CKID bit existing in the 8308
either, so the prior read should also be ifdeffed out.

Kim

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


[U-Boot] 8308 Clock issues - Not PCI_HOST

2011-05-03 Thread Barry G
Hello,

I am working on porting u-boot to our custom board.  Everything
is working fine using my BSP except one common area in u-boot
that I have had issues with and have fixed with the following patch:
--- u-boot.without_b2040/arch/powerpc/cpu/mpc83xx/speed.c
2011-05-02 08:11:04.916529581 -0700
+++ u-boot/arch/powerpc/cpu/mpc83xx/speed.c 2011-05-02
08:11:19.023546051 -0700
@@ -156,6 +156,10 @@
} else {
 #if defined(CONFIG_83XX_PCICLK)
  pci_sync_in = CONFIG_83XX_PCICLK;
+#elif defined(CONFIG_83XX_CLKIN)
+  /* 8308 doesn't have the HRCWH_PCI_HOST, but should
+ run off the CONFIG_83XX_CLKIN */
+ pci_sync_in = CONFIG_83XX_CLKIN / (1 + clkin_div);
 #else
  pci_sync_in = 0xDEADBEEF;
 #endif

The issue is since the 8308 is using PCI express, the check
for im->reset.rcwh & HRCWH_PCI_HOST fails (this bit isn't
defined for the 8308) and I don't have the CONFIG_83XX_PCICLK
defined.  I am not using PCI on the board.  Without my patch
I end up with deadbeef and a board with really whacky clock
frequencies :-)

Looking at the MPC8308RDB.h, I see they defined HRCWH_PCI_HOST
even though it really isn't a standard PCI host.  I tried doing this but
it didn't work on my 8308 (the test still doesn't see the bit set in the rcwh).

That all said, my patch works but seems kind of lame.  Is there
a better way to fix this?  Has anyone else had this issue?

Thanks,

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


Re: [U-Boot] [PATCH 2/2] powerpc/85xx: verify the device tree before booting Linux

2011-05-03 Thread Timur Tabi
Scott Wood wrote:
> This seems to have a higher potential for false positives than a checksum.

As a compromise, if the verify function thinks that there could be a false
positive, then it can display a warning and return success.

Frankly, though, if the there's a mismatch with the CCSR base address, then
there's not much room for false positives.

-- 
Timur Tabi
Linux kernel developer at Freescale

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


Re: [U-Boot] [PATCH 2/2] powerpc/85xx: verify the device tree before booting Linux

2011-05-03 Thread Scott Wood
On Tue, 3 May 2011 10:10:18 -0500
Kumar Gala  wrote:

> 
> On May 3, 2011, at 9:41 AM, Timur Tabi wrote:
> 
> > On May 3, 2011, at 9:21 AM, Kumar Gala  wrote:
> > 
> >>> 
> >>> +
> >>> +ft_verify_fdt(*of_flat_tree);
> >> 
> >> Do we not want to error out here if verify fails?
> > 
> > Maybe.  I didn't want a false negative to prevent booting.  If the DT is 
> > wrong, the kernel won't display any messages, so the warning will be the 
> > last thing the user sees anyway.
> > 
> > If the consensus is that failure should abort, then I can add that.  I 
> > don't have a strong preference either way.
> >> 
> 
> I would think that a verify of this form should be considered as bad as not 
> passing a checksum verification.

This seems to have a higher potential for false positives than a checksum.

-Scott

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


[U-Boot] [PATCH] video: Add SHARP LQ084S3LG01 LCD support on P1022DS

2011-05-03 Thread Timur Tabi
The SHARP LQ084S3LG01 is a TFT LCD used on the P1022DS (revision "C") board.
This device only supports 800x600 resolution, so if that resolution is selected,
assume that this is the device.  The device is attached to the LVDS port
on the P1022DS board.

Also change the existing entry for 800x600 so that it is used only on the
PDM360NG board, to avoid confusion.  We should probably add a more robust
method for specifying display parameters.

Signed-off-by: Timur Tabi 
---
 drivers/video/fsl_diu_fb.c |   23 +++
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fsl_diu_fb.c b/drivers/video/fsl_diu_fb.c
index 0709849..3546b90 100644
--- a/drivers/video/fsl_diu_fb.c
+++ b/drivers/video/fsl_diu_fb.c
@@ -78,10 +78,7 @@ struct fb_videomode {
unsigned int flag;
 };
 
-#define FB_SYNC_VERT_HIGH_ACT  2   /* vertical sync high active*/
-#define FB_SYNC_COMP_HIGH_ACT  8   /* composite sync high active   */
-#define FB_VMODE_NONINTERLACED  0  /* non interlaced */
-
+#ifdef CONFIG_PDM360NG
 /* This setting is used for the ifm pdm360ng with PRIMEVIEW PM070WL3 */
 static struct fb_videomode fsl_diu_mode_800 = {
.name   = "800x600-60",
@@ -98,6 +95,24 @@ static struct fb_videomode fsl_diu_mode_800 = {
.sync   = 0,
.vmode  = FB_VMODE_NONINTERLACED
 };
+#else
+/* For the SHARP LQ084S3LG01, used on the P1022DS board */
+static struct fb_videomode fsl_diu_mode_800 = {
+   .name   = "800x600-60",
+   .refresh= 60,
+   .xres   = 800,
+   .yres   = 600,
+   .pixclock   = 25000,
+   .left_margin= 88,
+   .right_margin   = 40,
+   .upper_margin   = 23,
+   .lower_margin   = 1,
+   .hsync_len  = 128,
+   .vsync_len  = 4,
+   .sync   = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+   .vmode  = FB_VMODE_NONINTERLACED
+};
+#endif
 
 /*
  * These parameters give default parameters
-- 
1.7.3.4


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


Re: [U-Boot] [PATCH] spi: Tegra2: Add SPI driver for SPIFLASH on Seaboard

2011-05-03 Thread Mike Frysinger
On Tue, May 3, 2011 at 11:13, Tom Warren wrote:
> On Mon, May 2, 2011 at 4:16 PM, Mike Frysinger wrote:
>> On Monday, May 02, 2011 19:06:51 Tom Warren wrote:
>>> Seaboard has a touchscreen on SPI1, but U-Boot doesn't care about that.
>>
>> fwiw, u-boot has splash screen support
>
> Thanks, Mike. I'm talking touchscreen support. We'll be submitting LCD
> support for Tegra2 at a later date, so splash screens can be shown by
> ODMs, etc.

you could implement a simple console input driver for the touchscreen
(translate the gestures into up/down/enter/etc...), but you're
probably treading way into new territory for u-boot if you do :)
-mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 1/2] GPIO: Tegra2: add GPIO driver for Tegra2

2011-05-03 Thread Mike Frysinger
On Tue, May 3, 2011 at 12:49, Michael Walle wrote:
> Am Di, 3.05.2011, 00:45, schrieb Tom Warren:
>> Changes in V2:
>>       - use 'gpio_pin' enum in gpio.h (Simon Glass review request)
>>       - change 'GPIO_PORT8' to 'GPIO_FULLPORT' (Simon Glass request)
>>       - change 'offset' to 'pin' globally
>>
>>  arch/arm/include/asm/arch-tegra2/gpio.h |  244
> -
>>  drivers/gpio/Makefile                   |    1 +
>>  drivers/gpio/tegra2_gpio.c              |  299
>
> Does this (SoC) driver belong to drivers/gpio/ or
> arch/arm/cpu/armv7/tegra2/? To me it seems that both are used for
> architectures/SoCs specific drivers (eg. blackfin, omap in arch/ and at91
> in drivers/gpio/). What is the preferred directory?

following the Linux style makes sense to me.  only gpio expanders and
such live in drivers/gpio/.  but until we get a more unified api
effort, i'm not sure sweating the location of the driver is important.
-mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] fdt: add prototype for fdt_increase_size()

2011-05-03 Thread Timur Tabi
Add a prototype for fdt_increase_size() so that anyone can call it.

Signed-off-by: Timur Tabi 
---
 include/fdt_support.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/fdt_support.h b/include/fdt_support.h
index ce6817b..7333c0c 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -79,6 +79,7 @@ void ft_pci_setup(void *blob, bd_t *bd);
 
 void set_working_fdt_addr(void *addr);
 int fdt_resize(void *blob);
+int fdt_increase_size(void *fdt, int add_len);
 
 int fdt_fixup_nor_flash_size(void *blob);
 
-- 
1.7.3.4


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


[U-Boot] [PATCH 2/2] fman: insert the Fman firmware into the device tree

2011-05-03 Thread Timur Tabi
The Fman device tree node binding allows for the entire Fman firmware binary
data to be embedded in the device tree.  This eliminates the need to have
NOR flash mapped to Linux just so that the Fman driver can see the firmware.

The location of the Fman firmware is taken from the 'fman_ucode' environment
variable.

Signed-off-by: Timur Tabi 
---
 arch/powerpc/cpu/mpc85xx/fdt.c |  119 
 include/configs/corenet_ds.h   |8 +--
 2 files changed, 121 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 6e909b5..42bc51a 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -33,6 +33,7 @@
 #ifdef CONFIG_FSL_ESDHC
 #include 
 #endif
+#include "../../../../drivers/qe/qe.h" /* For struct qe_firmware */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -397,6 +398,122 @@ static void ft_fixup_qe_snum(void *blob)
 }
 #endif
 
+/**
+ * fdt_fixup_fman_firmware -- insert the Fman firmware into the device tree
+ *
+ * The binding for an Fman firmware node is documented in
+ * Documentation/powerpc/dts-bindings/fsl/dpaa/fman.txt.  This node contains
+ * the actual Fman firmware binary data.  The operating system is expected to
+ * be able to parse the binary data to determine any attributes it needs.
+ */
+void fdt_fixup_fman_firmware(void *blob)
+{
+   int rc, fmnode, fwnode = -1;
+   uint32_t phandle;
+   struct qe_firmware *fmanfw;
+   const struct qe_header *hdr;
+   unsigned int length;
+   uint32_t crc;
+   const char *p;
+
+   /* The first Fman we find will contain the actual firmware. */
+   fmnode = fdt_node_offset_by_compatible(blob, -1, "fsl,fman");
+   if (fmnode < 0)
+   /* Exit silently if there are no Fman devices */
+   return;
+
+   /* If we already have a firmware node, then also exit silently. */
+   if (fdt_node_offset_by_compatible(blob, -1, "fsl,fman-firmware") > 0)
+   return;
+
+   /* If the environment variable is not set, then exit silently */
+   p = getenv("fman_ucode");
+   if (!p)
+   return;
+
+   fmanfw = (struct qe_firmware *) simple_strtoul(p, NULL, 0);
+   if (!fmanfw)
+   return;
+
+   hdr = &fmanfw->header;
+   length = be32_to_cpu(hdr->length);
+
+   /* Verify the firmware. */
+   if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') ||
+   (hdr->magic[2] != 'F')) {
+   printf("Data at %p is not an Fman firmware\n", fmanfw);
+   return;
+   }
+
+   if (length > 16384) {
+   printf("Fman firmware at %p is too large (size=%u)\n",
+  fmanfw, length);
+   return;
+   }
+
+   length -= sizeof(u32);  /* Subtract the size of the CRC */
+   crc = be32_to_cpu(*(u32 *)((void *)fmanfw + length));
+   if (crc != crc32_no_comp(0, (void *)fmanfw, length)) {
+   printf("Fman firmware at %p has invalid CRC\n", fmanfw);
+   return;
+   }
+
+   /* Increase the size of the fdt to make room for the node. */
+   rc = fdt_increase_size(blob, fmanfw->header.length);
+   if (rc < 0) {
+   printf("Unable to make room for Fman firmware: %s\n",
+   fdt_strerror(rc));
+   return;
+   }
+
+   /* Create the firmware node. */
+   fwnode = fdt_add_subnode(blob, fmnode, "fman-firmware");
+   if (fwnode < 0) {
+   char s[64];
+   fdt_get_path(blob, fmnode, s, sizeof(s));
+   printf("Could not add firmware node to %s: %s\n", s,
+  fdt_strerror(fwnode));
+   return;
+   }
+   rc = fdt_setprop_string(blob, fwnode, "compatible", 
"fsl,fman-firmware");
+   if (rc < 0) {
+   char s[64];
+   fdt_get_path(blob, fwnode, s, sizeof(s));
+   printf("Could not add compatible property to node %s: %s\n", s,
+  fdt_strerror(rc));
+   return;
+   }
+   phandle = fdt_alloc_phandle(blob);
+   rc = fdt_setprop_cell(blob, fwnode, "linux,phandle", phandle);
+   if (rc < 0) {
+   char s[64];
+   fdt_get_path(blob, fwnode, s, sizeof(s));
+   printf("Could not add phandle property to node %s: %s\n", s,
+  fdt_strerror(rc));
+   return;
+   }
+   rc = fdt_setprop(blob, fwnode, "fsl,firmware", fmanfw, 
fmanfw->header.length);
+   if (rc < 0) {
+   char s[64];
+   fdt_get_path(blob, fwnode, s, sizeof(s));
+   printf("Could not add firmware property to node %s: %s\n", s,
+  fdt_strerror(rc));
+   return;
+   }
+
+   /* Find all other Fman nodes and point them to the firmware node. */
+   while ((fmnode = fdt_node_offset_by_compatible(blob, fmnode, 
"fsl,fman")) > 0) {

[U-Boot] [PATCH 2/2] [v2] powerpc/85xx: verify the device tree before booting Linux

2011-05-03 Thread Timur Tabi
Introduce ft_verify_fdt(), a function that is called after the device tree
has been fixed up, that displays warning messages if there is a mismatch
between the physical addresses of some devices that U-Boot has configured with
what the device tree says the addresses are.

This is a particular problem when booting a 36-bit device tree from a 32-bit
U-Boot (or vice versa), because the physical address of CCSR is wrong in the
device tree.  When the operating system boots, no messages are displayed, so
the user generally has no idea what's wrong.

Signed-off-by: Timur Tabi 
---

At Kumar's request, this patch replaces "[v3] powerpc/85xx: introduce
'fdt verify' command".  The PCI checking has been dropped, because Kumar wants
PCI addresses to be fixed up, not verified (TBD in a future patch).  Also,
this code is now run on every boot via a weak function, rather than an 'fdt'
command.  It never really made much sense to make this a command-line command,
because running fdt commands is clunky.

 arch/powerpc/cpu/mpc85xx/fdt.c |   72 
 arch/powerpc/lib/bootm.c   |   21 +++
 2 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 6e909b5..c490993 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -497,3 +497,75 @@ void ft_cpu_setup(void *blob, bd_t *bd)
do_fixup_by_compat_u32(blob, "fsl,gianfar-ptp-timer",
"timer-frequency", gd->bus_clk/2, 1);
 }
+
+/*
+ * For some CCSR devices, we only have the virtual address, not the physical
+ * address.  This is because we map CCSR as a whole, so we typically don't need
+ * a macro for the physical address of any device within CCSR.  In this case,
+ * we calculate the physical address of that device using it's the difference
+ * between the virtual address of the device and the virtual address of the
+ * beginning of CCSR.
+ */
+#define CCSR_VIRT_TO_PHYS(x) \
+   (CONFIG_SYS_CCSRBAR_PHYS + ((x) - CONFIG_SYS_CCSRBAR))
+
+/*
+ * Verify the device tree
+ *
+ * This function compares several CONFIG_xxx macros that contain physical
+ * addresses with the corresponding nodes in the device tree, to see if
+ * the physical addresses are all correct.  For example, if
+ * CONFIG_SYS_NS16550_COM1 is defined, then it contains the virtual address
+ * of the first UART.  We convert this to a physical address and compare
+ * that with the physical address of the first ns16550-compatible node
+ * in the device tree.  If they don't match, then we display a warning.
+ *
+ * Returns 1 on success, 0 on failure
+ */
+int ft_verify_fdt(void *fdt)
+{
+   uint64_t ccsr = 0;
+   int aliases;
+   int off;
+
+   /* First check the CCSR base address */
+   off = fdt_node_offset_by_prop_value(fdt, -1, "device_type", "soc", 4);
+   if (off > 0)
+   ccsr = fdt_get_base_address(fdt, off);
+
+   if (!ccsr) {
+   printf("Warning: could not determine base CCSR address in "
+  "device tree\n");
+   /* No point in checking anything else */
+   return 0;
+   }
+
+   if (ccsr != CONFIG_SYS_CCSRBAR_PHYS) {
+   printf("Warning: U-Boot configured CCSR at address %llx,\n"
+  "but the device tree has it at %llx\n",
+  (uint64_t) CONFIG_SYS_CCSRBAR_PHYS, ccsr);
+   /* No point in checking anything else */
+   return 0;
+   }
+
+   /*
+* Get the 'aliases' node.  If there isn't one, then there's nothing
+* left to do.
+*/
+   aliases = fdt_path_offset(fdt, "/aliases");
+   if (aliases > 0) {
+#ifdef CONFIG_SYS_NS16550_COM1
+   if (!fdt_verify_alias_address(fdt, aliases, "serial0",
+   CCSR_VIRT_TO_PHYS(CONFIG_SYS_NS16550_COM1)))
+   return 0;
+#endif
+
+#ifdef CONFIG_SYS_NS16550_COM2
+   if (!fdt_verify_alias_address(fdt, aliases, "serial1",
+   CCSR_VIRT_TO_PHYS(CONFIG_SYS_NS16550_COM2)))
+   return 0;
+#endif
+   }
+
+   return 1;
+}
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index e01787d..3ca4374 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -226,6 +226,24 @@ static int boot_bd_t_linux(bootm_headers_t *images)
return ret;
 }
 
+/*
+ * Verify the device tree.
+ *
+ * This function is called after all device tree fix-ups have been enacted,
+ * so that the final device tree can be verified.  The definition of "verified"
+ * is up to the specific implementation.  However, it generally means that the
+ * addresses of some of the devices in the device tree are compared with the
+ * actual addresses at which U-Boot has placed them.
+ *
+ * Returns 1 on success, 0 on failure.  If 0 is returned, U-boot will halt the
+ * boot process.
+ */
+static int _

[U-Boot] [PATCH 1/2] [v2] fdt: introduce fdt_verify_alias_address() and fdt_get_base_address()

2011-05-03 Thread Timur Tabi
Introduce two functions, fdt_verify_alias_address() and fdt_get_base_address(),
which can be used to verify the physical address of a device in a device tree.

fdt_get_base_address() returns the base address of an SOC or PCI node.

fdt_verify_alias_address() prints a message if the address of a node specified
by an alias does not match the given physical address.

Signed-off-by: Timur Tabi 
---
 common/fdt_support.c  |   67 +
 include/fdt_support.h |4 +++
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 496040b..150a3c5 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1223,3 +1223,70 @@ err_size:
return ret;
 }
 #endif
+
+/*
+ * Verify the physical address of device tree node for a given alias
+ *
+ * This function locates the device tree node of a given alias, and then
+ * verifies that the physical address of that device matches the given
+ * parameter.  It displays a message if there is a mismatch.
+ *
+ * Returns 1 on success, 0 on failure
+ */
+int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr)
+{
+   const char *path;
+   const u32 *reg;
+   int node, len;
+   u64 dt_addr;
+
+   path = fdt_getprop(fdt, anode, alias, NULL);
+   if (!path) {
+   /* If there's no such alias, then it's not a failure */
+   return 1;
+   }
+
+   node = fdt_path_offset(fdt, path);
+   if (node < 0) {
+   printf("Warning: device tree alias '%s' points to invalid "
+  "node %s.\n", alias, path);
+   return 0;
+   }
+
+   reg = fdt_getprop(fdt, node, "reg", &len);
+   if (!reg) {
+   printf("Warning: device tree node '%s' has no address.\n",
+  path);
+   return 0;
+   }
+
+   dt_addr = fdt_translate_address(fdt, node, reg);
+   if (addr != dt_addr) {
+   printf("Warning: U-Boot configured device %s at address %llx,\n"
+  " but the device tree has it address %llx.\n",
+  alias, addr, dt_addr);
+   return 0;
+   }
+
+   return 1;
+}
+
+/*
+ * Returns the base address of an SOC or PCI node
+ */
+u64 fdt_get_base_address(void *fdt, int node)
+{
+   int size;
+   u32 naddr;
+   const u32 *prop;
+
+   prop = fdt_getprop(fdt, node, "#address-cells", &size);
+   if (prop && size == 4)
+   naddr = *prop;
+   else
+   naddr = 2;
+
+   prop = fdt_getprop(fdt, node, "ranges", &size);
+
+   return prop ? fdt_translate_address(fdt, node, prop + naddr) : 0;
+}
diff --git a/include/fdt_support.h b/include/fdt_support.h
index ce6817b..cefc990 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -90,5 +90,9 @@ int fdt_node_offset_by_compat_reg(void *blob, const char 
*compat,
 int fdt_alloc_phandle(void *blob);
 int fdt_add_edid(void *blob, const char *compat, unsigned char *buf);
 
+int fdt_verify_alias_address(void *fdt, int anode, const char *alias,
+ u64 addr);
+u64 fdt_get_base_address(void *fdt, int node);
+
 #endif /* ifdef CONFIG_OF_LIBFDT */
 #endif /* ifndef __FDT_SUPPORT_H */
-- 
1.7.3.4


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


[U-Boot] [PATCH v1] PPC405EX CHIP_21 erratum

2011-05-03 Thread Steven A. Falco
APM errata CHIP_21 for the 405EX/EXr (from the rev 1.09 document dated 4/27/11)
states that rev D processors may wake up with the wrong feature set.  I've
personally seen that happen.  This patch implements the APM-proposed workaround.

Note that you cannot blindly use this workaround.  You must add/customize the
following three defines to match your hardware.  If you get this wrong, the
processor will go into an infinite reset loop, and JTAG will be required to
recover.

#define CONFIG_405EX_CHIP21_PVR_REV_C   0x1291147d /* EX without 
security */
#define CONFIG_405EX_CHIP21_PVR_REV_D   0x12911473 /* EX without 
security */
#define CONFIG_405EX_CHIP21_ECID3_REV_D 0x1/* EX without 
security */

Signed-off-by: Steve Falco 

---

diff --git a/arch/powerpc/cpu/ppc4xx/cpu_init.c 
b/arch/powerpc/cpu/ppc4xx/cpu_init.c
index bf208ad..89a577b 100644
--- a/arch/powerpc/cpu/ppc4xx/cpu_init.c
+++ b/arch/powerpc/cpu/ppc4xx/cpu_init.c
@@ -221,6 +221,69 @@ void reconfigure_pll(u32 new_cpu_freq)
 #endif
 }
 
+#ifdefined(CONFIG_405EX_CHIP21_PVR_REV_C) && \
+   defined(CONFIG_405EX_CHIP21_PVR_REV_D) && \
+   defined(CONFIG_405EX_CHIP21_ECID3_REV_D)
+void
+chip_21_errata (void)
+{
+   /*
+* See rev 1.09 of the 405EX/405EXr errata.  CHIP_21 says that
+* sometimes reading the PVR and/or SDR0_ECID results in incorrect
+* values.  Since the rev-D chip uses the SDR0_ECID bits to control
+* internal features, that means the second PCIe or ethernet of an EX
+* variant could fail to work.  Also, security features of both EX and
+* EXr might be incorrectly disabled.
+*
+* The suggested workaround is as follows (covering rev-C and rev-D):
+* 
+* 1.Read the PVR and SDR0_ECID3.
+*
+* 2.If the PVR matches an expected Revision C PVR value AND if
+* SDR0_ECID3[12:15] is different from PVR[28:31], then – processor is
+* Revision C: continue executing the initialization code (no reset
+* required).  else – go to step 3.
+*
+* 3.If the PVR matches an expected Revision D PVR value AND if
+* SDR0_ECID3[10:11] matches its expected value, then – continue
+* executing initialization code, no reset required.  else – write
+* DBCR0[RST] = 0b11 to generate a SysReset.
+*/
+
+   u32 pvr;
+   u32 pvr_28_31;
+   u32 ecid3;
+   u32 ecid3_10_11;
+   u32 ecid3_12_15;
+
+   // Step 1:
+   pvr = get_pvr();
+   mfsdr(SDR0_ECID3, ecid3);
+
+   // Step 2:
+   pvr_28_31 = pvr & 0xf;
+   ecid3_10_11 = (ecid3 >> 20) & 0x3;
+   ecid3_12_15 = (ecid3 >> 16) & 0xf;
+   if((pvr == CONFIG_405EX_CHIP21_PVR_REV_C) &&
+   (pvr_28_31 != ecid3_12_15)) {
+   // No reset required.
+   return;
+   }
+
+   // Step 3:
+   if((pvr == CONFIG_405EX_CHIP21_PVR_REV_D) &&
+   (ecid3_10_11 == CONFIG_405EX_CHIP21_ECID3_REV_D)) {
+   // No reset required.
+   return;
+   }
+
+   // Reset required.
+   __asm__ __volatile__ ("sync; isync");
+   mtspr(SPRN_DBCR0, 0x3000);
+
+}
+#endif
+
 /*
  * Breath some life into the CPU...
  *
@@ -235,6 +298,12 @@ cpu_init_f (void)
u32 val;
 #endif
 
+#ifdefined(CONFIG_405EX_CHIP21_PVR_REV_C) && \
+   defined(CONFIG_405EX_CHIP21_PVR_REV_D) && \
+   defined(CONFIG_405EX_CHIP21_ECID3_REV_D)
+   chip_21_errata();
+#endif
+
reconfigure_pll(CONFIG_SYS_PLL_RECONFIG);
 
 #if (defined(CONFIG_405EP) || defined (CONFIG_405EX)) && \
diff --git a/arch/powerpc/include/asm/ppc405ex.h 
b/arch/powerpc/include/asm/ppc405ex.h
index 36d3149..8070385 100644
--- a/arch/powerpc/include/asm/ppc405ex.h
+++ b/arch/powerpc/include/asm/ppc405ex.h
@@ -43,6 +43,11 @@
 #define SDR0_PFC1  0x4101
 #define SDR0_MFR   0x4300  /* SDR0_MFR reg */
 
+#define SDR0_ECID0 0x0080
+#define SDR0_ECID1 0x0081
+#define SDR0_ECID2 0x0082
+#define SDR0_ECID3 0x0083
+
 #define SDR0_SDCS_SDD  (0x8000 >> 31)
 
 #define SDR0_SRST_DMC  (0x8000 >> 10)
diff --git a/include/configs/kilauea.h b/include/configs/kilauea.h
index 031f8fb..2d3efba 100644
--- a/include/configs/kilauea.h
+++ b/include/configs/kilauea.h
@@ -44,6 +44,17 @@
 #endif
 
 /*
+ * CHIP_21 errata
+ */
+//#define CONFIG_405EX_CHIP21_PVR_REV_C0x1291147f /* EX with 
security */
+//#define CONFIG_405EX_CHIP21_PVR_REV_D0x12911475 /* EX with 
security */
+//#define CONFIG_405EX_CHIP21_ECID3_REV_D  0x0/* EX with 
security */
+
+#define CONFIG_405EX_CHIP21_PVR_REV_C  0x1291147d /* EX without 
security */
+#define CONFIG_405EX_CHIP21_PVR_REV_D  0x12911473 /* EX without 
security */
+#define CONFIG_405EX_CHIP21_ECID3_REV_D0x1/* EX 
without securit

Re: [U-Boot] [PATCH V2 1/2] GPIO: Tegra2: add GPIO driver for Tegra2

2011-05-03 Thread Michael Walle
Am Di, 3.05.2011, 00:45, schrieb Tom Warren:
> Signed-off-by: Tom Warren 
> ---
> Changes in V2:
>   - use 'gpio_pin' enum in gpio.h (Simon Glass review request)
>   - change 'GPIO_PORT8' to 'GPIO_FULLPORT' (Simon Glass request)
>   - change 'offset' to 'pin' globally
>
>  arch/arm/include/asm/arch-tegra2/gpio.h |  244
-
>  drivers/gpio/Makefile   |1 +
>  drivers/gpio/tegra2_gpio.c  |  299

Does this (SoC) driver belong to drivers/gpio/ or
arch/arm/cpu/armv7/tegra2/? To me it seems that both are used for
architectures/SoCs specific drivers (eg. blackfin, omap in arch/ and at91
in drivers/gpio/). What is the preferred directory?

-- 
Michael




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


Re: [U-Boot] [PATCH v2] nand_spl: Fix large page nand_command()

2011-05-03 Thread Scott Wood
On Sun, 1 May 2011 16:43:30 +0200
Wolfgang Denk  wrote:

> Dear Alex Waterman,
> 
> In message <4d9cc6b0.6020...@dawning.com> you wrote:
> >
> > This patch changes the large page nand_command() routine to use a word
> > offset instead of a byte offset. The 'offs' argument gets divided by 2
> > so that the offset passed to nand_command() is still by byte offset.
> > Originally, the offset was not shifted and when too high an offset was
> > requested the nand chip would attempt to read non-existent data.
> > 
> > Changes for v2:
> > 
> >  - Moved the offset calculation to outside of the OOB emulation code.
> >  - Hopefully no more whitespace mangling.
> > 
> > Signed-off-by: Alex Waterman 
> > ---
> >  nand_spl/nand_boot.c |4 
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> Unfortunately this patch breaks building of the canyonlands_nand and
> glacier_nand configurations:
> 
> Configuring for canyonlands_nand - Board: canyonlands, Options: 
> CANYONLANDS,NAND_U_BOOT,SYS_TEXT_BASE=0x0100
> ppc_6xx-ld: section .resetvec [e3003ffc -> e3003fff] overlaps section 
> .bss.ndfc_cs [e3003ff4 -> e3004003]
> make[1]: *** [/work/wd/tmp-ppc/nand_spl/u-boot-spl] Error 1
> make: *** [nand_spl] Error 2
> make: *** Waiting for unfinished jobs
> ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file
> 
> Configuring for glacier_nand - Board: canyonlands, Options: 
> GLACIER,NAND_U_BOOT,SYS_TEXT_BASE=0x0100
> ppc_6xx-ld: section .resetvec [e3003ffc -> e3003fff] overlaps section 
> .bss.ndfc_cs [e3003ff4 -> e3004003]
> make[1]: *** [/work/wd/tmp-ppc/nand_spl/u-boot-spl] Error 1
> make: *** [nand_spl] Error 2
> make: *** Waiting for unfinished jobs
> ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file

They build for me with GCC 4.5.1 -- probably right on the edge of the code
size limit.

-Scott

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


Re: [U-Boot] [PATCH] spi: Tegra2: Add SPI driver for SPIFLASH on Seaboard

2011-05-03 Thread Tom Warren
On Mon, May 2, 2011 at 4:16 PM, Mike Frysinger  wrote:
> On Monday, May 02, 2011 19:06:51 Tom Warren wrote:
>> Seaboard has a touchscreen on SPI1, but U-Boot doesn't care about that.
>
> fwiw, u-boot has splash screen support
> -mike
>
Thanks, Mike. I'm talking touchscreen support. We'll be submitting LCD
support for Tegra2 at a later date, so splash screens can be shown by
ODMs, etc.

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


Re: [U-Boot] [PATCH 2/2] powerpc/85xx: verify the device tree before booting Linux

2011-05-03 Thread Kumar Gala

On May 3, 2011, at 9:41 AM, Timur Tabi wrote:

> On May 3, 2011, at 9:21 AM, Kumar Gala  wrote:
> 
>>> 
>>> +
>>> +ft_verify_fdt(*of_flat_tree);
>> 
>> Do we not want to error out here if verify fails?
> 
> Maybe.  I didn't want a false negative to prevent booting.  If the DT is 
> wrong, the kernel won't display any messages, so the warning will be the last 
> thing the user sees anyway.
> 
> If the consensus is that failure should abort, then I can add that.  I don't 
> have a strong preference either way.
>> 

I would think that a verify of this form should be considered as bad as not 
passing a checksum verification.

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


[U-Boot] [PATCH v5 4/4] Enable multiple fs options for Marvell SoC family on OpenRD boards

2011-05-03 Thread Clint Adams
Signed-off-by: Clint Adams 
Cc: Albert ARIBAUD 
Cc: Prafulla Wadaskar 
Cc: Julian Pidancet 
---
 include/configs/openrd.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/openrd.h b/include/configs/openrd.h
index 8d86067..3256cb3 100644
--- a/include/configs/openrd.h
+++ b/include/configs/openrd.h
@@ -60,6 +60,7 @@
  * Commands configuration
  */
 #define CONFIG_SYS_NO_FLASH/* Declare no flash (NOR/SPI) */
+#define CONFIG_SYS_MVFS
 #include 
 #define CONFIG_CMD_AUTOSCRIPT
 #define CONFIG_CMD_DHCP
-- 
1.7.4.4

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


[U-Boot] [PATCH v5 3/4] Initialize second PHY on OpenRD-Client and OpenRD-Ultimate

2011-05-03 Thread Clint Adams
Though the OpenRD-Base only has one gigabit Ethernet port,
both the OpenRD-Client and OpenRD-Ultimate each have two.

On the Ultimate, the PHY addresses are consecutive, but
on the Client they are not.

(based on
<62a0952ce368acc725063a00a5ec680a639d6c27.1301040318.git.julian.pidan...@citrix.com>

)

Signed-off-by: Clint Adams 
Cc: Albert ARIBAUD 
Cc: Prafulla Wadaskar 
Cc: Julian Pidancet 
--
Changes for v3:
  - lengthened commit message
Changes for v4:
   - Added Signed-off-by: line to commit message
   - Changed whitespace to TABs
---
 board/Marvell/openrd/openrd.c |   25 +
 include/configs/openrd.h  |   14 --
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/board/Marvell/openrd/openrd.c b/board/Marvell/openrd/openrd.c
index 14ca88e..87939de 100644
--- a/board/Marvell/openrd/openrd.c
+++ b/board/Marvell/openrd/openrd.c
@@ -124,12 +124,11 @@ int board_init(void)
 }
 
 #ifdef CONFIG_RESET_PHY_R
-/* Configure and enable MV88E1116 PHY */
-void reset_phy(void)
+/* Configure and enable MV88E1116/88E1121 PHY */
+void mv_phy_init(char *name)
 {
u16 reg;
u16 devadr;
-   char *name = "egiga0";
 
if (miiphy_set_current_dev(name))
return;
@@ -154,6 +153,24 @@ void reset_phy(void)
/* reset the phy */
miiphy_reset(name, devadr);
 
-   printf("88E1116 Initialized on %s\n", name);
+   printf(PHY_NO" Initialized on %s\n", name);
+}
+
+void reset_phy(void)
+{
+   mv_phy_init("egiga0");
+
+#ifdef CONFIG_BOARD_IS_OPENRD_CLIENT
+   /* Kirkwood ethernet driver is written with the assumption that in case
+* of multiple PHYs, their addresses are consecutive. But unfortunately
+* in case of OpenRD-Client, PHY addresses are not consecutive.*/
+   miiphy_write("egiga1", 0xEE, 0xEE, 24);
+#endif
+
+#if defined(CONFIG_BOARD_IS_OPENRD_CLIENT) || \
+   defined(CONFIG_BOARD_IS_OPENRD_ULTIMATE)
+   /* configure and initialize both PHY's */
+   mv_phy_init("egiga1");
+#endif
 }
 #endif /* CONFIG_RESET_PHY_R */
diff --git a/include/configs/openrd.h b/include/configs/openrd.h
index 7299749..8d86067 100644
--- a/include/configs/openrd.h
+++ b/include/configs/openrd.h
@@ -117,8 +117,18 @@
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_MVGBE_PORTS {1, 0}  /* enable port 0 only */
-#define CONFIG_PHY_BASE_ADR0x8
+# ifdef CONFIG_BOARD_IS_OPENRD_BASE
+#  define CONFIG_MVGBE_PORTS   {1, 0}  /* enable port 0 only */
+# else
+#  define CONFIG_MVGBE_PORTS   {1, 1}  /* enable both ports */
+# endif
+# ifdef CONFIG_BOARD_IS_OPENRD_ULTIMATE
+#  define CONFIG_PHY_BASE_ADR  0x0
+#  define PHY_NO   "88E1121"
+# else
+#  define CONFIG_PHY_BASE_ADR  0x8
+#  define PHY_NO   "88E1116"
+# endif
 #endif /* CONFIG_CMD_NET */
 
 /*
-- 
1.7.4.4

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


[U-Boot] [PATCH v5 2/4] Add definitions for OpenRD-Client and OpenRD-Ultimate

2011-05-03 Thread Clint Adams
Signed-off-by: Clint Adams 
Cc: Albert ARIBAUD 
Cc: Prafulla Wadaskar 
Cc: Julian Pidancet 
---
 MAKEALL   |2 ++
 board/Marvell/openrd/openrd.c |6 ++
 boards.cfg|2 ++
 include/configs/openrd.h  |   14 +-
 4 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index c3df657..d592374 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -361,6 +361,8 @@ LIST_ARM9=" \
omap5912osk \
omap730p2   \
openrd_base \
+   openrd_client   \
+   openrd_ultimate \
rd6281a \
sbc2410x\
scb9328 \
diff --git a/board/Marvell/openrd/openrd.c b/board/Marvell/openrd/openrd.c
index e53fa16..14ca88e 100644
--- a/board/Marvell/openrd/openrd.c
+++ b/board/Marvell/openrd/openrd.c
@@ -110,7 +110,13 @@ int board_init(void)
/*
 * arch number of board
 */
+#if defined(CONFIG_BOARD_IS_OPENRD_BASE)
gd->bd->bi_arch_number = MACH_TYPE_OPENRD_BASE;
+#elif defined(CONFIG_BOARD_IS_OPENRD_CLIENT)
+   gd->bd->bi_arch_number = MACH_TYPE_OPENRD_CLIENT;
+#elif defined(CONFIG_BOARD_IS_OPENRD_ULTIMATE)
+   gd->bd->bi_arch_number = MACH_TYPE_OPENRD_ULTIMATE;
+#endif
 
/* adress of boot parameters */
gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
diff --git a/boards.cfg b/boards.cfg
index 4452de7..fd8ae8f 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -107,6 +107,8 @@ suen3arm arm926ejs   km_arm 
 keymile
 guruplug arm arm926ejs   -   
Marvellkirkwood
 mv88f6281gtw_ge  arm arm926ejs   -   
Marvellkirkwood
 openrd_base  arm arm926ejs   openrd  
Marvellkirkwoodopenrd:BOARD_IS_OPENRD_BASE
+openrd_clientarm arm926ejs   openrd  
Marvellkirkwoodopenrd:BOARD_IS_OPENRD_CLIENT
+openrd_ultimate  arm arm926ejs   openrd  
Marvellkirkwoodopenrd:BOARD_IS_OPENRD_ULTIMATE
 rd6281a  arm arm926ejs   -   
Marvellkirkwood
 sheevaplug   arm arm926ejs   -   
Marvellkirkwood
 dockstar arm arm926ejs   -   
Seagatekirkwood
diff --git a/include/configs/openrd.h b/include/configs/openrd.h
index 13dc34c..7299749 100644
--- a/include/configs/openrd.h
+++ b/include/configs/openrd.h
@@ -33,7 +33,19 @@
 /*
  * Version number information
  */
-#define CONFIG_IDENT_STRING"\nOpenRD_base"
+#ifdef CONFIG_BOARD_IS_OPENRD_ULTIMATE
+# define CONFIG_IDENT_STRING   "\nOpenRD-Ultimate"
+#else
+# ifdef CONFIG_BOARD_IS_OPENRD_CLIENT
+#  define CONFIG_IDENT_STRING  "\nOpenRD-Client"
+# else
+#  ifdef CONFIG_BOARD_IS_OPENRD_BASE
+#   define CONFIG_IDENT_STRING "\nOpenRD-Base"
+#  else
+#   error Unknown OpenRD board specified
+#  endif
+# endif
+#endif
 
 /*
  * High Level Configuration Options (easy to change)
-- 
1.7.4.4

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


[U-Boot] [PATCH v5 1/4] Rename openrd_base files to openrd

2011-05-03 Thread Clint Adams
Signed-off-by: Clint Adams 
Cc: Albert ARIBAUD 
Cc: Prafulla Wadaskar 
Cc: Julian Pidancet 
---
 board/Marvell/{openrd_base => openrd}/Makefile |2 +-
 board/Marvell/{openrd_base => openrd}/kwbimage.cfg |0
 .../{openrd_base/openrd_base.c => openrd/openrd.c} |2 +-
 .../{openrd_base/openrd_base.h => openrd/openrd.h} |0
 boards.cfg |2 +-
 include/configs/{openrd_base.h => openrd.h}|4 ++--
 6 files changed, 5 insertions(+), 5 deletions(-)
 rename board/Marvell/{openrd_base => openrd}/Makefile (98%)
 rename board/Marvell/{openrd_base => openrd}/kwbimage.cfg (100%)
 rename board/Marvell/{openrd_base/openrd_base.c => openrd/openrd.c} (99%)
 rename board/Marvell/{openrd_base/openrd_base.h => openrd/openrd.h} (100%)
 rename include/configs/{openrd_base.h => openrd.h} (98%)

diff --git a/board/Marvell/openrd_base/Makefile b/board/Marvell/openrd/Makefile
similarity index 98%
rename from board/Marvell/openrd_base/Makefile
rename to board/Marvell/openrd/Makefile
index d6d0ed3..19020e4 100644
--- a/board/Marvell/openrd_base/Makefile
+++ b/board/Marvell/openrd/Makefile
@@ -31,7 +31,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS  := openrd_base.o
+COBJS  := openrd.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/Marvell/openrd_base/kwbimage.cfg 
b/board/Marvell/openrd/kwbimage.cfg
similarity index 100%
rename from board/Marvell/openrd_base/kwbimage.cfg
rename to board/Marvell/openrd/kwbimage.cfg
diff --git a/board/Marvell/openrd_base/openrd_base.c 
b/board/Marvell/openrd/openrd.c
similarity index 99%
rename from board/Marvell/openrd_base/openrd_base.c
rename to board/Marvell/openrd/openrd.c
index 10109c1..e53fa16 100644
--- a/board/Marvell/openrd_base/openrd_base.c
+++ b/board/Marvell/openrd/openrd.c
@@ -31,7 +31,7 @@
 #include 
 #include 
 #include 
-#include "openrd_base.h"
+#include "openrd.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/Marvell/openrd_base/openrd_base.h 
b/board/Marvell/openrd/openrd.h
similarity index 100%
rename from board/Marvell/openrd_base/openrd_base.h
rename to board/Marvell/openrd/openrd.h
diff --git a/boards.cfg b/boards.cfg
index 8b44006..4452de7 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -106,7 +106,7 @@ davinci_sonata   arm arm926ejs   sonata 
 davinci
 suen3arm arm926ejs   km_arm  
keymilekirkwood
 guruplug arm arm926ejs   -   
Marvellkirkwood
 mv88f6281gtw_ge  arm arm926ejs   -   
Marvellkirkwood
-openrd_base  arm arm926ejs   -   
Marvellkirkwood
+openrd_base  arm arm926ejs   openrd  
Marvellkirkwoodopenrd:BOARD_IS_OPENRD_BASE
 rd6281a  arm arm926ejs   -   
Marvellkirkwood
 sheevaplug   arm arm926ejs   -   
Marvellkirkwood
 dockstar arm arm926ejs   -   
Seagatekirkwood
diff --git a/include/configs/openrd_base.h b/include/configs/openrd.h
similarity index 98%
rename from include/configs/openrd_base.h
rename to include/configs/openrd.h
index cfdd09c..13dc34c 100644
--- a/include/configs/openrd_base.h
+++ b/include/configs/openrd.h
@@ -27,8 +27,8 @@
  * MA 02110-1301 USA
  */
 
-#ifndef _CONFIG_OPENRD_BASE_H
-#define _CONFIG_OPENRD_BASE_H
+#ifndef _CONFIG_OPENRD_H
+#define _CONFIG_OPENRD_H
 
 /*
  * Version number information
-- 
1.7.4.4

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


[U-Boot] [PATCH v5 0/4] OpenRD-Client and OpenRD-Ultimate support

2011-05-03 Thread Clint Adams
Changes for v5:
   - rebase against current u-boot-marvell.git/master

Clint Adams (4):
  Rename openrd_base files to openrd
  Add definitions for OpenRD-Client and OpenRD-Ultimate
  Initialize second PHY on OpenRD-Client and OpenRD-Ultimate
  Enable multiple fs options for Marvell SoC family on OpenRD boards

 MAKEALL|2 +
 board/Marvell/{openrd_base => openrd}/Makefile |2 +-
 board/Marvell/{openrd_base => openrd}/kwbimage.cfg |0
 .../{openrd_base/openrd_base.c => openrd/openrd.c} |   33 +---
 .../{openrd_base/openrd_base.h => openrd/openrd.h} |0
 boards.cfg |4 ++-
 include/configs/{openrd_base.h => openrd.h}|   33 +---
 7 files changed, 62 insertions(+), 12 deletions(-)
 rename board/Marvell/{openrd_base => openrd}/Makefile (98%)
 rename board/Marvell/{openrd_base => openrd}/kwbimage.cfg (100%)
 rename board/Marvell/{openrd_base/openrd_base.c => openrd/openrd.c} (80%)
 rename board/Marvell/{openrd_base/openrd_base.h => openrd/openrd.h} (100%)
 rename include/configs/{openrd_base.h => openrd.h} (81%)

-- 
1.7.4.4

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


Re: [U-Boot] [PATCH 2/2] powerpc/85xx: verify the device tree before booting Linux

2011-05-03 Thread Timur Tabi
On May 3, 2011, at 9:21 AM, Kumar Gala  wrote:

>> 
>> +
>> +ft_verify_fdt(*of_flat_tree);
> 
> Do we not want to error out here if verify fails?

Maybe.  I didn't want a false negative to prevent booting.  If the DT is wrong, 
the kernel won't display any messages, so the warning will be the last thing 
the user sees anyway.

If the consensus is that failure should abort, then I can add that.  I don't 
have a strong preference either way.
> 

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


Re: [U-Boot] [PATCH 2/2] powerpc/85xx: verify the device tree before booting Linux

2011-05-03 Thread Kumar Gala
> diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
> index e01787d..53b9b27 100644
> --- a/arch/powerpc/lib/bootm.c
> +++ b/arch/powerpc/lib/bootm.c
> @@ -226,6 +226,23 @@ static int boot_bd_t_linux(bootm_headers_t *images)
>   return ret;
> }
> 
> +/*
> + * Verify the device tree.
> + *
> + * This function is called after all device tree fix-ups have been enacted,
> + * so that the final device tree can be verified.  The definition of 
> "verified"
> + * is up to the specific implementation.  However, it generally means that 
> the
> + * addresses of some of the devices in the device tree are compared with the
> + * actual addresses at which U-Boot has placed them.
> + *
> + * The function should display warning messages for any problems it finds.
> + * U-Boot will still attempt to boot the operating system, however.
> + */
> +static void __ft_verify_fdt(void *fdt)
> +{
> +}
> +__attribute__((weak, alias("__ft_verify_fdt"))) void ft_verify_fdt(void 
> *fdt);
> +
> static int boot_body_linux(bootm_headers_t *images)
> {
>   ulong rd_len;
> @@ -296,6 +313,8 @@ static int boot_body_linux(bootm_headers_t *images)
>   /* fixup the initrd now that we know where it should be */
>   if (*initrd_start && *initrd_end)
>   fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 
> 1);
> +
> + ft_verify_fdt(*of_flat_tree);

Do we not want to error out here if verify fails?

>   }
> #endif/* CONFIG_OF_LIBFDT */
>   return 0;
> -- 
> 1.7.3.4

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


[U-Boot] [PATCH v2 8/8] arm/km: update mgcoge3un board support

2011-05-03 Thread Valentin Longchamp
From: Holger Brunck 

Add wait for the GPIO line connected to mgcoge3ne before
starting mgcoge3un. A board specific ethernet present function
was added, because on this board ethernet is always present.
The BOCO FPGA access was enhanced and changed to use register
definitions.

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
cc: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series

 board/keymile/km_arm/km_arm.c |   80 +---
 1 files changed, 66 insertions(+), 14 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 4049a4e..d86acc9 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -41,6 +41,16 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * BOCO FPGA definitions
+ */
+#define BOCO   0x10
+#define REG_CTRL_H 0x02
+#define MASK_WRL_UNITRUN   0x01
+#define MASK_RBX_PGY_PRESENT   0x40
+#define REG_IRQ_CIRQ2  0x2d
+#define MASK_RBI_DEFECT_16 0x01
+
 /* Multi-Purpose Pins Functionality configuration */
 u32 kwmpp_config[] = {
MPP0_NF_IO2,
@@ -102,43 +112,64 @@ u32 kwmpp_config[] = {
0
 };
 
+#if defined(CONFIG_MGCOGE3UN)
+/*
+ * Wait for startup OK from mgcoge3ne
+ */
+int startup_allowed(void)
+{
+   unsigned char buf;
+
+   /*
+* Read CIRQ16 bit (bit 0)
+*/
+   if (i2c_read(BOCO, REG_IRQ_CIRQ2, 1, &buf, 1) != 0)
+   printf("%s: Error reading Boco\n", __func__);
+   else
+   if ((buf & MASK_RBI_DEFECT_16) == MASK_RBI_DEFECT_16)
+   return 1;
+   return 0;
+}
+
+/*
+ * mgcoge3un has always ethernet present. Its connected to the 6061 switch
+ * and provides ICNev and piggy4 connections.
+ */
+int ethernet_present(void)
+{
+   return 1;
+}
+#else
 int ethernet_present(void)
 {
uchar   buf;
int ret = 0;
 
-   if (i2c_read(0x10, 2, 1, &buf, 1) != 0) {
+   if (i2c_read(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) {
printf("%s: Error reading Boco\n", __func__);
return -1;
}
-   if ((buf & 0x40) == 0x40)
+   if ((buf & MASK_RBX_PGY_PRESENT) == MASK_RBX_PGY_PRESENT)
ret = 1;
 
return ret;
 }
+#endif
 
 int initialize_unit_leds(void)
 {
/*
-* init the unit LEDs
-* per default they all are
+* Init the unit LEDs per default they all are
 * ok apart from bootstat
-* LED connected through BOCO
-* BOCO lies at the address  0x10
-* LEDs are in the block CTRL_H (addr 0x02)
-* BOOTSTAT LED is the first 0x01
 */
-   #define BOCO0x10
-   #define CTRL_H  0x02
-   #define APPLEDMASK  0x01
uchar buf;
 
-   if (i2c_read(BOCO, CTRL_H, 1, &buf, 1) != 0) {
+   if (i2c_read(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) {
printf("%s: Error reading Boco\n", __func__);
return -1;
}
-   buf |= APPLEDMASK;
-   if (i2c_write(BOCO, CTRL_H, 1, &buf, 1) != 0) {
+   buf |= MASK_WRL_UNITRUN;
+   if (i2c_write(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) {
printf("%s: Error writing Boco\n", __func__);
return -1;
}
@@ -167,6 +198,27 @@ int misc_init_r(void)
printf("Overwriting MACH_TYPE with %d!!!\n", mach_type);
gd->bd->bi_arch_number = mach_type;
}
+#if defined(CONFIG_MGCOGE3UN)
+   char *wait_for_ne;
+   wait_for_ne = getenv("waitforne");
+   if (wait_for_ne != NULL) {
+   if (strcmp(wait_for_ne, "true") == 0) {
+   int cnt = 0;
+   puts("NE go: ");
+   while (startup_allowed() == 0) {
+   udelay(20);
+   cnt++;
+   if (cnt == 5)
+   puts("wait\b\b\b\b");
+   if (cnt == 10) {
+   cnt = 0;
+   puts("\b\b\b\b");
+   }
+   }
+   puts("OK\n");
+   }
+   }
+#endif
 
initialize_unit_leds();
set_km_env();
-- 
1.7.0.5

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


[U-Boot] [PATCH v2 7/8] arm/km: change default settings for egiga on mgcoge3un

2011-05-03 Thread Valentin Longchamp
From: Holger Brunck 

The reason we need this is that we have the gig port on mgcoge3un
connected using a back-to-back pair of PHYs. There are no magnetics and
because of that the port has to be run with a fixd configuration and
auto-negotiation must be disabled. In the default mode the egiga driver
uses autoneg to determine port speed - which defaults to 1G (we need
100M full duplex).

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
Acked-by: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series

 drivers/net/mvgbe.h |2 ++
 include/configs/mgcoge3un.h |   25 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/net/mvgbe.h b/drivers/net/mvgbe.h
index 3de98d0..d8a5429 100644
--- a/drivers/net/mvgbe.h
+++ b/drivers/net/mvgbe.h
@@ -84,6 +84,7 @@
MVGBE_TX_BURST_SIZE_16_64BIT)
 
 /* Default port serial control value */
+#ifndef PORT_SERIAL_CONTROL_VALUE
 #define PORT_SERIAL_CONTROL_VALUE  ( \
MVGBE_FORCE_LINK_PASS   | \
MVGBE_DIS_AUTO_NEG_FOR_DUPLX| \
@@ -101,6 +102,7 @@
MVGBE_CLR_EXT_LOOPBACK  | \
MVGBE_SET_FULL_DUPLEX_MODE  | \
MVGBE_DIS_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX)
+#endif
 
 /* Tx WRR confoguration macros */
 #define PORT_MAX_TRAN_UNIT 0x24/* MTU register (default) 9KByte */
diff --git a/include/configs/mgcoge3un.h b/include/configs/mgcoge3un.h
index 0d19da4..6f8 100644
--- a/include/configs/mgcoge3un.h
+++ b/include/configs/mgcoge3un.h
@@ -48,6 +48,31 @@
 #define KM_ENV_BUS "pca9547:70:d" /* I2C2 (Mux-Port 5)*/
 
 /*
+ * mgcoge3un has a fixed link to the marvell switch
+ * with 100MB full duplex and autoneg off, for this
+ * reason we have to change the default settings
+ */
+#define PORT_SERIAL_CONTROL_VALUE  ( \
+   MVGBE_FORCE_LINK_PASS   | \
+   MVGBE_DIS_AUTO_NEG_FOR_DUPLX| \
+   MVGBE_DIS_AUTO_NEG_FOR_FLOW_CTRL| \
+   MVGBE_ADV_NO_FLOW_CTRL  | \
+   MVGBE_FORCE_FC_MODE_NO_PAUSE_DIS_TX | \
+   MVGBE_FORCE_BP_MODE_NO_JAM  | \
+   (1 << 9) /* Reserved bit has to be 1 */ | \
+   MVGBE_DO_NOT_FORCE_LINK_FAIL| \
+   MVGBE_DIS_AUTO_NEG_SPEED_GMII   | \
+   MVGBE_DTE_ADV_0 | \
+   MVGBE_MIIPHY_MAC_MODE   | \
+   MVGBE_AUTO_NEG_NO_CHANGE| \
+   MVGBE_MAX_RX_PACKET_1552BYTE| \
+   MVGBE_CLR_EXT_LOOPBACK  | \
+   MVGBE_SET_FULL_DUPLEX_MODE  | \
+   MVGBE_DIS_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX|\
+   MVGBE_SET_GMII_SPEED_TO_10_100  |\
+   MVGBE_SET_MII_SPEED_TO_100)
+
+/*
  * Default environment variables
  */
 #define CONFIG_EXTRA_ENV_SETTINGS  \
-- 
1.7.0.5

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


[U-Boot] [PATCH v2 6/8] arm/km: rename mgcoge2un to mgcoge3un

2011-05-03 Thread Valentin Longchamp
From: Holger Brunck 

The mgcoge2un target was only an intermediate step to mgcoge3un.
For this reason the mgcoge2un support was moved to mgcoge3un,
because it isn't needed to support both targets.

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
cc: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series

 MAINTAINERS  |8 
 boards.cfg   |2 +-
 include/configs/{mgcoge2un.h => mgcoge3un.h} |   10 +-
 3 files changed, 10 insertions(+), 10 deletions(-)
 rename include/configs/{mgcoge2un.h => mgcoge3un.h} (92%)

diff --git a/MAINTAINERS b/MAINTAINERS
index e2a4ba9..2dd1f8d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -429,14 +429,11 @@ Heiko Schocher 
kmeter1 MPC8360
kmsupx5 MPC8321
mgcoge  MPC8247
-   mgcoge2ne   MPC8247
-   mgcoge2un   ARM926EJS (Kirkwood SoC)
+   mgcoge3ne   MPC8247
mucmc52 MPC5200
muas3001MPC8270
municse MPC5200
sc3 PPC405GP
-   suen3   ARM926EJS (Kirkwood SoC)
-   suen8   ARM926EJS (Kirkwood SoC)
suvd3   MPC8321
tuda1   MPC8321
tuxa1   MPC8321
@@ -814,6 +811,9 @@ Jens Scharsig 
 Heiko Schocher 
 
magnesium   i.MX27
+   mgcoge3un   ARM926EJS (Kirkwood SoC)
+   suen3   ARM926EJS (Kirkwood SoC)
+   suen8   ARM926EJS (Kirkwood SoC)
 
 Robert Schwebel 
 
diff --git a/boards.cfg b/boards.cfg
index 2b0900a..2d36c52 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -105,7 +105,7 @@ davinci_sffsdr   arm arm926ejs   sffsdr 
 davinci
 davinci_sonata   arm arm926ejs   sonata  
davincidavinci
 suen3arm arm926ejs   km_arm  
keymilekirkwood
 suen8arm arm926ejs   km_arm  
keymilekirkwood
-mgcoge2unarm arm926ejs   km_arm  
keymilekirkwood
+mgcoge3unarm arm926ejs   km_arm  
keymilekirkwood
 guruplug arm arm926ejs   -   
Marvellkirkwood
 mv88f6281gtw_ge  arm arm926ejs   -   
Marvellkirkwood
 openrd_base  arm arm926ejs   -   
Marvellkirkwood
diff --git a/include/configs/mgcoge2un.h b/include/configs/mgcoge3un.h
similarity index 92%
rename from include/configs/mgcoge2un.h
rename to include/configs/mgcoge3un.h
index d3c7bdc..0d19da4 100644
--- a/include/configs/mgcoge2un.h
+++ b/include/configs/mgcoge3un.h
@@ -31,8 +31,8 @@
 /* for linking errors see
  * http://lists.denx.de/pipermail/u-boot/2009-July/057350.html */
 
-#ifndef _CONFIG_MGCOGE2UN_H
-#define _CONFIG_MGCOGE2UN_H
+#ifndef _CONFIG_MGCOGE3UN_H
+#define _CONFIG_MGCOGE3UN_H
 
 /* include common defines/options for all arm based Keymile boards */
 #include "km_arm.h"
@@ -40,9 +40,9 @@
 /*
  * Version number information
  */
-#define CONFIG_IDENT_STRING"\nKeymile MGCOGE2UN"
-
-#define CONFIG_HOSTNAMEmgcoge2un
+#define CONFIG_IDENT_STRING"\nKeymile MGCOGE3UN"
+#define CONFIG_HOSTNAMEmgcoge3un
+#define CONFIG_MGCOGE3UN
 
 #define KM_IVM_BUS "pca9547:70:9" /* I2C2 (Mux-Port 1)*/
 #define KM_ENV_BUS "pca9547:70:d" /* I2C2 (Mux-Port 5)*/
-- 
1.7.0.5

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


[U-Boot] [PATCH v2 5/8] arm/km: add second serial interface for kirkwood

2011-05-03 Thread Valentin Longchamp
From: Holger Brunck 

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
cc: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series

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

diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h
index a8a4d77..06f91fe 100644
--- a/include/configs/km_arm.h
+++ b/include/configs/km_arm.h
@@ -92,6 +92,7 @@
 #define CONFIG_SYS_NS16550_REG_SIZE(-4)
 #define CONFIG_SYS_NS16550_CLK CONFIG_SYS_TCLK
 #define CONFIG_SYS_NS16550_COM1KW_UART0_BASE
+#define CONFIG_SYS_NS16550_COM2KW_UART1_BASE
 
 /*
  * Serial Port configuration
@@ -136,7 +137,12 @@
 
 #define BOOTFLASH_START0x0
 
+/* Kirkwood has two serial IF */
+#if (CONFIG_CONS_INDEX == 2)
+#define CONFIG_KM_CONSOLE_TTY  "ttyS1"
+#else
 #define CONFIG_KM_CONSOLE_TTY  "ttyS0"
+#endif
 
 /* size in bytes reserved for initial data */
 
-- 
1.7.0.5

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


[U-Boot] [PATCH v2 3/8] arm/km: add BootROM config file for memphis SDRAM

2011-05-03 Thread Valentin Longchamp
This RAM is used on mgcoge3un and needs other initialization values
for the SDRAM controller.

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
cc: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series

 board/keymile/km_arm/kwbimage-memphis.cfg |  197 +
 1 files changed, 197 insertions(+), 0 deletions(-)
 create mode 100644 board/keymile/km_arm/kwbimage-memphis.cfg

diff --git a/board/keymile/km_arm/kwbimage-memphis.cfg 
b/board/keymile/km_arm/kwbimage-memphis.cfg
new file mode 100644
index 000..2faaf2b
--- /dev/null
+++ b/board/keymile/km_arm/kwbimage-memphis.cfg
@@ -0,0 +1,197 @@
+#
+# (C) Copyright 2010
+# Heiko Schocher, DENX Software Engineering, h...@denx.de.
+#
+# (C) Copyright 2011
+# Valentin Longchamp, Keymile AG, valentin.longch...@keymile.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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM  spi # Boot from SPI flash
+
+DATA 0xFFD1 0x0111 # MPP Control 0 Register
+# bit 3-0:   MPPSel0   2, NF_IO[2]
+# bit 7-4:   MPPSel1   2, NF_IO[3]
+# bit 12-8:  MPPSel2   2, NF_IO[4]
+# bit 15-12: MPPSel3   2, NF_IO[5]
+# bit 19-16: MPPSel4   1, NF_IO[6]
+# bit 23-20: MPPSel5   1, NF_IO[7]
+# bit 27-24: MPPSel6   1, SYSRST_O
+# bit 31-28: MPPSel7   0, GPO[7]
+
+DATA 0xFFD10004 0x03303300
+
+DATA 0xFFD10008 0x1100 # MPP Control 2 Register
+# bit 3-0:   MPPSel16  0, GPIO[16]
+# bit 7-4:   MPPSel17  0, GPIO[17]
+# bit 12-8:  MPPSel18  1, NF_IO[0]
+# bit 15-12: MPPSel19  1, NF_IO[1]
+# bit 19-16: MPPSel20  0, GPIO[20]
+# bit 23-20: MPPSel21  0, GPIO[21]
+# bit 27-24: MPPSel22  0, GPIO[22]
+# bit 31-28: MPPSel23  0, GPIO[23]
+
+DATA 0xFFD100E0 0x1B1B1B1B # IO Configuration 0 Register
+DATA 0xFFD20134 0x # L2 RAM Timing 0 Register
+DATA 0xFFD20138 0x # L2 RAM Timing 1 Register
+DATA 0xFFD20154 0x0200 # CPU RAM Management Control3 Register
+DATA 0xFFD2014C 0x1C00 # CPU RAM Management Control1 Register
+DATA 0xFFD20148 0x0001 # CPU RAM Management Control0 Register
+
+#Dram initalization
+DATA 0xFFD01400 0x430004E0 # SDRAM Configuration Register
+# bit13-0:  0x4E0 (DDR2 clks refresh rate)
+# bit23-14: zero
+# bit24: 1= enable exit self refresh mode on DDR access
+# bit25: 1 required
+# bit29-26: zero
+# bit31-30: 01
+
+DATA 0xFFD01404 0x38543000 # DDR Controller Control Low
+# bit 3-0:  0 reserved
+# bit 4:0=addr/cmd in smame cycle
+# bit 5:0=clk is driven during self refresh, we don't care for APX
+# bit 6:0=use recommended falling edge of clk for addr/cmd
+# bit14:0=input buffer always powered up
+# bit18:1=cpu lock transaction enabled
+# bit23-20: 5=recommended value for CL=4 and STARTBURST_DEL disabled bit31=0
+# bit27-24: 8= CL+4, STARTBURST sample stages, for freqs 400MHz, unbuffered 
DIMM
+# bit30-28: 3 required
+# bit31:0=no additional STARTBURST delay
+
+DATA 0xFFD01408 0x2302433E # DDR Timing (Low) (active cycles value +1)
+# bit3-0:   TRAS lsbs
+# bit7-4:   TRCD
+# bit11- 8: TRP
+# bit15-12: TWR
+# bit19-16: TWTR
+# bit20:TRAS msb
+# bit23-21: 0x0
+# bit27-24: TRRD
+# bit31-28: TRTP
+
+DATA 0xFFD0140C 0x0A3E #  DDR Timing (High)
+# bit6-0:   TRFC
+# bit8-7:   TR2R
+# bit10-9:  TR2W
+# bit12-11: TW2W
+# bit31-13: zero required
+
+DATA 0xFFD01410 0x0001 #  DDR Address Control
+# bit1-0:   01, Cs0width=x16
+# bit3-2:   00, Cs0size=2Gb
+# bit5-4:   00, Cs2width=nonexistent
+# bit7-6:   00, Cs1size =nonexistent
+# bit9-8:   00, Cs2width=nonexistent
+# bit11-10: 00, Cs2size =nonexistent
+# bit13-12: 00, Cs3width=nonexistent
+# bit15-14: 00, Cs3size =nonexistent
+# bit16:0,  Cs0AddrSel
+# bit17:0,  Cs1AddrSel
+# bit18:0,  Cs2AddrSel
+# bit19:0,  Cs3AddrSel
+# bit31-20: 0 required
+
+DATA 0xFFD01414 0x #  DDR Open Pages Control
+# bit0:0,  OpenPage enabled
+# bit31-1: 0 required
+
+DATA 0xFFD01418 0x #  DDR Operation
+# bit3-0:   0x0, DDR cmd
+# bit31-4:  0 required
+
+DATA 

[U-Boot] [PATCH v2 4/8] arm/km: disable ls (through jffs2 support)

2011-05-03 Thread Valentin Longchamp
This is not supported on our km-arm boards since we have defined
CONFIG_SYS_NO_FLASH for our NAND Flash chip.

With CONFIG_CMD_JFFS2, the ls command is present and works very badly
on our km-arm boards.

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
cc: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series

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

diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h
index 89f9d35..a8a4d77 100644
--- a/include/configs/km_arm.h
+++ b/include/configs/km_arm.h
@@ -248,6 +248,7 @@ int get_scl (void);
 #if defined(CONFIG_SYS_NO_FLASH)
 #define CONFIG_KM_UBI_PARTITION_NAME   "ubi0"
 #undef CONFIG_FLASH_CFI_MTD
+#undef CONFIG_CMD_JFFS2
 #undef CONFIG_JFFS2_CMDLINE
 #endif
 
-- 
1.7.0.5

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


[U-Boot] [PATCH v2 2/8] arm/km: remove last_stage_init and unneeded printouts

2011-05-03 Thread Valentin Longchamp
From: Holger Brunck 

last_stage_init is not available for arm platforms. So move
the calls to set_km_var and set_bootcount_addr to misc_init_r
and remove this function.

Additionally some unneeded printouts were removed.

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
cc: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series

 board/keymile/km_arm/km_arm.c |   20 
 1 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index f147f1f..4049a4e 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -161,11 +161,6 @@ int misc_init_r(void)
char *str;
int mach_type;
 
-   puts("Piggy:");
-   if (ethernet_present() == 0)
-   puts (" not");
-   puts(" present\n");
-
str = getenv("mach_type");
if (str != NULL) {
mach_type = simple_strtoul(str, NULL, 10);
@@ -174,7 +169,10 @@ int misc_init_r(void)
}
 
initialize_unit_leds();
-
+   set_km_env();
+#if defined(CONFIG_BOOTCOUNT_LIMIT)
+   set_bootcount_addr();
+#endif
return 0;
 }
 
@@ -193,7 +191,6 @@ int board_early_init_f(void)
writel(tmp | FLASH_GPIO_PIN , KW_GPIO0_BASE);
tmp = readl(KW_GPIO0_BASE + 4);
writel(tmp & (~FLASH_GPIO_PIN) , KW_GPIO0_BASE + 4);
-   printf("KM: setting NAND mode\n");
 
 #if defined(CONFIG_SOFT_I2C)
/* init the GPIO for I2C Bitbang driver */
@@ -223,15 +220,6 @@ int board_init(void)
return 0;
 }
 
-int last_stage_init(void)
-{
-   set_km_env();
-#if defined(CONFIG_BOOTCOUNT_LIMIT)
-   set_bootcount_addr();
-#endif
-   return 0;
-}
-
 #if defined(CONFIG_CMD_SF)
 int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-- 
1.7.0.5

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


[U-Boot] [PATCH v2 1/8] arm/km: introduce and manage bootcount environment variable

2011-05-03 Thread Valentin Longchamp
This environment variable is used to set the bootcount address
for the kernel.

Signed-off-by: Valentin Longchamp 
Signed-off-by: Holger Brunck 
Acked-by: Heiko Schocher 
cc: Prafulla Wadaskar 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch series to three independent smaller
 patch series
   - taken Wolfgang Denk's comments into account

 board/keymile/km_arm/km_arm.c |   14 ++
 include/configs/km_arm.h  |3 +++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index c772ee2..f147f1f 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -145,6 +145,17 @@ int initialize_unit_leds(void)
return 0;
 }
 
+#if defined(CONFIG_BOOTCOUNT_LIMIT)
+void set_bootcount_addr(void)
+{
+   uchar buf[32];
+   unsigned int bootcountaddr;
+   bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR;
+   sprintf((char *)buf, "0x%x", bootcountaddr);
+   setenv("bootcountaddr", (char *)buf);
+}
+#endif
+
 int misc_init_r(void)
 {
char *str;
@@ -215,6 +226,9 @@ int board_init(void)
 int last_stage_init(void)
 {
set_km_env();
+#if defined(CONFIG_BOOTCOUNT_LIMIT)
+   set_bootcount_addr();
+#endif
return 0;
 }
 
diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h
index 70113d4..89f9d35 100644
--- a/include/configs/km_arm.h
+++ b/include/configs/km_arm.h
@@ -64,6 +64,9 @@
 #define CONFIG_KM_KERNEL_ADDR  0x200   /* 4096KBytes */
 
 #define CONFIG_KM_DEF_ENV_CPU  \
+   "addbootcount=" \
+   "setenv bootargs ${bootargs} "  \
+   "bootcountaddr=${bootcountaddr}\0"  \
"addmtdparts=setenv bootargs ${bootargs} ${mtdparts}\0" \
"boot=bootm ${actual_kernel_addr} - -\0"\
"cramfsloadfdt=echo c\0"\
-- 
1.7.0.5

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


[U-Boot] [PATCH v2 0/8] keymile arm boards update, part 2

2011-05-03 Thread Valentin Longchamp
This series is the second effort of merging the Keymile boards support
back into mainline.

This series is a subset of the first patch series:
http://lists.denx.de/pipermail/u-boot/2011-April/090013.html
The first large series was split up to three independent series, which
are easier to review and apply for the custodians.

This series adds the km_arm specific parts of the series. All its changes
concern our marvell based boards and that's why it should go through the
u-boot-marvell git tree.

Holger Brunck (5):
  arm/km: remove last_stage_init and unneeded printouts
  arm/km: add second serial interface for kirkwood
  arm/km: rename mgcoge2un to mgcoge3un
  arm/km: change default settings for egiga on mgcoge3un
  arm/km: update mgcoge3un board support

Valentin Longchamp (3):
  arm/km: introduce and manage bootcount environment variable
  arm/km: add BootROM config file for memphis SDRAM
  arm/km: disable ls (through jffs2 support)

 MAINTAINERS  |8 +-
 board/keymile/km_arm/km_arm.c|  108 +++
 board/keymile/km_arm/kwbimage-memphis.cfg|  197 ++
 boards.cfg   |2 +-
 drivers/net/mvgbe.h  |2 +
 include/configs/km_arm.h |   10 ++
 include/configs/{mgcoge2un.h => mgcoge3un.h} |   35 -
 7 files changed, 325 insertions(+), 37 deletions(-)
 create mode 100644 board/keymile/km_arm/kwbimage-memphis.cfg
 rename include/configs/{mgcoge2un.h => mgcoge3un.h} (66%)

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


Re: [U-Boot] [PATCH v5 5/5] Add support for Network Space v2

2011-05-03 Thread Simon Guinot
Hi Wolfgang,

I have failed to find an entry for this patch in the U-Boot patchwork
(and any previous version except the very first).

Have I missed something and/or done something wrong ?

Regards,

Simon

On Tue, May 03, 2011 at 12:42:28AM +0200, Simon Guinot wrote:
> From: Simon Guinot 
> 
> This patch add support for the Network Space v2 board and parents, based
> on the Marvell Kirkwood SoC. This include Network Space (Max) v2 and
> Internet Space v2.
> 
> Signed-off-by: Simon Guinot 
> ---
> Changes for v2:
>   - add entries to MAINTAINERS file
>   - move boards from root Makefile to boards.cfg
>   - move MACH_TYPE definition into netspace_v2.h
>   - remove CONFIG_SYS_HZ redefinition
>   - turn PHY initialization message into debug()
> 
> Changes for v3: none
> 
> Changes for v4: 
>   - enhance commit message: add SoC information
> 
> Changes for v5: none
> 
>  MAINTAINERS   |6 +
>  board/LaCie/netspace_v2/Makefile  |   49 ++
>  board/LaCie/netspace_v2/kwbimage.cfg  |  162 
> +
>  board/LaCie/netspace_v2/netspace_v2.c |  144 +
>  board/LaCie/netspace_v2/netspace_v2.h |   39 
>  boards.cfg|3 +
>  include/configs/netspace_v2.h |  149 ++
>  7 files changed, 552 insertions(+), 0 deletions(-)
>  create mode 100644 board/LaCie/netspace_v2/Makefile
>  create mode 100644 board/LaCie/netspace_v2/kwbimage.cfg
>  create mode 100644 board/LaCie/netspace_v2/netspace_v2.c
>  create mode 100644 board/LaCie/netspace_v2/netspace_v2.h
>  create mode 100644 include/configs/netspace_v2.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e2a4ba9..f905a48 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -652,6 +652,12 @@ Sedji Gaouaou
>   at91sam9g10ek   ARM926EJS (AT91SAM9G10 SoC)
>   at91sam9m10g45ekARM926EJS (AT91SAM9G45 SoC)
>  
> +Simon Guinot 
> +
> + inetspace_v2ARM926EJS (Kirkwood SoC)
> + netspace_v2 ARM926EJS (Kirkwood SoC)
> + netspace_max_v2 ARM926EJS (Kirkwood SoC)
> +
>  Marius Gr�ger 
>  
>   impa7   ARM720T (EP7211)
> diff --git a/board/LaCie/netspace_v2/Makefile 
> b/board/LaCie/netspace_v2/Makefile
> new file mode 100644
> index 000..a245f2c
> --- /dev/null
> +++ b/board/LaCie/netspace_v2/Makefile
> @@ -0,0 +1,49 @@
> +#
> +# Copyright (C) 2011 Simon Guinot 
> +#
> +# Based on Kirkwood support:
> +# (C) Copyright 2009
> +# Marvell Semiconductor 
> +# Written-by: Prafulla Wadaskar 
> +#
> +# 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.
> +#
> +
> +include $(TOPDIR)/config.mk
> +
> +LIB  = $(obj)lib$(BOARD).o
> +
> +COBJS:= netspace_v2.o
> +
> +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
> +OBJS := $(addprefix $(obj),$(COBJS))
> +SOBJS:= $(addprefix $(obj),$(SOBJS))
> +
> +$(LIB):  $(obj).depend $(OBJS) $(SOBJS)
> + $(call cmd_link_o_target, $(OBJS) $(SOBJS))
> +
> +clean:
> + rm -f $(SOBJS) $(OBJS)
> +
> +distclean:   clean
> + rm -f $(LIB) core *.bak .depend
> +
> +#
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#
> diff --git a/board/LaCie/netspace_v2/kwbimage.cfg 
> b/board/LaCie/netspace_v2/kwbimage.cfg
> new file mode 100644
> index 000..361feeb
> --- /dev/null
> +++ b/board/LaCie/netspace_v2/kwbimage.cfg
> @@ -0,0 +1,162 @@
> +#
> +# Copyright (C) 2011 Simon Guinot 
> +#
> +# Based on Kirkwood support:
> +# (C) Copyright 2009
> +# Marvell Semiconductor 
> +# Written-by: Prafulla Wadaskar 
> +#
> +# 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.
> +#
> +# Refer docs/README.kwimage for more details about how-to configure
> +# and create kirkwood bo

Re: [U-Boot] PPC405EX CHIP_21 erratum

2011-05-03 Thread Stefan Roese
On Monday 02 May 2011 23:44:58 Steven A. Falco wrote:
> I have not been able to find a way to distinguish a power-up versus a
> reboot. So for now, I've implemented the AMCC bug fix more or less as
> written.  To do it right, we'd have to add entries in every U-Boot config
> file for the 405 EX/EXr to definitively specify the CPU type expected, and
> to put the list of allowed PVRs in the code.
> 
> This means that the PVR is essentially useless to distinguish between the
> EX and EXr, because we have seen one misbehaving EX report as an EXr!
> If the PVR had been garbage, we could maybe use it, but reporting "wrong
> yet legal" values makes it worthless.
> 
> All our boards use the EX, so we are able to live with this, but I realize
> it is not a solution for the larger community.  That is why I have not
> proposed a definitive patch.

I see. Thanks for the explanation.

IMHO, it would be best to provide a default list of PVR's that are 
allowed/correct for 405EX(r). And this list can be overridden by a board 
specific version (as needed in your case). Not sure how to handle this 
elegantly in assembler though.

We might move this to cpu_init_f(). This is the first C function called via 
start.S. It already handles similar issues for some 4xx SoC variants 
(reconfigure_pll()) which require a system reboot.

What do you think? Would you be able to prepare a patch with such a CHIP_21 
fix?

Cheers,
Stefan

--
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 2/3] arm: omap: innovator: Prepare for mach-types.h changes

2011-05-03 Thread Igor Grinberg
Hi Wolfgang,

On 05/03/11 15:29, Wolfgang Denk wrote:
> Dear Igor Grinberg,
>
> In message <1304417333-30745-1-git-send-email-grinb...@compulab.co.il> you 
> wrote:
>> This board used machine_is_* macros for identifying the arch number.
>> Fix this by introducing a board specific configuration variable.
>>
>> Signed-off-by: Igor Grinberg 
>> ---
>> v2:  remove the ifdeferry by introducing config variable,
>>  Alessandro, what about this one?
> ...
>> +gd->bd->bi_arch_number = CONFIG_BOARD_MACH_TYPE;
> In principle this is OK, but why do you invent yet another new CONFIG_
> variable (and without documenting it) ?

Well, it was meant to be board specific, so local documentation in
config file should be enough.

> We have a number of boards that already use a similar construct with
> CONFIG_MACH_TYPE, so I suggest you do the same.

Didn't know that, I though it is new... silly me... ;)
Thanks for pointing.

> And while being there, could you please also add a description for
> CONFIG_MACH_TYPE to the README?   Thanks!

I'll try my best, but this will take a while...

Other patches in this series are not affected by this one,
so can be easily applied.


-- 
Regards,
Igor.

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


Re: [U-Boot] [PATCH] part_dos: allocate sector buffer dynamically

2011-05-03 Thread Sergei Shtylyov
Hello.

On 03-05-2011 16:34, Wolfgang Denk wrote:

> Umm... you _are_ aware that you can put dynamically sized arrays on
> the stack, aren't you?

No, it seems I'm not. Is it a standard C now?

> Best regards,

> Wolfgang Denk

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


Re: [U-Boot] [U-Boot-Users] U-Boot WinCE booting support?

2011-05-03 Thread Marek Vasut
On Tuesday, May 03, 2011 08:43:39 AM Balaji P wrote:
> Hi
>   I am working in Arm based board which can support both linux and
> wince. We need unified bootloader to boot both. Please provide me some
> help.

CCing uboot mailing list ... I can't help you more
> 
> Thanks&  Regards
> Balaji P
> 
> On Thursday 07 April 2011 06:55 PM, Marek Vasut wrote:
> > On Thursday 07 April 2011 15:02:37 Balaji P wrote:
> >> Hi
> >> 
> >>   I want to boot wince using uboot. Please provide me some help.
> > 
> > Any why don't you just stick with eboot ?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC] Act as a TFTP server

2011-05-03 Thread Wolfgang Denk
Dear Luca Ceresoli,

In message <4dbff3af.4040...@comelit.it> you wrote:
>
> > So assuming we never see any incoming packets - how long will we wait?
> 
> Once it has started, the server is stopped like the client is:
> - on a complete file reception
> - pressing Ctrl-C
> - after waiting 5 seconds for 10 times.

OK, fine.  Can you please document thisn, then.  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"Confound these ancestors They've stolen our best ideas!"
- Ben Jonson
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] part_dos: allocate sector buffer dynamically

2011-05-03 Thread Wolfgang Denk
Dear Sergei Shtylyov,

In message <4dbff300.9010...@mvista.com> you wrote:
> 
> > Can we please keep the buffer on the stack as before?
> 
> It will be unsafe. We can't really predict the size of the buffer (unless 
> we postulate that the buffer size won't ever exceed e.g. 4K).

In which way will a buffer allocated on the stack be less safe than
one allocated using malloc()?  Changes to do things wrong (like
forgetting to free the array on return or freeing a bad pointer) are
much higher with malloc(), it seems.

> I think using stack variables makes the code much more error prone, to 
> the 
> point that U-Boot just crashes when the sector size happens to exceed our 
> buffer size.

This statement makes no sense to me.  Wether the sector size exceeds
the buffer size or not is in no way dependent on where or how you
allocate the buffer - be it on the stack or using malloc().

Umm... you _are_ aware that you can put dynamically sized arrays on
the stack, aren't you?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Disc space - the final frontier!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] MIPS: Move timer code to arch/mips/cpu/$(CPU)/

2011-05-03 Thread Shinya Kuribayashi
Current timer routines (arch/mips/lib/timer.c) are implemented assuming
that MIPS32 coprocessor (CP0) resources, Counter and Compare registers
in this case, are available.  But this doesn't always work.

We need to make sure that all MIPS-based systems don't necessarily use
CP0 counter/compare registers as time keeping resources.  And some MIPS
variant processors might come with different hardware specs with genuine
MIPS32 CP0 registers.

This patch makes each $(CPU) can have its own timer code.

Signed-off-by: Shinya Kuribayashi 
---
 arch/mips/cpu/mips32/Makefile|2 +-
 arch/mips/{lib => cpu/mips32}/time.c |0
 arch/mips/lib/Makefile   |1 -
 3 files changed, 1 insertions(+), 2 deletions(-)
 rename arch/mips/{lib => cpu/mips32}/time.c (100%)

diff --git a/arch/mips/cpu/mips32/Makefile b/arch/mips/cpu/mips32/Makefile
index e315c1b..eb8e005 100644
--- a/arch/mips/cpu/mips32/Makefile
+++ b/arch/mips/cpu/mips32/Makefile
@@ -27,7 +27,7 @@ LIB   = $(obj)lib$(CPU).o
 
 START  = start.o
 SOBJS-y= cache.o
-COBJS-y= cpu.o interrupts.o
+COBJS-y= cpu.o interrupts.o time.o
 
 SRCS   := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/arch/mips/lib/time.c b/arch/mips/cpu/mips32/time.c
similarity index 100%
rename from arch/mips/lib/time.c
rename to arch/mips/cpu/mips32/time.c
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 4e90704..9244f31 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -33,7 +33,6 @@ COBJS-y   += bootm_qemu_mips.o
 else
 COBJS-y+= bootm.o
 endif
-COBJS-y+= time.o
 
 SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
-- 
1.7.4.5

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


Re: [U-Boot] [PATCH v2 2/3] arm: omap: innovator: Prepare for mach-types.h changes

2011-05-03 Thread Wolfgang Denk
Dear Igor Grinberg,

In message <1304417333-30745-1-git-send-email-grinb...@compulab.co.il> you 
wrote:
> This board used machine_is_* macros for identifying the arch number.
> Fix this by introducing a board specific configuration variable.
> 
> Signed-off-by: Igor Grinberg 
> ---
> v2:   remove the ifdeferry by introducing config variable,
>   Alessandro, what about this one?
...
> + gd->bd->bi_arch_number = CONFIG_BOARD_MACH_TYPE;

In principle this is OK, but why do you invent yet another new CONFIG_
variable (and without documenting it) ?

We have a number of boards that already use a similar construct with
CONFIG_MACH_TYPE, so I suggest you do the same.

And while being there, could you please also add a description for
CONFIG_MACH_TYPE to the README?   Thanks!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
If the car industry behaved like the computer industry over the  last
30  years, a Rolls-Royce would cost $5, get 300 miles per gallon, and
blow up once a year killing all passengers inside.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC] Act as a TFTP server

2011-05-03 Thread Luca Ceresoli
Il 30/04/2011 21:53, Wolfgang Denk ha scritto:
> Dear Luca Ceresoli,
>
> In message<4da59b5e.5000...@comelit.it>  you wrote:
  Usage:tftpsrv []

 This would be used almost like tftpboot, except no file name is specified 
 on
 the commandline.
 would default to the environment variable.
>>> I see some user interface issues here:
>>> - When and how do you terminate this command?  After a successful
>>> download, ok.  But how long do we wait for that?  Forever? Or do we
>>> time out?
>> The TFTP client tries sending a RRQ packet TIMEOUT_COUNT times (default 10),
>> spaced TIMEOUT msecs (default 5000) from each other. 50 seconds total by 
>> default.
> Well - this requires that there actually _is_ a TFTP client which
> attempts to connect.  But there is no guarantee that any such client
> is running at all, or that it can connect through firewalls, routers,
> etc.
>
> So assuming we never see any incoming packets - how long will we wait?

Once it has started, the server is stopped like the client is:
- on a complete file reception
- pressing Ctrl-C
- after waiting 5 seconds for 10 times.

Luca


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


Re: [U-Boot] [PATCH] part_dos: allocate sector buffer dynamically

2011-05-03 Thread Sergei Shtylyov
Hello.

On 30-04-2011 23:14, Wolfgang Denk wrote:

>> Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when 
>> it
>> tries to read the MBR into 512-byte buffer situated on stack. Instead 
>> allocate
>> this buffer dynamically to be safe with any large sector size.

>> Signed-off-by: Sergei Shtylyov

> Can we please keep the buffer on the stack as before?

It will be unsafe. We can't really predict the size of the buffer (unless 
we postulate that the buffer size won't ever exceed e.g. 4K).

> There is no need to use malloc() here.

No, there *is* a need I think.

> It just makes the code slower and more
> complicated and error prone without neeed.

I think using stack variables makes the code much more error prone, to the 
point that U-Boot just crashes when the sector size happens to exceed our 
buffer size.

> Best regards,

> Wolfgang Denk

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


Re: [U-Boot] [PATCH v5 2/5] Kirkwood: allow to override CONFIG_SYS_TCLK

2011-05-03 Thread Prafulla Wadaskar


> -Original Message-
> From: Simon Guinot [mailto:simon.gui...@sequanux.org]
> Sent: Tuesday, May 03, 2011 4:12 AM
> To: Prafulla Wadaskar; Albert ARIBAUD; Wolfgang Denk; Mike Frysinger
> Cc: u-boot@lists.denx.de; Simon Guinot
> Subject: [PATCH v5 2/5] Kirkwood: allow to override CONFIG_SYS_TCLK
> 
> From: Simon Guinot 
> 
> This patch allow to override CONFIG_SYS_TCLK from board configuration
> files. This is needed for the Network Space v2 which use a non standard
> core clock frequency (166MHz instead of 200MHz for a 6281 SoC).
> 
> As a possible enhancement for 6281 and 6282 devices, TCLK could be
> dynamically detected by checking the Sample at Reset register bit 21.
> 
> Additionally this patch fix a typo.
> 
> Signed-off-by: Simon Guinot 
> Acked-by: Prafulla Wadaskar 
> ---
> Changes for v[1-5]: none
> 
>  arch/arm/include/asm/arch-kirkwood/kw88f6281.h |8 +---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-kirkwood/kw88f6281.h
> b/arch/arm/include/asm/arch-kirkwood/kw88f6281.h
> index 80723ea..22d10f1 100644
> --- a/arch/arm/include/asm/arch-kirkwood/kw88f6281.h
> +++ b/arch/arm/include/asm/arch-kirkwood/kw88f6281.h
> @@ -27,11 +27,13 @@
>  #ifndef _ASM_ARCH_KW88F6281_H
>  #define _ASM_ARCH_KW88F6281_H
> 
> -/* SOC specific definations */
> +/* SOC specific definitions */
>  #define KW88F6281_REGS_PHYS_BASE 0xf100
>  #define KW_REGS_PHY_BASE KW88F6281_REGS_PHYS_BASE
> 
> -/* TCLK Core Clock defination*/
> -#define CONFIG_SYS_TCLK2 /* 200MHz */
> +/* TCLK Core Clock definition */
> +#ifndef CONFIG_SYS_TCLK
> +#define CONFIG_SYS_TCLK  2 /* 200MHz */
> +#endif
> 
>  #endif /* _ASM_ARCH_KW88F6281_H */
> --
> 1.6.3.1

Applied to u-boot-marvell.git master branch

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


[U-Boot] [PATCH v2 2/2] cramfs: make cramfs usable without a NOR flash

2011-05-03 Thread Heiko Schocher
cc: Wolfgang Denk 
cc: Detlev Zundel 
cc: Valentin Longchamp 
cc: Holger Brunck 
Signed-off-by: Valentin Longchamp 
---
changes for v2:
- added comments from Wolfgang Denk:
  - introduce define OFFSET_ADJUSTMENT, so command can be used
without a NOR flash.

 common/cmd_cramfs.c |   10 --
 fs/cramfs/cramfs.c  |4 
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c
index 9060ecc..e7f496e 100644
--- a/common/cmd_cramfs.c
+++ b/common/cmd_cramfs.c
@@ -45,6 +45,12 @@
 #ifdef CONFIG_CRAMFS_CMDLINE
 #include 
 
+#ifdef CONFIG_SYS_NO_FLASH
+# define OFFSET_ADJUSTMENT 0
+#else
+# define OFFSET_ADJUSTMENT (flash_info[id.num].start[0])
+#endif
+
 #ifndef CONFIG_CMD_JFFS2
 #include 
 char *mkmodestr(unsigned long mode, char *str)
@@ -119,7 +125,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
dev.id = &id;
part.dev = &dev;
/* fake the address offset */
-   part.offset = addr - flash_info[id.num].start[0];
+   part.offset = addr - OFFSET_ADJUSTMENT;
 
/* pre-set Boot file name */
if ((filename = getenv("bootfile")) == NULL) {
@@ -182,7 +188,7 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
dev.id = &id;
part.dev = &dev;
/* fake the address offset */
-   part.offset = addr - flash_info[id.num].start[0];
+   part.offset = addr - OFFSET_ADJUSTMENT;
 
if (argc == 2)
filename = argv[1];
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index 2956d39..910955d 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -41,8 +41,12 @@ struct cramfs_super super;
 
 /* CPU address space offset calculation macro, struct part_info offset is
  * device address space offset, so we need to shift it by a device start 
address. */
+#if !defined(CONFIG_SYS_NO_FLASH)
 extern flash_info_t flash_info[];
 #define PART_OFFSET(x) (x->offset + flash_info[x->dev->id->num].start[0])
+#else
+#define PART_OFFSET(x) (x->offset)
+#endif
 
 static int cramfs_read_super (struct part_info *info)
 {
-- 
1.7.4.4

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


[U-Boot] [PATCH v2 1/2] cramfs: fix bug in using CONFIG_CRAMFS_CMDLINE

2011-05-03 Thread Heiko Schocher
do not define own flash_info variable, instead use
the flash_info variable defined in your flash driver.

Signed-off-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
cc: Valentin Longchamp 
cc: Holger Brunck 
Signed-off-by: Valentin Longchamp 
---
changes for v2:
- added comments from Wolfgang Denk:
  - new patch in this version
  - no ifndef around include  needed

 common/cmd_cramfs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c
index 8c86dc5..9060ecc 100644
--- a/common/cmd_cramfs.c
+++ b/common/cmd_cramfs.c
@@ -43,7 +43,7 @@
 #endif
 
 #ifdef CONFIG_CRAMFS_CMDLINE
-flash_info_t flash_info[1];
+#include 
 
 #ifndef CONFIG_CMD_JFFS2
 #include 
-- 
1.7.4.4

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


Re: [U-Boot] [PATCH v5 3/5] mv-common.h: fix DRAM banks configuration

2011-05-03 Thread Prafulla Wadaskar


> -Original Message-
> From: Simon Guinot [mailto:simon.gui...@sequanux.org]
> Sent: Tuesday, May 03, 2011 4:12 AM
> To: Prafulla Wadaskar; Albert ARIBAUD; Wolfgang Denk; Mike Frysinger
> Cc: u-boot@lists.denx.de; Simon Guinot
> Subject: [PATCH v5 3/5] mv-common.h: fix DRAM banks configuration
> 
> From: Simon Guinot 
> 
> The asm/arch/config.h header define CONFIG_NR_DRAM_BANKS_MAX, which is
> needed to configure DRAM banks.
> 
> This patch move the asm/arch/config.h header inclusion above the DRAM
> banks configuration.
> 
> Additionally this patch fix a typo.
> 
> Signed-off-by: Simon Guinot 
> ---
> Changes for v2: none
> 
> Changes for v3:
>   - fix "Definitions" typo in mv-common.h
> 
> Changes for v4,5: none
> 
>  include/configs/mv-common.h |8 
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
> index a8937dd..0a39257 100644
> --- a/include/configs/mv-common.h
> +++ b/include/configs/mv-common.h
> @@ -113,6 +113,9 @@
>  #define CONFIG_SYS_RESET_ADDRESS 0x  /* Rst Vector Adr */
>  #define CONFIG_SYS_MAXARGS   16  /* max number of command args */
> 
> +/* > Include platform Common Definitions */
> +#include 
> +
>  /*
>   * DRAM Banks configuration, Custom config can be done in .h
>   */
> @@ -124,10 +127,7 @@
>  #endif
>  #endif /* CONFIG_NR_DRAM_BANKS */
> 
> -/* > Include platform Common Definations */
> -#include 
> -
> -/* > Include driver Common Definations */
> +/* > Include driver Common Definitions */
>  /*
>   * Common NAND configuration
>   */
> --
> 1.6.3.1

Applied to u-boot-marvell.git master branch

Regards..
Prafulla . .


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


Re: [U-Boot] [PATCH v4 0/4] OpenRD-Client and OpenRD-Ultimate support

2011-05-03 Thread Prafulla Wadaskar


> -Original Message-
> From: Clint Adams [mailto:cl...@debian.org]
> Sent: Tuesday, April 26, 2011 6:47 AM
> To: u-boot@lists.denx.de
> Cc: Albert ARIBAUD; Prafulla Wadaskar; Wolfgang Denk; Clint Adams
> Subject: [PATCH v4 0/4] OpenRD-Client and OpenRD-Ultimate support
> 
> Changes for v4:
>- Various commit log and whitespace tweaks
> 
> Clint Adams (4):
>   Rename openrd_base files to openrd
>   Add definitions for OpenRD-Client and OpenRD-Ultimate
>   Initialize second PHY on OpenRD-Client and OpenRD-Ultimate
>   Enable multiple fs options for Marvell SoC family on OpenRD boards
> 
>  MAKEALL|2 +
>  board/Marvell/{openrd_base => openrd}/Makefile |2 +-
>  board/Marvell/{openrd_base => openrd}/kwbimage.cfg |0
>  .../{openrd_base/openrd_base.c => openrd/openrd.c} |   33
> +---
>  .../{openrd_base/openrd_base.h => openrd/openrd.h} |0
>  boards.cfg |4 ++-
>  include/configs/{openrd_base.h => openrd.h}|   33
> +---
>  7 files changed, 62 insertions(+), 12 deletions(-)
>  rename board/Marvell/{openrd_base => openrd}/Makefile (98%)
>  rename board/Marvell/{openrd_base => openrd}/kwbimage.cfg (100%)
>  rename board/Marvell/{openrd_base/openrd_base.c => openrd/openrd.c}
> (80%)
>  rename board/Marvell/{openrd_base/openrd_base.h => openrd/openrd.h}
> (100%)
>  rename include/configs/{openrd_base.h => openrd.h} (81%)
> 

Hi Clint

I have rebased u-boot-marvell.git master branch
I am unable to apply this patch series cleanly to this rebased branch.

Kindly please provide the new patch series for the same.

Regards..
Prafulla . .

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


Re: [U-Boot] [PATCH 17/30] cramfs: make cramfs usable without a NOR flash

2011-05-03 Thread Wolfgang Denk
Dear Heiko Schocher,

In message <4dbf9760.5030...@denx.de> you wrote:
>
> >> --- a/common/cmd_cramfs.c
> >> +++ b/common/cmd_cramfs.c
> >> @@ -43,7 +43,9 @@
> >>  #endif
> >>  
> >>  #ifdef CONFIG_CRAMFS_CMDLINE
> >> -flash_info_t flash_info[1];
> >> +#if !defined(CONFIG_SYS_NO_FLASH)
> >> +#include 
> >> +#endif
> > 
> > Do we need the #ifndef here?  I don;t thik it hurts if we
> > unconditionally #include  ?
> 
> Yep, you are right.
> 
> > But note: there was no "extern" in this declaration of flash_info[],
> > i. e. we _did_ allocate storage here. Is the new code really
> > equivalent? How extensively has it been tested?
> 
> flash_info is defined in the flash driver, so this is OK.
> It is tested on the keymile boards, and a MAKEALL runs
> clean.

You are probably right that the code with your patch is correct, i. e.
that this one-line deletion fixes an actual bug in the existing code.
But you don't mention this in the commit message.

These are two unrelated changes, that belon into separate commits.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Presidency:  The greased pig in the field game of American politics.
- Ambrose Bierce
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/3] arm: omap: innovator: Prepare for mach-types.h changes

2011-05-03 Thread Igor Grinberg
This board used machine_is_* macros for identifying the arch number.
Fix this by introducing a board specific configuration variable.

Signed-off-by: Igor Grinberg 
---
v2: remove the ifdeferry by introducing config variable,
Alessandro, what about this one?

 board/ti/omap1610inn/omap1610innovator.c |7 +--
 include/configs/omap1610h2.h |4 +++-
 include/configs/omap1610inn.h|4 +++-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/board/ti/omap1610inn/omap1610innovator.c 
b/board/ti/omap1610inn/omap1610innovator.c
index 44818bb..a071f63 100644
--- a/board/ti/omap1610inn/omap1610innovator.c
+++ b/board/ti/omap1610inn/omap1610innovator.c
@@ -63,12 +63,7 @@ static inline void delay (unsigned long loops)
 
 int board_init (void)
 {
-   if (machine_is_omap_h2())
-   gd->bd->bi_arch_number = MACH_TYPE_OMAP_H2;
-   else if (machine_is_omap_innovator())
-   gd->bd->bi_arch_number = MACH_TYPE_OMAP_INNOVATOR;
-   else
-   gd->bd->bi_arch_number = MACH_TYPE_OMAP_GENERIC;
+   gd->bd->bi_arch_number = CONFIG_BOARD_MACH_TYPE;
 
/* adress of boot parameters */
gd->bd->bi_boot_params = 0x1100;
diff --git a/include/configs/omap1610h2.h b/include/configs/omap1610h2.h
index 7e53ae6..0770d9d 100644
--- a/include/configs/omap1610h2.h
+++ b/include/configs/omap1610h2.h
@@ -34,7 +34,9 @@
 #define CONFIG_OMAP1   /* in a TI OMAP core */
 #define CONFIG_OMAP16101   /* which is in a 1610 */
 #define CONFIG_H2_OMAP1610 1   /* on an H2 Board */
-#define CONFIG_MACH_OMAP_H2/* Select board mach-type */
+
+/* Select board mach-type */
+#define CONFIG_BOARD_MACH_TYPE MACH_TYPE_OMAP_H2
 
 /* input clock of PLL */
 /* the OMAP1610 H2 has 12MHz input clock */
diff --git a/include/configs/omap1610inn.h b/include/configs/omap1610inn.h
index be569a3..1859780 100644
--- a/include/configs/omap1610inn.h
+++ b/include/configs/omap1610inn.h
@@ -34,7 +34,9 @@
 #define CONFIG_OMAP1   /* in a TI OMAP core*/
 #define CONFIG_OMAP16101   /* which is in a 1610  */
 #define CONFIG_INNOVATOROMAP1610   1   /*  a Innovator Board  */
-#define CONFIG_MACH_OMAP_INNOVATOR /* Select board mach-type */
+
+/* Select board mach-type */
+#define CONFIG_BOARD_MACH_TYPE MACH_TYPE_OMAP_INNOVATOR
 
 /* input clock of PLL */
 /* the OMAP1610 Innovator has 12MHz input clock */
-- 
1.7.3.4

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


Re: [U-Boot] [PATCH v5 0/5] Add support for LaCie NAS Network Space v2

2011-05-03 Thread Prafulla Wadaskar


> -Original Message-
> From: Simon Guinot [mailto:simon.gui...@sequanux.org]
> Sent: Tuesday, May 03, 2011 4:12 AM
> To: Prafulla Wadaskar; Albert ARIBAUD; Wolfgang Denk; Mike Frysinger
> Cc: u-boot@lists.denx.de; Simon Guinot
> Subject: [PATCH v5 0/5] Add support for LaCie NAS Network Space v2
> 
> This patch series adds support for Network Space v2 board and parents.
> 
> Changes for v2:
>   - netconsole: restore NetOurIP check
>   - add entries to MAINTAINERS file
>   - move boards from root Makefile to boards.cfg
>   - move MACH_TYPE definition into netspace_v2.h
>   - remove CONFIG_SYS_HZ redefinition
>   - turn PHY initialization message into debug()
> 
> Changes for v3:
>   - drop patch for Macronix MX25L4005A
>   - rewrite patch "sf: disable write protection for Macronix flash",
> using the common spi flash code
>   - fix "Definitions" typo in mv-common.h
>   - netconsole: add a "/* Fall through */" comment before the NETCONS
> case label
> 
> Changes for v4:
>   - sf macronix: use spi_flash_cmd_write_enable()
>   - enhance commit message for patch "Add support for Network Space v2"
> 
> Changes for v5:
>   - add a changelog per patch
>

> Simon Guinot (5):
>   sf: disable write protection for Macronix flash

>   Kirkwood: allow to override CONFIG_SYS_TCLK
>   mv-common.h: fix DRAM banks configuration

Hi Simon
>From these patch series, I will pull these two patches into u-boot-marvell.git 
>since they have standalone Kirkwood related fixes.
You may exclude them from your next patch series

>   netconsole: remove `serverip' check
>   Add support for Network Space v2

Whereas, mainly your board support patch have dependency with
1. "sf: disable write protection for Macronix flash" to be mainlined by Mike and
2. "netconsole: remove `serverip' check" to be mainlined by net maintainer.

Regards..
Prafulla . .

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


[U-Boot] [PATCH v2 7/7] powerpc/km82xx: add board specific environment variable

2011-05-03 Thread Holger Brunck
On mgcoge3ne a new environment variable bobcatreset is used.
So this patch adds a possibility to add board specific
environment variables in general and this specific variable
for mgcoge3ne.

Signed-off-by: Holger Brunck 
Signed-off-by: Valentin Longchamp 
Acked-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch serie to three independent smaller
 patch series
   - fix typo in commit message

 include/configs/km82xx-common.h |1 +
 include/configs/mgcoge.h|2 ++
 include/configs/mgcoge3ne.h |2 ++
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/configs/km82xx-common.h b/include/configs/km82xx-common.h
index 894e015..446c1d0 100644
--- a/include/configs/km82xx-common.h
+++ b/include/configs/km82xx-common.h
@@ -80,6 +80,7 @@
  * Default environment settings
  */
 #defineCONFIG_EXTRA_ENV_SETTINGS   
\
+   CONFIG_KM_BOARD_EXTRA_ENV   \
CONFIG_KM_DEF_ENV   \
"EEprom_ivm=pca9544a:70:4 \0"   \
"unlock=yes\0"  \
diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h
index 93a6f4a..0745855 100644
--- a/include/configs/mgcoge.h
+++ b/include/configs/mgcoge.h
@@ -85,6 +85,8 @@
 PSDMR_CL_2)
 
 
+#define CONFIG_KM_BOARD_EXTRA_ENV  ""
+
 /* include further common stuff for all keymile 82xx boards */
 #include "km82xx-common.h"
 
diff --git a/include/configs/mgcoge3ne.h b/include/configs/mgcoge3ne.h
index f080619..7ed213e 100644
--- a/include/configs/mgcoge3ne.h
+++ b/include/configs/mgcoge3ne.h
@@ -85,6 +85,8 @@
PSDMR_WRC_2C|\
PSDMR_CL_2)
 
+#define CONFIG_KM_BOARD_EXTRA_ENV  "bobcatreset=true\0"
+
 /* include further common stuff for all keymile 82xx boards */
 #include "km82xx-common.h"
 
-- 
1.7.1

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


[U-Boot] [PATCH v2 6/7] powerpc/km82xx: adapt CONFIG_SYSSYPCR to manual

2011-05-03 Thread Holger Brunck
Reserved bit was changed according to the processors manual.

Signed-off-by: Holger Brunck 
Signed-off-by: Valentin Longchamp 
Acked-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch serie to three independent smaller
 patch series
   - no change in the content of this patch

 include/configs/km82xx-common.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/configs/km82xx-common.h b/include/configs/km82xx-common.h
index da551c9..894e015 100644
--- a/include/configs/km82xx-common.h
+++ b/include/configs/km82xx-common.h
@@ -182,7 +182,7 @@
 #define CONFIG_SYS_HID20
 
 #define CONFIG_SYS_SIUMCR  0x4020c200
-#define CONFIG_SYS_SYPCR   0xFFC3
+#define CONFIG_SYS_SYPCR   0xFF83
 #define CONFIG_SYS_BCR 0x1000
 #define CONFIG_SYS_SCCR(SCCR_PCI_MODE | SCCR_PCI_MODCK)
 
-- 
1.7.1

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


[U-Boot] [PATCH v2 5/7] powerpc/km82xx: add mgcoge3ne and remove mgcoge2ne support

2011-05-03 Thread Holger Brunck
This patch adds support for the MPC8247 based board mgcoge3ne.
Additionaly mgcoge2ne board supprot was removed, because due
to the mgcoge3ne, this board is obsolete and not longer
maintained.
The board is similar to mgcoge. The difference is that
a NUMONYX flash is used and a different SDRAM (256MB).
Also introduce CONFIG_KM_82XX to collect ppc82xx common
settings and remove staticness from the common set_pin function.

Signed-off-by: Holger Brunck 
Signed-off-by: Valentin Longchamp 
Acked-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch serie to three independent smaller
 patch series
   - squashed with powerpc/km82xx: move SDRAM config to board config
 from first serie and update commit message

 MAINTAINERS  |2 +-
 board/keymile/common/common.c|6 ++--
 board/keymile/common/common.h|1 +
 board/keymile/km82xx/km82xx.c|   27 ++-
 boards.cfg   |2 +-
 include/configs/km82xx-common.h  |   26 --
 include/configs/mgcoge.h |   27 +++
 include/configs/{mgcoge2ne.h => mgcoge3ne.h} |   47 -
 8 files changed, 96 insertions(+), 42 deletions(-)
 rename include/configs/{mgcoge2ne.h => mgcoge3ne.h} (62%)

diff --git a/MAINTAINERS b/MAINTAINERS
index e2a4ba9..e2c48a8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -429,7 +429,7 @@ Heiko Schocher 
kmeter1 MPC8360
kmsupx5 MPC8321
mgcoge  MPC8247
-   mgcoge2ne   MPC8247
+   mgcoge3ne   MPC8247
mgcoge2un   ARM926EJS (Kirkwood SoC)
mucmc52 MPC5200
muas3001MPC8270
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index dc96489..25a3850 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGCOGE2NE)
+#if defined(CONFIG_KM82XX)
 #include 
 #endif
 #include 
@@ -398,10 +398,10 @@ int ivm_read_eeprom(void)
 #define DELAY_ABORT_SEQ62  /* @200kHz 9 clocks = 44us, 62us is 
ok */
 #define DELAY_HALF_PERIOD  (500 / (CONFIG_SYS_I2C_SPEED / 1000))
 
-#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGCOGE2NE)
+#if defined(CONFIG_KM_82XX)
 #define SDA_MASK   0x0001
 #define SCL_MASK   0x0002
-static void set_pin(int state, unsigned long mask)
+void set_pin(int state, unsigned long mask)
 {
ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
 
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index 6ce992a..cee24d4 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -124,6 +124,7 @@ struct bfticu_iomap {
 
 int ethernet_present(void);
 int ivm_read_eeprom(void);
+void set_pin(int state, unsigned long mask);
 
 int set_km_env(void);
 int fdt_set_node_and_value(void *blob,
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 01c0bfd..d453d25 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -288,7 +288,7 @@ int checkboard(void)
 #if defined(CONFIG_MGCOGE)
puts("Board: Keymile mgcoge");
 #else
-   puts("Board: Keymile mgcoge2ne");
+   puts("Board: Keymile mgcoge3ne");
 #endif
if (ethernet_present())
puts(" with PIGGY.");
@@ -314,6 +314,28 @@ int last_stage_init(void)
return 0;
 }
 
+#ifdef CONFIG_MGCOGE3NE
+/*
+ * For mgcoge3ne boards, the mgcoge3un control is controlled from
+ * a GPIO line on the PPC CPU. If bobcatreset is set the line
+ * will toggle once what forces the mgocge3un part to restart
+ * immediately.
+ */
+void handle_mgcoge3un_reset(void)
+{
+   char *bobcatreset = getenv("bobcatreset");
+   if (bobcatreset) {
+   if (strcmp(bobcatreset, "true") == 0) {
+   puts("Forcing bobcat reset\n");
+   set_pin(0, 0x0004); /* clear PD29 to reset arm */
+   udelay(1000);
+   set_pin(1, 0x0004);
+   } else
+   set_pin(1, 0x0004); /* set PD29 to not reset arm */
+   }
+}
+#endif
+
 /*
  * Early board initalization.
  */
@@ -329,6 +351,9 @@ int board_early_init_r(void)
out_8(&base->oprtl, (H_OPORTS_SCC4_ENA | H_OPORTS_SCC4_FD_ENA |
H_OPORTS_FCC1_PW_DWN));
 
+#ifdef CONFIG_MGCOGE3NE
+   handle_mgcoge3un_reset();
+#endif
return 0;
 }
 
diff --git a/boards.cfg b/boards.cfg
index e0791fe..f0d3440 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -440,7 +440,7 @@ PQ2FADS-ZU_66MHz_lowboot powerpc mpc8260 
mpc8260ads  freesca
 PQ2FADS-ZU_lowboot   powerpc mpc8260 mpc8260ads  
freescale  -   
MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=

[U-Boot] [PATCH v2 4/7] powerpc/km82xx: rework DIP switch detection

2011-05-03 Thread Holger Brunck
From: Huber, Andreas 

Introduce a struct for the BFTICU FPGA to increase the readability of
the code. And the define CONFIG_SYS_BFTICU_BASE was removed because
the CONFIG_SYS_FPGA_BASE is already the base value for BFTICU registers.

Signed-off-by: Andreas Huber 
Signed-off-by: Holger Brunck 
Signed-off-by: Valentin Longchamp 
Acked-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch serie to three independent smaller
 patch series
   - no change in the content of this patch

 board/keymile/common/common.h |   79 +
 board/keymile/km82xx/km82xx.c |   11 +++---
 include/configs/mgcoge.h  |3 --
 3 files changed, 84 insertions(+), 9 deletions(-)

diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index 14768c9..6ce992a 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -39,6 +39,85 @@ struct km_bec_fpga {
unsigned char   pgy_eth;
 };
 
+#define BFTICU_DIPSWITCH_MASK   0x0f
+
+/*
+ * BFTICU FPGA iomap
+ * BFTICU is used on mgcoge and mgocge3ne
+ */
+struct bfticu_iomap {
+   u8  xi_ena; /* General defect enable */
+   u8  pack1[3];
+   u8  en_csn;
+   u8  pack2;
+   u8  safe_mem;
+   u8  pack3;
+   u8  id;
+   u8  pack4;
+   u8  rev;
+   u8  build;
+   u8  p_frc;
+   u8  p_msk;
+   u8  pack5[2];
+   u8  xg_int;
+   u8  pack6[15];
+   u8  s_conf;
+   u8  pack7;
+   u8  dmx_conf12;
+   u8  pack8;
+   u8  s_clkslv;
+   u8  pack9[11];
+   u8  d_conf;
+   u8  d_mask_ca;
+   u8  d_pll_del;
+   u8  pack10[16];
+   u8  t_conf_ca;
+   u8  t_mask_ca;
+   u8  pack11[13];
+   u8  m_def0;
+   u8  m_def1;
+   u8  m_def2;
+   u8  m_def3;
+   u8  m_def4;
+   u8  m_def5;
+   u8  m_def_trap0;
+   u8  m_def_trap1;
+   u8  m_def_trap2;
+   u8  m_def_trap3;
+   u8  m_def_trap4;
+   u8  m_def_trap5;
+   u8  m_mask_def0;
+   u8  m_mask_def1;
+   u8  m_mask_def2;
+   u8  m_mask_def3;
+   u8  m_mask_def4;
+   u8  m_mask_def5;
+   u8  m_def_mask0;
+   u8  m_def_mask1;
+   u8  m_def_mask2;
+   u8  m_def_mask3;
+   u8  m_def_mask4;
+   u8  m_def_mask5;
+   u8  m_def_pri;
+   u8  pack12[11];
+   u8  hw_status;
+   u8  pack13;
+   u8  hw_control1;
+   u8  hw_control2;
+   u8  hw_control3;
+   u8  pack14[7];
+   u8  led_on; /* Leds */
+   u8  pack15;
+   u8  sfp_control;/* SFP modules */
+   u8  pack16;
+   u8  alarm_control;  /* Alarm output */
+   u8  pack17;
+   u8  icps;   /* ICN clock pulse shaping */
+   u8  mswitch;/* Read mode switch */
+   u8  pack18[6];
+   u8  pb_dbug;
+};
+
 #if !defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET)
 #define CONFIG_PIGGY_MAC_ADRESS_OFFSET 0
 #endif
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 6c511a6..01c0bfd 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -296,15 +296,14 @@ int checkboard(void)
return 0;
 }
 
-#define DIPSWITCH_OFFSET 0x89
-#define DIPSWITCH_MASK   0x0f
-
 int last_stage_init(void)
 {
+   struct bfticu_iomap *base =
+   (struct bfticu_iomap *)CONFIG_SYS_FPGA_BASE;
u8 dip_switch;
-   /* Dip switch */
-   dip_switch = readb(CONFIG_SYS_BFTICU_BASE + DIPSWITCH_OFFSET);
-   dip_switch &= DIPSWITCH_MASK;
+
+   dip_switch = in_8(&base->mswitch);
+   dip_switch &= BFTICU_DIPSWITCH_MASK;
/* dip switch 'full reset' or 'db erase' */
if (dip_switch & 0x1 || dip_switch & 0x2) {
/* start bootloader */
diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h
index dcde76c..3d2ee24 100644
--- a/include/configs/mgcoge.h
+++ b/include/configs/mgcoge.h
@@ -61,7 +61,4 @@
 /* include further common stuff for all keymile 82xx boards */
 #include "km82xx-common.h"
 
-/* bfticu address */
-#define CONFIG_SYS_BFTICU_BASE  0x4000
-
 #endif /* __CONFIG_H */
-- 
1.7.1

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


[U-Boot] [PATCH v2 3/7] powerpc/km82xx: rename mgcoge files to km82xx

2011-05-03 Thread Holger Brunck
The directory and file mgcoge was renamed to km82xx.
Because other keymile 82xx will follow and will use the
same platform code.

Signed-off-by: Holger Brunck 
Signed-off-by: Valentin Longchamp 
Acked-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch serie to three independent smaller
 patch series
   - no change in the content of this patch

 board/keymile/{mgcoge => km82xx}/Makefile  |0
 board/keymile/{mgcoge/mgcoge.c => km82xx/km82xx.c} |0
 boards.cfg |4 ++--
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename board/keymile/{mgcoge => km82xx}/Makefile (100%)
 rename board/keymile/{mgcoge/mgcoge.c => km82xx/km82xx.c} (100%)

diff --git a/board/keymile/mgcoge/Makefile b/board/keymile/km82xx/Makefile
similarity index 100%
rename from board/keymile/mgcoge/Makefile
rename to board/keymile/km82xx/Makefile
diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/km82xx/km82xx.c
similarity index 100%
rename from board/keymile/mgcoge/mgcoge.c
rename to board/keymile/km82xx/km82xx.c
diff --git a/boards.cfg b/boards.cfg
index 2b0900a..e0791fe 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -439,8 +439,8 @@ PQ2FADS-ZU_66MHz powerpc mpc8260 
mpc8260ads  freesca
 PQ2FADS-ZU_66MHz_lowboot powerpc mpc8260 mpc8260ads  
freescale  -   
MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=6600,SYS_TEXT_BASE=0xFF80
 PQ2FADS-ZU_lowboot   powerpc mpc8260 mpc8260ads  
freescale  -   
MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF80
 VoVPN-GW_66MHz   powerpc mpc8260 vovpn-gw
funkwerk   -   VoVPN-GW:CLKIN_66MHz
-mgcoge   powerpc mpc8260 -   
keymile
-mgcoge2nepowerpc mpc8260 mgcoge  
keymile
+mgcoge   powerpc mpc8260 km82xx  
keymile
+mgcoge2nepowerpc mpc8260 km82xx  
keymile
 SCM  powerpc mpc8260 -   
siemens
 TQM8255_AA   powerpc mpc8260 tqm8260 tqc   
 -   TQM8260:MPC8255,300MHz
 TQM8260_AA   powerpc mpc8260 tqm8260 tqc   
 -   TQM8260:MPC8260,200MHz
-- 
1.7.1

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


[U-Boot] [PATCH v2 1/7] km/common: remove hdlc_enet implementation

2011-05-03 Thread Holger Brunck
The hdlc implementation for mgcoge was initially developed,
but later on not used. Remove the C files, the references
in mgcoge.c and the Makefile to decrease maintenance effort.

Signed-off-by: Holger Brunck 
Signed-off-by: Valentin Longchamp 
Acked-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch serie to three independent smaller
 patch series
   - no change in the content of this patch

 board/keymile/common/common.c|3 -
 board/keymile/common/common.h|4 -
 board/keymile/common/keymile_hdlc_enet.c |  620 --
 board/keymile/mgcoge/Makefile|3 +-
 board/keymile/mgcoge/mgcoge_hdlc_enet.c  |  276 -
 5 files changed, 1 insertions(+), 905 deletions(-)
 delete mode 100644 board/keymile/common/keymile_hdlc_enet.c
 delete mode 100644 board/keymile/mgcoge/mgcoge_hdlc_enet.c

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 4883fe5..dc96489 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -677,9 +677,6 @@ int ethernet_present(void)
 
 int board_eth_init(bd_t *bis)
 {
-#ifdef CONFIG_KEYMILE_HDLC_ENET
-   (void)keymile_hdlc_enet_initialize(bis);
-#endif
if (ethernet_present())
return cpu_eth_init(bis);
 
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index 099de98..14768c9 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -46,10 +46,6 @@ struct km_bec_fpga {
 int ethernet_present(void);
 int ivm_read_eeprom(void);
 
-#ifdef CONFIG_KEYMILE_HDLC_ENET
-int keymile_hdlc_enet_initialize(bd_t *bis);
-#endif
-
 int set_km_env(void);
 int fdt_set_node_and_value(void *blob,
char *nodename,
diff --git a/board/keymile/common/keymile_hdlc_enet.c 
b/board/keymile/common/keymile_hdlc_enet.c
deleted file mode 100644
index a545211..000
--- a/board/keymile/common/keymile_hdlc_enet.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- * (C) Copyright 2008
- * Gary Jennejohn, DENX Software Engineering GmbH, ga...@denx.de.
- *
- * Based in part on arch/powerpc/cpu/mpc8260/ether_scc.c.
- *
- * 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 
-#include 
-#include 
-
-#ifdef CONFIG_KEYMILE_HDLC_ENET
-#ifdef TEST_IT
-#include 
-#endif
-
-#include "keymile_hdlc_enet.h"
-
-extern char keymile_slot;  /* our slot number in the backplane */
-
-/* Allow up to about 50 ms for sending */
-#define TOUT_LOOP  5
-
-/*
- * Since, except during initialization, ethact is always HDLC
- * while we're in the driver, just use serial_printf() everywhere for
- * output.  This avoids possible conflicts when netconsole is being
- * used.
- */
-#define dprintf(fmt, args...)  serial_printf(fmt, ##args)
-
-/* Cannot use the storage from net.c because we allocate larger buffers */
-static volatile uchar MyPktBuf[HDLC_PKTBUFSRX * PKT_MAXBLR_SIZE + PKTALIGN];
-static volatile uchar *MyRxPackets[HDLC_PKTBUFSRX]; /* Receive packet */
-
-static unsigned int keymile_rxIdx; /* index of the current RX buffer */
-
-static IPaddr_t cachedNumbers[CACHEDNUMBERS]; /* 4 bytes per entry */
-void initCachedNumbers(int);
-
-/*
-  * SCC Ethernet Tx and Rx buffer descriptors allocated at the
-  *  immr->udata_bd address on Dual-Port RAM
-  * Provide for Double Buffering
-  */
-typedef volatile struct CommonBufferDescriptor {
-cbd_t txbd;/* Tx BD */
-cbd_t rxbd[HDLC_PKTBUFSRX];/* Rx BD */
-} RTXBD;
-
-/*
- * This must be extern because it is allocated in DPRAM using CPM-sepcific
- * code.
- */
-static RTXBD *rtx;
-
-static int keymile_hdlc_enet_send(struct eth_device *, volatile void *, int);
-static int keymile_hdlc_enet_recv(struct eth_device *);
-void keymile_hdlc_enet_init_bds(RTXBD *);
-extern int keymile_hdlc_enet_init(struct eth_device *, bd_t *);
-extern void keymile_hdlc_enet_halt(struct eth_device *);
-
-/* flags in the buffer descriptor not defined anywhere else */
-#define BD_SC_CT   BD_SC_CD
-#define BD_SC_CR   0x04
-#define BD_SC_DE   0x80
-#ifndef BD_SC_TC
-#define BD_SC_TC   ((ushort)0x0400)/* Transmit CRC */
-#endif
-#

[U-Boot] [PATCH v2 2/7] powerpc/km82xx: cleanup coding style for mgcoge.c

2011-05-03 Thread Holger Brunck
Signed-off-by: Holger Brunck 
Signed-off-by: Valentin Longchamp 
Acked-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
---
Changes for v2:
   - split up first large patch serie to three independent smaller
 patch series
   - no change in the content of this patch

 board/keymile/mgcoge/mgcoge.c |  291 +
 1 files changed, 146 insertions(+), 145 deletions(-)

diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c
index 7b34684..6c511a6 100644
--- a/board/keymile/mgcoge/mgcoge.c
+++ b/board/keymile/mgcoge/mgcoge.c
@@ -45,154 +45,154 @@
  */
 const iop_conf_t iop_conf_tab[4][32] = {
 
-/* Port A */
-{  /*conf  ppar psor pdir podr pdat */
-   /* PA31 */ { 0,  0,   0,   0,   0,   0 }, /* PA31*/
-   /* PA30 */ { 0,  0,   0,   0,   0,   0 }, /* PA30*/
-   /* PA29 */ { 0,  0,   0,   0,   0,   0 }, /* PA29*/
-   /* PA28 */ { 0,  0,   0,   0,   0,   0 }, /* PA28*/
-   /* PA27 */ { 0,  0,   0,   0,   0,   0 }, /* PA27*/
-   /* PA26 */ { 0,  0,   0,   0,   0,   0 }, /* PA26*/
-   /* PA25 */ { 0,  0,   0,   0,   0,   0 }, /* PA25*/
-   /* PA24 */ { 0,  0,   0,   0,   0,   0 }, /* PA24*/
-   /* PA23 */ { 0,  0,   0,   0,   0,   0 }, /* PA23*/
-   /* PA22 */ { 0,  0,   0,   0,   0,   0 }, /* PA22*/
-   /* PA21 */ { 0,  0,   0,   0,   0,   0 }, /* PA21*/
-   /* PA20 */ { 0,  0,   0,   0,   0,   0 }, /* PA20*/
-   /* PA19 */ { 0,  0,   0,   0,   0,   0 }, /* PA19*/
-   /* PA18 */ { 0,  0,   0,   0,   0,   0 }, /* PA18*/
-   /* PA17 */ { 0,  0,   0,   0,   0,   0 }, /* PA17*/
-   /* PA16 */ { 0,  0,   0,   0,   0,   0 }, /* PA16*/
-   /* PA15 */ { 0,  0,   0,   0,   0,   0 }, /* PA15*/
-   /* PA14 */ { 0,  0,   0,   0,   0,   0 }, /* PA14*/
-   /* PA13 */ { 0,  0,   0,   0,   0,   0 }, /* PA13*/
-   /* PA12 */ { 0,  0,   0,   0,   0,   0 }, /* PA12*/
-   /* PA11 */ { 0,  0,   0,   0,   0,   0 }, /* PA11*/
-   /* PA10 */ { 0,  0,   0,   0,   0,   0 }, /* PA10*/
-   /* PA9  */ { 1,  1,   0,   1,   0,   0 }, /* SMC2 TxD*/
-   /* PA8  */ { 1,  1,   0,   0,   0,   0 }, /* SMC2 RxD*/
-   /* PA7  */ { 0,  0,   0,   0,   0,   0 }, /* PA7 */
-   /* PA6  */ { 0,  0,   0,   0,   0,   0 }, /* PA6 */
-   /* PA5  */ { 0,  0,   0,   0,   0,   0 }, /* PA5 */
-   /* PA4  */ { 0,  0,   0,   0,   0,   0 }, /* PA4 */
-   /* PA3  */ { 0,  0,   0,   0,   0,   0 }, /* PA3 */
-   /* PA2  */ { 0,  0,   0,   0,   0,   0 }, /* PA2 */
-   /* PA1  */ { 0,  0,   0,   0,   0,   0 }, /* PA1 */
-   /* PA0  */ { 0,  0,   0,   0,   0,   0 }  /* PA0 */
-},
-
-/* Port B */
-{  /*conf  ppar psor pdir podr pdat */
-   /* PB31 */ { 0,  0,   0,   0,   0,   0 }, /* PB31*/
-   /* PB30 */ { 0,  0,   0,   0,   0,   0 }, /* PB30*/
-   /* PB29 */ { 0,  0,   0,   0,   0,   0 }, /* PB29*/
-   /* PB28 */ { 0,  0,   0,   0,   0,   0 }, /* PB28*/
-   /* PB27 */ { 0,  0,   0,   0,   0,   0 }, /* PB27*/
-   /* PB26 */ { 0,  0,   0,   0,   0,   0 }, /* PB26*/
-   /* PB25 */ { 0,  0,   0,   0,   0,   0 }, /* PB25*/
-   /* PB24 */ { 0,  0,   0,   0,   0,   0 }, /* PB24*/
-   /* PB23 */ { 0,  0,   0,   0,   0,   0 }, /* PB23*/
-   /* PB22 */ { 0,  0,   0,   0,   0,   0 }, /* PB22*/
-   /* PB21 */ { 0,  0,   0,   0,   0,   0 }, /* PB21*/
-   /* PB20 */ { 0,  0,   0,   0,   0,   0 }, /* PB20*/
-   /* PB19 */ { 0,  0,   0,   0,   0,   0 }, /* PB19*/
-   /* PB18 */ { 0,  0,   0,   0,   0,   0 }, /* PB18*/
-   /* PB17 */ { 0,  0,   0,   0,   0,   0 }, /* non-existent*/
-   /* PB16 */ { 0,  0,   0,   0,   0,   0 }, /* non-existent*/
-   /* PB15 */ { 0,  0,   0,   0,   0,   0 }, /* non-existent*/
-   /* PB14 */ { 0,  0,   0,   0,   0,   0 }, /* non-existent*/
-   /* PB13 */ { 0,  0,   0,   0,   0,   0 }, /* non-existent*/
-   /* PB12 */ { 0,  0,   0,   0,   0,   0 }, /* non-existent*/
-   /* 

[U-Boot] [PATCH v2 0/7] km82xx mainlining

2011-05-03 Thread Holger Brunck
This series is the second effort of merging the Keymile boards support
back into mainline.
This serie is a smaller serie based on the first patch serie:
http://lists.denx.de/pipermail/u-boot/2011-April/090013.html
The first large serie was split up to three independent series, which
is easier to review and apply for the custodians.
This serie adds the km82xx specific parts of the serie. All changes
here are only km relevant and should not affect other boards.

Holger Brunck (6):
  km/common: remove hdlc_enet implementation
  powerpc/km82xx: cleanup coding style for mgcoge.c
  powerpc/km82xx: rename mgcoge files to km82xx
  powerpc/km82xx: add mgcoge3ne and remove mgcoge2ne support
  powerpc/km82xx: adapt CONFIG_SYSSYPCR to manual
  poweprc/km82xx: add board specific environment variable

Huber, Andreas (1):
  powerpc/km82xx: rework DIP switch detection

 MAINTAINERS  |2 +-
 board/keymile/common/common.c|9 +-
 board/keymile/common/common.h|   84 -
 board/keymile/common/keymile_hdlc_enet.c |  620 --
 board/keymile/{mgcoge => km82xx}/Makefile|3 +-
 board/keymile/km82xx/km82xx.c|  371 +++
 board/keymile/mgcoge/mgcoge.c|  346 --
 board/keymile/mgcoge/mgcoge_hdlc_enet.c  |  276 
 boards.cfg   |4 +-
 include/configs/km82xx-common.h  |   29 +--
 include/configs/mgcoge.h |   32 ++-
 include/configs/{mgcoge2ne.h => mgcoge3ne.h} |   49 ++-
 12 files changed, 528 insertions(+), 1297 deletions(-)
 delete mode 100644 board/keymile/common/keymile_hdlc_enet.c
 rename board/keymile/{mgcoge => km82xx}/Makefile (94%)
 create mode 100644 board/keymile/km82xx/km82xx.c
 delete mode 100644 board/keymile/mgcoge/mgcoge.c
 delete mode 100644 board/keymile/mgcoge/mgcoge_hdlc_enet.c
 rename include/configs/{mgcoge2ne.h => mgcoge3ne.h} (60%)

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


Re: [U-Boot] [PATCH 2/6] NET: pass source IP address to packet handlers

2011-05-03 Thread Luca Ceresoli
Hi Wolfgang,

Wolfgang Denk wrote:

> Dear Luca Ceresoli,
>
> In message<1302796377-3321-3-git-send-email-luca.ceres...@comelit.it>  you 
> wrote:
>> This is needed for the upcoming TFTP server implementation.
>>
>> This also simplifies PingHandler() and fixes rxhand_f documentation.
>>
>> Signed-off-by: Luca Ceresoli
>> Cc: Wolfgang Denk
> Undone this and previous one as there is a V2 version of this patch.
>
> I wish you would thread yout postings!
I'm sorry for your wasted time, but it's not clear (to me at least...) how
postings should be threaded in the U-Boot ml.

The Wiki says:

>  Make sure that your mailer adds or keeps correct
>  |"In-reply-to:"|  and|"References:"|  headers, so threading of
>  messages is working and everybody can see that the new message
>  refers to some older posting of the same topic.
>
>  Uncommented and un-threaded repostings are extremely annoying and
>  time-consuming, as we have to try to remember if anything similar has
>  been posted before, look up the old threads, and then manually
>  compare if anything has been changed, or what.

'correct|"In-reply-to:"|  and|"References:"|' can have many interpretations.

On the ML I see varying ones, and I even see submissions with NO THREADING
AT ALL: the first submit is in a thread, v2 starts a new thread, v3 yet
another one etc.

MY humble interpretation of the Wiki wording is this:

- [PATCH 0/2]
   |
   +->  [PATCH 1/2]
   +->  [PATCH 2/2]
   |   +->  Re: [PATCH 2/2] reviewers comments to patch 2/2
   |   +->  Re: [PATCH 2/2] more reviewers comments to patch 2/2
   |
   +->  Re: [PATCH 0/2] reviewers comments to the patchset (0/2)
   |   +->  Re: [PATCH 0/2] discussion...
   |
   +->  [PATCH v2 0/2] resubmit (In-Reply-To: the first submit)
   |
   +->  [PATCH v2 1/2]
   +->  [PATCH v2 2/2]
   |   ... more discussion - not shown...
   |
   +->  [PATCH v3 0/2] resubmit (In-Reply-To: the first submit)
   |
   +->  [PATCH v3 1/2]
   +->  [PATCH v3 2/2]

What's wrong with this?
Please state in absolutely unambiguous detail what the correct threading is,
and please docuemnt it in the wiki for everybody.

My postings look correctly threaded according to the above interpretation,
as you can see for example on the Gmane threaded interface.

Luca


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


Re: [U-Boot] [PATCH 00/30] Keymile boards mainlining, part 2 (resend)

2011-05-03 Thread Valentin Longchamp
Hello,

Valentin Longchamp wrote:
> This series is the second effort of merging the Keymile boards support
> back into mainline.
> 
> Most of the patches are only keymile relevant and should only affect our
> boards.
> 
> There are also patches for the i2c deblocking support and cramfs for ARM.

We have split the whole series so that it gets easier to apply through 
the various trees:

1) the i2c patches were sent by Heiko and already applied
2) lib, vsprintf: introduce strict_strtoul and cramfs: make cramfs 
usable without a NOR flash are (or already have been) resent as 
standalone patches
3) Holger is going to send a series for km82xx changes
4) Holger is going to send a series with the keymile changes
5) I will send a series with the ARM/marvell changes

I hope this will simplify the review and merging of these patches into 
mainline.

Best Regards

Valentin

> 
> The whole series is based on current denx-master with the our first patch
> series posted by Heiko that was reviewed previous weeks and should still
> be merged during the current merge window:
> 
> http://lists.denx.de/pipermail/u-boot/2011-April/089530.html
> 
> Heiko Schocher (5):
>   lib, vsprintf: introduce strict_strtoul
>   arm/km: add CRAMFS support for keymile boards
>   cramfs: make cramfs usable without a NOR flash
>   i2c, soft_i2c: deblock bus if switching to another i2c bus
>   arm, powerpc, keymile boards: move keymile specific header in subdir
> 
> Holger Brunck (18):
>   km/common: remove hdlc_enet implementation
>   powerpc/km82xx: cleanup coding style for mgcoge.c
>   powerpc/km82xx: rename mgcoge files to km82xx
>   powerpc/km82xx: move SDRAM config to board config
>   powerpc/km82xx: adapt CONFIG_SYSSYPCR to manual
>   powerpc/km82xx: rename mgcoge2ne to mgcoge3ne board support
>   poweprc/km82xx: add board specific environment variable
>   arm/km: add addbootcount environment variable
>   arm/km: remove last_stage_init and unneeded printouts
>   arm/km: add second serial interface for kirkwood
>   common/hush: make get_local_var visible for other users
>   km/common: implement setboardid as a command
>   km/common: add pnvramsize to default environment
>   km/common: fix coding style issues in generic header
>   km/common: simplify default environment
>   arm/km: rename mgcoge2un to mgcoge3un
>   arm/km: change default settings for egiga on mgcoge3un
>   arm/km: update mgcoge3un board support
> 
> Huber, Andreas (1):
>   powerpc/km82xx: add DIP switch detection
> 
> Stefan Bigler (1):
>   i2c: add i2c deblock sequence before and after every mux config
> 
> Thomas Herzmann (2):
>   km/common: fix initial_boot_bank for bootpackages
>   km/common: replace env var checkboardidlist by function
> 
> Valentin Longchamp (3):
>   arm/km: add mkimage config file for uart download
>   arm/km: add BootROM config files for memphis SDRAM
>   arm/km: disable ls (through jffs2 support)
> 
>  MAINTAINERS|4 +-
>  board/keymile/common/common.c  |  156 ++-
>  board/keymile/common/common.h  |   84 +++-
>  board/keymile/common/keymile_hdlc_enet.c   |  620 
> 
>  board/keymile/{mgcoge => km82xx}/Makefile  |3 +-
>  board/keymile/km82xx/km82xx.c  |  373 ++
>  board/keymile/km_arm/km_arm.c  |   93 +++-
>  board/keymile/km_arm/kwbimage-memphis-uart.cfg |  197 
>  board/keymile/km_arm/kwbimage-memphis.cfg  |  197 
>  board/keymile/km_arm/kwbimage-uart.cfg |  179 +++
>  board/keymile/mgcoge/mgcoge.c  |  333 -
>  board/keymile/mgcoge/mgcoge_hdlc_enet.c|  276 ---
>  board/keymile/scripts/README   |   25 +
>  board/keymile/scripts/debug-arm-env.txt|2 +
>  board/keymile/scripts/debug-common-env.txt |9 +
>  board/keymile/scripts/debug-ppc-env.txt|2 +
>  boards.cfg |6 +-
>  common/cmd_cramfs.c|   12 +-
>  common/cmd_i2c.c   |   12 +
>  common/hush.c  |3 +-
>  drivers/i2c/soft_i2c.c |1 +
>  drivers/net/mvgbe.h|2 +
>  fs/cramfs/cramfs.c |4 +
>  include/_exports.h |1 +
>  include/common.h   |1 +
>  include/configs/{ => km}/keymile-common.h  |  175 +--
>  include/configs/{ => km}/km-powerpc.h  |   12 +-
>  include/configs/{ => km}/km82xx-common.h   |   29 +-
>  include/configs/{ => km}/km8321-common.h   |0
>  include/configs/{ => km}/km83xx-common.h   |0
>  include/configs/{ => km}/km_arm.h  |   25 +-
>  include/configs/kmeter1.h  |2 +-
>  include/configs/kmsupx5.h  |2 +-
>  include/configs/mgcoge.h 

Re: [U-Boot] boot-up time optimization. Where to start?

2011-05-03 Thread Stefano Babic
On 05/03/2011 08:48 AM, Alexander Stein wrote:

Hi Alexander,

> Am Montag, 2. Mai 2011, 19:00:47 schrieb Wolfgang Denk:
>> In message <201105021640.27241.alexander.st...@systec-electronic.com> you 
> wrote:
>>> Ok, let me be more precise on this.
>>> We used U-Boot v2010.09 on a custom board running on an I.MX35 (ARM1136).

The i.MX35 is supported in u-boot mainline. As I can suppose, you start
from the mx35pdk to port your code, probably you have good chances to
use the last u-boot code. And then to send patches for your board,
too... ;-)

> 
>> 2. This is an ARM board.
>>
>> 3. This is an old version before cache support for ARM was added.
> 
> This specific version was selected due to relocation problems on ARM.

The mx35pdk board is supported in u-boot mainline using relocation.

> expect the dcache doesn't have that big influence on the named code part as 
> the environment is already in RAM.

Check in the mailing list, the numbers reported by people who measured
the influence of cache say there is a big difference, specially when big
chunks of code is copied, that is copying the kernel from storage before
booting.

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


[U-Boot] [PATCH v2] lib, vsprintf: introduce strict_strtoul

2011-05-03 Thread Heiko Schocher
as checkpatch proposes to use strict_strtoul instead of
simple_strtoul, introduce it.

Ported this function from Linux 2.6.38 commit ID:
521cb40b0c44418a4fd36dc633f575813d59a43d

Signed-off-by: Heiko Schocher 
cc: Wolfgang Denk 
cc: Detlev Zundel 
cc: Valentin Longchamp 
cc: Holger Brunck 
Signed-off-by: Valentin Longchamp 
---
changes for v2:
- added origin source for this new function, as Wolfgang
  Denk suggested.
- Patch no longer in the patchserie, as it is an independent
  change.

 include/_exports.h |1 +
 include/common.h   |1 +
 include/exports.h  |1 +
 lib/vsprintf.c |   51 +++
 4 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/include/_exports.h b/include/_exports.h
index d89b65b..349a3c5 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -19,6 +19,7 @@ EXPORT_FUNC(do_reset)
 EXPORT_FUNC(getenv)
 EXPORT_FUNC(setenv)
 EXPORT_FUNC(simple_strtoul)
+EXPORT_FUNC(strict_strtoul)
 EXPORT_FUNC(simple_strtol)
 EXPORT_FUNC(strcmp)
 EXPORT_FUNC(i2c_write)
diff --git a/include/common.h b/include/common.h
index 00e266e..1e4a6a5 100644
--- a/include/common.h
+++ b/include/common.h
@@ -650,6 +650,7 @@ voidudelay(unsigned long);
 
 /* lib/vsprintf.c */
 ulong  simple_strtoul(const char *cp,char **endp,unsigned int base);
+int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
 unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int 
base);
 long   simple_strtol(const char *cp,char **endp,unsigned int base);
 void   panic(const char *fmt, ...)
diff --git a/include/exports.h b/include/exports.h
index ddd1bf4..e14d727 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -20,6 +20,7 @@ void __udelay(unsigned long);
 unsigned long get_timer(unsigned long);
 int vprintf(const char *, va_list);
 unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
+int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
 char *getenv (char *name);
 int setenv (char *varname, char *varvalue);
 long simple_strtol(const char *cp,char **endp,unsigned int base);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 61e6f0d..3b924ec 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #if !defined (CONFIG_PANIC_HANG)
@@ -61,6 +62,56 @@ unsigned long simple_strtoul(const char *cp,char 
**endp,unsigned int base)
return result;
 }
 
+/**
+ * strict_strtoul - convert a string to an unsigned long strictly
+ * @cp: The string to be converted
+ * @base: The number base to use
+ * @res: The converted result value
+ *
+ * strict_strtoul converts a string to an unsigned long only if the
+ * string is really an unsigned long string, any string containing
+ * any invalid char at the tail will be rejected and -EINVAL is returned,
+ * only a newline char at the tail is acceptible because people generally
+ * change a module parameter in the following way:
+ *
+ *  echo 1024 > /sys/module/e1000/parameters/copybreak
+ *
+ * echo will append a newline to the tail.
+ *
+ * It returns 0 if conversion is successful and *res is set to the converted
+ * value, otherwise it returns -EINVAL and *res is set to 0.
+ *
+ * simple_strtoul just ignores the successive invalid characters and
+ * return the converted value of prefix part of the string.
+ *
+ * Copied this function from Linux 2.6.38 commit ID:
+ * 521cb40b0c44418a4fd36dc633f575813d59a43d
+ *
+ */
+int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
+{
+   char *tail;
+   unsigned long val;
+   size_t len;
+
+   *res = 0;
+   len = strlen(cp);
+   if (len == 0)
+   return -EINVAL;
+
+   val = simple_strtoul(cp, &tail, base);
+   if (tail == cp)
+   return -EINVAL;
+
+   if ((*tail == '\0') ||
+   ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
+   *res = val;
+   return 0;
+   }
+
+   return -EINVAL;
+}
+
 long simple_strtol(const char *cp,char **endp,unsigned int base)
 {
if(*cp=='-')
-- 
1.7.4.4

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