Re: [U-Boot] [PATCH V3 2/2] ARM: omap3: add support to Technexion twister board

2012-01-14 Thread Albert ARIBAUD

(re-sent due to the U-Boot MX rejecting my provider's servers -- again)

Hi Stefano,

Le 01/12/2011 10:56, Stefano Babic a écrit :

The twister board is a development board using
the TAM3517 SOM.


I see this match made it in IMX then ARM, but it seems not to build here 
either with ELDK 4.2 or linaro (Ubuntu) cross tool chains:



Configuring for twister board...
omap_gpmc.c:33:30: attention : ‘hw_nand_oob’ defined but not used 
[-Wunused-variable]
omap_gpmc.c:78:13: attention : ‘omap_hwecc_init’ defined but not used 
[-Wunused-function]
omap_gpmc.c:116:12: attention : ‘omap_correct_data’ defined but not used 
[-Wunused-function]
omap_gpmc.c:182:12: attention : ‘omap_calculate_ecc’ defined but not used 
[-Wunused-function]
omap_gpmc.c:208:13: attention : ‘omap_enable_hwecc’ defined but not used 
[-Wunused-function]
drivers/usb/host/libusb_host.o: In function `usb_lowlevel_stop':
/home/uboot/src/u-boot-arm/drivers/usb/host/ehci-hcd.c:806: undefined reference 
to `ehci_hcd_stop'
drivers/usb/host/libusb_host.o: In function `usb_lowlevel_init':
/home/uboot/src/u-boot-arm/drivers/usb/host/ehci-hcd.c:814: undefined reference 
to `ehci_hcd_init'
arm-linux-gnueabi-ld: BFD (GNU Binutils for Ubuntu) 2.21.53.20110810 assertion 
fail ../../bfd/elf32-arm.c:7498
arm-linux-gnueabi-ld: BFD (GNU Binutils for Ubuntu) 2.21.53.20110810 assertion 
fail ../../bfd/elf32-arm.c:7498
arm-linux-gnueabi-ld: BFD (GNU Binutils for Ubuntu) 2.21.53.20110810 assertion 
fail ../../bfd/elf32-arm.c:13828
/bin/sh : ligne 1 : 23855 Erreur de segmentation  arm-linux-gnueabi-ld -pie -T 
u-boot.lds -Bstatic -Ttext 0x80008000 $UNDEF_SYM arch/arm/cpu/armv7/start.o 
--start-group api/libapi.o arch/arm/cpu/armv7/libarmv7.o 
arch/arm/cpu/armv7/omap-common/libomap-common.o 
arch/arm/cpu/armv7/omap3/libomap3.o arch/arm/lib/libarm.o common/libcommon.o 
disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o 
drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o 
drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o 
drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o 
drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o 
drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o 
drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o 
drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o 
drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/eth/libusb_eth.o 
drivers/usb


/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o 
drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o 
drivers/usb/ulpi/libusb_ulpi.o drivers/video/libvideo.o 
drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o 
fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o 
fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o 
lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o 
lib/zlib/libz.o net/libnet.o post/libpost.o 
board/technexion/twister/libtwister.o --end-group 
/home/uboot/src/u-boot-arm/arch/arm/lib/eabi_compat.o -L 
/usr/lib/gcc/arm-linux-gnueabi/4.6.1 -lgcc -Map u-boot.map -o u-boot

make: *** [u-boot] Erreur 139
make: *** Attente des tâches non terminées
arm-linux-gnueabi-size: ./u-boot: File format not recognized

- SUMMARY 
Boards compiled: 1
Boards with warnings or errors: 1 ( twister )
--


The above was tried on 10a4fa9e22b9677819b3901a87eec05875b346ad (the 
current u-boot-arm/master, but trying various commits in between it and 
92e30c07e02b84a3b63205fcb29ac57defd043f6 (creation of twister), I find 
no commit where it builds.


Stefano, can you have a look at this?

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


Re: [U-Boot] [PATCH 1/2 V3] arm926: Flush the data cache before disabling it

2012-01-14 Thread Albert ARIBAUD

Hi Sughosh,

Le 14/01/2012 08:49, Sughosh Ganu a écrit :

The current implementation invalidates the cache instead of flushing
it. This causes problems on platforms where the spl/u-boot is already
loaded to the RAM, with caches enabled by a first stage bootloader.

The V bit of the cp15's control register c1 is set to the value of
VINITHI on reset. Do not clear this bit by default, as there are SOC's
with no valid memory region at 0x0.

Also fix the comments to match code.

Signed-off-by: Sughosh Ganuurwithsugh...@gmail.com
---

Changes since V2
* Added code to invalidate I cache, based on review comment by Aneesh.
* Fixed comments to match the code.

Changes since V1
* Added arm926 keyword to the subject line
* Removed the superfluous setting of r0.
* Fixed the comment to reflect the fact that V is not being cleared

  arch/arm/cpu/arm926ejs/start.S |   14 +-
  1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 6a09c02..91a9325 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -355,17 +355,21 @@ _dynsym_start_ofs:
   */
  cpu_init_crit:
/*
-* flush v4 I/D caches
+* flush D cache before disabling it
 */
mov r0, #0
-   mcr p15, 0, r0, c7, c7, 0   /* flush v3/v4 cache */
-   mcr p15, 0, r0, c8, c7, 0   /* flush v4 TLB */
+flush_dcache:
+   mrc p15, 0, r15, c7, c10, 3
+   bne flush_dcache
+
+   mcr p15, 0, r0, c8, c7, 0   /* invalidate TLB */
+   mcr p15, 0, r0, c7, c5, 0   /* invalidate I Cache */

/*
-* disable MMU stuff and caches
+* disable MMU and D cache, and enable I cache.
 */
mrc p15, 0, r0, c1, c0, 0
-   bic r0, r0, #0x2300 /* clear bits 13, 9:8 (--V- --RS) */
+   bic r0, r0, #0x0300 /* clear bits 9:8 ( --RS) */


NAK--this alters the functioning of U-Boot for many boards in ways 
unpredictable. If you want to get this specific V change into ARM, then 
please also add code to set V in all relevant SoCs, or (better yet IMO) 
make do not set V in cpu_init_crit a config option and set it in the 
relevant SoCs or boards.



bic r0, r0, #0x0087 /* clear bits 7, 2:0 (B--- -CAM) */
orr r0, r0, #0x0002 /* set bit 2 (A) Align */
orr r0, r0, #0x1000 /* set bit 12 (I) I-Cache */


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


Re: [U-Boot] [PATCH 1/2 V2] arm926: Flush the data cache before disabling it.

2012-01-14 Thread Albert ARIBAUD

Le 12/01/2012 07:29, Sughosh Ganu a écrit :

On Thu Jan 12, 2012 at 06:56:01AM +0100, Christian Riesch wrote:

On Wednesday, January 11, 2012, Marek Vasutmarek.va...@gmail.com  wrote:


snip


RBL executes an AIS script. Sughosh, could you please explain what your

AIS

does or how you create it?


So basically, this SPL business can be avoided and this all can be done

in a

standard way?


I don't know, I never had to deal with booting from NAND. I was just
wondering what Sughosh's AIS is doing that he gets these SPL problems.
Christian


   I have checked my ais ini file, and it does the normal pll/ddr
   settings. I think it is the rbl which might be turning the cache
   ON.


I do understand it is ROM code so no change can be done to it, but that 
a bootloader pass control to its payload with the cache still enabled 
and, worse yet, dirty, is Bad(tm).


Can the AIS not be augmented with instructions to flush and disable the 
cache?


Note: I do NOT intend to reject the U-Boot patch if the AIS can indeed 
be modified; I am just trying to apply the Postel principe fully, and 
while the patch would make U-Boot be (more) liberal in what it receives 
from the ROM bootloader, I would like the bootloader to be (more) 
conservative in what it gives U-Boot, i.e. give it a clean system with 
as little assumptions to make or constraints to respect.


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


Re: [U-Boot] [PATCH 1/2 V3] arm926: Flush the data cache before disabling it

2012-01-14 Thread Sughosh Ganu
hi Albert,

On Sat Jan 14, 2012 at 10:02:16AM +0100, Albert ARIBAUD wrote:

snip

  /*
 - * disable MMU stuff and caches
 + * disable MMU and D cache, and enable I cache.
   */
  mrc p15, 0, r0, c1, c0, 0
 -bic r0, r0, #0x2300 /* clear bits 13, 9:8 (--V- --RS) */
 +bic r0, r0, #0x0300 /* clear bits 9:8 ( --RS) */
 
 NAK--this alters the functioning of U-Boot for many boards in ways
 unpredictable. If you want to get this specific V change into ARM,
 then please also add code to set V in all relevant SoCs, or (better
 yet IMO) make do not set V in cpu_init_crit a config option and
 set it in the relevant SoCs or boards.

  Ok, but the problem i have is that i don't have visibility into all
  the SoC's out there -- don't know what maps where. So i think it
  should be done by people using those specific SOC's. I can add a
  config option, and introduce it for my board/SOC. Will that be fine.

  In any case, i will split this patch into two, with the cache
  flushing part kept separate, as it fixes a real issue on my
  board. Will work out the setting of the V bit in a separate patch.

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


Re: [U-Boot] [PATCH V3 2/2] ARM: omap3: add support to Technexion twister board

2012-01-14 Thread Stefano Babic
On 14/01/2012 09:47, Albert ARIBAUD wrote:
 (re-sent due to the U-Boot MX rejecting my provider's servers -- again)
 
 Hi Stefano,
 

Hi Albert, hi Tom,

 drivers/usb/host/libusb_host.o: In function `usb_lowlevel_init':
 /home/uboot/src/u-boot-arm/drivers/usb/host/ehci-hcd.c:814: undefined
 reference to `ehci_hcd_init'

The twister board depends on several patches for the AM3517 processor
previously senty by Ilya Yanok. One of them (maybe because it is USB
related and should go into u-boot-usb) is missing.

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

The patch is set to new and assigned to Remy, but he gived up as
maintainer - nobody checks at it ;-(.

I can at least sent my tested-by - it was nice if you can pick it up.

Best regards,
Stefano

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


Re: [U-Boot] [PATCH V3 2/2] ARM: omap3: add support to Technexion twister board

2012-01-14 Thread Albert ARIBAUD

Hi Stefano,

Le 14/01/2012 10:48, Stefano Babic a écrit :

On 14/01/2012 09:47, Albert ARIBAUD wrote:

(re-sent due to the U-Boot MX rejecting my provider's servers -- again)

Hi Stefano,



Hi Albert, hi Tom,


drivers/usb/host/libusb_host.o: In function `usb_lowlevel_init':
/home/uboot/src/u-boot-arm/drivers/usb/host/ehci-hcd.c:814: undefined
reference to `ehci_hcd_init'


The twister board depends on several patches for the AM3517 processor
previously senty by Ilya Yanok. One of them (maybe because it is USB
related and should go into u-boot-usb) is missing.

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


Board then compiles but with warnings for 4 declared but unused symbols.


The patch is set to new and assigned to Remy, but he gived up as
maintainer - nobody checks at it ;-(.


Considering that all it does is adding a new EHCI driver, the worst 
impact it can have is to not function properly for boards using it, 
which at the moment means omap3_beagle and tam3517; but it won't affect 
USB on existing boards.


But then I wonder why twister needs it at all, as it does not have a 
single USB config option in its header config file...



I can at least sent my tested-by - it was nice if you can pick it up.


*If* someone can explain to me why a patch that adds a new USB EHCI 
driver is needed by a board which does not have any USB in its config 
header file, and *unless Wolfgang says otherwise*, I agree to accept 
patch 130952 with your Tested-By.



Best regards,
Stefano


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


Re: [U-Boot] [PATCH] configs: Remove CONFIG_NET_MULTI from board files

2012-01-14 Thread Stefano Babic
On 11/01/2012 13:47, Fabio Estevam wrote:
 CONFIG_NET_MULTI is not used anymore, so remove it from board files.
 
 Cc: Marek Vasut marek.va...@gmail.com
 Cc: Stefano Babic sba...@denx.de
 Cc: Kumar Gala kumar.g...@freescale.com
 Cc: Sandeep Paulraj s-paul...@ti.com
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---
  include/configs/P1010RDB.h |5 -
  include/configs/PM826.h|2 --
  include/configs/PM828.h|2 --
  include/configs/cam_enc_4xx.h  |1 -
  include/configs/coreboot.h |6 --
  include/configs/da850_am18xxevm.h  |1 -
  include/configs/ecovec.h   |1 -
  include/configs/efikamx.h  |1 -
  include/configs/enbw_cmc.h |1 -
  include/configs/ethernut5.h|1 -
  include/configs/flea3.h|1 -
  include/configs/m28evk.h   |1 -
  include/configs/omap3_evm_common.h |1 -
  include/configs/omap3_mvblx.h  |1 -
  include/configs/p1_p2_rdb_pc.h |7 ---
  include/configs/tam3517-common.h   |1 -
  16 files changed, 0 insertions(+), 33 deletions(-)

Applied to u-boot-imx after rebasing on u-boot-arm/master
(include/configs/da850_am18xxevm.h was dropped in a recent patch), thanks.

Best regards,
Stefano Babic

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


Re: [U-Boot] [PATCH V3 2/2] ARM: omap3: add support to Technexion twister board

2012-01-14 Thread Stefano Babic
On 14/01/2012 11:06, Albert ARIBAUD wrote:

 
 Board then compiles but with warnings for 4 declared but unused symbols.

I see also the warnings, they are related to a couple of drivers (NAND).
They need a clean-up patch to fix them.

 Considering that all it does is adding a new EHCI driver, the worst
 impact it can have is to not function properly for boards using it,
 which at the moment means omap3_beagle and tam3517; but it won't affect
 USB on existing boards.
 
 But then I wonder why twister needs it at all, as it does not have a
 single USB config option in its header config file...

Well, that is not true...

 
 I can at least sent my tested-by - it was nice if you can pick it up.
 
 *If* someone can explain to me why a patch that adds a new USB EHCI
 driver is needed by a board which does not have any USB in its config
 header file,

I can explain this. The twister board is based on the Technexion TAM3517
SOM. There is a common configuration files for all boards (I have also
added a second one) using this module with the TI AM3517 SOC:

include/configs/tam3517-common.h

Because pins for USB are fixed on the SOM, the USB configuration is made
common to all boards. In tam3517-common.h you can find:

/* EHCI */
#define CONFIG_OMAP3_GPIO_5
#define CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_OMAP
#define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO25
#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
#define CONFIG_USB_STORAGE


 and *unless Wolfgang says otherwise*,

..added Wolfgang in CC

Best regards,
Stefano Babic

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


Re: [U-Boot] [PATCH V3 2/2] ARM: omap3: add support to Technexion twister board

2012-01-14 Thread Albert ARIBAUD

Le 14/01/2012 11:15, Stefano Babic a écrit :

On 14/01/2012 11:06, Albert ARIBAUD wrote:



Board then compiles but with warnings for 4 declared but unused symbols.


I see also the warnings, they are related to a couple of drivers (NAND).
They need a clean-up patch to fix them.


Considering that all it does is adding a new EHCI driver, the worst
impact it can have is to not function properly for boards using it,
which at the moment means omap3_beagle and tam3517; but it won't affect
USB on existing boards.

But then I wonder why twister needs it at all, as it does not have a
single USB config option in its header config file...


Well, that is not true...




I can at least sent my tested-by - it was nice if you can pick it up.


*If* someone can explain to me why a patch that adds a new USB EHCI
driver is needed by a board which does not have any USB in its config
header file,


I can explain this. The twister board is based on the Technexion TAM3517
SOM. There is a common configuration files for all boards (I have also
added a second one) using this module with the TI AM3517 SOC:

include/configs/tam3517-common.h

Because pins for USB are fixed on the SOM, the USB configuration is made
common to all boards. In tam3517-common.h you can find:

/* EHCI */
#define CONFIG_OMAP3_GPIO_5
#define CONFIG_USB_EHCI
#define CONFIG_USB_EHCI_OMAP
#define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO25
#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
#define CONFIG_USB_STORAGE


Ok, got it. I had only read the twister entry in boards.cfg and thus I 
thought twister was 'simple' omap3.


So that leaves this:


and *unless Wolfgang says otherwise*,


..added Wolfgang in CC


Oops. Thanks. :)


Best regards,
Stefano Babic


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


Re: [U-Boot] [PATCH 1/2 V3] arm926: Flush the data cache before disabling it

2012-01-14 Thread Albert ARIBAUD

Hi Sughosh

Le 14/01/2012 10:21, Sughosh Ganu a écrit :

hi Albert,

On Sat Jan 14, 2012 at 10:02:16AM +0100, Albert ARIBAUD wrote:

snip


/*
-* disable MMU stuff and caches
+* disable MMU and D cache, and enable I cache.
 */
mrc p15, 0, r0, c1, c0, 0
-   bic r0, r0, #0x2300 /* clear bits 13, 9:8 (--V- --RS) */
+   bic r0, r0, #0x0300 /* clear bits 9:8 ( --RS) */


NAK--this alters the functioning of U-Boot for many boards in ways
unpredictable. If you want to get this specific V change into ARM,
then please also add code to set V in all relevant SoCs, or (better
yet IMO) make do not set V in cpu_init_crit a config option and
set it in the relevant SoCs or boards.


   Ok, but the problem i have is that i don't have visibility into all
   the SoC's out there -- don't know what maps where. So i think it
   should be done by people using those specific SOC's. I can add a
   config option, and introduce it for my board/SOC. Will that be fine.


For me it is fine: this way, you won't affect code behavior for existing 
boards.



   In any case, i will split this patch into two, with the cache
   flushing part kept separate, as it fixes a real issue on my
   board. Will work out the setting of the V bit in a separate patch.


This is a good idea too.


-sughosh


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


[U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Matthias Fuchs
The generic spi flash driver (drivers/mtd/spi/spi_flash.c) uses the
spi low level driver's spi_xfer() function with len=0 to deassert the
SPI flash' chip select. But the i.MX28 spi driver rejects this call
due to len=0.

This patch implements an exception for len=0 with the SPI_XFER_END
flag set. This results in an extra read with the chip select being
deasserted afterwards. There seems to be no way to deassert the signal
by hand.

Signed-off-by: Matthias Fuchs matthias.fu...@esd.eu
---
 drivers/spi/mxs_spi.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index 4c27fef..adb9ca8 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -129,9 +129,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
int len = bitlen / 8;
const char *tx = dout;
char *rx = din;
-
-   if (bitlen == 0)
-   return 0;
+   char dummy;
+
+   if (bitlen == 0) {
+   if (flags  SPI_XFER_END) {
+   rx = dummy;
+   len = 1;
+   } else
+   return 0;
+   }
 
if (!rx  !tx)
return 0;
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2 V4] arm926: Flush the data cache before disabling it

2012-01-14 Thread Sughosh Ganu
The current implementation invalidates the cache instead of flushing
it. This causes problems on platforms where the spl/u-boot is already
loaded to the RAM, with caches enabled by a first stage bootloader.

Also fix the comments to match code.

Signed-off-by: Sughosh Ganu urwithsugh...@gmail.com
Cc: Albert Aribaud albert.u.b...@aribaud.net
Cc: Tom Rini tr...@ti.com
---

Changes since V3
* Removed tampering of the V bit setting. Would be done in a separate
  patch on the lines of review comments by Albert.

Changes since V2
* Added code to invalidate I cache, based on review comment by Aneesh.
* Fixed comments to match the code.

Changes since V1
* Added arm926 keyword to the subject line
* Removed the superfluous setting of r0.
* Fixed the comment to reflect the fact that V is not being cleared

 arch/arm/cpu/arm926ejs/start.S |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 6a09c02..d64165a 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -355,14 +355,18 @@ _dynsym_start_ofs:
  */
 cpu_init_crit:
/*
-* flush v4 I/D caches
+* flush D cache before disabling it
 */
mov r0, #0
-   mcr p15, 0, r0, c7, c7, 0   /* flush v3/v4 cache */
-   mcr p15, 0, r0, c8, c7, 0   /* flush v4 TLB */
+flush_dcache:
+   mrc p15, 0, r15, c7, c10, 3
+   bne flush_dcache
+
+   mcr p15, 0, r0, c8, c7, 0   /* invalidate TLB */
+   mcr p15, 0, r0, c7, c5, 0   /* invalidate I Cache */
 
/*
-* disable MMU stuff and caches
+* disable MMU and D cache, and enable I cache.
 */
mrc p15, 0, r0, c1, c0, 0
bic r0, r0, #0x2300 /* clear bits 13, 9:8 (--V- --RS) */
-- 
1.7.5.4

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


Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Marek Vasut
 The generic spi flash driver (drivers/mtd/spi/spi_flash.c) uses the
 spi low level driver's spi_xfer() function with len=0 to deassert the
 SPI flash' chip select. But the i.MX28 spi driver rejects this call
 due to len=0.
 
 This patch implements an exception for len=0 with the SPI_XFER_END
 flag set. This results in an extra read with the chip select being
 deasserted afterwards. There seems to be no way to deassert the signal
 by hand.

This seems good, but it doesn't look too correct either (is there really no 
other way to deassert CS than doing dummy read?). Do you see an issue with 
current implementation on some board please?

 
 Signed-off-by: Matthias Fuchs matthias.fu...@esd.eu
 ---
  drivers/spi/mxs_spi.c |   12 +---
  1 files changed, 9 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
 index 4c27fef..adb9ca8 100644
 --- a/drivers/spi/mxs_spi.c
 +++ b/drivers/spi/mxs_spi.c
 @@ -129,9 +129,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int
 bitlen, int len = bitlen / 8;
   const char *tx = dout;
   char *rx = din;
 -
 - if (bitlen == 0)
 - return 0;
 + char dummy;
 +
 + if (bitlen == 0) {
 + if (flags  SPI_XFER_END) {
 + rx = dummy;
 + len = 1;
 + } else
 + return 0;
 + }
 
   if (!rx  !tx)
   return 0;
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 2/2] ARM: omap3: add support to Technexion twister board

2012-01-14 Thread Tom Rini
On Sat, Jan 14, 2012 at 1:47 AM, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:
 (re-sent due to the U-Boot MX rejecting my provider's servers -- again)

 Hi Stefano,

 Le 01/12/2011 10:56, Stefano Babic a écrit :

 The twister board is a development board using
 the TAM3517 SOM.


 I see this match made it in IMX then ARM, but it seems not to build here
 either with ELDK 4.2 or linaro (Ubuntu) cross tool chains:

 Configuring for twister board...
 omap_gpmc.c:33:30: attention : ‘hw_nand_oob’ defined but not used
 [-Wunused-variable]
 omap_gpmc.c:78:13: attention : ‘omap_hwecc_init’ defined but not used
 [-Wunused-function]
 omap_gpmc.c:116:12: attention : ‘omap_correct_data’ defined but not used
 [-Wunused-function]
 omap_gpmc.c:182:12: attention : ‘omap_calculate_ecc’ defined but not used
 [-Wunused-function]
 omap_gpmc.c:208:13: attention : ‘omap_enable_hwecc’ defined but not used
 [-Wunused-function]
 drivers/usb/host/libusb_host.o: In function `usb_lowlevel_stop':
 /home/uboot/src/u-boot-arm/drivers/usb/host/ehci-hcd.c:806: undefined
 reference to `ehci_hcd_stop'
 drivers/usb/host/libusb_host.o: In function `usb_lowlevel_init':
 /home/uboot/src/u-boot-arm/drivers/usb/host/ehci-hcd.c:814: undefined
 reference to `ehci_hcd_init'
 arm-linux-gnueabi-ld: BFD (GNU Binutils for Ubuntu) 2.21.53.20110810
 assertion fail ../../bfd/elf32-arm.c:7498
 arm-linux-gnueabi-ld: BFD (GNU Binutils for Ubuntu) 2.21.53.20110810
 assertion fail ../../bfd/elf32-arm.c:7498
 arm-linux-gnueabi-ld: BFD (GNU Binutils for Ubuntu) 2.21.53.20110810
 assertion fail ../../bfd/elf32-arm.c:13828
 /bin/sh : ligne 1 : 23855 Erreur de segmentation  arm-linux-gnueabi-ld
 -pie -T u-boot.lds -Bstatic -Ttext 0x80008000 $UNDEF_SYM
 arch/arm/cpu/armv7/start.o --start-group api/libapi.o
 arch/arm/cpu/armv7/libarmv7.o
 arch/arm/cpu/armv7/omap-common/libomap-common.o
 arch/arm/cpu/armv7/omap3/libomap3.o arch/arm/lib/libarm.o common/libcommon.o
 disk/libdisk.o drivers/bios_emulator/libatibiosemu.o
 drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o
 drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o
 drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o
 drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o
 drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o
 drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o
 drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o
 drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o
 drivers/twserial/libtws.o drivers/usb/eth/libusb_eth.o drivers/usb


 /gadget/libusb_gadget.o drivers/usb/host/libusb_host.o
 drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o
 drivers/usb/ulpi/libusb_ulpi.o drivers/video/libvideo.o
 drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o
 fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o
 fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o
 lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o
 lib/zlib/libz.o net/libnet.o post/libpost.o
 board/technexion/twister/libtwister.o --end-group
 /home/uboot/src/u-boot-arm/arch/arm/lib/eabi_compat.o -L
 /usr/lib/gcc/arm-linux-gnueabi/4.6.1 -lgcc -Map u-boot.map -o u-boot

 make: *** [u-boot] Erreur 139
 make: *** Attente des tâches non terminées
 arm-linux-gnueabi-size: ./u-boot: File format not recognized

 - SUMMARY 
 Boards compiled: 1
 Boards with warnings or errors: 1 ( twister )
 --


 The above was tried on 10a4fa9e22b9677819b3901a87eec05875b346ad (the current
 u-boot-arm/master, but trying various commits in between it and
 92e30c07e02b84a3b63205fcb29ac57defd043f6 (creation of twister), I find no
 commit where it builds.

 Stefano, can you have a look at this?

So what happened is I accidentally put this board into u-boot-ti/next
a while back, before the USB changes went in, without realizing it.
The reason the USB changes haven't gone in, still, is that they've
been made more generic (as the IP block is shared between these boards
and omap4/5).  For that part of the problem perhaps we should turn off
the USB portion of the board for now?

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


Re: [U-Boot] [PATCH V3 2/2] ARM: omap3: add support to Technexion twister board

2012-01-14 Thread Stefano Babic
On 14/01/2012 15:25, Tom Rini wrote:

 So what happened is I accidentally put this board into u-boot-ti/next
 a while back, before the USB changes went in, without realizing it.
 The reason the USB changes haven't gone in, still, is that they've
 been made more generic (as the IP block is shared between these boards
 and omap4/5).  For that part of the problem perhaps we should turn off
 the USB portion of the board for now?

Ok - I will sent a patch to turn USB off, until EHCI omap flows into
mainline.

Stefano

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


Re: [U-Boot] [PATCH 1/2 V2] arm926: Flush the data cache before disabling it.

2012-01-14 Thread Christian Riesch
Hi Albert,

On Saturday, January 14, 2012, Albert ARIBAUD albert.u.b...@aribaud.net
wrote:
 Le 12/01/2012 07:29, Sughosh Ganu a écrit :

 On Thu Jan 12, 2012 at 06:56:01AM +0100, Christian Riesch wrote:

 On Wednesday, January 11, 2012, Marek Vasutmarek.va...@gmail.com
 wrote:

 snip

 RBL executes an AIS script. Sughosh, could you please explain what
your

 AIS

 does or how you create it?

 So basically, this SPL business can be avoided and this all can be done

 in a

 standard way?

 I don't know, I never had to deal with booting from NAND. I was just
 wondering what Sughosh's AIS is doing that he gets these SPL problems.
 Christian

   I have checked my ais ini file, and it does the normal pll/ddr
   settings. I think it is the rbl which might be turning the cache
   ON.

 I do understand it is ROM code so no change can be done to it, but that a
bootloader pass control to its payload with the cache still enabled and,
worse yet, dirty, is Bad(tm).

 Can the AIS not be augmented with instructions to flush and disable the
cache?

I checked the AIS documentation and I don't think this can be done... AIS
has a command to write arbitrary memory regions, but not registers.
Christian
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2 V2] arm926: Flush the data cache before disabling it.

2012-01-14 Thread Christian Riesch
Hi Sughosh,

On Thursday, January 12, 2012, Sughosh Ganu urwithsugh...@gmail.com wrote:
 hi Christian,

 On Thu Jan 12, 2012 at 03:04:37PM +0100, Christian Riesch wrote:
 On Thu, Jan 12, 2012 at 2:53 PM, Sughosh Ganu urwithsugh...@gmail.com
wrote:
  On Thu Jan 12, 2012 at 01:03:05PM +0100, Christian Riesch wrote:

 snip

 
  Since all my tests were successful I wonder what issues did you have
  with the cache? Can you describe the problems you had? I think the
  difference is that you are booting from NAND and have an OMAP-L138,
  whereas I boot from SPI (on the da850evm) or from NOR (on calimain)
  and have an AM1808 on both boards, right?
 
   Thanks a lot for all the testing. One difference i think we have on
   these boards and hawkboard, is that on hawkboard, the rbl configures
   the memory and loads the target image(spl in this case) directly to
   the ram. Looking at da850evm's lds file, it looks like the spl
   gets loaded to the sram, configures dram and then copies u-boot to
   the target load address.

 This is only true if the SPL is actually used. Have a closer look at
 my test report, I tested three different methods:

 1) The first test was done with the SPL and yes, here the RBL loads
 the SPL into SRAM, initializes DDR memory and then copies u-boot.bin
 to DDR memory.
 2) The second test was done with TI's UBL. Here, the RBL loads the UBL
 into SRAM, the UBL initializes DDR memory and then copies u-boot.bin
 to DDR memory.
 3) The third test was done without SPL and without UBL: Here the DDR
 memory init is in the AIS, so in fact the RBL does memory
 initialization and then RBL loads u-boot.bin to DDR memory. This is
 the same case that you have on the hawkboard (only that you have the
 OMAP-L138 and NAND flash instead) and it works for me regardless of
 your patch.

  Yes, the third case is similar to the one used in hawkboard. I'm not
  sure as to why it causes a problem on my board, though i'm not sure
  if we can compare the two cases, as we have different rbl's. It
  could be that the rbl used on hawkboard initialises the caches, as
  the caches are off by default on reset.

  Here are the values i use in my ini file for ddr init.

 [EMIF3DDR]
 PLL1CFG0 = 0x15010001
 PLL1CFG1 = 0x0002

 DDRPHYC1R = 0x0043
 SDCR = 0x00134632
 SDTIMR = 0x26492a09
 SDTIMR2 = 0x7d13c722
 SDRCR = 0x0249
 CLK2XSRC = 0x


Just for curiosity, could you please send the full ini file?
Thanks, Christian
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2 V2] arm926: Flush the data cache before disabling it.

