[U-Boot] [PATCH v3] dfu, nand, ubi: add partubi alt settings for updating ubi partition

2013-07-18 Thread Heiko Schocher
updating an ubi partition needs a completely erased mtd partition,
see:
http://lists.infradead.org/pipermail/linux-mtd/2011-May/035416.html

So, add partubi alt setting for the dfu_alt_info environment
variable to mark this partition as an ubi partition. In case we
update an ubi partition, we erase after flashing the image into the
partition, the remaining sektors.

Signed-off-by: Heiko Schocher h...@denx.de
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Wolfgang Denk w...@denx.de

---

- This patch is also a good starting point to fix up updating ubi, as
  we currently use nand erase for erasing the sektors. This is
  not the prefered way for writing an ubi image, see:
  http://www.linux-mtd.infradead.org/faq/ubi.html#L_flash_img

  This must be fixed ... we have no ubiformat in u-boot, or?

- changes for v2:
  - do not use spread = 1 for nand_erase_opts, to prevent
errormessage if there are bad blocks in the erase range.

- changes for v3:
  - add comment from Marek Vasut:
- prevent losing memory
  - added comment from Lukasz Majewski:
- move code to dfu_nand.c dfu_flush_medium_nand()
---
 drivers/dfu/dfu_nand.c | 58 ++
 include/dfu.h  |  2 ++
 2 Dateien geändert, 60 Zeilen hinzugefügt(+)

diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 07dee89..ade5ae7 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -148,11 +148,43 @@ static int dfu_read_medium_nand(struct dfu_entity *dfu, 
u64 offset, void *buf,
return ret;
 }
 
+static int dfu_flush_medium_nand(struct dfu_entity *dfu)
+{
+   int ret = 0;
+
+   /* in case of ubi partition, erase rest of the partition */
+   if (dfu-ubi == 1) {
+   nand_info_t *nand;
+   nand_erase_options_t opts;
+
+   if (nand_curr_device  0 ||
+   nand_curr_device = CONFIG_SYS_MAX_NAND_DEVICE ||
+   !nand_info[nand_curr_device].name) {
+   printf(%s: invalid nand device\n, __func__);
+   return -1;
+   }
+
+   nand = nand_info[nand_curr_device];
+
+   memset(opts, 0, sizeof(opts));
+   opts.offset = dfu-data.nand.start + dfu-offset +
+   dfu-bad_skip;
+   opts.length = dfu-data.nand.start +
+   dfu-data.nand.size - opts.offset;
+   ret = nand_erase_opts(nand, opts);
+   if (ret != 0)
+   printf(Failure erase: %d\n, ret);
+   }
+
+   return ret;
+}
+
 int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 {
char *st;
int ret, dev, part;
 
+   dfu-ubi = 0;
dfu-dev_type = DFU_DEV_NAND;
st = strsep(s,  );
if (!strcmp(st, raw)) {
@@ -185,7 +217,32 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 
dfu-data.nand.start = pi-offset;
dfu-data.nand.size = pi-size;
+   } else if (!strcmp(st, partubi)) {
+   char mtd_id[32];
+   struct mtd_device *mtd_dev;
+   u8 part_num;
+   struct part_info *pi;
 
+   dfu-layout = DFU_RAW_ADDR;
+
+   dev = simple_strtoul(s, s, 10);
+   s++;
+   part = simple_strtoul(s, s, 10);
+
+   sprintf(mtd_id, %s%d,%d, nand, dev, part - 1);
+   printf(using id '%s'\n, mtd_id);
+
+   mtdparts_init();
+
+   ret = find_dev_and_part(mtd_id, mtd_dev, part_num, pi);
+   if (ret != 0) {
+   printf(Could not locate '%s'\n, mtd_id);
+   return -1;
+   }
+
+   dfu-data.nand.start = pi-offset;
+   dfu-data.nand.size = pi-size;
+   dfu-ubi = 1;
} else {
printf(%s: Memory layout (%s) not supported!\n, __func__, st);
return -1;
@@ -193,6 +250,7 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 
dfu-read_medium = dfu_read_medium_nand;
dfu-write_medium = dfu_write_medium_nand;
+   dfu-flush_medium = dfu_flush_medium_nand;
 
/* initial state */
dfu-inited = 0;
diff --git a/include/dfu.h b/include/dfu.h
index 124653c..7bbe42d 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -111,6 +111,8 @@ struct dfu_entity {
u32 bad_skip;   /* for nand use */
 
unsigned int inited:1;
+   /* for nand/ubi use */
+   unsigned int ubi:1;
 };
 
 int dfu_config_entities(char *s, char *interface, int num);
-- 
1.7.11.7

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


[U-Boot] Boot Linux kernel with initramfs fails

2013-07-18 Thread Axel Lin
Hi,
When I boot Linux kernel with FIT Image, the kernel does not unpacking 
initramfs.
( The root cause is initrd_start is NULL.)

The initramfs is built-in with kernel, so I don't specify ramdisk in my
kernel.its file.

Is this a known issue or do I need special setting to boot a Linux kernel
with initramfs?

BTW, bootm shows below messages:

= bootm
## Loading kernel from FIT Image at 0040 ...
   Using 'conf@1' configuration
   Trying 'kernel@1' kernel subimage
 Description:  kernel
 Type: Kernel Image
 Compression:  uncompressed
 Data Start:   0x004000e8
 Data Size:2496848 Bytes = 2.4 MiB
 Architecture: ARM
 OS:   Linux
 Load Address: 0x
 Entry Point:  0x
   Verifying Hash Integrity ... OK
## Loading fdt from FIT Image at 0040 ...
   Using 'conf@1' configuration
   Trying 'fdt@1' fdt subimage
 Description:  gpl327xx.dtb
 Type: Flat Device Tree
 Compression:  uncompressed
 Data Start:   0x00661ae8
 Data Size:2174 Bytes = 2.1 KiB
 Architecture: ARM
 Hash algo:sha1
 Hash value:   674b5443523a23ad8de49b161932fd3a1d7f90ea
   Verifying Hash Integrity ... sha1+ OK
   Booting using the fdt blob at 0x661ae8
   Loading Kernel Image ... OK
## initrd_high = 0x, copy_to_ram = 1
   ramdisk load start = 0x, ramdisk load end = 0x
   Loading Device Tree to 019b4000, end 019b787d ... OK


Below is part of my boot messages:

NET: Registered protocol family 1
BEGIN::: populate_rootfs...
^^^ My debug message, so I know populate_rootfs() is executed.
populate_rootfs... initrd_start is NULL
^^^ My debug message, I got initrd_start is NULL. That is why the initramfs 
is not unpack.
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered (default)
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
Warning: unable to open an initial console.
VFS: Cannot open root device (null) or unknown-block(0,0): error -6
Please append a correct root= boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 3.11.0-rc1-00018-g16fc5bc-dirty #131
[bda8] (unwind_backtrace+0x0/0xf0) from [ac0c] 
(show_stack+0x10/0x14)
[ac0c] (show_stack+0x10/0x14) from [001fcff8] (panic+0x7c/0x1c4)
[001fcff8] (panic+0x7c/0x1c4) from [0026ddb4] (mount_block_root+0x1f4/0x2b4)
[0026ddb4] (mount_block_root+0x1f4/0x2b4) from [0026e000] 
(prepare_namespace+0x128/0x18c)
[0026e000] (prepare_namespace+0x128/0x18c) from [0026da74] 
(kernel_init_freeable+0x164/0x1a8)
[0026da74] (kernel_init_freeable+0x164/0x1a8) from [001fb808] 
(kernel_init+0x8/0xe4)
[001fb808] (kernel_init+0x8/0xe4) from [8f70] (ret_from_fork+0x14/0x24)

(Test on latest u-boot git tree.)

Regards,
Axel

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


Re: [U-Boot] How to create a library with already built library

2013-07-18 Thread Albert ARIBAUD
Hi Julyberry,

On Wed, 17 Jul 2013 10:52:41 -0700 (PDT), Julyberry sen...@gmail.com
wrote:

 Thanks for the reply.
 
 Could you help with find the Makefile where it links the already built
 library?
 
 I tried to modify the main Makefile but it looks it tries to generate the
 library.

Well, you can get help here, as your request appears on-topic; or you
can join the u_boot IRC chan. In either case, you should at least tell
us the name of the existing library you are mentioning, and the name of
the new library you are adding.

 Thanks,

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


Re: [U-Boot] [PATCH v3] dfu, nand, ubi: add partubi alt settings for updating ubi partition

2013-07-18 Thread Lukasz Majewski
On Thu, 18 Jul 2013 08:04:55 +0200 Heiko Schocher h...@denx.de wrote,

Hi Heiko,

 updating an ubi partition needs a completely erased mtd partition,
 see:
 http://lists.infradead.org/pipermail/linux-mtd/2011-May/035416.html
 
 So, add partubi alt setting for the dfu_alt_info environment
 variable to mark this partition as an ubi partition. In case we
 update an ubi partition, we erase after flashing the image into the
 partition, the remaining sektors.
 
 Signed-off-by: Heiko Schocher h...@denx.de
 Cc: Pantelis Antoniou pa...@antoniou-consulting.com
 Cc: Tom Rini tr...@ti.com
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 Cc: Wolfgang Denk w...@denx.de
 
 ---
 
 - This patch is also a good starting point to fix up updating ubi, as
   we currently use nand erase for erasing the sektors. This is
   not the prefered way for writing an ubi image, see:
   http://www.linux-mtd.infradead.org/faq/ubi.html#L_flash_img
 
   This must be fixed ... we have no ubiformat in u-boot, or?
 
 - changes for v2:
   - do not use spread = 1 for nand_erase_opts, to prevent
 errormessage if there are bad blocks in the erase range.
 
 - changes for v3:
   - add comment from Marek Vasut:
 - prevent losing memory
   - added comment from Lukasz Majewski:
 - move code to dfu_nand.c dfu_flush_medium_nand()
 ---
  drivers/dfu/dfu_nand.c | 58
 ++
 include/dfu.h  |  2 ++ 2 Dateien geändert, 60 Zeilen
 hinzugefügt(+)
 
 diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
 index 07dee89..ade5ae7 100644
 --- a/drivers/dfu/dfu_nand.c
 +++ b/drivers/dfu/dfu_nand.c
 @@ -148,11 +148,43 @@ static int dfu_read_medium_nand(struct
 dfu_entity *dfu, u64 offset, void *buf, return ret;
  }
  
 +static int dfu_flush_medium_nand(struct dfu_entity *dfu)
 +{
 + int ret = 0;
 +
 + /* in case of ubi partition, erase rest of the partition */
 + if (dfu-ubi == 1) {
^^ if (dfu-ubi) shall be enough here.


 + nand_info_t *nand;
 + nand_erase_options_t opts;
 +
 + if (nand_curr_device  0 ||
 + nand_curr_device = CONFIG_SYS_MAX_NAND_DEVICE ||
 + !nand_info[nand_curr_device].name) {
 + printf(%s: invalid nand device\n,
 __func__);
 + return -1;
 + }
 +
 + nand = nand_info[nand_curr_device];
 +
 + memset(opts, 0, sizeof(opts));
 + opts.offset = dfu-data.nand.start + dfu-offset +
 + dfu-bad_skip;
 + opts.length = dfu-data.nand.start +
 + dfu-data.nand.size - opts.offset;
 + ret = nand_erase_opts(nand, opts);
 + if (ret != 0)
 + printf(Failure erase: %d\n, ret);
 + }
 +
 + return ret;
 +}
 +
  int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
  {
   char *st;
   int ret, dev, part;
  
 + dfu-ubi = 0;
   dfu-dev_type = DFU_DEV_NAND;
   st = strsep(s,  );
   if (!strcmp(st, raw)) {
 @@ -185,7 +217,32 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu,
 char *s) 
   dfu-data.nand.start = pi-offset;
   dfu-data.nand.size = pi-size;
 + } else if (!strcmp(st, partubi)) {
 + char mtd_id[32];
 + struct mtd_device *mtd_dev;
 + u8 part_num;
 + struct part_info *pi;
  
 + dfu-layout = DFU_RAW_ADDR;
 +
 + dev = simple_strtoul(s, s, 10);
 + s++;
 + part = simple_strtoul(s, s, 10);
 +
 + sprintf(mtd_id, %s%d,%d, nand, dev, part - 1);
 + printf(using id '%s'\n, mtd_id);
 +
 + mtdparts_init();
 +
 + ret = find_dev_and_part(mtd_id, mtd_dev, part_num,
 pi);
 + if (ret != 0) {
 + printf(Could not locate '%s'\n, mtd_id);
 + return -1;
 + }
 +
 + dfu-data.nand.start = pi-offset;
 + dfu-data.nand.size = pi-size;
 + dfu-ubi = 1;
   } else {
   printf(%s: Memory layout (%s) not supported!\n,
 __func__, st); return -1;
 @@ -193,6 +250,7 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu,
 char *s) 
   dfu-read_medium = dfu_read_medium_nand;
   dfu-write_medium = dfu_write_medium_nand;
 + dfu-flush_medium = dfu_flush_medium_nand;
  
   /* initial state */
   dfu-inited = 0;
 diff --git a/include/dfu.h b/include/dfu.h
 index 124653c..7bbe42d 100644
 --- a/include/dfu.h
 +++ b/include/dfu.h
 @@ -111,6 +111,8 @@ struct dfu_entity {
   u32 bad_skip;   /* for nand use */
  
   unsigned int inited:1;
 + /* for nand/ubi use */
 + unsigned int ubi:1;

Maybe it would be better to add this flag to struct nand_internal_data?
It seems to me like a nand specific.

As a side note, I'm curious 

Re: [U-Boot] [PATCH v3 2/7] ARM: OMAP5: USB: Add OMAP5 common USB EHCI information

2013-07-18 Thread Roger Quadros
Dan,

On 07/17/2013 11:16 PM, Dan Murphy wrote:
 * Enable the OMAP5 EHCI host clocks
 * Add OMAP5 EHCI register definitions
 * Add OMAP5 ES2 host revision
 
 Signed-off-by: Dan Murphy dmur...@ti.com
 ---
 v3 - Updated per comments - http://patchwork.ozlabs.org/patch/258230/
 
  arch/arm/cpu/armv7/omap5/hw_data.c  |   17 
  arch/arm/include/asm/arch-omap5/clock.h |6 +
  arch/arm/include/asm/arch-omap5/ehci.h  |   43 
 +++
  arch/arm/include/asm/ehci-omap.h|1 +
  drivers/usb/host/ehci-omap.c|2 +-
  5 files changed, 68 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/include/asm/arch-omap5/ehci.h
 
 diff --git a/arch/arm/cpu/armv7/omap5/hw_data.c 
 b/arch/arm/cpu/armv7/omap5/hw_data.c
 index 07b1108..b1be748 100644
 --- a/arch/arm/cpu/armv7/omap5/hw_data.c
 +++ b/arch/arm/cpu/armv7/omap5/hw_data.c
 @@ -414,6 +414,10 @@ void enable_basic_clocks(void)
   (*prcm)-cm_l4per_gpio6_clkctrl,
   (*prcm)-cm_l4per_gpio7_clkctrl,
   (*prcm)-cm_l4per_gpio8_clkctrl,
 +#ifdef CONFIG_USB_EHCI_OMAP
 + (*prcm)-cm_clksel_usb_60mhz,
 + (*prcm)-cm_l3init_hsusbtll_clkctrl,
 +#endif
   0
   };
  
 @@ -425,6 +429,9 @@ void enable_basic_clocks(void)
   (*prcm)-cm_wkup_wdtimer2_clkctrl,
   (*prcm)-cm_l4per_uart3_clkctrl,
   (*prcm)-cm_l4per_i2c1_clkctrl,
 +#ifdef CONFIG_USB_EHCI_OMAP
 + (*prcm)-cm_l3init_hsusbhost_clkctrl,
 +#endif
   0
   };
  
 @@ -448,6 +455,16 @@ void enable_basic_clocks(void)
   setbits_le32((*prcm)-cm_wkup_gptimer1_clkctrl,
   GPTIMER1_CLKCTRL_CLKSEL_MASK);
  
 +#ifdef CONFIG_USB_EHCI
 + /* Enable port 2 and 3 clocks*/
 + setbits_le32((*prcm)-cm_l3init_hsusbhost_clkctrl,
 + USB_HOST_HS_CLKCTRL_MASK);

For consistency, maybe you should enable all 3 port clocks
since you are enabling all 3 TLL clocks below?
 +
 + /* Enable all 3 usb host ports tll clocks*/
 + setbits_le32((*prcm)-cm_l3init_hsusbtll_clkctrl,
 + USB_TLL_HS_CLKCTRL_MASK);
 +#endif
 +
   do_enable_clocks(clk_domains_essential,
clk_modules_hw_auto_essential,
clk_modules_explicit_en_essential,
 diff --git a/arch/arm/include/asm/arch-omap5/clock.h 
 b/arch/arm/include/asm/arch-omap5/clock.h
 index 4d2765d..3a58337 100644
 --- a/arch/arm/include/asm/arch-omap5/clock.h
 +++ b/arch/arm/include/asm/arch-omap5/clock.h
 @@ -165,6 +165,12 @@
  /* CM_L3INIT_USBPHY_CLKCTRL */
  #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK8
  
 +/* CM_L3INIT_USB_HOST_HS_CLKCTRL */
 +#define USB_HOST_HS_CLKCTRL_MASK 0x56C0
 +
 +/* CM_L3INIT_USB_TLL_HS_CLKCTRL */
 +#define USB_TLL_HS_CLKCTRL_MASK  0x700
 +
  /* CM_MPU_MPU_CLKCTRL */
  #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_SHIFT   24
  #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK(3  24)
 diff --git a/arch/arm/include/asm/arch-omap5/ehci.h 
 b/arch/arm/include/asm/arch-omap5/ehci.h
 new file mode 100644
 index 000..3921e4a
 --- /dev/null
 +++ b/arch/arm/include/asm/arch-omap5/ehci.h
 @@ -0,0 +1,43 @@
 +/*
 + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com*
 + * Author: Govindraj R govindraj.r...@ti.com
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + */
 +
 +#ifndef _EHCI_H
 +#define _EHCI_H
 +
 +#define OMAP_EHCI_BASE   (OMAP54XX_L4_CORE_BASE 
 + 0x64C00)
 +#define OMAP_UHH_BASE(OMAP54XX_L4_CORE_BASE 
 + 0x64000)
 +#define OMAP_USBTLL_BASE (OMAP54XX_L4_CORE_BASE + 
 0x62000)
 +
 +/* TLL Register Set */
 +#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE  (1  3)
 +#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP  (1  2)
 +#define OMAP_USBTLL_SYSCONFIG_SOFTRESET  (1  1)
 +#define OMAP_USBTLL_SYSCONFIG_CACTIVITY  (1  8)
 +#define OMAP_USBTLL_SYSSTATUS_RESETDONE  1
 +
 +#define OMAP_UHH_SYSCONFIG_SOFTRESET 1
 +#define OMAP_UHH_SYSSTATUS_EHCI_RESETDONE(1  2)
 +#define OMAP_UHH_SYSCONFIG_NOIDLE(1  2)
 +#define OMAP_UHH_SYSCONFIG_NOSTDBY   (1  4)
 +
 +#define 

Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Lukasz Majewski
On Thu, 18 Jul 2013 07:36:40 +0200 Heiko Schocher h...@denx.de wrote,

Hi Heiko,

 Hello Lukasz,
 
 Am 17.07.2013 16:34, schrieb Lukasz Majewski:
  On Wed, 17 Jul 2013 12:26:35 +0200 Heiko Schocher h...@denx.de wrote,
 
  Hi Heiko,
 
  Hello Lukasz,
 
  Am 16.07.2013 17:35, schrieb Lukasz Majewski:
  Dear All,
 
  Since DFU usage at u-boot is spreading to different device types
  (MMC, NAND), file systems, raw partitions, ubi, etc, I think that
  it is a good moment to unify and structure the form of
  dfu_alt_info environment variable.
 
  Full Ack!
 
  Proposed new format for single dfu entity:
 
  NAME | Type | Device | Dev_num | Dev_part | FS   | start |
  size  |
 
  where:
 
  Name - name of the alt setting (as seen by dfu-util -l)
  Type - description of the image (raw, file, img, command [*])
  Device   - physical device on which data are stored (mmc, nand,
  -) Dev_num  - number of the device - it is possible to store
  data via DFU on several devices of the same type.
  Dev_part - number of partitions on the device.
 
  Should this be number of the partition on the device
 
  No. I made a mistake. It should be partition to which we want to
  write
 
 
  You mean here the mtd partition for storing, right?
 
  Yes, number of the partition to store data. The exact address will
  be extracted from mtdparts or partitions env variable.
 
 Ok.
 
 
  FS   - information about file system on the device (fat,
   ext2/ext4, ubi).
  start- start offset from the beginning of the Device (byte or
  LBA number addressed)
  size - maximal number of blocks to be stored on the Device
   (expressed with Bytes of LBA number) (protection
  from overwriting the whole device)
 
 
  Example:
 
  Maybe dummy questions ...
 
  NAME | Type | Device | Dev_num | Dev_part | FS   | start |
  size  |
  --
  u-boot   | raw  | mmc| 0   | - [**] | -  | 0x80  |
  0x100 | uImage   | file | mmc| 0   | 2| ext4 |
  -   | -   |
 
  Is this enough information? Where to store the uImage file on the
  ext4 partition?
 
  To store uImage file on ext4/fat/ext2 partition it is enough to only
  give:
 
  uImage mmc 0 2,
 
  which maps to the following command:
 
  ext4write mmc 0:2 0x4400 /uImage [size]
 
 Hmm... and what if I have my uImage in /boot/ ?

Then you need to define NAME in a following way:
/boot/uImage.

I'm also aware, that this is NOT an elegant solution.

 
  The file size is taken from number of sent bytes via DFU/USB.
 
 Yes.
 
  With writing to file system, one need to first store the whole
  transmitted data to a buffer and then store the (big) buffer on the
  SD/eMMC device.
 
 Ok, same for an ubi image.
 
  Since, we aren't supporting seek kind of write to current ext4
  implementation at u-boot, the big buffer must be used.
 
 Ok, there are places to optimize ;-)

Frankly, handling those large buffers is cumbersome. I've observed that
our current sdhci implementation has some issues with handling such
large transfers.

 
  root.img | img  | mmc| 0   | 5| -  | -   |
  -   |
 
  img means here: getting an image and storing it on the mtd
  partition Dev_part if start and size are marked with -,
  beginning on start of the partition?
 
  No, here img is for example a rootfs image. When storing it on the
  eMMC, it would be better to specify destination partition.
 
 
  Wouldn't it be better to use here mtd partition names instead
  numbers for Dev_part?
 
  I'd prefer to create a new entrance here (Part_name):
 
  NAME | Type | Device | Dev_num | Dev_part | Part_name | FS | start |
  size |
 
  I would like to avoid situation with ambiguous fields. One field
  shall only serve for one (clear) purpose. When not needed/used -
  field shall be marked as -.
 
 Ok. but this gives long constructs ...

I know, but we also want to clean up it once for a long time. I'm very
open for other ideas :-).

 
  What if start and size are filled with values for the Type
  img? Or is this forbidden for the Type img?
 
  I think, that each Type shall have predefined set of allowed
  attributes:
 
  1. img: Device + Dev num + Dev parts
  2. raw: Device + Dev num + start + size
  3. file: Device + Dev num + Dev parts + FS
 
  and so on.
 
 If we introduce a Part_name this should be also possible:
 
 4. img: Device + Dev num + Part_name
 5. file: Device + Dev num + Part_name + FS
 
 or?

Yes. This also looks valid.

 
  root.img | raw  | mmc| 0   | -  | -  | 0x1000|
  0x4000|
 
  u-boot   | raw  | nand   | 0   | -  | -  | 0x100 |
  0x100 | uImage   | file | nand   | 0   | 3| ubi  |
  -   | -   |
 
  s/uImage/rootfs.img ? s/file/img ?
 
  NAME: uImage and rootfs.img maps to files sent to board.
 
  The NAME is used thereafter to provide exact name for file system
  write (ext4write/ fatwrite).
 
 Ah! If we have to write in a subdirectory, NAME is the fullpath +
 

Re: [U-Boot] [PATCH] nds32: Enable FPU if the version of CPU supported

2013-07-18 Thread uboot
Hi Kuan-Yu Kuo,

2013/7/18 Kuan-Yu Kuo ken.ku...@gmail.com:
 +   /*
 +* enable_fpu:
 +*  Some of Andes CPU version support FPU coprocessor, if so,
 +*  we should enable it.
 +*/
 +enable_fpu:
 +   mfsr$r0, $CPU_VER   /* enable FPU if it exists */
 +   srli$r0, $r0, 3
 +   andi$r0, $r0, 1
 +   beqz$r0, 1f /* skip if no 
 COP */
 +   mfsr$r0, $FUCOP_EXIST
 +   srli$r0, $r0, 31
 +   beqz$r0, 1f /* skip if no 
 FPU */
 +   mfsr$r0, $FUCOP_CTL
 +   ori $r0, $r0, 1
 +   mtsr$r0, $FUCOP_CTL

There are two kinds of toolchain in Andes architecture, one is FPU supported 
and the other is not, for the latter one, there is no need to enable FPU even 
if the processor supports it.
This code snippet only useful for the toolchain that will generate FPU 
instructions, so add compile option to determine Andes predefined macros would 
be better.
For example:
#if defined(NDS32_EXT_FPU_DP) || defined(NDS32_EXT_FPU_SP)

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


Re: [U-Boot] [U-boot] failed to boot an compressed u-boot.bin

2013-07-18 Thread Wolfgang Denk
Dear tiger...@viatech.com.cn,

please stop top posting / full quoting.


In message fe7aded5c2218b4786c09cd97dc4c49f99d...@exchbj02.viatech.com.bj you 
wrote:

 My code base is based on u-boot-2013.04 .
 I followed board\samsung\smdkc100\config.mk , and put it into my board
 related directory.

You managed toi find a really bad example of code.  This should not be
used.  Today, CONFIG_SYS_TEXT_BASE should be defined in the board
config file instead. The use of board specific confog.mk files is
strongly deprecated.

Minkyu Kang, could you please clean this up as soon as possible?
Thanks!


 About SPL approach:
 Did you suggest I put decompressed algorithm code into SPL code instead
 of adding a self-uncompressed header?

Yes, that would be the U-Boot way to implement it. It allows you to
reusse existing code instead of adding new methods.

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
Life, loathe it or ignore it, you can't like it.
- Marvin the paranoid android
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Wolfgang Denk
Dear Heiko Schocher,

In message 51e77a1d.90...@denx.de you wrote:
 
  Try nand write.trimffs to write UBI images produced with ubinize .
 
 This solves not the erasecounter problem, or?
 
 For UBI we need something like this:
 http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo
 
 But I am not an UBI expert. It is possible I overlook something
 obvious ...

No, you don't.  Devices managed by UBI should never be erased by
other, non-UBI-aware tools.

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
I will also, for an appropriate fee, certify that  your  keyboard  is
object-oriented,  and  that  the bits on your hard disk are template-
compatible.- Jeffrey S. Haemer in 411akr$3...@cygnus.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] fs: fat: fix bug when write size is less than a sector size

2013-07-18 Thread Josh Wu
Tested in at91sam9x5ek and sama5d3x-ek in mmc fat.

Signed-off-by: Josh Wu josh...@atmel.com
---
When I debugging this issue, I also find the thread talking about this:
  http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/158698
But finally no patch is send for this bug. So I send this and cc all the
people in that thread. Hope it can be merged in 2013.07.

 fs/fat/fat_write.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 5829adf..b7ba8ea 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -561,7 +561,7 @@ set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer,
 unsigned long size)
 {
int idx = 0;
-   __u32 startsect;
+   __u32 startsect, nr_sectors;
 
if (clustnum  0)
startsect = mydata-data_begin +
@@ -571,7 +571,11 @@ set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer,
 
debug(clustnum: %d, startsect: %d\n, clustnum, startsect);
 
-   if (disk_write(startsect, size / mydata-sect_size, buffer)  0) {
+   nr_sectors = size / mydata-sect_size;
+   if (nr_sectors == 0)
+   nr_sectors = 1;
+
+   if (disk_write(startsect, nr_sectors, buffer)  0) {
debug(Error writing data\n);
return -1;
}
-- 
1.7.9.5

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


Re: [U-Boot] Boot Linux kernel with initramfs fails

2013-07-18 Thread Wolfgang Denk
Dear Axel Lin,

In message 1374128157.12431.9.camel@phoenix you wrote:

 When I boot Linux kernel with FIT Image, the kernel does not unpacking 
 initramfs.
 ( The root cause is initrd_start is NULL.)

That's probably because you don't tell Linux that there is a ramdisk.

 The initramfs is built-in with kernel, so I don't specify ramdisk in my
 kernel.its file.

And on the kernel command line?


 Below is part of my boot messages:

Unfortunately you don;t include so critical information like the
actual kernel command line.

 Warning: unable to open an initial console.

You appear to have other problems as well.

 (Test on latest u-boot git tree.)

Which exact board / configuration is this?

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
An organization dries up if you don't challenge it with growth.
   - Mark Shepherd, former President and CEO of Texas Instruments
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] fs: fat: fix bug when write size is less than a sector size

2013-07-18 Thread Wolfgang Denk
Dear Josh Wu,

In message 1374134870-10154-1-git-send-email-josh...@atmel.com you wrote:
 Tested in at91sam9x5ek and sama5d3x-ek in mmc fat.
 
 Signed-off-by: Josh Wu josh...@atmel.com
 ---
 When I debugging this issue, I also find the thread talking about this:
   http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/158698
 But finally no patch is send for this bug. So I send this and cc all the
 people in that thread. Hope it can be merged in 2013.07.

Definitely not.  This needs thurough testing before it can go
mainline.


 - __u32 startsect;
 + __u32 startsect, nr_sectors;
  
   if (clustnum  0)
   startsect = mydata-data_begin +
 @@ -571,7 +571,11 @@ set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer,
  
   debug(clustnum: %d, startsect: %d\n, clustnum, startsect);
  
 - if (disk_write(startsect, size / mydata-sect_size, buffer)  0) {
 + nr_sectors = size / mydata-sect_size;
 + if (nr_sectors == 0)
 + nr_sectors = 1;

Why would this be needed?  The case of a partial write is covered
further down below in the code, in the if (size % mydata-sect_size)
part...



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
I still miss my ex-wife, but my aim is getting better.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [U-boot] failed to boot an compressed u-boot.bin

2013-07-18 Thread TigerLiu
Dear Denk:
Yes, that would be the U-Boot way to implement it. It allows you to
reusse existing code instead of adding new methods.

So, is there any example SPL code which contains uncompressed algorithm
code?

Best wishes,

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


[U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Sascha Silbe
Hello,

ethernet support for Wandboard Quad seems to be broken on current master
(576aacdb):

U-Boot 2013.07-rc3-00021-g576aacd (Jul 18 2013 - 08:34:32)  

 


 
CPU:   Freescale i.MX6Q rev1.2 at 792 MHz   

 
Reset cause: POR

 
Board: Wandboard

 
DRAM:  2 GiB

 
MMC:   FSL_SDHC: 0, FSL_SDHC: 1 

 
*** Warning - bad CRC, using default environment

 


 
In:serial   

 
Out:   serial   

 
Err:   serial   

 
Net:   FEC [PRIME]  

 
Warning: FEC using MAC address from net device  

 


 
Hit any key to stop autoboot:  0

 
= setenv autoload no  dhcp  tftp ${fdt_addr} 
/wandboard/imx6q-wandboard.dtb  fdt addr ${fdt_addr}  tftpboot ${loadaddr} 
/wandboard/zImage  setenv bootargs console=${console},
${baudrate} rootwait  bootz ${loadaddr} - ${fdt_addr} 

 
BOOTP broadcast 1   

 
BOOTP broadcast 2   

 
BOOTP broadcast 3   

 
BOOTP broadcast 4   

 
BOOTP broadcast 5   

 


 
Retry count exceeded; starting again

 
[...]


It used to work as of e6c7f86f:

U-Boot 2013.04-00603-ge6c7f86 (Jul 18 2013 - 08:42:04)  

   

Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Sascha Silbe
Sascha Silbe t-ub...@infra-silbe.de writes:

 I've started a git bisect run (booting via USB OTG), but it's going to
 take a while as git bisect is throwing lots of commits without Wandboard
 Quad support at me and seems to be only narrowing down the commits one
 by one rather than on a log-2 basis.

A slightly more refined approach (cherry-picking the Wandboard Quad
support patch each time the build fails) enabled git bisect to track the
breakage down to:

commit de1d786edf01035f60a87e1e0f917a4169dc6964
Author: Charles Coldwell coldw...@gmail.com
Date:   Thu Feb 21 08:25:52 2013 -0500

add support for Xilinx 1000BASE-X phy (GTX)

commit 39695029bc15041c809df3db4ba19bd729c447fa
Author: Charles Coldwell coldw...@ll.mit.edu
Date:   Tue Feb 19 08:27:33 2013 -0500

Changes to support the Xilinx 1000BASE-X phy (GTX/MGT)

Signed-off-by: Charles Coldwell coldw...@ll.mit.edu

:04 04 459dbd37eb25461cc71d6e59b91a4b4994dca297 
ee62742c09ab981c458ee61a1c827ee6baefb08b M  drivers
:04 04 f8ebebe7282a5a69ed50b1f4ed687f8e8fc6a9ce 
ffd40f9c2a640f9aa74bbef92fc4a3e2925b04e0 M  include


Reverting the commit fixes ethernet support on Wandboard Quad.

Charles, do you have any idea why your commit breaks ethernet support on
Wandboard Quad? This is what I'm seeing:

U-Boot 2013.07-rc3-00021-g576aacd (Jul 18 2013 - 08:34:32)  

 

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz   

 
Reset cause: POR

 
Board: Wandboard

 
DRAM:  2 GiB

 
MMC:   FSL_SDHC: 0, FSL_SDHC: 1 

 
*** Warning - bad CRC, using default environment

 

In:serial   

 
Out:   serial   

 
Err:   serial   

 
Net:   FEC [PRIME]  

 
Warning: FEC using MAC address from net device  

 

Hit any key to stop autoboot:  0

 
= setenv autoload no  dhcp  tftp ${fdt_addr} 
/wandboard/imx6q-wandboard.dtb  fdt addr ${fdt_addr}  tftpboot ${loadaddr}
/wandboard/zImage  setenv bootargs console=${console},
${baudrate} rootwait  bootz ${loadaddr} - ${fdt_addr} 

 
BOOTP broadcast 1   

 
BOOTP broadcast 2   

 
BOOTP broadcast 3   

 
BOOTP broadcast 4   

 
BOOTP broadcast 5   
 

[U-Boot] [PATCH 1/1] net: phy/realtek: Add support for RTL8211DN and RTL8211E phy modules

2013-07-18 Thread Bhupesh Sharma
This patch adds support for Realtek PHY modules RTL8211DN and
RTL8211E (variants: RTL8211E-VB-CG, RTL8211E-VL-CG, RTL8211EG-VB-CG),
which can be found on Freescale's T1040RDB boards.

To make the driver more generic across 8211 family, a generic name 8211x
is added for macros and function names.

Signed-off-by: Bhupesh Sharma bhupesh.sha...@freescale.com
---
 drivers/net/phy/realtek.c | 77 +++
 1 file changed, 51 insertions(+), 26 deletions(-)

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index b7e2753..b971456 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -26,18 +26,18 @@
 
 #define PHY_AUTONEGOTIATE_TIMEOUT 5000
 
-/* RTL8211B PHY Status Register */
-#define MIIM_RTL8211B_PHY_STATUS   0x11
-#define MIIM_RTL8211B_PHYSTAT_SPEED0xc000
-#define MIIM_RTL8211B_PHYSTAT_GBIT 0x8000
-#define MIIM_RTL8211B_PHYSTAT_100  0x4000
-#define MIIM_RTL8211B_PHYSTAT_DUPLEX   0x2000
-#define MIIM_RTL8211B_PHYSTAT_SPDDONE  0x0800
-#define MIIM_RTL8211B_PHYSTAT_LINK 0x0400
-
-
-/* RealTek RTL8211B */
-static int rtl8211b_config(struct phy_device *phydev)
+/* RTL8211x PHY Status Register */
+#define MIIM_RTL8211x_PHY_STATUS   0x11
+#define MIIM_RTL8211x_PHYSTAT_SPEED0xc000
+#define MIIM_RTL8211x_PHYSTAT_GBIT 0x8000
+#define MIIM_RTL8211x_PHYSTAT_100  0x4000
+#define MIIM_RTL8211x_PHYSTAT_DUPLEX   0x2000
+#define MIIM_RTL8211x_PHYSTAT_SPDDONE  0x0800
+#define MIIM_RTL8211x_PHYSTAT_LINK 0x0400
+
+
+/* RealTek RTL8211x */
+static int rtl8211x_config(struct phy_device *phydev)
 {
phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
 
@@ -46,20 +46,20 @@ static int rtl8211b_config(struct phy_device *phydev)
return 0;
 }
 
-static int rtl8211b_parse_status(struct phy_device *phydev)
+static int rtl8211x_parse_status(struct phy_device *phydev)
 {
unsigned int speed;
unsigned int mii_reg;
 
-   mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211B_PHY_STATUS);
+   mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_STATUS);
 
-   if (!(mii_reg  MIIM_RTL8211B_PHYSTAT_SPDDONE)) {
+   if (!(mii_reg  MIIM_RTL8211x_PHYSTAT_SPDDONE)) {
int i = 0;
 
/* in case of timeout -link is cleared */
phydev-link = 1;
puts(Waiting for PHY realtime link);
-   while (!(mii_reg  MIIM_RTL8211B_PHYSTAT_SPDDONE)) {
+   while (!(mii_reg  MIIM_RTL8211x_PHYSTAT_SPDDONE)) {
/* Timeout reached ? */
if (i  PHY_AUTONEGOTIATE_TIMEOUT) {
puts( TIMEOUT !\n);
@@ -71,29 +71,29 @@ static int rtl8211b_parse_status(struct phy_device *phydev)
putc('.');
udelay(1000);   /* 1 ms */
mii_reg = phy_read(phydev, MDIO_DEVAD_NONE,
-   MIIM_RTL8211B_PHY_STATUS);
+   MIIM_RTL8211x_PHY_STATUS);
}
puts( done\n);
udelay(50); /* another 500 ms (results in faster booting) */
} else {
-   if (mii_reg  MIIM_RTL8211B_PHYSTAT_LINK)
+   if (mii_reg  MIIM_RTL8211x_PHYSTAT_LINK)
phydev-link = 1;
else
phydev-link = 0;
}
 
-   if (mii_reg  MIIM_RTL8211B_PHYSTAT_DUPLEX)
+   if (mii_reg  MIIM_RTL8211x_PHYSTAT_DUPLEX)
phydev-duplex = DUPLEX_FULL;
else
phydev-duplex = DUPLEX_HALF;
 
-   speed = (mii_reg  MIIM_RTL8211B_PHYSTAT_SPEED);
+   speed = (mii_reg  MIIM_RTL8211x_PHYSTAT_SPEED);
 
switch (speed) {
-   case MIIM_RTL8211B_PHYSTAT_GBIT:
+   case MIIM_RTL8211x_PHYSTAT_GBIT:
phydev-speed = SPEED_1000;
break;
-   case MIIM_RTL8211B_PHYSTAT_100:
+   case MIIM_RTL8211x_PHYSTAT_100:
phydev-speed = SPEED_100;
break;
default:
@@ -103,28 +103,53 @@ static int rtl8211b_parse_status(struct phy_device 
*phydev)
return 0;
 }
 
-static int rtl8211b_startup(struct phy_device *phydev)
+static int rtl8211x_startup(struct phy_device *phydev)
 {
/* Read the Status (2x to make sure link is right) */
genphy_update_link(phydev);
-   rtl8211b_parse_status(phydev);
+   rtl8211x_parse_status(phydev);
 
return 0;
 }
 
+/* Support for RTL8211B PHY */
 static struct phy_driver RTL8211B_driver = {
.name = RealTek RTL8211B,
.uid = 0x1cc910,
.mask = 0xf0,
.features = PHY_GBIT_FEATURES,
-   .config = rtl8211b_config,
-   .startup = rtl8211b_startup,
+   .config = rtl8211x_config,
+   .startup = rtl8211x_startup,
+   .shutdown = genphy_shutdown,
+};
+
+/* Support for RTL8211E-VB-CG, RTL8211E-VL-CG and RTL8211EG-VB-CG PHYs 

Re: [U-Boot] [PATCH 6/7 v8] NAND: TPL : introduce the TPL based on the SPL

2013-07-18 Thread Zhang Ying-B40530


-Original Message-
From: Wood Scott-B07421 
Sent: Wednesday, July 17, 2013 2:07 AM
To: Zhang Ying-B40530
Cc: Wood Scott-B07421; u-boot@lists.denx.de; aflem...@gmail.com; Xie 
Xiaobo-R63061
Subject: Re: [PATCH 6/7 v8] NAND: TPL : introduce the TPL based on the SPL

On 07/16/2013 05:04:55 AM, Zhang Ying-B40530 wrote:
 
 
 -Original Message-
 From: Wood Scott-B07421
 Sent: Tuesday, July 16, 2013 7:56 AM
 To: Zhang Ying-B40530
 Cc: u-boot@lists.denx.de; aflem...@gmail.com; Xie Xiaobo-R63061;  
 Zhang Ying-B40530
 Subject: Re: [PATCH 6/7 v8] NAND: TPL : introduce the TPL based on  
 the SPL
 

 How about something like:
 
 # $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
 $(4) is pad-to
 SPL_PAD_APPEND = \
  $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O  
 binary \
  $(1) $(obj)$(3); \
  cat $(obj)$(3) $(obj)$(2)  $@; \
  rm $(obj)$(3)
 
 $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin  
 $(obj)tpl/u-boot-with-tpl.bin
  $(call
 SPL_PAD_APPEND,$,u-boot-with-tpl.bin,spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
 
 $(obj)u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin
  $(call
 SPL_PAD_APPEND,$,u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
 [Zhang Ying]
 According to your advice, how to do for those don't have TPL?

They would use the rule for u-boot-with-spl.bin, and the TPL rule would  
be ignored.  No ifdef needed.
[Zhang Ying] 
But, Don't u-boot-with-spl.bin contain tpl/u-boot-with-tpl.bin in the following 
rule?

$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin  
$(obj)tpl/u-boot-with-tpl.bin
  $(call 
SPL_PAD_APPEND,$,u-boot-with-tpl.bin,spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))


  diff --git a/include/nand.h b/include/nand.h index 228d871..2aa7238
  100644
  --- a/include/nand.h
  +++ b/include/nand.h
  @@ -153,6 +153,9 @@ int nand_unlock(nand_info_t *meminfo, loff_t
  start, size_t length,  int nand_get_lock_status(nand_info_t  
 *meminfo,
  loff_t offset);
 
   int nand_spl_load_image(uint32_t offs, unsigned int size, void  
 *dst);
  +#ifdef CONFIG_TPL_BUILD
  +int nand_load_image(uint32_t offs, unsigned int uboot_size, void
  *vdst);
  +#endif
   void nand_deselect(void);
 
 
 Don't ifdef prototypes.  Plus, some other platforms may want this in  
 other configurations.
 [Zhang Ying]
 Remove ifdef?  If remove, there was error:
 cmd_nand.c:889:12: error: conflicting types for 'nand_load_image'.

Hmm...  In that case, please rename the function when built static.

 The function nand_load_image is defined in two files:
 1. /common/cmd_nand.c:
 static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
ulong offset, ulong addr, char *cmd)
 2. drivers/mtd/nand/fsl_elbc_spl.c
 #ifndef CONFIG_TPL_BUILD
 static
 #endif
 int nand_load_image(uint32_t offs, unsigned int uboot_size, void  
 *vdst)
 
 This function only is called by outside in TPL. So, there should  
 ifdef.

You're defining a function called nand_load_image ind  
include/nand.h.  There's nothing eLBC-specific about that.  It is  
entirely possible that another implementation will want to export that  
function in an ordinary SPL -- or even possibly in the main U-Boot  
image.

In fact, there's already a common definition for this, which is  
nand_spl_load_image().  Use that.
[Zhang Ying] 
There has a prolem:
nand_spl_simple.c: In function 'nand_init':
nand_spl_simple.c:265:2: error: too many arguments to function 'board_nand_init'

This because the functionality board_nand_init is called and parameter is not 
null, 
but board_nand_init prototype is declared to void board_nand_init(void).

In include/nand.h:

#ifdef CONFIG_SYS_NAND_SELF_INIT
void board_nand_init(void);
int nand_register(int devnum);
#else
extern int board_nand_init(struct nand_chip *nand);
#endif

There need ifdef CONFIG_SYS_NAND_SELF_INIT in nand_init(), it's ok?

#ifdef CONFIG_SYS_NAND_SELF_INIT
board_nand_init();
#else
board_nand_init(nand_chip);
#endif



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


[U-Boot] [PATCH] arm:trats:fix: Correction of loaddtb environment variable.

2013-07-18 Thread Lukasz Majewski
Missing space for loaddtb command has been added. When missing, ext4load
fails with wrong number of passed parameters.


Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/trats.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 103295e..356d87b 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -189,7 +189,7 @@
nfsroot=/nfsroot/arm\0 \
bootblock= CONFIG_BOOTBLOCK \0 \
loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 uImage\0 \
-   loaddtb=ext4load mmc ${mmcdev}:${mmcbootpart} ${fdtaddr} \
+   loaddtb=ext4load mmc ${mmcdev}:${mmcbootpart} ${fdtaddr}  \
${fdtfile}\0 \
mmcdev=0\0 \
mmcbootpart=2\0 \
-- 
1.7.10.4

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


Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Fabio Estevam
Hi Sascha,

On Thu, Jul 18, 2013 at 6:07 AM, Sascha Silbe t-ub...@infra-silbe.de wrote:
 Sascha Silbe t-ub...@infra-silbe.de writes:

 I've started a git bisect run (booting via USB OTG), but it's going to
 take a while as git bisect is throwing lots of commits without Wandboard
 Quad support at me and seems to be only narrowing down the commits one
 by one rather than on a log-2 basis.

 A slightly more refined approach (cherry-picking the Wandboard Quad
 support patch each time the build fails) enabled git bisect to track the
 breakage down to:

 commit de1d786edf01035f60a87e1e0f917a4169dc6964
 Author: Charles Coldwell coldw...@gmail.com
 Date:   Thu Feb 21 08:25:52 2013 -0500

 add support for Xilinx 1000BASE-X phy (GTX)

 commit 39695029bc15041c809df3db4ba19bd729c447fa
 Author: Charles Coldwell coldw...@ll.mit.edu
 Date:   Tue Feb 19 08:27:33 2013 -0500

 Changes to support the Xilinx 1000BASE-X phy (GTX/MGT)

 Signed-off-by: Charles Coldwell coldw...@ll.mit.edu

I confirm the same here: currently ethernet is broken in U-boot master
and reverting such commit make it work again.

Thanks,

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


Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Fabio Estevam
On Thu, Jul 18, 2013 at 8:31 AM, Fabio Estevam feste...@gmail.com wrote:
 Hi Sascha,

 On Thu, Jul 18, 2013 at 6:07 AM, Sascha Silbe t-ub...@infra-silbe.de wrote:
 Sascha Silbe t-ub...@infra-silbe.de writes:

 I've started a git bisect run (booting via USB OTG), but it's going to
 take a while as git bisect is throwing lots of commits without Wandboard
 Quad support at me and seems to be only narrowing down the commits one
 by one rather than on a log-2 basis.

 A slightly more refined approach (cherry-picking the Wandboard Quad
 support patch each time the build fails) enabled git bisect to track the
 breakage down to:

 commit de1d786edf01035f60a87e1e0f917a4169dc6964
 Author: Charles Coldwell coldw...@gmail.com
 Date:   Thu Feb 21 08:25:52 2013 -0500

 add support for Xilinx 1000BASE-X phy (GTX)

 commit 39695029bc15041c809df3db4ba19bd729c447fa
 Author: Charles Coldwell coldw...@ll.mit.edu
 Date:   Tue Feb 19 08:27:33 2013 -0500

 Changes to support the Xilinx 1000BASE-X phy (GTX/MGT)

 Signed-off-by: Charles Coldwell coldw...@ll.mit.edu

 I confirm the same here: currently ethernet is broken in U-boot master
 and reverting such commit make it work again.

I have tried:

--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -404,7 +404,7 @@ int genphy_config(struct phy_device *phydev)
if (val  ESTATUS_1000_XFULL)
features |= SUPPORTED_1000baseX_Full;
if (val  ESTATUS_1000_XHALF)
-   features |= SUPPORTED_1000baseX_Full;
+   features |= SUPPORTED_1000baseX_Half;
}

phydev-supported = features;

,but it still did not fix the issue.

Charles/Joe,

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


[U-Boot] [PATCH] dfu: Implementation of target reset after communication with dfu-util's -R switch

2013-07-18 Thread Lukasz Majewski
This patch extends dfu code to support transmission with -R switch
specified at dfu-util.

When -R is specified, the extra USB_REQ_DFU_DETACH request is sent after
successful data transmission. Then dfu resources are released and reset
command is issued.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 common/cmd_dfu.c   |   14 +-
 drivers/dfu/dfu.c  |   11 +++
 drivers/usb/gadget/f_dfu.c |2 ++
 include/dfu.h  |2 ++
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 83ef324..2d5db63 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -31,8 +31,8 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 {
const char *str_env;
char *s = dfu;
+   int ret, i = 0;
char *env_bkp;
-   int ret;
 
if (argc  3)
return CMD_RET_USAGE;
@@ -61,6 +61,15 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 
g_dnl_register(s);
while (1) {
+   if (dfu_reset())
+   /*
+* This extra number of usb_gadget_handle_interrupts()
+* calls is necessary to assure correct transmission
+* completion with dfu-util
+*/
+   if (++i == 10)
+   goto exit;
+
if (ctrlc())
goto exit;
 
@@ -72,6 +81,9 @@ done:
dfu_free_entities();
free(env_bkp);
 
+   if (dfu_reset())
+   run_command(reset, 0);
+
return CMD_RET_SUCCESS;
 }
 
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 0521752..a06db2f 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -28,9 +28,20 @@
 #include linux/list.h
 #include linux/compiler.h
 
+static bool dfu_reset_request;
 static LIST_HEAD(dfu_list);
 static int dfu_alt_num;
 
+bool dfu_reset(void)
+{
+   return dfu_reset_request;
+}
+
+void dfu_trigger_reset()
+{
+   dfu_reset_request = true;
+}
+
 static int dfu_find_alt_num(const char *s)
 {
int i = 0;
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index d7ae0c0..e869703 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -324,6 +324,8 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
DFU_STATE_dfuMANIFEST_WAIT_RST;
to_runtime_mode(f_dfu);
f_dfu-dfu_state = DFU_STATE_appIDLE;
+
+   dfu_trigger_reset();
break;
default:
f_dfu-dfu_state = DFU_STATE_dfuERROR;
diff --git a/include/dfu.h b/include/dfu.h
index 124653c..b17b80d 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -121,6 +121,8 @@ const char *dfu_get_dev_type(enum dfu_device_type t);
 const char *dfu_get_layout(enum dfu_layout l);
 struct dfu_entity *dfu_get_entity(int alt);
 char *dfu_extract_token(char** e, int *n);
+void dfu_trigger_reset(void);
+bool dfu_reset(void);
 
 int dfu_read(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
 int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
-- 
1.7.10.4

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


Re: [U-Boot] [U-boot] failed to boot an compressed u-boot.bin

2013-07-18 Thread Wolfgang Denk
Dear tiger...@viatech.com.cn,

In message fe7aded5c2218b4786c09cd97dc4c49f99d...@exchbj02.viatech.com.bj you 
wrote:

 Yes, that would be the U-Boot way to implement it. It allows you to
 reusse existing code instead of adding new methods.
 
 So, is there any example SPL code which contains uncompressed algorithm
 code?

No, none thaty I am aware of.

Note that usually this makes little sense.  Using a compressed U-Boot
image can have two effects:

- saving some memory on the boot device; usually reacent hardware has
  ample resources, so saving 100...200 kB is typically not important
  enough to add such complexity.
- saving time when loading the U-Boot image from the boot device *at
  the cost of adding time needed to uncompress it).  If you ant to
  reduce boot time, it is more efficient to use Falcon mode and skip
  loading U-Boot completely when running in production mode.

So there is actually little motivation to implement such a feature -
but your milage may vary, or you may have specific requrements where
it actually makes sense.

Patches welcome.

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
The computer can't tell you the emotional story. It can give you  the
exact mathematical design, but what's missing is the eyebrows.
- Frank Zappa
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm:exynos:gpio: fix s5p_gpio_part_max for exynos4x12

2013-07-18 Thread Piotr Wilczek

Dear Minkyu Kang,

Could you please review this patch?

Best regards,
Piotr Wilczek

--
Samsung RD Institute Poland
Samsung Electronics

On 05/21/2013 03:39 PM, Piotr Wilczek wrote:

This patch fix wrong value returned by 's5p_gpio_part_max' function
for Exynos4412.

Signed-off-by: Piotr Wilczek p.wilc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
CC: Minkyu Kang mk7.k...@samsung.com
---
  arch/arm/include/asm/arch-exynos/gpio.h |   17 +
  1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h 
b/arch/arm/include/asm/arch-exynos/gpio.h
index cfe1024..20a4e3f 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -303,10 +303,19 @@ static inline unsigned int s5p_gpio_part_max(int nr)
return EXYNOS5_GPIO_PART2_MAX;

} else if (cpu_is_exynos4()) {
-   if (nr  EXYNOS4_GPIO_PART1_MAX)
-   return 0;
-   else
-   return EXYNOS4_GPIO_PART1_MAX;
+   if (proid_is_exynos4412()) {
+   if (nr  EXYNOS4X12_GPIO_PART1_MAX)
+   return 0;
+   else if (nr  EXYNOS4X12_GPIO_PART2_MAX)
+   return EXYNOS4X12_GPIO_PART1_MAX;
+   else
+   return EXYNOS4X12_GPIO_PART2_MAX;
+   } else {
+   if (nr  EXYNOS4_GPIO_PART1_MAX)
+   return 0;
+   else
+   return EXYNOS4_GPIO_PART1_MAX;
+   }
}

return 0;



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


[U-Boot] [PATCH v6 2/2] NET: Add net_busy_flag

2013-07-18 Thread Jim Lin
This flag is to have console aware that NET transfer is running or not.

Signed-off-by: Jim Lin ji...@nvidia.com
---
Changes in v2:
 1. Change configuration name from CONFIG_CTRLC_POLL_MS to CONFIG_CTRLC_POLL_S.
 2. New code will be executed only when CONFIG_CTRLC_POLL_S is defined in
configuration header file.
 3. Add description in README.console.
Changes in v3:
 1. Move changes to common/usb_kbd.c and doc/README.usb
 2. Rename config setting to CONFIG_USBKB_TESTC_PERIOD.
 3. Remove slow response on USB-keyboard input when TFTP boot is not running.
Changes in v4:
 1. Remove changes in doc/README.usb, common/usb_kbd.c and
CONFIG_USBKB_TESTC_PERIOD 
 2. Modify net/net.c
Changes in v5:
 1. Change variable name to ctrlc_t_start.
 2. Use two calls of get_timer(0) to get time gap.
Changes in v6:
 1. Add net_busy_flag to make console aware NET transfer is running or not.

 net/net.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/net.c b/net/net.c
index df94789..76d8ea9 100644
--- a/net/net.c
+++ b/net/net.c
@@ -207,6 +207,8 @@ static int net_check_prereq(enum proto_t protocol);
 
 static int NetTryCount;
 
+int net_busy_flag;
+
 /**/
 
 static int on_bootfile(const char *name, const char *value, enum env_op op,
@@ -341,6 +343,7 @@ int NetLoop(enum proto_t protocol)
eth_init_state_only(bd);
 
 restart:
+   net_busy_flag = 0;
net_set_state(NETLOOP_CONTINUE);
 
/*
@@ -454,6 +457,8 @@ restart:
 #endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */
 #endif /* CONFIG_MII, ... */
 
+   net_busy_flag = 1;
+
/*
 *  Main packet reception loop.  Loop receiving packets until
 *  someone sets `net_state' to a state that terminates.
@@ -558,6 +563,7 @@ restart:
}
 
 done:
+   net_busy_flag = 0;
 #ifdef CONFIG_CMD_TFTPPUT
/* Clear out the handlers */
net_set_udp_handler(NULL);
-- 
1.7.7

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


[U-Boot] [PATCH v6 1/2] console: usb: kbd: To improve TFTP booting performance

2013-07-18 Thread Jim Lin
TFTP booting is slow when a USB keyboard is installed and
stdin has usbkbd added.
This fix is to change Ctrl-C polling for USB keyboard to every second
when NET transfer is running.

Signed-off-by: Jim Lin ji...@nvidia.com
---
Changes in v2:
 1. Change configuration name from CONFIG_CTRLC_POLL_MS to CONFIG_CTRLC_POLL_S.
 2. New code will be executed only when CONFIG_CTRLC_POLL_S is defined in
configuration header file.
 3. Add description in README.console.
Changes in v3:
 1. Move changes to common/usb_kbd.c and doc/README.usb
 2. Rename config setting to CONFIG_USBKB_TESTC_PERIOD.
 3. Remove slow response on USB-keyboard input when TFTP boot is not running.
Changes in v4:
 1. Remove changes in doc/README.usb, common/usb_kbd.c and
CONFIG_USBKB_TESTC_PERIOD 
 2. Modify net/net.c
Changes in v5:
 1. Change variable name to ctrlc_t_start.
 2. Use two calls of get_timer(0) to get time gap.
Changes in v6:
 1. In common/usb_kbd.c, check net_busy_flag to determine whether we poll
USB keyboard status.
 2. In include/usb.h, add external variable declaration net_busy_flag


 common/usb_kbd.c |   15 +++
 include/usb.h|2 +-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 3174b5e..3288c69 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -121,6 +121,9 @@ struct usb_kbd_pdata {
uint8_t flags;
 };
 
+/* The period of time between two calls of usb_kbd_testc(). */
+static unsigned long kbd_testc_tms;
+
 /* Generic keyboard event polling. */
 void usb_kbd_generic_poll(void)
 {
@@ -366,6 +369,18 @@ static int usb_kbd_testc(void)
struct usb_device *usb_kbd_dev;
struct usb_kbd_pdata *data;
 
+   /*
+* If net_busy_flag is 1, NET transfer is running,
+* then we check key pressed every second to improve
+* TFTP booting performance.
+*/
+   if (net_busy_flag) {
+   if (get_timer(kbd_testc_tms)  CONFIG_SYS_HZ)
+   return 0;
+   else
+   kbd_testc_tms = get_timer(0);
+   }
+
dev = stdio_get_by_name(DEVNAME);
usb_kbd_dev = (struct usb_device *)dev-priv;
data = usb_kbd_dev-privptr;
diff --git a/include/usb.h b/include/usb.h
index d7b082d..824b394 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -206,7 +206,7 @@ int usb_host_eth_scan(int mode);
 
 int drv_usb_kbd_init(void);
 int usb_kbd_deregister(void);
-
+extern int net_busy_flag;
 #endif
 /* routines */
 int usb_init(void); /* initialize the USB Controller */
-- 
1.7.7

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


Re: [U-Boot] [PATCH v6 1/2] console: usb: kbd: To improve TFTP booting performance

2013-07-18 Thread Marek Vasut
Dear Jim Lin,

 TFTP booting is slow when a USB keyboard is installed and
 stdin has usbkbd added.
 This fix is to change Ctrl-C polling for USB keyboard to every second
 when NET transfer is running.
 
 Signed-off-by: Jim Lin ji...@nvidia.com
 ---
 Changes in v2:
  1. Change configuration name from CONFIG_CTRLC_POLL_MS to
 CONFIG_CTRLC_POLL_S. 2. New code will be executed only when
 CONFIG_CTRLC_POLL_S is defined in configuration header file.
  3. Add description in README.console.
 Changes in v3:
  1. Move changes to common/usb_kbd.c and doc/README.usb
  2. Rename config setting to CONFIG_USBKB_TESTC_PERIOD.
  3. Remove slow response on USB-keyboard input when TFTP boot is not
 running. Changes in v4:
  1. Remove changes in doc/README.usb, common/usb_kbd.c and
 CONFIG_USBKB_TESTC_PERIOD
  2. Modify net/net.c
 Changes in v5:
  1. Change variable name to ctrlc_t_start.
  2. Use two calls of get_timer(0) to get time gap.
 Changes in v6:
  1. In common/usb_kbd.c, check net_busy_flag to determine whether we poll
 USB keyboard status.
  2. In include/usb.h, add external variable declaration net_busy_flag
 
 
  common/usb_kbd.c |   15 +++
  include/usb.h|2 +-
  2 files changed, 16 insertions(+), 1 deletions(-)
 
 diff --git a/common/usb_kbd.c b/common/usb_kbd.c
 index 3174b5e..3288c69 100644
 --- a/common/usb_kbd.c
 +++ b/common/usb_kbd.c
 @@ -121,6 +121,9 @@ struct usb_kbd_pdata {
   uint8_t flags;
  };
 
 +/* The period of time between two calls of usb_kbd_testc(). */
 +static unsigned long kbd_testc_tms;
 +
  /* Generic keyboard event polling. */
  void usb_kbd_generic_poll(void)
  {
 @@ -366,6 +369,18 @@ static int usb_kbd_testc(void)
   struct usb_device *usb_kbd_dev;
   struct usb_kbd_pdata *data;
 
 + /*
 +  * If net_busy_flag is 1, NET transfer is running,
 +  * then we check key pressed every second to improve
 +  * TFTP booting performance.
 +  */
 + if (net_busy_flag) {

THis variable is not declared so this patch won't compile

 + if (get_timer(kbd_testc_tms)  CONFIG_SYS_HZ)
 + return 0;
 + else
 + kbd_testc_tms = get_timer(0);
 + }
 +
   dev = stdio_get_by_name(DEVNAME);
   usb_kbd_dev = (struct usb_device *)dev-priv;
   data = usb_kbd_dev-privptr;
 diff --git a/include/usb.h b/include/usb.h
 index d7b082d..824b394 100644
 --- a/include/usb.h
 +++ b/include/usb.h
 @@ -206,7 +206,7 @@ int usb_host_eth_scan(int mode);
 
  int drv_usb_kbd_init(void);
  int usb_kbd_deregister(void);
 -
 +extern int net_busy_flag;
  #endif
  /* routines */
  int usb_init(void); /* initialize the USB Controller */

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Marek Vasut
Hi,

 Dear Heiko Schocher,
 
 In message 51e77a1d.90...@denx.de you wrote:
   Try nand write.trimffs to write UBI images produced with ubinize .
  
  This solves not the erasecounter problem, or?
  
  For UBI we need something like this:
  http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo
  
  But I am not an UBI expert. It is possible I overlook something
  obvious ...
 
 No, you don't.  Devices managed by UBI should never be erased by
 other, non-UBI-aware tools.

I based my reply on the following commit in U-Boot and the fact that 
write.trimffs is used to flash UBI images. Maybe I was wrong?

commit c9494866df835bcee68e17339aec1090faa704da
Author: Ben Gardiner bengardi...@nanometrics.ca
Date:   Tue Jun 14 16:35:07 2011 -0400

cmd_nand: add nand write.trimffs command

Add another nand write. variant, trimffs. This command will request of
nand_write_skip_bad() that all trailing all-0xff pages will be
dropped from eraseblocks when they are written to flash as-per the
reccommended behaviour of the UBI FAQ [1].

The function that implements this timming is the drop_ffs() function
by Artem Bityutskiy, ported from the mtd-utils tree.

[1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 5/7] ARM: OMAP5-uevm: Add USB MAC ethernet address

2013-07-18 Thread Dan Murphy
On 07/17/2013 11:28 PM, Marek Vasut wrote:
 Dear Dan Murphy,

 Set the usbethaddr based on the OMAP DIE_ID registers
 which should be unique for each processor.

 Then set this as the usb ethernet MAC address.

 Signed-off-by: Dan Murphy dmur...@ti.com
 ---
 v3 - new patch

  board/ti/omap5_uevm/evm.c|   26 ++
  include/configs/omap5_uevm.h |2 ++
  2 files changed, 28 insertions(+)

 diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
 index bf14cd2..9add0fd 100644
 --- a/board/ti/omap5_uevm/evm.c
 +++ b/board/ti/omap5_uevm/evm.c
 @@ -33,6 +33,11 @@
  #include usb.h
  #include asm/arch/ehci.h
  #include asm/ehci-omap.h
 +
 +#define MAX_DEVICE_MAC  20
 +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000)
 +#define DIE_ID_REG_OFFSET   0x200
 +
  #endif

  DECLARE_GLOBAL_DATA_PTR;
 @@ -121,6 +126,27 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr,
 struct ehci_hcor **hcor) {
  int ret;
  int auxclk;
 +int val[4] = { 0 };
 +int reg;
 +char device_mac[MAX_DEVICE_MAC];
 +
 +reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET;
 +
 +val[0] = readl(reg);
 +val[1] = readl(reg + 0x8);
 +val[2] = readl(reg + 0xC);
 +val[3] = readl(reg + 0x10);
 +
 +/* create a fake MAC address from the processor ID code.
 + * first byte is 0x02 to signify locally administered.
 + */
 /*
  * valid
  * multiline
  * comment ... has that leading newline on the top. [1]
  */

Will fix
 +snprintf(device_mac, MAX_DEVICE_MAC, %02X:%02X:%02X:%02X:%02X:%02X,
 +0x02, val[3]  0xff, val[2]  0xff, val[1]  
 0xff,
 +val[0]  0xff, (val[0]  8  0xff));
 +
 +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 +setenv(usbethaddr, device_mac);
 +#endif
 Urgh ... this is a big fat NAK. No, just don't do this, please. A kitten will 
 die if you set variables in the code like this. Another one will die for such 
 a 
 config option.

 You might work around this problem by setting a different env variable (yet I 
 am 
 still unhappy to see this) and then in the board environment have a command 
 to 
 load the USB mac address from that other variable. But do not enforce the mac 
 address on users.

I will modify the usbethaddr only if the user has not already set the variable.
This is the way I see it in other code as well.

Is that acceptable?

  auxclk = readl((*prcm)-scrm_auxclk1);
  /* Request auxilary clock */
 diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h
 index 0740a32..53b86ec 100644
 --- a/include/configs/omap5_uevm.h
 +++ b/include/configs/omap5_uevm.h
 @@ -79,5 +79,7 @@

  #define CONSOLEDEV  ttyO2

 +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 +
  #define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC16296
  #endif /* __CONFIG_OMAP5_EVM_H */
 [1] http://www.denx.de/wiki/U-Boot/CodingStyle

 Best regards,
 Marek Vasut


-- 
--
Dan Murphy

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


Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Fabio Estevam
Joe,

On Thu, Jul 18, 2013 at 8:41 AM, Fabio Estevam feste...@gmail.com wrote:

 I have tried:

 --- a/drivers/net/phy/phy.c
 +++ b/drivers/net/phy/phy.c
 @@ -404,7 +404,7 @@ int genphy_config(struct phy_device *phydev)
 if (val  ESTATUS_1000_XFULL)
 features |= SUPPORTED_1000baseX_Full;
 if (val  ESTATUS_1000_XHALF)
 -   features |= SUPPORTED_1000baseX_Full;
 +   features |= SUPPORTED_1000baseX_Half;
 }

 phydev-supported = features;

 ,but it still did not fix the issue.

 Charles/Joe,

 Any ideas?

Also tested on a mx6qsabresd and ethernet is also broken there as well.

The following patch fixes it:

--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -337,12 +337,8 @@ int genphy_parse_link(struct phy_device *phydev)
estatus = phy_read(phydev, MDIO_DEVAD_NONE,
   MII_ESTATUS);

-   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |
-   ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
-   phydev-speed = SPEED_1000;
-   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
-   phydev-duplex = DUPLEX_FULL;
-   }
+   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
+   phydev-duplex = DUPLEX_FULL;

} else {
u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);

Is this the correct fix?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 5/7] ARM: OMAP5-uevm: Add USB MAC ethernet address

2013-07-18 Thread Marek Vasut
Dear Dan Murphy,

 On 07/17/2013 11:28 PM, Marek Vasut wrote:
  Dear Dan Murphy,
  
  Set the usbethaddr based on the OMAP DIE_ID registers
  which should be unique for each processor.
  
  Then set this as the usb ethernet MAC address.
  
  Signed-off-by: Dan Murphy dmur...@ti.com
  ---
  v3 - new patch
  
   board/ti/omap5_uevm/evm.c|   26 ++
   include/configs/omap5_uevm.h |2 ++
   2 files changed, 28 insertions(+)
  
  diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
  index bf14cd2..9add0fd 100644
  --- a/board/ti/omap5_uevm/evm.c
  +++ b/board/ti/omap5_uevm/evm.c
  @@ -33,6 +33,11 @@
  
   #include usb.h
   #include asm/arch/ehci.h
   #include asm/ehci-omap.h
  
  +
  +#define MAX_DEVICE_MAC20
  +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000)
  +#define DIE_ID_REG_OFFSET 0x200
  +
  
   #endif
   
   DECLARE_GLOBAL_DATA_PTR;
  
  @@ -121,6 +126,27 @@ int ehci_hcd_init(int index, struct ehci_hccr
  **hccr, struct ehci_hcor **hcor) {
  
 int ret;
 int auxclk;
  
  +  int val[4] = { 0 };
  +  int reg;
  +  char device_mac[MAX_DEVICE_MAC];
  +
  +  reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET;
  +
  +  val[0] = readl(reg);
  +  val[1] = readl(reg + 0x8);
  +  val[2] = readl(reg + 0xC);
  +  val[3] = readl(reg + 0x10);
  +
  +  /* create a fake MAC address from the processor ID code.
  +   * first byte is 0x02 to signify locally administered.
  +   */
  
  /*
  
   * valid
   * multiline
   * comment ... has that leading newline on the top. [1]
   */
 
 Will fix
 
  +  snprintf(device_mac, MAX_DEVICE_MAC, %02X:%02X:%02X:%02X:%02X:%02X,
  +  0x02, val[3]  0xff, val[2]  0xff, val[1] 
  
  0xff,
  
  +  val[0]  0xff, (val[0]  8  0xff));
  +
  +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
  +  setenv(usbethaddr, device_mac);
  +#endif
  
  Urgh ... this is a big fat NAK. No, just don't do this, please. A kitten
  will die if you set variables in the code like this. Another one will
  die for such a config option.
  
  You might work around this problem by setting a different env variable
  (yet I am still unhappy to see this) and then in the board environment
  have a command to load the USB mac address from that other variable. But
  do not enforce the mac address on users.
 
 I will modify the usbethaddr only if the user has not already set the
 variable. This is the way I see it in other code as well.
 
 Is that acceptable?

That'd also make sense, yeah.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Charles Coldwell
On Thu, Jul 18, 2013 at 5:07 AM, Sascha Silbe t-ub...@infra-silbe.de wrote:


 Charles, do you have any idea why your commit breaks ethernet support on
 Wandboard Quad?

I've never heard of the Wandboard Quad, so I suppose the short answer
is no.  However, the philosophy of the patch I submitted was:

1. Check the ESTATEN (Extended Status Enabled) bit in the BMSR (Basic
Mode Status Register at address 0x01) MII register.

2. If it is set, read the ESTATUS (Extended Status) register

3. If the ESTATUS register indicates that it supports 1000BASE-X or
1000BASE-T, set the corresponding speed and duplex fields of the
phy_device structure.

The MDIO registers in the Xilinx 1000BASE-X phy are documented here

http://www.xilinx.com/support/documentation/user_guides/ug194.pdf

starting on page 122.

ESTATEN is bit 8 of the BMSR at address 0x01; ESTATUS is at register
address 15 and should always hold the value 0x8000 on the Xilinx
1000BASE-X phy since the only mode it supports is 1000BASE-X full
duplex.

So, AFAICS, the patch should function correctly if both phys are using
the same register maps.  However, I don't think the Xilinx register
map is blessed by the MDIO standards bodies, and therein might lie the
trouble.

Can somebody look up the phy register maps for the i.MX6 phy (if it's
built in) or whatever the Wandboard is using?

--
Charles M. Coldwell, W1CMC
Belmont, Massachusetts, New England
Turn on, log in, tune out
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Charles Coldwell
On Thu, Jul 18, 2013 at 11:44 AM, Fabio Estevam feste...@gmail.com wrote:

 The following patch fixes it:

 --- a/drivers/net/phy/phy.c
 +++ b/drivers/net/phy/phy.c
 @@ -337,12 +337,8 @@ int genphy_parse_link(struct phy_device *phydev)
 estatus = phy_read(phydev, MDIO_DEVAD_NONE,
MII_ESTATUS);

 -   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |
 -   ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
 -   phydev-speed = SPEED_1000;
 -   if (estatus  (ESTATUS_1000_XFULL | 
 ESTATUS_1000_TFULL))
 -   phydev-duplex = DUPLEX_FULL;
 -   }
 +   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
 +   phydev-duplex = DUPLEX_FULL;

 } else {
 u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);

 Is this the correct fix?

No, I don't think so.

In the previous version, it would have set both phydev-speed and
phydev-duplex; after your patch it only sets phydev-duplex.

What happens if you just remove the line that assigns phydev-speed in
the previous version?

--
Charles M. Coldwell, W1CMC
Belmont, Massachusetts, New England
Turn on, log in, tune out
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 5/6] omap3_beagle: support findfdt and loadfdt for devicetree support

2013-07-18 Thread Tom Rini
On Mon, Jul 15, 2013 at 04:52:51PM +0200, Koen Kooi wrote:
 
 Op 15 jul. 2013, om 16:49 heeft Tom Rini tr...@ti.com het volgende 
 geschreven:
 
  On Mon, Jul 15, 2013 at 02:16:50PM +0200, Koen Kooi wrote:
  
  Op 15 jul. 2013, om 14:11 heeft Nishanth Menon n...@ti.com het volgende 
  geschreven:
  
  For folks not using concatenated device tree with uImage, having
  an handy function to find and load device tree is very handy.
  
  So introduce findfdt and loadfdt and run findfdt by default to make
  it easier on user scripts.
  
  Signed-off-by: Nishanth Menon n...@ti.com
  ---
  V3: Fixes typo mistake reported in 
  http://marc.info/?t=13735821236r=1w=2
  
  include/configs/omap3_beagle.h |   15 +++
  1 file changed, 15 insertions(+)
  
  diff --git a/include/configs/omap3_beagle.h 
  b/include/configs/omap3_beagle.h
  index bdeee17..5ec8ade 100644
  --- a/include/configs/omap3_beagle.h
  +++ b/include/configs/omap3_beagle.h
  @@ -210,6 +210,8 @@
  #define CONFIG_EXTRA_ENV_SETTINGS \
loadaddr=0x8020\0 \
rdaddr=0x8100\0 \
  + fdt_high=0x\0 \
  + fdtaddr=0x80f8\0 \
usbtty=cdc_acm\0 \
bootfile=uImage\0 \
ramdisk=ramdisk.gz\0 \
  @@ -250,6 +252,17 @@
omapdss.def_disp=${defaultdisplay}  \
root=${nandroot}  \
rootfstype=${nandrootfstype}\0 \
  + findfdt= \
  + if test $beaglerev = AxBx; then  \
  + setenv fdtfile omap3-beagle.dtb; fi;  \
  + if test $beaglerev = Cx; then  \
  + setenv fdtfile omap3-beagle.dtb; fi;  \
  + if test $beaglerev = xMAB; then  \
  + setenv fdtfile omap3-beagle-xm.dtb; fi;  \
  + if test $beaglerev = xMC; then  \
  + setenv fdtfile omap3-beagle-xm.dtb; fi;  \
  + if test $fdtfile = undefined; then  \
  + echo WARNING: Could not determine device tree to use; 
  fi; \0 \
  
  With the remote chance of a future xM rev D, can you make the
  fallthrough be 'omap3-beagle-xm.dtb' intead of 'undefined'?
  
  I don't like that idea.  On am335x_evm configs we have undefined and
  then say hey, it's undefined! so it's clear that we don't know what to
  do.  That in theory future xM rev D might need a different device tree
  for example.
 
 And that's patched out on the build that actually ships with the
 beaglebone and beaglebone black so it will fall back to BBB when it
 can't ID the board. You'll see that the u-boot bits that need the ID
 for the xM also fallback to the latest rev. I don't see why the
 boardfile and script need to have different behaviour.

Yes, I'm not terribly happy with what gets done for the shipping U-Boot
on BBB, but I understand you're trying to not have too special of a
binary used in programming versus distribution of the board.  If the
vendor wants to ship software that says when in doubt, it's likely this
board, that's OK for the vendor to do.

-- 
Tom


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


Re: [U-Boot] [RFC] Improve bootargs for IGEP boards.

2013-07-18 Thread Tom Rini
On Tue, Jul 16, 2013 at 10:00:16AM +0200, Enric Balletbo Serra wrote:

[snip]
   o 2nd proposal:
 
 4 partitions:
 SPL
 U-Boot
 U-Boot Environment
 Filesystem (ubifs): zImage + kernel modules + dtbs files + filesystem

A slight change here would be 3 partitions
1) SPL (that covers the redundant locations as well)
2) U-Boot
3) UBI container of: env, redundant env and either filesystem with
kernel+dtbs, or kernel and dtbs in their own volumes, I'm not sure which
is better there honestly.

But I did want to highlight that we support U-Boot env in the UBI
container.

-- 
Tom


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


Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Fabio Estevam
On Thu, Jul 18, 2013 at 12:49 PM, Charles Coldwell coldw...@gmail.com wrote:

 What happens if you just remove the line that assigns phydev-speed in
 the previous version?

It works fine if I do:

--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -339,7 +339,6 @@ int genphy_parse_link(struct phy_device *phydev)

if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |
ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
-   phydev-speed = SPEED_1000;
if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
phydev-duplex = DUPLEX_FULL;
}

Is this the correct fix?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Tom Rini
On Tue, Jul 16, 2013 at 05:35:21PM +0200, Lukasz Majewski wrote:

 Dear All,
 
 Since DFU usage at u-boot is spreading to different device types (MMC,
 NAND), file systems, raw partitions, ubi, etc, I think that it is a
 good moment to unify and structure the form of dfu_alt_info environment
 variable.
[snip]
 NAME | Type | Device | Dev_num | Dev_part | FS   | start | size  | 
[snip]
 u-boot   | raw  | nand   | 0   | -  | -  | 0x100 | 0x100 |
 uImage   | file | nand   | 0   | 3| ubi  | -   | -   | 

We also need to cover:

uImage | raw  | nand   | 0   | kernel | -  | -   | -   |

Since partitions provide start/size.  And I'm not totally sure we're
providing enough information for 'destination resides in this part of
UBI container'.  It could be /boot/uImage in rootfs in ubi0 or raw to
kernel0 in ubi0.

-- 
Tom


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


Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Fabio Estevam
On Thu, Jul 18, 2013 at 9:31 AM, Charles Coldwell coldw...@gmail.com wrote:

 Can somebody look up the phy register maps for the i.MX6 phy (if it's
 built in) or whatever the Wandboard is using?

mx6qsabresd and wandboard both use AR8031 PHY.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] usb: Use well-known descriptor sizes when parsing configuration

2013-07-18 Thread Albert ARIBAUD
Hi Julius,

On Wed, 17 Jul 2013 17:55:19 -0700, Julius Werner
jwer...@chromium.org wrote:

 The existing USB configuration parsing code relies on the descriptors'
 own length values when reading through the configuration blob. Since the
 size of those descriptors is always well-defined, we should rather use
 the known sizes instead of trusting device-provided values to be
 correct. Also adds some safety to potential out-of-order descriptors.
 
 Change-Id: I16f69dfdd6793aa0fe930b5148d4521f3e5c3090
 Signed-off-by: Julius Werner jwer...@chromium.org
 ---

Please do not forget patch history.

  common/usb.c | 73 
 ++--
  common/usb_hub.c | 14 ---
  2 files changed, 64 insertions(+), 23 deletions(-)
 
 diff --git a/common/usb.c b/common/usb.c
 index 55fff5b..ab7bafe 100644
 --- a/common/usb.c
 +++ b/common/usb.c
 @@ -341,6 +341,7 @@ static int usb_set_maxpacket(struct usb_device *dev)
  
 /***
   * Parse the config, located in buffer, and fills the dev-config structure.
   * Note that all little/big endian swapping are done automatically.
 + * (wTotalLength has already been swapped when it was read.)
   */
  static int usb_parse_config(struct usb_device *dev,
   unsigned char *buffer, int cfgno)
 @@ -361,24 +362,39 @@ static int usb_parse_config(struct usb_device *dev,
   head-bDescriptorType);
   return -1;
   }
 - memcpy(dev-config, buffer, buffer[0]);
 - le16_to_cpus((dev-config.desc.wTotalLength));
 + if (buffer[0] != USB_DT_CONFIG_SIZE)
 + printf(Ignoring invalid USB CFG length (%d)\n, buffer[0]);
 + memcpy(dev-config, buffer, USB_DT_CONFIG_SIZE);
   dev-config.no_of_if = 0;

From a security / robustness standpoint,

- if the descriptor length field is found to be abnormal, then the code
  should not process the packet at all. Here it seems it only warns
  then goes on to use the descriptor.

- if for some reason (although I don't see any) the descriptor must be
  processed despite its wrong length, then only the bytes at positions
  0..length-1 should be considered; bytes beyond the descriptor's
  announced length should be deemed undefined (and, I might add,
  should not be even be read from the device).

   index = dev-config.desc.bLength;
   /* Ok the first entry must be a configuration entry,
* now process the others */
   head = (struct usb_descriptor_header *) buffer[index];
 - while (index + 1  dev-config.desc.wTotalLength) {
 + while (index + 1  dev-config.desc.wTotalLength  head-bLength) {

Does this change fall into either using the well-defined length
or adding safety to out-of-order descriptors category? If none, then
there should be a third category of change documented in the commit
message.

   switch (head-bDescriptorType) {
   case USB_DT_INTERFACE:
 + if (index + USB_DT_INTERFACE_SIZE 
 + dev-config.desc.wTotalLength) {
 + puts(USB IF descriptor overflowed buffer!\n);
 + break;
 + }
   if (((struct usb_interface_descriptor *) \
buffer[index])-bInterfaceNumber != curr_if_num) {
   /* this is a new interface, copy new desc */
   ifno = dev-config.no_of_if;
 + if (ifno = USB_MAXINTERFACES) {
 + puts(Too many USB interfaces!\n);
 + /* try to go on with what we have */
 + return 1;
 + }
   if_desc = dev-config.if_desc[ifno];
   dev-config.no_of_if++;
 - memcpy(if_desc, buffer[index], buffer[index]);
 + if (buffer[index] != USB_DT_INTERFACE_SIZE)
 + printf(Ignoring invalid USB IF length
 +  (%d)\n, buffer[index]);
 + memcpy(if_desc, buffer[index],
 + USB_DT_INTERFACE_SIZE);

Again here, a wrong length is detected yet the descriptor is used.

   if_desc-no_of_ep = 0;
   if_desc-num_altsetting = 1;
   curr_if_num =
 @@ -392,12 +408,29 @@ static int usb_parse_config(struct usb_device *dev,
   }
   break;
   case USB_DT_ENDPOINT:
 + if (index + USB_DT_ENDPOINT_SIZE 
 + dev-config.desc.wTotalLength) {
 + puts(USB EP descriptor overflowed buffer!\n);
 + break;
 

Re: [U-Boot] Ethernet support broken for Wandboard Quad on master

2013-07-18 Thread Fabio Estevam
On Thu, Jul 18, 2013 at 9:31 AM, Charles Coldwell coldw...@gmail.com wrote:
 On Thu, Jul 18, 2013 at 5:07 AM, Sascha Silbe t-ub...@infra-silbe.de wrote:


 Charles, do you have any idea why your commit breaks ethernet support on
 Wandboard Quad?

 I've never heard of the Wandboard Quad, so I suppose the short answer
 is no.  However, the philosophy of the patch I submitted was:

 1. Check the ESTATEN (Extended Status Enabled) bit in the BMSR (Basic
 Mode Status Register at address 0x01) MII register.

 2. If it is set, read the ESTATUS (Extended Status) register

 3. If the ESTATUS register indicates that it supports 1000BASE-X or
 1000BASE-T, set the corresponding speed and duplex fields of the
 phy_device structure.

 The MDIO registers in the Xilinx 1000BASE-X phy are documented here

Which board uses the Xilinx 1000BASE-X in U-boot?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] usb: Use well-known descriptor sizes when parsing configuration

2013-07-18 Thread Julius Werner
 From a security / robustness standpoint,

 - if the descriptor length field is found to be abnormal, then the code
   should not process the packet at all. Here it seems it only warns
   then goes on to use the descriptor.

Weren't you the guy who was so worried about poor Chinese devices who
don't follow the spec just two mails ago? This code just tries to make
the most of a broken response while keeping the host safe. Since the
descriptors are just put into a structure and left there for the
driver to decide which ones it's interested in anyway, more is usually
better than less.

 - if for some reason (although I don't see any) the descriptor must be
   processed despite its wrong length, then only the bytes at positions
   0..length-1 should be considered; bytes beyond the descriptor's
   announced length should be deemed undefined (and, I might add,
   should not be even be read from the device).

This is not reading from the device, it's memcpy()'ing between an
already read buffer and another data structure. memcpy()'ing one byte
less into an uninitialized struct doesn't make the last byte any less
undefined than copying garbage.

 Does this change fall into either using the well-defined length
 or adding safety to out-of-order descriptors category? If none, then
 there should be a third category of change documented in the commit
 message.

It's another thing about the length... it prevents the code from
running into an endless loop when it encounters a descriptor with
length 0.

 - if (usb_get_hub_descriptor(dev, buffer, descriptor-bLength)  0) {
 + if (usb_get_hub_descriptor(dev, buffer, length)  0) {
   debug(usb_hub_configure: failed to get hub  \
 descriptor 2nd giving up %lX\n, dev-status);

 This message seems less clear than the one it replaces; I suspect
 failed to get hub descriptor 2nd giving up is not a valid sentence.

I'm only touching the condition... if you don't like the message, I'd
be happy to review your patch for it.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/2] console: usb: kbd: To improve TFTP booting performance

2013-07-18 Thread Stephen Warren
On 07/18/2013 08:15 AM, Jim Lin wrote:
 TFTP booting is slow when a USB keyboard is installed and
 stdin has usbkbd added.
 This fix is to change Ctrl-C polling for USB keyboard to every second
 when NET transfer is running.

I think this general approach is a reasonable compromise to the problem.

Some issues need to be considered:

1) git bisect is broken as Marek pointed out.

2) Does the code still compile/link if USB keyboard and/or networking
support is not enabled? I suspect it won't in the case where USB
keyboard is enabled, yet networking support isn't. This probably needs
to be solved by putting int net_busy_flag; into some common
non-optional file so that all the users of that variable don't have to
be chronically ifdef'd for all the possible feature combinations.

3) Is net_busy_flag the best name for the variable? Perhaps the flag
could be used to disable other time-consuming polling beyond just USB
keyboard CTRL-C handling. Perhaps other operations besides networking
transfers could benefit from setting this flag. At the risk of
bike-shedding, how about renaming this one of:

reduce_non_critical_polling_frequency
non_interactive_operation_in_progress

?

A comment on the code below:

 diff --git a/common/usb_kbd.c b/common/usb_kbd.c

 @@ -366,6 +369,18 @@ static int usb_kbd_testc(void)
   struct usb_device *usb_kbd_dev;
   struct usb_kbd_pdata *data;
  
 + /*
 +  * If net_busy_flag is 1, NET transfer is running,
 +  * then we check key pressed every second to improve
 +  * TFTP booting performance.
 +  */
 + if (net_busy_flag) {
 + if (get_timer(kbd_testc_tms)  CONFIG_SYS_HZ)
 + return 0;
 + else
 + kbd_testc_tms = get_timer(0);
 + }

I think you always want to assign to kbd_testc_tms so it always records
the most recent time of the most recent USB keyboard activity, not the
most recent USB keyboard activity while a network operation was in
progress. So,

if (net_busy_flag  get_timer(kbd_testc_tms)  CONFIG_SYS_HZ)
return 0;
kbd_testc_tms = get_timer(0);
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Michael Cashwell
On Jul 18, 2013, at 12:39 PM, Tom Rini tr...@ti.com wrote:

 uImage | raw  | nand   | 0   | kernel | -  | -   | -   |
 
 Since partitions provide start/size.

I've got some WIP that pulls the alt info from a GPT partition map on mmc. That 
alt settings in DFU can be strings or numbers was handy to allow the name to 
identify the partition.

-Mike

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


Re: [U-Boot] [PATCH v6 2/2] NET: Add net_busy_flag

2013-07-18 Thread Stephen Warren
On 07/18/2013 08:15 AM, Jim Lin wrote:
 This flag is to have console aware that NET transfer is running or not.

I actually wonder if the shell interpreter or command-invocation code
(to cover automatic bootcmd?) shouldn't set this flag before invoking
every command, and clear it afterward? Or perhaps, a flag should be
added to commands that would benefit from this flag being set?

But this patch is probably a reasonable way to implement it in the first
place, so we don't add complex infra-structure if it turns out that
nothing else is going to require this feature.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/7] ARM: OMAP5: USB: Add OMAP5 common USB EHCI information

2013-07-18 Thread Dan Murphy
Dear Roger

On 07/18/2013 02:10 AM, Roger Quadros wrote:
 Dan,

 On 07/17/2013 11:16 PM, Dan Murphy wrote:
 * Enable the OMAP5 EHCI host clocks
 * Add OMAP5 EHCI register definitions
 * Add OMAP5 ES2 host revision

 Signed-off-by: Dan Murphy dmur...@ti.com
 ---
 v3 - Updated per comments - http://patchwork.ozlabs.org/patch/258230/

  arch/arm/cpu/armv7/omap5/hw_data.c  |   17 
  arch/arm/include/asm/arch-omap5/clock.h |6 +
  arch/arm/include/asm/arch-omap5/ehci.h  |   43 
 +++
  arch/arm/include/asm/ehci-omap.h|1 +
  drivers/usb/host/ehci-omap.c|2 +-
  5 files changed, 68 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/include/asm/arch-omap5/ehci.h

 diff --git a/arch/arm/cpu/armv7/omap5/hw_data.c 
 b/arch/arm/cpu/armv7/omap5/hw_data.c
 index 07b1108..b1be748 100644
 --- a/arch/arm/cpu/armv7/omap5/hw_data.c
 +++ b/arch/arm/cpu/armv7/omap5/hw_data.c
 @@ -414,6 +414,10 @@ void enable_basic_clocks(void)
  (*prcm)-cm_l4per_gpio6_clkctrl,
  (*prcm)-cm_l4per_gpio7_clkctrl,
  (*prcm)-cm_l4per_gpio8_clkctrl,
 +#ifdef CONFIG_USB_EHCI_OMAP
 +(*prcm)-cm_clksel_usb_60mhz,
 +(*prcm)-cm_l3init_hsusbtll_clkctrl,
 +#endif
  0
  };
  
 @@ -425,6 +429,9 @@ void enable_basic_clocks(void)
  (*prcm)-cm_wkup_wdtimer2_clkctrl,
  (*prcm)-cm_l4per_uart3_clkctrl,
  (*prcm)-cm_l4per_i2c1_clkctrl,
 +#ifdef CONFIG_USB_EHCI_OMAP
 +(*prcm)-cm_l3init_hsusbhost_clkctrl,
 +#endif
  0
  };
  
 @@ -448,6 +455,16 @@ void enable_basic_clocks(void)
  setbits_le32((*prcm)-cm_wkup_gptimer1_clkctrl,
  GPTIMER1_CLKCTRL_CLKSEL_MASK);
  
 +#ifdef CONFIG_USB_EHCI
 +/* Enable port 2 and 3 clocks*/
 +setbits_le32((*prcm)-cm_l3init_hsusbhost_clkctrl,
 +USB_HOST_HS_CLKCTRL_MASK);
 For consistency, maybe you should enable all 3 port clocks
 since you are enabling all 3 TLL clocks below?
So I thought about this we should enable all 3 clocks since it is a common file 
and disable the unused clocks in the board file.

Or we should enable the specific port clocks during ehci_hcd_init in the board 
file only since it is a board implementation detail.

Thoughts?
 +
 +/* Enable all 3 usb host ports tll clocks*/
 +setbits_le32((*prcm)-cm_l3init_hsusbtll_clkctrl,
 +USB_TLL_HS_CLKCTRL_MASK);
 +#endif
 +
  do_enable_clocks(clk_domains_essential,
   clk_modules_hw_auto_essential,
   clk_modules_explicit_en_essential,
 diff --git a/arch/arm/include/asm/arch-omap5/clock.h 
 b/arch/arm/include/asm/arch-omap5/clock.h
 index 4d2765d..3a58337 100644
 --- a/arch/arm/include/asm/arch-omap5/clock.h
 +++ b/arch/arm/include/asm/arch-omap5/clock.h
 @@ -165,6 +165,12 @@
  /* CM_L3INIT_USBPHY_CLKCTRL */
  #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK   8
  
 +/* CM_L3INIT_USB_HOST_HS_CLKCTRL */
 +#define USB_HOST_HS_CLKCTRL_MASK0x56C0
 +
 +/* CM_L3INIT_USB_TLL_HS_CLKCTRL */
 +#define USB_TLL_HS_CLKCTRL_MASK 0x700
 +
  /* CM_MPU_MPU_CLKCTRL */
  #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_SHIFT  24
  #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK   (3  24)
 diff --git a/arch/arm/include/asm/arch-omap5/ehci.h 
 b/arch/arm/include/asm/arch-omap5/ehci.h
 new file mode 100644
 index 000..3921e4a
 --- /dev/null
 +++ b/arch/arm/include/asm/arch-omap5/ehci.h
 @@ -0,0 +1,43 @@
 +/*
 + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com*
 + * Author: Govindraj R govindraj.r...@ti.com
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + */
 +
 +#ifndef _EHCI_H
 +#define _EHCI_H
 +
 +#define OMAP_EHCI_BASE  (OMAP54XX_L4_CORE_BASE 
 + 0x64C00)
 +#define OMAP_UHH_BASE   (OMAP54XX_L4_CORE_BASE 
 + 0x64000)
 +#define OMAP_USBTLL_BASE(OMAP54XX_L4_CORE_BASE + 
 0x62000)
 +
 +/* TLL Register Set */
 +#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE (1  3)
 +#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1  2)
 +#define OMAP_USBTLL_SYSCONFIG_SOFTRESET (1  1)
 +#define OMAP_USBTLL_SYSCONFIG_CACTIVITY 

Re: [U-Boot] USB host on MPC8349 not working

2013-07-18 Thread Mehresh Ramneek-B31383
Hi Stewart,

Did you probe PHY CLK on external phy pin ? Is phy clock coming to the soc ?

Regards,
Ramneek

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of Stewart Hamilton
Sent: Monday, July 08, 2013 12:08 PM
To: 'u-boot@lists.denx.de'
Subject: [U-Boot] USB host on MPC8349 not working

Hi

We have been using U- boot on our MPC8349 based board This was based on the  
v2009.06-rc2  circa May 2009  version.

This was configured to boot embedded linux  from a Usb storage device.
Recently Micron release a revised version of this device (MTFDCAE002S ) and our 
current U-Boot is unable to load from it.
Booting into the Linux via other means has enabled us to program and verify 
this device works correctly in our system.

So it appears the 4 year old version of U-boot we are using is problem.


I have download the latest version of U-Boot and after numberer of changes to 
our configuration file got it to compile and boot

Unfortunately I cannot get it to configure the MPC8349 USB host controller.

We are running this USB controller in MPH mode.
After U-boot has booted into the console mode.
Typing USB start produced the following error..

(Re)start USB...
USB0:   SET PHY CLOCK E0022500
USB PHY clock invalid!
lowlevel init failed
USB error: all controllers failed lowlevel init



Tracing this error shows it originates from the usb_phy_clk_valid routine in 
ehci-fsl.c I cannot find out why the ehci control port is unable to have the 
clock enabled.

I would appreciate any help or advice that people on here are able to give



Below are our Configuration head files and the low level board driver.

MPX8349.h

/*
*/

#ifndef __CONFIG_H
#define __CONFIG_H


/*
* High Level Configuration Options
*/
#define CONFIG_E300 1  /* E300 Family */
#define CONFIG_MPC83xx 1  /* MPC83xx family */
#define CONFIG_MPC834x 1  /* MPC834x family */
#define CONFIG_MPC8349 1  /* MPC8349 specific */
// #define CONFIG_MPC8349EMDS  1  /* MPC8349EMDS board specific */

#define   CONFIG_SYS_TEXT_BASE 0xFC00


#define CONFIG_PCI
#undef CONFIG_MPC83XX_PCI2 /* support for 2nd PCI controller */


#define CONFIG_SYS_USB_HOST /* use the EHCI USB controller */

#ifdef CONFIG_SYS_USB_HOST
/*
* Support USB
*/
#define CONFIG_USB_STORAGE
#define CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_FSL
#define CONFIG_USB_EHCI_MPC83XX
#define CONFIG_DOS_PARTITION


#define CONFIG_EHCI_HCD_INIT_AFTER_RESET

/* Current USB implementation supports the only USB controller,
* so we have to choose between the MPH or the DR ones */ #if 1 #define 
CONFIG_HAS_FSL_MPH_USB #else #define CONFIG_HAS_FSL_DR_USB #endif

#endif


#define CONFIG_PCI_33M

#ifdef CONFIG_PCI_66M
#define CONFIG_83XX_CLKIN   6600  /* in Hz */
#else
#define CONFIG_83XX_CLKIN   3300  /* in Hz */
#endif

#ifdef CONFIG_PCISLAVE
#define CONFIG_PCI
#define CONFIG_83XX_PCICLK    /* in Hz */
#endif /* CONFIG_PCISLAVE */

#ifndef CONFIG_SYS_CLK_FREQ
#ifdef CONFIG_PCI_66M
#define CONFIG_SYS_CLK_FREQ 6600
#else
#define CONFIG_SYS_CLK_FREQ 5940
#endif
#endif

#undef CONFIG_BOARD_EARLY_INIT_F  /* don't call board_pre_init */
#undef CONFIG_BOARD_EARLY_INIT_R  /* no board specific init */
#define   CONFIG_MISC_INIT_F  1  /* Use misc_init_f() */

#define CONFIG_SYS_IMMR0xE000

#undef CONFIG_SYS_DRAM_TEST/* memory test, takes time */
#define CONFIG_SYS_MEMTEST_START   0x  /* memtest region */
#define CONFIG_SYS_MEMTEST_END0x0010

/*
* DDR Setup
*/
#undef CONFIG_DDR_ECC /* support DDR ECC function */
#undef CONFIG_DDR_ECC_CMD  /* use DDR ECC user commands */
#undef CONFIG_SPD_EEPROM   /* use SPD EEPROM for DDR setup*/

/*
* define CONFIG_FSL_DDR2 to use unified DDR driver
* undefine it to use old spd_sdram.c
*/
#undef CONFIG_FSL_DDR2

#ifdef CONFIG_FSL_DDR2
#define CONFIG_SYS_SPD_BUS_NUM 0
#define SPD_EEPROM_ADDRESS1 0x52
#define SPD_EEPROM_ADDRESS2 0x51
#define CONFIG_NUM_DDR_CONTROLLERS 1
#define CONFIG_DIMM_SLOTS_PER_CTLR 2
#define CONFIG_CHIP_SELECTS_PER_CTRL  (2 * CONFIG_DIMM_SLOTS_PER_CTLR)
#define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
#define CONFIG_MEM_INIT_VALUE  0xDeadBeef
#endif

/*
* 32-bit data path mode.
*
* Please note that using this mode for devices with the real density of 64-bit
* effectively reduces the amount of available memory due to the effect of
* wrapping around while translating address to row/columns, for example in the
* 256MB module the upper 128MB get aliased with contents of the lower
* 128MB); normally this define should be used for devices with real 32-bit
* data path.
*/
#undef CONFIG_DDR_32BIT

#define CONFIG_SYS_DDR_BASE 0x/* DDR is system memory*/
#define CONFIG_SYS_SDRAM_BASE  CONFIG_SYS_DDR_BASE
#define CONFIG_SYS_DDR_SDRAM_BASE  CONFIG_SYS_DDR_BASE
#define 

Re: [U-Boot] [PATCH v2] usb: Use well-known descriptor sizes when parsing configuration

2013-07-18 Thread Marek Vasut
Dear Julius Werner,

  From a security / robustness standpoint,
  
  - if the descriptor length field is found to be abnormal, then the code
  
should not process the packet at all. Here it seems it only warns
then goes on to use the descriptor.
 
 Weren't you the guy who was so worried about poor Chinese devices who
 don't follow the spec just two mails ago?

That would have been me, not Albert. I suspect what happens below (and will 
likely happen onwards, if we don't cut the crap soon) is a bullshit-fueled 
discussion about nothing, so just can it. It's totally unproductive and 
drifting 
away from the discussion about patch. ML is not the right place for duking out 
this crap ...

Please, go, break a tartelette and fix your quarrel elsewhere.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 5/6] omap3_beagle: support findfdt and loadfdt for devicetree support

2013-07-18 Thread Nishanth Menon
On Thu, Jul 18, 2013 at 11:13 AM, Tom Rini tr...@ti.com wrote:

 Yes, I'm not terribly happy with what gets done for the shipping U-Boot
 on BBB, but I understand you're trying to not have too special of a
 binary used in programming versus distribution of the board.  If the
 vendor wants to ship software that says when in doubt, it's likely this
 board, that's OK for the vendor to do.
Alrite, so we go with V3(current version) of the patch then.

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


Re: [U-Boot] [PATCH v2] usb: Use well-known descriptor sizes when parsing configuration

2013-07-18 Thread Marek Vasut
Dear Julius Werner,

 The existing USB configuration parsing code relies on the descriptors'
 own length values when reading through the configuration blob. Since the
 size of those descriptors is always well-defined, we should rather use
 the known sizes instead of trusting device-provided values to be
 correct. Also adds some safety to potential out-of-order descriptors.
 
 Change-Id: I16f69dfdd6793aa0fe930b5148d4521f3e5c3090
 Signed-off-by: Julius Werner jwer...@chromium.org
 ---

I finally got time to properly look into the patch, sorry for the delay.

  common/usb.c | 73
 ++-- common/usb_hub.c
 | 14 ---
  2 files changed, 64 insertions(+), 23 deletions(-)
 
 diff --git a/common/usb.c b/common/usb.c
 index 55fff5b..ab7bafe 100644
 --- a/common/usb.c
 +++ b/common/usb.c
 @@ -341,6 +341,7 @@ static int usb_set_maxpacket(struct usb_device *dev)
  /*
 ** * Parse the config, located in buffer, and fills the dev-config
 structure. * Note that all little/big endian swapping are done
 automatically. + * (wTotalLength has already been swapped when it was
 read.)
   */
  static int usb_parse_config(struct usb_device *dev,
   unsigned char *buffer, int cfgno)
 @@ -361,24 +362,39 @@ static int usb_parse_config(struct usb_device *dev,
   head-bDescriptorType);
   return -1;
   }
 - memcpy(dev-config, buffer, buffer[0]);
 - le16_to_cpus((dev-config.desc.wTotalLength));
 + if (buffer[0] != USB_DT_CONFIG_SIZE)
 + printf(Ignoring invalid USB CFG length (%d)\n, buffer[0]);

Mulling over this some more, I suspect if the device does have incorrect config 
descriptor, we should just ignore the device because it's broken piece of junk.

 + memcpy(dev-config, buffer, USB_DT_CONFIG_SIZE);
   dev-config.no_of_if = 0;

Looking at this, the memcpy is incorrect in the first place. It shouldn't 
memcpy 
into dev-config, but into dev-config.desc . And in turn, you an do

memcpy(dev-config.desc, buffer, sizeof(dev-config.desc));

Which is even better, since you always take into account the size of the 
structure member. This would be worth fixing the right way.

Looking through the usage of these structures, you opened quite the ugly can of 
worms here :(

   index = dev-config.desc.bLength;
   /* Ok the first entry must be a configuration entry,
* now process the others */
   head = (struct usb_descriptor_header *) buffer[index];
 - while (index + 1  dev-config.desc.wTotalLength) {
 + while (index + 1  dev-config.desc.wTotalLength  head-bLength) {

Urgh, who the heck wrote this code. Damn that's a mess. Anyway, I suspect this 
might still explode if we go over USB_BUFSIZ in wTotalLength . Worth fixing.

   switch (head-bDescriptorType) {
   case USB_DT_INTERFACE:
 + if (index + USB_DT_INTERFACE_SIZE 
 + dev-config.desc.wTotalLength) {
 + puts(USB IF descriptor overflowed buffer!\n);
 + break;
 + }

Can you maybe use sizeof(struct usb_interface_descriptor) ? As a future 
proposal, we might really want to get rid of the USB_DT_INTERFACE_SIZE in favor 
of using sizeof(), that'd be much less error prone.

   if (((struct usb_interface_descriptor *) \
buffer[index])-bInterfaceNumber != curr_if_num) {

Would be nice to clean this up into understandable format by defining a 
variable for the buffer[index] and than just simply comparing this var-
bInterfaceNumber and curr_if_num .

   /* this is a new interface, copy new desc */
   ifno = dev-config.no_of_if;
 + if (ifno = USB_MAXINTERFACES) {
 + puts(Too many USB interfaces!\n);
 + /* try to go on with what we have */
 + return 1;
 + }

OK

   if_desc = dev-config.if_desc[ifno];
   dev-config.no_of_if++;
 - memcpy(if_desc, buffer[index], buffer[index]);
 + if (buffer[index] != USB_DT_INTERFACE_SIZE)
 + printf(Ignoring invalid USB IF length
 +  (%d)\n, buffer[index]);

Let's just ignore the descriptor if it's incorrect.

 + memcpy(if_desc, buffer[index],
 + USB_DT_INTERFACE_SIZE);
   if_desc-no_of_ep = 0;
   if_desc-num_altsetting = 1;
   curr_if_num =
 @@ -392,12 +408,29 @@ static int 

[U-Boot] [PATCH v4 2/8] am335x_evm: Update SPI_BOOT support, add MTDPARTS info

2013-07-18 Thread Tom Rini
- Style cleanup (# define - #define)
- Due to ROM issues, redudant loading isn't feasible, so drop.
- Given extra space, increase max size of U-Boot to 512KiB
- Correct env size to match usage (we had not re-defined ENV_SIZE).
- Given extra space, keep env size as 128KiB, add redundant environment.

Reviewed-by: Peter Korsgaard jac...@sunsite.dk
Signed-off-by: Tom Rini tr...@ti.com

---
Changes in v2:
- Correct physmap - m25p80 in mtdparts (Peter K).
- Style fixups, drop redundant SPL space, add redundant environment.
---
 include/configs/am335x_evm.h |   33 +++--
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ea8669a..cc2da92 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -367,7 +367,7 @@
 #define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SPL_SPI_BUS 0
 #define CONFIG_SPL_SPI_CS  0
-#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8
+#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x2
 #define CONFIG_SPL_MUSB_NEW_SUPPORT
 #define CONFIG_SPL_LDSCRIPT$(CPUDIR)/am33xx/u-boot-spl.lds
 
@@ -453,22 +453,27 @@
 #endif
 
 /*
- * Default to using SPI for environment, etc.  We have multiple copies
- * of SPL as the ROM will check these locations.
- * 0x0 - 0x2 : First copy of SPL
- * 0x2 - 0x4 : Second copy of SPL
- * 0x4 - 0x6 : Third copy of SPL
- * 0x6 - 0x8 : Fourth copy of SPL
- * 0x8 - 0xDF000 : U-Boot
- * 0xDF000 - 0xE : U-Boot Environment
- * 0xE - 0x442000 : Linux Kernel
+ * Default to using SPI for environment, etc.
+ * 0x00 - 0x02 : SPL (128KiB)
+ * 0x02 - 0x0A : U-Boot (512KiB)
+ * 0x0A - 0x0B : First copy of U-Boot Environment (128KiB)
+ * 0x0C - 0x0D : Second copy of U-Boot Environment (128KiB)
+ * 0x0E - 0x442000 : Linux Kernel
  * 0x442000 - 0x80 : Userland
  */
 #if defined(CONFIG_SPI_BOOT)
-# define CONFIG_ENV_IS_IN_SPI_FLASH
-# define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
-# define CONFIG_ENV_OFFSET (892  10) /* 892 KiB in */
-# define CONFIG_ENV_SECT_SIZE  (4  10) /* 4 KB sectors */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+#define CONFIG_ENV_SPI_MAX_HZ  CONFIG_SF_DEFAULT_SPEED
+#define CONFIG_ENV_SECT_SIZE   (4  10) /* 4 KB sectors */
+#define CONFIG_ENV_OFFSET  (768  10) /* 768 KiB in */
+#define CONFIG_ENV_OFFSET_REDUND   (896  10) /* 896 KiB in */
+#define CONFIG_CMD_MTDPARTS
+#define MTDIDS_DEFAULT nor0=m25p80-flash.0
+#define MTDPARTS_DEFAULT   mtdparts=m25p80-flash.0:128k(SPL), \
+   512k(u-boot),128k(u-boot-env1), \
+   128k(u-boot-env2),3464k(kernel), \
+   -(rootfs)
 #endif /* SPI support */
 
 /* Unsupported features */
-- 
1.7.9.5

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


[U-Boot] [PATCH v4 1/8] am335x_evm: Drop useless CONFIG_ENV_IS_NOWHERE

2013-07-18 Thread Tom Rini
We always set a CONFIG_ENV_IS_...somewhere... so drop the initial define
of NOWHERE.

Reviewed-by: Peter Korsgaard jac...@sunsite.dk
Signed-off-by: Tom Rini tr...@ti.com
---
 include/configs/am335x_evm.h |4 
 1 file changed, 4 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 0f12c75..ea8669a 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -306,8 +306,6 @@
 #define CONFIG_ENV_OVERWRITE   1
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
 
-#define CONFIG_ENV_IS_NOWHERE
-
 /* Defines for SPL */
 #define CONFIG_SPL
 #define CONFIG_SPL_FRAMEWORK
@@ -467,7 +465,6 @@
  * 0x442000 - 0x80 : Userland
  */
 #if defined(CONFIG_SPI_BOOT)
-# undef CONFIG_ENV_IS_NOWHERE
 # define CONFIG_ENV_IS_IN_SPI_FLASH
 # define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
 # define CONFIG_ENV_OFFSET (892  10) /* 892 KiB in */
@@ -515,7 +512,6 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE 1   /* Max number of NAND
   devices */
 #if !defined(CONFIG_SPI_BOOT)
-#undef CONFIG_ENV_IS_NOWHERE
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_OFFSET  0x26 /* environment starts here */
 #define CONFIG_SYS_ENV_SECT_SIZE   (128  10) /* 128 KiB */
-- 
1.7.9.5

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


[U-Boot] [PATCH v4 4/8] am335x_evm: Rework board_is_foo() checks

2013-07-18 Thread Tom Rini
We rework the various board_is_foo() checks to take a pointer to
struct am335x_baseboard_id rather than using a local copy in board.c.
This allows us to make use of the same checks in mux.c as well as fixing
problems when this code could be running from read-only memory.

Reviewed-by: Peter Korsgaard jac...@sunsite.dk
Signed-off-by: Tom Rini tr...@ti.com

---
Changes in v2:
- Fix checkpatch warnings
---
 board/ti/am335x/board.c |   80 ---
 board/ti/am335x/board.h |   31 ++
 board/ti/am335x/mux.c   |   10 +++---
 3 files changed, 63 insertions(+), 58 deletions(-)

diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index fdbe26c..a645d30 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -48,43 +48,10 @@ static struct wd_timer *wdtimer = (struct wd_timer 
*)WDT_BASE;
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
-static struct am335x_baseboard_id __attribute__((section (.data))) header;
-
-static inline int board_is_bone(void)
-{
-   return !strncmp(header.name, A335BONE, HDR_NAME_LEN);
-}
-
-static inline int board_is_bone_lt(void)
-{
-   return !strncmp(header.name, A335BNLT, HDR_NAME_LEN);
-}
-
-static inline int board_is_evm_sk(void)
-{
-   return !strncmp(A335X_SK, header.name, HDR_NAME_LEN);
-}
-
-static inline int board_is_idk(void)
-{
-   return !strncmp(header.config, SKU#02, 6);
-}
-
-static int __maybe_unused board_is_gp_evm(void)
-{
-   return !strncmp(A33515BB, header.name, 8);
-}
-
-int board_is_evm_15_or_later(void)
-{
-   return (!strncmp(A33515BB, header.name, 8) 
-   strncmp(1.5, header.version, 3) = 0);
-}
-
 /*
  * Read header information from EEPROM into global structure.
  */
-static int read_eeprom(void)
+static int read_eeprom(struct am335x_baseboard_id *header)
 {
/* Check if baseboard eeprom is available */
if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
@@ -94,28 +61,28 @@ static int read_eeprom(void)
}
 
/* read the eeprom using i2c */
-   if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
-   sizeof(header))) {
+   if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
+sizeof(struct am335x_baseboard_id))) {
puts(Could not read the EEPROM; something fundamentally
 wrong on the I2C bus.\n);
return -EIO;
}
 
-   if (header.magic != 0xEE3355AA) {
+   if (header-magic != 0xEE3355AA) {
/*
 * read the eeprom using i2c again,
 * but use only a 1 byte address
 */
-   if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1,
-   (uchar *)header, sizeof(header))) {
+   if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,
+sizeof(struct am335x_baseboard_id))) {
puts(Could not read the EEPROM; something 
fundamentally wrong on the I2C bus.\n);
return -EIO;
}
 
-   if (header.magic != 0xEE3355AA) {
+   if (header-magic != 0xEE3355AA) {
printf(Incorrect magic number (0x%x) in EEPROM\n,
-   header.magic);
+   header-magic);
return -EINVAL;
}
}
@@ -289,12 +256,14 @@ int spl_start_uboot(void)
  */
 void s_init(void)
 {
+#ifdef CONFIG_SPL_BUILD
+   struct am335x_baseboard_id header;
+
/*
 * Save the boot parameters passed from romcode.
 * We cannot delay the saving further than this,
 * to prevent overwrites.
 */
-#ifdef CONFIG_SPL_BUILD
save_omap_boot_params();
 #endif
 
@@ -343,11 +312,11 @@ void s_init(void)
/* Initalize the board header */
enable_i2c0_pin_mux();
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-   if (read_eeprom()  0)
+   if (read_eeprom(header)  0)
puts(Could not get board ID.\n);
 
enable_board_pin_mux(header);
-   if (board_is_evm_sk()) {
+   if (board_is_evm_sk(header)) {
/*
 * EVM SK 1.2A and later use gpio0_7 to enable DDR3.
 * This is safe enough to do on older revs.
@@ -356,15 +325,15 @@ void s_init(void)
gpio_direction_output(GPIO_DDR_VTT_EN, 1);
}
 
-   if (board_is_evm_sk())
+   if (board_is_evm_sk(header))
config_ddr(303, MT41J128MJT125_IOCTRL_VALUE, ddr3_data,
   ddr3_cmd_ctrl_data, ddr3_emif_reg_data, 0);
-   else if (board_is_bone_lt())
+   else if (board_is_bone_lt(header))
config_ddr(400, MT41K256M16HA125E_IOCTRL_VALUE,
 

[U-Boot] [PATCH v4 3/8] am335x_evm: Only set CONFIG_NAND when !CONFIG_SPI_BOOT

2013-07-18 Thread Tom Rini
Due to hardware design the board supported by the am335x_evm config
cannot have both NAND and SPI (or NOR) enabled at the same time due to
conflicts.  Disable the NAND SW stack when we know we can't have it
present.

Reviewed-by: Peter Korsgaard jac...@sunsite.dk
Cc: Justin Waters justin.wat...@timesys.com
Signed-off-by: Tom Rini tr...@ti.com

---
Changes in v4:
- Rework location, and note that when merged this should be dropped in
  favor of Justin Waters' approach in his series
Changes in v2:
- Reword commit message
---
 include/configs/am335x_evm.h |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index cc2da92..c00a97f 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -42,6 +42,10 @@
 
 #define CONFIG_SYS_CACHELINE_SIZE   64
 
+#if !defined(CONFIG_SPI_BOOT)
+#define CONFIG_NAND
+#endif
+
 /* commands to include */
 #include config_cmd_default.h
 
@@ -231,7 +235,9 @@
 /* USB Device Firmware Update support */
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
+#ifdef CONFIG_NAND
 #define CONFIG_DFU_NAND
+#endif
 #define CONFIG_CMD_DFU
 #define DFU_ALT_INFO_MMC \
boot part 0 1; \
@@ -372,11 +378,13 @@
 #define CONFIG_SPL_LDSCRIPT$(CPUDIR)/am33xx/u-boot-spl.lds
 
 #define CONFIG_SPL_BOARD_INIT
+#ifdef CONFIG_NAND
 #define CONFIG_SPL_NAND_AM33XX_BCH
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_NAND_BASE
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
+#endif
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
 CONFIG_SYS_NAND_PAGE_SIZE)
@@ -497,7 +505,6 @@
 #define CONFIG_PHY_ADDR0
 #define CONFIG_PHY_SMSC
 
-#define CONFIG_NAND
 /* NAND support */
 #ifdef CONFIG_NAND
 #define CONFIG_CMD_NAND
@@ -516,11 +523,9 @@
/* CS0 */
 #define CONFIG_SYS_MAX_NAND_DEVICE 1   /* Max number of NAND
   devices */
-#if !defined(CONFIG_SPI_BOOT)
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_OFFSET  0x26 /* environment starts here */
 #define CONFIG_SYS_ENV_SECT_SIZE   (128  10) /* 128 KiB */
 #endif
-#endif
 
 #endif /* ! __CONFIG_AM335X_EVM_H */
-- 
1.7.9.5

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


[U-Boot] [PATCH v4 0/8] am335x: NOR support

2013-07-18 Thread Tom Rini
Hey all,

This series adds NOR support to am335x_evm, along with a few generic
changes to make gpmc clearer (for per-board things like different NOR
chips, etc).  This series depends on the last go-round of the am335x
falcon mode docs as that adds the README that I add more content to.
And while I say this in 3/8, to be clear, I expect to drop 3/8 in favor
of Justin Waters' way of doing this instead, I just include this here for
completeness and will get it all happy together when I assemble things
in u-boot-ti.

The big changes in v4 are:
- Apply again to master which includes a few non-trivial updates, so the
  linker script got re-synced.
- After checking what's going on, and testing with NAND again, we can be
  common with gpmc_cfg-irqstatus/enable, and only set documented bits
  in gpmc_cfg-config

-- 
Tom

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


[U-Boot] [PATCH v4 5/8] am33xx: Correct gpmc_cfg-irqstatus/enable

2013-07-18 Thread Tom Rini
Based on our usage of the GPMC, either with NOR or NAND we do not need
to be setting the irqstatus or irqenable bits and should clear them like
we have historically.

Signed-off-by: Tom Rini tr...@ti.com
---
 arch/arm/cpu/armv7/am33xx/mem.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/mem.c b/arch/arm/cpu/armv7/am33xx/mem.c
index 45f5426..160edd8 100644
--- a/arch/arm/cpu/armv7/am33xx/mem.c
+++ b/arch/arm/cpu/armv7/am33xx/mem.c
@@ -77,8 +77,8 @@ void gpmc_init(void)
 
/* global settings */
writel(0x0008, gpmc_cfg-sysconfig);
-   writel(0x0100, gpmc_cfg-irqstatus);
-   writel(0x0100, gpmc_cfg-irqenable);
+   writel(0x, gpmc_cfg-irqstatus);
+   writel(0x, gpmc_cfg-irqenable);
writel(0x0012, gpmc_cfg-config);
/*
 * Disable the GPMC0 config set by ROM code
-- 
1.7.9.5

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


[U-Boot] [PATCH v4 6/8] am335x_evm: Add support for the NOR module on the memory cape

2013-07-18 Thread Tom Rini
From: Steve Kipisz s-kipi...@ti.com

This patch adds support for the NOR module that attaches
to the memory cape for a Beaglebone board. This does not
add booting support; only support so that you can boot from
SD/MMC and see the NOR module so that it can be programmed.

Signed-off-by: Steve Kipisz s-kipi...@ti.com
[trini: Clean up config changes slightly]
Signed-off-by: Tom Rini tr...@ti.com

---
Changes in v4:
- Split clearing of gpmc_cfg-irqstatus/irqenable into a separate patch
Changes in v3:
- Reword comment in asm/arch-am33xx/mem.h to explain why STNOR values
  belong in here.
Changes in v2:
- Move GPMC config portion into board.c

Signed-off-by: Tom Rini tr...@ti.com
---
 arch/arm/cpu/armv7/am33xx/mem.c|4 +++
 arch/arm/include/asm/arch-am33xx/mem.h |9 ++
 board/ti/am335x/board.c|   13 
 board/ti/am335x/mux.c  |   53 
 boards.cfg |1 +
 include/configs/am335x_evm.h   |   28 +
 6 files changed, 108 insertions(+)

diff --git a/arch/arm/cpu/armv7/am33xx/mem.c b/arch/arm/cpu/armv7/am33xx/mem.c
index 160edd8..ea44f87 100644
--- a/arch/arm/cpu/armv7/am33xx/mem.c
+++ b/arch/arm/cpu/armv7/am33xx/mem.c
@@ -79,7 +79,11 @@ void gpmc_init(void)
writel(0x0008, gpmc_cfg-sysconfig);
writel(0x, gpmc_cfg-irqstatus);
writel(0x, gpmc_cfg-irqenable);
+#ifdef CONFIG_NOR
+   writel(0x0200, gpmc_cfg-config);
+#else
writel(0x0012, gpmc_cfg-config);
+#endif
/*
 * Disable the GPMC0 config set by ROM code
 */
diff --git a/arch/arm/include/asm/arch-am33xx/mem.h 
b/arch/arm/include/asm/arch-am33xx/mem.h
index c3bf74e..9ece266 100644
--- a/arch/arm/include/asm/arch-am33xx/mem.h
+++ b/arch/arm/include/asm/arch-am33xx/mem.h
@@ -46,6 +46,7 @@
  *
  * Currently valid part Names are (PART):
  * M_NAND - Micron NAND
+ * STNOR - STMicrolelctronics M29W128GL
  */
 #define GPMC_SIZE_256M 0x0
 #define GPMC_SIZE_128M 0x8
@@ -61,6 +62,14 @@
 #define M_NAND_GPMC_CONFIG60x16000f80
 #define M_NAND_GPMC_CONFIG70x0008
 
+#define STNOR_GPMC_CONFIG1 0x1200
+#define STNOR_GPMC_CONFIG2 0x00101000
+#define STNOR_GPMC_CONFIG3 0x00030301
+#define STNOR_GPMC_CONFIG4 0x10041004
+#define STNOR_GPMC_CONFIG5 0x000C1010
+#define STNOR_GPMC_CONFIG6 0x08070280
+#define STNOR_GPMC_CONFIG7 0x0F48
+
 /* max number of GPMC Chip Selects */
 #define GPMC_MAX_CS8
 /* max number of GPMC regs */
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index a645d30..7bcaa98 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -27,6 +27,7 @@
 #include asm/arch/gpio.h
 #include asm/arch/mmc_host_def.h
 #include asm/arch/sys_proto.h
+#include asm/arch/mem.h
 #include asm/io.h
 #include asm/emif.h
 #include asm/gpio.h
@@ -347,10 +348,22 @@ void s_init(void)
  */
 int board_init(void)
 {
+#ifdef CONFIG_NOR
+   const u32 gpmc_nor[GPMC_MAX_REG] = { STNOR_GPMC_CONFIG1,
+   STNOR_GPMC_CONFIG2, STNOR_GPMC_CONFIG3, STNOR_GPMC_CONFIG4,
+   STNOR_GPMC_CONFIG5, STNOR_GPMC_CONFIG6, STNOR_GPMC_CONFIG7 };
+#endif
+
gd-bd-bi_boot_params = PHYS_DRAM_1 + 0x100;
 
gpmc_init();
 
+#ifdef CONFIG_NOR
+   /* Reconfigure CS0 for NOR instead of NAND. */
+   enable_gpmc_cs_config(gpmc_nor, gpmc_cfg-cs[0],
+ CONFIG_SYS_FLASH_BASE, GPMC_SIZE_16M);
+#endif
+
return 0;
 }
 
diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
index 2e09d98..187468e 100644
--- a/board/ti/am335x/mux.c
+++ b/board/ti/am335x/mux.c
@@ -190,6 +190,56 @@ static struct module_pin_mux nand_pin_mux[] = {
{-1},
 };
 
+#if defined(CONFIG_NOR)
+static struct module_pin_mux bone_norcape_pin_mux[] = {
+   {OFFSET(lcd_data0), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A0 */
+   {OFFSET(lcd_data1), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A1 */
+   {OFFSET(lcd_data2), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A2 */
+   {OFFSET(lcd_data3), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A3 */
+   {OFFSET(lcd_data4), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A4 */
+   {OFFSET(lcd_data5), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A5 */
+   {OFFSET(lcd_data6), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A6 */
+   {OFFSET(lcd_data7), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A7 */
+   {OFFSET(lcd_vsync), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A8 */
+   {OFFSET(lcd_hsync), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A9 */
+   {OFFSET(lcd_pclk), MODE(1)| PULLUDEN | RXACTIVE},   /* NOR_A10 */
+   {OFFSET(lcd_ac_bias_en), MODE(1)| PULLUDEN | RXACTIVE}, /* NOR_A11 */
+   {OFFSET(lcd_data8), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A12 */
+   {OFFSET(lcd_data9), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A13 */
+   {OFFSET(lcd_data10), MODE(1) | 

[U-Boot] [PATCH v4 7/8] am335x_evm: Add support to boot from NOR.

2013-07-18 Thread Tom Rini
From: Steve Kipisz s-kipi...@ti.com

NOR requires that s_init be within the first 4KiB of the image so that
we can perform the rest of the required pinmuxing to talk with the rest
of NOR that we are found on.  When NOR_BOOT is set we save our
environment in NOR at 512KiB and a redundant copy at 768KiB.  We avoid
using SPL for this case and u-boot.bin is written directly to the start
of NOR.

We enclose the DMM-related parts of arch/arm/cpu/armv7/am33xx/emif4.c
with TI81xx checks as at this time U-Boot does not discard unused
sections in the main build and this code relies on functions specific to
(and only provided in) ti81xx-related code.

Cc: Albert ARIBAUD albert.u.b...@aribaud.net
Signed-off-by: Steve Kipisz s-kipi...@ti.com
Signed-off-by: Tom Rini tr...@ti.com

---
Changes in v4:
- Rebase to current.  Note that the asm statements seemingly conflict
  with the save_omap_boot_params call, but I don't see why.

Changes in v3:
- Explain TI81xx changes

Changes in v2:
- Reword commit message slightly
---
 arch/arm/cpu/armv7/am33xx/board.c |2 +-
 arch/arm/cpu/armv7/am33xx/emif4.c |6 +-
 board/ti/am335x/Makefile  |2 +-
 board/ti/am335x/board.c   |   33 +--
 board/ti/am335x/mux.c |6 +-
 board/ti/am335x/u-boot.lds|  117 +
 boards.cfg|1 +
 include/configs/am335x_evm.h  |   26 -
 8 files changed, 182 insertions(+), 11 deletions(-)
 create mode 100644 board/ti/am335x/u-boot.lds

diff --git a/arch/arm/cpu/armv7/am33xx/board.c 
b/arch/arm/cpu/armv7/am33xx/board.c
index b935a29..3085292 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -150,7 +150,7 @@ int arch_misc_init(void)
return 0;
 }
 
-#ifdef CONFIG_SPL_BUILD
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
 void rtc32k_enable(void)
 {
struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE;
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index aa84e96..370230b 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -43,9 +43,11 @@ void dram_init_banksize(void)
 }
 
 
-#ifdef CONFIG_SPL_BUILD
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
+#ifdef CONFIG_TI81XX
 static struct dmm_lisa_map_regs *hw_lisa_map_regs =
(struct dmm_lisa_map_regs *)DMM_BASE;
+#endif
 static struct vtp_reg *vtpreg[2] = {
(struct vtp_reg *)VTP0_CTRL_ADDR,
(struct vtp_reg *)VTP1_CTRL_ADDR};
@@ -53,6 +55,7 @@ static struct vtp_reg *vtpreg[2] = {
 static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR;
 #endif
 
+#ifdef CONFIG_TI81XX
 void config_dmm(const struct dmm_lisa_map_regs *regs)
 {
enable_dmm_clocks();
@@ -67,6 +70,7 @@ void config_dmm(const struct dmm_lisa_map_regs *regs)
writel(regs-dmm_lisa_map_1, hw_lisa_map_regs-dmm_lisa_map_1);
writel(regs-dmm_lisa_map_0, hw_lisa_map_regs-dmm_lisa_map_0);
 }
+#endif
 
 static void config_vtp(int nr)
 {
diff --git a/board/ti/am335x/Makefile b/board/ti/am335x/Makefile
index 67a87a1..1795e3e 100644
--- a/board/ti/am335x/Makefile
+++ b/board/ti/am335x/Makefile
@@ -18,7 +18,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-ifdef CONFIG_SPL_BUILD
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_NOR_BOOT),y)
 COBJS  := mux.o
 endif
 
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 7bcaa98..81ab04a 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -91,7 +91,7 @@ static int read_eeprom(struct am335x_baseboard_id *header)
return 0;
 }
 
-#ifdef CONFIG_SPL_BUILD
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
 static const struct ddr_data ddr2_data = {
.datardsratio0 = ((MT47H128M16RT25E_RD_DQS30) |
  (MT47H128M16RT25E_RD_DQS20) |
@@ -257,10 +257,28 @@ int spl_start_uboot(void)
  */
 void s_init(void)
 {
-#ifdef CONFIG_SPL_BUILD
-   struct am335x_baseboard_id header;
+   __maybe_unused struct am335x_baseboard_id header;
 
/*
+* The ROM will only have set up sufficient pinmux to allow for the
+* first 4KiB NOR to be read, we must finish doing what we know of
+* the NOR mux in this space in order to continue.
+*/
+#ifdef CONFIG_NOR_BOOT
+   asm(stmfd  sp!, {r2 - r4});
+   asm(movw   r4, #0x8A4);
+   asm(movw   r3, #0x44E1);
+   asm(orrr4, r4, r3, lsl #16);
+   asm(movr2, #9);
+   asm(movr3, #8);
+   asm(gpmc_mux:  str r2, [r4], #4);
+   asm(subs   r3, r3, #1);
+   asm(bnegpmc_mux);
+   asm(ldmfd  sp!, {r2 - r4});
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+   /*
 * Save the boot parameters passed from romcode.
 * We cannot delay the saving further than this,
 * to prevent overwrites.
@@ -278,7 

[U-Boot] [PATCH v4 8/8] board/ti/am335x/README: Document NOR programming

2013-07-18 Thread Tom Rini
The Beaglebone White may be populated with a memory cape that has a NOR
module.  Document how to program it.

Signed-off-by: Tom Rini tr...@ti.com
---
 board/ti/am335x/README |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/board/ti/am335x/README b/board/ti/am335x/README
index 6d45352..67b5246 100644
--- a/board/ti/am335x/README
+++ b/board/ti/am335x/README
@@ -38,6 +38,29 @@ U-Boot # nand write 8100 0 26
 U-Boot # load mmc 0 ${loadaddr} uImage
 U-Boot # nand write ${loadaddr} kernel 50
 
+NOR
+===
+
+The Beaglebone White can be equiped with a memory cape that in turn can
+have a NOR module plugged into it.  In this case it is then possible to
+program and boot from NOR.  Note that due to how U-Boot is architectured we
+must build a specific version of U-Boot that knows we have NOR flash.  This
+build is named 'am335x_evm_nor'.  Further, we have a 'am335x_evm_norboot'
+build that will assume that the environment is on NOR rather than NAND.  In
+the following example we assume that and SD card has been populated with
+MLO and u-boot.img from a 'am335x_evm_nor' build and also contains the
+'u-boot.bin' from a 'am335x_evm_norboot' build.  When booting from NOR, a
+binary must be written to the start of NOR, with no header or similar
+prepended.  In the following example we use a size of 512KiB (0x8)
+as that is how much space we set aside before the environment, as per
+the config file.
+
+U-Boot # mmc rescan
+U-Boot # load mmc 0 ${loadaddr} u-boot.bin
+U-Boot # protect off 0800 +8
+U-Boot # erase 0800 +8
+U-Boot # cp.b ${loadaddr} 0800 ${filesize}
+
 Falcon Mode
 ===
 
-- 
1.7.9.5

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


[U-Boot] [PATCH 2/2] ARM: tegra: Enable data cache on Dalmore

2013-07-18 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com

Disabling the data cache is no longer required to boot Dalmore, so
enable it. This results in notably better performance when loading
and booting the Linux kernel.

Signed-off-by: Thierry Reding tred...@nvidia.com
---
 include/configs/dalmore.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h
index 2723843..3d3619f 100644
--- a/include/configs/dalmore.h
+++ b/include/configs/dalmore.h
@@ -21,9 +21,6 @@
 
 #include tegra114-common.h
 
-/* Must be off for Dalmore to boot !?!? FIXME */
-#define CONFIG_SYS_DCACHE_OFF
-
 /* Enable fdt support for Dalmore. Flash the image in u-boot-dtb.bin */
 #define CONFIG_DEFAULT_DEVICE_TREE tegra114-dalmore
 #define CONFIG_OF_CONTROL
-- 
1.8.1.5

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


[U-Boot] [PATCH 1/2] ARM: tegra: Make cache line size SoC specific

2013-07-18 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com

Currently all Tegra SoCs are assumed to have 32 byte cache lines. This
isn't true for Tegra114, however, which uses 4 Cortex-A15 cores and
therefore uses a cache line size of 64 bytes. Move the cache line size
setting to the per-SoC common configuration file.

Signed-off-by: Thierry Reding tred...@nvidia.com
---
 include/configs/tegra-common.h| 2 --
 include/configs/tegra114-common.h | 3 +++
 include/configs/tegra20-common.h  | 3 +++
 include/configs/tegra30-common.h  | 3 +++
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
index cb9e7c3..056207b 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -33,8 +33,6 @@
 #define CONFIG_TEGRA   /* which is a Tegra generic machine */
 #define CONFIG_SYS_L2CACHE_OFF /* No L2 cache */
 
-#define CONFIG_SYS_CACHELINE_SIZE  32
-
 #include asm/arch/tegra.h/* get chip and board defs */
 
 /*
diff --git a/include/configs/tegra114-common.h 
b/include/configs/tegra114-common.h
index 44e98e5..c3de9a9 100644
--- a/include/configs/tegra114-common.h
+++ b/include/configs/tegra114-common.h
@@ -18,6 +18,9 @@
 #define _TEGRA114_COMMON_H_
 #include tegra-common.h
 
+/* Cortex-A15 uses a cache line size of 64 bytes */
+#define CONFIG_SYS_CACHELINE_SIZE  64
+
 /*
  * NS16550 Configuration
  */
diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
index d5abecb..b334b33 100644
--- a/include/configs/tegra20-common.h
+++ b/include/configs/tegra20-common.h
@@ -25,6 +25,9 @@
 #define _TEGRA20_COMMON_H_
 #include tegra-common.h
 
+/* Cortex-A9 uses a cache line size of 32 bytes */
+#define CONFIG_SYS_CACHELINE_SIZE  32
+
 /*
  * Errata configuration
  */
diff --git a/include/configs/tegra30-common.h b/include/configs/tegra30-common.h
index 7ea36be..a72dc13 100644
--- a/include/configs/tegra30-common.h
+++ b/include/configs/tegra30-common.h
@@ -25,6 +25,9 @@
 #define _TEGRA30_COMMON_H_
 #include tegra-common.h
 
+/* Cortex-A9 uses a cache line size of 32 bytes */
+#define CONFIG_SYS_CACHELINE_SIZE  32
+
 /*
  * Errata configuration
  */
-- 
1.8.1.5

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


Re: [U-Boot] [PATCH v4 7/8] am335x_evm: Add support to boot from NOR.

2013-07-18 Thread Albert ARIBAUD
Hi Tom,

On Thu, 18 Jul 2013 15:13:04 -0400, Tom Rini tr...@ti.com wrote:

 Changes in v4:
 - Rebase to current.  Note that the asm statements seemingly conflict
   with the save_omap_boot_params call, but I don't see why.

How exactly does the conflict manifest itself?

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


Re: [U-Boot] [PATCH v2] usb: Use well-known descriptor sizes when parsing configuration

2013-07-18 Thread Julius Werner
 Mulling over this some more, I suspect if the device does have incorrect 
 config
 descriptor, we should just ignore the device because it's broken piece of 
 junk.

I can change it if you insist, but I'd like to keep it to make the
code look more consistent (since later on with the interface/endpoint
descriptors, I think ignoring errors makes more sense).

 Looking at this, the memcpy is incorrect in the first place. It shouldn't 
 memcpy
 into dev-config, but into dev-config.desc . And in turn, you an do
 memcpy(dev-config.desc, buffer, sizeof(dev-config.desc));

 Which is even better, since you always take into account the size of the
 structure member. This would be worth fixing the right way.

The sizeof() thing is true for the configuration descriptor, but not
for some others (e.g. endpoint) because U-Boot reserves fields for
it's own stuff behind that. So for consistency (and safety in case of
future expansion) I went with the macros in all cases.

 Urgh, who the heck wrote this code. Damn that's a mess. Anyway, I suspect this
 might still explode if we go over USB_BUFSIZ in wTotalLength . Worth fixing.

usb_get_configuration_no() now makes sure we don't read more than
USB_BUFSIZ and stores the actually read amount in wTotalLength so we
can use it without worrying here.

 Would be nice to clean this up into understandable format by defining a
 variable for the buffer[index] and than just simply comparing this var-
bInterfaceNumber and curr_if_num .

Agreed, but let's clean this up one patch at a time.

   if_desc = dev-config.if_desc[ifno];
   dev-config.no_of_if++;
 - memcpy(if_desc, buffer[index], buffer[index]);
 + if (buffer[index] != USB_DT_INTERFACE_SIZE)
 + printf(Ignoring invalid USB IF length
 +  (%d)\n, buffer[index]);

 Let's just ignore the descriptor if it's incorrect.


Jokes about Chinese crap aside, I would try to err on the side of
making it work if in any way possible, as long as the code stays safe.
This is firmware so we often can't do much error recovery... either we
can work with what we have, or we won't boot. Although I don't think
these cases will happen in practice.

 - result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, tmp);
 - debug(get_conf_no %d Result %d, wLength %d\n, cfgno, result, tmp);
 + result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, length);
 + debug(get_conf_no %d Result %d, wLength %d\n, cfgno, result, length);
 + config-wTotalLength = length; /* validated, with CPU byte order */

 The above assignment is new, why ?

This is the sanitization of wTotalLength I mentioned above. Maybe not
the most obvious way to do it, but it's convenient since you have to
pass the actually read length from here to usb_parse_config() somehow
(to avoid things like reading into the leftover descriptors of a
previously enumerated device).
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 7/8] am335x_evm: Add support to boot from NOR.

2013-07-18 Thread Tom Rini
On Thu, Jul 18, 2013 at 09:21:33PM +0200, Albert ARIBAUD wrote:
 Hi Tom,
 
 On Thu, 18 Jul 2013 15:13:04 -0400, Tom Rini tr...@ti.com wrote:
 
  Changes in v4:
  - Rebase to current.  Note that the asm statements seemingly conflict
with the save_omap_boot_params call, but I don't see why.
 
 How exactly does the conflict manifest itself?

What I end up seeing (and I didn't get a debugger attached) was that the
i2c init fails (one of the i2c error messages is sent out), so i2c probe
fails so we can't init the hardware.  And it's left in such a bizarro
state that trying to boot again via UART instead for example still fails
that way, a power cycle is required to clear things out.

-- 
Tom


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


[U-Boot] [PATCH] net: phy: Fix networking regression on some mx6 boards

2013-07-18 Thread Fabio Estevam
From: Fabio Estevam fabio.este...@freescale.com

Since commit de1d786edf (add support for Xilinx 1000BASE-X phy (GTX))
we are no longer able to use tftp transfers on some mx6 boards
like mx6qsabresd and wandboard, which use AR8031 Ethernet phy.

Revert the commit as a proper fix is still not available.

Reported-by: Sascha Silbe t-ub...@infra-silbe.de
Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 drivers/net/phy/phy.c   | 21 -
 include/linux/ethtool.h |  4 
 include/linux/mii.h |  2 --
 3 files changed, 27 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7c0eaec..77d19c6 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -75,10 +75,6 @@ static int genphy_config_advert(struct phy_device *phydev)
adv |= ADVERTISE_PAUSE_CAP;
if (advertise  ADVERTISED_Asym_Pause)
adv |= ADVERTISE_PAUSE_ASYM;
-   if (advertise  ADVERTISED_1000baseX_Half)
-   adv |= ADVERTISE_1000XHALF;
-   if (advertise  ADVERTISED_1000baseX_Full)
-   adv |= ADVERTISE_1000XFULL;
 
if (adv != oldadv) {
err = phy_write(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE, adv);
@@ -292,7 +288,6 @@ int genphy_parse_link(struct phy_device *phydev)
if (mii_reg  BMSR_ANEGCAPABLE) {
u32 lpa = 0;
u32 gblpa = 0;
-   u32 estatus = 0;
 
/* Check for gigabit capability */
if (mii_reg  BMSR_ERCAP) {
@@ -332,18 +327,6 @@ int genphy_parse_link(struct phy_device *phydev)
 
} else if (lpa  LPA_10FULL)
phydev-duplex = DUPLEX_FULL;
-
-   if (mii_reg  BMSR_ESTATEN)
-   estatus = phy_read(phydev, MDIO_DEVAD_NONE,
-  MII_ESTATUS);
-
-   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |
-   ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
-   phydev-speed = SPEED_1000;
-   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
-   phydev-duplex = DUPLEX_FULL;
-   }
-
} else {
u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
 
@@ -401,10 +384,6 @@ int genphy_config(struct phy_device *phydev)
features |= SUPPORTED_1000baseT_Full;
if (val  ESTATUS_1000_THALF)
features |= SUPPORTED_1000baseT_Half;
-   if (val  ESTATUS_1000_XFULL)
-   features |= SUPPORTED_1000baseX_Full;
-   if (val  ESTATUS_1000_XHALF)
-   features |= SUPPORTED_1000baseX_Full;
}
 
phydev-supported = features;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index f6dbdb0..fcb20fe 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -580,8 +580,6 @@ enum ethtool_sfeatures_retval_bits {
 #define SUPPORTED_1baseKX4_Full(1  18)
 #define SUPPORTED_1baseKR_Full (1  19)
 #define SUPPORTED_1baseR_FEC   (1  20)
-#define SUPPORTED_1000baseX_Half   (1  21)
-#define SUPPORTED_1000baseX_Full   (1  22)
 
 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half(1  0)
@@ -605,8 +603,6 @@ enum ethtool_sfeatures_retval_bits {
 #define ADVERTISED_1baseKX4_Full   (1  18)
 #define ADVERTISED_1baseKR_Full(1  19)
 #define ADVERTISED_1baseR_FEC  (1  20)
-#define ADVERTISED_1000baseX_Half  (1  21)
-#define ADVERTISED_1000baseX_Full  (1  22)
 
 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 66b83d8..8b92692 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -115,8 +115,6 @@
 #define EXPANSION_MFAULTS  0x0010  /* Multiple faults detected*/
 #define EXPANSION_RESV 0xffe0  /* Unused...   */
 
-#define ESTATUS_1000_XFULL 0x8000  /* Can do 1000BX Full */
-#define ESTATUS_1000_XHALF 0x4000  /* Can do 1000BX Half */
 #define ESTATUS_1000_TFULL 0x2000  /* Can do 1000BT Full */
 #define ESTATUS_1000_THALF 0x1000  /* Can do 1000BT Half */
 
-- 
1.8.1.2

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


[U-Boot] [PATCH] net: phy: Fix networking regression on some mx6 boards

2013-07-18 Thread Fabio Estevam
From: Fabio Estevam fabio.este...@freescale.com

Since commit de1d786edf (add support for Xilinx 1000BASE-X phy (GTX))
we are no longer able to use tftp transfers on some mx6 boards
like mx6qsabresd and wandboard, which use AR8031 Ethernet phy.

Revert the commit as a proper fix is still not available.

Reported-by: Sascha Silbe t-ub...@infra-silbe.de
Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 drivers/net/phy/phy.c   | 21 -
 include/linux/ethtool.h |  4 
 include/linux/mii.h |  2 --
 3 files changed, 27 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7c0eaec..77d19c6 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -75,10 +75,6 @@ static int genphy_config_advert(struct phy_device *phydev)
adv |= ADVERTISE_PAUSE_CAP;
if (advertise  ADVERTISED_Asym_Pause)
adv |= ADVERTISE_PAUSE_ASYM;
-   if (advertise  ADVERTISED_1000baseX_Half)
-   adv |= ADVERTISE_1000XHALF;
-   if (advertise  ADVERTISED_1000baseX_Full)
-   adv |= ADVERTISE_1000XFULL;
 
if (adv != oldadv) {
err = phy_write(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE, adv);
@@ -292,7 +288,6 @@ int genphy_parse_link(struct phy_device *phydev)
if (mii_reg  BMSR_ANEGCAPABLE) {
u32 lpa = 0;
u32 gblpa = 0;
-   u32 estatus = 0;
 
/* Check for gigabit capability */
if (mii_reg  BMSR_ERCAP) {
@@ -332,18 +327,6 @@ int genphy_parse_link(struct phy_device *phydev)
 
} else if (lpa  LPA_10FULL)
phydev-duplex = DUPLEX_FULL;
-
-   if (mii_reg  BMSR_ESTATEN)
-   estatus = phy_read(phydev, MDIO_DEVAD_NONE,
-  MII_ESTATUS);
-
-   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |
-   ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
-   phydev-speed = SPEED_1000;
-   if (estatus  (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))
-   phydev-duplex = DUPLEX_FULL;
-   }
-
} else {
u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
 
@@ -401,10 +384,6 @@ int genphy_config(struct phy_device *phydev)
features |= SUPPORTED_1000baseT_Full;
if (val  ESTATUS_1000_THALF)
features |= SUPPORTED_1000baseT_Half;
-   if (val  ESTATUS_1000_XFULL)
-   features |= SUPPORTED_1000baseX_Full;
-   if (val  ESTATUS_1000_XHALF)
-   features |= SUPPORTED_1000baseX_Full;
}
 
phydev-supported = features;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index f6dbdb0..fcb20fe 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -580,8 +580,6 @@ enum ethtool_sfeatures_retval_bits {
 #define SUPPORTED_1baseKX4_Full(1  18)
 #define SUPPORTED_1baseKR_Full (1  19)
 #define SUPPORTED_1baseR_FEC   (1  20)
-#define SUPPORTED_1000baseX_Half   (1  21)
-#define SUPPORTED_1000baseX_Full   (1  22)
 
 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half(1  0)
@@ -605,8 +603,6 @@ enum ethtool_sfeatures_retval_bits {
 #define ADVERTISED_1baseKX4_Full   (1  18)
 #define ADVERTISED_1baseKR_Full(1  19)
 #define ADVERTISED_1baseR_FEC  (1  20)
-#define ADVERTISED_1000baseX_Half  (1  21)
-#define ADVERTISED_1000baseX_Full  (1  22)
 
 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 66b83d8..8b92692 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -115,8 +115,6 @@
 #define EXPANSION_MFAULTS  0x0010  /* Multiple faults detected*/
 #define EXPANSION_RESV 0xffe0  /* Unused...   */
 
-#define ESTATUS_1000_XFULL 0x8000  /* Can do 1000BX Full */
-#define ESTATUS_1000_XHALF 0x4000  /* Can do 1000BX Half */
 #define ESTATUS_1000_TFULL 0x2000  /* Can do 1000BT Full */
 #define ESTATUS_1000_THALF 0x1000  /* Can do 1000BT Half */
 
-- 
1.8.1.2

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


Re: [U-Boot] [PATCH 1/2] ARM: tegra: Make cache line size SoC specific

2013-07-18 Thread Stephen Warren
On 07/18/2013 01:13 PM, Thierry Reding wrote:
 From: Thierry Reding tred...@nvidia.com
 
 Currently all Tegra SoCs are assumed to have 32 byte cache lines. This
 isn't true for Tegra114, however, which uses 4 Cortex-A15 cores and
 therefore uses a cache line size of 64 bytes. Move the cache line size
 setting to the per-SoC common configuration file.

Tested-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Stephen Warren swar...@nvidia.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/18/2013 04:17 PM, Lukasz Majewski wrote:
 On Thu, 18 Jul 2013 13:30:55 -0400 Michael Cashwell
 mboa...@prograde.net wrote:
 
 On Jul 18, 2013, at 12:39 PM, Tom Rini tr...@ti.com wrote:
 
 uImage | raw  | nand   | 0   | kernel | -  | -
 | -   |
 
 Since partitions provide start/size.
 
 I've got some WIP that pulls the alt info from a GPT partition
 map on mmc.
 
 Extraction the part of dfu_alt_info from GPT or $partitions env
 variable (as defined at e.g. Trats) is also a good idea.
 
 The best solution would be to produce alt settings information as a
 mix of GPT layout information (extraction of part num, start
 offset, size... any more?) [*] and some predefined dfu_alt_info env
 variable. In this way we can reuse already available code (since
 GPT layout is already in place for most of targets).
 
 But what about mtd parts (Nand/ UBI)? It shall be also doable to 
 extract information [*] from it. Am I correct?

Right, we support that today even in DFU.

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJR6G00AAoJENk4IS6UOR1WA9cQAKRC0fOrdoVcQyrqeAzf+ahC
y18UHlFsmS+0fVzJzc0z3m7RiUYNCFEsNMm2JFedss7xgpP7GCwMDLRcLhy4CkEW
m5hjISL/C3pJKoAbCocKcUe4TD53Vmukr+sBPwKUR2N62iRcVYCO0Ved8P/4QXUz
g+Ylc8F6C6pPXxTEi8cn8oigmZzckJqn02AjfhY474uQZvKNezM1eA6uBOAbCugM
RJYjM+AxjOeL4dNYJTQEcmLAqcQPF0KW9yxfbMYi79h09qVJTqZIyvIHVIX4XfUp
E64yh21LhuhEyKxUnMcZbvcn5RQ2CvROY2a121D+hFWCxrnLeumIA49Hz8ilVYBt
1P6qzNotUbciOr9M33pedFOziYua/0Y6Wy4f5sMqYOaCy+qhO9KnaiJe0SkOUYah
XNMZ5tVMOAhCwDhmnmLSDWfZZMl9LBzibzIsw7qPzb/ZYtwA7CEa9WSSwZVw7Zsj
jj0+/j4uis4a4UOwj1E7ui3CgiRLu7ck5vBBTJ1VJlRvdCvBknio2aJ3/ZcJaXjc
U76Aly890n4EfwlclwRpeXVGg2eObsherz6gOuWqmVmjBYuiwQAKiT7X4VnqtWmM
V6yB6VmOKO5Am9GmpaWplep8l1vJgkmWd++3kwR75NgZIgmizwIpRxG56hd+oav8
0MH2gBeO6rZo/WdnJwJS
=IYIY
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Lukasz Majewski
On Thu, 18 Jul 2013 13:30:55 -0400
Michael Cashwell mboa...@prograde.net wrote:

 On Jul 18, 2013, at 12:39 PM, Tom Rini tr...@ti.com wrote:
 
  uImage | raw  | nand   | 0   | kernel | -  | -   |
  -   |
  
  Since partitions provide start/size.
 
 I've got some WIP that pulls the alt info from a GPT partition map on
 mmc. 

Extraction the part of dfu_alt_info from GPT or $partitions env variable
(as defined at e.g. Trats) is also a good idea.

The best solution would be to produce alt settings information as a mix
of GPT layout information (extraction of part num, start offset,
size... any more?) [*] and some predefined dfu_alt_info env variable. In
this way we can reuse already available code (since GPT layout is
already in place for most of targets).

But what about mtd parts (Nand/ UBI)? It shall be also doable to
extract information [*] from it. Am I correct?

 That alt settings in DFU can be strings or numbers was handy to
 allow the name to identify the partition.
 
 -Mike
 
 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot



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


Re: [U-Boot] [PATCH v6 2/2] NET: Add net_busy_flag

2013-07-18 Thread Marek Vasut
Dear Stephen Warren,

 On 07/18/2013 08:15 AM, Jim Lin wrote:
  This flag is to have console aware that NET transfer is running or not.
 
 I actually wonder if the shell interpreter or command-invocation code
 (to cover automatic bootcmd?) shouldn't set this flag before invoking
 every command, and clear it afterward? Or perhaps, a flag should be
 added to commands that would benefit from this flag being set?

Not a bad idea, but then this might be also needed for USB if the transfer is 
long etc etc
 
 But this patch is probably a reasonable way to implement it in the first
 place, so we don't add complex infra-structure if it turns out that
 nothing else is going to require this feature.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] usb: Use well-known descriptor sizes when parsing configuration

2013-07-18 Thread Marek Vasut
Dear Julius Werner,

  Mulling over this some more, I suspect if the device does have incorrect
  config descriptor, we should just ignore the device because it's broken
  piece of junk.
 
 I can change it if you insist, but I'd like to keep it to make the
 code look more consistent (since later on with the interface/endpoint
 descriptors, I think ignoring errors makes more sense).

How would that make the code more consistent ? It seems if the device can not 
even provide valid config ep descriptor, the device is broken beyond salvation.

  Looking at this, the memcpy is incorrect in the first place. It shouldn't
  memcpy into dev-config, but into dev-config.desc . And in turn, you an
  do memcpy(dev-config.desc, buffer, sizeof(dev-config.desc));
  
  Which is even better, since you always take into account the size of the
  structure member. This would be worth fixing the right way.
 
 The sizeof() thing is true for the configuration descriptor, but not
 for some others (e.g. endpoint) because U-Boot reserves fields for
 it's own stuff behind that.

Urgh, then the structure defining the descriptor shall be separated out.

 So for consistency (and safety in case of
 future expansion) I went with the macros in all cases.

Dang.

  Urgh, who the heck wrote this code. Damn that's a mess. Anyway, I suspect
  this might still explode if we go over USB_BUFSIZ in wTotalLength .
  Worth fixing.
 
 usb_get_configuration_no() now makes sure we don't read more than
 USB_BUFSIZ and stores the actually read amount in wTotalLength so we
 can use it without worrying here.

OK

  Would be nice to clean this up into understandable format by defining a
  variable for the buffer[index] and than just simply comparing this var-
  
 bInterfaceNumber and curr_if_num .
 
 Agreed, but let's clean this up one patch at a time.

Would you do a series on this maybe?

if_desc = dev-config.if_desc[ifno];
dev-config.no_of_if++;
  
  - memcpy(if_desc, buffer[index],
  buffer[index]); + if (buffer[index] !=
  USB_DT_INTERFACE_SIZE) +
  printf(Ignoring invalid USB IF length +  
 (%d)\n, buffer[index]);
  
  Let's just ignore the descriptor if it's incorrect.
 
 Jokes about Chinese crap aside, I would try to err on the side of
 making it work if in any way possible, as long as the code stays safe.

But obviously the descriptor is broken.

 This is firmware so we often can't do much error recovery... either we
 can work with what we have, or we won't boot. Although I don't think
 these cases will happen in practice.

So, let's just ignore broken descriptors.

  - result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer,
  tmp); - debug(get_conf_no %d Result %d, wLength %d\n, cfgno,
  result, tmp); + result = usb_get_descriptor(dev, USB_DT_CONFIG,
  cfgno, buffer, length); + debug(get_conf_no %d Result %d, wLength
  %d\n, cfgno, result, length); + config-wTotalLength = length; /*
  validated, with CPU byte order */
  
  The above assignment is new, why ?
 
 This is the sanitization of wTotalLength I mentioned above. Maybe not
 the most obvious way to do it, but it's convenient since you have to
 pass the actually read length from here to usb_parse_config() somehow
 (to avoid things like reading into the leftover descriptors of a
 previously enumerated device).

Document this properly then.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: at91sam9n12: change EBI IO to high drive mode

2013-07-18 Thread Bo Shen

Hi Albert,

On 07/17/2013 06:42 PM, Albert ARIBAUD wrote:

Hi Bo,

On Wed, 17 Jul 2013 18:27:29 +0800, Bo Shen voice.s...@atmel.com
wrote:


Hi Albert,

On 07/17/2013 06:10 PM, Albert ARIBAUD wrote:

Hi Bo,

On Wed, 17 Jul 2013 17:14:17 +0800, Bo Shen voice.s...@atmel.com
wrote:


As both the DDR SDRAM and NAND flash connect to EBI on at91sam9n12
and share the lower 8 bits data line. If use low drive of the data
line, it will cause DDR data access corrupt in lower address, so
change the data line to high drive mode

This will fix the Linux kernel boot issue when use Lower address


Wait--does this mean that there is no separate chip selects for NAND and
DDR on this SoC?


No. The NAND and DDR has there own chip selects.
This is chip specific. If DDR and NAND share data line, if we use low
drive for EBI IO, it will cause DDR low memory address content corrupt.
For example, if the DDR base address is 0x2000, if we use 0x20008000
as entry address of Linux kernel, then it won't boot up successfully.
So, if we need to use low memory address, we need this to fix.


I understand the symptom. What I don't undestand is how come NAND
does not keep its data lines in high impedance when its chip select is
inactive, which it is when DDR is being accessed.


So, I expect this patch be applied in v2013.07 release, would it be OK?

Hi Andreas,
  If no objection from Albert, would it be possible to apply it and 
include it in v2013.07 release.



Best Regards,
Bo Shen


Amicalement,



Best Regards,
Bo Shen
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] net: phy: Fix networking regression on some mx6 boards

2013-07-18 Thread Otavio Salvador
On Thu, Jul 18, 2013 at 6:04 PM, Fabio Estevam feste...@gmail.com wrote:
 From: Fabio Estevam fabio.este...@freescale.com

 Since commit de1d786edf (add support for Xilinx 1000BASE-X phy (GTX))
 we are no longer able to use tftp transfers on some mx6 boards
 like mx6qsabresd and wandboard, which use AR8031 Ethernet phy.

 Revert the commit as a proper fix is still not available.

 Reported-by: Sascha Silbe t-ub...@infra-silbe.de
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com

This is indeed the best option that late in the release I think.

Acked-by: Otavio Salvador ota...@osystems.com.br

--
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] ARM: tegra: Make cache line size SoC specific

2013-07-18 Thread Thierry Reding
On Thu, Jul 18, 2013 at 03:19:18PM -0600, Stephen Warren wrote:
 On 07/18/2013 01:13 PM, Thierry Reding wrote:
  From: Thierry Reding tred...@nvidia.com
  
  Currently all Tegra SoCs are assumed to have 32 byte cache lines. This
  isn't true for Tegra114, however, which uses 4 Cortex-A15 cores and
  therefore uses a cache line size of 64 bytes. Move the cache line size
  setting to the per-SoC common configuration file.
 
 Tested-by: Stephen Warren swar...@nvidia.com
 Reviewed-by: Stephen Warren swar...@nvidia.com

Do these apply to patch 2 of this series as well?

Thierry


pgp2FlszQ_lEZ.pgp
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] dfu: Implementation of target reset after communication with dfu-util's -R switch

2013-07-18 Thread Heiko Schocher

Hello Lukasz,

Am 18.07.2013 13:19, schrieb Lukasz Majewski:

This patch extends dfu code to support transmission with -R switch
specified at dfu-util.

When -R is specified, the extra USB_REQ_DFU_DETACH request is sent after
successful data transmission. Then dfu resources are released and reset
command is issued.

Signed-off-by: Lukasz Majewskil.majew...@samsung.com
Signed-off-by: Kyungmin Parkkyungmin.p...@samsung.com
---
  common/cmd_dfu.c   |   14 +-
  drivers/dfu/dfu.c  |   11 +++
  drivers/usb/gadget/f_dfu.c |2 ++
  include/dfu.h  |2 ++
  4 files changed, 28 insertions(+), 1 deletion(-)


Tested on AM335x based boards, so:

Tested-by: Heiko Schocher h...@denx.de

Thanks!

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4] dfu, nand, ubi: add partubi alt settings for updating ubi partition

2013-07-18 Thread Heiko Schocher
updating an ubi partition needs a completely erased mtd partition,
see:
http://lists.infradead.org/pipermail/linux-mtd/2011-May/035416.html

So, add partubi alt setting for the dfu_alt_info environment
variable to mark this partition as an ubi partition. In case we
update an ubi partition, we erase after flashing the image into the
partition, the remaining sektors.

Signed-off-by: Heiko Schocher h...@denx.de
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Wolfgang Denk w...@denx.de

---

- This patch is also a good starting point to fix up updating ubi, as
  we currently use nand erase for erasing the sektors. This is
  not the prefered way for writing an ubi image, see:
  http://www.linux-mtd.infradead.org/faq/ubi.html#L_flash_img

  This must be fixed ... we have no ubiformat in u-boot, or?

- changes for v2:
  - do not use spread = 1 for nand_erase_opts, to prevent
errormessage if there are bad blocks in the erase range.

- changes for v3:
  - add comment from Marek Vasut:
- prevent losing memory
  - added comment from Lukasz Majewski:
- move code to dfu_nand.c dfu_flush_medium_nand()

- changes for v4:
  - add comment from Lukasz Majewski:
- move ubi var to internal struct struct nand_internal_data
---
 drivers/dfu/dfu_nand.c | 58 ++
 include/dfu.h  |  2 ++
 2 Dateien geändert, 60 Zeilen hinzugefügt(+)

diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 07dee89..c0f8adf 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -148,11 +148,43 @@ static int dfu_read_medium_nand(struct dfu_entity *dfu, 
u64 offset, void *buf,
return ret;
 }
 
+static int dfu_flush_medium_nand(struct dfu_entity *dfu)
+{
+   int ret = 0;
+
+   /* in case of ubi partition, erase rest of the partition */
+   if (dfu-data.nand.ubi) {
+   nand_info_t *nand;
+   nand_erase_options_t opts;
+
+   if (nand_curr_device  0 ||
+   nand_curr_device = CONFIG_SYS_MAX_NAND_DEVICE ||
+   !nand_info[nand_curr_device].name) {
+   printf(%s: invalid nand device\n, __func__);
+   return -1;
+   }
+
+   nand = nand_info[nand_curr_device];
+
+   memset(opts, 0, sizeof(opts));
+   opts.offset = dfu-data.nand.start + dfu-offset +
+   dfu-bad_skip;
+   opts.length = dfu-data.nand.start +
+   dfu-data.nand.size - opts.offset;
+   ret = nand_erase_opts(nand, opts);
+   if (ret != 0)
+   printf(Failure erase: %d\n, ret);
+   }
+
+   return ret;
+}
+
 int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 {
char *st;
int ret, dev, part;
 
+   dfu-data.nand.ubi = 0;
dfu-dev_type = DFU_DEV_NAND;
st = strsep(s,  );
if (!strcmp(st, raw)) {
@@ -185,7 +217,32 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 
dfu-data.nand.start = pi-offset;
dfu-data.nand.size = pi-size;
+   } else if (!strcmp(st, partubi)) {
+   char mtd_id[32];
+   struct mtd_device *mtd_dev;
+   u8 part_num;
+   struct part_info *pi;
 
+   dfu-layout = DFU_RAW_ADDR;
+
+   dev = simple_strtoul(s, s, 10);
+   s++;
+   part = simple_strtoul(s, s, 10);
+
+   sprintf(mtd_id, %s%d,%d, nand, dev, part - 1);
+   printf(using id '%s'\n, mtd_id);
+
+   mtdparts_init();
+
+   ret = find_dev_and_part(mtd_id, mtd_dev, part_num, pi);
+   if (ret != 0) {
+   printf(Could not locate '%s'\n, mtd_id);
+   return -1;
+   }
+
+   dfu-data.nand.start = pi-offset;
+   dfu-data.nand.size = pi-size;
+   dfu-data.nand.ubi = 1;
} else {
printf(%s: Memory layout (%s) not supported!\n, __func__, st);
return -1;
@@ -193,6 +250,7 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 
dfu-read_medium = dfu_read_medium_nand;
dfu-write_medium = dfu_write_medium_nand;
+   dfu-flush_medium = dfu_flush_medium_nand;
 
/* initial state */
dfu-inited = 0;
diff --git a/include/dfu.h b/include/dfu.h
index 124653c..4de7b34 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -59,6 +59,8 @@ struct nand_internal_data {
 
unsigned int dev;
unsigned int part;
+   /* for nand/ubi use */
+   unsigned int ubi;
 };
 
 static inline unsigned int get_mmc_blk_size(int dev)
-- 
1.7.11.7

___
U-Boot mailing list

Re: [U-Boot] [PATCH 1/2] ARM: tegra: Make cache line size SoC specific

2013-07-18 Thread Stephen Warren
On 07/18/2013 08:38 PM, Thierry Reding wrote:
 On Thu, Jul 18, 2013 at 03:19:18PM -0600, Stephen Warren wrote:
 On 07/18/2013 01:13 PM, Thierry Reding wrote:
 From: Thierry Reding tred...@nvidia.com
 
 Currently all Tegra SoCs are assumed to have 32 byte cache
 lines. This isn't true for Tegra114, however, which uses 4
 Cortex-A15 cores and therefore uses a cache line size of 64
 bytes. Move the cache line size setting to the per-SoC common
 configuration file.
 
 Tested-by: Stephen Warren swar...@nvidia.com Reviewed-by:
 Stephen Warren swar...@nvidia.com
 
 Do these apply to patch 2 of this series as well?

Yes, the whole series.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [U-boot] failed to boot an compressed u-boot.bin

2013-07-18 Thread Minkyu Kang
On 18/07/13 17:08, Wolfgang Denk wrote:
 Dear tiger...@viatech.com.cn,
 
 please stop top posting / full quoting.
 
 
 In message fe7aded5c2218b4786c09cd97dc4c49f99d...@exchbj02.viatech.com.bj 
 you wrote:

 My code base is based on u-boot-2013.04 .
 I followed board\samsung\smdkc100\config.mk , and put it into my board
 related directory.
 
 You managed toi find a really bad example of code.  This should not be
 used.  Today, CONFIG_SYS_TEXT_BASE should be defined in the board
 config file instead. The use of board specific confog.mk files is
 strongly deprecated.
 
 Minkyu Kang, could you please clean this up as soon as possible?
 Thanks!

Sure.

 
 
 About SPL approach:
 Did you suggest I put decompressed algorithm code into SPL code instead
 of adding a self-uncompressed header?
 
 Yes, that would be the U-Boot way to implement it. It allows you to
 reusse existing code instead of adding new methods.
 
 Best regards,
 
 Wolfgang Denk
 

Thanks,
Minkyu Kang.

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


Re: [U-Boot] [RFC][DFU] Unification of dfu_alt_info alt settings description + command execution

2013-07-18 Thread Heiko Schocher

Hello Marek,

Am 18.07.2013 17:10, schrieb Marek Vasut:

Hi,


Dear Heiko Schocher,

In message51e77a1d.90...@denx.de  you wrote:

Try nand write.trimffs to write UBI images produced with ubinize .


This solves not the erasecounter problem, or?

For UBI we need something like this:
http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo

But I am not an UBI expert. It is possible I overlook something
obvious ...


No, you don't.  Devices managed by UBI should never be erased by
other, non-UBI-aware tools.


I based my reply on the following commit in U-Boot and the fact that
write.trimffs is used to flash UBI images. Maybe I was wrong?

commit c9494866df835bcee68e17339aec1090faa704da
Author: Ben Gardinerbengardi...@nanometrics.ca
Date:   Tue Jun 14 16:35:07 2011 -0400

 cmd_nand: add nand write.trimffs command

 Add another nand write. variant, trimffs. This command will request of
 nand_write_skip_bad() that all trailing all-0xff pages will be
 dropped from eraseblocks when they are written to flash as-per the
 reccommended behaviour of the UBI FAQ [1].

 The function that implements this timming is the drop_ffs() function
 by Artem Bityutskiy, ported from the mtd-utils tree.

 [1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo


Yes, that sounds as a step in the right direction, but where are
the erasecounters handled, as described in [1] ?

And as this is a ubi function and not nand specific, the command
should start with ubi ... ... as we have a ubi write ..., but
ubi write is only for ubi volumes ... i tend to say, we need a
ubi format ... similiar to ubiformat in the mtd utils [2] ...

[2] http://git.infradead.org/mtd-utils.git
ubiformat found in /ubi-utils/ubiformat.c

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot