[U-Boot] Loading a userland file

2012-11-03 Thread Grant
I'm trying to get Tiny Core working on the Beaglebone.  I'm stuck on
getting the Tiny Core userland file uCore to load so init works.  I'm
using this uEnv.txt:

bootfile=/uImage
optargs=init=/init rootwait
fatload mmc 0 0x4310 uCore
mmcboot=echo Booting from mmc ...; run mmcargs; bootm 0x8020 0x4310

I get the following data abort:

## Booting kernel from Legacy Image at 8020 ...
Image Name:   Linux-3.6.0-rc7-00219-g35e0f42
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:2878667 Bytes = 2.7 MiB
Load Address: 80008000
Entry Point:  80008000
Verifying Checksum ... OK
data abort
pc : [8ff99480]  lr : [8ff996ac]
sp : 8fe6abd0  ip : 8fe6d163 fp : 0001
r10: 0002  r9 :  r8 : 8fe6af68
r7 : 8ffbaebc  r6 : 4310 r5 : 8ffbaec0  r4 : 4310
r3 :   r2 : 0010 r1 :   r0 : 4310
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
Resetting CPU ...

If I change mmcboot to:

mmcboot=echo Booting from mmc ...; run mmcargs; bootm 0x8020

The kernel loads, but init fails:

EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
devtmpfs: error mounting -2
Freeing init memory: 144K
Failed to execute /init.  Attempting defaults...
Kernel panic - not syncing: No init found.  Try passing init= option to
kernel.

Can anyone tell me how to load uCore so init works?

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


Re: [U-Boot] [PATCH 02/17] Add gettime command

2012-11-03 Thread Luka Perkov
Hi Simon,

On Fri, Nov 02, 2012 at 05:27:18PM -0700, Simon Glass wrote:
 From: Anton Staaf robot...@chromium.org
 
 Gettime returns the current timer value.  If CONFIG_SYS_HZ is defined
 then the timer value is also converted to seconds.
 
 Tegra20 (SeaBoard) # gettime
 Timer val: 7754
 Seconds : 7
 Remainder : 754
 sys_hz = 1000
 
 Signed-off-by: Anton Staaf robot...@chromium.org
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  README   |1 +
  common/Makefile  |1 +
  common/cmd_gettime.c |   56 
 ++
  include/config_cmd_all.h |1 +
  4 files changed, 59 insertions(+), 0 deletions(-)
  create mode 100644 common/cmd_gettime.c
 
 diff --git a/README b/README
 index 22fd6b7..a080225 100644
 --- a/README
 +++ b/README
 @@ -815,6 +815,7 @@ The following options need to be configured:
   CONFIG_CMD_FDOS * Dos diskette Support
   CONFIG_CMD_FLASH  flinfo, erase, protect
   CONFIG_CMD_FPGA   FPGA device initialization support
 + CONFIG_CMD_GETTIME * Get time since boot

Here should be TABs instead of spaces.

   CONFIG_CMD_GO   * the 'go' command (exec code)
   CONFIG_CMD_GREPENV  * search environment
   CONFIG_CMD_HWFLOW   * RTS/CTS hw flow control
 diff --git a/common/Makefile b/common/Makefile
 index 9e43322..0fb79ed 100644
 --- a/common/Makefile
 +++ b/common/Makefile
 @@ -100,6 +100,7 @@ ifdef CONFIG_FPGA
  COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o
  endif
  COBJS-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o
 +COBJS-$(CONFIG_CMD_GETTIME) += cmd_gettime.o
  COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o
  COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o
  COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o
 diff --git a/common/cmd_gettime.c b/common/cmd_gettime.c
 new file mode 100644
 index 000..d7d36a9
 --- /dev/null
 +++ b/common/cmd_gettime.c
 @@ -0,0 +1,56 @@
 +/*
 + * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 + *
 + * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
 + *
 + * (C) Copyright 2001
 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 + *
 + * See file CREDITS for list of people who contributed to this
 + * project.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + */
 +
 +/*
 + * Get Timer overflows after 2^32 / CONFIG_SYS_HZ (32Khz) = 131072 sec
 + */
 +#include common.h
 +#include command.h
 +
 +static int do_gettime(cmd_tbl_t *cmdtp, int flag, int argc,
 +   char * const argv[])
 +{
 + unsigned long int val = get_timer(0);
 +
 +#ifdef CONFIG_SYS_HZ
 + printf(Timer val: %lu\n, val);
 + printf(Seconds : %lu\n, val / CONFIG_SYS_HZ);
 + printf(Remainder : %lu\n, val % CONFIG_SYS_HZ);
 + printf(sys_hz = %lu\n, (unsigned long int)CONFIG_SYS_HZ);
 +#else
 + printf(CONFIG_SYS_HZ not defined);
 + printf(Timer Val %lu, val);
 +#endif
 +
 + return 0;
 +}
 +
 +U_BOOT_CMD(
 + gettime,1,  1,  do_gettime,

I would put here spaces instead of TABs.

 + get timer val elapsed,\n,
 + get time elapsed from uboot start\n
 +);
 diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h
 index f434cd0..b87967e 100644
 --- a/include/config_cmd_all.h
 +++ b/include/config_cmd_all.h
 @@ -40,6 +40,7 @@
  #define CONFIG_CMD_FDOS  /* Floppy DOS support   */
  #define CONFIG_CMD_FLASH /* flinfo, erase, protect   */
  #define CONFIG_CMD_FPGA  /* FPGA configuration Support   */
 +#define CONFIG_CMD_GETTIME   /* Get time since boot */
  #define CONFIG_CMD_HWFLOW/* RTS/CTS hw flow control  */
  #define CONFIG_CMD_I2C   /* I2C serial bus support   */
  #define CONFIG_CMD_IDE   /* IDE harddisk support */
 -- 
 1.7.7.3

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


Re: [U-Boot] [PATCH v3 0/18] Add environment call-back and flags capability

2012-11-03 Thread Wolfgang Denk
Dear Joseph Hershberger,

In message fef7fe83-c55c-4ff4-a885-41a692404...@ni.com you wrote:
 htmlbody
 pfont size=2 face=sans-serifHi Wolfgang,br


Please do not send HTML messages.

Please send plain text only.

Message unreadable, ignored. Sorry.


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
Panic, n.: The second time you can't do it the first time.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 01/10] arm: Compile cache_disable() with -O2 to avoid failure

2012-11-03 Thread Marek Vasut
Dear Simon Glass,

 It is good to have these functions written in C instead of assembler,
 but with -O0 the cache_disable() function doesn't return. Rather than
 revert to assembler, this fix just forces this to be built with -O2.
 
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  arch/arm/lib/cache-cp15.c |   10 ++
  1 files changed, 10 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
 index 939de10..8f8385d 100644
 --- a/arch/arm/lib/cache-cp15.c
 +++ b/arch/arm/lib/cache-cp15.c
 @@ -110,6 +110,16 @@ static void cache_enable(uint32_t cache_bit)
   set_cr(reg | cache_bit);
  }
 
 +/*
 + * Big hack warning!
 + *
 + * Devs like to compile with -O0 to get a nice debugging illusion. But
 this + * function does not survive that since -O0 causes the compiler to
 read the + * PC back from the stack after the dcache flush. Might it be
 possible to fix + * this by flushing the write buffer?
 + */
 +static void cache_disable(uint32_t cache_bit) __attribute__
 ((optimize(2))); +
  /* cache_bit must be either CR_I or CR_C */
  static void cache_disable(uint32_t cache_bit)
  {

Uh, are you sure this is right ?

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


Re: [U-Boot] pull request for u-boot-tegra/master into ARM/master

2012-11-03 Thread Albert ARIBAUD
Hi Tom,

On Mon, 29 Oct 2012 16:49:34 -0700, Tom Warren
twarren.nvi...@gmail.com wrote:

 Albert,
 
 Please pull u-boot-tegra/master into ARM/master. Thanks!
 
 checkpatch is clean, and ./MAKEALL -a arm is clean (except for
 previous failures not created by these patches). Note that the serial:
 patch from Allen is already in u-boot/master, but is needed to get
 u-boot-tegra binaries to work correctly.
 
 The following changes since commit f04821a8ca714459481bd9fd315af2b5f92d99a6:
   Albert ARIBAUD (1):
 Merge remote-tracking branch 'u-boot-imx/master'
 
 are available in the git repository at:
 
   git://git.denx.de/u-boot-tegra master
 
 Allen Martin (5):
   SPL: make jump_to_image_no_args a weak symbol
   tegra: move to common SPL framework
   tegra20: initialize variable to avoid compiler warning
   serial: remove calls to serial_assign()
   arm720t: add back common.h include
 
 Lucas Stach (2):
   tegra: add Colibri T20 board support
   tegra: nand: make ONFI detection work
 
 Marc Dietrich (1):
   tegra: move common features to a common makefile
 
 Stephen Warren (10):
   ARM: tegra: define CONFIG_SYS_BOOTMAPSZ
   ARM: tegra: use standard variables to define load addresses
   ARM: tegra: Harmony: enable ULPI USB port
   ARM: tegra: Seaboard: enable multiple USB ports
   ARM: tegra: Whistler: remove unused USB alias
   ARM: enhance u-boot.lds to detect over-sized SPL
   ARM: tegra: derive CONFIG_SPL_MAX_SIZE instead of hard-coding it
   ARM: tegra: select between Seaboard/Ventana at compile time
   ARM: tegra: don't request GPIO from Seaboard's SPL
   ARM: tegra: combine duplicate Makefile rules
 
  MAINTAINERS|4 +
  Makefile   |   15 ++--
  arch/arm/cpu/arm720t/interrupts.c  |2 +
  arch/arm/cpu/arm720t/tegra-common/spl.c|   91 
 +++-
  arch/arm/cpu/tegra20-common/emc.c  |2 +-
  arch/arm/cpu/u-boot.lds|4 +
  arch/arm/include/asm/arch-tegra20/spl.h|   28 ++
  board/avionic-design/medcom-wide/Makefile  |6 +-
  board/avionic-design/plutux/Makefile   |6 +-
  board/avionic-design/tec/Makefile  |6 +-
  board/compal/paz00/Makefile|6 +-
  board/compulab/trimslice/Makefile  |6 +-
  board/nvidia/common/Makefile   |4 +-
  board/nvidia/common/common.mk  |4 +
  board/nvidia/dts/tegra20-harmony.dts   |3 +-
  board/nvidia/dts/tegra20-whistler.dts  |5 +-
  board/nvidia/harmony/harmony.c |9 ++
  board/nvidia/seaboard/seaboard.c   |   18 +---
  .../colibri_t20-common/colibri_t20-common.c|   44 ++
  .../colibri_t20-common/colibri_t20-common.h|   16 
  board/toradex/colibri_t20_iris/Makefile|   40 +
  board/toradex/colibri_t20_iris/colibri_t20_iris.c  |   46 ++
  board/toradex/dts/tegra20-colibri_t20_iris.dts |   38 
  boards.cfg |1 +
  common/cmd_nvedit.c|3 -
  common/iomux.c |   10 --
  common/spl/spl.c   |8 +-
  drivers/mtd/nand/tegra_nand.c  |   36 
  include/configs/colibri_t20_iris.h |   83 ++
  include/configs/harmony.h  |3 +
  include/configs/seaboard.h |1 +
  include/configs/tegra-common-post.h|   32 ++-
  include/configs/tegra20-common.h   |   10 ++-
  33 files changed, 455 insertions(+), 135 deletions(-)
  create mode 100644 arch/arm/include/asm/arch-tegra20/spl.h
  create mode 100644 board/nvidia/common/common.mk
  create mode 100644 board/toradex/colibri_t20-common/colibri_t20-common.c
  create mode 100644 board/toradex/colibri_t20-common/colibri_t20-common.h
  create mode 100644 board/toradex/colibri_t20_iris/Makefile
  create mode 100644 board/toradex/colibri_t20_iris/colibri_t20_iris.c
  create mode 100644 board/toradex/dts/tegra20-colibri_t20_iris.dts
  create mode 100644 include/configs/colibri_t20_iris.h
 

Applied to u-boot-arm/master, thanks!

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


[U-Boot] [PATCH V2] ARM: Fix malloc area size for versatile and integrator

2012-11-03 Thread Marek Vasut
These boards couldn't save their environment because they couldn't malloc()
the whole size of the sector.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Linus Walleij linus.wall...@linaro.org
---
 include/configs/integrator-common.h |3 ++-
 include/configs/versatile.h |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

V2: Align with current code

diff --git a/include/configs/integrator-common.h 
b/include/configs/integrator-common.h
index 564b418..51227e7 100644
--- a/include/configs/integrator-common.h
+++ b/include/configs/integrator-common.h
@@ -37,7 +37,8 @@
 #define CONFIG_SYS_PBSIZE  
(CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
 #define CONFIG_SYS_MAXARGS 16  /* max number of command args */
 #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE /* Boot Argument 
Buffer Size*/
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128*1024) /* Size of 
malloc() pool */
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SECT_SIZE + 128*1024)
 
 #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs  */
 #define CONFIG_SETUP_MEMORY_TAGS
diff --git a/include/configs/versatile.h b/include/configs/versatile.h
index a65c676..2484881 100644
--- a/include/configs/versatile.h
+++ b/include/configs/versatile.h
@@ -71,7 +71,7 @@
  * Size of malloc() pool
  */
 #define CONFIG_ENV_SIZE8192
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128 * 1024)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SECT_SIZE + 128 * 1024)
 
 /*
  * Hardware drivers
-- 
1.7.10.4

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


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

2012-11-03 Thread Albert ARIBAUD
Hi Tom,

On Fri, 2 Nov 2012 10:08:22 -0700, Tom Rini tr...@ti.com wrote:

 Hello,
 
 The following changes since commit c7d35bef255dedb3ec3856982f042dde514676b0:
 
   am33xx/ddr_defs.h: rename DDR2/DDR3 defines to their actual part numbers 
 (2012-10-25 11:31:38 -0700)
 
 are available in the git repository at:
 
   git://git.denx.de/u-boot-ti.git master
 
 for you to fetch changes up to a956bdcb3ff759f753e3f0c5e40e58f4c3056e22:
 
   am335x: add initial AM335x IDK board support (2012-11-02 10:04:04 -0700)
 
 
 Andrew Bradford (4):
   am33xx: Enable UART{1,2,3,4,5} clocks
   am33xx: Enable UART{1,2,3,4,5} pin-mux
   serial: ns16550: Enable COM5 and COM6
   am335x_evm: Enable use of UART{1,2,3,4,5}
 
 Koen Kooi (1):
   am335x: add mux config for DDR3 version of beaglebone
 
 Matthias Fuchs (1):
   am335x: add initial AM335x IDK board support
 
 Pali Rohár (4):
   arm bootm: Allow to pass board specified atags
   Add power bus message definitions in twl4030.h
   cfb_console: Add support for some ANSI terminal escape codes
   New board support: Nokia RX-51 aka N900
 
 Raphael Assenat (1):
   eco5pk: Add new board and default config
 
 Tom Rini (1):
   omap3: Rework board.c for !CONFIG_SYS_L2CACHE_OFF
 
  MAINTAINERS   |8 +
  README|4 +
  arch/arm/cpu/armv7/am33xx/clock.c |   35 ++
  arch/arm/cpu/armv7/omap3/board.c  |   28 +-
  arch/arm/include/asm/setup.h  |5 +
  arch/arm/lib/bootm.c  |4 +
  board/8dtech/eco5pk/Makefile  |   43 +++
  board/8dtech/eco5pk/eco5pk.c  |   61 
  board/8dtech/eco5pk/eco5pk.h  |  404 ++
  board/nokia/rx51/Makefile |   46 +++
  board/nokia/rx51/lowlevel_init.S  |  209 
  board/nokia/rx51/rx51.c   |  677 
 +
  board/nokia/rx51/rx51.h   |  389 +
  board/nokia/rx51/tag_omap.h   |  311 +
  board/ti/am335x/board.c   |   24 +-
  board/ti/am335x/board.h   |5 +
  board/ti/am335x/mux.c |   80 +
  boards.cfg|9 +-
  doc/README.nokia_rx51 |  104 ++
  drivers/serial/serial_ns16550.c   |   36 +-
  drivers/video/cfb_console.c   |  328 +-
  include/configs/am335x_evm.h  |   12 +-
  include/configs/eco5pk.h  |   81 +
  include/configs/nokia_rx51.h  |  452 +
  include/twl4030.h |   98 ++
  25 files changed, 3421 insertions(+), 32 deletions(-)
  create mode 100644 board/8dtech/eco5pk/Makefile
  create mode 100644 board/8dtech/eco5pk/eco5pk.c
  create mode 100644 board/8dtech/eco5pk/eco5pk.h
  create mode 100644 board/nokia/rx51/Makefile
  create mode 100644 board/nokia/rx51/lowlevel_init.S
  create mode 100644 board/nokia/rx51/rx51.c
  create mode 100644 board/nokia/rx51/rx51.h
  create mode 100644 board/nokia/rx51/tag_omap.h
  create mode 100644 doc/README.nokia_rx51
  create mode 100644 include/configs/eco5pk.h
  create mode 100644 include/configs/nokia_rx51.h
 
 Thanks!
 

Applied to u-boot-arm/master, thanks!

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


Re: [U-Boot] Custodian branch base commits

2012-11-03 Thread Albert ARIBAUD
Hi Stephen,

On Wed, 31 Oct 2012 10:56:08 -0600, Stephen Warren
swar...@wwwdotorg.org wrote:

  Hopefully, u-boot-arm/master will merge in (or get reset to) 
  u-boot/master fairly shortly. However, should Tegra's repo have
  to wait for this?
  
  Yes, tegra has to wait otherwise you've just forced u-boot-arm into
  a re-sync with master and now u-boot-arm can't where problems came
  from, be it your tree or master.
 
 That is only true if the pull request sent to u-boot-arm from
 u-boot-tegra is sent or processed before u-boot-arm pulls in the
 u-boot commit that u-boot-tegra was based upon.
 
 In other words, I don't think this issue requires that leaf repos be
 based on a commit that's already in their immediate upstream repo, but
 rather that leaf repos don't send a pull request to their upstream
 repo until the leaf repo's baseline commit is included in their
 upstream repo.

Stop me if I'm wrong, but if e.g. u-boot-tegra/master dependsn on some
commits from u-boot/master that are not already in u-boot/arm, then
when I fetch u-boot-tegra/master, these commits will automatically get
fetched along, and when I fetch u-boot/arm, these commits will just be
already there.

So what am I missing?

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


Re: [U-Boot] [PATCH 01/10] arm: Compile cache_disable() with -O2 to avoid failure

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351813330-23741-1-git-send-email-...@chromium.org you wrote:
 It is good to have these functions written in C instead of assembler,
 but with -O0 the cache_disable() function doesn't return. Rather than
 revert to assembler, this fix just forces this to be built with -O2.

NAK.

This is vodoo programming to fix a problem which is obviously not
correctly understood (and fixed), so the real cause remains unfixed.

 +/*
 + * Big hack warning!
 + *
 + * Devs like to compile with -O0 to get a nice debugging illusion. But this

We don't use -O0 normally, and actually there are more places in the
code that are likely to cause problems or to actually break when
using -O0.

 + * function does not survive that since -O0 causes the compiler to read the
 + * PC back from the stack after the dcache flush. Might it be possible to fix
 + * this by flushing the write buffer?
 + */

compiler to read the PC back from the stack after the dcache flush -
can you please explain what exactly this means, and which exact
problem it causes?

 +static void cache_disable(uint32_t cache_bit) __attribute__ ((optimize(2)));

Sorry, I will not accept 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
backups: always in season, never out of style.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 05/10] arm: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351813330-23741-5-git-send-email-...@chromium.org you wrote:
 This option delays loading of the environment until later, so that only the
 default environment will be available to U-Boot.
 
 This can address the security risk of untrusted data being used during boot.
 
 When CONFIG_DELAY_ENVIRONMENT is defined, it is convenient to have a
 run-time way of enabling loadinlg of the environment. Add this to the
 fdt as /config/delay-environment.

Please explain what exactly this is good for, or which exact security
risks this is supposed to fix.

As is, I strongly tend to NAK 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
In the beginning, there was nothing, which exploded.
- Terry Pratchett, _Lords and Ladies_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 06/10] arm: Add CONFIG_DISPLAY_BOARDINFO_LATE to display board info on LCD

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351813330-23741-6-git-send-email-...@chromium.org you wrote:
 This option displays board info after stdio is running, so that it will
 appear on the LCD. If it is displayed earlier, the board info will appear
 on the serial console but not on the LCD.

Note that this is intentional!  We always want to have the output in
the console as soon as possible.


 +- CONFIG_DISPLAY_BOARDINFO
 + Display information about the board that U-Boot is running on
 + when U-Boot starts up.

Why do we need a config option for this?

This being the default (and I request that this remains so!), you
would have to touch _ALL_ existing board config files!

 +- CONFIG_DISPLAY_BOARDINFO_LATE
 + Similar to the previous option, but display this information
 + later, once stdio is running and output goes to the LCD, if
 + present.

This makes little sense to me.

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
Each kiss is as the first.
-- Miramanee, Kirk's wife, The Paradise Syndrome,
   stardate 4842.6
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/10] arm: Add option to display customised memory information

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351813330-23741-7-git-send-email-...@chromium.org you wrote:
 Some boards want to report more than just memory size. For example, it
 might be useful to display the memory type (DDR2, DDR3) or manufacturer.
 
 Add a weak function to support this requirement.
 
 Any example of the DRAM: output is below, just for illustration:
 
 U-Boot 2011.12-02470-gd64a0f8-dirty (Sep 14 2012 - 10:46:39) for SMDK5250
 
 CPU:   S5PC520 @ 1700MHz
 I2C:   ready
 DRAM:  2 GiB Samsung DDR3 @ 800MHz
 MMC:   S5P MSHC0: 0, S5P MSHC1: 1
 Using default environment

NAK.

Such information does not belong into the standard boot messages.
These should containonly the necessary information to see that U-Boot
is coming up correctly and give indication where it might be hanging
if it does.

All other information should be printed by commands that may be called
by users who are actually interested in such information.  You may
even add such commands to your preboot settings, but please make
sure that users not interested in such stuff can change this and get
only minimal output (as may be needed for minimal boot times).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
If a person (a) is poorly, (b) receives treatment  intended  to  make
him  better, and (c) gets better, then no power of reasoning known to
medical science can convince him  that  it  may  not  have  been  the
treatment that restored his health.
- Sir Peter Medawar, The Art of the Soluble
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 04/10] arm: Move fdt check earlier so that board_early_init_f() can use it

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351813330-23741-4-git-send-email-...@chromium.org you wrote:
 We want to use the fdt inside board_early_init_f(), so check for its
 presence earlier in the pre-reloc init sequence.
 
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  arch/arm/lib/board.c |7 +++
  1 files changed, 3 insertions(+), 4 deletions(-)

NAK as is.  Please make sure to keep all architectures in sync.  The
long term goal is still to merge the lib/board.c files into a single,
common one.

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
In the future, you're going to get computers as prizes  in  breakfast
cereals.  You'll  throw  them out because your house will be littered
with them. - Robert Lucky
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 09/10] arm: Move bootstage record for board_init_f() to after arch_cpu_init()

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351813330-23741-9-git-send-email-...@chromium.org you wrote:
 The timer may be inited in arch_cpu_init() so it is not safe to make a
 bootstage mark before this is called. Arrange the code to fix this.
 
 We now get a correct time for board_init_f:
 
 Timer summary in microseconds:
MarkElapsed  Stage
   0  0  reset
 100,000100,000  spl_start
 848,530748,530  board_init_f
 907,301 58,771  board_init_r
 910,478  3,177  board_init
 
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  arch/arm/lib/board.c |   11 +--
  1 files changed, 9 insertions(+), 2 deletions(-)