2012-01-14 Thread Sughosh Ganu
hi Christian,

On Sat Jan 14, 2012 at 06:20:06PM +0100, Christian Riesch wrote:
 Hi Sughosh,

snip

 On Thursday, January 12, 2012, Sughosh Ganu urwithsugh...@gmail.com wrote:
  1) The first test was done with the SPL and yes, here the RBL loads
  the SPL into SRAM, initializes DDR memory and then copies u-boot.bin
  to DDR memory.
  2) The second test was done with TI's UBL. Here, the RBL loads the UBL
  into SRAM, the UBL initializes DDR memory and then copies u-boot.bin
  to DDR memory.
  3) The third test was done without SPL and without UBL: Here the DDR
  memory init is in the AIS, so in fact the RBL does memory
  initialization and then RBL loads u-boot.bin to DDR memory. This is
  the same case that you have on the hawkboard (only that you have the
  OMAP-L138 and NAND flash instead) and it works for me regardless of
  your patch.
 
   Yes, the third case is similar to the one used in hawkboard. I'm not
   sure as to why it causes a problem on my board, though i'm not sure
   if we can compare the two cases, as we have different rbl's. It
   could be that the rbl used on hawkboard initialises the caches, as
   the caches are off by default on reset.
 
   Here are the values i use in my ini file for ddr init.
 
  [EMIF3DDR]
  PLL1CFG0 = 0x15010001
  PLL1CFG1 = 0x0002
 
  DDRPHYC1R = 0x0043
  SDCR = 0x00134632
  SDTIMR = 0x26492a09
  SDTIMR2 = 0x7d13c722
  SDRCR = 0x0249
  CLK2XSRC = 0x

Here it is.
[General]
busWidth=8

BootMode=NAND

crcCheckType=NO_CRC

[PLL0CONFIG]
PLL0CFG0 = 0x00180001
PLL0CFG1 = 0x0205

[EMIF3DDR]
PLL1CFG0 = 0x15010001
PLL1CFG1 = 0x0002
DDRPHYC1R = 0x0043
SDCR = 0x00134632
SDTIMR = 0x26492a09
SDTIMR2 = 0x7d13c722
SDRCR = 0x0249
CLK2XSRC = 0x
[ARM_EMIF3DDR_PATCHFXN]

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


[U-Boot] [PATCH] omap3: board.c - Fix compile warnings

2012-01-14 Thread Pali Rohár
 * This patch fix compile warnings when CONFIG_SYS_L2CACHE_OFF is enabled

   board.c:48:13: warning: ‘omap3_invalidate_l2_cache_secure’ declared ‘static’ 
but never defined
   board.c:373:13: warning: ‘omap3_update_aux_cr’ defined but not used

Signed-off-by: Pali Rohár pali.ro...@gmail.com
---
 arch/arm/cpu/armv7/omap3/board.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 1f33c63..52514ae 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -45,7 +45,10 @@
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 static void omap3_setup_aux_cr(void);
+
+#ifndef CONFIG_SYS_L2CACHE_OFF
 static void omap3_invalidate_l2_cache_secure(void);
+#endif
 
 static const struct gpio_bank gpio_bank_34xx[6] = {
{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
@@ -370,6 +373,7 @@ static void omap3_update_aux_cr_secure(u32 set_bits, u32 
clear_bits)
}
 }
 
+#ifndef CONFIG_SYS_L2CACHE_OFF
 static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
 {
u32 acr;
@@ -382,6 +386,7 @@ static void omap3_update_aux_cr(u32 set_bits, u32 
clear_bits)
/* Write ACR - affects non-secure banked bits */
asm volatile (mcr p15, 0, %0, c1, c0, 1 : : r (acr));
 }
+#endif
 
 static void omap3_setup_aux_cr(void)
 {
-- 
1.7.5.4

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


Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Matthias Fuchs
On 01/14/2012 03:10 PM, Marek Vasut wrote:
 The generic spi flash driver (drivers/mtd/spi/spi_flash.c) uses the
 spi low level driver's spi_xfer() function with len=0 to deassert the
 SPI flash' chip select. But the i.MX28 spi driver rejects this call
 due to len=0.

 This patch implements an exception for len=0 with the SPI_XFER_END
 flag set. This results in an extra read with the chip select being
 deasserted afterwards. There seems to be no way to deassert the signal
 by hand.
 
 This seems good, but it doesn't look too correct either (is there really no 
 other way to deassert CS than doing dummy read?). 
Not that I am aware of. Did you wrote that mxs_spi driver? How did you 
interpret the 
chips reference manual. I understood it this way: you need to tell the 
controller
to deassert chip select before the final transfer.

I could be possible to change the driver implementation and use GPIOs for 
chip select. But I think that's not the philisophy of this controller.

 Do you see an issue with 
 current implementation on some board please?
Yes, I installed an SST25VF032B SPI on the MX28EVK in preparation of our 
own board. The chip was detected correctly after power on, but erasing
(that's one place where the status register polling is used) more than one page
does not work and then after reset the device is not correctly detected.

I would expect problems on the M28EVK (Denx) also. You might want to turn 
SPI + spi_flash debugging to see it. Also I found a posting from
Alexander Keller on the u-boot list from 12/13/2011. Perhaps the can check if
this patch fixes his problems also.

Matthias
 

 Signed-off-by: Matthias Fuchs matthias.fu...@esd.eu
 ---
  drivers/spi/mxs_spi.c |   12 +---
  1 files changed, 9 insertions(+), 3 deletions(-)

 diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
 index 4c27fef..adb9ca8 100644
 --- a/drivers/spi/mxs_spi.c
 +++ b/drivers/spi/mxs_spi.c
 @@ -129,9 +129,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int
 bitlen, int len = bitlen / 8;
  const char *tx = dout;
  char *rx = din;
 -
 -if (bitlen == 0)
 -return 0;
 +char dummy;
 +
 +if (bitlen == 0) {
 +if (flags  SPI_XFER_END) {
 +rx = dummy;
 +len = 1;
 +} else
 +return 0;
 +}

  if (!rx  !tx)
  return 0;
 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot


-- 
-
Dipl.-Ing. Matthias Fuchs
Head of System Design

esd electronic system design gmbh
Vahrenwalder Str. 207 - 30165 Hannover - GERMANY
Phone: +49-511-37298-0 - Fax: +49-511-37298-68
Please visit our homepage http://www.esd.eu
Quality Products - Made in Germany
-
Geschäftsführer: Klaus Detering
Amtsgericht Hannover HRB 51373 - VAT-ID DE 115672832
-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Fabio Estevam
Hi Matthias,

On Sat, Jan 14, 2012 at 10:25 AM, Matthias Fuchs matthias.fu...@esd.eu wrote:
 The generic spi flash driver (drivers/mtd/spi/spi_flash.c) uses the
 spi low level driver's spi_xfer() function with len=0 to deassert the
 SPI flash' chip select. But the i.MX28 spi driver rejects this call
 due to len=0.

 This patch implements an exception for len=0 with the SPI_XFER_END
 flag set. This results in an extra read with the chip select being
 deasserted afterwards. There seems to be no way to deassert the signal
 by hand.

 Signed-off-by: Matthias Fuchs matthias.fu...@esd.eu

What about the approach bellow (untested)?

--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -126,17 +126,14 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 {
struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave);
struct mx28_ssp_regs *ssp_regs = mxs_slave-regs;
-   int len = bitlen / 8;
+   unsigned int len = bitlen / 8;
const char *tx = dout;
char *rx = din;

-   if (bitlen == 0)
-   return 0;
-
if (!rx  !tx)
return 0;

-   if (flags  SPI_XFER_BEGIN)
+   if ((flags  SPI_XFER_BEGIN)  !len)
mxs_spi_start_xfer(ssp_regs);

while (len--) {
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Fabio Estevam
On Sat, Jan 14, 2012 at 4:46 PM, Fabio Estevam feste...@gmail.com wrote:
 Hi Matthias,

 On Sat, Jan 14, 2012 at 10:25 AM, Matthias Fuchs matthias.fu...@esd.eu 
 wrote:
 The generic spi flash driver (drivers/mtd/spi/spi_flash.c) uses the
 spi low level driver's spi_xfer() function with len=0 to deassert the
 SPI flash' chip select. But the i.MX28 spi driver rejects this call
 due to len=0.

 This patch implements an exception for len=0 with the SPI_XFER_END
 flag set. This results in an extra read with the chip select being
 deasserted afterwards. There seems to be no way to deassert the signal
 by hand.

 Signed-off-by: Matthias Fuchs matthias.fu...@esd.eu

 What about the approach bellow (untested)?

Actually I meant this:

--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -136,7 +136,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
if (!rx  !tx)
return 0;

-   if (flags  SPI_XFER_BEGIN)
+   if ((flags  SPI_XFER_BEGIN)  len)
mxs_spi_start_xfer(ssp_regs);

while (len--) {
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Fabio Estevam
On Sat, Jan 14, 2012 at 4:53 PM, Fabio Estevam feste...@gmail.com wrote:

 Actually I meant this:

One more time ;-)

--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -130,13 +130,10 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
const char *tx = dout;
char *rx = din;

-   if (bitlen == 0)
-   return 0;
-
if (!rx  !tx)
return 0;

-   if (flags  SPI_XFER_BEGIN)
+   if ((flags  SPI_XFER_BEGIN)  len)
mxs_spi_start_xfer(ssp_regs);

while (len--) {
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Matthias Fuchs
This cannot work. I do not understand what you are trying to achieve with this.

Matthias

On 01/14/2012 07:54 PM, Fabio Estevam wrote:
 On Sat, Jan 14, 2012 at 4:53 PM, Fabio Estevam feste...@gmail.com wrote:
 
 Actually I meant this:
 
 One more time ;-)
 
 --- a/drivers/spi/mxs_spi.c
 +++ b/drivers/spi/mxs_spi.c
 @@ -130,13 +130,10 @@ int spi_xfer(struct spi_slave *slave, unsigned int 
 bitlen,
 const char *tx = dout;
 char *rx = din;
 
 -   if (bitlen == 0)
 -   return 0;
 -
 if (!rx  !tx)
 return 0;
 
 -   if (flags  SPI_XFER_BEGIN)
 +   if ((flags  SPI_XFER_BEGIN)  len)
 mxs_spi_start_xfer(ssp_regs);
 
 while (len--) {
 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot

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


Re: [U-Boot] [PATCH] omap3: board.c - Fix compile warnings

2012-01-14 Thread Marek Vasut
  * This patch fix compile warnings when CONFIG_SYS_L2CACHE_OFF is enabled
 
board.c:48:13: warning: ‘omap3_invalidate_l2_cache_secure’ declared
 ‘static’ but never defined board.c:373:13: warning: ‘omap3_update_aux_cr’
 defined but not used
 
 Signed-off-by: Pali Rohár pali.ro...@gmail.com
 ---
  arch/arm/cpu/armv7/omap3/board.c |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/cpu/armv7/omap3/board.c
 b/arch/arm/cpu/armv7/omap3/board.c index 1f33c63..52514ae 100644
 --- a/arch/arm/cpu/armv7/omap3/board.c
 +++ b/arch/arm/cpu/armv7/omap3/board.c
 @@ -45,7 +45,10 @@
  /* Declarations */
  extern omap3_sysinfo sysinfo;
  static void omap3_setup_aux_cr(void);
 +
 +#ifndef CONFIG_SYS_L2CACHE_OFF
  static void omap3_invalidate_l2_cache_secure(void);
 +#endif

This is due to the ordering, right ? Now, split this into two patches, because 
you're actually doing two unrelated things.

 
  static const struct gpio_bank gpio_bank_34xx[6] = {
   { (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
 @@ -370,6 +373,7 @@ static void omap3_update_aux_cr_secure(u32 set_bits,
 u32 clear_bits) }
  }
 
 +#ifndef CONFIG_SYS_L2CACHE_OFF
  static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
  {
   u32 acr;
 @@ -382,6 +386,7 @@ static void omap3_update_aux_cr(u32 set_bits, u32
 clear_bits) /* Write ACR - affects non-secure banked bits */
   asm volatile (mcr p15, 0, %0, c1, c0, 1 : : r (acr));
  }
 +#endif

Just move this function a few lines below instead of adding more CPP bloat.

 
  static void omap3_setup_aux_cr(void)
  {

Also, does this manifest on omap4 too?

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


Re: [U-Boot] [PATCH] omap3: board.c - Fix compile warnings

2012-01-14 Thread Marek Vasut
   * This patch fix compile warnings when CONFIG_SYS_L2CACHE_OFF is enabled
   
 board.c:48:13: warning: ‘omap3_invalidate_l2_cache_secure’ declared
  
  ‘static’ but never defined board.c:373:13: warning: ‘omap3_update_aux_cr’
  defined but not used
  
  Signed-off-by: Pali Rohár pali.ro...@gmail.com
  ---
  
   arch/arm/cpu/armv7/omap3/board.c |5 +
   1 files changed, 5 insertions(+), 0 deletions(-)
  
  diff --git a/arch/arm/cpu/armv7/omap3/board.c
  b/arch/arm/cpu/armv7/omap3/board.c index 1f33c63..52514ae 100644
  --- a/arch/arm/cpu/armv7/omap3/board.c
  +++ b/arch/arm/cpu/armv7/omap3/board.c
  @@ -45,7 +45,10 @@
  
   /* Declarations */
   extern omap3_sysinfo sysinfo;
   static void omap3_setup_aux_cr(void);
  
  +
  +#ifndef CONFIG_SYS_L2CACHE_OFF
  
   static void omap3_invalidate_l2_cache_secure(void);
  
  +#endif
 
 This is due to the ordering, right ? Now, split this into two patches,
 because you're actually doing two unrelated things.
 
   static const struct gpio_bank gpio_bank_34xx[6] = {
   
  { (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
  
  @@ -370,6 +373,7 @@ static void omap3_update_aux_cr_secure(u32 set_bits,
  u32 clear_bits) }
  
   }
  
  +#ifndef CONFIG_SYS_L2CACHE_OFF
  
   static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
   {
   
  u32 acr;
  
  @@ -382,6 +386,7 @@ static void omap3_update_aux_cr(u32 set_bits, u32
  clear_bits) /* Write ACR - affects non-secure banked bits */
  
  asm volatile (mcr p15, 0, %0, c1, c0, 1 : : r (acr));
   
   }
  
  +#endif
 
 Just move this function a few lines below instead of adding more CPP bloat.
 
   static void omap3_setup_aux_cr(void)
   {
 
 Also, does this manifest on omap4 too?
 
 M

And one last thing ... Cc appropriate maintainers please
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx28: fix i.MX28 spi driver

2012-01-14 Thread Fabio Estevam
On Sat, Jan 14, 2012 at 6:09 PM, Matthias Fuchs matthias.fu...@esd.eu wrote:
 This cannot work. I do not understand what you are trying to achieve with 
 this.

I would like to avoid the extra dummy read that your patch proposes.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 2/3] zipitz2: enable pxa27x_mkp driver

2012-01-14 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: remove usbtty stuff from EXTRA_ENV_SETTINGS
v3: shift+backspace should produce backspace code
v4: no change

 include/configs/zipitz2.h |   82 ++---
 1 files changed, 77 insertions(+), 5 deletions(-)

diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
index 26204af..76054af 100644
--- a/include/configs/zipitz2.h
+++ b/include/configs/zipitz2.h
@@ -80,6 +80,12 @@
 #defineCONFIG_CMD_MMC
 #defineCONFIG_CMD_SPI
 
+#defineCONFIG_EXTRA_ENV_SETTINGS   
\
+   stdout=lcd\0  \
+   stdin=pxa27x-mkp\0\
+   stderr=lcd\0  \
+   
+#defineCONFIG_KEYBOARD
 /*
  * MMC Card Configuration
  */
@@ -206,15 +212,81 @@ unsigned char zipitz2_spi_read(void);
 #define CONFIG_SYS_FLASH_PROTECTION
 
 /*
+ * Matrix keypad
+ */
+#ifdef CONFIG_KEYBOARD
+#defineCONFIG_PXA27X_MKP
+
+#defineCONFIG_PXA27X_MKP_MKP_COLS  7
+#defineCONFIG_PXA27X_MKP_MKP_ROWS  6
+
+#defineCONFIG_PXA27X_MKP_DEBOUNCE  30
+#defineCONFIG_PXA27X_MKP_DELAY 3
+
+#defineCONFIG_PXA27X_MKP_MOD_SHIFT {5, 3}
+#defineCONFIG_PXA27X_MKP_MOD_ALT   {5, 2}
+#defineCONFIG_PXA27X_MKP_MOD_CTRL  {5, 4}
+
+#defineCONFIG_PXA27X_MKP_KEYMAP\
+   { 1, 1, 'q', 'Q', '1', 0xff },  \
+   { 2, 1, 'i', 'I', '8', 0xff },  \
+   { 3, 1, 'g', 'G', '\', 0xff }, \
+   { 4, 1, 'x', 'X', '/', 0xff },  \
+   { 5, 1, '\r', 0xff, 0xff, 0xff },   \
+   { 6, 1, '-', 0xff, 0xff, 0xff },\
+   \
+   { 1, 2, 'w', 'W', '2', 0xff },  \
+   { 2, 2, 'o', 'O', '9', 0xff },  \
+   { 3, 2, 'h', 'H', '\'', 0xff }, \
+   { 4, 2, 'c', 'C', '+', 0xff },  \
+   \
+   { 1, 3, 'e', 'E', '3', 0xff },  \
+   { 2, 3, 'p', 'P', '0', 0xff },  \
+   { 3, 3, 'j', 'J', '[', 0xff },  \
+   { 4, 3, 'v', 'V', '*', 0xff },  \
+   \
+   { 0, 4, '\e', 0xff, '|', 0xff },\
+   { 1, 4, 'r', 'R', '4', 0xff },  \
+   { 2, 4, 'a', 'A', '$', 0xff },  \
+   { 3, 4, 'k', 'K', ']', 0xff },  \
+   { 4, 4, 'b', 'B', '=', 0xff },  \
+   \
+   { 0, 5, '\t', 0xff, 0xff, 0xff },   \
+   { 1, 5, 't', 'T', '5', 0xff },  \
+   { 2, 5, 's', 'S', '#', 0xff },  \
+   { 3, 5, 'l', 'L', '-', 0xff },  \
+   { 4, 5, 'n', 'N', '_', 0xff },  \
+   { 5, 5, ' ', 0xff, 0xff, 0xff },\
+   \
+   { 1, 6, 'y', 'Y', '6', 0xff },  \
+   { 2, 6, 'd', 'D', '', 0xff },  \
+   { 3, 6, '\b', '\b', '\\', 0xff },   \
+   { 4, 6, 'm', 'M', '?', 0xff },  \
+   { 5, 6, ',', '(', '', '{' },   \
+   \
+   { 1, 7, 'u', 'U', '7', 0xff },  \
+   { 2, 7, 'f', 'F', '@', 0xff },  \
+   { 3, 7, 'z', 'Z', '!', 0xff },  \
+   { 4, 7, ';', '~', ':', 0xff },  \
+   { 5, 7, '.', ')', '', '}' },   \
+   \
+   { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
+
+#defineCONFIG_SYS_CONSOLE_ENV_OVERWRITE
+#defineCONFIG_SYS_CONSOLE_IS_IN_ENV
+
+#endif
+
+/*
  * GPIO settings
  */
 #define CONFIG_SYS_GAFR0_L_VAL 0x02000140
-#define CONFIG_SYS_GAFR0_U_VAL 0x59188000
-#define CONFIG_SYS_GAFR1_L_VAL 0x6392
+#define CONFIG_SYS_GAFR0_U_VAL 0x59188005
+#define CONFIG_SYS_GAFR1_L_VAL 0x639420a2
 #define CONFIG_SYS_GAFR1_U_VAL 0xaaa03950
 #define CONFIG_SYS_GAFR2_L_VAL 0x0aaa
 #define CONFIG_SYS_GAFR2_U_VAL 0x29000308
-#define CONFIG_SYS_GAFR3_L_VAL 0x5400
+#define CONFIG_SYS_GAFR3_L_VAL 0x56aa9500
 #define CONFIG_SYS_GAFR3_U_VAL 0x00d5
 #define CONFIG_SYS_GPCR0_VAL   0x
 #define CONFIG_SYS_GPCR1_VAL   0x0020
@@ -222,7 +294,7 @@ unsigned char zipitz2_spi_read(void);
 #define CONFIG_SYS_GPCR3_VAL   0x
 #define CONFIG_SYS_GPDR0_VAL   0xdafcee00
 #define CONFIG_SYS_GPDR1_VAL   0xffa3aaab
-#define CONFIG_SYS_GPDR2_VAL   0x8fe9
+#define CONFIG_SYS_GPDR2_VAL   0x8fe1
 #define CONFIG_SYS_GPDR3_VAL   0x001b1f8a
 #define CONFIG_SYS_GPSR0_VAL   0x06080400
 #define CONFIG_SYS_GPSR1_VAL   0x007f
@@ -234,7 +306,7 @@ unsigned char zipitz2_spi_read(void);
 /*
  * Clock settings
  */
-#define CONFIG_SYS_CKEN0x00511220
+#define CONFIG_SYS_CKEN0x00591220
 #define CONFIG_SYS_CCCR0x0190
 
 /*
-- 
1.7.8.3

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


[U-Boot] [PATCH v4 1/3] PXA: PXA27x Matrix keypad driver

2012-01-14 Thread Vasily Khoruzhick
From: Marek Vasut marek.va...@gmail.com

Signed-off-by: Marek Vasut marek.va...@gmail.com
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
[vasily: adapted Marek's old version for newer u-boot,
 fixed multiple keypresses handling]
---
v2: use struct-based access to regs, minor cleanup
v3: fix multiple keypresses handling, minor cleanup
v4: another minor cleanup

 arch/arm/include/asm/arch-pxa/pxa-regs.h|   52 -
 arch/arm/include/asm/arch-pxa/regs-keypad.h |   84 
 drivers/input/Makefile  |2 +
 drivers/input/pxa27x-mkp.c  |  293 +++
 4 files changed, 379 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-pxa/regs-keypad.h
 create mode 100644 drivers/input/pxa27x-mkp.c

diff --git a/arch/arm/include/asm/arch-pxa/pxa-regs.h 
b/arch/arm/include/asm/arch-pxa/pxa-regs.h
index b81b42c..d562658 100644
--- a/arch/arm/include/asm/arch-pxa/pxa-regs.h
+++ b/arch/arm/include/asm/arch-pxa/pxa-regs.h
@@ -2567,58 +2567,6 @@ typedef void (*ExcpHndlr) (void) ;
 #define OVL2C1_O2EN(131) /* Enable bit for Overlay 2 */
 #define CCR_CEN(131) /* Enable bit for Cursor */
 
-/* Keypad controller */
-
-#define KPC0x4150 /* Keypad Interface Control register */
-#define KPDK   0x4158 /* Keypad Interface Direct Key register */
-#define KPREC  0x41500010 /* Keypad Intefcace Rotary Encoder register 
*/
-#define KPMK   0x41500018 /* Keypad Intefcace Matrix Key register */
-#define KPAS   0x41500020 /* Keypad Interface Automatic Scan register 
*/
-#define KPASMKP0   0x41500028 /* Keypad Interface Automatic Scan Multiple 
Key Presser register 0 */
-#define KPASMKP1   0x41500030 /* Keypad Interface Automatic Scan Multiple 
Key Presser register 1 */
-#define KPASMKP2   0x41500038 /* Keypad Interface Automatic Scan Multiple 
Key Presser register 2 */
-#define KPASMKP3   0x41500040 /* Keypad Interface Automatic Scan Multiple 
Key Presser register 3 */
-#define KPKDI  0x41500048 /* Keypad Interface Key Debounce Interval 
register */
-
-#define KPC_AS (0x1  30)  /* Automatic Scan bit */
-#define KPC_ASACT  (0x1  29)  /* Automatic Scan on Activity */
-#define KPC_MI (0x1  22)  /* Matrix interrupt bit */
-#define KPC_IMKP   (0x1  21)  /* Ignore Multiple Key Press */
-#define KPC_MS7(0x1  20)  /* Matrix scan line 7 */
-#define KPC_MS6(0x1  19)  /* Matrix scan line 6 */
-#define KPC_MS5(0x1  18)  /* Matrix scan line 5 */
-#define KPC_MS4(0x1  17)  /* Matrix scan line 4 */
-#define KPC_MS3(0x1  16)  /* Matrix scan line 3 */
-#define KPC_MS2(0x1  15)  /* Matrix scan line 2 */
-#define KPC_MS1(0x1  14)  /* Matrix scan line 1 */
-#define KPC_MS0(0x1  13)  /* Matrix scan line 0 */
-#define KPC_ME (0x1  12)  /* Matrix Keypad Enable */
-#define KPC_MIE(0x1  11)  /* Matrix Interrupt Enable */
-#define KPC_DK_DEB_SEL (0x1   9)  /* Direct Key Debounce select */
-#define KPC_DI (0x1   5)  /* Direct key interrupt bit */
-#define KPC_DEE0   (0x1   2)  /* Rotary Encoder 0 Enable */
-#define KPC_DE (0x1   1)  /* Direct Keypad Enable */
-#define KPC_DIE(0x1   0)  /* Direct Keypad interrupt Enable 
*/
-
-#define KPDK_DKP   (0x1  31)
-#define KPDK_DK7   (0x1   7)
-#define KPDK_DK6   (0x1   6)
-#define KPDK_DK5   (0x1   5)
-#define KPDK_DK4   (0x1   4)
-#define KPDK_DK3   (0x1   3)
-#define KPDK_DK2   (0x1   2)
-#define KPDK_DK1   (0x1   1)
-#define KPDK_DK0   (0x1   0)
-
-#define KPREC_OF1  (0x1  31)
-#define kPREC_UF1  (0x1  30)
-#define KPREC_OF0  (0x1  15)
-#define KPREC_UF0  (0x1  14)
-
-#define KPMK_MKP   (0x1  31)
-#define KPAS_SO(0x1  31)
-#define KPASMKPx_SO(0x1  31)
-
 #define GPIO113_BIT(1  17)/* GPIO113 in GPSR, GPCR, bit 17 */
 #define PSLR   0x40F00034
 #define PSTR   0x40F00038  /* Power Manager Standby Configuration Reg 
*/
diff --git a/arch/arm/include/asm/arch-pxa/regs-keypad.h 
b/arch/arm/include/asm/arch-pxa/regs-keypad.h
new file mode 100644
index 000..1909417
--- /dev/null
+++ b/arch/arm/include/asm/arch-pxa/regs-keypad.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2012 Vasily Khoruzhick anars...@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 

[U-Boot] [PATCH v4 3/3] zipitz2: use pxa_mmc_gen as MMC driver

2012-01-14 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: mmcinfo is necessary to scan card for partitions
v3: replace mmcinfo with mmc rescan
v4: mmc rescan does not take extra argument in recent u-boot,
so remove it.

 board/zipitz2/zipitz2.c   |8 
 include/configs/zipitz2.h |   14 --
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/board/zipitz2/zipitz2.c b/board/zipitz2/zipitz2.c
index b093c2f..4075fb6 100644
--- a/board/zipitz2/zipitz2.c
+++ b/board/zipitz2/zipitz2.c
@@ -79,6 +79,14 @@ void dram_init_banksize(void)
gd-bd-bi_dram[0].size = PHYS_SDRAM_1_SIZE;
 }
 
+#ifdef CONFIG_CMD_MMC
+int board_mmc_init(bd_t *bis)
+{
+   pxa_mmc_register(0);
+   return 0;
+}
+#endif
+
 #ifdef CONFIG_CMD_SPI
 
 struct {
diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
index 76054af..9640ebb 100644
--- a/include/configs/zipitz2.h
+++ b/include/configs/zipitz2.h
@@ -44,11 +44,12 @@
 #defineCONFIG_SYS_MALLOC_LEN   (128*1024)
 #defineCONFIG_ARCH_CPU_INIT
 
-#defineCONFIG_BOOTCOMMAND  
\
-   if mmc init  fatload mmc 0 0xa000 uboot.script ; then   \
-   source 0xa000;\
-   else  \
-   bootm 0x6;\
+#defineCONFIG_BOOTCOMMAND  
   \
+   if mmc rescan  ext2load mmc 0 0xa000 boot/uboot.script ; \
+   then \
+   source 0xa000;   \
+   else \
+   bootm 0x6;   \
fi; 
 #defineCONFIG_BOOTARGS 
\
console=tty0 console=ttyS2,115200 fbcon=rotate:3
@@ -91,7 +92,8 @@
  */
 #ifdef CONFIG_CMD_MMC
 #defineCONFIG_MMC
-#defineCONFIG_PXA_MMC
+#defineCONFIG_GENERIC_MMC
+#defineCONFIG_PXA_MMC_GENERIC
 #defineCONFIG_SYS_MMC_BASE 0xF000
 #defineCONFIG_CMD_FAT
 #define CONFIG_CMD_EXT2
-- 
1.7.8.3

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


Re: [U-Boot] [PATCH v4 1/3] PXA: PXA27x Matrix keypad driver

2012-01-14 Thread Marek Vasut
 From: Marek Vasut marek.va...@gmail.com
 
 Signed-off-by: Marek Vasut marek.va...@gmail.com
 Signed-off-by: Vasily Khoruzhick anars...@gmail.com
 [vasily: adapted Marek's old version for newer u-boot,
  fixed multiple keypresses handling]
 ---
 v2: use struct-based access to regs, minor cleanup
 v3: fix multiple keypresses handling, minor cleanup
 v4: another minor cleanup

What the ... damn ... actually changed? Can you be less descriptive next time 
please?

 
  arch/arm/include/asm/arch-pxa/pxa-regs.h|   52 -
  arch/arm/include/asm/arch-pxa/regs-keypad.h |   84 
  drivers/input/Makefile  |2 +
  drivers/input/pxa27x-mkp.c  |  293
 +++ 4 files changed, 379 insertions(+), 52
 deletions(-)
  create mode 100644 arch/arm/include/asm/arch-pxa/regs-keypad.h
  create mode 100644 drivers/input/pxa27x-mkp.c
 
 diff --git a/arch/arm/include/asm/arch-pxa/pxa-regs.h
 b/arch/arm/include/asm/arch-pxa/pxa-regs.h index b81b42c..d562658 100644
 --- a/arch/arm/include/asm/arch-pxa/pxa-regs.h
 +++ b/arch/arm/include/asm/arch-pxa/pxa-regs.h
 @@ -2567,58 +2567,6 @@ typedef void   (*ExcpHndlr) (void) ;
  #define OVL2C1_O2EN  (131) /* Enable bit for Overlay 2 */
  #define CCR_CEN  (131) /* Enable bit for Cursor */
 
 -/* Keypad controller */
 -
 -#define KPC  0x4150 /* Keypad Interface Control register */
 -#define KPDK 0x4158 /* Keypad Interface Direct Key register */
 -#define KPREC0x41500010 /* Keypad Intefcace Rotary Encoder 
register */
 -#define KPMK 0x41500018 /* Keypad Intefcace Matrix Key register */
 -#define KPAS 0x41500020 /* Keypad Interface Automatic Scan register 
*/
 -#define KPASMKP0 0x41500028 /* Keypad Interface Automatic Scan Multiple
 Key Presser register 0 */ -#define KPASMKP1   0x41500030 /* Keypad Interface
 Automatic Scan Multiple Key Presser register 1 */ -#define
 KPASMKP2  0x41500038 /* Keypad Interface Automatic Scan Multiple Key
 Presser register 2 */ -#define KPASMKP3   0x41500040 /* Keypad Interface
 Automatic Scan Multiple Key Presser register 3 */ -#define
 KPKDI 0x41500048 /* Keypad Interface Key Debounce Interval register 
 */ 
-
 -#define KPC_AS   (0x1  30)  /* Automatic Scan bit */
 -#define KPC_ASACT(0x1  29)  /* Automatic Scan on Activity */
 -#define KPC_MI   (0x1  22)  /* Matrix interrupt bit */
 -#define KPC_IMKP (0x1  21)  /* Ignore Multiple Key Press */
 -#define KPC_MS7  (0x1  20)  /* Matrix scan line 7 */
 -#define KPC_MS6  (0x1  19)  /* Matrix scan line 6 */
 -#define KPC_MS5  (0x1  18)  /* Matrix scan line 5 */
 -#define KPC_MS4  (0x1  17)  /* Matrix scan line 4 */
 -#define KPC_MS3  (0x1  16)  /* Matrix scan line 3 */
 -#define KPC_MS2  (0x1  15)  /* Matrix scan line 2 */
 -#define KPC_MS1  (0x1  14)  /* Matrix scan line 1 */
 -#define KPC_MS0  (0x1  13)  /* Matrix scan line 0 */
 -#define KPC_ME   (0x1  12)  /* Matrix Keypad Enable */
 -#define KPC_MIE  (0x1  11)  /* Matrix Interrupt Enable */
 -#define KPC_DK_DEB_SEL   (0x1   9)  /* Direct Key Debounce select */
 -#define KPC_DI   (0x1   5)  /* Direct key interrupt bit */
 -#define KPC_DEE0 (0x1   2)  /* Rotary Encoder 0 Enable */
 -#define KPC_DE   (0x1   1)  /* Direct Keypad Enable */
 -#define KPC_DIE  (0x1   0)  /* Direct Keypad interrupt Enable 
*/
 -
 -#define KPDK_DKP (0x1  31)
 -#define KPDK_DK7 (0x1   7)
 -#define KPDK_DK6 (0x1   6)
 -#define KPDK_DK5 (0x1   5)
 -#define KPDK_DK4 (0x1   4)
 -#define KPDK_DK3 (0x1   3)
 -#define KPDK_DK2 (0x1   2)
 -#define KPDK_DK1 (0x1   1)
 -#define KPDK_DK0 (0x1   0)
 -
 -#define KPREC_OF1(0x1  31)
 -#define kPREC_UF1(0x1  30)
 -#define KPREC_OF0(0x1  15)
 -#define KPREC_UF0(0x1  14)
 -
 -#define KPMK_MKP (0x1  31)
 -#define KPAS_SO  (0x1  31)
 -#define KPASMKPx_SO  (0x1  31)
 -
  #define GPIO113_BIT  (1  17)/* GPIO113 in GPSR, GPCR, bit 17 */
  #define PSLR 0x40F00034
  #define PSTR 0x40F00038  /* Power Manager Standby Configuration Reg 
*/
 diff --git a/arch/arm/include/asm/arch-pxa/regs-keypad.h
 b/arch/arm/include/asm/arch-pxa/regs-keypad.h new file mode 100644
 index 000..1909417
 --- /dev/null
 +++ b/arch/arm/include/asm/arch-pxa/regs-keypad.h
 @@ -0,0 +1,84 @@
 +/*
 + * Copyright (C) 2012 Vasily Khoruzhick anars...@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 

Re: [U-Boot] [PATCH v4 3/3] zipitz2: use pxa_mmc_gen as MMC driver

2012-01-14 Thread Marek Vasut
 Signed-off-by: Vasily Khoruzhick anars...@gmail.com
 ---
 v2: mmcinfo is necessary to scan card for partitions
 v3: replace mmcinfo with mmc rescan
 v4: mmc rescan does not take extra argument in recent u-boot,
 so remove it.
 
  board/zipitz2/zipitz2.c   |8 
  include/configs/zipitz2.h |   14 --
  2 files changed, 16 insertions(+), 6 deletions(-)
 
 diff --git a/board/zipitz2/zipitz2.c b/board/zipitz2/zipitz2.c
 index b093c2f..4075fb6 100644
 --- a/board/zipitz2/zipitz2.c
 +++ b/board/zipitz2/zipitz2.c
 @@ -79,6 +79,14 @@ void dram_init_banksize(void)
   gd-bd-bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  }
 
 +#ifdef   CONFIG_CMD_MMC
 +int board_mmc_init(bd_t *bis)
 +{
 + pxa_mmc_register(0);
 + return 0;
 +}
 +#endif
 +
  #ifdef   CONFIG_CMD_SPI
 
  struct {
 diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
 index 76054af..9640ebb 100644
 --- a/include/configs/zipitz2.h
 +++ b/include/configs/zipitz2.h
 @@ -44,11 +44,12 @@
  #define  CONFIG_SYS_MALLOC_LEN   (128*1024)
  #define  CONFIG_ARCH_CPU_INIT
 
 -#define  CONFIG_BOOTCOMMAND  
\
 - if mmc init  fatload mmc 0 0xa000 uboot.script ; then   \
 - source 0xa000;\
 - else  \
 - bootm 0x6;\
 +#define  CONFIG_BOOTCOMMAND  

\
 + if mmc rescan  ext2load mmc 0 0xa000 boot/uboot.script ; \
 + then \
 + source 0xa000;   \
 + else \
 + bootm 0x6;   \
   fi; 

You keep producing spaces/tabs at random before the backslash at the end of the 
line, please fix that and I apply this. No more comments here.

  #define  CONFIG_BOOTARGS 
\
   console=tty0 console=ttyS2,115200 fbcon=rotate:3
 @@ -91,7 +92,8 @@
   */
  #ifdef   CONFIG_CMD_MMC
  #define  CONFIG_MMC
 -#define  CONFIG_PXA_MMC
 +#define  CONFIG_GENERIC_MMC
 +#define  CONFIG_PXA_MMC_GENERIC
  #define  CONFIG_SYS_MMC_BASE 0xF000
  #define  CONFIG_CMD_FAT
  #define CONFIG_CMD_EXT2
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] omap3: board.c - Fix compile warnings

2012-01-14 Thread Pali Rohár
On Saturday 14 January 2012 21:12:00 Marek Vasut wrote:
   * This patch fix compile warnings when CONFIG_SYS_L2CACHE_OFF is enabled
 
 board.c:48:13: warning: ‘omap3_invalidate_l2_cache_secure’ declared
 
  ‘static’ but never defined board.c:373:13: warning: ‘omap3_update_aux_cr’
  defined but not used
 
  Signed-off-by: Pali Rohár pali.ro...@gmail.com
  ---
 
   arch/arm/cpu/armv7/omap3/board.c |5 +
   1 files changed, 5 insertions(+), 0 deletions(-)
 
  diff --git a/arch/arm/cpu/armv7/omap3/board.c
  b/arch/arm/cpu/armv7/omap3/board.c index 1f33c63..52514ae 100644
  --- a/arch/arm/cpu/armv7/omap3/board.c
  +++ b/arch/arm/cpu/armv7/omap3/board.c
  @@ -45,7 +45,10 @@
 
   /* Declarations */
   extern omap3_sysinfo sysinfo;
   static void omap3_setup_aux_cr(void);
 
  +
  +#ifndef CONFIG_SYS_L2CACHE_OFF
 
   static void omap3_invalidate_l2_cache_secure(void);
 
  +#endif

 This is due to the ordering, right ? Now, split this into two patches,
 because you're actually doing two unrelated things.

No, function omap3_invalidate_l2_cache_secure is defined in block #ifndef
CONFIG_SYS_L2CACHE_OFF. So declaration should be in #ifndef too.


   static const struct gpio_bank gpio_bank_34xx[6] = {
 
  { (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
 
  @@ -370,6 +373,7 @@ static void omap3_update_aux_cr_secure(u32 set_bits,
  u32 clear_bits) }
 
   }
 
  +#ifndef CONFIG_SYS_L2CACHE_OFF
 
   static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
   {
 
  u32 acr;
 
  @@ -382,6 +386,7 @@ static void omap3_update_aux_cr(u32 set_bits, u32
  clear_bits) /* Write ACR - affects non-secure banked bits */
 
  asm volatile (mcr p15, 0, %0, c1, c0, 1 : : r (acr));
 
   }
 
  +#endif

 Just move this function a few lines below instead of adding more CPP bloat.

Function omap3_update_aux_cr is called only when CONFIG_SYS_L2CACHE_OFF is not
defined, so adding #ifndef is needed.


   static void omap3_setup_aux_cr(void)
   {

 Also, does this manifest on omap4 too?

 M

--
Pali Rohár
pali.ro...@gmail.com

signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] omap3: board.c - Fix compile warnings

2012-01-14 Thread Marek Vasut
 On Saturday 14 January 2012 21:12:00 Marek Vasut wrote:
* This patch fix compile warnings when CONFIG_SYS_L2CACHE_OFF is
enabled

  board.c:48:13: warning: ‘omap3_invalidate_l2_cache_secure’ declared
   
   ‘static’ but never defined board.c:373:13: warning:
   ‘omap3_update_aux_cr’ defined but not used
   
   Signed-off-by: Pali Rohár pali.ro...@gmail.com
   ---
   
arch/arm/cpu/armv7/omap3/board.c |5 +
1 files changed, 5 insertions(+), 0 deletions(-)
   
   diff --git a/arch/arm/cpu/armv7/omap3/board.c
   b/arch/arm/cpu/armv7/omap3/board.c index 1f33c63..52514ae 100644
   --- a/arch/arm/cpu/armv7/omap3/board.c
   +++ b/arch/arm/cpu/armv7/omap3/board.c
   @@ -45,7 +45,10 @@
   
/* Declarations */
extern omap3_sysinfo sysinfo;
static void omap3_setup_aux_cr(void);
   
   +
   +#ifndef CONFIG_SYS_L2CACHE_OFF
   
static void omap3_invalidate_l2_cache_secure(void);
   
   +#endif
  
  This is due to the ordering, right ? Now, split this into two patches,
  because you're actually doing two unrelated things.
 
 No, function omap3_invalidate_l2_cache_secure is defined in block #ifndef
 CONFIG_SYS_L2CACHE_OFF. So declaration should be in #ifndef too.

Well ... I didn't object to that. I was just pointing out you're fixing forward 
declaration to undefined function. You should make a separate patch for that 
and 
explain it in the changelog so it's easily bisectable.

 
static const struct gpio_bank gpio_bank_34xx[6] = {

 { (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
   
   @@ -370,6 +373,7 @@ static void omap3_update_aux_cr_secure(u32
   set_bits, u32 clear_bits) }
   
}
   
   +#ifndef CONFIG_SYS_L2CACHE_OFF
   
static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
{

 u32 acr;
   
   @@ -382,6 +386,7 @@ static void omap3_update_aux_cr(u32 set_bits, u32
   clear_bits) /* Write ACR - affects non-secure banked bits */
   
 asm volatile (mcr p15, 0, %0, c1, c0, 1 : : r (acr));

}
   
   +#endif
  
  Just move this function a few lines below instead of adding more CPP
  bloat.
 
 Function omap3_update_aux_cr is called only when CONFIG_SYS_L2CACHE_OFF is
 not defined, so adding #ifndef is needed.

Sigh ... move this function to the whole #ifndef block a few lines under that 
function.

 
static void omap3_setup_aux_cr(void)
{
  
  Also, does this manifest on omap4 too?
  
  M
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] omap3: board.c - Fix compile warnings

2012-01-14 Thread Tom Rini
On Sat, Jan 14, 2012 at 4:40 PM, Pali Rohár pali.ro...@gmail.com wrote:
 On Saturday 14 January 2012 21:12:00 Marek Vasut wrote:
   * This patch fix compile warnings when CONFIG_SYS_L2CACHE_OFF is enabled
 
     board.c:48:13: warning: ‘omap3_invalidate_l2_cache_secure’ declared
 
  ‘static’ but never defined board.c:373:13: warning: ‘omap3_update_aux_cr’
  defined but not used
 
  Signed-off-by: Pali Rohár pali.ro...@gmail.com
  ---
 
   arch/arm/cpu/armv7/omap3/board.c |    5 +
   1 files changed, 5 insertions(+), 0 deletions(-)
 
  diff --git a/arch/arm/cpu/armv7/omap3/board.c
  b/arch/arm/cpu/armv7/omap3/board.c index 1f33c63..52514ae 100644
  --- a/arch/arm/cpu/armv7/omap3/board.c
  +++ b/arch/arm/cpu/armv7/omap3/board.c
  @@ -45,7 +45,10 @@
 
   /* Declarations */
   extern omap3_sysinfo sysinfo;
   static void omap3_setup_aux_cr(void);
 
  +
  +#ifndef CONFIG_SYS_L2CACHE_OFF
 
   static void omap3_invalidate_l2_cache_secure(void);
 
  +#endif

 This is due to the ordering, right ? Now, split this into two patches,
 because you're actually doing two unrelated things.

 No, function omap3_invalidate_l2_cache_secure is defined in block #ifndef
 CONFIG_SYS_L2CACHE_OFF. So declaration should be in #ifndef too.

Right, but if we move the function to be just before it's used, inside
the existing ifndef block we can remove the prototype instead.

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


Re: [U-Boot] [PATCH] omap3: board.c - Fix compile warnings

2012-01-14 Thread Marek Vasut
 On Sat, Jan 14, 2012 at 4:40 PM, Pali Rohár pali.ro...@gmail.com wrote:
  On Saturday 14 January 2012 21:12:00 Marek Vasut wrote:
* This patch fix compile warnings when CONFIG_SYS_L2CACHE_OFF is
   enabled
   
  board.c:48:13: warning: ‘omap3_invalidate_l2_cache_secure’ declared
   
   ‘static’ but never defined board.c:373:13: warning:
   ‘omap3_update_aux_cr’ defined but not used
   
   Signed-off-by: Pali Rohár pali.ro...@gmail.com
   ---
   
arch/arm/cpu/armv7/omap3/board.c |5 +
1 files changed, 5 insertions(+), 0 deletions(-)
   
   diff --git a/arch/arm/cpu/armv7/omap3/board.c
   b/arch/arm/cpu/armv7/omap3/board.c index 1f33c63..52514ae 100644
   --- a/arch/arm/cpu/armv7/omap3/board.c
   +++ b/arch/arm/cpu/armv7/omap3/board.c
   @@ -45,7 +45,10 @@
   
/* Declarations */
extern omap3_sysinfo sysinfo;
static void omap3_setup_aux_cr(void);
   
   +
   +#ifndef CONFIG_SYS_L2CACHE_OFF
   
static void omap3_invalidate_l2_cache_secure(void);
   
   +#endif
  
  This is due to the ordering, right ? Now, split this into two patches,
  because you're actually doing two unrelated things.
  
  No, function omap3_invalidate_l2_cache_secure is defined in block #ifndef
  CONFIG_SYS_L2CACHE_OFF. So declaration should be in #ifndef too.
 
 Right, but if we move the function to be just before it's used, inside
 the existing ifndef block we can remove the prototype instead.

Yep, it's just an function ordering issue being solved here.

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


[U-Boot] [PATCH 0/17] tegra: Add display driver and LCD support for Seaboard

2012-01-14 Thread Simon Glass
This series adds support for the Tegra2x's display peripheral. This
supports the LCD display on Seaboard and we use this to enable console
output in U-Boot on the LCD.

Configuration is via the device tree. Proposed bindings are included
in this series.

To improve performance two optimisations are offered:

1. The LCD frame buffer is cached, with the cache being flushed after
each call puts(). This dramatically increases performance (around 10x).
This requires a few additions to the ARM cache support.

2. The console supports scrolling in steps of more than 1 line. This
speeds up scrolling output considerably, particularly commands like
'printenv' which display a lot of output. This requires a new CONFIG
and a change to the console_scrollup() function.


Mayuresh Kulkarni (1):
  tegra: Enable display/lcd support on Seaboard

Simon Glass (15):
  fdt: Add function to look up a phandle's register address
  fdt: Add header guard to fdtdec.h
  fdt: Correct GPIO name access in fdtdec
  tegra: Add display support to funcmux
  tegra: fdt: Add LCD definitions for Tegra
  tegra: Add support for PWFM
  tegra: Add LCD driver
  tegra: Add LCD support to Nvidia boards
  arm: Add control over cachability of memory regions
  lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU
  lcd: Add support for flushing LCD fb from dcache after update
  tegra: Align LCD frame buffer to section boundary
  tegra: Support control of cache settings for LCD
  tegra: fdt: Add LCD definitions for Seaboard
  lcd: Add CONSOLE_SCROLL_LINES option to speed console

Wei Ni (1):
  tegra: Add SOC support for display/lcd

 README  |   16 +
 arch/arm/cpu/armv7/cache_v7.c   |   11 +
 arch/arm/cpu/armv7/tegra2/Makefile  |1 +
 arch/arm/cpu/armv7/tegra2/display.c |  271 +++
 arch/arm/cpu/armv7/tegra2/funcmux.c |   39 ++
 arch/arm/cpu/armv7/tegra2/pwfm.c|   40 ++
 arch/arm/dts/tegra20.dtsi   |   25 +
 arch/arm/include/asm/arch-tegra2/dc.h   |  544 +++
 arch/arm/include/asm/arch-tegra2/display.h  |  133 ++
 arch/arm/include/asm/arch-tegra2/pwfm.h |   54 +++
 arch/arm/include/asm/system.h   |   30 ++
 arch/arm/lib/cache-cp15.c   |   62 +++-
 board/nvidia/common/board.c |   21 +-
 board/nvidia/dts/tegra2-seaboard.dts|   21 +
 common/cmd_echo.c   |3 +-
 common/lcd.c|   85 +++-
 doc/device-tree-bindings/video/nvidia-video.txt |   92 
 drivers/video/Makefile  |1 +
 drivers/video/tegra.c   |  388 
 include/configs/seaboard.h  |   12 +-
 include/configs/tegra2-common.h |1 +
 include/fdtdec.h|   17 +
 include/lcd.h   |   11 +
 lib/fdtdec.c|   15 +-
 24 files changed, 1862 insertions(+), 31 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/display.c
 create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c
 create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h
 create mode 100644 arch/arm/include/asm/arch-tegra2/display.h
 create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h
 create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt
 create mode 100644 drivers/video/tegra.c

-- 
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/17] fdt: Add function to look up a phandle's register address

2012-01-14 Thread Simon Glass
This is a commonly-used requirement, so add a function to support it
easily.

Signed-off-by: Simon Glass s...@chromium.org
---
 include/fdtdec.h |   13 +
 lib/fdtdec.c |   11 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index e705124..81ce3f6 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -239,6 +239,19 @@ const char *fdtdec_get_compatible(enum fdt_compat_id id);
 int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name);
 
 /**
+ * Look up a phandle and follow it to its node. Then return the register
+ * address of that node as a pointer. This can be used to access the
+ * peripheral directly.
+ *
+ * @param blob FDT blob
+ * @param node node to examine
+ * @param prop_namename of property to find
+ * @return pointer to node's register address
+ */
+void *fdtdec_lookup_phandle_reg(const void *blob, int node,
+   const char *prop_name);
+
+/**
  * Look up a property in a node and return its contents in an integer
  * array of given length. The property must have at least enough data for
  * the array (4*count bytes). It may have more, but this will be ignored.
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 48abf02..bcb2343 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -311,6 +311,17 @@ int fdtdec_lookup_phandle(const void *blob, int node, 
const char *prop_name)
return lookup;
 }
 
+void *fdtdec_lookup_phandle_reg(const void *blob, int node,
+   const char *prop_name)
+{
+   int lookup;
+
+   lookup = fdtdec_lookup_phandle(blob, node, prop_name);
+   if (lookup  0)
+   return NULL;
+   return (void *)fdtdec_get_addr(blob, lookup, reg);
+}
+
 /**
  * Look up a property in a node and check that it has a minimum length.
  *
-- 
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/17] tegra: fdt: Add LCD definitions for Tegra

2012-01-14 Thread Simon Glass
Add LCD definitions and also a proposed binding for LCD displays.

The PWFM is in progress on the device-tree-discuss list, so only a
very basic binding is offered here.

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/arm/dts/tegra20.dtsi   |   25 ++
 doc/device-tree-bindings/video/nvidia-video.txt |   92 +++
 2 files changed, 117 insertions(+), 0 deletions(-)
 create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt

diff --git a/arch/arm/dts/tegra20.dtsi b/arch/arm/dts/tegra20.dtsi
index 3d435aa..85c8bf6 100644
--- a/arch/arm/dts/tegra20.dtsi
+++ b/arch/arm/dts/tegra20.dtsi
@@ -221,4 +221,29 @@
compatible = nvidia,tegra20-kbc;
reg = 0x7000e200 0x0078;
};
+
+   pwfm0: pwm@7000a000 {
+   compatible = nvidia,tegra20-pwfm;
+   reg = 0x7000a000 0x4;
+   };
+
+   pwfm1: pwm@7000a010 {
+   compatible = nvidia,tegra20-pwfm;
+   reg = 0x7000a010 0x4;
+   };
+
+   pwfm2: pwm@7000a020 {
+   compatible = nvidia,tegra20-pwfm;
+   reg = 0x7000a020 0x4;
+   };
+
+   pwfm3: pwm@7000a030 {
+   compatible = nvidia,tegra20-pwfm;
+   reg = 0x7000a030 0x4;
+   };
+
+   display1: display@0x5420 {
+   compatible = nvidia,tegra20-display;
+   reg = 0x5420 0x4;
+   };
 };
diff --git a/doc/device-tree-bindings/video/nvidia-video.txt 
b/doc/device-tree-bindings/video/nvidia-video.txt
new file mode 100644
index 000..ede9260
--- /dev/null
+++ b/doc/device-tree-bindings/video/nvidia-video.txt
@@ -0,0 +1,92 @@
+LCD Display
+---
+
+(there isn't yet a generic binding in Linux, so this describes what is in
+U-Boot)
+
+The device node for a display device is as described in the document
+Open Firmware Recommended Practice : Universal Serial Bus with the
+following modifications and additions :
+
+Required properties :
+ - compatible : Should be nvidia,tegra20-display
+ - pwfm: phandle of PWFM to use for backlight
+
+Note: This is just a phande and provides no information, nor a backlight
+node. The PWM is still under discussion I think:
+   http://patchwork.ozlabs.org/patch/132386/
+
+We don't support any parameters as yet - the setting is hard-coded.
+
+ - width: width of display in pixels
+ - height: height of display in pixels
+ - bits-per-pixel: number of bits per pixel (depth)
+ - pixel-clock : Pixel clock in Hz
+ - horiz-timing; horizontal timing: ref_to_sync, sync_width. back_porch,
+   front_porch
+ - vert-timing; vertical timing: ref_to_sync, sync_width. back_porch,
+   front_porch
+
+This node should sit inside its controller.
+
+
+Nvidia Tegra2x Display Controller
+-
+
+The device node for a NAND flash controller is as described in the document
+Open Firmware Recommended Practice : Universal Serial Bus with the
+following modifications and additions :
+
+Required properties:
+ - compatible: should be tegra20-display
+ - panel-timings: 4 cells containing required timings in ms:
+   * delay between panel_vdd-rise and data-rise
+   * delay between data-rise and backlight_vdd-rise
+   * delay between backlight_vdd and pwm-rise
+   * delay between pwm-rise and backlight_en-rise
+
+(should we use us here, or perhaps call it panel-timings-ms?)
+
+Optional properties:
+ - frame-buffer: address of frame buffer (if omitted it will be calculated)
+   - This may be useful to share an address between U-Boot and Linux and
+   avoid boot-time corruption / flicker
+
+Optional GPIO properies all have (phandle, GPIO number, flags):
+ - backlight-enable-gpio: backlight enable GPIO
+ - lvds-shutdown-gpio: LVDS power shutdown GPIO
+ - backlight-vdd-gpio: backlight power GPIO
+ - panel-vdd-gpio: panel power GPIO
+
+(should those have an nvidia, prefix? Perhap use polariy bit so that
+lvds-shutdown becomes lvds-enable?)
+
+I have put these into the display controller since I don't think they are
+generic enough to go in the lcd node.
+
+Example:
+
+display@0x5420 {
+   pwfm = pwfm2;
+
+   /* frame-buffer location to share with Linux */
+   frame-buffer = 0x2f68;
+
+   /* Parameter 3 bit 0:1=output, 0=input; bit 1:1=high, 0=low */
+   backlight-enable = gpio 28 0;/* PD4 */
+   lvds-shutdown = gpio 10 0;   /* PB2 */
+   backlight-vdd = gpio 176 0;  /* PW0 */
+   panel-vdd = gpio 22 0;   /* PC6 */
+   panel-timings = 4 203 17 15;
+
+   lcd {
+   compatible = generic,lcd;
+   width = 1366;
+   height = 768;
+   bits-per-pixel = 16;
+   pixel-clock = 7060;
+
+   horiz-timing = 11 58 58 58;
+   vert-timing = 1 4 4 4;
+   };
+};
-- 
1.7.7.3

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

[U-Boot] [PATCH 11/17] lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU

2012-01-14 Thread Simon Glass
We want to make the display section-aligned on ARM so that we can easily
turn off data caching for this.

Is this useful for other architectures? We could perhaps generalise it by
adding the ability to specify the alignment size, but at least for ARM
it is easier to have it be an architecture feature set by the MMU's
system.h header.

Signed-off-by: Simon Glass s...@chromium.org
---
 README|   10 ++
 common/lcd.c  |   25 -
 include/lcd.h |3 +++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 7adf7c7..d0b891f 100644
--- a/README
+++ b/README
@@ -1380,6 +1380,16 @@ The following options need to be configured:
Normally display is black on white background; define
CONFIG_SYS_WHITE_ON_BLACK to get it inverted.
 
+
+   CONFIG_ALIGN_LCD_TO_SECTION
+
+   Normally the LCD is page-aligned (tyically 4KB). If this is
+   defined then the LCD will be aligned to MMU_SECTION_SIZE
+   instead. This is useful for architectures where it is cheaper
+   to change data cache settings on a per-section basis (such as
+   ARM). Only enabled on ARM at present.
+
+
 - Splash Screen Support: CONFIG_SPLASH_SCREEN
 
If this option is set, the environment is checked for
diff --git a/common/lcd.c b/common/lcd.c
index bf1a6a9..be69d0d 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -35,6 +35,9 @@
 #include stdarg.h
 #include linux/types.h
 #include stdio_dev.h
+#ifdef CONFIG_ARM
+#include asm/system.h
+#endif
 #if defined(CONFIG_POST)
 #include post.h
 #endif
@@ -330,6 +333,12 @@ static void test_pattern (void)
 /* ** GENERIC Initialization Routines  */
 //
 
+int lcd_get_size(int *line_length)
+{
+   *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
+   return *line_length * panel_info.vl_row;
+}
+
 int drv_lcd_init (void)
 {
struct stdio_dev lcddev;
@@ -337,7 +346,7 @@ int drv_lcd_init (void)
 
lcd_base = (void *)(gd-fb_base);
 
-   lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
+   lcd_get_size(lcd_line_length);
 
lcd_init (lcd_base);/* LCD initialization */
 
@@ -449,15 +458,21 @@ static int lcd_init (void *lcdbase)
 ulong lcd_setmem (ulong addr)
 {
ulong size;
-   int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
+   int line_length;
 
debug (LCD panel info: %d x %d, %d bit/pix\n,
panel_info.vl_col, panel_info.vl_row, NBITS 
(panel_info.vl_bpix) );
 
-   size = line_length * panel_info.vl_row;
+   size = lcd_get_size(line_length);
 
-   /* Round up to nearest full page */
-   size = (size + (PAGE_SIZE - 1))  ~(PAGE_SIZE - 1);
+   /* Round up to nearest full page, or MMU section if defined */
+#ifdef CONFIG_ALIGN_LCD_TO_SECTION
+   size = ALIGN(size, MMU_SECTION_SIZE);
+   addr = ALIGN(addr - MMU_SECTION_SIZE + 1, MMU_SECTION_SIZE);
+#else
+   size = ALIGN(size, PAGE_SIZE);
+   addr = ALIGN(addr - PAGE_SIZE + 1, PAGE_SIZE);
+#endif
 
/* Allocate pages for the frame buffer. */
addr -= size;
diff --git a/include/lcd.h b/include/lcd.h
index d95feeb..148bb54 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -217,6 +217,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y);
 /* Allow boards to customize the information displayed */
 void lcd_show_board_info(void);
 
+/* Return the size of the LCD frame buffer, and the line length */
+int lcd_get_size(int *line_length);
+
 //
 /* ** BITMAP DISPLAY SUPPORT   */
 //
-- 
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/17] tegra: Add support for PWFM

2012-01-14 Thread Simon Glass
The pulse width/frequency modulation peripheral supports generating
a repeating pulse. It is useful for controlling LCD brightness.

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/arm/cpu/armv7/tegra2/Makefile  |1 +
 arch/arm/cpu/armv7/tegra2/pwfm.c|   40 +++
 arch/arm/include/asm/arch-tegra2/pwfm.h |   54 +++
 3 files changed, 95 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/pwfm.c
 create mode 100644 arch/arm/include/asm/arch-tegra2/pwfm.h

diff --git a/arch/arm/cpu/armv7/tegra2/Makefile 
b/arch/arm/cpu/armv7/tegra2/Makefile
index 08c4137..9779e9e 100644
--- a/arch/arm/cpu/armv7/tegra2/Makefile
+++ b/arch/arm/cpu/armv7/tegra2/Makefile
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o
 COBJS-$(CONFIG_TEGRA_PMU) += pmu.o
 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
 COBJS-$(CONFIG_TEGRA2_LP0) += crypto.o warmboot.o warmboot_avp.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += pwfm.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/armv7/tegra2/pwfm.c b/arch/arm/cpu/armv7/tegra2/pwfm.c
new file mode 100644
index 000..cdb0cbe
--- /dev/null
+++ b/arch/arm/cpu/armv7/tegra2/pwfm.c
@@ -0,0 +1,40 @@
+/*
+ * Tegra2 pulse width frequency modulator definitions
+ *
+ * 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 asm/io.h
+#include asm/arch/clock.h
+#include asm/arch/pwfm.h
+
+void pwfm_enable(struct pwfm_ctlr *pwfm, int rate, int pulse_width,
+   int freq_divider)
+{
+   u32 reg;
+
+   /* TODO: Can we use clock_adjust_periph_pll_div() here? */
+   clock_start_periph_pll(PERIPH_ID_PWM, CLOCK_ID_SFROM32KHZ, rate);
+
+   reg = PWFM_ENABLE_MASK;
+   reg |= pulse_width  PWFM_WIDTH_SHIFT;
+   reg |= freq_divider  PWFM_DIVIDER_SHIFT;
+   writel(reg, pwfm-control);
+}
diff --git a/arch/arm/include/asm/arch-tegra2/pwfm.h 
b/arch/arm/include/asm/arch-tegra2/pwfm.h
new file mode 100644
index 000..69e2edd
--- /dev/null
+++ b/arch/arm/include/asm/arch-tegra2/pwfm.h
@@ -0,0 +1,54 @@
+/*
+ * Tegra pulse width frequency modulator definitions
+ *
+ * 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
+ */
+
+#ifndef __ASM_ARCH_TEGRA_PWFM_H
+#define __ASM_ARCH_TEGRA_PWFM_H
+
+/* This is a single PWFM channel */
+struct pwfm_ctlr {
+   uint control;   /* Control register */
+};
+
+/* PWM_CONTROLLER_PWM_CSR_0/1/2/3_0 */
+#define PWFM_ENABLE_SHIFT  31
+#define PWFM_ENABLE_MASK   (0x1  PWFM_ENABLE_SHIFT)
+
+#define PWFM_WIDTH_SHIFT   16
+#define PWFM_WIDTH_MASK(0x7FFF  PWFM_WIDTH_SHIFT)
+
+#define PWFM_DIVIDER_SHIFT 0
+#define PWFM_DIVIDER_MASK  (0x1FFF  PWFM_DIVIDER_SHIFT)
+
+/**
+ * Program the PWFM with the given parameters.
+ *
+ * @param pwfm Pointer to PWFM register
+ * @param rate Clock rate to use for PWFM
+ * @param pulse_width  high pulse width: 0=always low, 1=1/256 pulse high,
+ * n = n/256 pulse high
+ * @param freq_divider frequency divider value (1 to use rate as is)
+ */
+void pwfm_enable(struct pwfm_ctlr *pwfm, int rate, int pulse_width,
+   int freq_divider);
+
+#endif /* __ASM_ARCH_TEGRA_PWFM_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 14/17] tegra: Support control of cache settings for LCD

2012-01-14 Thread Simon Glass
Add support for selecting the required cache mode for the LCD:
off, write-through or write-back.

Signed-off-by: Simon Glass s...@chromium.org
---
 drivers/video/tegra.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c
index 7622d2d..f244cc1 100644
--- a/drivers/video/tegra.c
+++ b/drivers/video/tegra.c
@@ -175,6 +175,15 @@ void lcd_ctrl_init(void *lcdbase)
return;
}
 
+   /* For write-through or cache off, change the LCD memory region */
+   if (!(config.cache_type  FDT_LCD_CACHE_WRITE_BACK))
+   mmu_set_region_dcache(config.frame_buffer, size,
+   config.cache_type  FDT_LCD_CACHE_WRITE_THROUGH ?
+   DCACHE_WRITETHROUGH : DCACHE_OFF);
+
+   /* Enable flushing after LCD writes if requested */
+   lcd_set_flush_dcache(config.cache_type  FDT_LCD_CACHE_FLUSH);
+
debug(LCD frame buffer at %p\n, lcd_base);
 }
 
-- 
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/17] lcd: Add support for flushing LCD fb from dcache after update

2012-01-14 Thread Simon Glass
This provides an option for the LCD to flush the dcache after each update
(puts, scroll or clear).

Signed-off-by: Simon Glass s...@chromium.org
---
 common/cmd_echo.c |3 ++-
 common/lcd.c  |   44 +---
 include/lcd.h |8 
 3 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/common/cmd_echo.c b/common/cmd_echo.c
index 43a6da5..12efbab 100644
--- a/common/cmd_echo.c
+++ b/common/cmd_echo.c
@@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
}
}
 
+   /* Use puts() so that the LCD sees it as a new line */
if (putnl)
-   putc('\n');
+   puts(\n);
 
return 0;
 }
diff --git a/common/lcd.c b/common/lcd.c
index be69d0d..707f785 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -93,6 +93,9 @@ static void lcd_setbgcolor (int color);
 
 char lcd_is_enabled = 0;
 
+static char lcd_flush_dcache;  /* 1 to flush dcache after each lcd update */
+
+
 #ifdef NOT_USED_SO_FAR
 static void lcd_getcolreg (ushort regno,
ushort *red, ushort *green, ushort *blue);
@@ -101,6 +104,28 @@ static int lcd_getfgcolor (void);
 
 //
 
+/* Flush LCD activity to the caches */
+void lcd_sync(void)
+{
+   /*
+* flush_dcache_range() is declared in common.h but it seems that some
+* architectures do not actually implement it. Is there a way to find
+* out whether it exists? For now, ARM is safe.
+*/
+#ifdef CONFIG_ARM
+   int line_length;
+
+   if (lcd_flush_dcache)
+   flush_dcache_range((u32)lcd_base,
+   (u32)(lcd_base + lcd_get_size(line_length)));
+#endif
+}
+
+void lcd_set_flush_dcache(int flush)
+{
+   lcd_flush_dcache = (flush != 0);
+}
+
 /*--*/
 
 static void console_scrollup (void)
@@ -110,6 +135,7 @@ static void console_scrollup (void)
 
/* Clear the last one */
memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
+   lcd_sync();
 }
 
 /*--*/
@@ -194,6 +220,7 @@ void lcd_puts (const char *s)
while (*s) {
lcd_putc (*s++);
}
+   lcd_sync();
 }
 
 /*--*/
@@ -365,13 +392,6 @@ int drv_lcd_init (void)
 }
 
 /*--*/
-static
-int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
-{
-   lcd_clear();
-   return 0;
-}
-
 void lcd_clear(void)
 {
 #if LCD_BPP == LCD_MONOCHROME
@@ -413,6 +433,14 @@ void lcd_clear(void)
 
console_col = 0;
console_row = 0;
+   lcd_sync();
+}
+
+static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
+   char *const argv[])
+{
+   lcd_clear();
+   return 0;
 }
 
 U_BOOT_CMD(
@@ -612,6 +640,7 @@ void bitmap_plot (int x, int y)
}
 
WATCHDOG_RESET();
+   lcd_sync();
 }
 #endif /* CONFIG_LCD_LOGO */
 
@@ -810,6 +839,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
break;
};
 
+   lcd_sync();
return (0);
 }
 #endif
diff --git a/include/lcd.h b/include/lcd.h
index 148bb54..ab3e79d 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -56,6 +56,14 @@ extern void lcd_initcolregs (void);
 /* gunzip_bmp used if CONFIG_VIDEO_BMP_GZIP */
 extern struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp);
 
+/**
+ * Set whether we need to flush the dcache when changing the LCD image. This
+ * defaults to off.
+ *
+ * @param flushnon-zero to flush cache after update, 0 to skip
+ */
+void lcd_set_flush_dcache(int flush);
+
 #if defined CONFIG_MPC823
 /*
  * LCD controller stucture for MPC823 CPU
-- 
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/17] fdt: Correct GPIO name access in fdtdec

2012-01-14 Thread Simon Glass
This was missing an fdt32_to_cpu() call so got the name pointer wrong.
If the GPIO module looks at it, this would cause a problem.

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

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index bcb2343..f7d0c95 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -418,7 +418,7 @@ static int fdtdec_decode_gpios(const void *blob, int node,
}
 
/* We will use the name to tag the GPIO */
-   name = fdt_string(blob, prop-nameoff);
+   name = fdt_string(blob, fdt32_to_cpu(prop-nameoff));
cell = (u32 *)prop-data;
len /= sizeof(u32) * 3; /* 3 cells per GPIO record */
if (len  max_count) {
@@ -444,6 +444,7 @@ int fdtdec_decode_gpio(const void *blob, int node, const 
char *prop_name,
 
debug(%s: %s\n, __func__, prop_name);
gpio-gpio = FDT_GPIO_NONE;
+   gpio-name = NULL;
err = fdtdec_decode_gpios(blob, node, prop_name, gpio, 1);
return err == 1 ? 0 : err;
 }
-- 
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/17] tegra: Add LCD support to Nvidia boards

2012-01-14 Thread Simon Glass
Add calls to the LCD driver from Nvidia board code.

Signed-off-by: Simon Glass s...@chromium.org
---
 board/nvidia/common/board.c |   21 -
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
index 04990bf..1c3387d 100644
--- a/board/nvidia/common/board.c
+++ b/board/nvidia/common/board.c
@@ -28,6 +28,7 @@
 #include asm/arch/sys_proto.h
 
 #include asm/arch/board.h
+#include asm/arch/display.h
 #include asm/arch/clk_rst.h
 #include asm/arch/clock.h
 #include asm/arch/emc.h
@@ -78,6 +79,9 @@ static void power_det_init(void)
  */
 int board_init(void)
 {
+#ifdef CONFIG_VIDEO_TEGRA2
+   tegra_lcd_check_next_stage(gd-blob, 0);
+#endif
/* Do clocks and UART first so that printf() works */
clock_init();
clock_verify();
@@ -114,6 +118,9 @@ int board_init(void)
 
board_usb_init(gd-fdt_blob);
 #endif
+#if defined(CONFIG_VIDEO_TEGRA)
+   tegra_lcd_check_next_stage(gd-fdt_blob, 0);
+#endif
 
 #ifdef CONFIG_TEGRA2_LP0
/* prepare the WB code to LP0 location */
@@ -134,6 +141,18 @@ int board_early_init_f(void)
 #else
gpio_config_uart();
 #endif
-   return 0;
+#if defined(CONFIG_VIDEO_TEGRA)
+   tegra_lcd_early_init(gd-fdt_blob);
+#endif
+return 0;
 }
 #endif /* EARLY_INIT */
+
+int board_late_init(void)
+{
+#ifdef CONFIG_VIDEO_TEGRA
+   /* Make sure we finish initing the LCD */
+   tegra_lcd_check_next_stage(gd-fdt_blob, 1);
+#endif
+   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 16/17] lcd: Add CONSOLE_SCROLL_LINES option to speed console

2012-01-14 Thread Simon Glass
When the cursor position gets to the end of the LCD console we normally
scroll by one line. This adds an option to increase that value.

Console scrolling is often slow, and if a large amount of output is
being sent, increasing this option to 10 or so will speed things up
considerably.

Signed-off-by: Simon Glass s...@chromium.org
---
 README   |6 ++
 common/lcd.c |   16 +---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/README b/README
index d0b891f..c2f6699 100644
--- a/README
+++ b/README
@@ -1389,6 +1389,12 @@ The following options need to be configured:
to change data cache settings on a per-section basis (such as
ARM). Only enabled on ARM at present.
 
+   CONSOLE_SCROLL_LINES
+
+   When the console need to be scrolled, this is the number of
+   lines to scroll by. It defaults to 1. Increasing this makes
+   the console jump but can help speed up operation when scrolling
+   is slow.
 
 - Splash Screen Support: CONFIG_SPLASH_SCREEN
 
diff --git a/common/lcd.c b/common/lcd.c
index 707f785..b6da10e 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -130,12 +130,23 @@ void lcd_set_flush_dcache(int flush)
 
 static void console_scrollup (void)
 {
+   int rows = 1;
+
+#ifdef CONSOLE_SCROLL_LINES
+   rows = CONSOLE_SCROLL_LINES;
+#endif
/* Copy up rows ignoring the first one */
-   memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
+   memcpy(CONSOLE_ROW_FIRST,
+  lcd_console_address + CONSOLE_ROW_SIZE * rows,
+  CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
 
/* Clear the last one */
-   memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
+   memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
+   COLOR_MASK(lcd_color_bg),
+  CONSOLE_ROW_SIZE * rows);
+
lcd_sync();
+   console_row -= rows;
 }
 
 /*--*/
@@ -165,7 +176,6 @@ static inline void console_newline (void)
if (console_row = CONSOLE_ROWS) {
/* Scroll everything up */
console_scrollup () ;
-   --console_row;
}
 }
 
-- 
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/17] tegra: Add LCD driver

2012-01-14 Thread Simon Glass
This driver supports driving a single LCD and providing a U-Boot console
on it.

Signed-off-by: Simon Glass s...@chromium.org
---
 drivers/video/Makefile |1 +
 drivers/video/tegra.c  |  379 
 include/fdtdec.h   |1 +
 lib/fdtdec.c   |1 +
 4 files changed, 382 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/tegra.c

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 6252f6a..ff043a1 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -42,6 +42,7 @@ COBJS-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o videomodes.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_VIDEO_SM501) += sm501.o
 COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += tegra.o
 COBJS-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
 
 COBJS  := $(sort $(COBJS-y))
diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c
new file mode 100644
index 000..7622d2d
--- /dev/null
+++ b/drivers/video/tegra.c
@@ -0,0 +1,379 @@
+/*
+ * 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 fdtdec.h
+#include lcd.h
+
+#include asm/system.h
+#include asm/gpio.h
+
+#include asm/arch/clock.h
+#include asm/arch/funcmux.h
+#include asm/arch/pinmux.h
+#include asm/arch/pwfm.h
+#include asm/arch/display.h
+#include asm/arch/timer.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* These are the stages we go throuh in enabling the LCD */
+enum stage_t {
+   STAGE_START,
+   STAGE_LVDS,
+   STAGE_BACKLIGHT_VDD,
+   STAGE_PWFM,
+   STAGE_BACKLIGHT_EN,
+   STAGE_DONE,
+};
+
+static enum stage_t stage; /* Current stage we are at */
+static unsigned long timer_next; /* Time we can move onto next stage */
+static struct fdt_lcd config;  /* Our LCD config, set up in handle_stage() */
+
+enum {
+   /* Maximum LCD size we support */
+   LCD_MAX_WIDTH   = 1366,
+   LCD_MAX_HEIGHT  = 768,
+   LCD_MAX_LOG2_BPP= 4,/* 2^4 = 16 bpp */
+};
+
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+
+void *lcd_base;/* Start of framebuffer memory  */
+void *lcd_console_address; /* Start of console buffer  */
+
+short console_col;
+short console_row;
+
+vidinfo_t panel_info = {
+   /* Insert a value here so that we don't end up in the BSS */
+   .vl_col = -1,
+};
+
+char lcd_cursor_enabled;
+
+ushort lcd_cursor_width;
+ushort lcd_cursor_height;
+
+#ifndef CONFIG_OF_CONTROL
+#error You must enable CONFIG_OF_CONTROL to get Tegra LCD support
+#endif
+
+void lcd_cursor_size(ushort width, ushort height)
+{
+   lcd_cursor_width = width;
+   lcd_cursor_height = height;
+}
+
+void lcd_toggle_cursor(void)
+{
+   ushort x, y;
+   uchar *dest;
+   ushort row;
+
+   x = console_col * lcd_cursor_width;
+   y = console_row * lcd_cursor_height;
+   dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1  LCD_BPP) /
+   8);
+
+   for (row = 0; row  lcd_cursor_height; ++row, dest += lcd_line_length) {
+   ushort *d = (ushort *)dest;
+   ushort color;
+   int i;
+
+   for (i = 0; i  lcd_cursor_width; ++i) {
+   color = *d;
+   color ^= lcd_color_fg;
+   *d = color;
+   ++d;
+   }
+   }
+}
+
+void lcd_cursor_on(void)
+{
+   lcd_cursor_enabled = 1;
+   lcd_toggle_cursor();
+}
+void lcd_cursor_off(void)
+{
+   lcd_cursor_enabled = 0;
+   lcd_toggle_cursor();
+}
+
+char lcd_is_cursor_enabled(void)
+{
+   return lcd_cursor_enabled;
+}
+
+static void update_panel_size(struct fdt_lcd *config)
+{
+   panel_info.vl_col = config-width;
+   panel_info.vl_row = config-height;
+   panel_info.vl_bpix = config-log2_bpp;
+}
+
+/*
+ *  Main init function called by lcd driver.
+ *  Inits and then prints test pattern if required.
+ */
+
+void lcd_ctrl_init(void *lcdbase)
+{
+   int line_length, size;
+
+   /*
+* The framebuffer address should be specified in the device tree.
+* This 

[U-Boot] [PATCH 15/17] tegra: fdt: Add LCD definitions for Seaboard

2012-01-14 Thread Simon Glass
The Seaboard has a 1366x768 16bpp LCD. The backlight is controlled
by one of the PWMs.

Signed-off-by: Simon Glass s...@chromium.org
---
 board/nvidia/dts/tegra2-seaboard.dts |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/board/nvidia/dts/tegra2-seaboard.dts 
b/board/nvidia/dts/tegra2-seaboard.dts
index b847215..710b254 100644
--- a/board/nvidia/dts/tegra2-seaboard.dts
+++ b/board/nvidia/dts/tegra2-seaboard.dts
@@ -210,4 +210,25 @@
 00  00  00  11  00  00  00  00
 00  00  00  00  00  00  00  00];
};
+
+   display@0x5420 {
+   pwfm = pwfm2;
+   frame-buffer = 0x2f68;
+   backlight-enable-gpio = gpio 28 0;   /* PD4 */
+   lvds-shutdown-gpio = gpio 10 0;  /* PB2 */
+   backlight-vdd-gpio = gpio 176 0; /* PW0 */
+   panel-vdd-gpio = gpio 22 0;  /* PC6 */
+   panel-timings = 4 203 17 15;
+
+   lcd {
+   compatible = generic,lcd;
+   width = 1366;
+   height = 768;
+   bits-per-pixel = 16;
+   pixel-clock = 7060;
+
+   horiz-timing = 11 58 58 58;
+   vert-timing = 1 4 4 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 07/17] tegra: Add SOC support for display/lcd

2012-01-14 Thread Simon Glass
From: Wei Ni w...@nvidia.com

Add support for the LCD peripheral at the Tegra2 SOC level. A separate
LCD driver will use this functionality to configure the display.

Mayuresh Kulkarni:
- changes to remove bitfields and clean up for submission

Simon Glass:
- simplify code, move clock control into here, clean-up

Signed-off-by: Mayuresh Kulkarni mkulka...@nvidia.com
Signed-off-by: Simon Glass s...@chromium.org
---
 arch/arm/cpu/armv7/tegra2/Makefile |2 +-
 arch/arm/cpu/armv7/tegra2/display.c|  271 ++
 arch/arm/include/asm/arch-tegra2/dc.h  |  544 
 arch/arm/include/asm/arch-tegra2/display.h |  133 +++
 4 files changed, 949 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/display.c
 create mode 100644 arch/arm/include/asm/arch-tegra2/dc.h
 create mode 100644 arch/arm/include/asm/arch-tegra2/display.h

diff --git a/arch/arm/cpu/armv7/tegra2/Makefile 
b/arch/arm/cpu/armv7/tegra2/Makefile
index 9779e9e..413f8c9 100644
--- a/arch/arm/cpu/armv7/tegra2/Makefile
+++ b/arch/arm/cpu/armv7/tegra2/Makefile
@@ -39,7 +39,7 @@ COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o
 COBJS-$(CONFIG_TEGRA_PMU) += pmu.o
 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
 COBJS-$(CONFIG_TEGRA2_LP0) += crypto.o warmboot.o warmboot_avp.o
-COBJS-$(CONFIG_VIDEO_TEGRA) += pwfm.o
+COBJS-$(CONFIG_VIDEO_TEGRA) += display.o pwfm.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/armv7/tegra2/display.c 
b/arch/arm/cpu/armv7/tegra2/display.c
new file mode 100644
index 000..f4f4c85
--- /dev/null
+++ b/arch/arm/cpu/armv7/tegra2/display.c
@@ -0,0 +1,271 @@
+/*
+ *  (C) Copyright 2010
+ *  NVIDIA Corporation www.nvidia.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include asm/io.h
+#include asm/arch/clk_rst.h
+#include asm/arch/clock.h
+#include asm/arch/timer.h
+#include asm/arch/tegra2.h
+#include asm/arch/display.h
+#include asm/arch/dc.h
+
+static void update_window(struct dc_ctlr *dc, struct disp_ctl_win *win)
+{
+   unsigned h_dda, v_dda;
+   unsigned long val;
+
+   val = readl(dc-cmd.disp_win_header);
+   val |= WINDOW_A_SELECT;
+   writel(val, dc-cmd.disp_win_header);
+
+   writel(win-fmt, dc-win.color_depth);
+
+   val = readl(dc-win.byte_swap);
+   val |= BYTE_SWAP_NOSWAP  BYTE_SWAP_SHIFT;
+   writel(val, dc-win.byte_swap);
+
+   val = win-out_x  H_POSITION_SHIFT;
+   val |= win-out_y  V_POSITION_SHIFT;
+   writel(val, dc-win.pos);
+
+   val = win-out_w  H_SIZE_SHIFT;
+   val |= win-out_h  V_SIZE_SHIFT;
+   writel(val, dc-win.size);
+
+   val = (win-w * win-bpp / 8)  H_PRESCALED_SIZE_SHIFT;
+   val |= win-h  V_PRESCALED_SIZE_SHIFT;
+   writel(val, dc-win.prescaled_size);
+
+   writel(0, dc-win.h_initial_dda);
+   writel(0, dc-win.v_initial_dda);
+
+   h_dda = (win-w * 0x1000) / max(win-out_w - 1, 1);
+   v_dda = (win-h * 0x1000) / max(win-out_h - 1, 1);
+
+   val = h_dda  H_DDA_INC_SHIFT;
+   val |= v_dda  V_DDA_INC_SHIFT;
+   writel(val, dc-win.dda_increment);
+
+   writel(win-stride, dc-win.line_stride);
+   writel(0, dc-win.buf_stride);
+
+   val = WIN_ENABLE;
+   if (win-bpp  24)
+   val |= COLOR_EXPAND;
+   writel(val, dc-win.win_opt);
+
+   writel((unsigned long)win-phys_addr, dc-winbuf.start_addr);
+   writel(win-x, dc-winbuf.addr_h_offset);
+   writel(win-y, dc-winbuf.addr_v_offset);
+
+   writel(0xff00, dc-win.blend_nokey);
+   writel(0xff00, dc-win.blend_1win);
+
+   val = GENERAL_ACT_REQ | WIN_A_ACT_REQ;
+   val |= GENERAL_UPDATE | WIN_A_UPDATE;
+   writel(val, dc-cmd.state_ctrl);
+}
+
+static void write_pair(struct fdt_lcd *config, int item, u32 *reg)
+{
+   writel(config-horiz_timing[item] |
+   (config-vert_timing[item]  16), reg);
+}
+
+static int update_display_mode(struct dc_disp_reg *disp,
+   struct fdt_lcd *config)
+{
+   unsigned long val;
+   unsigned long rate;
+   unsigned long div;
+
+   writel(0x0, disp-disp_timing_opt);
+   write_pair(config, FDT_LCD_TIMING_REF_TO_SYNC, 

[U-Boot] [PATCH 02/17] fdt: Add header guard to fdtdec.h

2012-01-14 Thread Simon Glass
This makes it easier to include this header from other headers.

Signed-off-by: Simon Glass s...@chromium.org
---
 include/fdtdec.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 81ce3f6..f60c969 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -19,6 +19,8 @@
  * MA 02111-1307 USA
  */
 
+#ifndef __fdtdec_h
+#define __fdtdec_h
 
 /*
  * This file contains convenience functions for decoding useful and
@@ -371,3 +373,4 @@ int fdtdec_get_byte_array(const void *blob, int node, const 
char *prop_name,
  */
 const u8 *fdtdec_locate_byte_array(const void *blob, int node,
 const char *prop_name, int count);
+#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 13/17] tegra: Align LCD frame buffer to section boundary

2012-01-14 Thread Simon Glass
For tegra we want to enable the cache for the LCD. This is easier if
we can avoid using L2 page tages, so align the LCD to a section
boundary.

Signed-off-by: Simon Glass s...@chromium.org
---
 include/configs/tegra2-common.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
index 97ac6cd..ff4d90d 100644
--- a/include/configs/tegra2-common.h
+++ b/include/configs/tegra2-common.h
@@ -44,6 +44,7 @@
 #define CONFIG_SYS_CACHELINE_SIZE  32
 
 #define CONFIG_ARCH_CPU_INIT   /* Fire up the A9 core */
+#define CONFIG_ALIGN_LCD_TO_SECTION/* Align LCD to 1MB boundary */
 
 #include asm/arch/tegra2.h   /* get chip and board defs */
 
-- 
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/17] arm: Add control over cachability of memory regions

2012-01-14 Thread Simon Glass
Add support for adjusting the cachability of an L1 section by updating
the MMU. The mmu_set_region_dcache() function allows drivers to make
these changes after the MMU is set up.

It is implemented only for ARMv7 at present.

This is needed for LCD support, where we want to make the LCD frame buffer
write-through (or off) rather than write-back.

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/arm/cpu/armv7/cache_v7.c |   11 +++
 arch/arm/include/asm/system.h |   30 
 arch/arm/lib/cache-cp15.c |   62 +---
 3 files changed, 92 insertions(+), 11 deletions(-)

diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c
index 1b4e808..5f6d039 100644
--- a/arch/arm/cpu/armv7/cache_v7.c
+++ b/arch/arm/cpu/armv7/cache_v7.c
@@ -297,6 +297,12 @@ void arm_init_before_mmu(void)
v7_inval_tlb();
 }
 
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+   flush_dcache_range(start, stop);
+   v7_inval_tlb();
+}
+
 /*
  * Flush range from all levels of d-cache/unified-cache used:
  * Affects the range [start, start + size - 1]
@@ -329,6 +335,11 @@ void arm_init_before_mmu(void)
 void  flush_cache(unsigned long start, unsigned long size)
 {
 }
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+}
+
 #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
 
 #ifndef CONFIG_SYS_ICACHE_OFF
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 2b28a26..f52a4fc 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -75,6 +75,36 @@ static inline void set_cr(unsigned int val)
isb();
 }
 
+/* options available for data cache on each page */
+enum dcache_option {
+   DCACHE_OFF,
+   DCACHE_WRITETHROUGH,
+   DCACHE_WRITEBACK,
+};
+
+/* Size of an MMU section */
+enum {
+   MMU_SECTION_SHIFT   = 20,
+   MMU_SECTION_SIZE= 1  MMU_SECTION_SHIFT,
+};
+
+/**
+ * Change the cache settings for a region.
+ *
+ * \param startstart address of memory region to change
+ * \param size size of memory region to change
+ * \param option   dcache option to select
+ */
+void mmu_set_region_dcache(u32 start, int size, enum dcache_option option);
+
+/**
+ * Register an update to the page tables, and flush the TLB
+ *
+ * \param startstart address of update in page table
+ * \param stop stop address of update in page table
+ */
+void mmu_page_table_flush(unsigned long start, unsigned long stop);
+
 #endif /* __ASSEMBLY__ */
 
 #define arch_align_stack(x) (x)
diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
index e6c3eae..facb1a7 100644
--- a/arch/arm/lib/cache-cp15.c
+++ b/arch/arm/lib/cache-cp15.c
@@ -26,12 +26,6 @@
 
 #if !(defined(CONFIG_SYS_ICACHE_OFF)  defined(CONFIG_SYS_DCACHE_OFF))
 
-#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
-#define CACHE_SETUP0x1a
-#else
-#define CACHE_SETUP0x1e
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 void __arm_init_before_mmu(void)
@@ -50,9 +44,52 @@ static void cp_delay (void)
asm volatile( : : : memory);
 }
 
-static inline void dram_bank_mmu_setup(int bank)
+void set_section_dcache(int section, enum dcache_option option)
 {
+   u32 value = section  MMU_SECTION_SHIFT | (3  10);
u32 *page_table = (u32 *)gd-tlb_addr;
+
+   switch (option) {
+   case DCACHE_WRITETHROUGH:
+   value |= 0x1a;
+   break;
+
+   case DCACHE_WRITEBACK:
+   value |= 0x1e;
+   break;
+
+   case DCACHE_OFF:
+   value |= 0x12;
+   break;
+   }
+
+   page_table[section] = value;
+}
+
+void __mmu_page_table_flush(unsigned long start, unsigned long stop)
+{
+   debug(%s: Warning: not implemented\n, __func__);
+}
+
+void mmu_page_table_flush(unsigned long start, unsigned long stop)
+   __attribute__((weak, alias(__mmu_page_table_flush)));
+
+void mmu_set_region_dcache(u32 start, int size, enum dcache_option option)
+{
+   u32 *page_table = (u32 *)gd-tlb_addr;
+   u32 upto, end;
+
+   end = ALIGN(start + size, MMU_SECTION_SIZE)  MMU_SECTION_SHIFT;
+   start = start  MMU_SECTION_SHIFT;
+   debug(mmu_set_region_dcache start=%x, size=%x, option=%d\n,
+ start, size, option);
+   for (upto = start; upto  end; upto++)
+   set_section_dcache(upto, option);
+   mmu_page_table_flush((u32)page_table[start], (u32)page_table[end]);
+}
+
+static inline void dram_bank_mmu_setup(int bank)
+{
bd_t *bd = gd-bd;
int i;
 
@@ -60,21 +97,24 @@ static inline void dram_bank_mmu_setup(int bank)
for (i = bd-bi_dram[bank].start  20;
 i  (bd-bi_dram[bank].start + bd-bi_dram[bank].size)  20;
 i++) {
-   page_table[i] = i  20 | (3  10) | CACHE_SETUP;
+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
+   set_section_dcache(i, 

[U-Boot] [PATCH 04/17] tegra: Add display support to funcmux

2012-01-14 Thread Simon Glass
Add support for a default pin mapping for display1.

Signed-off-by: Simon Glass s...@chromium.org
---
 arch/arm/cpu/armv7/tegra2/funcmux.c |   39 +++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/tegra2/funcmux.c 
b/arch/arm/cpu/armv7/tegra2/funcmux.c
index a5ff890..edddf03 100644
--- a/arch/arm/cpu/armv7/tegra2/funcmux.c
+++ b/arch/arm/cpu/armv7/tegra2/funcmux.c
@@ -25,6 +25,31 @@
 #include asm/arch/funcmux.h
 #include asm/arch/pinmux.h
 
+/*
+ * The PINMUX macro is used to set up pinmux tables.
+ */
+#define PINMUX(grp, mux, pupd, tri)   \
+   {PINGRP_##grp, PMUX_FUNC_##mux, PMUX_PULL_##pupd, PMUX_TRI_##tri}
+
+struct pingroup_config disp1_default[] = {
+   PINMUX(LDI,   DISPA,  NORMAL,NORMAL),
+   PINMUX(LHP0,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LHP1,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LHP2,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LHS,   DISPA,  NORMAL,NORMAL),
+   PINMUX(LM0,   RSVD4,  NORMAL,NORMAL),
+   PINMUX(LPP,   DISPA,  NORMAL,NORMAL),
+   PINMUX(LPW0,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LPW1,  RSVD4,  NORMAL,TRISTATE),
+   PINMUX(LPW2,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LSC0,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LSPI,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LVP1,  DISPA,  NORMAL,NORMAL),
+   PINMUX(LVS,   DISPA,  NORMAL,NORMAL),
+   PINMUX(SLXD,  SPDIF,  NORMAL,NORMAL),
+};
+
+
 int funcmux_select(enum periph_id id, int config)
 {
int bad_config = config != FUNCMUX_DEFAULT;
@@ -179,6 +204,20 @@ int funcmux_select(enum periph_id id, int config)
break;
}
 
+   case PERIPH_ID_DISP1:
+   if (config == FUNCMUX_DEFAULT) {
+   int i;
+
+   for (i = PINGRP_LD0; i = PINGRP_LD17; i++) {
+   pinmux_set_func(i, PMUX_FUNC_DISPA);
+   pinmux_tristate_disable(i);
+   pinmux_set_pullupdown(i, PMUX_PULL_NORMAL);
+   }
+   pinmux_config_table(disp1_default,
+   ARRAY_SIZE(disp1_default));
+   }
+   break;
+
default:
debug(%s: invalid periph_id %d, __func__, id);
return -1;
-- 
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/17] tegra: Enable display/lcd support on Seaboard

2012-01-14 Thread Simon Glass
From: Mayuresh Kulkarni mkulka...@nvidia.com

Enable the Seaboard's 16bpp LCD and use it as the console.

Signed-off-by: Mayuresh Kulkarni mkulka...@nvidia.com
Signed-off-by: Simon Glass s...@chromium.org
---
 include/configs/seaboard.h |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index fe60b38..09c4196 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -64,6 +64,7 @@
 #define CONFIG_SYS_BOARD_ODMDATA   0x300d8011 /* lp1, 1GB */
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT /* Make sure LCD init is complete */
 
 /* SPI */
 #define CONFIG_TEGRA2_SPI
@@ -123,6 +124,13 @@
 
 #undef TEGRA2_DEVICE_SETTINGS
 #define TEGRA2_DEVICE_SETTINGS stdin=serial,tegra-kbc\0 \
-   stdout=serial\0 \
-   stderr=serial\0
+   stdout=serial,lcd\0 \
+   stderr=serial,lcd\0
+
+/* LCD support */
+#define CONFIG_LCD
+#define CONFIG_VIDEO_TEGRA
+#define LCD_BPPLCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONSOLE_SCROLL_LINES   10
 #endif /* __CONFIG_H */
-- 
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] configs: Remove CONFIG_NET_MULTI from board files

2012-01-14 Thread Mike Frysinger
On Wednesday 11 January 2012 07:47:31 Fabio Estevam wrote:
 CONFIG_NET_MULTI is not used anymore, so remove it from board files.

NAK: idea: good.  actual patch: buggy :(.

 --- a/include/configs/P1010RDB.h
 +++ b/include/configs/P1010RDB.h
 
 -#if defined(CONFIG_TSEC_ENET)
 -#ifndef CONFIG_NET_MULTI
 -#define CONFIG_NET_MULTI
 -#endif
 -
  #define CONFIG_MII   /* MII PHY management */
  #define CONFIG_MII_DEFAULT_TSEC  1   /* Allow unregistered phys */
  #define CONFIG_TSEC1 1

you sure this is correct ?  looks like you deleted 2 if statements but only 1 
endif.

 --- a/include/configs/p1_p2_rdb_pc.h
 +++ b/include/configs/p1_p2_rdb_pc.h

  #define CONFIG_DOS_PARTITION
  #endif /* CONFIG_PCI */
 
 -#if defined(CONFIG_TSEC_ENET)
 -
 -#ifndef CONFIG_NET_MULTI
 -#define CONFIG_NET_MULTI
 -#endif
 -
  #define CONFIG_MII   /* MII PHY management */
  #define CONFIG_TSEC1
  #define CONFIG_TSEC1_NAMEeTSEC1

same issue here
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/5] miiphyutil: Add Micrel KSZ9021 support to miiphy_speed

2012-01-14 Thread Mike Frysinger
On Friday 13 January 2012 07:10:02 Dirk Behme wrote:
  common/miiphyutil.c |   18 +-
  1 files changed, 17 insertions(+), 1 deletions(-)

this is dead code ... i think we're pushing people to use the name phy 
framework rather than fixing/extending the old one.

 --- a/common/miiphyutil.c
 +++ b/common/miiphyutil.c

 +#ifdef CONFIG_PHY_MICREL_KSZ9021
 +#define MII_PHY_CTL  0x1f
 +#define MII_PHY_CTL_1000 (1  6)
 +#define MII_PHY_CTL_100  (1  5)
 +#define MII_PHY_CTL_10   (1  4)

are you sure there aren't defines already in linux/mii.h for these ?
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] SPI: Add i.MX ECSPI driver

2012-01-14 Thread Mike Frysinger
On Thursday 12 January 2012 10:27:13 Dirk Behme wrote:
 +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 + unsigned int max_hz, unsigned int mode)
 +{
 + struct imx_spi_dev_t *imx_spi_slave = NULL;

setting to NULL is kind of pointless when you init it immediately below

 + imx_spi_slave = (struct imx_spi_dev_t *)
 + calloc(sizeof(struct imx_spi_dev_t), 1);

no need for that cast on the return of calloc

 + spi_get_cfg(imx_spi_slave);
 + spi_io_init(imx_spi_slave, 0);

i don't see these funcs defined anywhere in this patch.  since they aren't part 
of the common SPI API, you should namespace them accordingly (like with an SoC 
prefix or something).

 + spi_reset((imx_spi_slave-slave));

the inner params are not needed.  also, programming of hardware does not 
happen in the spi_setup_slave() step.  that's what the spi_claim_bus() is for.

 + return (imx_spi_slave-slave);

drop the paren

 +void spi_free_slave(struct spi_slave *slave)
 +{
 + struct imx_spi_dev_t *imx_spi_slave;
 +
 + if (slave) {
 + imx_spi_slave = to_imx_spi_slave(slave);
 + free(imx_spi_slave);
 + }
 +}

the NULL check on slave is not necessary.  we assume everywhere else that it 
is valid ahead of time.

 +int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen,
 + const u8 *dout, u8 *din, unsigned long flags)

static

 + if (spi_reg-ctrl_reg == 0) {
 + printf(Error: spi(base=0x%x) has not been initialized yet\n,
 + dev-base);

not necessary either ... we don't bother supporting broken callers in the bus 
drivers

 +int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void
 + *dout, void *din, unsigned long flags)
 ...
 + if (!slave)
 + return -1;

not necessary either

 +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
 +{
 + return 1;
 +}

this can't be right ...
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] i.mx6q: SabreLite: Add SPI NOR support

2012-01-14 Thread Mike Frysinger
On Thursday 12 January 2012 10:27:14 Dirk Behme wrote:
 +#ifdef CONFIG_CMD_SF
 + #define CONFIG_FSL_SF   1
 + #define CONFIG_SPI_FLASH   1
 + #define CONFIG_SPI_FLASH_SST1
 + #define CONFIG_SPI_FLASH_CS 1
 + #define CONFIG_IMX_ECSPI
 + #define IMX_CSPI_VER_2_31

don't indent the #
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] i.mx6q: SabreLite: Add SPI NOR support

2012-01-14 Thread Mike Frysinger
On Thursday 12 January 2012 10:38:40 Marek Vasut wrote:
  From: Eric Nelson eric.nel...@boundarydevices.com
  +#ifdef CONFIG_IMX_ECSPI
  +s32 spi_get_cfg(struct imx_spi_dev_t *dev)
  +{
  +   int rval = 0 ;
  +   if (1 == dev-slave.cs) {
  +   dev-base = ECSPI1_BASE_ADDR;
  +   dev-ss = 1 ;
 
  ; again.
 
 Also, Do you even need the ecspi thing? Doesn't uboot support some kind of
 imx spi driver already?

when you reply, please delete all unnecessary context.  there was like ~170 
lines of context when you only needed ~10.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement

2012-01-14 Thread Mike Frysinger
On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
 On Mon, Jan 9, 2012 at 9:33 AM, Mike Frysinger wrote:
  On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
  On Sun, Jan 8, 2012 at 12:35 AM, Mike Frysinger wrote:
   On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
   --- a/include/bootstage.h
   +++ b/include/bootstage.h
   
   +static inline ulong bootstage_mark(enum bootstage_id id)
{
   - show_boot_progress(-val);
   +#ifdef CONFIG_SHOW_BOOT_PROGRESS
   + show_boot_progress(id);
   +#endif
   + return 0;
}
   
   +static inline ulong bootstage_error(enum bootstage_id id)
   +{
   +#ifdef CONFIG_SHOW_BOOT_PROGRESS
   + show_boot_progress(-id);
   +#endif
   + return 0;
   +}
   
   why isn't show_boot_progress() just a stub when
   CONFIG_SHOW_BOOT_PROGRESS isn't defined ?  then you don't have to
   protect the call sites.
  
  show_boot_progress() has been part of U-Boot for a while. Quite a lot
  of boards define this function with the expectation that they can turn
  CONFIG_SHOW_BOOT_PROGRESS on and off independently. So If I do what
  you suggest I will break that expectation.
  
  One fix would be to bracket all show_boot_progress() function
  implementations in the boards with CONFIG_SHOW_BOOT_PROGRESS, but I
  haven't done that.
  
  it seemed like part of your clean up series was to merge
  show_boot_progress() into your new bootstage framework.  in which case,
  we have full control over it now, and ifdef bracketing for it should go
  away ...
 
 Still don't quite get it though. For example, the beagle board defines
 show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
 wouldn't that break that board?

that sounds like an odd-man-out that needs fixing rather than allowing to live
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] configs: Remove CONFIG_NET_MULTI from board files

2012-01-14 Thread Mike Frysinger
On Saturday 14 January 2012 05:08:46 Stefano Babic wrote:
 On 11/01/2012 13:47, Fabio Estevam wrote:
  CONFIG_NET_MULTI is not used anymore, so remove it from board files.
  
   include/configs/P1010RDB.h |5 -
   include/configs/PM826.h|2 --
   include/configs/PM828.h|2 --
   include/configs/cam_enc_4xx.h  |1 -
   include/configs/coreboot.h |6 --
   include/configs/da850_am18xxevm.h  |1 -
   include/configs/ecovec.h   |1 -
   include/configs/efikamx.h  |1 -
   include/configs/enbw_cmc.h |1 -
   include/configs/ethernut5.h|1 -
   include/configs/flea3.h|1 -
   include/configs/m28evk.h   |1 -
   include/configs/omap3_evm_common.h |1 -
   include/configs/omap3_mvblx.h  |1 -
   include/configs/p1_p2_rdb_pc.h |7 ---
   include/configs/tam3517-common.h   |1 -
   16 files changed, 0 insertions(+), 33 deletions(-)
 
 Applied to u-boot-imx after rebasing on u-boot-arm/master
 (include/configs/da850_am18xxevm.h was dropped in a recent patch), thanks.

might want to drop it considering it's buggy
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement

2012-01-14 Thread Simon Glass
Hi Mike,

On Sat, Jan 14, 2012 at 5:09 PM, Mike Frysinger vap...@gentoo.org wrote:
 On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
 On Mon, Jan 9, 2012 at 9:33 AM, Mike Frysinger wrote:
  On Sunday 08 January 2012 12:42:02 Simon Glass wrote:
  On Sun, Jan 8, 2012 at 12:35 AM, Mike Frysinger wrote:
   On Saturday 10 December 2011 16:08:05 Simon Glass wrote:
   --- a/include/bootstage.h
   +++ b/include/bootstage.h
  
   +static inline ulong bootstage_mark(enum bootstage_id id)
    {
   -     show_boot_progress(-val);
   +#ifdef CONFIG_SHOW_BOOT_PROGRESS
   +     show_boot_progress(id);
   +#endif
   +     return 0;
    }
  
   +static inline ulong bootstage_error(enum bootstage_id id)
   +{
   +#ifdef CONFIG_SHOW_BOOT_PROGRESS
   +     show_boot_progress(-id);
   +#endif
   +     return 0;
   +}
  
   why isn't show_boot_progress() just a stub when
   CONFIG_SHOW_BOOT_PROGRESS isn't defined ?  then you don't have to
   protect the call sites.
 
  show_boot_progress() has been part of U-Boot for a while. Quite a lot
  of boards define this function with the expectation that they can turn
  CONFIG_SHOW_BOOT_PROGRESS on and off independently. So If I do what
  you suggest I will break that expectation.
 
  One fix would be to bracket all show_boot_progress() function
  implementations in the boards with CONFIG_SHOW_BOOT_PROGRESS, but I
  haven't done that.
 
  it seemed like part of your clean up series was to merge
  show_boot_progress() into your new bootstage framework.  in which case,
  we have full control over it now, and ifdef bracketing for it should go
  away ...

 Still don't quite get it though. For example, the beagle board defines
 show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
 wouldn't that break that board?

 that sounds like an odd-man-out that needs fixing rather than allowing to live

Fair enough. although I suspect there will be many. If I could
actually get a MAKEALL to run without producing 100s of broken boards
then it would be easier to do this sort of thing. At the moment it's
like looking for a needle in a haystack. My warnings series aimed to
improve things slightly, but I don't think others have these problems.

Regards,
Simon

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


Re: [U-Boot] [PATCH v4] Add 'patman' patch generation, checking and submission script

2012-01-14 Thread Simon Glass
Hi,

Hmmm patman found a tag in this commit and tried to send it to Fred
Bloggs. I have added the line below - sorry for the confusion.

On Sat, Jan 14, 2012 at 5:12 PM, Simon Glass s...@chromium.org wrote:
 What is this?
 =

 This tool is a Python script which:
 - Creates patch directly from your branch
 - Cleans them up by removing unwanted tags
 - Inserts a cover letter with change lists
 - Runs the patches through checkpatch.pl and its own checks
 - Optionally emails them out to selected people

 It is intended to automate patch creation and make it a less
 error-prone process. It is useful for U-Boot and Linux work so far,
 since it uses the checkpatch.pl script.

 It is configured almost entirely by tags it finds in your commits.
 This means that you can work on a number of different branches at
 once, and keep the settings with each branch rather than having to
 git format-patch, git send-email, etc. with the correct parameters
 each time. So for example if you put:

Series-to: fred.bl...@napier.co.nz


 in one of your commits, the series will be sent there.

 See the README file for full details.


...

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


Re: [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement

2012-01-14 Thread Mike Frysinger
On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
 On Sat, Jan 14, 2012 at 5:09 PM, Mike Frysinger wrote:
  On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
  Still don't quite get it though. For example, the beagle board defines
  show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
  wouldn't that break that board?
  
  that sounds like an odd-man-out that needs fixing rather than allowing to
  live
 
 Fair enough. although I suspect there will be many. If I could
 actually get a MAKEALL to run without producing 100s of broken boards
 then it would be easier to do this sort of thing. At the moment it's
 like looking for a needle in a haystack. My warnings series aimed to
 improve things slightly, but I don't think others have these problems.

that's fair.  if it's a small # of boards, i'd prefer to migrate them.  if 
it's a lot more, we can punt for now (add to the TODO?) and add comments to 
the code why we have these checks.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv5 1/7] mkenvimage: correct and clarify comments and error messages

2012-01-14 Thread Mike Frysinger
Acked-by: Mike Frysinger vap...@gentoo.org
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv5 2/7] mkenvimage: Correct an include and add a missing one

2012-01-14 Thread Mike Frysinger
Acked-by: Mike Frysinger vap...@gentoo.org
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv5 3/7] mkenvimage: More error handling

2012-01-14 Thread Mike Frysinger
On Friday 13 January 2012 18:27:36 David Wagner wrote:
 --- a/tools/mkenvimage.c
 +++ b/tools/mkenvimage.c
 
 +long int xstrtol(const char *s)

long term, we'll prob want to add a host set of helper libs like xmalloc and 
xstrdup and xstrtol so we don't have to copy  paste between tools ...

for now:
Acked-by: Mike Frysinger vap...@gentoo.org
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 0/15] bootstage: record and publish boot progress timing

2012-01-14 Thread Simon Glass
This series creates a simple boot progress timing feature in U-Boot.

Previous discussion on this is here:

http://lists.denx.de/pipermail/u-boot/2011-May/thread.html#92584

A request was made to unify this with show_boot_progress(). As discussed
in the v1 RFC patch, this series addresses this the following way:

1. Create bootstage.h with the intent of replacing integers with enums. This
will allow the values to be easily changed or rationalised later as required.
It also makes it more explicit that (for example) 15 means we are about to
run an OS.

2. Change show_boot_progress() to use these enums. This first patch just
shows doing this with one (commonly used) integer value.

3. Create bootstage.c file which permits recording of bootstage timestamps.

4. Change the existing show_boot_progress() handlers within board files to
use a provided bootstage progress handler instead. This is easy enough as
there are few users.

5. Change show_boot_progress() to call into bootstage, which in turns calls
the board-provided progress handler, if defined, after recording a timestamp.
The function signature will stay the same for now.

Ultimately I would like boot timing available from before U-Boot to user
space in Linux. See RFC patch for Linux here:

http://lwn.net/Articles/460432/

and discussion here:

http://comments.gmane.org/gmane.linux.kernel/1194861

Still to do: change the microsecond time printout to use the Linux
seconds.microseconds format.

Changes in v2:
- Unify show_boot_progress() into this series

Changes in v3:
- Adjust show_boot_progress() comment
- Fix 'progres' typo
- Fix code style in bootstage_mark_name()
- Make main bootstage commit title more explicit
- Move file comment above copyright message
- Rename timer patch to remove bootstage: tag
- Set BOOTSTAGE_ID_START to 0 explicitly
- Update commit message to clarify the purpose of CONFIG_BOOTSTAGE_REPORT

Simon Glass (15):
  bootstage: Create an initial header for boot progress integers
  bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
  bootstage: Use show_boot_error() for -ve progress numbers
  bootstage: Convert progress numbers 1-9 into enums
  bootstage: Convert progress numbers 10-19 to enums
  bootstage: Convert progress numbers 20-41 to enums
  bootstage: Convert IDE progress numbers to enums
  bootstage: Convert NAND progress numbers to enums
  bootstage: Convert net progress numbers to enums
  bootstage: Convert FIT progress numbers to enums
  timer: add microsecond boot func
  bootstage: Replace show_boot_progress/error() with bootstage_...()
  bootstage: Implement core microsecond boot time measurement
  bootstage: Plumb in bootstage calls for basic operations
  bootstage: arm: Add bootstage calls in board and bootm

 README |   25 +++
 arch/arm/lib/board.c   |3 +
 arch/arm/lib/bootm.c   |6 +-
 arch/avr32/lib/bootm.c |2 +-
 arch/m68k/lib/bootm.c  |2 +-
 arch/microblaze/lib/bootm.c|2 +-
 arch/mips/lib/bootm.c  |2 +-
 arch/mips/lib/bootm_qemu_mips.c|2 +-
 arch/nds32/lib/bootm.c |2 +-
 arch/powerpc/lib/board.c   |2 +-
 arch/powerpc/lib/bootm.c   |2 +-
 arch/sparc/lib/board.c |2 +-
 arch/x86/lib/board.c   |   19 +--
 board/Seagate/dockstar/dockstar.c  |4 +-
 board/a4m072/a4m072.c  |2 +-
 board/bf533-stamp/bf533-stamp.c|   30 ++--
 board/hermes/hermes.c  |8 +-
 board/ivm/ivm.c|2 +-
 board/matrix_vision/common/mv_common.c |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c|8 +-
 board/pcs440ep/pcs440ep.c  |   50 +++---
 board/scb9328/scb9328.c|6 -
 board/sixnet/sixnet.c  |2 +-
 board/ti/beagle/beagle.c   |2 +-
 common/Makefile|1 +
 common/bootstage.c |  160 
 common/cmd_bootm.c |   95 ++--
 common/cmd_ide.c   |   46 +++---
 common/cmd_nand.c  |   34 ++--
 common/cmd_net.c   |   23 ++-
 common/cmd_usb.c   |1 +
 common/env_common.c|2 +-
 common/image.c |   56 
 include/bootstage.h|  259 
 include/common.h   |   13 +-
 lib/time.c |   17 ++
 net/bootp.c|4 +
 net/eth.c  |6 +-
 net/net.c  |1 +
 post/post.c|4 +-
 40 files changed, 697 insertions(+), 212 deletions(-)
 create mode 100644 common/bootstage.c
 create mode 100644 include/bootstage.h

-- 
1.7.7.3


[U-Boot] [PATCH v3 01/15] bootstage: Create an initial header for boot progress integers

2012-01-14 Thread Simon Glass
At present boot_stage_progress() is called with various magic numbers. The
new bootstage.h header will be used to turn these into symbolic names
throughout the code.

The intent is not that these numbers are passed to Linux. In fact by using
an enum to track them we should eventually be able to remove the explict
numbers and just have the stages count up from 0.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Adjust show_boot_progress() comment
- Fix 'progres' typo
- Move file comment above copyright message

 include/bootstage.h |   58 +++
 include/common.h|6 +---
 2 files changed, 60 insertions(+), 4 deletions(-)
 create mode 100644 include/bootstage.h

diff --git a/include/bootstage.h b/include/bootstage.h
new file mode 100644
index 000..ddfb07a
--- /dev/null
+++ b/include/bootstage.h
@@ -0,0 +1,58 @@
+/*
+ * This file implements recording of each stage of the boot process. It is
+ * intended to implement timing of each stage, reporting this information
+ * to the user and passing it to the OS for logging / further analysis.
+ *
+ * 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
+ */
+
+#ifndef _BOOTSTAGE_H
+#define _BOOTSTAGE_H
+
+/*
+ * A list of boot stages that we know about. Each of these indicates the
+ * state that we are at, and the action that we are about to perform. For
+ * errors, we issue an error for an item when it fails. Therefore the
+ * normal sequence is:
+ *
+ * progress action1
+ * progress action2
+ * progress action3
+ *
+ * and an error condition where action 3 failed would be:
+ *
+ * progress action1
+ * progress action2
+ * progress action3
+ * error on action3
+ */
+enum bootstage_id {
+   BOOTSTAGE_ID_RUN_OS = 15,   /* Exiting U-Boot, entering OS */
+};
+
+/*
+ * Board code can implement show_boot_progress() if needed.
+ *
+ * @param val  Progress state (enum bootstage_id), or -id if an error
+ * has occurred.
+ */
+void show_boot_progress(int val);
+
+#endif
diff --git a/include/common.h b/include/common.h
index 3df1def..ae38784 100644
--- a/include/common.h
+++ b/include/common.h
@@ -799,10 +799,8 @@ intpcmcia_init (void);
 #ifdef CONFIG_STATUS_LED
 # include status_led.h
 #endif
-/*
- * Board-specific Platform code can reimplement show_boot_progress () if needed
- */
-void show_boot_progress(int val);
+
+#include bootstage.h
 
 /* Multicore arch functions */
 #ifdef CONFIG_MP
-- 
1.7.7.3

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


Re: [U-Boot] [PATCHv5 5/7] mkenvimage: Use mmap() when reading from a regular file

2012-01-14 Thread Mike Frysinger
Acked-by: Mike Frysinger vap...@gentoo.org
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv5 6/7] mkenvimage: Don't try to detect comments in the input file

2012-01-14 Thread Mike Frysinger
On Friday 13 January 2012 18:27:39 David Wagner wrote:
 Remove this feature since it seems impossible to reliably detect them.

would be nice to have these, but i can see how it'd be hard to detect 
multiline vars and comments ...

Acked-by: Mike Frysinger vap...@gentoo.org
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 02/15] bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()

2012-01-14 Thread Simon Glass
This changes the number 15 as used in boot_stage_progress() to use the
new name provided for it. This is a separate patch because it touches
so many files.

Signed-off-by: Simon Glass s...@chromium.org
Acked-by: Mike Frysinger vap...@gentoo.org
---

 arch/arm/lib/bootm.c|2 +-
 arch/avr32/lib/bootm.c  |2 +-
 arch/m68k/lib/bootm.c   |2 +-
 arch/microblaze/lib/bootm.c |2 +-
 arch/mips/lib/bootm.c   |2 +-
 arch/mips/lib/bootm_qemu_mips.c |2 +-
 arch/nds32/lib/bootm.c  |2 +-
 arch/powerpc/lib/bootm.c|2 +-
 board/Seagate/dockstar/dockstar.c   |2 +-
 board/a4m072/a4m072.c   |2 +-
 board/bf533-stamp/bf533-stamp.c |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |2 +-
 board/pcs440ep/pcs440ep.c   |3 +--
 board/sixnet/sixnet.c   |2 +-
 board/ti/beagle/beagle.c|2 +-
 common/cmd_bootm.c  |8 
 16 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index afa0093..249ac1b 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -113,7 +113,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf (Using machid 0x%x from environment\n, machid);
}
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef CONFIG_OF_LIBFDT
if (images-ft_len)
diff --git a/arch/avr32/lib/bootm.c b/arch/avr32/lib/bootm.c
index c9a55ff..f180737 100644
--- a/arch/avr32/lib/bootm.c
+++ b/arch/avr32/lib/bootm.c
@@ -192,7 +192,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
 
theKernel = (void *)images-ep;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
params = params_start = (struct tag *)gd-bd-bi_boot_params;
params = setup_start_tag(params);
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 1229ac7..233782b 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
debug(## Transferring control to Linux (at address %08lx) ...\n,
  (ulong) kernel);
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
/*
 * Linux Kernel Parameters (passing board info data):
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 9f6d6d6..24b9e09 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
if (ret)
return 1;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
if (!of_flat_tree  argc  3)
of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16);
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 40a5647..5b7e74f 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images-ep;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef DEBUG
printf (## Transferring control to Linux (at address %08lx) ...\n,
diff --git a/arch/mips/lib/bootm_qemu_mips.c b/arch/mips/lib/bootm_qemu_mips.c
index f1906c6..47f5310 100644
--- a/arch/mips/lib/bootm_qemu_mips.c
+++ b/arch/mips/lib/bootm_qemu_mips.c
@@ -39,7 +39,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images-ep;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
debug (## Transferring control to Linux (at address %08lx) ...\n,
(ulong) theKernel);
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index b0a5a0d..5ae90fb 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -69,7 +69,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf(Using machid 0x%x from environment\n, machid);
}
 
-   show_boot_progress(15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
debug(## Transferring control to Linux (at address %08lx) ...\n,
   (ulong)theKernel);
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index efcfe84..37f162a 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -69,7 +69,7 @@ static void boot_jump_linux(bootm_headers_t *images)
debug (## Transferring control to Linux (at address %08lx) ...\n,
(ulong)kernel);

[U-Boot] [PATCH v3 03/15] bootstage: Use show_boot_error() for -ve progress numbers

2012-01-14 Thread Simon Glass
Rather than the caller negating our progress numbers to indicate an
error has occurred, which seems hacky, add a function to indicate this.

Signed-off-by: Simon Glass s...@chromium.org
Acked-by: Mike Frysinger vap...@gentoo.org
---

 arch/powerpc/lib/board.c |2 +-
 arch/sparc/lib/board.c   |2 +-
 common/cmd_bootm.c   |   50 +++---
 common/cmd_ide.c |   22 ++--
 common/cmd_nand.c|   16 +++---
 common/cmd_net.c |8 +++---
 common/env_common.c  |2 +-
 common/image.c   |   22 ++--
 include/bootstage.h  |4 +++
 net/eth.c|2 +-
 post/post.c  |4 +-
 11 files changed, 69 insertions(+), 65 deletions(-)

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index ff5888e..b11ec8c 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -1065,7 +1065,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 void hang(void)
 {
puts(### ERROR ### Please RESET the board ###\n);
-   show_boot_progress(-30);
+   show_boot_error(30);
for (;;)
;
 }
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index 519a4fb..fcbc666 100644
--- a/arch/sparc/lib/board.c
+++ b/arch/sparc/lib/board.c
@@ -426,7 +426,7 @@ void hang(void)
 {
puts(### ERROR ### Please RESET the board ###\n);
 #ifdef CONFIG_SHOW_BOOT_PROGRESS
-   show_boot_progress(-30);
+   show_boot_error(30);
 #endif
for (;;) ;
 }
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 6edee3f..450fa5c 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_type(images.fit_hdr_os,
images.fit_noffset_os, 
images.os.type)) {
puts(Can't get image type!\n);
-   show_boot_progress(-109);
+   show_boot_error(109);
return 1;
}
 
if (fit_image_get_comp(images.fit_hdr_os,
images.fit_noffset_os, 
images.os.comp)) {
puts(Can't get image compression!\n);
-   show_boot_progress(-110);
+   show_boot_error(110);
return 1;
}
 
if (fit_image_get_os(images.fit_hdr_os,
images.fit_noffset_os, images.os.os)) {
puts(Can't get image OS!\n);
-   show_boot_progress(-111);
+   show_boot_error(111);
return 1;
}
 
@@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
images.os.load)) {
puts(Can't get image load address!\n);
-   show_boot_progress(-112);
+   show_boot_error(112);
return 1;
}
break;
@@ -348,7 +348,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
puts(GUNZIP: uncompress, out-of-mem or overwrite 
error - must RESET board to recover\n);
if (boot_progress)
-   show_boot_progress(-6);
+   show_boot_error(6);
return BOOTM_ERR_RESET;
}
 
@@ -370,7 +370,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
printf(BUNZIP2: uncompress or overwrite error %d 
- must RESET board to recover\n, i);
if (boot_progress)
-   show_boot_progress(-6);
+   show_boot_error(6);
return BOOTM_ERR_RESET;
}
 
@@ -389,7 +389,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
if (ret != SZ_OK) {
printf(LZMA: uncompress or overwrite error %d 
- must RESET board to recover\n, ret);
-   show_boot_progress(-6);
+   show_boot_error(6);
return BOOTM_ERR_RESET;
}
*load_end = load + unc_len;
@@ -407,7 +407,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
printf(LZO: uncompress or overwrite error %d 
  - must RESET board to recover\n, ret);
if (boot_progress)
-   

[U-Boot] [PATCH v3 08/15] bootstage: Convert NAND progress numbers to enums

2012-01-14 Thread Simon Glass
This changes over the NAND progress numbers to use enums from
bootstage.h.

Signed-off-by: Simon Glass s...@chromium.org
---

 common/cmd_nand.c   |   34 +-
 include/bootstage.h |   15 +++
 2 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index e294b3e..1cfa247 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -787,7 +787,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t 
*nand,
if (s != NULL 
(strcmp(s, .jffs2)  strcmp(s, .e)  strcmp(s, .i))) {
printf(Unknown nand load suffix '%s'\n, s);
-   show_boot_error(53);
+   show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
return 1;
}
 
@@ -797,16 +797,16 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t 
*nand,
r = nand_read_skip_bad(nand, offset, cnt, (u_char *) addr);
if (r) {
puts(** Read error\n);
-   show_boot_error(56);
+   show_boot_error(BOOTSTAGE_ID_NAND_HDR_READ);
return 1;
}
-   show_boot_progress (56);
+   show_boot_progress(BOOTSTAGE_ID_NAND_HDR_READ);
 
switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
 
-   show_boot_progress (57);
+   show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
image_print_contents (hdr);
 
cnt = image_get_image_size (hdr);
@@ -820,29 +820,29 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t 
*nand,
break;
 #endif
default:
-   show_boot_error(57);
+   show_boot_error(BOOTSTAGE_ID_NAND_TYPE);
puts (** Unknown image type\n);
return 1;
}
-   show_boot_progress (57);
+   show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
 
r = nand_read_skip_bad(nand, offset, cnt, (u_char *) addr);
if (r) {
puts(** Read error\n);
-   show_boot_error(58);
+   show_boot_error(BOOTSTAGE_ID_NAND_READ);
return 1;
}
-   show_boot_progress (58);
+   show_boot_progress(BOOTSTAGE_ID_NAND_READ);
 
 #if defined(CONFIG_FIT)
/* This cannot be done earlier, we need complete FIT image in RAM first 
*/
if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
if (!fit_check_format (fit_hdr)) {
-   show_boot_error(150);
+   show_boot_error(BOOTSTAGE_ID_NAND_FIT_READ);
puts (** Bad FIT image format\n);
return 1;
}
-   show_boot_progress (151);
+   show_boot_progress(BOOTSTAGE_ID_NAND_FIT_READ_OK);
fit_print_contents (fit_hdr);
}
 #endif
@@ -884,7 +884,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char 
* const argv[])
}
 #endif
 
-   show_boot_progress(52);
+   show_boot_progress(BOOTSTAGE_ID_NAND_PART);
switch (argc) {
case 1:
addr = CONFIG_SYS_LOAD_ADDR;
@@ -907,26 +907,26 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, 
char * const argv[])
 #if defined(CONFIG_CMD_MTDPARTS)
 usage:
 #endif
-   show_boot_error(53);
+   show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
return cmd_usage(cmdtp);
}
 
-   show_boot_progress(53);
+   show_boot_progress(BOOTSTAGE_ID_NAND_SUFFIX);
if (!boot_device) {
puts(\n** No boot device **\n);
-   show_boot_error(54);
+   show_boot_error(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
return 1;
}
-   show_boot_progress(54);
+   show_boot_progress(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
 
idx = simple_strtoul(boot_device, NULL, 16);
 
if (idx  0 || idx = CONFIG_SYS_MAX_NAND_DEVICE || 
!nand_info[idx].name) {
printf(\n** Device %d not available\n, idx);
-   show_boot_error(55);
+   show_boot_error(BOOTSTAGE_ID_NAND_AVAILABLE);
return 1;
}
-   show_boot_progress(55);
+   show_boot_progress(BOOTSTAGE_ID_NAND_AVAILABLE);
 
return nand_load_image(cmdtp, nand_info[idx], offset, addr, argv[0]);
 }
diff --git a/include/bootstage.h b/include/bootstage.h
index fec3c3c..d58c46b 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -105,6 +105,21 @@ enum bootstage_id {
 
BOOTSTAGE_ID_IDE_CHECKSUM,  /* 50 */
BOOTSTAGE_ID_IDE_READ,
+
+   /* Boot stages related to loading a kernel from an NAND device */
+   BOOTSTAGE_ID_NAND_PART,
+   BOOTSTAGE_ID_NAND_SUFFIX,
+   BOOTSTAGE_ID_NAND_BOOT_DEVICE,
+   BOOTSTAGE_ID_NAND_HDR_READ = 55,
+   BOOTSTAGE_ID_NAND_AVAILABLE = 55,
+   BOOTSTAGE_ID_NAND_TYPE = 57,
+   BOOTSTAGE_ID_NAND_READ,
+
+ 

[U-Boot] [PATCH v3 07/15] bootstage: Convert IDE progress numbers to enums

2012-01-14 Thread Simon Glass
This changes over the IDE progress numbers to use enums from bootstage.h.

Signed-off-by: Simon Glass s...@chromium.org
---

 common/cmd_ide.c|   46 +++---
 include/bootstage.h |   14 ++
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index bdfa8db..46fa7d4 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -345,7 +345,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
const void *fit_hdr = NULL;
 #endif
 
-   show_boot_progress(41);
+   show_boot_progress(BOOTSTAGE_ID_IDE_START);
switch (argc) {
case 1:
addr = CONFIG_SYS_LOAD_ADDR;
@@ -360,41 +360,41 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
boot_device = argv[2];
break;
default:
-   show_boot_error(42);
+   show_boot_error(BOOTSTAGE_ID_IDE_ADDR);
return cmd_usage(cmdtp);
}
-   show_boot_progress(42);
+   show_boot_progress(BOOTSTAGE_ID_IDE_ADDR);
 
if (!boot_device) {
puts(\n** No boot device **\n);
-   show_boot_error(43);
+   show_boot_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
return 1;
}
-   show_boot_progress(43);
+   show_boot_progress(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 
dev = simple_strtoul(boot_device, ep, 16);
 
if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) {
printf(\n** Device %d not available\n, dev);
-   show_boot_error(44);
+   show_boot_error(BOOTSTAGE_ID_IDE_TYPE);
return 1;
}
-   show_boot_progress(44);
+   show_boot_progress(BOOTSTAGE_ID_IDE_TYPE);
 
if (*ep) {
if (*ep != ':') {
puts(\n** Invalid boot device, use `dev[:part]' **\n);
-   show_boot_error(45);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART);
return 1;
}
part = simple_strtoul(++ep, NULL, 16);
}
-   show_boot_progress(45);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART);
if (get_partition_info(ide_dev_desc[dev], part, info)) {
-   show_boot_error(46);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART_INFO);
return 1;
}
-   show_boot_progress(46);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART_INFO);
if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0)

(strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)
@@ -402,10 +402,10 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
printf(\n** Invalid partition type \%.32s\  (expect \
BOOT_PART_TYPE \)\n,
info.type);
-   show_boot_error(47);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART_TYPE);
return 1;
}
-   show_boot_progress(47);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART_TYPE);
 
printf(\nLoading from IDE device %d, partition %d: 
   Name: %.32s  Type: %.32s\n, dev, part, info.name, info.type);
@@ -416,23 +416,23 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
if (ide_dev_desc[dev].
block_read(dev, info.start, 1, (ulong *) addr) != 1) {
printf(** Read error on %d:%d\n, dev, part);
-   show_boot_error(48);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART_READ);
return 1;
}
-   show_boot_progress(48);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART_READ);
 
switch (genimg_get_format((void *) addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *) addr;
 
-   show_boot_progress(49);
+   show_boot_progress(BOOTSTAGE_ID_IDE_FORMAT);
 
if (!image_check_hcrc(hdr)) {
puts(\n** Bad Header Checksum **\n);
-   show_boot_error(50);
+   show_boot_error(BOOTSTAGE_ID_IDE_CHECKSUM);
return 1;
}
-   show_boot_progress(50);
+   show_boot_progress(BOOTSTAGE_ID_IDE_CHECKSUM);
 
image_print_contents(hdr);
 
@@ -447,7 +447,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
break;
 #endif
default:
-   show_boot_error(49);
+   show_boot_error(BOOTSTAGE_ID_IDE_FORMAT);
puts(** Unknown image type\n);
return 1;
}
@@ -459,20 +459,20 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt,

[U-Boot] [PATCH v3 05/15] bootstage: Convert progress numbers 10-19 to enums

2012-01-14 Thread Simon Glass
Signed-off-by: Simon Glass s...@chromium.org
Acked-by: Mike Frysinger vap...@gentoo.org
---

 board/bf533-stamp/bf533-stamp.c |   10 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |2 +-
 common/image.c  |   20 ++--
 include/bootstage.h |7 +++
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index 07a988a..4d36160 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -112,11 +112,11 @@ void show_boot_progress(int status)
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
break;
case BOOTSTAGE_ID_BOOT_OS_RETURNED:
-   case 10:
-   case 11:
-   case 12:
-   case 13:
-   case 14:
+   case BOOTSTAGE_ID_RD_MAGIC:
+   case BOOTSTAGE_ID_RD_HDR_CHECKSUM:
+   case BOOTSTAGE_ID_RD_CHECKSUM:
+   case BOOTSTAGE_ID_RAMDISK:
+   case BOOTSTAGE_ID_NO_RAMDISK:
case BOOTSTAGE_ID_RUN_OS:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
break;
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c 
b/board/matrix_vision/mvbc_p/mvbc_p.c
index a5dc2f0..7e06d6c 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -247,7 +247,7 @@ void show_boot_progress(int val)
case 65:
setbits_be32(gpio-simple_dvo, LED_G1);
break;
-   case 12:
+   case BOOTSTAGE_ID_COPY_RAMDISK:
setbits_be32(gpio-simple_dvo, LED_Y);
break;
case BOOTSTAGE_ID_RUN_OS:
diff --git a/common/image.c b/common/image.c
index 6c69c2b..af228cc 100644
--- a/common/image.c
+++ b/common/image.c
@@ -373,37 +373,37 @@ static const image_header_t *image_get_ramdisk(ulong 
rd_addr, uint8_t arch,
 
if (!image_check_magic(rd_hdr)) {
puts(Bad Magic Number\n);
-   show_boot_error(10);
+   show_boot_error(BOOTSTAGE_ID_RD_MAGIC);
return NULL;
}
 
if (!image_check_hcrc(rd_hdr)) {
puts(Bad Header Checksum\n);
-   show_boot_error(11);
+   show_boot_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
return NULL;
}
 
-   show_boot_progress(10);
+   show_boot_progress(BOOTSTAGE_ID_RD_MAGIC);
image_print_contents(rd_hdr);
 
if (verify) {
puts(   Verifying Checksum ... );
if (!image_check_dcrc(rd_hdr)) {
puts(Bad Data CRC\n);
-   show_boot_error(12);
+   show_boot_error(BOOTSTAGE_ID_RD_CHECKSUM);
return NULL;
}
puts(OK\n);
}
 
-   show_boot_progress(11);
+   show_boot_progress(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 
if (!image_check_os(rd_hdr, IH_OS_LINUX) ||
!image_check_arch(rd_hdr, arch) ||
!image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
printf(No Linux %s Ramdisk Image\n,
genimg_get_arch_name(arch));
-   show_boot_error(13);
+   show_boot_error(BOOTSTAGE_ID_RAMDISK);
return NULL;
}
 
@@ -895,7 +895,7 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
printf(## Loading init Ramdisk from Legacy 
Image at %08lx ...\n, rd_addr);
 
-   show_boot_progress(BOOTSTAGE_ID_LOAD_RAMDISK);
+   show_boot_progress(BOOTSTAGE_ID_CHECK_RAMDISK);
rd_hdr = image_get_ramdisk(rd_addr, arch,
images-verify);
 
@@ -1002,7 +1002,7 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
 * Now check if we have a legacy mult-component image,
 * get second entry data start address and len.
 */
-   show_boot_progress(13);
+   show_boot_progress(BOOTSTAGE_ID_RAMDISK);
printf(## Loading init Ramdisk from multi component 
Legacy Image at %08lx ...\n,
(ulong)images-legacy_hdr_os);
@@ -1012,7 +1012,7 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
/*
 * no initrd image
 */
-   show_boot_progress(14);
+   show_boot_progress(BOOTSTAGE_ID_NO_RAMDISK);
rd_len = rd_data = 0;
}
 
@@ -1096,7 +1096,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, 
ulong rd_len,
puts(ramdisk - allocation error\n);
goto error;
}
-   

[U-Boot] [PATCH v3 06/15] bootstage: Convert progress numbers 20-41 to enums

2012-01-14 Thread Simon Glass
Signed-off-by: Simon Glass s...@chromium.org
---

 arch/powerpc/lib/board.c  |2 +-
 arch/sparc/lib/board.c|2 +-
 arch/x86/lib/board.c  |   18 +-
 board/hermes/hermes.c |4 +++-
 board/pcs440ep/pcs440ep.c |3 ++-
 include/bootstage.h   |   25 +
 post/post.c   |4 ++--
 7 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index b11ec8c..837c82d 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -1065,7 +1065,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 void hang(void)
 {
puts(### ERROR ### Please RESET the board ###\n);
-   show_boot_error(30);
+   show_boot_error(BOOTSTAGE_ID_NEED_RESET);
for (;;)
;
 }
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index fcbc666..770136b 100644
--- a/arch/sparc/lib/board.c
+++ b/arch/sparc/lib/board.c
@@ -426,7 +426,7 @@ void hang(void)
 {
puts(### ERROR ### Please RESET the board ###\n);
 #ifdef CONFIG_SHOW_BOOT_PROGRESS
-   show_boot_error(30);
+   show_boot_error(BOOTSTAGE_ID_NEED_RESET);
 #endif
for (;;) ;
 }
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index d742fec..1f677cc 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -280,7 +280,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
static gd_t gd_data;
init_fnc_t **init_fnc_ptr;
 
-   show_boot_progress(0x21);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_INIT_R);
 
/* Global data pointer is now writable */
gd = gd_data;
@@ -291,7 +291,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
gd-bd = bd_data;
memset(gd-bd, 0, sizeof(bd_t));
-   show_boot_progress(0x22);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_GLOBAL_DATA);
 
gd-baudrate =  CONFIG_BAUDRATE;
 
@@ -302,7 +302,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
if ((*init_fnc_ptr)() != 0)
hang();
}
-   show_boot_progress(0x23);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_INIT_SEQ);
 
 #ifdef CONFIG_SERIAL_MULTI
serial_initialize();
@@ -312,14 +312,14 @@ void board_init_r(gd_t *id, ulong dest_addr)
/* configure available FLASH banks */
size = flash_init();
display_flash_config(size);
-   show_boot_progress(0x24);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_FLASH);
 #endif
 
-   show_boot_progress(0x25);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_FLASH_37);
 
/* initialize environment */
env_relocate();
-   show_boot_progress(0x26);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_ENV);
 
 
 #ifdef CONFIG_CMD_NET
@@ -334,7 +334,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
pci_init();
 #endif
 
-   show_boot_progress(0x27);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_PCI);
 
 
stdio_init();
@@ -363,7 +363,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
/* enable exceptions */
enable_interrupts();
-   show_boot_progress(0x28);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_INTERRUPTS);
 
 #ifdef CONFIG_STATUS_LED
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
@@ -432,7 +432,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
-   show_boot_progress(0x29);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_DONE);
 
/* main_loop() can return to retry autoboot, if so just run it again. */
for (;;)
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index 1b40ae8..38bab03 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -595,7 +595,9 @@ void show_boot_progress (int status)
 {
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 
-   if (status  -32) status = -1;  /* let things compatible */
+   /* let things compatible */
+   if (status  -BOOTSTAGE_ID_POST_FAIL_R)
+   status = -1;
status ^= 0x0F;
status = (status  0x0F)  14;
immr-im_cpm.cp_pbdat = (immr-im_cpm.cp_pbdat  ~PB_LED_ALL) | status;
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 118d81c..f67eedd 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -97,7 +97,8 @@ static void status_led_blink (void)
 void show_boot_progress (int val)
 {
/* find all valid Codes for val in README */
-   if (val == -30) return;
+   if (val == -BOOTSTAGE_ID_NEED_RESET)
+   return;
if (val  0) {
/* smthing goes wrong */
status_led_blink ();
diff --git a/include/bootstage.h b/include/bootstage.h
index 29082eb..a828f5c 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -66,6 +66,31 @@ enum bootstage_id {
BOOTSTAGE_ID_NO_RAMDISK,/* No ram disk found (not an error) */
 
BOOTSTAGE_ID_RUN_OS = 15,   /* 

[U-Boot] [PATCH v3 04/15] bootstage: Convert progress numbers 1-9 into enums

2012-01-14 Thread Simon Glass
Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Set BOOTSTAGE_ID_START to 0 explicitly

 board/bf533-stamp/bf533-stamp.c|   18 +++---
 board/hermes/hermes.c  |2 +-
 board/ivm/ivm.c|2 +-
 board/matrix_vision/common/mv_common.c |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c|2 +-
 board/pcs440ep/pcs440ep.c  |   22 
 common/cmd_bootm.c |   41 +++
 common/image.c |2 +-
 include/bootstage.h|   14 +++
 9 files changed, 59 insertions(+), 46 deletions(-)

diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index b1134e9..07a988a 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -91,27 +91,27 @@ static void stamp_led_set(int LED1, int LED2, int LED3)
 void show_boot_progress(int status)
 {
switch (status) {
-   case 1:
+   case BOOTSTAGE_ID_CHECK_MAGIC:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
break;
-   case 2:
+   case BOOTSTAGE_ID_CHECK_HEADER:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
break;
-   case 3:
+   case BOOTSTAGE_ID_CHECK_CHECKSUM:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
break;
-   case 4:
+   case BOOTSTAGE_ID_CHECK_ARCH:
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
break;
-   case 5:
-   case 6:
+   case BOOTSTAGE_ID_CHECK_IMAGETYPE:
+   case BOOTSTAGE_ID_DECOMP_IMAGE:
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
break;
-   case 7:
-   case 8:
+   case BOOTSTAGE_ID_KERNEL_LOADED:
+   case BOOTSTAGE_ID_CHECK_BOOT_OS:
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
break;
-   case 9:
+   case BOOTSTAGE_ID_BOOT_OS_RETURNED:
case 10:
case 11:
case 12:
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index acf364e..1b40ae8 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -370,7 +370,7 @@ static ulong board_init (void)
immr-im_ioport.iop_pcdat |= PC_REP_RES;
}
}
-   SHOW_BOOT_PROGRESS (0x00);
+   SHOW_BOOT_PROGRESS(BOOTSTAGE_ID_CHECK_MAGIC);
 
return ((revision  16) | (speed  0x));
 }
diff --git a/board/ivm/ivm.c b/board/ivm/ivm.c
index 9bec198..71d64d4 100644
--- a/board/ivm/ivm.c
+++ b/board/ivm/ivm.c
@@ -322,7 +322,7 @@ void show_boot_progress (int status)
(status  0) ? STATUS_LED_ON : STATUS_LED_OFF);
 # endif/* STATUS_LED_YELLOW */
 # if defined(STATUS_LED_BOOT)
-   if (status == 6)
+   if (status == BOOTSTAGE_ID_DECOMP_IMAGE)
status_led_set (STATUS_LED_BOOT, STATUS_LED_OFF);
 # endif/* STATUS_LED_BOOT */
 #endif /* CONFIG_STATUS_LED */
diff --git a/board/matrix_vision/common/mv_common.c 
b/board/matrix_vision/common/mv_common.c
index acb72c5..7fde4ac 100644
--- a/board/matrix_vision/common/mv_common.c
+++ b/board/matrix_vision/common/mv_common.c
@@ -95,7 +95,7 @@ int mv_load_fpga(void)
 
result = fpga_load(0, fpga_data, data_size);
if (!result)
-   show_boot_progress(0);
+   show_boot_progress(BOOTSTAGE_ID_START);
 
return result;
 }
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c 
b/board/matrix_vision/mvbc_p/mvbc_p.c
index 9dffedc..a5dc2f0 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -241,7 +241,7 @@ void show_boot_progress(int val)
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
 
switch(val) {
-   case 0: /* FPGA ok */
+   case BOOTSTAGE_ID_START: /* FPGA ok */
setbits_be32(gpio-simple_dvo, LED_G0);
break;
case 65:
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 36994b5..118d81c 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -104,17 +104,17 @@ void show_boot_progress (int val)
return;
}
switch (val) {
-   case 1:
-   /* validating Image */
-   status_led_set (0, STATUS_LED_OFF);
-   status_led_set (1, STATUS_LED_ON);
-   status_led_set (2, STATUS_LED_ON);
-   break;
-   case BOOTSTAGE_ID_RUN_OS:
-   status_led_set (0, STATUS_LED_ON);
-   status_led_set (1, STATUS_LED_ON);
-   status_led_set (2, STATUS_LED_ON);
-   break;
+   case BOOTSTAGE_ID_CHECK_MAGIC:
+   /* validating Image */
+  

[U-Boot] [PATCH v3 09/15] bootstage: Convert net progress numbers to enums

2012-01-14 Thread Simon Glass
This changes over the network-related progress numbers to use enums
from bootstage.h.

Signed-off-by: Simon Glass s...@chromium.org
---

 board/Seagate/dockstar/dockstar.c   |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |2 +-
 board/pcs440ep/pcs440ep.c   |   24 
 common/cmd_net.c|   16 
 common/env_common.c |2 +-
 include/bootstage.h |   11 +++
 net/eth.c   |6 +++---
 7 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/board/Seagate/dockstar/dockstar.c 
b/board/Seagate/dockstar/dockstar.c
index 8cbfb02..38473e5 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -172,7 +172,7 @@ void show_boot_progress(int val)
case BOOTSTAGE_ID_RUN_OS:   /* booting Linux */
set_leds(BOTH_LEDS, NEITHER_LED);
break;
-   case 64:/* Ethernet initialization */
+   case BOOTSTAGE_ID_NET_ETH_START:/* Ethernet initialization */
set_leds(GREEN_LED, GREEN_LED);
break;
default:
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c 
b/board/matrix_vision/mvbc_p/mvbc_p.c
index 7e06d6c..4b48a3c 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -244,7 +244,7 @@ void show_boot_progress(int val)
case BOOTSTAGE_ID_START: /* FPGA ok */
setbits_be32(gpio-simple_dvo, LED_G0);
break;
-   case 65:
+   case BOOTSTAGE_ID_NET_ETH_INIT:
setbits_be32(gpio-simple_dvo, LED_G1);
break;
case BOOTSTAGE_ID_COPY_RAMDISK:
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index f67eedd..746a54c 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -117,19 +117,19 @@ void show_boot_progress (int val)
status_led_set(2, STATUS_LED_ON);
break;
 #if 0
-   case 64:
-   /* starting Ethernet configuration */
-   status_led_set (0, STATUS_LED_OFF);
-   status_led_set (1, STATUS_LED_OFF);
-   status_led_set (2, STATUS_LED_ON);
-   break;
+   case BOOTSTAGE_ID_NET_ETH_START:
+   /* starting Ethernet configuration */
+   status_led_set(0, STATUS_LED_OFF);
+   status_led_set(1, STATUS_LED_OFF);
+   status_led_set(2, STATUS_LED_ON);
+   break;
 #endif
-   case 80:
-   /* loading Image */
-   status_led_set (0, STATUS_LED_ON);
-   status_led_set (1, STATUS_LED_OFF);
-   status_led_set (2, STATUS_LED_ON);
-   break;
+   case BOOTSTAGE_ID_NET_START:
+   /* loading Image */
+   status_led_set(0, STATUS_LED_ON);
+   status_led_set(1, STATUS_LED_OFF);
+   status_led_set(2, STATUS_LED_ON);
+   break;
}
 }
 #endif
diff --git a/common/cmd_net.c b/common/cmd_net.c
index efaddf5..ea3df8f 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -230,36 +230,36 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t 
*cmdtp, int argc,
break;
 #endif
default:
-   show_boot_error(80);
+   show_boot_error(BOOTSTAGE_ID_NET_START);
return cmd_usage(cmdtp);
}
 
-   show_boot_progress (80);
+   show_boot_progress(BOOTSTAGE_ID_NET_START);
if ((size = NetLoop(proto))  0) {
-   show_boot_error(81);
+   show_boot_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
return 1;
}
 
-   show_boot_progress (81);
+   show_boot_progress(BOOTSTAGE_ID_NET_NETLOOP_OK);
/* NetLoop ok, update environment */
netboot_update_env();
 
/* done if no file was loaded (no errors though) */
if (size == 0) {
-   show_boot_error(82);
+   show_boot_error(BOOTSTAGE_ID_NET_LOADED);
return 0;
}
 
/* flush cache */
flush_cache(load_addr, size);
 
-   show_boot_progress(82);
+   show_boot_progress(BOOTSTAGE_ID_NET_LOADED);
rcode = bootm_maybe_autostart(cmdtp, argv[0]);
 
if (rcode  0)
-   show_boot_error(83);
+   show_boot_error(BOOTSTAGE_ID_NET_DONE_ERR);
else
-   show_boot_progress (84);
+   show_boot_progress(BOOTSTAGE_ID_NET_DONE);
return rcode;
 }
 
diff --git a/common/env_common.c b/common/env_common.c
index 49b55f1..41e2f26 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -228,7 +228,7 @@ void env_relocate(void)
 #if defined(CONFIG_ENV_IS_NOWHERE) /* Environment not changable */
set_default_env(NULL);
 #else
- 

[U-Boot] [PATCH v3 13/15] bootstage: Implement core microsecond boot time measurement

2012-01-14 Thread Simon Glass
This defines the basics of a new boot time measurement feature. This allows
logging of very accurate time measurements as the boot proceeds, by using
an available microsecond counter.

To enable the feature, define CONFIG_BOOTSTAGE in your board config file.
Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be
printed just before handing off to the OS.

Most IDs are not named at this stage. For that I would first like to
renumber them all.

Timer summary in microseconds:
   MarkElapsed  Stage
  0  0  reset
205,000205,000  board_init_f
  6,053,000  5,848,000  bootm_start
  6,053,000  0  id=1
  6,058,000  5,000  id=101
  6,058,000  0  id=100
  6,061,000  3,000  id=103
  6,064,000  3,000  id=104
  6,093,000 29,000  id=107
  6,093,000  0  id=106
  6,093,000  0  id=105
  6,093,000  0  id=108
  7,089,000996,000  id=7
  7,089,000  0  id=15
  7,089,000  0  id=8
  7,097,000  8,000  start_kernel

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Fix code style in bootstage_mark_name()
- Make main bootstage commit title more explicit

 README  |   25 
 common/Makefile |1 +
 common/bootstage.c  |  160 +++
 include/bootstage.h |   77 -
 4 files changed, 261 insertions(+), 2 deletions(-)
 create mode 100644 common/bootstage.c

diff --git a/README b/README
index 9d713e8..e757786 100644
--- a/README
+++ b/README
@@ -2235,6 +2235,31 @@ The following options need to be configured:
example, some LED's) on your board. At the moment,
the following checkpoints are implemented:
 
+- Detailed boot stage timing
+   CONFIG_BOOTSTAGE
+   Define this option to get detailed timing of each stage
+   of the boot process.
+
+   CONFIG_BOOTSTAGE_USER_COUNT
+   This is the number of available user bootstage records.
+   Each time you call bootstage_mark(BOOTSTAGE_ID_ALLOC, ...)
+   a new ID will be allocated from this stash. If you exceed
+   the limit, recording will stop.
+
+   CONFIG_BOOTSTAGE_REPORT
+   Define this to print a report before boot, similar to this:
+
+   Timer summary in microseconds:
+  MarkElapsed  Stage
+ 0  0  reset
+ 3,575,678  3,575,678  board_init_f start
+ 3,575,695 17  arch_cpu_init A9
+ 3,575,777 82  arch_cpu_init done
+ 3,659,598 83,821  board_init_r start
+ 3,910,375250,777  main_loop
+29,916,167 26,005,792  bootm_start
+30,361,327445,160  start_kernel
+
 Legacy uImage format:
 
   Arg  Where   When
diff --git a/common/Makefile b/common/Makefile
index 2d9ae8c..038baf0 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -172,6 +172,7 @@ SPD := y
 endif
 COBJS-$(SPD) += ddr_spd.o
 COBJS-$(CONFIG_HWCONFIG) += hwconfig.o
+COBJS-$(CONFIG_BOOTSTAGE) += bootstage.o
 COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o
 COBJS-y += flash.o
 COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
diff --git a/common/bootstage.c b/common/bootstage.c
new file mode 100644
index 000..358e1ca
--- /dev/null
+++ b/common/bootstage.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2011, Google Inc. All rights reserved.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+/*
+ * This module records the progress of boot and arbitrary commands, and
+ * permits accurate timestamping of each.
+ *
+ * TBD: Pass timings to kernel in the FDT
+ */
+
+#include common.h
+#include libfdt.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+enum bootstage_flags {
+   BOOTSTAGEF_ERROR= 1  0,   /* Error record */
+   BOOTSTAGEF_ALLOC= 1  1,   /* Allocate an id */
+};
+
+struct bootstage_record {
+   ulong time_us;
+   const char *name;
+   int flags;  /* see enum bootstage_flags */
+   enum bootstage_id id;
+};
+
+static struct bootstage_record 

[U-Boot] [PATCH v3 15/15] bootstage: arm: Add bootstage calls in board and bootm

2012-01-14 Thread Simon Glass
Add calls to bootstage before and after relocation, and just
before jumping to the OS.

The idea here is you can call bootstage_report() to get a report.
Additionally, if you define CONFIG_BOOTSTAGE_REPORT then a report is
printed automatically by U-Boot just before jumping to the kernel.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v2:
- Unify show_boot_progress() into this series

Changes in v3:
- Update commit message to clarify the purpose of CONFIG_BOOTSTAGE_REPORT

 arch/arm/lib/board.c |3 +++
 arch/arm/lib/bootm.c |4 
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 3d78274..e4b243b 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -266,6 +266,8 @@ void board_init_f(ulong bootflag)
ulong reg;
 #endif
 
+   bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, board_init_r);
+
/* Pointer is writable since we allocated a register for it */
gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR)  ~0x07);
/* compiler optimization barrier needed for GCC = 3.4 */
@@ -455,6 +457,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
gd = id;
 
gd-flags |= GD_FLG_RELOC;  /* tell others: relocation done */
+   bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, board_init_f);
 
monitor_flash_len = _end_ofs;
 
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index f114cd6..2961ab2 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -83,6 +83,10 @@ void arch_lmb_reserve(struct lmb *lmb)
 static void announce_and_cleanup(void)
 {
printf(\nStarting kernel ...\n\n);
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, start_kernel);
+#ifdef CONFIG_BOOTSTAGE_REPORT
+   bootstage_report();
+#endif
 
 #ifdef CONFIG_USB_DEVICE
{
-- 
1.7.7.3

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


[U-Boot] [PATCH v3 14/15] bootstage: Plumb in bootstage calls for basic operations

2012-01-14 Thread Simon Glass
This inserts bootstage calls into tftp, usb start and bootm. We
could go further, but this is a reasonable start to illustrate
the concept.

Signed-off-by: Simon Glass s...@chromium.org
---

 common/cmd_bootm.c |2 ++
 common/cmd_net.c   |7 ++-
 common/cmd_usb.c   |1 +
 net/bootp.c|4 
 net/net.c  |1 +
 5 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 7e780fb..7536f34 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -199,6 +199,8 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
 
bootm_start_lmb();
 
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTM_START, bootm_start);
+
/* get kernel image header, start address and length */
os_hdr = boot_get_kernel(cmdtp, flag, argc, argv,
images, images.os.image_start, images.os.image_len);
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 78b7113..0606096 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -43,7 +43,12 @@ U_BOOT_CMD(
 
 int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-   return netboot_common(TFTPGET, cmdtp, argc, argv);
+   int ret;
+
+   bootstage_mark_name(BOOTSTAGE_KERNELREAD_START, tftp_start);
+   ret = netboot_common(TFTPGET, cmdtp, argc, argv);
+   bootstage_mark_name(BOOTSTAGE_KERNELREAD_STOP, tftp_done);
+   return ret;
 }
 
 U_BOOT_CMD(
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 320667f..8115f4e 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -513,6 +513,7 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
if ((strncmp(argv[1], reset, 5) == 0) ||
 (strncmp(argv[1], start, 5) == 0)) {
+   bootstage_mark_name(BOOTSTAGE_ID_USB_START, usb_start);
usb_stop();
printf((Re)start USB...\n);
i = usb_init();
diff --git a/net/bootp.c b/net/bootp.c
index 34124b8..9e32476 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -322,6 +322,7 @@ BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, 
unsigned src,
BootpVendorProcess((uchar *)bp-bp_vend[4], len);
 
NetSetTimeout(0, (thand_f *)0);
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, bootp_stop);
 
debug(Got good BOOTP\n);
 
@@ -589,6 +590,7 @@ BootpRequest (void)
Bootp_t *bp;
int ext_len, pktlen, iplen;
 
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTP_START, bootp_start);
 #if defined(CONFIG_CMD_DHCP)
dhcp_state = INIT;
 #endif
@@ -949,6 +951,8 @@ DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, 
unsigned src,
BootpCopyNetParams(bp); /* Store net params from reply 
*/
dhcp_state = BOUND;
printf (DHCP client bound to address %pI4\n, 
NetOurIP);
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP,
+   bootp_stop);
 
net_auto_load();
return;
diff --git a/net/net.c b/net/net.c
index 045405b..c5acf8f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -402,6 +402,7 @@ int NetLoop(enum proto_t protocol)
NetArpWaitTxPacketSize = 0;
}
 
+   bootstage_mark_name(BOOTSTAGE_ID_ETH_START, eth_start);
eth_halt();
eth_set_current();
if (eth_init(bd)  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 v3 11/15] timer: add microsecond boot func

2012-01-14 Thread Simon Glass
Define timer_get_boot_us() which returns the number of microseconds
since boot. If undefined then we use get_timer() * 1000.

We can fit this in a 32-bit register which keeps everyone happy on
the efficiency side. It will wrap around after about an hour. If we
are still looking at it after an hour then we had better not be
timing the boot.

There is some scope to join bootstage and post, but for now they are
separate things with separate CONFIGs, and you don't have to enable
one to get the other.

Signed-off-by: Simon Glass s...@chromium.org
---
Changes in v3:
- Rename timer patch to remove bootstage: tag

 include/common.h |7 +++
 lib/time.c   |   17 +
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/common.h b/include/common.h
index ae38784..c23087a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -207,6 +207,13 @@ typedef void (interrupt_handler_t)(void *);
 #endif /* CONFIG_SERIAL_MULTI */
 
 /*
+ * Return the time since boot in microseconds, This is needed for bootstage
+ * and should be defined in CPU- or board-specific code. If undefined then
+ * millisecond resolution will be used (the standard get_timer()).
+ */
+ulong timer_get_boot_us(void);
+
+/*
  * General Purpose Utilities
  */
 #define min(X, Y)  \
diff --git a/lib/time.c b/lib/time.c
index 6e2937b..69edc3d 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -47,3 +47,20 @@ void mdelay(unsigned long msec)
while (msec--)
udelay(1000);
 }
+
+ulong __timer_get_boot_us(void)
+{
+   static ulong base_time;
+
+   /*
+* We can't implement this properly. Return 0 on the first call and
+* larger values after that.
+*/
+   if (base_time)
+   return get_timer(base_time) * 1000;
+   base_time = get_timer(0);
+   return 0;
+}
+
+ulong timer_get_boot_us(void)
+   __attribute__((weak, alias(__timer_get_boot_us)));
-- 
1.7.7.3

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


[U-Boot] [PATCH v3 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...()

2012-01-14 Thread Simon Glass
These calls should not be made directly any more, since bootstage
will call the show_boot_...() functions as needed.

Signed-off-by: Simon Glass s...@chromium.org
---

 arch/arm/lib/bootm.c   |2 +-
 arch/avr32/lib/bootm.c |2 +-
 arch/m68k/lib/bootm.c  |2 +-
 arch/microblaze/lib/bootm.c|2 +-
 arch/mips/lib/bootm.c  |2 +-
 arch/mips/lib/bootm_qemu_mips.c|2 +-
 arch/nds32/lib/bootm.c |2 +-
 arch/powerpc/lib/board.c   |2 +-
 arch/powerpc/lib/bootm.c   |2 +-
 arch/sparc/lib/board.c |2 +-
 arch/x86/lib/board.c   |   19 +++
 board/hermes/hermes.c  |2 +-
 board/matrix_vision/common/mv_common.c |2 +-
 board/scb9328/scb9328.c|6 --
 common/cmd_bootm.c |   92 
 common/cmd_ide.c   |   46 
 common/cmd_nand.c  |   34 ++--
 common/cmd_net.c   |   16 +++---
 common/env_common.c|2 +-
 common/image.c |   52 +-
 net/eth.c  |6 +-
 post/post.c|4 +-
 22 files changed, 147 insertions(+), 154 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 249ac1b..f114cd6 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -113,7 +113,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf (Using machid 0x%x from environment\n, machid);
}
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef CONFIG_OF_LIBFDT
if (images-ft_len)
diff --git a/arch/avr32/lib/bootm.c b/arch/avr32/lib/bootm.c
index f180737..74ebeca 100644
--- a/arch/avr32/lib/bootm.c
+++ b/arch/avr32/lib/bootm.c
@@ -192,7 +192,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
 
theKernel = (void *)images-ep;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
params = params_start = (struct tag *)gd-bd-bi_boot_params;
params = setup_start_tag(params);
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 233782b..d506d0c 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
debug(## Transferring control to Linux (at address %08lx) ...\n,
  (ulong) kernel);
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
/*
 * Linux Kernel Parameters (passing board info data):
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 24b9e09..95cee50 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
if (ret)
return 1;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
if (!of_flat_tree  argc  3)
of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16);
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 5b7e74f..9930abf 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images-ep;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef DEBUG
printf (## Transferring control to Linux (at address %08lx) ...\n,
diff --git a/arch/mips/lib/bootm_qemu_mips.c b/arch/mips/lib/bootm_qemu_mips.c
index 47f5310..bb6442a 100644
--- a/arch/mips/lib/bootm_qemu_mips.c
+++ b/arch/mips/lib/bootm_qemu_mips.c
@@ -39,7 +39,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images-ep;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
debug (## Transferring control to Linux (at address %08lx) ...\n,
(ulong) theKernel);
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 5ae90fb..03f58bf 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -69,7 +69,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf(Using machid 0x%x from environment\n, machid);
}
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 

[U-Boot] [PATCH v3 10/15] bootstage: Convert FIT progress numbers to enums

2012-01-14 Thread Simon Glass
This changes over all the FIT image progress numbers to use enums
from bootstage.h.

Signed-off-by: Simon Glass s...@chromium.org
---

 common/cmd_bootm.c  |   44 ++--
 common/image.c  |   36 
 include/bootstage.h |   38 ++
 3 files changed, 80 insertions(+), 38 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 9ab1c61..44a9ded 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_type(images.fit_hdr_os,
images.fit_noffset_os, 
images.os.type)) {
puts(Can't get image type!\n);
-   show_boot_error(109);
+   show_boot_error(BOOTSTAGE_ID_FIT_TYPE);
return 1;
}
 
if (fit_image_get_comp(images.fit_hdr_os,
images.fit_noffset_os, 
images.os.comp)) {
puts(Can't get image compression!\n);
-   show_boot_error(110);
+   show_boot_error(BOOTSTAGE_ID_FIT_COMPRESSION);
return 1;
}
 
if (fit_image_get_os(images.fit_hdr_os,
images.fit_noffset_os, images.os.os)) {
puts(Can't get image OS!\n);
-   show_boot_error(111);
+   show_boot_error(BOOTSTAGE_ID_FIT_OS);
return 1;
}
 
@@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
images.os.load)) {
puts(Can't get image load address!\n);
-   show_boot_error(112);
+   show_boot_error(BOOTSTAGE_ID_FIT_LOADADDR);
return 1;
}
break;
@@ -648,7 +648,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
} else {
puts(ERROR: new format image overwritten - 
must RESET the board to recover\n);
-   show_boot_error(113);
+   show_boot_error(BOOTSTAGE_ID_OVERWRITTEN);
do_reset(cmdtp, flag, argc, argv);
}
}
@@ -789,28 +789,28 @@ static int fit_check_kernel(const void *fit, int 
os_noffset, int verify)
puts(   Verifying Hash Integrity ... );
if (!fit_image_check_hashes(fit, os_noffset)) {
puts(Bad Data Hash\n);
-   show_boot_error(104);
+   show_boot_error(BOOTSTAGE_ID_FIT_CHECK_HASH);
return 0;
}
puts(OK\n);
}
-   show_boot_progress(105);
+   show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_ARCH);
 
if (!fit_image_check_target_arch(fit, os_noffset)) {
puts(Unsupported Architecture\n);
-   show_boot_error(105);
+   show_boot_error(BOOTSTAGE_ID_FIT_CHECK_ARCH);
return 0;
}
 
-   show_boot_progress(106);
+   show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) 
!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
puts(Not a kernel image\n);
-   show_boot_error(106);
+   show_boot_error(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
return 0;
}
 
-   show_boot_progress(107);
+   show_boot_progress(BOOTSTAGE_ID_FIT_CHECKED);
return 1;
 }
 #endif /* CONFIG_FIT */
@@ -921,10 +921,10 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, 
int argc,
 
if (!fit_check_format(fit_hdr)) {
puts(Bad FIT kernel image format!\n);
-   show_boot_error(100);
+   show_boot_error(BOOTSTAGE_ID_FIT_FORMAT);
return NULL;
}
-   show_boot_progress(100);
+   show_boot_progress(BOOTSTAGE_ID_FIT_FORMAT);
 
if (!fit_uname_kernel) {
/*
@@ -933,11 +933,11 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, 
int argc,
 * fit_conf_get_node() will try to find default config
 * node
 */
-   show_boot_progress(101);
+   show_boot_progress(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);

Re: [U-Boot] [PATCHv5 7/7] mkenvimage: Really set the redundant byte when applicable

2012-01-14 Thread Mike Frysinger
Acked-by: Mike Frysinger vap...@gentoo.org
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement

2012-01-14 Thread Simon Glass
Hi Mike,

On Sat, Jan 14, 2012 at 5:22 PM, Mike Frysinger vap...@gentoo.org wrote:
 On Saturday 14 January 2012 20:16:35 Simon Glass wrote:
 On Sat, Jan 14, 2012 at 5:09 PM, Mike Frysinger wrote:
  On Thursday 12 January 2012 00:41:24 Simon Glass wrote:
  Still don't quite get it though. For example, the beagle board defines
  show_boot_progress() but does not define CONFIG_SHOW_BOOT_PROGRESS, so
  wouldn't that break that board?
 
  that sounds like an odd-man-out that needs fixing rather than allowing to
  live

 Fair enough. although I suspect there will be many. If I could
 actually get a MAKEALL to run without producing 100s of broken boards
 then it would be easier to do this sort of thing. At the moment it's
 like looking for a needle in a haystack. My warnings series aimed to
 improve things slightly, but I don't think others have these problems.

 that's fair.  if it's a small # of boards, i'd prefer to migrate them.  if
 it's a lot more, we can punt for now (add to the TODO?) and add comments to
 the code why we have these checks.

OK, I don't know the answer to that but will try it out, and adjust
that patch as needed.

Regards,
Simon

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


Re: [U-Boot] [PATCH v2] bootm: Avoid 256-byte overflow in fixup_silent_linux()

2012-01-14 Thread Mike Frysinger
On Wednesday 11 January 2012 13:19:52 Doug Anderson wrote:
 + if (cmdline  (cmdline[0] != '\0')) {
 + char *start = strstr(cmdline, CONSOLE_ARG);
 +
   if (start) {
 - end = strchr(start, ' ');
 - strncpy(buf, cmdline, (start - cmdline + 8));
 + char *end = strchr(start, ' ');
 + int num_start_bytes = start - cmdline + CONSOLE_ARG_LEN;
 +
 + strncpy(buf, cmdline, num_start_bytes);
   if (end)
 - strcpy(buf + (start - cmdline + 8), end);
 + strcpy(buf + num_start_bytes, end);
   else
 - buf[start - cmdline + 8] = '\0';
 + buf[num_start_bytes] = '\0';
   } else {
 - strcpy(buf, cmdline);
 - strcat(buf,  console=);
 + sprintf(buf, %s %s, cmdline, CONSOLE_ARG);
   }
   } else {
 - strcpy(buf, console=);
 + buf = strdup(CONSOLE_ARG);
 + if (!buf) {
 + debug(%s: strdup failed\n, __func__);
 + return;
 + }
   }
 
   setenv(bootargs, buf);
   debug(after silent fix-up: %s\n, buf);
 + free(buf);

seems like the strdup() in the else branch is unnecessary.
const char *env_val;
...
if (cmdline  (cmdline[0] != '\0')) {
...
env_val = buf;
} else {
buf = NULL;
env_val = console=;
}

setenv(bootargs, env_val);
debug(after silent fix-up: %s\n, env_val);
free(buf);
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 04/17] tegra: Add display support to funcmux

2012-01-14 Thread Mike Frysinger
On Saturday 14 January 2012 19:47:16 Simon Glass wrote:
 --- a/arch/arm/cpu/armv7/tegra2/funcmux.c
 +++ b/arch/arm/cpu/armv7/tegra2/funcmux.c
 
 +struct pingroup_config disp1_default[] = {

const ?  although it looks like we need to fix pinmux_config_table() first ...
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 11/17] lcd: Add CONFIG_ALIGN_LCD_TO_SECTION to align lcd for MMU

2012-01-14 Thread Mike Frysinger
On Saturday 14 January 2012 19:47:23 Simon Glass wrote:
 We want to make the display section-aligned on ARM so that we can easily
 turn off data caching for this.
 
 Is this useful for other architectures? We could perhaps generalise it by
 adding the ability to specify the alignment size, but at least for ARM
 it is easier to have it be an architecture feature set by the MMU's
 system.h header.

seems like a generally useful thing, but the exact alignment is a bit hackish.  
so perhaps the CONFIG knob should instead be the size you want to align things 
to ?
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 12/17] lcd: Add support for flushing LCD fb from dcache after update

2012-01-14 Thread Mike Frysinger
On Saturday 14 January 2012 19:47:24 Simon Glass wrote:
 --- a/common/cmd_echo.c
 +++ b/common/cmd_echo.c
 @@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char *
 const argv[]) }
   }
 
 + /* Use puts() so that the LCD sees it as a new line */
   if (putnl)
 - putc('\n');
 + puts(\n);
 
   return 0;
  }

this sounds like a hack for a broken LCD core and so the fix should be 
somewhere in there

 --- a/common/lcd.c
 +++ b/common/lcd.c
 
 +static char lcd_flush_dcache;

seems like it'd be better as a CONFIG knob

 + /*
 +  * flush_dcache_range() is declared in common.h but it seems that some
 +  * architectures do not actually implement it. Is there a way to find
 +  * out whether it exists? For now, ARM is safe.
 +  */

if those arches don't implement this func, then the failure is on their head.  
people should feel free to use the cache api we expose in common.h.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 12/17] lcd: Add support for flushing LCD fb from dcache after update

2012-01-14 Thread Simon Glass
Hi Mike,

On Sat, Jan 14, 2012 at 5:42 PM, Mike Frysinger vap...@gentoo.org wrote:
 On Saturday 14 January 2012 19:47:24 Simon Glass wrote:
 --- a/common/cmd_echo.c
 +++ b/common/cmd_echo.c
 @@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char *
 const argv[]) }
       }

 +     /* Use puts() so that the LCD sees it as a new line */
       if (putnl)
 -             putc('\n');
 +             puts(\n);

       return 0;
  }

 this sounds like a hack for a broken LCD core and so the fix should be
 somewhere in there

Well it's actually that I don't want to flush after every character
(it slows things down a lot) so puts is a good place to look. I
suppose we could flush after every newline we see in lcd_putc().


 --- a/common/lcd.c
 +++ b/common/lcd.c

 +static char lcd_flush_dcache;

 seems like it'd be better as a CONFIG knob

OK, will see if I can do that.


 +     /*
 +      * flush_dcache_range() is declared in common.h but it seems that some
 +      * architectures do not actually implement it. Is there a way to find
 +      * out whether it exists? For now, ARM is safe.
 +      */

 if those arches don't implement this func, then the failure is on their head.
 people should feel free to use the cache api we expose in common.h.

I sort-of agree, except that I saw masses of failures. I will look a bit harder.

Regards,
Simon

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


Re: [U-Boot] [PATCH 12/17] lcd: Add support for flushing LCD fb from dcache after update

2012-01-14 Thread Mike Frysinger
On Saturday 14 January 2012 20:57:25 Simon Glass wrote:
 On Sat, Jan 14, 2012 at 5:42 PM, Mike Frysinger wrote:
  On Saturday 14 January 2012 19:47:24 Simon Glass wrote:
  --- a/common/cmd_echo.c
  +++ b/common/cmd_echo.c
  @@ -44,8 +44,9 @@ int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char
  * const argv[]) }
}
  
  + /* Use puts() so that the LCD sees it as a new line */
if (putnl)
  - putc('\n');
  + puts(\n);
  
return 0;
   }
  
  this sounds like a hack for a broken LCD core and so the fix should be
  somewhere in there
 
 Well it's actually that I don't want to flush after every character
 (it slows things down a lot)

right, but ...

 so puts is a good place to look

most puts() that i've seen are simple loops that call putc()

 I suppose we could flush after every newline we see in lcd_putc().

that would be the right way to go i think
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/6] tegra: nand: Add Tegra NAND driver

2012-01-14 Thread Mike Frysinger
On Friday 13 January 2012 18:10:55 Simon Glass wrote:
 From: Jim Lin ji...@nvidia.com
 
 A device tree is used to configure the NAND, including memory
 timings and block/pages sizes.
 
 If this node is not present or is disabled, then NAND will not
 be initialized.
 
 Signed-off-by: Simon Glass s...@chromium.org

the Author needs to sign off too ...
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/20] tegra: warmboot (suspend / resume) support

2012-01-14 Thread Mike Frysinger
there are a few patches here where the Author hasn't provided his s-o-b tag, 
so that'll need fixing ...
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/6] tegra: nand: Add Tegra NAND driver

2012-01-14 Thread Simon Glass
Hi Mike,

On Sat, Jan 14, 2012 at 8:03 PM, Mike Frysinger vap...@gentoo.org wrote:
 On Friday 13 January 2012 18:10:55 Simon Glass wrote:
 From: Jim Lin ji...@nvidia.com

 A device tree is used to configure the NAND, including memory
 timings and block/pages sizes.

 If this node is not present or is disabled, then NAND will not
 be initialized.

 Signed-off-by: Simon Glass s...@chromium.org

 the Author needs to sign off too ...

I have a lot like that. It doesn't feel right for me to just add their
sign-off after all my changes. I was hoping that they would reply to
the list with it. Does that work? The original commit does not have a
sign-off.

Regards,
Simon

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


Re: [U-Boot] [PATCH v2 20/20] tegra: Enable LP0 on Seaboard

2012-01-14 Thread Mike Frysinger
On Friday 13 January 2012 16:35:35 Simon Glass wrote:
 --- a/include/configs/tegra2-common.h
 +++ b/include/configs/tegra2-common.h
 
  /*
 + * QUOTE(m) will evaluate to a string version of the value of the macro m
 + * passed in.  The extra level of indirection here is to first evaluate
 + * the macro m before applying the quoting operator.
 + */
 +#define QUOTE_(m)   #m
 +#define QUOTE(m)QUOTE_(m)

we uses to have MK_STR/XMK_STR in common code, but that seems to have gone by 
the wayside.  but arches/boards still have it, so might as well use that 
naming convention.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/6] tegra: nand: Add Tegra NAND driver

2012-01-14 Thread Mike Frysinger
On Saturday 14 January 2012 23:08:45 Simon Glass wrote:
 On Sat, Jan 14, 2012 at 8:03 PM, Mike Frysinger wrote:
  On Friday 13 January 2012 18:10:55 Simon Glass wrote:
  From: Jim Lin ji...@nvidia.com
  
  A device tree is used to configure the NAND, including memory
  timings and block/pages sizes.
  
  If this node is not present or is disabled, then NAND will not
  be initialized.
  
  Signed-off-by: Simon Glass s...@chromium.org
  
  the Author needs to sign off too ...
 
 I have a lot like that. It doesn't feel right for me to just add their
 sign-off after all my changes. I was hoping that they would reply to
 the list with it. Does that work? The original commit does not have a
 sign-off.

sure, if the author replies with their s-o-b, or says they're OK with you 
adding it, that's fine.  but you're right that you can't just add it yourself 
without them saying so first ...
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/8] sandbox: Add flags for open() call

2012-01-14 Thread Mike Frysinger
On Tuesday 10 January 2012 19:45:51 Simon Glass wrote:
 This provides a way for callers to create files for writing. We define
 flags which mirror the POSIX values.
 
 Another approach would be to translate the flags at runtime. Perhaps we can
 leave to whoever wants to port this to another OS?

some of the flags differ between Linux/arches, so i think we'll have to do it 
now :/

 +enum {
 + OS_O_RDONLY,
 + OS_O_WRONLY,
 + OS_O_RDWR,
 + OS_O_CREAT  = 0100,
 +};

the flags are bit based, so an enum won't work i don't think
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/8] sandbox: Add flags for open() call

2012-01-14 Thread Simon Glass
Hi Mike,

On Sat, Jan 14, 2012 at 8:19 PM, Mike Frysinger vap...@gentoo.org wrote:
 On Tuesday 10 January 2012 19:45:51 Simon Glass wrote:
 This provides a way for callers to create files for writing. We define
 flags which mirror the POSIX values.

 Another approach would be to translate the flags at runtime. Perhaps we can
 leave to whoever wants to port this to another OS?

 some of the flags differ between Linux/arches, so i think we'll have to do it
 now :/

 +enum {
 +     OS_O_RDONLY,
 +     OS_O_WRONLY,
 +     OS_O_RDWR,
 +     OS_O_CREAT      = 0100,
 +};

 the flags are bit based, so an enum won't work i don't think

Mostly, but in /usr/include/bits/fcntl.h:

#define O_RDONLY 00
#define O_WRONLY 01
#define O_RDWR   02
#define O_CREAT0100 /* not fcntl */

Regards,
Simon

Regards,
Simon

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


  1   2   >