NAK as is.  Please make sure to keep all arhcitectures in sync.  The
long term goal iss till to merge the lib/board.c files into a single,
common one.

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 universe contains any amount of horrible ways  to  be  woken  up,
such as the noise of the mob breaking down the front door, the scream
of fire engines, or the realization that today is the Monday which on
Friday night was a comfortably long way off.
 - Terry Pratchett, _Moving Pictures_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/7] fs: Add a Coreboot Filesystem (CBFS) driver and commands

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message CAPnjgZ2hD4ZgzM=0rppsgr0-iojtv+q40e3gyexeqxndkop...@mail.gmail.com 
you wrote:
 
   --- /dev/null
   +++ b/common/cmd_cbfs.c
   @@ -0,0 +1,214 @@
   +/*
   + * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
   + *
   + * See file CREDITS for list of people who contributed to this
   + * project.
 
  file CREDITS ?  Please fix globally...
 
 
  Is any of this code taken from any other project?  If yes, then please
  attribute properly...
 
  Sorry?  U-Boot has a CREDITS file but only ~10% of the files reference
  it.

Yes, U-Boot has such a file, and I wonder if we should remove it.
After all, all the credits are maintained in the git history of
changes.

 Tom or Wolfgang, can you please explain what I should do here? I don't
 know what to do about the CREDITS line.

To me the reference to a CREDITS file is reason to suspect that this
code has not been written from scratch, but copied from some other
project, which eventually had it's own CREDITS file.

I'm missing a reference to the origin of the code.

If this was indeed written from scratch, with no code borrowed from
elsewhere, then please just drop these lines.

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
Text processing has made it possible to right-justify any idea, even
one which cannot be justified on any other grounds.
 -- J. Finnegan, USC.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] tpm: Add Infineon slb9635_i2c TPM driver

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351874667-23959-2-git-send-email-...@chromium.org you wrote:
 From: Rong Chang rongch...@chromium.org
 
 Add a driver for the I2C TPM from Infineon.
 
 Signed-off-by: Che-Liang Chiou clch...@chromium.org
 Signed-off-by: Rong Chang rongch...@chromium.org
 Signed-off-by: Tom Wai-Hong Tam waih...@chromium.org
 Signed-off-by: Simon Glass s...@chromium.org

NAK.  I will not accept any more additions of such dead code.
We added TPM support long ago, based on the assumption/promise that
users for it would follow soon.  But nothing ever happened.

Instead of adding more such dead code, we should rather completely
remove this unused stuff - note that it does not even get
compile-tested io any mainline configuration.

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
A year spent in artificial intelligence is enough to make one believe
in God.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] tpm: Add casts for proper compilation

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351874667-23959-1-git-send-email-...@chromium.org you wrote:
 From: Taylor Hutt th...@chromium.org
 
 When building for the Sandbox version, the casts in this change are
 necessary to avoid compilation issues.
 
 Signed-off-by: Taylor Hutt th...@chromium.org
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  drivers/tpm/generic_lpc_tpm.c |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)

I see little sense in spending work on this code.  After all the time,
it is still unused and dead code in mainline - there is not a single
configuration which actually enables the necessary CONFIG_ options.,

I recommend to remove the whole TPM code instead.

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
You are an excellent tactician, Captain. You let your second in  com-
mand attack while you sit and watch for weakness.
-- Khan Noonian Singh, Space Seed, stardate 3141.9
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Loading a userland file

2012-11-03 Thread Grant
 I'm trying to get Tiny Core working on the Beaglebone.  I'm stuck on
getting the Tiny Core userland file uCore to load so init works.  I'm
using this uEnv.txt:

 bootfile=/uImage
 optargs=init=/init rootwait
 fatload mmc 0 0x4310 uCore
 mmcboot=echo Booting from mmc ...; run mmcargs; bootm 0x8020
0x4310

 I get the following data abort:

 ## Booting kernel from Legacy Image at 8020 ...
 Image Name:   Linux-3.6.0-rc7-00219-g35e0f42
 Image Type:   ARM Linux Kernel Image (uncompressed)
 Data Size:2878667 Bytes = 2.7 MiB
 Load Address: 80008000
 Entry Point:  80008000
 Verifying Checksum ... OK
 data abort
 pc : [8ff99480]  lr : [8ff996ac]
 sp : 8fe6abd0  ip : 8fe6d163 fp : 0001
 r10: 0002  r9 :  r8 : 8fe6af68
 r7 : 8ffbaebc  r6 : 4310 r5 : 8ffbaec0  r4 : 4310
 r3 :   r2 : 0010 r1 :   r0 : 4310
 Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
 Resetting CPU ...

 If I change mmcboot to:

 mmcboot=echo Booting from mmc ...; run mmcargs; bootm 0x8020

 The kernel loads, but init fails:

 EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts:
(null)
 VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
 devtmpfs: error mounting -2
 Freeing init memory: 144K
 Failed to execute /init.  Attempting defaults...
 Kernel panic - not syncing: No init found.  Try passing init= option to
kernel.

 Can anyone tell me how to load uCore so init works?

 - Grant

I've gotten farther along, but I get one of these two errors when loading
the ramdisk:

RAMDISK: Couldn't find valid RAM disk image starting at 0.

Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid

Please let me know if you have any pointers.

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


Re: [U-Boot] [RFC PATCH 00/50] net: net subsystem ops cleanup

2012-11-03 Thread Wolfgang Denk
Dear Tomas Hlavacek,

In message 1351876722-5183-1-git-send-email-tmshl...@gmail.com you wrote:
 This patchset is a first stage of preparation of the net subsystem
 for the driver model.
 
 The idea of this patchset is:
 1) Remove ops .init, .send, .recv and .halt from the eth_device struct.
Add a sparate structure eth_ops which is ready for inclusion
to DM core.
 2) Replace dynamic init of ops function pointers by static struct.
 3) Do minor style cleanup.
 
 Tomas Hlavacek (50):
   net: dm: Pull out ops from struct eth_device
   net: 4xx_enet: Pull out init of struct eth_ops
   net: altera_tse: Pull out init of struct eth_ops
   net: dm9000x: Pull out init of struct eth_ops
   net: armada100_fec: Pull out init of struct eth_ops

Hm... looking at this patch series, I wonder if it is really
bisectable?  Can I really apply any number of these patches (the first
N, with N  50) and expect the code to build and to work?

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
Put your Nose to the Grindstone!
 -- Amalgamated Plastic Surgeons and Toolmakers, Ltd.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 01/17] arm: Add new bootstage step for the main loop

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-2-git-send-email-...@chromium.org you wrote:
 Mark when we get to the main loop.
 
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  common/main.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/common/main.c b/common/main.c
 index 9507cec..ed1da24 100644
 --- a/common/main.c
 +++ b/common/main.c
 @@ -299,6 +299,8 @@ void main_loop (void)
   char bcs_set[16];
  #endif /* CONFIG_BOOTCOUNT_LIMIT */
  
 + bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, main_loop);
 +
  #ifdef CONFIG_BOOTCOUNT_LIMIT
   bootcount = bootcount_load();
   bootcount++;

In which way is this patch ARM specific?


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
Do not underestimate the value of print statements for debugging.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 16/17] console: Enable function to display console info

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-17-git-send-email-...@chromium.org you wrote:
 The CONFIG_SYS_CONSOLE_INFO_QUIET option should suppress the console
 information, but allow boards to display it later if required. Adjust
 the code to support this.
 
 This is used to avoid printing the information while the LCD display
 is not ready, since it only becomes ready when stdio init is complete.
 
 BRANCH=snow

Please get such comments out of the commit messages.

 Signed-off-by: Simon Glass s...@chromium.org
 ---
  common/console.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)

This is broken.  You miss the fact that stdio_print_current_devices()
gets called in a number of other places as well (you should have
asked yourself why it isn't a static function).  See at least
board/mpl/mip405/mip405.c

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
In matrimony, to hesitate is sometimes to be saved.- Butler
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 09/17] Add sha256 command for hashing

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-10-git-send-email-...@chromium.org you wrote:
 From: ARUN MANKUZHI aru...@samsung.com
 
 sha256 command is added which can be used to test SHA 256 hash
 algorithm.
 
 Signed-off-by: ARUN MANKUZHI aru...@samsung.com
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  README   |1 +
  common/Makefile  |1 +
  common/cmd_sha256.c  |   57 
 ++
  include/config_cmd_all.h |1 +
  4 files changed, 60 insertions(+), 0 deletions(-)
  create mode 100644 common/cmd_sha256.c

Please make sure interface and functionality is similar to what we do
elsewhere, i. e. with the crc32 command.

 +U_BOOT_CMD(
 + sha256, 4, 1, do_sha256,
 + print hash result,
 + input inputlength output
 +);

What is input or output supposed to mean?  I don;t understand
this.  

output should not be mandatory. I would appreciate if we
could use similar help text as with the crc32 command:

crc32 - checksum calculation

Usage:
crc32 address count [addr]
- compute CRC32 checksum [save at addr]


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
Love is an ideal thing, marriage a real thing; a  confusion  of  the
real with the ideal never goes unpunished.  - Goethe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/17] Add gettime command

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-3-git-send-email-...@chromium.org you wrote:
 From: Anton Staaf robot...@chromium.org
 
 Gettime returns the current timer value.  If CONFIG_SYS_HZ is defined
 then the timer value is also converted to seconds.
 
 Tegra20 (SeaBoard) # gettime
 Timer val: 7754
 Seconds : 7
 Remainder : 754
 sys_hz = 1000

What exactly is this good for?

Also, are there any boards where CONFIG_SYS_HZ is NOT set?  [Which are
these?]

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
Earth -- mother of the most beautiful women in the universe.
-- Apollo, Who Mourns for Adonais? stardate 3468.1
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 15/17] Add console command to access io space registers

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-16-git-send-email-...@chromium.org you wrote:
 From: Vadim Bendebury vben...@chromium.org
 
 Provide u-boot console functions to access IO space registers. A no
 thrills implementation, accessing one register at a time.
 
 For example:
 boot  iod 80
 0080: 0094
 boot  iod.w 80
 0080: 0094
 boot  iod.b 80
 0080: 94
 boot  iow.b 0x80 12
 boot  iod 0x80
 0080: 0012

What are the exact use cases where this is necessary, i. e. where
plain md / mw does not work?

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
Quantum particles: The dreams that stuff is made of.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 06/17] env: Add the ability to merge the saved env with the default.

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-7-git-send-email-...@chromium.org you wrote:
 From: Doug Anderson diand...@chromium.org
 
 This is a useful mechanism any time you have a way to update the
 saved environment outside of u-boot.  This can be a tool like
 fw_setenv.

I don't see the need for this.

What exactly does it that env reset followed by env import does not
do?

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
Don't put off for tomorrow what you can  do  today,  because  if  you
enjoy it today you can do it again tomorrow.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 17/17] tpm: Add TPM stress test

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-18-git-send-email-...@chromium.org you wrote:
 From: Luigi Semenzato semenz...@chromium.org
 
 Add a simple command to stress-test a TPM (Trusted Platform Module).
 
 Signed-off-by: Luigi Semenzato semenz...@chromium.org
 
 Commit-Ready: Stefan Reinauer reina...@google.com
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  common/cmd_tpm.c |   93 ++---
  1 files changed, 87 insertions(+), 6 deletions(-)

See previous comments about TPM code.  Please let's dump all this
unused stuff.

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
You'll pay to know what you really think.- J.R. Bob Dobbs
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 05/17] stdio: remove useless strncpy

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-6-git-send-email-...@chromium.org you wrote:
 From: Vincent Palatin vpala...@chromium.org
 
 The name is already copied when we memopy the whole structure.

memopy?

 --- a/common/stdio.c
 +++ b/common/stdio.c
 @@ -135,7 +135,6 @@ struct stdio_dev* stdio_clone(struct stdio_dev *dev)
   return NULL;
  
   memcpy(_dev, dev, sizeof(struct stdio_dev));
 - strncpy(_dev-name, dev-name, 16);

_dev contains just the pointer, not the data, so why can we omit
copying the data?

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
It is better for civilization to be going down the drain than to  be
coming up it.  - Henry Allen
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 14/17] console: Call overwrite_console before searching for console devices

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351902453-27956-15-git-send-email-...@chromium.org you wrote:
 From: Anton Staaf robot...@chromium.org
 
 Move the overwrite_console function call to before the search for
 the console devices.  This lets the board specific function
 replace the environment variables and have that picked up by the
 console code.

Can you please explain what replace the environment variables means,
and how this is related to the console code?

Or what exactly this patch is needed for?

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
Mike's Law: For a lumber company employing two men and a cut-off saw,
the marginal product of labor for any number  of  additional  workers
equals  zero  until the acquisition of another cut-off saw. Let's not
even consider a chainsaw.
- Mike Dennison [You could always  schedule the saw, though - ed.]
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Merging device trees at runtime for module-based systems

2012-11-03 Thread David Gibson
On Thu, Nov 01, 2012 at 10:24:06AM +0100, Daniel Mack wrote:
 On 01.11.2012 04:26, David Gibson wrote:
  On Fri, Oct 26, 2012 at 09:24:11AM +0200, Daniel Mack wrote:
 
  I would especially like to know where such a new functionality should
  live, which data types it should operate on and what would be an
  appropriate name for it.
  
  So.. the first thought I have reading the original mail in the thread
  is that it's arguable that you really want a more heavyweight firmware
  for this setup, that actively maintains a live device tree as OF does,
  rather than u-boot which is pretty oriented towards a close-to-static
  device setup.  That's just a thought though, I'm not saying that at
  least some of this functionality doesn't belong in libfdt.
  
  So, my thought would be that stuff for manipulating big chunks of tree
  should go in a new .c file inside the libfdt tree.  We already have
  del_node and nop_node of course, which can remove whole subtrees.  I
  guess the big extra function you'd want would be something like:
  
  fdt_graft(void *fdt, int offset, void *subtree);
  
  Which would graft the tree blob give by subtree into the master tree
  (fdt) at node 'offset'.  Actually that might need to take a name for
  the top-level of the subtree to take in the new tree too.
 
 I called the function fdt_overlay, but I guess the implementation is
 similar to what you thought of. I pushed it here, see the topmost 3 commits:
 
   https://github.com/zonque/dtc/commits/overlay

Interesting.  So, it seems to me that fdt_graft() and fdt_overlay()
are different operations - both could be potentially useful.
fdt_graft() would attach a new subtree somewhere within the master
tree, with the assumption that the root of the subtree would become a
new node in the resulting tree.  Overwriting an existing subtree with
a new one would be an error for a graft.  fdt_overlay, as you've
implemented, can either add new nodes or modify existing ones by
replacing or adding new properties.

So, some notes on the actual implementation:

The in-place modification of the given path (which should really be
const char *) in your fdt_add_subnode_r() is nasty, nasty, nasty.  And
it's unnecessary because you can use the existing
fdt_add_subnode_namelen() to work with subsections of the path without
needing to either have a temporary buffer or do in-place modification.

...except, I don't think you actually need fdt_add_subnoode_r() for
your overlay implementation in any case.

AFAICT in your fdt_overlay() implementation you're only adding nodes
from the second tree if they contain properties (the
fdt_add_subnode_r() call is under the FDT_PROP case).  I'm not sure if
that was a deliberate policy decision - if so I really can't see a
reason for it.

If instead you *always* add subnodes when they exist in the second
tree, you'll be doing your add nodes from the FDT_BEGIN_NODE tag
case.  And you always get BEGIN_NODE tags for parents before subnodes,
so you can naturally add your new subnode path component by component
without having to walk down the path again in fdt_add_subnode_r().  As
an added bonus you no longer need pathbuf and it's arbitrary size
limit.

Hrm.. wait... I guess you need a stack so you can handle FDT_END_NODE
correctly.  I suspect a recursive solution (effectively using the
machine stack) would still take less (machine) stack space than
pathbuf.  Especially if pathbuf was increased up to PATH_MAX, which is
my usual rule of thumb when I can't avoid an arbitrary buffer size. 


On a tangent, note that fdt_graft() as defined above, unlike
fdt_overlay() would allow a considerably optimized implementation.
Instead of doing lots of individual inserts into the tree (and
therefore a lot of memmove()s), you could do one big _fdt_splice(),
copy in the grafted tree's structure block, then run through it
correcting property name offsets.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Merging device trees at runtime for module-based systems

2012-11-03 Thread Daniel Mack
On 03.11.2012 16:25, David Gibson wrote:
 On Thu, Nov 01, 2012 at 10:24:06AM +0100, Daniel Mack wrote:
 On 01.11.2012 04:26, David Gibson wrote:
 On Fri, Oct 26, 2012 at 09:24:11AM +0200, Daniel Mack wrote:

 I would especially like to know where such a new functionality should
 live, which data types it should operate on and what would be an
 appropriate name for it.

 So.. the first thought I have reading the original mail in the thread
 is that it's arguable that you really want a more heavyweight firmware
 for this setup, that actively maintains a live device tree as OF does,
 rather than u-boot which is pretty oriented towards a close-to-static
 device setup.  That's just a thought though, I'm not saying that at
 least some of this functionality doesn't belong in libfdt.

 So, my thought would be that stuff for manipulating big chunks of tree
 should go in a new .c file inside the libfdt tree.  We already have
 del_node and nop_node of course, which can remove whole subtrees.  I
 guess the big extra function you'd want would be something like:

 fdt_graft(void *fdt, int offset, void *subtree);

 Which would graft the tree blob give by subtree into the master tree
 (fdt) at node 'offset'.  Actually that might need to take a name for
 the top-level of the subtree to take in the new tree too.

 I called the function fdt_overlay, but I guess the implementation is
 similar to what you thought of. I pushed it here, see the topmost 3 commits:

   https://github.com/zonque/dtc/commits/overlay
 
 Interesting.  So, it seems to me that fdt_graft() and fdt_overlay()
 are different operations - both could be potentially useful.
 fdt_graft() would attach a new subtree somewhere within the master
 tree, with the assumption that the root of the subtree would become a
 new node in the resulting tree.  Overwriting an existing subtree with
 a new one would be an error for a graft.  fdt_overlay, as you've
 implemented, can either add new nodes or modify existing ones by
 replacing or adding new properties.
 
 So, some notes on the actual implementation:
 
 The in-place modification of the given path (which should really be
 const char *) in your fdt_add_subnode_r() is nasty, nasty, nasty.  And
 it's unnecessary because you can use the existing
 fdt_add_subnode_namelen() to work with subsections of the path without
 needing to either have a temporary buffer or do in-place modification.

Ok - thanks for the hint. I was looking for a nicer way as I also was
really unhappy about the implementation, but without access to heap
operations and avoid eating up too much stack, I thought this is a nasty
but working solution.

After all, that whole hacking was just meant as a proof of concept for
the result, which failed ;)

 ...except, I don't think you actually need fdt_add_subnoode_r() for
 your overlay implementation in any case.
 
 AFAICT in your fdt_overlay() implementation you're only adding nodes
 from the second tree if they contain properties (the
 fdt_add_subnode_r() call is under the FDT_PROP case).  I'm not sure if
 that was a deliberate policy decision - if so I really can't see a
 reason for it.

That was merely to spare some cycles, as fdt_add_subnode_r() turned out
not to be free of costs.

 If instead you *always* add subnodes when they exist in the second
 tree, you'll be doing your add nodes from the FDT_BEGIN_NODE tag
 case.  And you always get BEGIN_NODE tags for parents before subnodes,
 so you can naturally add your new subnode path component by component
 without having to walk down the path again in fdt_add_subnode_r().  As
 an added bonus you no longer need pathbuf and it's arbitrary size
 limit.

Yes, I had something like that in mind, but that requires keeping the
state of both trees around and care for the stacking etc.

 Hrm.. wait... I guess you need a stack so you can handle FDT_END_NODE
 correctly.  I suspect a recursive solution (effectively using the
 machine stack) would still take less (machine) stack space than
 pathbuf.  Especially if pathbuf was increased up to PATH_MAX, which is
 my usual rule of thumb when I can't avoid an arbitrary buffer size.   
 
 
 On a tangent, note that fdt_graft() as defined above, unlike
 fdt_overlay() would allow a considerably optimized implementation.
 Instead of doing lots of individual inserts into the tree (and
 therefore a lot of memmove()s), you could do one big _fdt_splice(),
 copy in the grafted tree's structure block, then run through it
 correcting property name offsets.

Given the fact that this implementation turns out to be inappropriate as
solution to my actual problem, I'm uncertain whether it should be merged
at all. Dunno of how much use that would be for others after all.


Many thanks for you input,
Daniel


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


Re: [U-Boot] [RFC PATCH v3 0/13] Port of MUSB driver from Linux (changes from Linux)

2012-11-03 Thread Ilya Yanok
Hi Tom,

On Tue, Oct 23, 2012 at 1:45 AM, Tom Rini tr...@ti.com wrote:

 In general, things look OK but please run it through checkpatch.pl, use
 just one Signed-off-by line and fixup if (...) { ... one line ... } in
 the glue code you add that's not synced up from the kernel (I saw one in
 the am335x bits).  Thanks!  And lets move this out of RFC...


Hm.. checkpatch produces tons of messages (mostly over 80 character lines)
but I can't see anything about if ( ... ) { one-line } in the code I've
added by hand... I've fixed some other minor style problems in the code
that was not taken from the kernel directly.

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


[U-Boot] [PATCH v4 0/13] Port of MUSB driver from Linux (changes from Linux)

2012-11-03 Thread Ilya Yanok
Current MUSB driver in U-Boot uses old UDC API while new gagdet
client drivers need new gadget API. Also current MUSB driver has
some significant limitations (like inability to handle tx for
endpoints other than ep0). So I think port of new Linux driver is
desirable.

This is initial port, performed mostly by putting DM and OTG
code under #ifndef __UBOOT__ clauses. My intention was to be as
close as possible to the original to ease of possible resyncs.
Some warnings are suppressed via CFLAGS. There are some style
problems but I'm not touching them for now for the above mentioned
reason. There is obviously some room for optimisation, some
structure fields are unused as well as (probably) some code.

This is not a replacement for existing MUSB driver (at least for
now), cause there are still consumers of USB serial gadget which
uses old API and there is no support for serial with new API
for now.

OTG and DMA are not supported. Ported drivers include:
musb_dsps (should work both with TI AM33xx and TI81xx, tested only on
AM33xx), am35x (tested on AM3517 EVM) and omap2plus (should work on
OMAP2/3/4, tested on omap3_beagle, omap4_panda doesn't work and needs
more work). Others should be easy to port too.

Virtual root hub is not implemented but this shouldn't be
a big problem as the old code has virtual root hub support
enabled only for Blackfin platform.

Pathes are rather big because of the original code size (and I didn't
delete unused code, just disabled it). So it's probably better to
look at changes as compared to Linux code. I prepared such version
also, you can find it at [1]. Hopefully it will be also useful
if resync with the kernel will be needed in future.

[1] https://github.com/yanok/u-boot/tree/musb-changes-from-linux-v4


Changes in v4:
 - fix indent
 - minor style fixes

Changes in v3:
 - fix old MUSB code compilation
 - bugfix: struct musb should be zeroed after alloc
 - fix musb gadget_chips entry
 - fix for new multi-interface usb API
 - use clrsetbits_le32 for USB PHY ops

Changes in v2:
 - add missing linux-compat.h header
 - added host support
 - glue code moved from musb_gadget_uboot.c to musb_uboot.c and
   cleaned up slightly.
 - added check for malloc return value
 - define is_{host,peripheral}_capable conditionally to support
   compilation with only host or gadget enabled
 - added some more is_{host,peripheral}_capable guards to core
   code to support compilation with only host or gadget enabled
 - rename backend config option to CONFIG_USB_MUSB_DSPS
 - we are providing host support now so add yourself to usb.h

Ilya Yanok (13):
  linux/usb/ch9.h: update with the version from Linux tree
  usb: use linux/usb/ch9.h instead of usbdescriptors.h
  musb-new: port of Linux musb driver
  musb-new: dsps backend driver
  am33xx: init OTG hardware and new musb gadget driver
  am335x_evm: enable both musb gadget and host
  musb-new: am35x backend driver
  OMAP3: am35x_def.h: add USB defines
  OMAP3: am35x: add musb functions
  am3517_evm: switch to musb-new
  musb-new: omap2plus backend driver
  omap3_beagle: add musb-new init
  omap3_beagle: use new MUSB intstead of the old one

 Makefile  |1 +
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c   |2 +-
 arch/arm/cpu/armv7/am33xx/board.c |  103 +-
 arch/arm/cpu/armv7/am33xx/clock.c |8 +
 arch/arm/cpu/armv7/omap3/Makefile |1 +
 arch/arm/cpu/armv7/omap3/am35x_musb.c |   75 +
 arch/arm/include/asm/arch-am33xx/cpu.h|   11 +-
 arch/arm/include/asm/arch-am33xx/hardware.h   |4 +
 arch/arm/include/asm/arch-omap3/am35x_def.h   |   27 +
 arch/arm/include/asm/arch-omap3/musb.h|   28 +
 arch/arm/include/asm/omap_musb.h  |   32 +
 arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |2 +-
 arch/powerpc/cpu/mpc5xxx/usb_ohci.c   |2 +-
 arch/powerpc/cpu/ppc4xx/usb_ohci.c|2 +-
 board/logicpd/am3517evm/am3517evm.c   |   74 +
 board/ti/beagle/beagle.c  |   43 +
 common/cmd_usb.c  |2 +-
 common/usb.c  |4 +-
 drivers/usb/gadget/config.c   |1 -
 drivers/usb/gadget/epautoconf.c   |1 -
 drivers/usb/gadget/ether.c|1 -
 drivers/usb/gadget/gadget_chips.h |4 +-
 drivers/usb/gadget/s3c_udc_otg.c  |1 -
 drivers/usb/gadget/usbstring.c|1 -
 drivers/usb/host/ehci-hcd.c   |   16 +-
 drivers/usb/host/isp116x-hcd.c|2 +-
 drivers/usb/host/ohci-hcd.c   |2 +-
 drivers/usb/host/sl811-hcd.c  |2 +-
 drivers/usb/musb-new/Makefile |   39 +
 drivers/usb/musb-new/am35x.c  |  709 +++
 drivers/usb/musb-new/linux-compat.h   |  119 ++
 drivers/usb/musb-new/musb_core.c  | 2497 +
 

[U-Boot] [PATCH v4 01/13] linux/usb/ch9.h: update with the version from Linux tree

2012-11-03 Thread Ilya Yanok
Signed-off-by: Ilya Yanok ya...@cogentembedded.com
Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 drivers/usb/gadget/config.c  |1 -
 drivers/usb/gadget/epautoconf.c  |1 -
 drivers/usb/gadget/ether.c   |1 -
 drivers/usb/gadget/s3c_udc_otg.c |1 -
 drivers/usb/gadget/usbstring.c   |1 -
 include/linux/usb/ch9.h  |  514 --
 include/usb/s3c_udc.h|1 -
 7 files changed, 499 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c
index f88d0c1..f9163a8 100644
--- a/drivers/usb/gadget/config.c
+++ b/drivers/usb/gadget/config.c
@@ -27,7 +27,6 @@
 #include linux/string.h
 
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/gadget.h
 
 
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index b656c8b..5b8776e 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -23,7 +23,6 @@
 
 #include common.h
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include asm/errno.h
 #include linux/usb/gadget.h
 #include asm/unaligned.h
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 1e187e5..c51e69c 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -24,7 +24,6 @@
 #include asm/errno.h
 #include linux/netdevice.h
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/cdc.h
 #include linux/usb/gadget.h
 #include net.h
diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index 3fdfdf7..f9d24e3 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -37,7 +37,6 @@
 #include malloc.h
 
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/gadget.h
 
 #include asm/byteorder.h
diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
index 4dbe060..9cf 100644
--- a/drivers/usb/gadget/usbstring.c
+++ b/drivers/usb/gadget/usbstring.c
@@ -13,7 +13,6 @@
 #include common.h
 #include asm/errno.h
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/gadget.h
 
 #include asm/unaligned.h
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index ce1d1e1..d1d732c 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -28,15 +28,13 @@
  * [c] for consistency, removing all doubt even when it appears to
  * someone that the two other points are non-issues for that
  * particular descriptor type.
- *
- * Ported to U-boot by: Thomas Smits ts.sm...@gmail.com and
- *  Remy Bohmer li...@bohmer.net
  */
 
 #ifndef __LINUX_USB_CH9_H
 #define __LINUX_USB_CH9_H
 
 #include linux/types.h   /* __u8 etc */
+#include asm/byteorder.h /* le16_to_cpu */
 
 /*-*/
 
@@ -70,7 +68,7 @@
 #define USB_RECIP_OTHER0x03
 /* From Wireless USB 1.0 */
 #define USB_RECIP_PORT 0x04
-#define USB_RECIP_RPIPE0x05
+#define USB_RECIP_RPIPE0x05
 
 /*
  * Standard requests, for the bRequest field of a SETUP packet.
@@ -90,6 +88,8 @@
 #define USB_REQ_GET_INTERFACE  0x0A
 #define USB_REQ_SET_INTERFACE  0x0B
 #define USB_REQ_SYNCH_FRAME0x0C
+#define USB_REQ_SET_SEL0x30
+#define USB_REQ_SET_ISOCH_DELAY0x31
 
 #define USB_REQ_SET_ENCRYPTION 0x0D/* Wireless USB */
 #define USB_REQ_GET_ENCRYPTION 0x0E
@@ -105,10 +105,16 @@
 #define USB_REQ_LOOPBACK_DATA_READ 0x16
 #define USB_REQ_SET_INTERFACE_DS   0x17
 
+/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
+ * used by hubs to put ports into a new L1 suspend state, except that it
+ * forgot to define its number ...
+ */
+
 /*
  * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
  * are read as a bit array returned by USB_REQ_GET_STATUS.  (So there
- * are at most sixteen features of each type.)
+ * are at most sixteen features of each type.)  Hubs may also support a
+ * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
  */
 #define USB_DEVICE_SELF_POWERED0   /* (read only) */
 #define USB_DEVICE_REMOTE_WAKEUP   1   /* dev may initiate wakeup */
@@ -120,8 +126,38 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT   5   /* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE  6   /* (special devices only) */
 
+/*
+ * Test Mode Selectors
+ * See USB 2.0 spec Table 9-7
+ */
+#defineTEST_J  1
+#defineTEST_K  2
+#defineTEST_SE0_NAK3
+#defineTEST_PACKET 4
+#defineTEST_FORCE_EN   5
+
+/*
+ * New Feature Selectors as added by USB 3.0
+ * See USB 3.0 spec Table 9-6
+ */
+#define USB_DEVICE_U1_ENABLE   48  /* dev may initiate U1 transition */
+#define 

[U-Boot] [PATCH v4 02/13] usb: use linux/usb/ch9.h instead of usbdescriptors.h

2012-11-03 Thread Ilya Yanok
Linux usb/ch9.h seems to have all the same information (and more)
as usbdescriptors.h so use the former instead of the later one.

As a consequense of this change USB_SPEED_* values don't correspond
directly to EHCI speed encoding anymore, I've added necessary
recoding in EHCI driver. Also there is no point to put speed into
pipe anymore so it's removed and a bunch of host drivers fixed to
look at usb_device-speed instead.

Old usbdescriptors.h included is not removed as it seems to be
used by old USB device code.

This makes usb.h and usbdevice.h incompatible. Fortunately the
only place that tries to include both are the old MUSB code and
it needs usb.h only for USB_DMA_MINALIGN used in aligned attribute
on musb_regs structure but this attribute seems to be unneeded
(old MUSB code doesn't support any DMA at all).

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com

---
Changes in v4:
 - fix indent

Changes in v3:
 - fix old MUSB code compilation

 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c   |2 +-
 arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |2 +-
 arch/powerpc/cpu/mpc5xxx/usb_ohci.c   |2 +-
 arch/powerpc/cpu/ppc4xx/usb_ohci.c|2 +-
 common/cmd_usb.c  |2 +-
 common/usb.c  |4 ++--
 drivers/usb/host/ehci-hcd.c   |   16 ++--
 drivers/usb/host/isp116x-hcd.c|2 +-
 drivers/usb/host/ohci-hcd.c   |2 +-
 drivers/usb/host/sl811-hcd.c  |2 +-
 drivers/usb/musb/musb_core.h  |3 +--
 drivers/usb/musb/musb_hcd.c   |5 +++--
 include/usb.h |   15 +++
 include/usb_defs.h|6 --
 14 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c 
b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
index 944bb32..3bca66a 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
@@ -620,7 +620,7 @@ static struct ed *ep_add_ed(struct usb_device *usb_dev, 
unsigned long pipe)
  | (usb_pipeisoc(pipe) ? 0x8000 : 0)
  | (usb_pipecontrol(pipe) ? 0 :
 (usb_pipeout(pipe) ? 0x800 : 0x1000))
- | usb_pipeslow(pipe)  13 |
+ | (usb_dev-speed == USB_SPEED_LOW)  13 |
  usb_maxpacket(usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c 
b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
index c747767..b9b0998 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
@@ -615,7 +615,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, 
unsigned long pipe)
| usb_pipeendpoint (pipe)  7
| (usb_pipeisoc (pipe)? 0x8000: 0)
| (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 
0x800: 0x1000))
-   | usb_pipeslow (pipe)  13
+   | (usb_dev-speed == USB_SPEED_LOW)  13
| usb_maxpacket (usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c 
b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
index 607034b..de07343 100644
--- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
+++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
@@ -618,7 +618,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, 
unsigned long pipe)
| usb_pipeendpoint (pipe)  7
| (usb_pipeisoc (pipe)? 0x8000: 0)
| (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 
0x800: 0x1000))
-   | usb_pipeslow (pipe)  13
+   | (usb_dev-speed == USB_SPEED_LOW)  13
| usb_maxpacket (usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/arch/powerpc/cpu/ppc4xx/usb_ohci.c 
b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
index 4ce2726..f820c37 100644
--- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c
+++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
@@ -621,7 +621,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, 
unsigned long pipe)
| usb_pipeendpoint (pipe)  7
| (usb_pipeisoc (pipe)? 0x8000: 0)
| (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 
0x800: 0x1000))
-   | usb_pipeslow (pipe)  13
+   | (usb_dev-speed == USB_SPEED_LOW)  13
| usb_maxpacket (usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index c128455..8be9952 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -192,7 +192,7 @@ void usb_display_desc(struct usb_device *dev)
 
 }
 
-void usb_display_conf_desc(struct usb_configuration_descriptor *config,

[U-Boot] [PATCH v4 04/13] musb-new: dsps backend driver

2012-11-03 Thread Ilya Yanok
Backend driver for MUSB OTG controllers found on TI AM33xx and
TI81xx SoCs (tested with AM33xx only).

Signed-off-by: Ilya Yanok ya...@cogentembedded.com

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---
Changes in v2:
 - rename backend config option to CONFIG_USB_MUSB_DSPS
 - we are providing host support now so add yourself to usb.h

 arch/arm/include/asm/omap_musb.h |   25 ++
 drivers/usb/musb-new/Makefile|1 +
 drivers/usb/musb-new/musb_dsps.c |  771 ++
 include/usb.h|3 +-
 4 files changed, 799 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/omap_musb.h
 create mode 100644 drivers/usb/musb-new/musb_dsps.c

diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h
new file mode 100644
index 000..0081a68
--- /dev/null
+++ b/arch/arm/include/asm/omap_musb.h
@@ -0,0 +1,25 @@
+/*
+ * Board data structure for musb gadget on OMAPs
+ *
+ * Copyright (C) 2012, Ilya Yanok ilya.ya...@gmail.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.
+ */
+
+#ifndef __ASM_ARM_OMAP_MUSB_H
+#define __ASM_ARM_OMAP_MUSB_H
+
+extern struct musb_platform_ops musb_dsps_ops;
+
+struct omap_musb_board_data {
+   void (*set_phy_power)(u8 on);
+};
+#endif /* __ASM_ARM_OMAP_MUSB_H */
diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile
index f01fb16..a753423 100644
--- a/drivers/usb/musb-new/Makefile
+++ b/drivers/usb/musb-new/Makefile
@@ -9,6 +9,7 @@ LIB := $(obj)libusb_musb-new.o
 COBJS-$(CONFIG_MUSB_GADGET) += musb_gadget.o musb_gadget_ep0.o musb_core.o
 COBJS-$(CONFIG_MUSB_GADGET) += musb_uboot.o
 COBJS-$(CONFIG_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o
+COBJS-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o
 
 CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \
$(call cc-option,-Wno-unused-but-set-variable) \
diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c
new file mode 100644
index 000..9a03917
--- /dev/null
+++ b/drivers/usb/musb-new/musb_dsps.c
@@ -0,0 +1,771 @@
+/*
+ * Texas Instruments DSPS platforms glue layer
+ *
+ * Copyright (C) 2012, by Texas Instruments
+ *
+ * Based on the am35x glue layer code.
+ *
+ * This file is part of the Inventra Controller Driver for Linux.
+ *
+ * The Inventra Controller Driver for Linux is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU
+ * General Public License version 2 as published by the Free Software
+ * Foundation.
+ *
+ * The Inventra Controller Driver for Linux 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 The Inventra Controller Driver for Linux ; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA  02111-1307  USA
+ *
+ * musb_dsps.c will be a common file for all the TI DSPS platforms
+ * such as dm64x, dm36x, dm35x, da8x, am35x and ti81x.
+ * For now only ti81x is using this and in future davinci.c, am35x.c
+ * da8xx.c would be merged to this file after testing.
+ */
+
+#define __UBOOT__
+#ifndef __UBOOT__
+#include linux/init.h
+#include linux/io.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/dma-mapping.h
+#include linux/pm_runtime.h
+#include linux/module.h
+
+#include linux/of.h
+#include linux/of_device.h
+#include linux/of_address.h
+
+#include plat/usb.h
+#else
+#include common.h
+#include asm/omap_musb.h
+#include linux-compat.h
+#endif
+
+#include musb_core.h
+
+/**
+ * avoid using musb_readx()/musb_writex() as glue layer should not be
+ * dependent on musb core layer symbols.
+ */
+static inline u8 dsps_readb(const void __iomem *addr, unsigned offset)
+   { return __raw_readb(addr + offset); }
+
+static inline u32 dsps_readl(const void __iomem *addr, unsigned offset)
+   { return __raw_readl(addr + offset); }
+
+static inline void dsps_writeb(void __iomem *addr, unsigned offset, u8 data)
+   { __raw_writeb(data, addr + offset); }
+
+static inline void dsps_writel(void __iomem *addr, unsigned offset, u32 data)
+   { __raw_writel(data, addr + offset); }
+
+/**
+ * DSPS musb wrapper register offset.
+ * FIXME: This should be expanded to have all the wrapper registers from TI 
DSPS
+ * musb 

[U-Boot] [PATCH v4 02/13] usb: use linux/usb/ch9.h instead of usbdescriptors.h

2012-11-03 Thread Ilya Yanok
Linux usb/ch9.h seems to have all the same information (and more)
as usbdescriptors.h so use the former instead of the later one.

As a consequense of this change USB_SPEED_* values don't correspond
directly to EHCI speed encoding anymore, I've added necessary
recoding in EHCI driver. Also there is no point to put speed into
pipe anymore so it's removed and a bunch of host drivers fixed to
look at usb_device-speed instead.

Old usbdescriptors.h included is not removed as it seems to be
used by old USB device code.

This makes usb.h and usbdevice.h incompatible. Fortunately the
only place that tries to include both are the old MUSB code and
it needs usb.h only for USB_DMA_MINALIGN used in aligned attribute
on musb_regs structure but this attribute seems to be unneeded
(old MUSB code doesn't support any DMA at all).

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com

---
Changes in v4:
 - fix indent

Changes in v3:
 - fix old MUSB code compilation

 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c   |2 +-
 arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |2 +-
 arch/powerpc/cpu/mpc5xxx/usb_ohci.c   |2 +-
 arch/powerpc/cpu/ppc4xx/usb_ohci.c|2 +-
 common/cmd_usb.c  |2 +-
 common/usb.c  |4 ++--
 drivers/usb/host/ehci-hcd.c   |   16 ++--
 drivers/usb/host/isp116x-hcd.c|2 +-
 drivers/usb/host/ohci-hcd.c   |2 +-
 drivers/usb/host/sl811-hcd.c  |2 +-
 drivers/usb/musb/musb_core.h  |3 +--
 drivers/usb/musb/musb_hcd.c   |5 +++--
 include/usb.h |   15 +++
 include/usb_defs.h|6 --
 14 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c 
b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
index 944bb32..3bca66a 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
@@ -620,7 +620,7 @@ static struct ed *ep_add_ed(struct usb_device *usb_dev, 
unsigned long pipe)
  | (usb_pipeisoc(pipe) ? 0x8000 : 0)
  | (usb_pipecontrol(pipe) ? 0 :
 (usb_pipeout(pipe) ? 0x800 : 0x1000))
- | usb_pipeslow(pipe)  13 |
+ | (usb_dev-speed == USB_SPEED_LOW)  13 |
  usb_maxpacket(usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c 
b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
index c747767..b9b0998 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
@@ -615,7 +615,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, 
unsigned long pipe)
| usb_pipeendpoint (pipe)  7
| (usb_pipeisoc (pipe)? 0x8000: 0)
| (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 
0x800: 0x1000))
-   | usb_pipeslow (pipe)  13
+   | (usb_dev-speed == USB_SPEED_LOW)  13
| usb_maxpacket (usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c 
b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
index 607034b..de07343 100644
--- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
+++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
@@ -618,7 +618,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, 
unsigned long pipe)
| usb_pipeendpoint (pipe)  7
| (usb_pipeisoc (pipe)? 0x8000: 0)
| (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 
0x800: 0x1000))
-   | usb_pipeslow (pipe)  13
+   | (usb_dev-speed == USB_SPEED_LOW)  13
| usb_maxpacket (usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/arch/powerpc/cpu/ppc4xx/usb_ohci.c 
b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
index 4ce2726..f820c37 100644
--- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c
+++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
@@ -621,7 +621,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, 
unsigned long pipe)
| usb_pipeendpoint (pipe)  7
| (usb_pipeisoc (pipe)? 0x8000: 0)
| (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 
0x800: 0x1000))
-   | usb_pipeslow (pipe)  13
+   | (usb_dev-speed == USB_SPEED_LOW)  13
| usb_maxpacket (usb_dev, pipe)  16);
 
return ed_ret;
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index c128455..8be9952 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -192,7 +192,7 @@ void usb_display_desc(struct usb_device *dev)
 
 }
 
-void usb_display_conf_desc(struct usb_configuration_descriptor *config,

[U-Boot] [PATCH v4 0/13] Port of MUSB driver from Linux (changes from Linux)

2012-11-03 Thread Ilya Yanok
My apologies for double posting -- I was so stupid to forget to
fix the Signed-off-by lines

Current MUSB driver in U-Boot uses old UDC API while new gagdet
client drivers need new gadget API. Also current MUSB driver has
some significant limitations (like inability to handle tx for
endpoints other than ep0). So I think port of new Linux driver is
desirable.

This is initial port, performed mostly by putting DM and OTG
code under #ifndef __UBOOT__ clauses. My intention was to be as
close as possible to the original to ease of possible resyncs.
Some warnings are suppressed via CFLAGS. There are some style
problems but I'm not touching them for now for the above mentioned
reason. There is obviously some room for optimisation, some
structure fields are unused as well as (probably) some code.

This is not a replacement for existing MUSB driver (at least for
now), cause there are still consumers of USB serial gadget which
uses old API and there is no support for serial with new API
for now.

OTG and DMA are not supported. Ported drivers include:
musb_dsps (should work both with TI AM33xx and TI81xx, tested only on
AM33xx), am35x (tested on AM3517 EVM) and omap2plus (should work on
OMAP2/3/4, tested on omap3_beagle, omap4_panda doesn't work and needs
more work). Others should be easy to port too.

Virtual root hub is not implemented but this shouldn't be
a big problem as the old code has virtual root hub support
enabled only for Blackfin platform.

Pathes are rather big because of the original code size (and I didn't
delete unused code, just disabled it). So it's probably better to
look at changes as compared to Linux code. I prepared such version
also, you can find it at [1]. Hopefully it will be also useful
if resync with the kernel will be needed in future.

[1] https://github.com/yanok/u-boot/tree/musb-changes-from-linux-v4


Changes in v4:
 - fix indent
 - minor style fixes

Changes in v3:
 - fix old MUSB code compilation
 - bugfix: struct musb should be zeroed after alloc
 - fix musb gadget_chips entry
 - fix for new multi-interface usb API
 - use clrsetbits_le32 for USB PHY ops

Changes in v2:
 - add missing linux-compat.h header
 - added host support
 - glue code moved from musb_gadget_uboot.c to musb_uboot.c and
   cleaned up slightly.
 - added check for malloc return value
 - define is_{host,peripheral}_capable conditionally to support
   compilation with only host or gadget enabled
 - added some more is_{host,peripheral}_capable guards to core
   code to support compilation with only host or gadget enabled
 - rename backend config option to CONFIG_USB_MUSB_DSPS
 - we are providing host support now so add yourself to usb.h

Ilya Yanok (13):
  linux/usb/ch9.h: update with the version from Linux tree
  usb: use linux/usb/ch9.h instead of usbdescriptors.h
  musb-new: port of Linux musb driver
  musb-new: dsps backend driver
  am33xx: init OTG hardware and new musb gadget driver
  am335x_evm: enable both musb gadget and host
  musb-new: am35x backend driver
  OMAP3: am35x_def.h: add USB defines
  OMAP3: am35x: add musb functions
  am3517_evm: switch to musb-new
  musb-new: omap2plus backend driver
  omap3_beagle: add musb-new init
  omap3_beagle: use new MUSB intstead of the old one

 Makefile  |1 +
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c   |2 +-
 arch/arm/cpu/armv7/am33xx/board.c |  103 +-
 arch/arm/cpu/armv7/am33xx/clock.c |8 +
 arch/arm/cpu/armv7/omap3/Makefile |1 +
 arch/arm/cpu/armv7/omap3/am35x_musb.c |   75 +
 arch/arm/include/asm/arch-am33xx/cpu.h|   11 +-
 arch/arm/include/asm/arch-am33xx/hardware.h   |4 +
 arch/arm/include/asm/arch-omap3/am35x_def.h   |   27 +
 arch/arm/include/asm/arch-omap3/musb.h|   28 +
 arch/arm/include/asm/omap_musb.h  |   32 +
 arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |2 +-
 arch/powerpc/cpu/mpc5xxx/usb_ohci.c   |2 +-
 arch/powerpc/cpu/ppc4xx/usb_ohci.c|2 +-
 board/logicpd/am3517evm/am3517evm.c   |   74 +
 board/ti/beagle/beagle.c  |   43 +
 common/cmd_usb.c  |2 +-
 common/usb.c  |4 +-
 drivers/usb/gadget/config.c   |1 -
 drivers/usb/gadget/epautoconf.c   |1 -
 drivers/usb/gadget/ether.c|1 -
 drivers/usb/gadget/gadget_chips.h |4 +-
 drivers/usb/gadget/s3c_udc_otg.c  |1 -
 drivers/usb/gadget/usbstring.c|1 -
 drivers/usb/host/ehci-hcd.c   |   16 +-
 drivers/usb/host/isp116x-hcd.c|2 +-
 drivers/usb/host/ohci-hcd.c   |2 +-
 drivers/usb/host/sl811-hcd.c  |2 +-
 drivers/usb/musb-new/Makefile |   39 +
 drivers/usb/musb-new/am35x.c  |  709 +++
 drivers/usb/musb-new/linux-compat.h   |  

[U-Boot] [PATCH v4 01/13] linux/usb/ch9.h: update with the version from Linux tree

2012-11-03 Thread Ilya Yanok
Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 drivers/usb/gadget/config.c  |1 -
 drivers/usb/gadget/epautoconf.c  |1 -
 drivers/usb/gadget/ether.c   |1 -
 drivers/usb/gadget/s3c_udc_otg.c |1 -
 drivers/usb/gadget/usbstring.c   |1 -
 include/linux/usb/ch9.h  |  514 --
 include/usb/s3c_udc.h|1 -
 7 files changed, 499 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c
index f88d0c1..f9163a8 100644
--- a/drivers/usb/gadget/config.c
+++ b/drivers/usb/gadget/config.c
@@ -27,7 +27,6 @@
 #include linux/string.h
 
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/gadget.h
 
 
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index b656c8b..5b8776e 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -23,7 +23,6 @@
 
 #include common.h
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include asm/errno.h
 #include linux/usb/gadget.h
 #include asm/unaligned.h
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 1e187e5..c51e69c 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -24,7 +24,6 @@
 #include asm/errno.h
 #include linux/netdevice.h
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/cdc.h
 #include linux/usb/gadget.h
 #include net.h
diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index 3fdfdf7..f9d24e3 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -37,7 +37,6 @@
 #include malloc.h
 
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/gadget.h
 
 #include asm/byteorder.h
diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
index 4dbe060..9cf 100644
--- a/drivers/usb/gadget/usbstring.c
+++ b/drivers/usb/gadget/usbstring.c
@@ -13,7 +13,6 @@
 #include common.h
 #include asm/errno.h
 #include linux/usb/ch9.h
-#include usbdescriptors.h
 #include linux/usb/gadget.h
 
 #include asm/unaligned.h
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index ce1d1e1..d1d732c 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -28,15 +28,13 @@
  * [c] for consistency, removing all doubt even when it appears to
  * someone that the two other points are non-issues for that
  * particular descriptor type.
- *
- * Ported to U-boot by: Thomas Smits ts.sm...@gmail.com and
- *  Remy Bohmer li...@bohmer.net
  */
 
 #ifndef __LINUX_USB_CH9_H
 #define __LINUX_USB_CH9_H
 
 #include linux/types.h   /* __u8 etc */
+#include asm/byteorder.h /* le16_to_cpu */
 
 /*-*/
 
@@ -70,7 +68,7 @@
 #define USB_RECIP_OTHER0x03
 /* From Wireless USB 1.0 */
 #define USB_RECIP_PORT 0x04
-#define USB_RECIP_RPIPE0x05
+#define USB_RECIP_RPIPE0x05
 
 /*
  * Standard requests, for the bRequest field of a SETUP packet.
@@ -90,6 +88,8 @@
 #define USB_REQ_GET_INTERFACE  0x0A
 #define USB_REQ_SET_INTERFACE  0x0B
 #define USB_REQ_SYNCH_FRAME0x0C
+#define USB_REQ_SET_SEL0x30
+#define USB_REQ_SET_ISOCH_DELAY0x31
 
 #define USB_REQ_SET_ENCRYPTION 0x0D/* Wireless USB */
 #define USB_REQ_GET_ENCRYPTION 0x0E
@@ -105,10 +105,16 @@
 #define USB_REQ_LOOPBACK_DATA_READ 0x16
 #define USB_REQ_SET_INTERFACE_DS   0x17
 
+/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
+ * used by hubs to put ports into a new L1 suspend state, except that it
+ * forgot to define its number ...
+ */
+
 /*
  * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
  * are read as a bit array returned by USB_REQ_GET_STATUS.  (So there
- * are at most sixteen features of each type.)
+ * are at most sixteen features of each type.)  Hubs may also support a
+ * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
  */
 #define USB_DEVICE_SELF_POWERED0   /* (read only) */
 #define USB_DEVICE_REMOTE_WAKEUP   1   /* dev may initiate wakeup */
@@ -120,8 +126,38 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT   5   /* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE  6   /* (special devices only) */
 
+/*
+ * Test Mode Selectors
+ * See USB 2.0 spec Table 9-7
+ */
+#defineTEST_J  1
+#defineTEST_K  2
+#defineTEST_SE0_NAK3
+#defineTEST_PACKET 4
+#defineTEST_FORCE_EN   5
+
+/*
+ * New Feature Selectors as added by USB 3.0
+ * See USB 3.0 spec Table 9-6
+ */
+#define USB_DEVICE_U1_ENABLE   48  /* dev may initiate U1 transition */
+#define USB_DEVICE_U2_ENABLE   49  /* dev may initiate U2 transition */

[U-Boot] [PATCH v4 04/13] musb-new: dsps backend driver

2012-11-03 Thread Ilya Yanok
Backend driver for MUSB OTG controllers found on TI AM33xx and
TI81xx SoCs (tested with AM33xx only).

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com

---
Changes in v2:
 - rename backend config option to CONFIG_USB_MUSB_DSPS
 - we are providing host support now so add yourself to usb.h

 arch/arm/include/asm/omap_musb.h |   25 ++
 drivers/usb/musb-new/Makefile|1 +
 drivers/usb/musb-new/musb_dsps.c |  771 ++
 include/usb.h|3 +-
 4 files changed, 799 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/omap_musb.h
 create mode 100644 drivers/usb/musb-new/musb_dsps.c

diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h
new file mode 100644
index 000..0081a68
--- /dev/null
+++ b/arch/arm/include/asm/omap_musb.h
@@ -0,0 +1,25 @@
+/*
+ * Board data structure for musb gadget on OMAPs
+ *
+ * Copyright (C) 2012, Ilya Yanok ilya.ya...@gmail.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.
+ */
+
+#ifndef __ASM_ARM_OMAP_MUSB_H
+#define __ASM_ARM_OMAP_MUSB_H
+
+extern struct musb_platform_ops musb_dsps_ops;
+
+struct omap_musb_board_data {
+   void (*set_phy_power)(u8 on);
+};
+#endif /* __ASM_ARM_OMAP_MUSB_H */
diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile
index f01fb16..a753423 100644
--- a/drivers/usb/musb-new/Makefile
+++ b/drivers/usb/musb-new/Makefile
@@ -9,6 +9,7 @@ LIB := $(obj)libusb_musb-new.o
 COBJS-$(CONFIG_MUSB_GADGET) += musb_gadget.o musb_gadget_ep0.o musb_core.o
 COBJS-$(CONFIG_MUSB_GADGET) += musb_uboot.o
 COBJS-$(CONFIG_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o
+COBJS-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o
 
 CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \
$(call cc-option,-Wno-unused-but-set-variable) \
diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c
new file mode 100644
index 000..9a03917
--- /dev/null
+++ b/drivers/usb/musb-new/musb_dsps.c
@@ -0,0 +1,771 @@
+/*
+ * Texas Instruments DSPS platforms glue layer
+ *
+ * Copyright (C) 2012, by Texas Instruments
+ *
+ * Based on the am35x glue layer code.
+ *
+ * This file is part of the Inventra Controller Driver for Linux.
+ *
+ * The Inventra Controller Driver for Linux is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU
+ * General Public License version 2 as published by the Free Software
+ * Foundation.
+ *
+ * The Inventra Controller Driver for Linux 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 The Inventra Controller Driver for Linux ; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA  02111-1307  USA
+ *
+ * musb_dsps.c will be a common file for all the TI DSPS platforms
+ * such as dm64x, dm36x, dm35x, da8x, am35x and ti81x.
+ * For now only ti81x is using this and in future davinci.c, am35x.c
+ * da8xx.c would be merged to this file after testing.
+ */
+
+#define __UBOOT__
+#ifndef __UBOOT__
+#include linux/init.h
+#include linux/io.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/dma-mapping.h
+#include linux/pm_runtime.h
+#include linux/module.h
+
+#include linux/of.h
+#include linux/of_device.h
+#include linux/of_address.h
+
+#include plat/usb.h
+#else
+#include common.h
+#include asm/omap_musb.h
+#include linux-compat.h
+#endif
+
+#include musb_core.h
+
+/**
+ * avoid using musb_readx()/musb_writex() as glue layer should not be
+ * dependent on musb core layer symbols.
+ */
+static inline u8 dsps_readb(const void __iomem *addr, unsigned offset)
+   { return __raw_readb(addr + offset); }
+
+static inline u32 dsps_readl(const void __iomem *addr, unsigned offset)
+   { return __raw_readl(addr + offset); }
+
+static inline void dsps_writeb(void __iomem *addr, unsigned offset, u8 data)
+   { __raw_writeb(data, addr + offset); }
+
+static inline void dsps_writel(void __iomem *addr, unsigned offset, u32 data)
+   { __raw_writel(data, addr + offset); }
+
+/**
+ * DSPS musb wrapper register offset.
+ * FIXME: This should be expanded to have all the wrapper registers from TI 
DSPS
+ * musb ips.
+ */
+struct dsps_musb_wrapper {
+   u16 

[U-Boot] [PATCH v4 06/13] am335x_evm: enable both musb gadget and host

2012-11-03 Thread Ilya Yanok
Enable musb gadget in Ethernet mode on port 0 and
musb host on port1.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 include/configs/am335x_evm.h |   27 +++
 1 file changed, 27 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 339d4bd..77f7219 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -237,6 +237,33 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #endif
 
+/*
+ * USB configuration
+ */
+#define CONFIG_USB_MUSB_DSPS
+#define CONFIG_ARCH_MISC_INIT
+#define CONFIG_MUSB_GADGET
+#define CONFIG_MUSB_PIO_ONLY
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_MUSB_HOST
+#define CONFIG_AM335X_USB0
+#define CONFIG_AM335X_USB0_MODEMUSB_PERIPHERAL
+#define CONFIG_AM335X_USB1
+#define CONFIG_AM335X_USB1_MODE MUSB_HOST
+
+#ifdef CONFIG_MUSB_HOST
+#define CONFIG_CMD_USB
+#define CONFIG_USB_STORAGE
+#endif
+
+#ifdef CONFIG_MUSB_GADGET
+#define CONFIG_USB_ETHER
+#define CONFIG_USB_ETH_RNDIS
+#endif /* CONFIG_MUSB_GADGET */
+
+/* Unsupported features */
+#undef CONFIG_USE_IRQ
+
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_PING
-- 
1.7.10.2 (Apple Git-33)

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


[U-Boot] [PATCH v4 05/13] am33xx: init OTG hardware and new musb gadget driver

2012-11-03 Thread Ilya Yanok
AM33xx has support for dual port MUSB OTG controller. This patch
adds initialization for the controller using new MUSB gadget
driver and ether gadget.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com

---
Changes in v3:
 - use clrsetbits_le32 for USB PHY ops

 arch/arm/cpu/armv7/am33xx/board.c   |  103 ++-
 arch/arm/cpu/armv7/am33xx/clock.c   |8 +++
 arch/arm/include/asm/arch-am33xx/cpu.h  |   11 ++-
 arch/arm/include/asm/arch-am33xx/hardware.h |4 ++
 4 files changed, 122 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/board.c 
b/arch/arm/cpu/armv7/am33xx/board.c
index 978b184..1917c2a 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -33,6 +33,11 @@
 #include i2c.h
 #include miiphy.h
 #include cpsw.h
+#include asm/errno.h
+#include linux/usb/ch9.h
+#include linux/usb/gadget.h
+#include linux/usb/musb.h
+#include asm/omap_musb.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -209,6 +214,84 @@ void setup_clocks_for_console(void)
return;
 }
 
+/* AM33XX has two MUSB controllers which can be host or gadget */
+#if (defined(CONFIG_MUSB_GADGET) || defined(CONFIG_MUSB_HOST))  \
+   (defined(CONFIG_AM335X_USB0) || defined(CONFIG_AM335X_USB1))
+/* USB 2.0 PHY Control */
+#define CM_PHY_PWRDN   (1  0)
+#define CM_PHY_OTG_PWRDN   (1  1)
+#define OTGVDET_EN (1  19)
+#define OTGSESSENDEN   (1  20)
+
+static void am33xx_usb_set_phy_power(u8 on, u32 *reg_addr)
+{
+   if (on) {
+   clrsetbits_le32(reg_addr, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN,
+   OTGVDET_EN | OTGSESSENDEN);
+   } else {
+   clrsetbits_le32(reg_addr, 0, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN);
+   }
+}
+
+static struct musb_hdrc_config musb_config = {
+   .multipoint = 1,
+   .dyn_fifo   = 1,
+   .num_eps= 16,
+   .ram_bits   = 12,
+};
+
+#ifdef CONFIG_AM335X_USB0
+static void am33xx_otg0_set_phy_power(u8 on)
+{
+   am33xx_usb_set_phy_power(on, cdev-usb_ctrl0);
+}
+
+struct omap_musb_board_data otg0_board_data = {
+   .set_phy_power = am33xx_otg0_set_phy_power,
+};
+
+static struct musb_hdrc_platform_data otg0_plat = {
+   .mode   = CONFIG_AM335X_USB0_MODE,
+   .config = musb_config,
+   .power  = 50,
+   .platform_ops   = musb_dsps_ops,
+   .board_data = otg0_board_data,
+};
+#endif
+
+#ifdef CONFIG_AM335X_USB1
+static void am33xx_otg1_set_phy_power(u8 on)
+{
+   am33xx_usb_set_phy_power(on, cdev-usb_ctrl1);
+}
+
+struct omap_musb_board_data otg1_board_data = {
+   .set_phy_power = am33xx_otg1_set_phy_power,
+};
+
+static struct musb_hdrc_platform_data otg1_plat = {
+   .mode   = CONFIG_AM335X_USB1_MODE,
+   .config = musb_config,
+   .power  = 50,
+   .platform_ops   = musb_dsps_ops,
+   .board_data = otg1_board_data,
+};
+#endif
+#endif
+
+int arch_misc_init(void)
+{
+#ifdef CONFIG_AM335X_USB0
+   musb_register(otg0_plat, otg0_board_data,
+   (void *)AM335X_USB0_OTG_BASE);
+#endif
+#ifdef CONFIG_AM335X_USB1
+   musb_register(otg1_plat, otg1_board_data,
+   (void *)AM335X_USB1_OTG_BASE);
+#endif
+   return 0;
+}
+
 /*
  * Basic board specific setup.  Pinmux has been handled already.
  */
@@ -261,9 +344,14 @@ static struct cpsw_platform_data cpsw_data = {
.host_port_num  = 0,
.version= CPSW_CTRL_VERSION_2,
 };
+#endif
 
+#if defined(CONFIG_DRIVER_TI_CPSW) || \
+   (defined(CONFIG_USB_ETHER)  defined(CONFIG_MUSB_GADGET))
 int board_eth_init(bd_t *bis)
 {
+   int rv, n = 0;
+#ifdef CONFIG_DRIVER_TI_CPSW
uint8_t mac_addr[6];
uint32_t mac_hi, mac_lo;
 
@@ -295,6 +383,19 @@ int board_eth_init(bd_t *bis)
PHY_INTERFACE_MODE_RGMII;
}
 
-   return cpsw_register(cpsw_data);
+   rv = cpsw_register(cpsw_data);
+   if (rv  0)
+   printf(Error %d registering CPSW switch\n, rv);
+   else
+   n += rv;
+#endif
+#ifdef CONFIG_USB_ETHER
+   rv = usb_eth_initialize(bis);
+   if (rv  0)
+   printf(Error %d registering USB_ETHER\n, rv);
+   else
+   n += rv;
+#endif
+   return n;
 }
 #endif
diff --git a/arch/arm/cpu/armv7/am33xx/clock.c 
b/arch/arm/cpu/armv7/am33xx/clock.c
index 2b19506..04841e4 100644
--- a/arch/arm/cpu/armv7/am33xx/clock.c
+++ b/arch/arm/cpu/armv7/am33xx/clock.c
@@ -40,6 +40,7 @@
 #define CLK_MODE_MASK  0xfff8
 #define CLK_DIV_SEL0xFFE0
 #define CPGMAC0_IDLE   0x3
+#define DPLL_CLKDCOLDO_GATE_CTRL0x300
 
 const struct cm_perpll *cmper = (struct cm_perpll *)CM_PER;
 const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP;
@@ -153,6 +154,11 @@ static void enable_per_clocks(void)
writel(PRCM_MOD_EN, 

[U-Boot] [PATCH v4 07/13] musb-new: am35x backend driver

2012-11-03 Thread Ilya Yanok
Backend driver for MUSB OTG controllers found on TI AM35x.

It seems that on AM35X interrupt status registers can be updated
_before_ core registers. As we don't use true interrupts in U-Boot
and poll interrupt status registers instead this can result in
interrupt handler being called with non-updated core registers.
This confuses the code and result in hanged transfers.
Add a small delay in am35x_interrupt as a workaround.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 arch/arm/include/asm/omap_musb.h|3 +
 drivers/usb/musb-new/Makefile   |1 +
 drivers/usb/musb-new/am35x.c|  709 +++
 drivers/usb/musb-new/linux-compat.h |1 +
 include/usb.h   |2 +-
 5 files changed, 715 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/musb-new/am35x.c

diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h
index 0081a68..46c8578 100644
--- a/arch/arm/include/asm/omap_musb.h
+++ b/arch/arm/include/asm/omap_musb.h
@@ -18,8 +18,11 @@
 #define __ASM_ARM_OMAP_MUSB_H
 
 extern struct musb_platform_ops musb_dsps_ops;
+extern const struct musb_platform_ops am35x_ops;
 
 struct omap_musb_board_data {
void (*set_phy_power)(u8 on);
+   void (*clear_irq)(void);
+   void (*reset)(void);
 };
 #endif /* __ASM_ARM_OMAP_MUSB_H */
diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile
index a753423..23fc735 100644
--- a/drivers/usb/musb-new/Makefile
+++ b/drivers/usb/musb-new/Makefile
@@ -10,6 +10,7 @@ COBJS-$(CONFIG_MUSB_GADGET) += musb_gadget.o 
musb_gadget_ep0.o musb_core.o
 COBJS-$(CONFIG_MUSB_GADGET) += musb_uboot.o
 COBJS-$(CONFIG_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o
 COBJS-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o
+COBJS-$(CONFIG_USB_MUSB_AM35X) += am35x.o
 
 CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \
$(call cc-option,-Wno-unused-but-set-variable) \
diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c
new file mode 100644
index 000..57c9bd3
--- /dev/null
+++ b/drivers/usb/musb-new/am35x.c
@@ -0,0 +1,709 @@
+/*
+ * Texas Instruments AM35x glue layer
+ *
+ * Copyright (c) 2010, by Texas Instruments
+ *
+ * Based on the DA8xx glue layer code.
+ * Copyright (c) 2008-2009, MontaVista Software, Inc. sou...@mvista.com
+ *
+ * This file is part of the Inventra Controller Driver for Linux.
+ *
+ * The Inventra Controller Driver for Linux is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU
+ * General Public License version 2 as published by the Free Software
+ * Foundation.
+ *
+ * The Inventra Controller Driver for Linux 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 The Inventra Controller Driver for Linux ; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#define __UBOOT__
+#ifndef __UBOOT__
+#include linux/init.h
+#include linux/module.h
+#include linux/clk.h
+#include linux/err.h
+#include linux/io.h
+#include linux/platform_device.h
+#include linux/dma-mapping.h
+
+#include plat/usb.h
+#else
+#include common.h
+#include asm/omap_musb.h
+#include linux-compat.h
+#endif
+
+#include musb_core.h
+
+/*
+ * AM35x specific definitions
+ */
+/* USB 2.0 OTG module registers */
+#define USB_REVISION_REG   0x00
+#define USB_CTRL_REG   0x04
+#define USB_STAT_REG   0x08
+#define USB_EMULATION_REG  0x0c
+/* 0x10 Reserved */
+#define USB_AUTOREQ_REG0x14
+#define USB_SRP_FIX_TIME_REG   0x18
+#define USB_TEARDOWN_REG   0x1c
+#define EP_INTR_SRC_REG0x20
+#define EP_INTR_SRC_SET_REG0x24
+#define EP_INTR_SRC_CLEAR_REG  0x28
+#define EP_INTR_MASK_REG   0x2c
+#define EP_INTR_MASK_SET_REG   0x30
+#define EP_INTR_MASK_CLEAR_REG 0x34
+#define EP_INTR_SRC_MASKED_REG 0x38
+#define CORE_INTR_SRC_REG  0x40
+#define CORE_INTR_SRC_SET_REG  0x44
+#define CORE_INTR_SRC_CLEAR_REG0x48
+#define CORE_INTR_MASK_REG 0x4c
+#define CORE_INTR_MASK_SET_REG 0x50
+#define CORE_INTR_MASK_CLEAR_REG 0x54
+#define CORE_INTR_SRC_MASKED_REG 0x58
+/* 0x5c Reserved */
+#define USB_END_OF_INTR_REG0x60
+
+/* Control register bits */
+#define AM35X_SOFT_RESET_MASK  1
+
+/* USB interrupt register bits */
+#define AM35X_INTR_USB_SHIFT   16
+#define AM35X_INTR_USB_MASK(0x1ff  AM35X_INTR_USB_SHIFT)
+#define AM35X_INTR_DRVVBUS 0x100
+#define AM35X_INTR_RX_SHIFT16
+#define AM35X_INTR_TX_SHIFT0
+#define AM35X_TX_EP_MASK   0x  /* EP0 + 15 Tx EPs */
+#define AM35X_RX_EP_MASK   0xfffe  /* 15 Rx EPs */
+#define AM35X_TX_INTR_MASK 

[U-Boot] [PATCH v4 08/13] OMAP3: am35x_def.h: add USB defines

2012-11-03 Thread Ilya Yanok
Add defines for MUSB IP block on AM35X SoCs.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 arch/arm/include/asm/arch-omap3/am35x_def.h |   27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/include/asm/arch-omap3/am35x_def.h 
b/arch/arm/include/asm/arch-omap3/am35x_def.h
index bbaf1bc..67698bc 100644
--- a/arch/arm/include/asm/arch-omap3/am35x_def.h
+++ b/arch/arm/include/asm/arch-omap3/am35x_def.h
@@ -32,9 +32,34 @@
 #ifndef __KERNEL_STRICT_NAMES
 #ifndef __ASSEMBLY__
 
+/* LVL_INTR_CLEAR bits */
+#define USBOTGSS_INT_CLR   (1  4)
+
 /* IP_SW_RESET bits */
+#define USBOTGSS_SW_RST(1  0)/* reset USBOTG */
 #define CPGMACSS_SW_RST(1  1)/* reset CPGMAC */
 
+/* DEVCONF2 bits */
+#define CONF2_PHY_GPIOMODE (1  23)
+#define CONF2_OTGMODE  (3  14)
+#define CONF2_NO_OVERRIDE  (0  14)
+#define CONF2_FORCE_HOST   (1  14)
+#define CONF2_FORCE_DEVICE (2  14)
+#define CONF2_FORCE_HOST_VBUS_LOW (3  14)
+#define CONF2_SESENDEN (1  13)
+#define CONF2_VBDTCTEN (1  12)
+#define CONF2_REFFREQ_24MHZ(2  8)
+#define CONF2_REFFREQ_26MHZ(7  8)
+#define CONF2_REFFREQ_13MHZ(6  8)
+#define CONF2_REFFREQ  (0xf  8)
+#define CONF2_PHYCLKGD (1  7)
+#define CONF2_VBUSSENSE(1  6)
+#define CONF2_PHY_PLLON(1  5)
+#define CONF2_RESET(1  4)
+#define CONF2_PHYPWRDN (1  3)
+#define CONF2_OTGPWRDN (1  2)
+#define CONF2_DATPOL   (1  1)
+
 /* General register mappings of system control module */
 #define AM35X_SCM_GEN_BASE 0x48002270
 struct am35x_scm_general {
@@ -49,6 +74,8 @@ struct am35x_scm_general {
 };
 #define am35x_scm_general_regs ((struct am35x_scm_general *)AM35X_SCM_GEN_BASE)
 
+#define AM35XX_IPSS_USBOTGSS_BASE  0x5C04
+
 #endif /*__ASSEMBLY__ */
 #endif /* __KERNEL_STRICT_NAMES */
 
-- 
1.7.10.2 (Apple Git-33)

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


[U-Boot] [PATCH v4 10/13] am3517_evm: switch to musb-new

2012-11-03 Thread Ilya Yanok
Use new musb framework instead of the old one on AM3517_EVM.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 board/logicpd/am3517evm/am3517evm.c |   74 +++
 include/configs/am3517_evm.h|   37 --
 2 files changed, 90 insertions(+), 21 deletions(-)

diff --git a/board/logicpd/am3517evm/am3517evm.c 
b/board/logicpd/am3517evm/am3517evm.c
index d316f33..0b3721e 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -25,12 +25,20 @@
 
 #include common.h
 #include asm/io.h
+#include asm/omap_musb.h
+#include asm/arch/am35x_def.h
 #include asm/arch/mem.h
 #include asm/arch/mux.h
 #include asm/arch/sys_proto.h
 #include asm/arch/mmc_host_def.h
+#include asm/arch/musb.h
 #include asm/mach-types.h
+#include asm/errno.h
+#include linux/usb/ch9.h
+#include linux/usb/gadget.h
+#include linux/usb/musb.h
 #include i2c.h
+#include netdev.h
 #include am3517evm.h
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -50,6 +58,52 @@ int board_init(void)
return 0;
 }
 
+#ifdef CONFIG_USB_MUSB_AM35X
+static struct musb_hdrc_config musb_config = {
+   .multipoint = 1,
+   .dyn_fifo   = 1,
+   .num_eps= 16,
+   .ram_bits   = 12,
+};
+
+static struct omap_musb_board_data musb_board_data = {
+   .set_phy_power  = am35x_musb_phy_power,
+   .clear_irq  = am35x_musb_clear_irq,
+   .reset  = am35x_musb_reset,
+};
+
+static struct musb_hdrc_platform_data musb_plat = {
+#if defined(CONFIG_MUSB_HOST)
+   .mode   = MUSB_HOST,
+#elif defined(CONFIG_MUSB_GADGET)
+   .mode   = MUSB_PERIPHERAL,
+#else
+#error Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET
+#endif
+   .config = musb_config,
+   .power  = 250,
+   .platform_ops   = am35x_ops,
+   .board_data = musb_board_data,
+};
+
+static void am3517_evm_musb_init(void)
+{
+   /*
+* Set up USB clock/mode in the DEVCONF2 register.
+* USB2.0 PHY reference clock is 13 MHz
+*/
+   clrsetbits_le32(am35x_scm_general_regs-devconf2,
+   CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
+   CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
+   CONF2_VBDTCTEN | CONF2_DATPOL);
+
+   musb_register(musb_plat, musb_board_data,
+   (void *)AM35XX_IPSS_USBOTGSS_BASE);
+}
+#else
+#define am3517_evm_musb_init() do {} while (0)
+#endif
+
 /*
  * Routine: misc_init_r
  * Description: Init i2c, ethernet, etc... (done here so udelay works)
@@ -62,6 +116,8 @@ int misc_init_r(void)
 
dieid_num_r();
 
+   am3517_evm_musb_init();
+
return 0;
 }
 
@@ -83,3 +139,21 @@ int board_mmc_init(bd_t *bis)
return 0;
 }
 #endif
+
+#if defined(CONFIG_USB_ETHER)  defined(CONFIG_MUSB_GADGET)
+int board_eth_init(bd_t *bis)
+{
+   int rv, n = 0;
+
+   rv = cpu_eth_init(bis);
+   if (rv  0)
+   n += rv;
+
+   rv = usb_eth_initialize(bis);
+   if (rv  0)
+   n += rv;
+
+   return n;
+}
+#endif
+
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 6980811..1f0199e 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -97,15 +97,16 @@
 
 /*
  * USB configuration
- * Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard
- * Enable CONFIG_MUSB_UDC for Device functionalities.
+ * Enable CONFIG_MUSB_HOST for Host functionalities MSC, keyboard
+ * Enable CONFIG_MUSB_GADGET for Device functionalities.
  */
-#define CONFIG_USB_AM35X   1
-#define CONFIG_MUSB_HCD1
+#define CONFIG_USB_MUSB_AM35X
+#define CONFIG_MUSB_HOST
+#define CONFIG_MUSB_PIO_ONLY
 
-#ifdef CONFIG_USB_AM35X
+#ifdef CONFIG_USB_MUSB_AM35X
 
-#ifdef CONFIG_MUSB_HCD
+#ifdef CONFIG_MUSB_HOST
 #define CONFIG_CMD_USB
 
 #define CONFIG_USB_STORAGE
@@ -117,21 +118,15 @@
 #define CONFIG_PREBOOT usb start
 #endif /* CONFIG_USB_KEYBOARD */
 
-#endif /* CONFIG_MUSB_HCD */
-
-#ifdef CONFIG_MUSB_UDC
-/* USB device configuration */
-#define CONFIG_USB_DEVICE  1
-#define CONFIG_USB_TTY 1
-#define CONFIG_SYS_CONSOLE_IS_IN_ENV   1
-/* Change these to suit your needs */
-#define CONFIG_USBD_VENDORID   0x0451
-#define CONFIG_USBD_PRODUCTID  0x5678
-#define CONFIG_USBD_MANUFACTURER   Texas Instruments
-#define CONFIG_USBD_PRODUCT_NAME   AM3517EVM
-#endif /* CONFIG_MUSB_UDC */
-
-#endif /* CONFIG_USB_AM35X */
+#endif /* CONFIG_MUSB_HOST */
+
+#ifdef CONFIG_MUSB_GADGET
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_ETHER
+#define CONFIG_USB_ETH_RNDIS
+#endif /* CONFIG_MUSB_GADGET */
+
+#endif /* CONFIG_USB_MUSB_AM35X */
 
 /* commands to include */
 #include config_cmd_default.h
-- 
1.7.10.2 (Apple Git-33)

___
U-Boot mailing list
U-Boot@lists.denx.de

[U-Boot] [PATCH v4 09/13] OMAP3: am35x: add musb functions

2012-11-03 Thread Ilya Yanok
AM35XX specific functions for integrated USB PHY/MUSB IP.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 arch/arm/cpu/armv7/omap3/Makefile  |1 +
 arch/arm/cpu/armv7/omap3/am35x_musb.c  |   75 
 arch/arm/include/asm/arch-omap3/musb.h |   28 
 3 files changed, 104 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/omap3/am35x_musb.c
 create mode 100644 arch/arm/include/asm/arch-omap3/musb.h

diff --git a/arch/arm/cpu/armv7/omap3/Makefile 
b/arch/arm/cpu/armv7/omap3/Makefile
index ac597be..de167ee 100644
--- a/arch/arm/cpu/armv7/omap3/Makefile
+++ b/arch/arm/cpu/armv7/omap3/Makefile
@@ -38,6 +38,7 @@ endif
 COBJS-$(CONFIG_DRIVER_TI_EMAC) += emac.o
 COBJS-$(CONFIG_EMIF4)  += emif4.o
 COBJS-$(CONFIG_SDRC)   += sdrc.o
+COBJS-$(CONFIG_USB_MUSB_AM35X) += am35x_musb.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS))
diff --git a/arch/arm/cpu/armv7/omap3/am35x_musb.c 
b/arch/arm/cpu/armv7/omap3/am35x_musb.c
new file mode 100644
index 000..7183c4f
--- /dev/null
+++ b/arch/arm/cpu/armv7/omap3/am35x_musb.c
@@ -0,0 +1,75 @@
+/*
+ * This file configures the internal USB PHY in AM35X.
+ *
+ * Copyright (C) 2012 Ilya Yanok ilya.ya...@gmail.com
+ *
+ * Based on omap_phy_internal.c code from Linux by
+ * Hema HK hem...@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.
+ *
+ */
+
+#include common.h
+#include asm/io.h
+#include asm/arch/am35x_def.h
+
+void am35x_musb_reset(void)
+{
+   /* Reset the musb interface */
+   clrsetbits_le32(am35x_scm_general_regs-ip_sw_reset,
+   0, USBOTGSS_SW_RST);
+   clrsetbits_le32(am35x_scm_general_regs-ip_sw_reset,
+   USBOTGSS_SW_RST, 0);
+}
+
+void am35x_musb_phy_power(u8 on)
+{
+   unsigned long start = get_timer(0);
+
+   if (on) {
+   /*
+* Start the on-chip PHY and its PLL.
+*/
+   clrsetbits_le32(am35x_scm_general_regs-devconf2,
+   CONF2_RESET | CONF2_PHYPWRDN | CONF2_OTGPWRDN,
+   CONF2_PHY_PLLON);
+
+   debug(Waiting for PHY clock good...\n);
+   while (!(readl(am35x_scm_general_regs-devconf2)
+CONF2_PHYCLKGD)) {
+
+   if (get_timer(start)  CONFIG_SYS_HZ / 10) {
+   printf(musb PHY clock good timed out\n);
+   break;
+   }
+   }
+   } else {
+   /*
+* Power down the on-chip PHY.
+*/
+   clrsetbits_le32(am35x_scm_general_regs-devconf2,
+   CONF2_PHY_PLLON,
+   CONF2_PHYPWRDN | CONF2_OTGPWRDN);
+   }
+}
+
+void am35x_musb_clear_irq(void)
+{
+   clrsetbits_le32(am35x_scm_general_regs-lvl_intr_clr,
+   0, USBOTGSS_INT_CLR);
+   readl(am35x_scm_general_regs-lvl_intr_clr);
+}
+
diff --git a/arch/arm/include/asm/arch-omap3/musb.h 
b/arch/arm/include/asm/arch-omap3/musb.h
new file mode 100644
index 000..423ac50
--- /dev/null
+++ b/arch/arm/include/asm/arch-omap3/musb.h
@@ -0,0 +1,28 @@
+/*
+ * (C) Copyright 2012
+ * Ilya Yanok, ilya.ya...@gmail.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#ifndef __ASM_ARCH_OMAP3_MUSB_H
+#define __ASM_ARCH_OMAP3_MUSB_H
+extern void am35x_musb_reset(void);
+extern void am35x_musb_phy_power(u8 on);
+extern void am35x_musb_clear_irq(void);
+#endif
-- 
1.7.10.2 (Apple Git-33)

___
U-Boot 

[U-Boot] [PATCH v4 12/13] omap3_beagle: add musb-new init

2012-11-03 Thread Ilya Yanok
Add initialization for new MUSB framework.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 board/ti/beagle/beagle.c   |   43 
 include/configs/omap3_beagle.h |2 ++
 2 files changed, 45 insertions(+)

diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 6175e1d..f20ebed 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -42,6 +42,11 @@
 #include asm/arch/sys_proto.h
 #include asm/gpio.h
 #include asm/mach-types.h
+#include asm/omap_musb.h
+#include asm/errno.h
+#include linux/usb/ch9.h
+#include linux/usb/gadget.h
+#include linux/usb/musb.h
 #include beagle.h
 #include command.h
 
@@ -285,6 +290,33 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
+#ifdef CONFIG_USB_MUSB_OMAP2PLUS
+static struct musb_hdrc_config musb_config = {
+   .multipoint = 1,
+   .dyn_fifo   = 1,
+   .num_eps= 16,
+   .ram_bits   = 12,
+};
+
+static struct omap_musb_board_data musb_board_data = {
+   .interface_type = MUSB_INTERFACE_ULPI,
+};
+
+static struct musb_hdrc_platform_data musb_plat = {
+#if defined(CONFIG_MUSB_HOST)
+   .mode   = MUSB_HOST,
+#elif defined(CONFIG_MUSB_GADGET)
+   .mode   = MUSB_PERIPHERAL,
+#else
+#error Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET
+#endif
+   .config = musb_config,
+   .power  = 100,
+   .platform_ops   = omap2430_ops,
+   .board_data = musb_board_data,
+};
+#endif
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -466,6 +498,10 @@ int misc_init_r(void)
omap3_dss_enable();
 #endif
 
+#ifdef CONFIG_USB_MUSB_OMAP2PLUS
+   musb_register(musb_plat, musb_board_data, (void *)MUSB_BASE);
+#endif
+
return 0;
 }
 
@@ -513,3 +549,10 @@ int ehci_hcd_stop(int index)
 }
 
 #endif /* CONFIG_USB_EHCI */
+
+#if defined(CONFIG_USB_ETHER)  defined(CONFIG_MUSB_GADGET)
+int board_eth_init(bd_t *bis)
+{
+   return usb_eth_initialize(bis);
+}
+#endif
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index f79f996..e3ed8ea 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -120,6 +120,8 @@
 #define CONFIG_MUSB_UDC1
 #define CONFIG_USB_OMAP3   1
 #define CONFIG_TWL4030_USB 1
+#define CONFIG_USB_ETHER
+#define CONFIG_USB_ETHER_RNDIS
 
 /* USB device configuration */
 #define CONFIG_USB_DEVICE  1
-- 
1.7.10.2 (Apple Git-33)

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


[U-Boot] [PATCH v4 11/13] musb-new: omap2plus backend driver

2012-11-03 Thread Ilya Yanok
Backend driver for MUSB OTG controllers found on TI OMAP2/3/4
(tested only on OMAP3 Beagle).

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com
---

 arch/arm/include/asm/omap_musb.h|4 +
 drivers/usb/musb-new/Makefile   |1 +
 drivers/usb/musb-new/linux-compat.h |9 +
 drivers/usb/musb-new/omap2430.c |  626 +++
 drivers/usb/musb-new/omap2430.h |   56 
 include/usb.h   |3 +-
 6 files changed, 698 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/musb-new/omap2430.c
 create mode 100644 drivers/usb/musb-new/omap2430.h

diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h
index 46c8578..b04d865 100644
--- a/arch/arm/include/asm/omap_musb.h
+++ b/arch/arm/include/asm/omap_musb.h
@@ -19,10 +19,14 @@
 
 extern struct musb_platform_ops musb_dsps_ops;
 extern const struct musb_platform_ops am35x_ops;
+extern const struct musb_platform_ops omap2430_ops;
 
 struct omap_musb_board_data {
+   u8 interface_type;
void (*set_phy_power)(u8 on);
void (*clear_irq)(void);
void (*reset)(void);
 };
+
+enum musb_interface{MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
 #endif /* __ASM_ARM_OMAP_MUSB_H */
diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile
index 23fc735..c23bef1 100644
--- a/drivers/usb/musb-new/Makefile
+++ b/drivers/usb/musb-new/Makefile
@@ -11,6 +11,7 @@ COBJS-$(CONFIG_MUSB_GADGET) += musb_uboot.o
 COBJS-$(CONFIG_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o
 COBJS-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o
 COBJS-$(CONFIG_USB_MUSB_AM35X) += am35x.o
+COBJS-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o
 
 CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \
$(call cc-option,-Wno-unused-but-set-variable) \
diff --git a/drivers/usb/musb-new/linux-compat.h 
b/drivers/usb/musb-new/linux-compat.h
index 61f95f8..7cfcb1a 100644
--- a/drivers/usb/musb-new/linux-compat.h
+++ b/drivers/usb/musb-new/linux-compat.h
@@ -37,6 +37,7 @@ typedef unsigned long dmaaddr_t;
 #define spin_unlock_irqrestore(lock, flags) do {} while (0)
 
 #define setup_timer(timer, func, data) do {} while (0)
+#define del_timer_sync(timer) do {} while (0)
 #define schedule_work(work) do {} while (0)
 #define INIT_WORK(work, fun) do {} while (0)
 
@@ -107,4 +108,12 @@ typedef unsigned long dmaaddr_t;
 #endif
 
 #define msleep(a)  udelay(a * 1000)
+
+/*
+ * Map U-Boot config options to Linux ones
+ */
+#ifdef CONFIG_OMAP34XX
+#define CONFIG_SOC_OMAP3430
+#endif
+
 #endif /* __LINUX_COMPAT_H__ */
diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c
new file mode 100644
index 000..b1c4dc7
--- /dev/null
+++ b/drivers/usb/musb-new/omap2430.c
@@ -0,0 +1,626 @@
+/*
+ * Copyright (C) 2005-2007 by Texas Instruments
+ * Some code has been taken from tusb6010.c
+ * Copyrights for that are attributable to:
+ * Copyright (C) 2006 Nokia Corporation
+ * Tony Lindgren t...@atomide.com
+ *
+ * This file is part of the Inventra Controller Driver for Linux.
+ *
+ * The Inventra Controller Driver for Linux is free software; you
+ * can redistribute it and/or modify it under the terms of the GNU
+ * General Public License version 2 as published by the Free Software
+ * Foundation.
+ *
+ * The Inventra Controller Driver for Linux 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 The Inventra Controller Driver for Linux ; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+#define __UBOOT__
+#ifndef __UBOOT__
+#include linux/module.h
+#include linux/kernel.h
+#include linux/sched.h
+#include linux/init.h
+#include linux/list.h
+#include linux/io.h
+#include linux/platform_device.h
+#include linux/dma-mapping.h
+#include linux/pm_runtime.h
+#include linux/err.h
+#include linux/usb/musb-omap.h
+#else
+#include common.h
+#include asm/omap_musb.h
+#include twl4030.h
+#include linux-compat.h
+#endif
+
+#include musb_core.h
+#include omap2430.h
+
+#ifndef __UBOOT__
+struct omap2430_glue {
+   struct device   *dev;
+   struct platform_device  *musb;
+   enum omap_musb_vbus_id_status status;
+   struct work_struct  omap_musb_mailbox_work;
+};
+#define glue_to_musb(g)platform_get_drvdata(g-musb)
+
+struct omap2430_glue   *_glue;
+
+static struct timer_list musb_idle_timer;
+
+static void musb_do_idle(unsigned long _musb)
+{
+   struct musb *musb = (void *)_musb;
+   unsigned long   flags;
+   u8  power;
+   u8  devctl;
+
+   spin_lock_irqsave(musb-lock, flags);
+
+   switch (musb-xceiv-state) {
+   case 

[U-Boot] [PATCH v4 13/13] omap3_beagle: use new MUSB intstead of the old one

2012-11-03 Thread Ilya Yanok
Enable using of new MUSB framework on Beagle.

NOTE! This is not just a change of backend code: top-level behavior
is also changed, we now use USB device port for USB Ethernet instead
of serial.

Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com

---

 include/configs/omap3_beagle.h |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index e3ed8ea..fe67c84 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -117,17 +117,14 @@
 #define CONFIG_SYS_I2C_NOPROBES{{0x0, 0x0}}
 
 /* USB */
-#define CONFIG_MUSB_UDC1
-#define CONFIG_USB_OMAP3   1
+#define CONFIG_MUSB_GADGET
+#define CONFIG_USB_MUSB_OMAP2PLUS
+#define CONFIG_MUSB_PIO_ONLY
+#define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_TWL4030_USB 1
 #define CONFIG_USB_ETHER
 #define CONFIG_USB_ETHER_RNDIS
 
-/* USB device configuration */
-#define CONFIG_USB_DEVICE  1
-#define CONFIG_USB_TTY 1
-#define CONFIG_SYS_CONSOLE_IS_IN_ENV   1
-
 /* USB EHCI */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
-- 
1.7.10.2 (Apple Git-33)

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


Re: [U-Boot] [PATCH v1 7/8] am33xx_spl_bch: simple SPL nand loader for AM33XX

2012-11-03 Thread Ilya Yanok
Hi Tom,

On Wed, Oct 31, 2012 at 1:03 AM, Tom Rini tr...@ti.com wrote:

  + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
  + this-ecc.hwctl(mtd, NAND_ECC_READ); +
 nand_command(block,
  page, data_pos, NAND_CMD_RNDOUT); + + this-read_buf(mtd, p,
  eccsize); + + nand_command(block, page, oob_pos,
  NAND_CMD_RNDOUT); + + this-read_buf(mtd, oob, eccbytes); +
  this-ecc.calculate(mtd, p, ecc_calc[i]); + +   data_pos +=
  eccsize; +oob_pos += eccbytes; +  oob += eccbytes; +
  }

 This is where the function differs.  If we can't merge things
 together, I'd like to see about putting just this function into
 nand_spl_simple.c under CONFIG_SYS_NAND_HW_BCH8 since if I follow
 what's going on, and I need to play with the code to confirm I do,
 it's a generic change related to how much more we're reading back out


Not exactly. This change is rather GPMC-specific: we have to read data
block then it's ecc code to get the syndrome. And even with GPMC in another
configuration we will need another reading order...
I'm not sure if we can do this in some generic way...

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


[U-Boot] [PATCH] TPM: remove dead code

2012-11-03 Thread Wolfgang Denk
The TPM code was added more than a year or 4 releases ago.  This was
done under the proposition that board support that would actually use
such code would be added soon.  However, nothing happened since.  The
code has no users in mainline, and does not even get build for any
configuration, so we cannot even tell if it compiles at all.

Remove the unused code.  In in some far future actual users show up,
it can be re-added easily.

Signed-off-by: Wolfgang Denk w...@denx.de
Cc: Vadim Bendebury vben...@chromium.org
Cc: Simon Glass s...@chromium.org
---
 README|  10 -
 common/Makefile   |   1 -
 common/cmd_tpm.c  | 103 -
 doc/driver-model/UDM-tpm.txt  |  48 
 drivers/tpm/Makefile  |  43 
 drivers/tpm/generic_lpc_tpm.c | 495 --
 include/tpm.h |  71 --
 7 files changed, 771 deletions(-)
 delete mode 100644 common/cmd_tpm.c
 delete mode 100644 doc/driver-model/UDM-tpm.txt
 delete mode 100644 drivers/tpm/Makefile
 delete mode 100644 drivers/tpm/generic_lpc_tpm.c
 delete mode 100644 include/tpm.h

diff --git a/README b/README
index 22fd6b7..54a0bdd 100644
--- a/README
+++ b/README
@@ -1161,16 +1161,6 @@ The following options need to be configured:
CONFIG_SH_ETHER_CACHE_WRITEBACK
If this option is set, the driver enables cache flush.
 
-- TPM Support:
-   CONFIG_GENERIC_LPC_TPM
-   Support for generic parallel port TPM devices. Only one device
-   per system is supported at this time.
-
-   CONFIG_TPM_TIS_BASE_ADDRESS
-   Base address where the generic TPM device is mapped
-   to. Contemporary x86 systems usually map it at
-   0xfed4.
-
 - USB Support:
At the moment only the UHCI host controller is
supported (PIP405, MIP405, MPC5200); define
diff --git a/common/Makefile b/common/Makefile
index 9e43322..6bcfdca 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -154,7 +154,6 @@ COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o
 COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o
 COBJS-$(CONFIG_CMD_TIME) += cmd_time.o
 COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o
-COBJS-$(CONFIG_CMD_TPM) += cmd_tpm.o
 COBJS-$(CONFIG_CMD_TSI148) += cmd_tsi148.o
 COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o
 COBJS-$(CONFIG_CMD_UBIFS) += cmd_ubifs.o
diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
deleted file mode 100644
index 6f5cd48..000
--- a/common/cmd_tpm.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium OS Authors.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include common.h
-#include command.h
-#include tpm.h
-
-#define MAX_TRANSACTION_SIZE 30
-
-/*
- * tpm_write() expects a variable number of parameters: the internal address
- * followed by data to write, byte by byte.
- *
- * Returns 0 on success or -1 on errors (wrong arguments or TPM failure).
- */
-static int tpm_process(int argc, char * const argv[], cmd_tbl_t *cmdtp)
-{
-   u8 tpm_buffer[MAX_TRANSACTION_SIZE];
-   u32 write_size, read_size;
-   char *p;
-   int rv = -1;
-
-   for (write_size = 0; write_size  argc; write_size++) {
-   u32 datum = simple_strtoul(argv[write_size], p, 0);
-   if (*p || (datum  0xff)) {
-   printf(\n%s: bad data value\n\n, argv[write_size]);
-   cmd_usage(cmdtp);
-   return rv;
-   }
-   tpm_buffer[write_size] = (u8)datum;
-   }
-
-   read_size = sizeof(tpm_buffer);
-   if (!tis_sendrecv(tpm_buffer, write_size, tpm_buffer, read_size)) {
-   int i;
-   puts(Got TPM response:\n);
-   for (i = 0; i  read_size; i++)
-   printf( %2.2x, tpm_buffer[i]);
-   puts(\n);
-   rv = 0;
-   } else {
-   puts(tpm command failed\n);
-   }
-   return rv;
-}
-
-static int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   int rv = 0;
-
-   /*
-* Verify that in case it is present, 

Re: [U-Boot] [PATCH 1/3] tpm: Add casts for proper compilation

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 8:00 AM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 1351874667-23959-1-git-send-email-...@chromium.org you wrote:
 From: Taylor Hutt th...@chromium.org

 When building for the Sandbox version, the casts in this change are
 necessary to avoid compilation issues.

 Signed-off-by: Taylor Hutt th...@chromium.org
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  drivers/tpm/generic_lpc_tpm.c |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)

 I see little sense in spending work on this code.  After all the time,
 it is still unused and dead code in mainline - there is not a single
 configuration which actually enables the necessary CONFIG_ options.,

 I recommend to remove the whole TPM code instead.

It is actually used in the x86 Chromebook, but the patch to enable it
never made it to mainline. There was quite a bit of push-back on the
x86 side at the time and the person working on it finally had enough
:-(

I have recently taken this up again to see if we can get x86 into a
better state for newer Intel chips and the latest x86 Chromebooks. The
patch to enable the TPM there is:

http://patchwork.ozlabs.org/patch/190813/

The patch to enable on ARM Chromebooks is the third patch in this TPM series:

http://patchwork.ozlabs.org/patch/196596/

I accept that it has sat there for a while without a board config to
use it. But I would very much like to keep this code and see no sense
in removing it now that it is actually in use.

Regards,
Simon


 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
 You are an excellent tactician, Captain. You let your second in  com-
 mand attack while you sit and watch for weakness.
 -- Khan Noonian Singh, Space Seed, stardate 3141.9
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] tpm: Add Infineon slb9635_i2c TPM driver

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 8:07 AM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 1351874667-23959-2-git-send-email-...@chromium.org you wrote:
 From: Rong Chang rongch...@chromium.org

 Add a driver for the I2C TPM from Infineon.

 Signed-off-by: Che-Liang Chiou clch...@chromium.org
 Signed-off-by: Rong Chang rongch...@chromium.org
 Signed-off-by: Tom Wai-Hong Tam waih...@chromium.org
 Signed-off-by: Simon Glass s...@chromium.org

 NAK.  I will not accept any more additions of such dead code.
 We added TPM support long ago, based on the assumption/promise that
 users for it would follow soon.  But nothing ever happened.

 Instead of adding more such dead code, we should rather completely
 remove this unused stuff - note that it does not even get
 compile-tested io any mainline configuration.

Please see my other message on this. Patches are pending for smdk5250
and chromebook-x86.

Regards,
Simon


 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
 A year spent in artificial intelligence is enough to make one believe
 in God.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 17/17] tpm: Add TPM stress test

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 8:29 AM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 1351902453-27956-18-git-send-email-...@chromium.org you wrote:
 From: Luigi Semenzato semenz...@chromium.org

 Add a simple command to stress-test a TPM (Trusted Platform Module).

 Signed-off-by: Luigi Semenzato semenz...@chromium.org

 Commit-Ready: Stefan Reinauer reina...@google.com
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  common/cmd_tpm.c |   93 
 ++---
  1 files changed, 87 insertions(+), 6 deletions(-)

 See previous comments about TPM code.  Please let's dump all this
 unused stuff.

As mentioned, patches are pending to enable this for two boards (ARM and x86).

Regards,
Simon


 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
 You'll pay to know what you really think.- J.R. Bob Dobbs
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] TPM: remove dead code

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 9:30 AM, Wolfgang Denk w...@denx.de wrote:
 The TPM code was added more than a year or 4 releases ago.  This was
 done under the proposition that board support that would actually use
 such code would be added soon.  However, nothing happened since.  The
 code has no users in mainline, and does not even get build for any
 configuration, so we cannot even tell if it compiles at all.

 Remove the unused code.  In in some far future actual users show up,
 it can be re-added easily.

I think you may have missed the pending patches which make use of
this. it is important functionality for the Chromebooks (secure boot).

Regards,
Simon


 Signed-off-by: Wolfgang Denk w...@denx.de
 Cc: Vadim Bendebury vben...@chromium.org
 Cc: Simon Glass s...@chromium.org
 ---
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/15] x86: Add functions to access MSRs

2012-11-03 Thread Simon Glass
Hi Graeme,

On Wed, Oct 24, 2012 at 3:22 PM, Graeme Russ graeme.r...@gmail.com wrote:
 Hi Stefan,

 On Thu, Oct 25, 2012 at 8:15 AM, Stefan Reinauer reina...@google.com wrote:
 Graeme,

 Reusing code from the Linux kernel is generally a great idea. However for
 simplicity I'd rather have 25 lines than 870 lines for reading MSRs. It
 seems a lot of code in those files doesn't really apply for u-boot

 Understood, however the code I extracted from the Linux kernel:
  - Makes it more likely that all the corner cases have been dealt with
  - Brings in all the 'magic numbers' for a wide range of CPUs, thus
 avoiding a continuing stream of patches (pulling them in from the
 Linux kernel code)
  - Includes MTTR functions and defines. I know coreboot is doing the
 memory init, but coreboot will not always be the only way to launch
 U-Boot and MTTRs will be needed
  - It's simply easier to keep synchronising with the Linux kernel when
 new defines and/or functions get added/removed/modified
  - I doubt it increases the compiled code size, and if it does,
 there's probably a good reason for it (corner cases)

Thanks for your comments.

I will bring in the full MTTR implementation from your patch. However,
first I need to test it and integrate with everything else here. So it
might take me a few weeks to get everything straight again.

I have one more lot of x86 patches queued up (about 20 patches), so I
will send these out based on what is there now. One of them does use
MTRR but it may be independent of this change anyway. More testing
will tell.

My initial goal is to get mainline booting properly on several x86
Chromebooks, using coreboot.

We also need to address moving coreboot code into a library directory
or whatever.

Regards,
Simon


 Regards,

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


Re: [U-Boot] [PATCH 6/7] fs: Add a Coreboot Filesystem (CBFS) driver and commands

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 8:04 AM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 
 CAPnjgZ2hD4ZgzM=0rppsgr0-iojtv+q40e3gyexeqxndkop...@mail.gmail.com you 
 wrote:

   --- /dev/null
   +++ b/common/cmd_cbfs.c
   @@ -0,0 +1,214 @@
   +/*
   + * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
   + *
   + * See file CREDITS for list of people who contributed to this
   + * project.
 
  file CREDITS ?  Please fix globally...
 
 
  Is any of this code taken from any other project?  If yes, then please
  attribute properly...
 
  Sorry?  U-Boot has a CREDITS file but only ~10% of the files reference
  it.

 Yes, U-Boot has such a file, and I wonder if we should remove it.
 After all, all the credits are maintained in the git history of
 changes.

 Tom or Wolfgang, can you please explain what I should do here? I don't
 know what to do about the CREDITS line.

 To me the reference to a CREDITS file is reason to suspect that this
 code has not been written from scratch, but copied from some other
 project, which eventually had it's own CREDITS file.

Yes, quite likely the boilerplate came from another U-Boot file.


 I'm missing a reference to the origin of the code.

It was written from scratch by Gabe - it did not come from coreboot if
that is what you as asking. I confirmed with him again yesterday.


 If this was indeed written from scratch, with no code borrowed from
 elsewhere, then please just drop these lines.

OK, I will do this in my follow-up patch to add DocBook support. I did
find a shorter message which some U-Boot files use at one point. I
will try to find that again, and use it.

Regards,
Simon


 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
 Text processing has made it possible to right-justify any idea, even
 one which cannot be justified on any other grounds.
  -- J. Finnegan, USC.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/20] Final patch set for basic coreboot x86 implementation

2012-11-03 Thread Simon Glass
This series contains patches to:

- enable video and keyboard
- fix up some x86 relocation bugs
- Implement show_boot_progress()
- Provide access to new Intel core architecture timers
- Enable device tree control and add a basic fdt include file

With the above changes (on top of previously-submitted series), we have
a basically functioning U-Boot on x86, running from coreboot.

Further work is required to tidy up MTRR support (based on Graeme's comments),
add a SPI driver, rename the config file, move coreboot support into a lib
directory (or similar), clean up the config to enable various other devices and
a few other minor issues.

This work will be the subject of a later series.


Duncan Laurie (3):
  x86: Fix MTRR clear to detect which MTRR to use
  x86: Issue SMI to finalize Coreboot in final stage
  video: Check for valid FB pointer before clearing

Gabe Black (8):
  x86: Initialise SPI if enabled
  x86: Reorder x86's post relocation memory layout
  x86: Make the upper bound on relocated symbols closed instead of open
  x86: Make calculate_relocation_address an overridable function
  x86: Override calculate_relocation_address to use the e820 map
  x86: Add back cold- and warm-boot flags
  x86: Add support for CONFIG_OF_CONTROL
  x86: coreboot: Set CONFIG_ARCH_DEVICE_TREE correctly

Simon Glass (3):
  x86: fdt: Create basic .dtsi file for coreboot
  x86: Remove video_init() prototype from u-boot-x86.h
  x86: coreboot: Enable video display

Stefan Reinauer (4):
  x86: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading
  x86: Emit port 80 post codes in show_boot_progress()
  x86: Remove coreboot_ from file name
  x86: drop unused code in coreboot.c

Vadim Bendebury (2):
  x86: Provide tick counter and frequency reference for Intel core
architecture
  x86: Provide a way to throttle port80 accesses

 arch/x86/cpu/coreboot/Makefile  |3 +-
 arch/x86/cpu/coreboot/{coreboot_car.S = car.S} |0
 arch/x86/cpu/coreboot/config.mk |   23 ++
 arch/x86/cpu/coreboot/coreboot.c|   53 ++-
 arch/x86/cpu/coreboot/sdram.c   |   53 +--
 arch/x86/cpu/interrupts.c   |   31 +
 arch/x86/cpu/start.S|   10 -
 arch/x86/cpu/start16.S  |3 +
 arch/x86/dts/coreboot.dtsi  |   16 +++
 arch/x86/dts/skeleton.dtsi  |   13 ++
 arch/x86/include/asm/global_data.h  |6 +++
 arch/x86/include/asm/init_helpers.h |1 +
 arch/x86/include/asm/u-boot-x86.h   |1 -
 arch/x86/lib/board.c|   10 
 arch/x86/lib/init_helpers.c |   50 +++---
 arch/x86/lib/init_wrappers.c|   28 -
 arch/x86/lib/relocate.c |2 +-
 drivers/video/cfb_console.c |5 +-
 include/configs/coreboot.h  |   10 +++-
 19 files changed, 287 insertions(+), 31 deletions(-)
 rename arch/x86/cpu/coreboot/{coreboot_car.S = car.S} (100%)
 create mode 100644 arch/x86/cpu/coreboot/config.mk
 create mode 100644 arch/x86/dts/coreboot.dtsi
 create mode 100644 arch/x86/dts/skeleton.dtsi

-- 
1.7.7.3

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


[U-Boot] [PATCH 02/20] x86: Reorder x86's post relocation memory layout

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

This changes the layout in decreasing addresses from:

1. Stack
2. Sections in the image
3. Heap

to

1. Sections in the image
2. Heap
3. Stack

This allows the stack to grow significantly more since it isn't constrained by
the other u-boot areas. More importantly, the generic memory wipe code assumes
that the stack is the lowest addressed area used by the main part of u-boot.
In the original layout, that means that u-boot tramples all over itself. In
the new layout, it works.

Signed-off-by: Gabe Black gabebl...@google.com
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/lib/init_helpers.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 4a6d9f3..6032ee5 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -96,16 +96,15 @@ int calculate_relocation_address(void)
dest_addr = ~15;
gd-gdt_addr = dest_addr;
 
-   /* Stack is below GDT */
-   gd-start_addr_sp = dest_addr;
-
-   /* U-Boot is below the stack */
-   dest_addr -= CONFIG_SYS_STACK_SIZE;
+   /* U-Boot is below Global Data */
dest_addr -= (bss_end - text_start);
dest_addr = ~15;
gd-relocaddr = dest_addr;
gd-reloc_off = (dest_addr - text_start);
 
+   /* Stack is at the bottom, so it can grow down */
+   gd-start_addr_sp = dest_addr - CONFIG_SYS_MALLOC_LEN;
+
return 0;
 }
 
-- 
1.7.7.3

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


[U-Boot] [PATCH 03/20] x86: Make the upper bound on relocated symbols closed instead of open

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

This seems to be a bug.

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/lib/relocate.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
index c0b9b29..23edca9 100644
--- a/arch/x86/lib/relocate.c
+++ b/arch/x86/lib/relocate.c
@@ -80,7 +80,7 @@ int do_elf_reloc_fixups(void)
 
/* Check that the target points into .text */
if (*offset_ptr_ram = CONFIG_SYS_TEXT_BASE 
-   *offset_ptr_ram 
+   *offset_ptr_ram =
(CONFIG_SYS_TEXT_BASE + size)) {
*offset_ptr_ram += gd-reloc_off;
}
-- 
1.7.7.3

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


[U-Boot] [PATCH 11/20] x86: Emit port 80 post codes in show_boot_progress()

2012-11-03 Thread Simon Glass
From: Stefan Reinauer reina...@chromium.org

This helps us monitor boot progress and determine where U-Boot dies if
there are any problems.

Signed-off-by: Stefan Reinauer reina...@google.com

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/coreboot.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index d1be8ff..2912443 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -28,6 +28,7 @@
 #include netdev.h
 #include asm/msr.h
 #include asm/cache.h
+#include asm/io.h
 #include asm/arch-coreboot/tables.h
 #include asm/arch-coreboot/sysinfo.h
 #include asm/arch/timestamp.h
@@ -68,6 +69,7 @@ int board_early_init_r(void)
 
 void show_boot_progress(int val)
 {
+   outb(val, 0x80);
 }
 
 
-- 
1.7.7.3

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


[U-Boot] [PATCH 10/20] x86: fdt: Create basic .dtsi file for coreboot

2012-11-03 Thread Simon Glass
This contains just the minimum information for a coreboot-based board.

Signed-off-by: Stefan Reinauer reina...@chromium.org
Signed-off-by: Gabe Black gabebl...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/dts/coreboot.dtsi |   16 
 arch/x86/dts/skeleton.dtsi |   13 +
 2 files changed, 29 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/dts/coreboot.dtsi
 create mode 100644 arch/x86/dts/skeleton.dtsi

diff --git a/arch/x86/dts/coreboot.dtsi b/arch/x86/dts/coreboot.dtsi
new file mode 100644
index 000..4862a59
--- /dev/null
+++ b/arch/x86/dts/coreboot.dtsi
@@ -0,0 +1,16 @@
+/include/ skeleton.dtsi
+
+/ {
+   aliases {
+   console = /serial;
+   };
+
+   serial {
+   compatible = ns16550;
+   reg-shift = 1;
+   io-mapped = 1;
+   multiplier = 1;
+   baudrate = 115200;
+   status = disabled;
+   };
+};
diff --git a/arch/x86/dts/skeleton.dtsi b/arch/x86/dts/skeleton.dtsi
new file mode 100644
index 000..b41d241
--- /dev/null
+++ b/arch/x86/dts/skeleton.dtsi
@@ -0,0 +1,13 @@
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value.  The bootloader will typically populate the memory
+ * node.
+ */
+
+/ {
+   #address-cells = 1;
+   #size-cells = 1;
+   chosen { };
+   aliases { };
+   memory { device_type = memory; reg = 0 0; };
+};
-- 
1.7.7.3

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


[U-Boot] [PATCH 16/20] x86: Remove coreboot_ from file name

2012-11-03 Thread Simon Glass
From: Stefan Reinauer reina...@chromium.org

... because that information is already encoded in the directory name.

Signed-off-by: Stefan Reinauer reina...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/Makefile  |3 +--
 arch/x86/cpu/coreboot/{coreboot_car.S = car.S} |0
 2 files changed, 1 insertions(+), 2 deletions(-)
 rename arch/x86/cpu/coreboot/{coreboot_car.S = car.S} (100%)

diff --git a/arch/x86/cpu/coreboot/Makefile b/arch/x86/cpu/coreboot/Makefile
index 4612a3e..b1d3e95 100644
--- a/arch/x86/cpu/coreboot/Makefile
+++ b/arch/x86/cpu/coreboot/Makefile
@@ -33,6 +33,7 @@ include $(TOPDIR)/config.mk
 
 LIB:= $(obj)lib$(SOC).o
 
+SOBJS-$(CONFIG_SYS_COREBOOT) += car.o
 COBJS-$(CONFIG_SYS_COREBOOT) += coreboot.o
 COBJS-$(CONFIG_SYS_COREBOOT) += tables.o
 COBJS-$(CONFIG_SYS_COREBOOT) += ipchecksum.o
@@ -40,8 +41,6 @@ COBJS-$(CONFIG_SYS_COREBOOT) += sdram.o
 COBJS-$(CONFIG_SYS_COREBOOT) += timestamp.o
 COBJS-$(CONFIG_PCI) += pci.o
 
-SOBJS-$(CONFIG_SYS_COREBOOT) += coreboot_car.o
-
 SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 
diff --git a/arch/x86/cpu/coreboot/coreboot_car.S b/arch/x86/cpu/coreboot/car.S
similarity index 100%
rename from arch/x86/cpu/coreboot/coreboot_car.S
rename to arch/x86/cpu/coreboot/car.S
-- 
1.7.7.3

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


[U-Boot] [PATCH 14/20] x86: Provide tick counter and frequency reference for Intel core architecture

2012-11-03 Thread Simon Glass
From: Vadim Bendebury vben...@chromium.org

Some u-boot modules rely on availability of get_ticks() and
get_tbclk() functions, reporting a free running clock and its
frequency respectively. Traditionally these functions return number
and frequency of timer interrupts.

Intel's core architecture processors however are known to run the
rdtsc instruction at a constant rate of the so called 'Max Non Turbo
ratio' times the external clock frequency which is 100MHz. This is
just as good for the timer tick functions in question.

Signed-off-by: Vadim Bendebury vben...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/interrupts.c |   31 +++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
index 710b653..f841834 100644
--- a/arch/x86/cpu/interrupts.c
+++ b/arch/x86/cpu/interrupts.c
@@ -33,6 +33,8 @@
 #include asm/io.h
 #include asm/processor-flags.h
 #include linux/compiler.h
+#include asm/msr.h
+#include asm/u-boot-x86.h
 
 #define DECLARE_INTERRUPT(x) \
.globl irq_#x\n \
@@ -673,3 +675,32 @@ asm(.globl irq_common_entry\n \
DECLARE_INTERRUPT(253) \
DECLARE_INTERRUPT(254) \
DECLARE_INTERRUPT(255));
+
+#if defined(CONFIG_INTEL_CORE_ARCH)
+/*
+ * Get the number of CPU time counter ticks since it was read first time after
+ * restart. This yields a free running counter guaranteed to take almost 6
+ * years to wrap around even at 100GHz clock rate.
+ */
+u64 get_ticks(void)
+{
+   static u64 tick_base;
+   u64 now_tick = rdtsc();
+
+   if (!tick_base)
+   tick_base = now_tick;
+
+   return now_tick - tick_base;
+}
+
+#define PLATFORM_INFO_MSR 0xce
+
+unsigned long get_tbclk(void)
+{
+   u32 ratio;
+   u64 platform_info = rdmsr(PLATFORM_INFO_MSR);
+
+   ratio = (platform_info  8)  0xff;
+   return 100 * 1000 * 1000 * ratio; /* 100MHz times Max Non Turbo ratio */
+}
+#endif
-- 
1.7.7.3

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


[U-Boot] [PATCH 09/20] x86: coreboot: Set CONFIG_ARCH_DEVICE_TREE correctly

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

We will use coreboot.dtsi as our fdt include file.

Signed-off-by: Gabe Black gabebl...@chromium.org

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/config.mk |   23 +++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/cpu/coreboot/config.mk

diff --git a/arch/x86/cpu/coreboot/config.mk b/arch/x86/cpu/coreboot/config.mk
new file mode 100644
index 000..4858fc3
--- /dev/null
+++ b/arch/x86/cpu/coreboot/config.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2012 The Chromium OS Authors.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+CONFIG_ARCH_DEVICE_TREE := coreboot
-- 
1.7.7.3

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


[U-Boot] [PATCH 20/20] x86: coreboot: Enable video display

2012-11-03 Thread Simon Glass
Enable the display on coreboot, using CFB.

Signed-off-by: Simon Glass s...@chromium.org
---
 include/configs/coreboot.h |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index 7c9c7e4..e62d7aa 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -59,6 +59,7 @@
  */
 #define CONFIG_RTC_MC146818
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS 0
+#define CONFIG_SYS_ISA_IO  CONFIG_SYS_ISA_IO_BASE_ADDRESS
 
 /*---
  * Serial Configuration
@@ -108,8 +109,13 @@
 /*---
  * Video Configuration
  */
-#undef CONFIG_VIDEO
-#undef CONFIG_CFB_CONSOLE
+#define CONFIG_VIDEO
+#define CONFIG_VIDEO_COREBOOT
+#define CONFIG_VIDEO_SW_CURSOR
+#define VIDEO_FB_16BPP_WORD_SWAP
+#define CONFIG_I8042_KBD
+#define CONFIG_CFB_CONSOLE
+#define CONFIG_SYS_CONSOLE_INFO_QUIET
 
 /*---
  * Command line configuration.
-- 
1.7.7.3

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


[U-Boot] [PATCH 19/20] x86: Remove video_init() prototype from u-boot-x86.h

2012-11-03 Thread Simon Glass
This function is not intended to be exported from the video drivers, so
remove the prototype. This fixes an error:

cfb_console.c:1793:12: error: static declaration of 'video_init' follows 
non-static declaration

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/include/asm/u-boot-x86.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/u-boot-x86.h 
b/arch/x86/include/asm/u-boot-x86.h
index 11be5c3..99062e5 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -63,7 +63,6 @@ u32 isa_map_rom(u32 bus_addr, int size);
 
 /* arch/x86/lib/... */
 int video_bios_init(void);
-int video_init(void);
 
 void   board_init_f_r_trampoline(ulong) __attribute__ ((noreturn));
 void   board_init_f_r(void) __attribute__ ((noreturn));
-- 
1.7.7.3

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


[U-Boot] [PATCH 07/20] x86: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading

2012-11-03 Thread Simon Glass
From: Stefan Reinauer reina...@chromium.org

This option delays loading of the environment until later, so that only the
default environment will be available to U-Boot.

This can address the security risk of untrusted data being used during boot.

When CONFIG_DELAY_ENVIRONMENT is defined, it is convenient to have a
run-time way of enabling loadinlg of the environment. Add this to the
fdt as /config/delay-environment.

Note: This patch depends on http://patchwork.ozlabs.org/patch/194342/

Signed-off-by: Simon Glass s...@chromium.org
Signed-off-by: Stefan Reinauer reina...@chromium.org
---
 arch/x86/lib/init_wrappers.c |   28 +++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/init_wrappers.c b/arch/x86/lib/init_wrappers.c
index 71449fe..cca018f 100644
--- a/arch/x86/lib/init_wrappers.c
+++ b/arch/x86/lib/init_wrappers.c
@@ -21,6 +21,7 @@
  * MA 02111-1307 USA
  */
 #include common.h
+#include environment.h
 #include serial.h
 #include kgdb.h
 #include scsi.h
@@ -36,10 +37,35 @@ int serial_initialize_r(void)
return 0;
 }
 
+/*
+ * Tell if it's OK to load the environment early in boot.
+ *
+ * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see
+ * if this is OK (defaulting to saying it's not OK).
+ *
+ * NOTE: Loading the environment early can be a bad idea if security is
+ *   important, since no verification is done on the environment.
+ *
+ * @return 0 if environment should not be loaded, !=0 if it is ok to load
+ */
+static int should_load_env(void)
+{
+#ifdef CONFIG_OF_CONTROL
+   return fdtdec_get_config_int(gd-fdt_blob, load-environment, 0);
+#elif defined CONFIG_DELAY_ENVIRONMENT
+   return 0;
+#else
+   return 1;
+#endif
+}
+
 int env_relocate_r(void)
 {
/* initialize environment */
-   env_relocate();
+   if (should_load_env())
+   env_relocate();
+   else
+   set_default_env(NULL);
 
return 0;
 }
-- 
1.7.7.3

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


[U-Boot] [PATCH 08/20] x86: Add support for CONFIG_OF_CONTROL

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

Allow a device tree to be provided through the standard mechanisms.

Signed-off-by: Gabe Black gabebl...@google.com
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/lib/board.c|7 +++
 arch/x86/lib/init_helpers.c |   29 +
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index e0c5419..3093ea5 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -98,10 +98,17 @@ typedef int (init_fnc_t) (void);
 init_fnc_t *init_sequence_f[] = {
cpu_init_f,
board_early_init_f,
+#ifdef CONFIG_OF_CONTROL
+   find_fdt,
+   fdtdec_check_fdt,
+#endif
env_init,
init_baudrate_f,
serial_init,
console_init_f,
+#ifdef CONFIG_OF_CONTROL
+   prepare_fdt,
+#endif
dram_init_f,
calculate_relocation_address,
 
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index fc28af7..4a94d96 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -205,3 +205,32 @@ int init_func_spi(void)
puts(ready\n);
return 0;
 }
+
+#ifdef CONFIG_OF_CONTROL
+int find_fdt(void)
+{
+#ifdef CONFIG_OF_EMBED
+   /* Get a pointer to the FDT */
+   gd-fdt_blob = _binary_dt_dtb_start;
+#elif defined CONFIG_OF_SEPARATE
+   /* FDT is at end of image */
+   gd-fdt_blob = (void *)(_end_ofs + _TEXT_BASE);
+#endif
+   /* Allow the early environment to override the fdt address */
+   gd-fdt_blob = (void *)getenv_ulong(fdtcontroladdr, 16,
+   (uintptr_t)gd-fdt_blob);
+
+   return 0;
+}
+
+int prepare_fdt(void)
+{
+   /* For now, put this check after the console is ready */
+   if (fdtdec_prepare_fdt()) {
+   panic(** CONFIG_OF_CONTROL defined but no FDT - please see 
+   doc/README.fdt-control);
+   }
+
+   return 0;
+}
+#endif
-- 
1.7.7.3

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


[U-Boot] [PATCH 18/20] video: Check for valid FB pointer before clearing

2012-11-03 Thread Simon Glass
From: Duncan Laurie dlau...@chromium.org

This command will start erasing at memory address zero
if there is not a valid framebuffer address that was found
during video_init().

This is a common case with Chrome OS devices in normal mode
when we do not execute the video option rom in coreboot.

Signed-off-by: Duncan Laurie dlau...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 drivers/video/cfb_console.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index c8d3e42..2b1f604 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1976,6 +1976,7 @@ int video_get_screen_columns(void)
 
 void video_clear(void)
 {
-   memsetl(video_fb_address,
-   (VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), 0);
+   if (video_fb_address)
+   memsetl(video_fb_address,
+   (VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), 0);
 }
-- 
1.7.7.3

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


[U-Boot] [PATCH 01/20] x86: Initialise SPI if enabled

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

If we have SPI support, make sure that we init it.

Signed-off-by: Gabe Black gabebl...@google.com
Signed-off-by: Simon Glass s...@chromium.org
Signed-off-by: Vic Yang victory...@chromium.org
---
 arch/x86/include/asm/init_helpers.h |1 +
 arch/x86/lib/board.c|3 +++
 arch/x86/lib/init_helpers.c |9 +
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/init_helpers.h 
b/arch/x86/include/asm/init_helpers.h
index 8afb443..4ea6536 100644
--- a/arch/x86/include/asm/init_helpers.h
+++ b/arch/x86/include/asm/init_helpers.h
@@ -38,5 +38,6 @@ int init_bd_struct_r(void);
 int flash_init_r(void);
 int status_led_set_r(void);
 int set_load_addr_r(void);
+int init_func_spi(void);
 
 #endif /* !_INIT_HELPERS_H_ */
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index e5caf13..e0c5419 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -154,6 +154,9 @@ init_fnc_t *init_sequence_r[] = {
 #ifndef CONFIG_SYS_NO_FLASH
flash_init_r,
 #endif
+#ifdef CONFIG_SPI
+   init_func_spi;
+#endif
env_relocate_r,
 #ifdef CONFIG_PCI
pci_init_r,
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 1863209..4a6d9f3 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -28,6 +28,7 @@
 #include net.h
 #include ide.h
 #include serial.h
+#include spi.h
 #include status_led.h
 #include asm/processor.h
 #include asm/u-boot-x86.h
@@ -196,3 +197,11 @@ int set_load_addr_r(void)
 
return 0;
 }
+
+int init_func_spi(void)
+{
+   puts(SPI:   );
+   spi_init();
+   puts(ready\n);
+   return 0;
+}
-- 
1.7.7.3

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


[U-Boot] [PATCH 12/20] x86: Fix MTRR clear to detect which MTRR to use

2012-11-03 Thread Simon Glass
From: Duncan Laurie dlau...@chromium.org

Coreboot was always using MTRR 7 for the write-protect
cache entry that covers the ROM and U-boot was removing it.
However with 4GB configs we need more MTRRs for the BIOS
and so the WP MTRR needs to move.  Instead coreboot will
always use the last available MTRR that is normally set
aside for OS use and U-boot can clear it before the OS.

Signed-off-by: Duncan Laurie dlau...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/coreboot.c |   19 +++
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index 2912443..ff42661 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -94,6 +94,8 @@ void setup_pcat_compatibility()
 {
 }
 
+#define MTRR_TYPE_WP  5
+#define MTRRcap_MSR   0xfe
 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
 
@@ -101,11 +103,20 @@ int board_final_cleanup(void)
 {
/* Un-cache the ROM so the kernel has one
 * more MTRR available.
+*
+* Coreboot should have assigned this to the
+* top available variable MTRR.
 */
-   disable_cache();
-   wrmsr(MTRRphysBase_MSR(7), 0);
-   wrmsr(MTRRphysMask_MSR(7), 0);
-   enable_cache();
+   u8 top_mtrr = (rdmsr(MTRRcap_MSR)  0xff) - 1;
+   u8 top_type = rdmsr(MTRRphysBase_MSR(top_mtrr))  0xff;
+
+   /* Make sure this MTRR is the correct Write-Protected type */
+   if (top_type == MTRR_TYPE_WP) {
+   disable_cache();
+   wrmsr(MTRRphysBase_MSR(top_mtrr), 0);
+   wrmsr(MTRRphysMask_MSR(top_mtrr), 0);
+   enable_cache();
+   }
 
return 0;
 }
-- 
1.7.7.3

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


[U-Boot] [PATCH 05/20] x86: Override calculate_relocation_address to use the e820 map

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

Because calculate_relocation_address now uses the e820 map, it will be able
to avoid addresses over 32 bits and regions that are at high addresses but
not big enough for U-Boot. It also means we can remove the hack which
limitted U-Boot's idea of the size of memory to less than 4GB.

Also take into account the space needed for the heap and stack, so we avoid
picking a very small region those areas might overlap with something it
shouldn't.

Signed-off-by: Gabe Black gabebl...@google.com
Signed-off-by: Gabe Black gabebl...@google.com
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/sdram.c |   53 +---
 1 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
index 5d3da99..611f554 100644
--- a/arch/x86/cpu/coreboot/sdram.c
+++ b/arch/x86/cpu/coreboot/sdram.c
@@ -51,6 +51,55 @@ unsigned install_e820_map(unsigned max_entries, struct 
e820entry *entries)
return num_entries;
 }
 
+/*
+ * This function looks for the highest region of memory lower than 4GB which
+ * has enough space for U-Boot where U-Boot is aligned on a page boundary. It
+ * overrides the default implementation found elsewhere which simply picks the
+ * end of ram, wherever that may be. The location of the stack, the relocation
+ * address, and how far U-Boot is moved by relocation are set in the global
+ * data structure.
+ */
+int calculate_relocation_address(void)
+{
+   const uint64_t uboot_size = __bss_end - __text_start;
+   const uint64_t total_size = uboot_size + CONFIG_SYS_MALLOC_LEN +
+   CONFIG_SYS_STACK_SIZE;
+   uintptr_t dest_addr = 0;
+   int i;
+
+   for (i = 0; i  lib_sysinfo.n_memranges; i++) {
+   struct memrange *memrange = lib_sysinfo.memrange[i];
+   /* Force U-Boot to relocate to a page aligned address. */
+   uint64_t start = roundup(memrange-base, 1  12);
+   uint64_t end = memrange-base + memrange-size;
+
+   /* Ignore non-memory regions. */
+   if (memrange-type != CB_MEM_RAM)
+   continue;
+
+   /* Filter memory over 4GB. */
+   if (end  0xULL)
+   end = 0x1ULL;
+   /* Skip this region if it's too small. */
+   if (end - start  total_size)
+   continue;
+
+   /* Use this address if it's the largest so far. */
+   if (end - uboot_size  dest_addr)
+   dest_addr = (end - uboot_size)  ~((1  12) - 1);
+   }
+
+   /* If no suitable area was found, return an error. */
+   if (!dest_addr)
+   return 1;
+
+   gd-start_addr_sp = dest_addr - CONFIG_SYS_MALLOC_LEN;
+   gd-relocaddr = dest_addr;
+   gd-reloc_off = dest_addr - (uintptr_t)__text_start;
+
+   return 0;
+}
+
 int dram_init_f(void)
 {
int i;
@@ -60,10 +109,6 @@ int dram_init_f(void)
struct memrange *memrange = lib_sysinfo.memrange[i];
unsigned long long end = memrange-base + memrange-size;
 
-   /* Ignore memory over 4GB, we can't use it. */
-   if (memrange-base  0x)
-   continue;
-
if (memrange-type == CB_MEM_RAM  end  ram_size)
ram_size = end;
}
-- 
1.7.7.3

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


[U-Boot] [PATCH 17/20] x86: drop unused code in coreboot.c

2012-11-03 Thread Simon Glass
From: Stefan Reinauer reina...@chromium.org

The function setup_pcat_compatibility() is weak and implemented as empty
function in board.c hence we don't have to override that with another
empty function.

monitor_flash_len is unused, drop it.

Signed-off-by: Stefan Reinauer reina...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/coreboot.c |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index da722e9..a3a1a4e 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -35,8 +35,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;
-
 /*
  * Miscellaneous platform dependent initializations
  */
@@ -93,7 +91,6 @@ void show_boot_progress(int val)
outb(val, 0x80);
 }
 
-
 int last_stage_init(void)
 {
return 0;
@@ -111,10 +108,6 @@ int board_eth_init(bd_t *bis)
return pci_eth_init(bis);
 }
 
-void setup_pcat_compatibility()
-{
-}
-
 #define MTRR_TYPE_WP  5
 #define MTRRcap_MSR   0xfe
 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
-- 
1.7.7.3

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


[U-Boot] [PATCH 06/20] x86: Add back cold- and warm-boot flags

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

These were removed, but actually are useful.

Cold means that we started from a reset/power on.
Warm means that we started from another U-Boot.

We determine whether u-boot on x86 was warm or cold booted (really if
it started at the beginning of the text segment or at the ELF entry point).
We plumb the result through to the global data structure.

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/start.S   |   10 +-
 arch/x86/cpu/start16.S |3 +++
 arch/x86/include/asm/global_data.h |6 ++
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index ee0dabe..acdd054 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -55,8 +55,16 @@ _x86boot_start:
movl%eax, %cr0
wbinvd
 
+   /* Tell 32-bit code it is being entered from an in-RAM copy */
+   movw$GD_FLG_WARM_BOOT, %bx
+   jmp 1f
 _start:
-   /* This is the 32-bit cold-reset entry point */
+   /*
+* This is the 32-bit cold-reset entry point. Initialize %bx to 0
+* in case we're preceeded by some sort of boot stub.
+*/
+   movw$GD_FLG_COLD_BOOT, %bx
+1:
 
/* Load the segement registes to match the gdt loaded in start16.S */
movl$(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax
diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S
index cc393ff..603bf1d 100644
--- a/arch/x86/cpu/start16.S
+++ b/arch/x86/cpu/start16.S
@@ -37,6 +37,9 @@
 .code16
 .globl start16
 start16:
+   /* Set the Cold Boot / Hard Reset flag */
+   movl$GD_FLG_COLD_BOOT, %ebx
+
/*
 * First we let the BSP do some early initialization
 * this code have to map the flash to its final position
diff --git a/arch/x86/include/asm/global_data.h 
b/arch/x86/include/asm/global_data.h
index d3b6031..b3a6b50 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -77,6 +77,12 @@ static inline gd_t *get_fs_gd_ptr(void)
 
 #include asm-generic/global_data_flags.h
 
+/*
+ * Our private Global Data Flags
+ */
+#define GD_FLG_COLD_BOOT   0x00100 /* Cold Boot */
+#define GD_FLG_WARM_BOOT   0x00200 /* Warm Boot */
+
 #define DECLARE_GLOBAL_DATA_PTR
 
 #endif /* __ASM_GBL_DATA_H */
-- 
1.7.7.3

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


[U-Boot] [PATCH 13/20] x86: Issue SMI to finalize Coreboot in final stage

2012-11-03 Thread Simon Glass
From: Duncan Laurie dlau...@chromium.org

This will write magic value to APMC command port which
will trigger an SMI and cause coreboot to lock down
the ME, chipset, and CPU.

Signed-off-by: Duncan Laurie dlau...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/coreboot.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index ff42661..59d730e 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -118,5 +118,9 @@ int board_final_cleanup(void)
enable_cache();
}
 
+   /* Issue SMI to Coreboot to lock down ME and registers */
+   printf(Finalizing Coreboot\n);
+   outb(0xcb, 0xb2);
+
return 0;
 }
-- 
1.7.7.3

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


[U-Boot] [PATCH 04/20] x86: Make calculate_relocation_address an overridable function

2012-11-03 Thread Simon Glass
From: Gabe Black gabebl...@chromium.org

Different systems may have different mechanisms for picking a suitable place
to relocate U-Boot to.

Signed-off-by: Gabe Black gabebl...@chromium.org

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/lib/init_helpers.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 6032ee5..fc28af7 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -32,6 +32,7 @@
 #include status_led.h
 #include asm/processor.h
 #include asm/u-boot-x86.h
+#include linux/compiler.h
 
 #include asm/init_helpers.h
 
@@ -72,7 +73,7 @@ int init_baudrate_f(void)
return 0;
 }
 
-int calculate_relocation_address(void)
+__weak int calculate_relocation_address(void)
 {
ulong text_start = (ulong)__text_start;
/* keep .bss variables aligned */
-- 
1.7.7.3

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


[U-Boot] [PATCH 15/20] x86: Provide a way to throttle port80 accesses

2012-11-03 Thread Simon Glass
From: Vadim Bendebury vben...@chromium.org

Some systems (like Google Link device) provide the ability to keep a
history of the target CPU port80 accesses, which is extremely handy
for debugging. The problem is that the EC handling port 80 access is
orders of magnitude slower than the AP. This causes random loss of
trace data.

This change allows to throttle port 80 accesses such that in case the
AP is trying to post faster than the EC can handle, a delay is
introduced to make sure that the post rate is throttled. Experiments
have shown that on Link the delay should be at least 350,000 of tsc
clocks.

Throttling is not being enabled by default: to enable it one would
have to set MIN_PORT80_KCLOCKS_DELAY to something like 400 and rebuild
the u-boot image. With upcoming EC code optimizations this number
could be decreased (new new value should be established
experimentally).

Signed-off-by: Vadim Bendebury vben...@chromium.org
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/x86/cpu/coreboot/coreboot.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index 59d730e..da722e9 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -69,6 +69,27 @@ int board_early_init_r(void)
 
 void show_boot_progress(int val)
 {
+#if MIN_PORT80_KCLOCKS_DELAY
+   static uint32_t prev_stamp;
+   static uint32_t base;
+
+   /*
+* Scale the time counter reading to avoid using 64 bit arithmetics.
+* Can't use get_timer() here becuase it could be not yet
+* initialized or even implemented.
+*/
+   if (!prev_stamp) {
+   base = rdtsc() / 1000;
+   prev_stamp = 0;
+   } else {
+   uint32_t now;
+
+   do {
+   now = rdtsc() / 1000 - base;
+   } while (now  (prev_stamp + MIN_PORT80_KCLOCKS_DELAY));
+   prev_stamp = now;
+   }
+#endif
outb(val, 0x80);
 }
 
-- 
1.7.7.3

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


[U-Boot] [PATCH 1/3] lzma: update to lzma sdk 9.20

2012-11-03 Thread Simon Glass
From: Stefan Reinauer reina...@chromium.org

Updated code taken from latest lzma sdk release 9.20 at
http://downloads.sourceforge.net/sevenzip/lzma920.tar.bz2

This generates quite a lot of checkpatch warnings, but I guess we
need to keep the code style as is to avoid a massive job each time we
update this.

Signed-off-by: Stefan Reinauer reina...@google.com

Signed-off-by: Simon Glass s...@chromium.org
---
 lib/lzma/LzmaDec.c   |   14 +++---
 lib/lzma/LzmaDec.h   |6 +++---
 lib/lzma/Types.h |   36 +++-
 lib/lzma/history.txt |   35 +++
 lib/lzma/lzma.txt|   34 +++---
 5 files changed, 91 insertions(+), 34 deletions(-)

diff --git a/lib/lzma/LzmaDec.c b/lib/lzma/LzmaDec.c
index f941da2..4f45f80 100644
--- a/lib/lzma/LzmaDec.c
+++ b/lib/lzma/LzmaDec.c
@@ -1,5 +1,5 @@
 /* LzmaDec.c -- LZMA Decoder
-2008-11-06 : Igor Pavlov : Public domain */
+2009-09-20 : Igor Pavlov : Public domain */
 
 #include config.h
 #include common.h
@@ -116,12 +116,6 @@
 StopCompilingDueBUG
 #endif
 
-static const Byte kLiteralNextStates[kNumStates * 2] =
-{
-  0, 0, 0, 0, 1, 2, 3,  4,  5,  6,  4,  5,
-  7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10
-};
-
 #define LZMA_DIC_MIN (1  12)
 
 /* First LZMA-symbol is always decoded.
@@ -180,6 +174,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, 
SizeT limit, const Byte
 
   if (state  kNumLitStates)
   {
+state -= (state  4) ? state : 3;
 symbol = 1;
 
 WATCHDOG_RESET();
@@ -190,6 +185,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, 
SizeT limit, const Byte
   {
 unsigned matchByte = p-dic[(dicPos - rep0) + ((dicPos  rep0) ? 
dicBufSize : 0)];
 unsigned offs = 0x100;
+state -= (state  10) ? 3 : 6;
 symbol = 1;
 
 WATCHDOG_RESET();
@@ -207,9 +203,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, 
SizeT limit, const Byte
   }
   dic[dicPos++] = (Byte)symbol;
   processedPos++;
-
-  state = kLiteralNextStates[state];
-  /* if (state  4) state = 0; else if (state  10) state -= 3; else state 
-= 6; */
   continue;
 }
 else
@@ -395,7 +388,6 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, 
SizeT limit, const Byte
 else if (distance = checkDicSize)
   return SZ_ERROR_DATA;
 state = (state  kNumStates + kNumLitStates) ? kNumLitStates : 
kNumLitStates + 3;
-/* state = kLiteralNextStates[state]; */
   }
 
   len += kMatchMinLen;
diff --git a/lib/lzma/LzmaDec.h b/lib/lzma/LzmaDec.h
index 7fba87f..63aa505 100644
--- a/lib/lzma/LzmaDec.h
+++ b/lib/lzma/LzmaDec.h
@@ -1,8 +1,8 @@
 /* LzmaDec.h -- LZMA Decoder
-2008-10-04 : Igor Pavlov : Public domain */
+2009-02-07 : Igor Pavlov : Public domain */
 
-#ifndef __LZMADEC_H
-#define __LZMADEC_H
+#ifndef __LZMA_DEC_H
+#define __LZMA_DEC_H
 
 #include Types.h
 
diff --git a/lib/lzma/Types.h b/lib/lzma/Types.h
index 1af5cfc..8afcba5 100644
--- a/lib/lzma/Types.h
+++ b/lib/lzma/Types.h
@@ -1,5 +1,5 @@
 /* Types.h -- Basic types
-2008-11-23 : Igor Pavlov : Public domain */
+2010-10-09 : Igor Pavlov : Public domain */
 
 #ifndef __7Z_TYPES_H
 #define __7Z_TYPES_H
@@ -65,9 +65,11 @@ typedef unsigned long UInt64;
 #if defined(_MSC_VER) || defined(__BORLANDC__)
 typedef __int64 Int64;
 typedef unsigned __int64 UInt64;
+#define UINT64_CONST(n) n
 #else
 typedef long long int Int64;
 typedef unsigned long long int UInt64;
+#define UINT64_CONST(n) n ## ULL
 #endif
 
 #endif
@@ -92,13 +94,11 @@ typedef int Bool;
 #endif
 
 #define MY_CDECL __cdecl
-#define MY_STD_CALL __stdcall
-#define MY_FAST_CALL MY_NO_INLINE __fastcall
+#define MY_FAST_CALL __fastcall
 
 #else
 
 #define MY_CDECL
-#define MY_STD_CALL
 #define MY_FAST_CALL
 
 #endif
@@ -108,6 +108,16 @@ typedef int Bool;
 
 typedef struct
 {
+  Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error 
*/
+} IByteIn;
+
+typedef struct
+{
+  void (*Write)(void *p, Byte b);
+} IByteOut;
+
+typedef struct
+{
   SRes (*Read)(void *p, void *buf, size_t *size);
 /* if (input(*size) != 0  output(*size) == 0) means end_of_stream.
(output(*size)  input(*size)) is allowed */
@@ -140,7 +150,7 @@ typedef struct
 
 typedef struct
 {
-  SRes (*Look)(void *p, void **buf, size_t *size);
+  SRes (*Look)(void *p, const void **buf, size_t *size);
 /* if (input(*size) != 0  output(*size) == 0) means end_of_stream.
(output(*size)  input(*size)) is not allowed
(output(*size)  input(*size)) is allowed */
@@ -205,4 +215,20 @@ typedef struct
 #define IAlloc_Alloc(p, size) (p)-Alloc((p), size)
 #define IAlloc_Free(p, a) (p)-Free((p), a)
 
+#ifdef _WIN32
+
+#define CHAR_PATH_SEPARATOR '\\'
+#define WCHAR_PATH_SEPARATOR L'\\'
+#define STRING_PATH_SEPARATOR \\
+#define WSTRING_PATH_SEPARATOR L\\
+
+#else
+
+#define CHAR_PATH_SEPARATOR '/'
+#define WCHAR_PATH_SEPARATOR L'/'
+#define 

[U-Boot] [PATCH 2/3] md5: Fix gcc-4.7 build problem in md5

2012-11-03 Thread Simon Glass
From: Han Shen shen...@google.com

Fixed by replacing pointer casting with memcpy.

Signed-off-by: Simon Glass s...@chromium.org
---
 lib/md5.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lib/md5.c b/lib/md5.c
index 2ae4a06..9791e59 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -153,8 +153,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
byteReverse(ctx-in, 14);
 
/* Append length in bits and transform */
-   ctx-in32[14] = ctx-bits[0];
-   ctx-in32[15] = ctx-bits[1];
+   memcpy(ctx-in + 14 * sizeof(__u32), ctx-bits, 2 * sizeof(__u32));
 
MD5Transform(ctx-buf, (__u32 *) ctx-in);
byteReverse((unsigned char *) ctx-buf, 4);
-- 
1.7.7.3

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


[U-Boot] [PATCH 3/3] Add stricmp() and strnicmp()

2012-11-03 Thread Simon Glass
strnicmp() is present but disabled. Make it available and define stricmp()
also. There is a only a small performance penalty to having stricmp()
call strnicmp(), so do this instead of a standalone function, to save code
space.

BRANCH=none
Signed-off-by: Simon Glass s...@chromium.org
---
 include/linux/string.h |4 
 lib/string.c   |   12 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/linux/string.h b/include/linux/string.h
index 9a8cbc2..77fd1e9 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -20,6 +20,10 @@ extern __kernel_size_t strspn(const char *,const char *);
  */
 #include asm/string.h
 
+int strnicmp(const char *s1, const char *s2, size_t len);
+
+int stricmp(const char *s1, const char *s2);
+
 #ifndef __HAVE_ARCH_STRCPY
 extern char * strcpy(char *,const char *);
 #endif
diff --git a/lib/string.c b/lib/string.c
index c3ad055..f73df3f 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -21,7 +21,6 @@
 #include malloc.h
 
 
-#if 0 /* not used - was: #ifndef __HAVE_ARCH_STRNICMP */
 /**
  * strnicmp - Case insensitive, length-limited string comparison
  * @s1: One string
@@ -52,7 +51,16 @@ int strnicmp(const char *s1, const char *s2, size_t len)
}
return (int)c1 - (int)c2;
 }
-#endif
+
+/**
+ * stricmp - Case insensitive string comparison
+ * @s1: One string
+ * @s2: The other string
+ */
+int stricmp(const char *s1, const char *s2)
+{
+   return strnicmp(s1, s2, -1U);
+}
 
 char * ___strtok;
 
-- 
1.7.7.3

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


Re: [U-Boot] [PATCH 04/10] arm: Move fdt check earlier so that board_early_init_f() can use it

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 7:56 AM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 1351813330-23741-4-git-send-email-...@chromium.org you wrote:
 We want to use the fdt inside board_early_init_f(), so check for its
 presence earlier in the pre-reloc init sequence.

 Signed-off-by: Simon Glass s...@chromium.org
 ---
  arch/arm/lib/board.c |7 +++
  1 files changed, 3 insertions(+), 4 deletions(-)

 NAK as is.  Please make sure to keep all architectures in sync.  The
 long term goal is still to merge the lib/board.c files into a single,
 common one.

So far ARM and microblaze are the only only ones that use
CONFIG_OF_CONTROL. Microblaze does not have the same init loop, and in
particular does not have the board_early_init_f() call. So a patch for
microblaze would have no meaning.

I have just sent patches to the list to enable CONFIG_OF_CONTROL for
x86. I will make the same change to a v2 patch there, and squash it
in.

Regarding the generic board series, there was quite a bit of
discussion at the time and it ended up being more work than I had time
for then. Also I found it very difficult to find all the little errors
in board builds when i was making global changes across the tree. Now
that I have by builder and a bit more time I plan to take another look
at this, probably early next month. When I left it, I had pulled out
the common fields in global_data, and got everything building. But it
still needs work. I am keen to get this done since it is annoying to
have to send 14 patches every time you want to add a new feature!

So we don't have to take this patch, but it would be useful in the meantime.

Regards,
Simon


 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
 In the future, you're going to get computers as prizes  in  breakfast
 cereals.  You'll  throw  them out because your house will be littered
 with them. - Robert Lucky
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] MAKEALL: Fix kill_children

2012-11-03 Thread Tom Rini
On Tue, Oct 30, 2012 at 08:55:20PM -0500, Joe Hershberger wrote:

 When building in parallel, make sure that we look up the children
 based on the the actual process group id instead of just assuming
 that the MAKEALL pid is the process group id.
 
 Also ensure that logs from incomplete builds are deleted in the
 process.
 
 Signed-off-by: Joe Hershberger joe.hershber...@ni.com

Now I see:
/home/trini/bin/uboot-build.sh: line 110:  2024 Terminated
/usr/bin/time -o $TIMEFILE -f %e ./MAKEALL $SOC $MACHINE  $LOG 21

With my MAKEALL wrapper.  Anything we can do about that?

-- 
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] [PATCH v4 00/24] pmic: Redesign PMIC framework to support multiple instances of devices

2012-11-03 Thread Tom Rini
On Tue, Oct 30, 2012 at 05:56:55PM +0100, Lukasz Majewski wrote:

 PMIC framework has been redesigned to support multiple instances of power 
 related devices
 (e.g. fuel gauge, PMICs, chargers, micro USB IC, battery).

I _think_ this series is causing:
$ uboot-build.sh mx51_efikamx
Testing mx51_efikamx on -00522-gce00053-dirty
Sat Nov  3 15:55:17 MST 2012
Configuring for mx51_efikamx - Board: mx51_efikamx, Options:
MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg
efikamx.c:35:18: fatal error: pmic.h: No such file or directory
make: ***
[/home/trini/work/ssd/u-boot/u-boot/mx51_efikamx/board/genesi/mx51_efikamx/libmx51_efikamx.o]
Error 2
arm-linux-gnueabi-size: 'mx51_efikamx/u-boot': No such file
efikamx.c:35:18: fatal error: pmic.h: No such file or directory
compilation terminated.
make[1]: *** No rule to make target
`/home/trini/work/ssd/u-boot/u-boot/mx51_efikamx/board/genesi/mx51_efikamx/.depend',
needed by
`/home/trini/work/ssd/u-boot/u-boot/mx51_efikamx/board/genesi/mx51_efikamx/libmx51_efikamx.o'.
Stop.
make: ***
[/home/trini/work/ssd/u-boot/u-boot/mx51_efikamx/board/genesi/mx51_efikamx/libmx51_efikamx.o]
Error 2

In my local tree.  Can you reproduce?  Thanks!

-- 
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 PATCH 00/50] net: net subsystem ops cleanup

2012-11-03 Thread Tomas Hlavacek
Dear Wolfgang,

On Sat, Nov 3, 2012 at 4:09 PM, Wolfgang Denk w...@denx.de wrote:
 Dear Tomas Hlavacek,

 In message 1351876722-5183-1-git-send-email-tmshl...@gmail.com you wrote:
 This patchset is a first stage of preparation of the net subsystem
 for the driver model.

 The idea of this patchset is:
 1) Remove ops .init, .send, .recv and .halt from the eth_device struct.
Add a sparate structure eth_ops which is ready for inclusion
to DM core.
 2) Replace dynamic init of ops function pointers by static struct.
 3) Do minor style cleanup.

 Tomas Hlavacek (50):
   net: dm: Pull out ops from struct eth_device
   net: 4xx_enet: Pull out init of struct eth_ops
   net: altera_tse: Pull out init of struct eth_ops
   net: dm9000x: Pull out init of struct eth_ops
   net: armada100_fec: Pull out init of struct eth_ops

 Hm... looking at this patch series, I wonder if it is really
 bisectable?  Can I really apply any number of these patches (the first
 N, with N  50) and expect the code to build and to work?

It should be, because the first patch adds new struct eth_ops and
changes all accesses to its' members in one step. Patches 2 .. 50
remove dynamic ops settings and add static initialization to each
affected driver - one patch per driver. I would rather try that by
compiling U-Boot with only 1/50 applied and after some random N, say
30/50 to be absolutely sure. Let me get back later when I have my
MAKEALL results.

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


[U-Boot] [PATCH] mmc: add no simultaenous power and vdd

2012-11-03 Thread RgC
Bring in the code from Linux kernel.

Signed-off-by: RgC sessya...@gmail.com
CC: Andy Fleming aflem...@freescale.com

modified:   drivers/mmc/sdhci.c
modified:   include/sdhci.h
---
 drivers/mmc/sdhci.c | 3 +++
 include/sdhci.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 7845f87..b9cbe34 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -340,6 +340,9 @@ static void sdhci_set_power(struct sdhci_host *host, 
unsigned short power)
return;
}
 
+   if (host-quirks  SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER)
+   sdhci_writeb(host, pwr, SDHCI_POWER_CONTROL);
+
pwr |= SDHCI_POWER_ON;
 
sdhci_writeb(host, pwr, SDHCI_POWER_CONTROL);
diff --git a/include/sdhci.h b/include/sdhci.h
index c44793d..cffbe53 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -225,6 +225,7 @@
 #define SDHCI_QUIRK_BROKEN_VOLTAGE (1  4)
 #define SDHCI_QUIRK_NO_CD  (1  5)
 #define SDHCI_QUIRK_WAIT_SEND_CMD  (1  6)
+#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1  7)
 
 /* to make gcc happy */
 struct sdhci_host;
-- 
1.8.0



pgp2IHvMwZ1SW.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 1/3] tpm: Add casts for proper compilation

2012-11-03 Thread Wolfgang Denk
Dear Simon,

In message capnjgz0rv991pa7mevxr463g-tkka+rzf8gn7r0_zbznowo...@mail.gmail.com 
you wrote:
 
  I recommend to remove the whole TPM code instead.
 
 It is actually used in the x86 Chromebook, but the patch to enable it
 never made it to mainline. There was quite a bit of push-back on the
 x86 side at the time and the person working on it finally had enough
 :-(
 
 I have recently taken this up again to see if we can get x86 into a
 better state for newer Intel chips and the latest x86 Chromebooks. The
 patch to enable the TPM there is:
 
 http://patchwork.ozlabs.org/patch/190813/

I don;t see how this uses it in any way in U-Boot.  It still would not
even compile most of the code, right?

 I accept that it has sat there for a while without a board config to
 use it. But I would very much like to keep this code and see no sense
 in removing it now that it is actually in use.

Feel free to re-add it when there are any real users.

I've posted a removal patch.

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
...when fits of creativity run strong, more than  one  programmer  or
writer  has  been  known to abandon the desktop for the more spacious
floor. - Fred Brooks, Jr.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] TPM: remove dead code

2012-11-03 Thread Wolfgang Denk
Dear Simon,

In message CAPnjgZ0JLarq6r=she+cfbjkyuf6hrggp4br9u_asug14mz...@mail.gmail.com 
you wrote:
 
 On Sat, Nov 3, 2012 at 9:30 AM, Wolfgang Denk w...@denx.de wrote:
  The TPM code was added more than a year or 4 releases ago.  This was
  done under the proposition that board support that would actually use
  such code would be added soon.  However, nothing happened since.  The
  code has no users in mainline, and does not even get build for any
  configuration, so we cannot even tell if it compiles at all.
 
  Remove the unused code.  In in some far future actual users show up,
  it can be re-added easily.
 
 I think you may have missed the pending patches which make use of
 this. it is important functionality for the Chromebooks (secure boot).

No, I have not missed these.  But all the patch does is set
CONFIG_GENERIC_LPC_TPM - there is still not a single user defining
CONFIG_CMD_TPM, so what does this help?  We still have tons of dead
code around.  Dump it!

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
Unix: Some say the learning curve is steep,  but  you  only  have  to
climb it once.  - Karl Lehenbauer
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] Add stricmp() and strnicmp()

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351979121-3769-3-git-send-email-...@chromium.org you wrote:
 strnicmp() is present but disabled. Make it available and define stricmp()
 also. There is a only a small performance penalty to having stricmp()
 call strnicmp(), so do this instead of a standalone function, to save code
 space.
 
 BRANCH=none

Please get rid of such entries in the commit messages

Consider all patches that contain such entries as NAKed.

 +int strnicmp(const char *s1, const char *s2, size_t len);
 +
 +int stricmp(const char *s1, const char *s2);

Who are the users of this?   I object against adding dead code.

If users will be added later, this patch should go into the series
adding the users.

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
Severe culture shock results when experts from another protocol suite
[...] try to read OSI documents. The term osified is used to  refer
to  such  documents. [...] Any relationship to the word ossified is
purely intentional.- Marshall T. Rose
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] md5: Fix gcc-4.7 build problem in md5

2012-11-03 Thread Wolfgang Denk
Dear Simon Glass,

In message 1351979121-3769-2-git-send-email-...@chromium.org you wrote:
 From: Han Shen shen...@google.com
 
 Fixed by replacing pointer casting with memcpy.
 
 Signed-off-by: Simon Glass s...@chromium.org
 ---
  lib/md5.c |3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)
 
 diff --git a/lib/md5.c b/lib/md5.c
 index 2ae4a06..9791e59 100644
 --- a/lib/md5.c
 +++ b/lib/md5.c
 @@ -153,8 +153,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
   byteReverse(ctx-in, 14);
  
   /* Append length in bits and transform */
 - ctx-in32[14] = ctx-bits[0];
 - ctx-in32[15] = ctx-bits[1];
 + memcpy(ctx-in + 14 * sizeof(__u32), ctx-bits, 2 * sizeof(__u32));

This makes the code actually unreadable.  Please add at least a
comment what this is doing.

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
Of course there's no reason for it, it's just our policy.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mmc: add no simultaenous power and vdd

2012-11-03 Thread Wolfgang Denk
Dear RgC,

In message 20121104001018.GA57283@crg you wrote:
 
 Bring in the code from Linux kernel.

PLease provide exact reference; see
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign

 Signed-off-by: RgC sessya...@gmail.com

Sorry, but we need a real name here.

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
He is truly wise who gains wisdom from another's mishap.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] md5: Fix gcc-4.7 build problem in md5

2012-11-03 Thread Wolfgang Denk
Dear Simon,

In message 20121104003242.92729200...@gemini.denx.de I wrote:
 
  /* Append length in bits and transform */
  -   ctx-in32[14] = ctx-bits[0];
  -   ctx-in32[15] = ctx-bits[1];
  +   memcpy(ctx-in + 14 * sizeof(__u32), ctx-bits, 2 * sizeof(__u32));
 
 This makes the code actually unreadable.  Please add at least a
 comment what this is doing.

Actually I think this shoul dbe split into two memcpy commands, using
the addresses of the respective array elements directly, without such
manual pointer arithmetics.

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 number  of  Unix  installations  has  grown  to  10,  with  more
expected.- The Unix Programmer's Manual, 2nd Edition, June, 1972
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mmc: add no simultaenous power and vdd

2012-11-03 Thread RgC
Dear Wolfgang,

On 2012.11/04, Wolfgang Denk wrote:
 Dear RgC,
 
 In message 20121104001018.GA57283@crg you wrote:
  
  Bring in the code from Linux kernel.
 
 PLease provide exact reference; see
 http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
 

Sorry wasn't reading the documents, my bad.

The orignal code was brought in by commit 
e08c1694d9e2138204f2b79b73f0f159074ce2f5
last 2008 to the Linux kernel but has since evolved.

  Signed-off-by: RgC sessya...@gmail.com
 
 Sorry, but we need a real name here.

Sorry. The real name is Rommel G Custodio.
I will prepare a V2 of the patch later.

 
 Best regards,
 
 Wolfgang Denk

All the best,
Rommel



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


[U-Boot] [PATCH v2] mmc: add no simultaenous power and vdd

2012-11-03 Thread RgC
Bring in the code from Linux kernel.

Added to Linux kernel by:
commit e08c1694d9e2138204f2b79b73f0f159074ce2f5
Author: Andres Salomon dilin...@queued.net
Date:   Fri Jul 4 10:00:03 2008 -0700

Some HW balks when writing both voltage setting and power up at the same
time to SDHCI_POWER_CONTROL register.

Signed-off-by: Rommel G Custodio sessya...@gmail.com
CC: Andy Fleming aflem...@freescale.com

v2: fix attribution and SOB
---
 drivers/mmc/sdhci.c | 3 +++
 include/sdhci.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 7845f87..b9cbe34 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -340,6 +340,9 @@ static void sdhci_set_power(struct sdhci_host *host, 
unsigned short power)
return;
}
 
+   if (host-quirks  SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER)
+   sdhci_writeb(host, pwr, SDHCI_POWER_CONTROL);
+
pwr |= SDHCI_POWER_ON;
 
sdhci_writeb(host, pwr, SDHCI_POWER_CONTROL);
diff --git a/include/sdhci.h b/include/sdhci.h
index c44793d..cffbe53 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -225,6 +225,7 @@
 #define SDHCI_QUIRK_BROKEN_VOLTAGE (1  4)
 #define SDHCI_QUIRK_NO_CD  (1  5)
 #define SDHCI_QUIRK_WAIT_SEND_CMD  (1  6)
+#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1  7)
 
 /* to make gcc happy */
 struct sdhci_host;
-- 
1.8.0



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


[U-Boot] [PATCH v1 0/1] Factorize ARM startup code as mush as possible.

2012-11-03 Thread Albert ARIBAUD

File crt0.S is introduced which contains the C runtime
framework, that is, the assembly code responsible for
setting up the C environments needed by board_init_*()
and relocate_code(). Corresponding code is removed from
all start.S files in arch/arm.

This precedes further factorization, e.g. relocate_code()
and possibly also the exception handlers.

This has the nice side effect of turning board_init_*()
and relocate_code() into normal C functions, too.


Albert ARIBAUD (1):
  arm: move generic startup code in crt0.S

 arch/arm/cpu/arm1136/start.S  |   62 ++
 arch/arm/cpu/arm1176/start.S  |   62 ++
 arch/arm/cpu/arm720t/start.S  |   53 ++---
 arch/arm/cpu/arm920t/start.S  |   61 ++
 arch/arm/cpu/arm925t/start.S  |   61 ++
 arch/arm/cpu/arm926ejs/start.S|   80 ++---
 arch/arm/cpu/arm946es/start.S |   56 ++---
 arch/arm/cpu/arm_intcm/start.S|   63 ++
 arch/arm/cpu/armv7/start.S|   58 +++---
 arch/arm/cpu/ixp/start.S  |   55 ++---
 arch/arm/cpu/pxa/start.S  |   63 ++
 arch/arm/cpu/s3c44b0/start.S  |   55 ++---
 arch/arm/cpu/sa1100/start.S   |   50 ++--
 arch/arm/lib/Makefile |2 +
 arch/arm/lib/board.c  |   11 --
 arch/arm/lib/crt0.S   |  179 +
 include/common.h  |2 +-
 lib/asm-offsets.c |   10 ++
 nand_spl/board/freescale/mx31pdk/Makefile |6 +-
 nand_spl/board/karo/tx25/Makefile |6 +-
 20 files changed, 322 insertions(+), 673 deletions(-)
 create mode 100644 arch/arm/lib/crt0.S

-- 
1.7.9.5

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


[U-Boot] [PATCH v1] arm: move generic startup code in crt0.S

2012-11-03 Thread Albert ARIBAUD
Signed-off-by: Albert ARIBAUD albert.u.b...@aribaud.net
---
 arch/arm/cpu/arm1136/start.S  |   62 ++
 arch/arm/cpu/arm1176/start.S  |   62 ++
 arch/arm/cpu/arm720t/start.S  |   53 ++---
 arch/arm/cpu/arm920t/start.S  |   61 ++
 arch/arm/cpu/arm925t/start.S  |   61 ++
 arch/arm/cpu/arm926ejs/start.S|   80 ++---
 arch/arm/cpu/arm946es/start.S |   56 ++---
 arch/arm/cpu/arm_intcm/start.S|   63 ++
 arch/arm/cpu/armv7/start.S|   58 +++---
 arch/arm/cpu/ixp/start.S  |   55 ++---
 arch/arm/cpu/pxa/start.S  |   63 ++
 arch/arm/cpu/s3c44b0/start.S  |   55 ++---
 arch/arm/cpu/sa1100/start.S   |   50 ++--
 arch/arm/lib/Makefile |2 +
 arch/arm/lib/board.c  |   11 --
 arch/arm/lib/crt0.S   |  179 +
 include/common.h  |2 +-
 lib/asm-offsets.c |   10 ++
 nand_spl/board/freescale/mx31pdk/Makefile |6 +-
 nand_spl/board/karo/tx25/Makefile |6 +-
 20 files changed, 322 insertions(+), 673 deletions(-)
 create mode 100644 arch/arm/lib/crt0.S

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 3752af9..fb1fcab 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -161,13 +161,7 @@ next:
bl  cpu_init_crit
 #endif
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-   ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
-   bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
-   ldr r0,=0x
-
-   bl  board_init_f
+   bl  _main
 
 
/*--*/
 
@@ -184,14 +178,10 @@ relocate_code:
mov r5, r1  /* save addr of gd */
mov r6, r2  /* save addr of destination */
 
-   /* Set up the stack */
-stack_setup:
-   mov sp, r4
-
adr r0, _start
cmp r0, r6
moveq   r9, #0  /* no relocation. relocation offset(r9) = 0 */
-   beq clear_bss   /* skip relocation */
+   beq relocate_done   /* skip relocation */
mov r1, r6  /* r1 - scratch for copy_loop */
ldr r3, _bss_start_ofs
add r2, r0, r3  /* r2 - source end address */
@@ -243,48 +233,9 @@ fixnext:
blo fixloop
 #endif
 
-clear_bss:
-#ifndef CONFIG_SPL_BUILD
-   ldr r0, _bss_start_ofs
-   ldr r1, _bss_end_ofs
-   mov r4, r6  /* reloc addr */
-   add r0, r0, r4
-   add r1, r1, r4
-   mov r2, #0x /* clear*/
-
-clbss_l:cmpr0, r1  /* clear loop... */
-   bhs clbss_e /* if reached end of bss, exit */
-   str r2, [r0]
-   add r0, r0, #4
-   b   clbss_l
-clbss_e:
-#endif /* #ifndef CONFIG_SPL_BUILD */
-
-/*
- * We are done. Do not return, instead branch to second part of board
- * initialization, now running from RAM.
- */
-#ifdef CONFIG_NAND_SPL
-   ldr r0, _nand_boot_ofs
-   mov pc, r0
+relocate_done:
 
-_nand_boot_ofs:
-   .word nand_boot
-#else
-jump_2_ram:
-   ldr r0, _board_init_r_ofs
-   ldr r1, _TEXT_BASE
-   add lr, r0, r1
-   add lr, lr, r9
-   /* setup parameters for board_init_r */
-   mov r0, r5  /* gd_t */
-   mov r1, r6  /* dest_addr */
-   /* jump to it ... */
-   mov pc, lr
-
-_board_init_r_ofs:
-   .word board_init_r - _start
-#endif
+   bx  lr
 
 _rel_dyn_start_ofs:
.word __rel_dyn_start - _start
@@ -293,6 +244,11 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
.word __dynsym_start - _start
 
+   .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
+
+   bx  lr
+
 /*
  *
  *
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index 667a0e0..40df4b1 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -224,12 +224,7 @@ skip_tcmdisable:
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
 
-/* Set stackpointer in internal RAM to call board_init_f */
-call_board_init_f:
-   ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
-   bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
-   ldr r0,=0x
-   bl  board_init_f
+   bl  _main
 
 
/*--*/
 
@@ -246,14 +241,10 @@ relocate_code:
mov r5, 

Re: [U-Boot] [PATCH] TPM: remove dead code

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 5:28 PM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon,

 In message 
 CAPnjgZ0JLarq6r=she+cfbjkyuf6hrggp4br9u_asug14mz...@mail.gmail.com you 
 wrote:

 On Sat, Nov 3, 2012 at 9:30 AM, Wolfgang Denk w...@denx.de wrote:
  The TPM code was added more than a year or 4 releases ago.  This was
  done under the proposition that board support that would actually use
  such code would be added soon.  However, nothing happened since.  The
  code has no users in mainline, and does not even get build for any
  configuration, so we cannot even tell if it compiles at all.
 
  Remove the unused code.  In in some far future actual users show up,
  it can be re-added easily.

 I think you may have missed the pending patches which make use of
 this. it is important functionality for the Chromebooks (secure boot).

 No, I have not missed these.  But all the patch does is set
 CONFIG_GENERIC_LPC_TPM - there is still not a single user defining
 CONFIG_CMD_TPM, so what does this help?  We still have tons of dead
 code around.  Dump it!

So we need a board that defines the command also? I did not realise
that was a requirement - certainly I can add that command to the
boards also.

Upstreaming the code is a step-by-step process. The TPM is an
important component of secure boot, and things have to progress in
some sort of fashion. I do understand the dead code argument, but we
can't submit high-level code without the drivers it uses (and there
are many).

Regards,
Simon


 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
 Unix: Some say the learning curve is steep,  but  you  only  have  to
 climb it once.  - Karl Lehenbauer
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] Add stricmp() and strnicmp()

2012-11-03 Thread Simon Glass
Hi Wolfgang,

On Sat, Nov 3, 2012 at 5:31 PM, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 1351979121-3769-3-git-send-email-...@chromium.org you wrote:
 strnicmp() is present but disabled. Make it available and define stricmp()
 also. There is a only a small performance penalty to having stricmp()
 call strnicmp(), so do this instead of a standalone function, to save code
 space.

 BRANCH=none

 Please get rid of such entries in the commit messages

 Consider all patches that contain such entries as NAKed.

Yes it is annoying - I submitted a patch to patman to remove this and
another gerrit one also. In the meantime I have to be careful!


 +int strnicmp(const char *s1, const char *s2, size_t len);
 +
 +int stricmp(const char *s1, const char *s2);

 Who are the users of this?   I object against adding dead code.

 If users will be added later, this patch should go into the series
 adding the users.

OK, messaged received loud and clear. It does require a change of
process at my end - now I have to find relationships between commits
in different series going to different maintainers and try to tie them
together. Just one more thing to worry about.

But I understand your concern that, in fact, if there is no user
immediately forthcoming, then it will just sit there and no one will
notice if it is dead code.

BTW, is there any easy way to obtain build-coverage information for
U-Boot? In other words, can we easily find code that is not enabled by
any existing board? That might be an interesting investigation.

Regards,
Simon


 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
 Severe culture shock results when experts from another protocol suite
 [...] try to read OSI documents. The term osified is used to  refer
 to  such  documents. [...] Any relationship to the word ossified is
 purely intentional.- Marshall T. Rose
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot