Re: [U-Boot] [PATCH v3] socfpga: Add a signer that is integrated into mkimage

2014-02-23 Thread Wolfgang Denk
Dear Charles,


would you please start following the established rules?  Especially
after having been asked before to to so?

In http://article.gmane.org/gmane.comp.boot-loaders.u-boot/180904
I asked you:

| Would you please read [1] and especially [2], the section about
| posting modified versions of patches ?
| 
| You are posting multiple patches with the same subject but different
| content.  Do you think we have time to figure out what might be the
| difference?  Please make sure to include a version tagin the Subject:
| line, and to add a history oof changes in the comment section.
| 
| And - do you think that This one passes checkpatch too :-) is a
| helpful and descriptive commit message?  [No, it is not.]
| 
| [1] http://www.denx.de/wiki/U-Boot/Patches
| [2] http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

In message 1393114104-7301-1-git-send-email-cdhmann...@gmail.com you wrote:
 This adds a signer for the socfpga preloader built from SPL.
 
 Instead of using the arcane Altera signing tool, this automatically
 creates a signed version of the SPL in the u-boot root directory.
 
 Changes since previous submissions:
 * This version is integrated into mkimage, with image type socfpgaimage.
 * This version passes checkpatch too :-)

This belongs into the comment section, i. e. below the --- line.

 Signed-off-by: Charles Manning cdhmann...@gmail.com
 ---

This is the place where comments go.

 --- a/common/image.c
 +++ b/common/image.c
 @@ -144,6 +144,7 @@ static const table_entry_t uimage_type[] = {
   {   IH_TYPE_INVALID,NULL, Invalid Image,  },
   {   IH_TYPE_MULTI,  multi,  Multi-File Image,   },
   {   IH_TYPE_OMAPIMAGE,  omapimage,  TI OMAP SPL With GP CH,},
 + {   IH_TYPE_SOCFPGAIMAGE,  socfpgaimage,  Altera SOCFPGA 
 preloader,},
   {   IH_TYPE_PBLIMAGE,   pblimage,   Freescale PBL Boot Image,},
   {   IH_TYPE_RAMDISK,ramdisk,RAMDisk Image,  },
   {   IH_TYPE_SCRIPT, script, Script, },

I asked before:

| Please always keep such lists sorted.

Why do you ignore review comments?


 +++ b/spl/Makefile
 @@ -144,8 +144,12 @@ $(OBJTREE)/MLO:  $(obj)u-boot-spl.bin
  
  $(OBJTREE)/MLO.byteswap: $(obj)u-boot-spl.bin
   $(OBJTREE)/tools/mkimage -T omapimage -n byteswap \
 +
   -a $(CONFIG_SPL_TEXT_BASE) -d $ $@

Me and Gerhard have asked you about this.  Is this eve working? I
doubt that.  But you ignore all such comments.

 +ifdef CONFIG_SOCFPGA
 +ALL-y += $(OBJTREE)/socfpga-signed-preloader.bin
 +endif

I commented on this - you ignored it.

 @@ -95,6 +95,7 @@ NOPED_OBJ_FILES-y += kwbimage.o
  NOPED_OBJ_FILES-y += pblimage.o
  NOPED_OBJ_FILES-y += imximage.o
  NOPED_OBJ_FILES-y += omapimage.o
 +NOPED_OBJ_FILES-y += socfpgaimage.o
  NOPED_OBJ_FILES-y += mkenvimage.o
  NOPED_OBJ_FILES-y += mkimage.o
  OBJ_FILES-$(CONFIG_SMDK5250) += mkexynosspl.o

I commented on this - you ignored it.

 @@ -214,6 +215,7 @@ $(obj)mkimage$(SFX):  $(obj)aisimage.o \
   $(obj)mkimage.o \
   $(obj)os_support.o \
   $(obj)omapimage.o \
 + $(obj)socfpgaimage.o \
   $(obj)sha1.o \
   $(obj)ublimage.o \
   $(LIBFDT_OBJS)

I commented on this - you ignored it.

...
 + * Reference doc 
 http://www.altera.com.cn/literature/hb/cyclone-v/cv_5400A.pdf
 + * Note this doc is not entirely accurate.

I asked for more information which parts of the doc are not correct.
You ignored this.

 + * This uses the CRC32 calc out of the well known Apple
 + * crc32.c code. Copyright for the CRC code:
 + *
 + * COPYRIGHT (C) 1986 Gary S. Brown.  You may use this program, or
 + *  code or tables extracted from it, as desired without restriction.

Many more ignored review comments folow.

Sorry, but this is not the way how code reviews are supposed to work.

NAK!!!


Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
As in certain cults it is possible to kill a process if you know  its
true name.  -- Ken Thompson and Dennis M. Ritchie
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] FAT filesystem support on SPI flash

2014-02-23 Thread Vasili Galka
Hi,

On our system, we are interested in keeping all files, including the OS image 
and U-Boot second stage on FAT filesystem residing on a SPI flash.

I have not found existing U-Boot support for such functionality. Have I missed 
it?

In any case, I'm willing to implement this, do you see it reasonable 
incorporating such code into U-Boot? (if it passes review of course)

I note about design: As our chip (TI's AM335x) does not support direct boot 
from FAT stored on SPI, I plan reserving section at the beginning of SPI flash 
for the first stage boot loader and having the filesystem after it.

Best,
Vasili

This email and any files transmitted with it are confidential and contain 
proprietary information belonging to VisionMap Ltd. VisionMap Ltd. asserts in 
respect of this email and any files transmitted with it all rights for 
confidentiality and proprietary interests to the fullest extent permitted by 
law. If you are not the intended recipient you are notified that disclosing, 
copying, distributing or taking any action in reliance on the contents of this 
information is strictly prohibited. Thank you. 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] FAT filesystem support on SPI flash

2014-02-23 Thread Wolfgang Denk
Dear Vasili,

In message d69e639dbb744e9ca4c7742f42c82...@ex13.visionmap.co.il you wrote:
   
 On our system, we are interested in keeping all files, including the OS image 
 and U-Boot second stage on FAT filesystem residing on a SPI flash.
 
 I have not found existing U-Boot support for such functionality. Have I 
 missed it?

We do not have FAT suppot on flash devices yet.

 In any case, I'm willing to implement this, do you see it reasonable 
 incorporating such code into U-Boot? (if it passes review of course)

I think the best way to implement this would require a two staged
approach: in the first stage, U-Boot should adapte the device driver
model we've been waiting for so long; in the second stage, the file
system support would more or less fall into place on to of the then
existing storage device drivers.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
When some people discover the truth, they just can't  understand  why
everybody isn't eager to hear it.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] FAT filesystem support on SPI flash

2014-02-23 Thread Jagan Teki
On Sun, Feb 23, 2014 at 7:07 PM, Vasili Galka vas...@visionmap.com wrote:
 Hi,

 On our system, we are interested in keeping all files, including the OS image 
 and U-Boot second stage on FAT filesystem residing on a SPI flash.

I'm not a file-system expert, but I've a basic question like how
does/well a SPI flash(mtd) device have
FAT support on it. Generally flash file-systems were categories to do
the job right?


 I have not found existing U-Boot support for such functionality. Have I 
 missed it?

 In any case, I'm willing to implement this, do you see it reasonable 
 incorporating such code into U-Boot? (if it passes review of course)

 I note about design: As our chip (TI's AM335x) does not support direct boot 
 from FAT stored on SPI, I plan reserving section at the beginning of SPI 
 flash for the first stage boot loader and having the filesystem after it.

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


Re: [U-Boot] [PATCH v3] socfpga: Add a signer that is integrated into mkimage

2014-02-23 Thread Charles Manning
Hello All, but mainly a message to Wolfgang and Gerhard.

I would like to apologise for my recent flurry of postings causing some 
confusion and gnashing of teeth.

I only read some of the comments (relating to adding a version number on the 
patch). I had read that far then assumed the patch had already been NAKed at 
that point and did not read further.

I shall now read all the comments from Wolfgang and Gerhard again and resubmit 
another version which I hope is closer to the mark.

Thank you for my ongoing education.

Regards

Charles


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


Re: [U-Boot] [PATCH v2 3/7] usb: eth: introduce support for Moschip USB ethernet

2014-02-23 Thread Gerhard Sittig
On Mon, Feb 17, 2014 at 21:57 +0100, Marek Vasut wrote:
 
 On Monday, February 17, 2014 at 08:35:23 PM, Gerhard Sittig wrote:
 
 [...]
 
  +int mcs7830_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
  +struct eth_device *eth)
  +{
  +   debug(%s()\n, __func__);
  +   if (!eth) {
  +   debug(%s: missing parameter.\n, __func__);
  +   return 0;
  +   }
  +
  +   snprintf(eth-name, sizeof(eth-name), %s%d,
  +MCS7830_BASE_NAME, mcs7830_iface_idx++);
  +   eth-init = mcs7830_init;
  +   eth-send = mcs7830_send;
  +   eth-recv = mcs7830_recv;
  +   eth-halt = mcs7830_halt;
  +   eth-write_hwaddr = mcs7830_write_mac;
  +   eth-priv = ss;
  +
  +   if (mcs7830_basic_reset(ss))
  +   return 0;
  +
  +#ifdef DEBUG
  +   (void)mcs7830_read_config(eth);
 
 So this is debug-only function? You might want to put the entire function 
 into 
 #ifdef DEBUG and then have an #else , where you define the function as an 
 empty 
 one. The GCC shall handle the rest then as well, but you won't have this ugly 
 ifdef in a function.

I thought about this for a while.

Usually you'd expect separate control and status registers in
hardware.  Where you write to control, and read back from status.
Here those two aspects appear to have been mixed into one
config register, and only in hindsight the reading became
unused.  It's not so much an intent, but more of a byproduct.

During development (before the driver became operational), I
could not tell whether I had to read-modify-write that config
register.  Following the Linux driver's approach, currently only
fixed values get written to the adapter and nothing gets read
back.

Later the shadow in the driver's private data was introduced,
such that updates neither need to read back what was written
before.  And since neither multicast nor promiscuous mode may
apply to bootloader operation, even those updates may never need
not occur.

In the meantime I'd even tend to support the removal of the
config register read routine.  Adding code just in case is a
programmer's sin that may not be acceptable in U-Boot, since the
cost outweights the benefit.

The current implementation (v3, with maybe unused decoration)
might be acceptable.  But should feedback suggest that v4 is
needed, I will remove that routine as well.


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


[U-Boot] [PATCH v4] socfpga: Add socfpga preloader signing to mkimage

2014-02-23 Thread Charles Manning
Like many platforms, the Altera socfpga platform requires that the
preloader be signed in a certain way or the built-in boot ROM will
not boot the code.

This change automatically creates an appropriately signed preloader
from an SPL image.

Signed-off-by: Charles Manning cdhmann...@gmail.com
---

Changes for v3:
 - Fix some coding style issues.
 - Move from a standalone tool to the mkimgae framework.

Changes for v4:
 - Fix more coding style issues.
 - Fix typos in Makefile.
 - Rebase on master (previous version was not on master, but on a 
   working socfpga branch).

Note: Building a SOCFPGA preloader will currently not produe a working
image, but that is due to issues in building SPL, not in this signer.

 common/image.c   |1 +
 include/image.h  |1 +
 spl/Makefile |8 ++
 tools/Makefile   |1 +
 tools/imagetool.c|2 +
 tools/imagetool.h|1 +
 tools/socfpgaimage.c |  365 ++
 7 files changed, 379 insertions(+)
 create mode 100644 tools/socfpgaimage.c

diff --git a/common/image.c b/common/image.c
index 9c6bec5..e7dc8cc 100644
--- a/common/image.c
+++ b/common/image.c
@@ -135,6 +135,7 @@ static const table_entry_t uimage_type[] = {
{   IH_TYPE_PBLIMAGE,   pblimage,   Freescale PBL Boot Image,},
{   IH_TYPE_RAMDISK,ramdisk,RAMDisk Image,  },
{   IH_TYPE_SCRIPT, script, Script, },
+   {   IH_TYPE_SOCFPGAIMAGE,  socfpgaimage,  Altera SOCFPGA 
preloader,},
{   IH_TYPE_STANDALONE, standalone, Standalone Program, },
{   IH_TYPE_UBLIMAGE,   ublimage,   Davinci UBL image,},
{   IH_TYPE_MXSIMAGE,   mxsimage,   Freescale MXS Boot Image,},
diff --git a/include/image.h b/include/image.h
index 6afd57b..bde31d9 100644
--- a/include/image.h
+++ b/include/image.h
@@ -215,6 +215,7 @@ struct lmb;
 #define IH_TYPE_KERNEL_NOLOAD  14  /* OS Kernel Image, can run from any 
load address */
 #define IH_TYPE_PBLIMAGE   15  /* Freescale PBL Boot Image */
 #define IH_TYPE_MXSIMAGE   16  /* Freescale MXSBoot Image  */
+#define IH_TYPE_SOCFPGAIMAGE   17  /* Altera SOCFPGA Preloader */
 
 /*
  * Compression Types
diff --git a/spl/Makefile b/spl/Makefile
index bf98024..90faaa6 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -181,6 +181,14 @@ $(objtree)/SPL : $(obj)/u-boot-spl.bin
 
 ALL-y  += $(obj)/$(SPL_BIN).bin
 
+$(OBJTREE)/socfpga-signed-preloader.bin: $(obj)/u-boot-spl.bin
+   $(OBJTREE)/tools/mkimage -T socfpgaimage -d $ $@
+
+
+ifdef CONFIG_SOCFPGA
+ALL-y += $(OBJTREE)/socfpga-signed-preloader.bin
+endif
+
 ifdef CONFIG_SAMSUNG
 ALL-y  += $(obj)/$(BOARD)-spl.bin
 endif
diff --git a/tools/Makefile b/tools/Makefile
index dcd49f8..59ff8d3 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -85,6 +85,7 @@ dumpimage-mkimage-objs := aisimage.o \
os_support.o \
pblimage.o \
sha1.o \
+   socfpgaimage.o \
ublimage.o \
$(LIBFDT_OBJS) \
$(RSA_OBJS-y)
diff --git a/tools/imagetool.c b/tools/imagetool.c
index 29d2189..1ef20b1 100644
--- a/tools/imagetool.c
+++ b/tools/imagetool.c
@@ -45,6 +45,8 @@ void register_image_tool(imagetool_register_t image_register)
init_ubl_image_type();
/* Init Davinci AIS support */
init_ais_image_type();
+   /* Init Altera SOCFPGA support */
+   init_socfpga_image_type();
 }
 
 /*
diff --git a/tools/imagetool.h b/tools/imagetool.h
index c2c9aea..c4833b1 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -167,6 +167,7 @@ void init_mxs_image_type(void);
 void init_fit_image_type(void);
 void init_ubl_image_type(void);
 void init_omap_image_type(void);
+void init_socfpga_image_type(void);
 
 void pbl_load_uboot(int fd, struct image_tool_params *mparams);
 
diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c
new file mode 100644
index 000..ca4369c
--- /dev/null
+++ b/tools/socfpgaimage.c
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2014 Charles Manning cdhmann...@gmail.com
+ *
+ * Use as you see fit.
+ *
+ * Reference doc http://www.altera.com.cn/literature/hb/cyclone-v/cv_5400A.pdf
+ * Note this doc is not entirely accurate.
+ *
+ * Header is a structure of the following format.
+ * this is positioned at 0x40.
+ *
+ * Endian is LSB.
+ *
+ * Offset   Length   Usage
+ * ---
+ *   0x404   Validation word 0x31305341
+ *   0x441   Version (whatever, zero is fine)
+ *   0x451   Flags   (unused, zero is fine)
+ *   0x462   Length  (in units of u32, including the end checksum).
+ *   0x482   Zero
+ *   0x0A2   Checksum over the heder. NB Not CRC32
+ *
+ * At the end of the code we have a 32-bit CRC checksum over whole binary
+ * excluding the CRC.
+ *
+ * The image is typically padded out to 64k, because that 

Re: [U-Boot] [PATCH v3 1/3] mtd: nand: omap: fix ecclayout to be in sync with u-boot NAND driver

2014-02-23 Thread Brian Norris
On Mon, Feb 17, 2014 at 10:11:52AM +0100, Albert ARIBAUD wrote:
 On Mon, 17 Feb 2014 13:11:23 +0530, Pekon Gupta pe...@ti.com wrote:
  Fixes: commit a919e51161b58ed7e6e663daba99ab7d558808f3
 mtd: nand: omap2: clean-up BCHx_HW and BCHx_SW ECC configurations in 
  device_probe
  
  Fixes ecclayout mismatch introduced in above commit for following 
  ecc-schemes:
   - OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
   - OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
   However, this patch also touches other ecc-schemes as the fix required
   refactoring common code, into ecc-scheme specific code.
  
  This patch aligns ecc-layout for below ecc-schemes as per reference 
  [1],[2],[3]
  Figure=ECC Locations in NAND Spare Areas
[snip]
 
 Seems to me that the commit message above could actually be placed in
 a doc/README.* file, making the commit message itself less bulky.

Yes, I have suggested Pekon add this as a proper documentation file. But
I will take the patches as-is anyway.

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


Re: [U-Boot] [PATCH v3 0/3] mtd: nand: omap: fix ecc-layout

2014-02-23 Thread Brian Norris
Hi Pekon,

On Mon, Feb 17, 2014 at 01:11:22PM +0530, Pekon Gupta wrote:
 *changes v2 - v3*
  - re-ordered the patch-set so that eccpos[] is fixed before 'oobfree'
  - marked for stable 3.13.x+
 
 
 *changes v1 - v2*
 [PATCH 1/3] fix oobfree-offset calculation + adjust for reserved-marker of 
 last sector
 [PATCH 2/3] new patch
 [PATCH 3/3] refactor code as suggested by Brian Norris 
 computersforpe...@gmail.com
 
  
 *original v1*
 [PATCH 1/2] 
 http://lists.infradead.org/pipermail/linux-mtd/2013-December/050946.html
 [PATCH 2/2] 
 http://lists.infradead.org/pipermail/linux-mtd/2013-December/050945.html
 
 This patch-set is tested on AM335x-EVM using following end-to-end boot 
 sequence
 with appropriate u-boot configs [1]
 
 (BCH8_HW)  (HAM1_HW) (HAM1_HW) (HAM1_HW)  (UBIFS)
 ROM - SPL - U-Boot - Kernel - File-System
 
 (BCH8_HW)  (BCH8_SW) (BCH8_SW) (BCH8_SW)  (UBIFS)
 ROM - SPL - U-Boot - Kernel - File-System
 
 (BCH8_HW)  (BCH8_HW) (BCH8_HW) (BCH8_HW)  (UBIFS)
 ROM - SPL - U-Boot - Kernel - File-System
 
 
 Test1: flash ubi image from u-boot and boot the kernel
u-boot mw 0x8200 0xff u-boot.img size aligned to NAND block boundary
u-boot fatload mmc 0 0x8200 u-boot.img
u-boot nand erase u-boot_offset u-boot.img size
u-boot nand write 0x8200  u-boot_offset u-boot.img size
u-boot setenv bootargs 'console=ttyO0,115200n8 noinitrd mem=256M \
 root=ubi0 rw rootfstype=ubifs ubi.mtd=mtdpart-of-rootfs,\
 page-size ip=off init=/init'
u-boot bootm kernel_offset
 
 Test2: update u-boot.img from kernel and re-boot
kernel flash_erase /dev/mtdpart-of-u-boot  0 0
kernel nandwrite -s 0  /dev/mtdpart-of-u-boot   u-boot.img
kernel reboot
 
 [1] u-boot configurations to match above ecc-layout are documented at
 https://processors.wiki.ti.com/index.php/Linux_Core_NAND_User%27s_Guide

Pushed to linux-mtd.git. I plan to send this to Linus in the 3.14-rc.
Thanks!

If you get the time, can you submit some documentation for
Documentation/mtd/nand/?

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


Re: [U-Boot] [U-Boot, v5] Makefile: add a new script to check -fstack-usage support

2014-02-23 Thread Masahiro Yamada
Hello Tom,


 We still want this, and it's still applicable right?

Yes, it's still applicable and I really want it on the code base.

Without this patch,  log message would be sprinked with warnings
when using some cross tools.


$ make CROSS_COMPILE=m68k-linux-   M54418TWR_config all
 [ snip ]
  CC  arch/m68k/lib/cache.o
arch/m68k/lib/cache.c: In function 'flush_cache':
arch/m68k/lib/cache.c:18:1: warning: -fstack-usage not supported for this 
target [enabled by default]
  CC  arch/m68k/lib/interrupts.o
arch/m68k/lib/interrupts.c: In function 'irq_install_handler':
arch/m68k/lib/interrupts.c:56:1: warning: -fstack-usage not supported for this 
target [enabled by default]
  CC  arch/m68k/lib/time.o
arch/m68k/lib/time.c: In function 'dtimer_interrupt':
arch/m68k/lib/time.c:76:1: warning: -fstack-usage not supported for this target 
[enabled by default]
  CC  arch/m68k/lib/traps.o
arch/m68k/lib/traps.c: In function 'exc_handler':
arch/m68k/lib/traps.c:40:1: warning: -fstack-usage not supported for this 
target [enabled by default]
  LD  arch/m68k/lib/built-in.o
  LD  board/freescale/common/built-in.o
  CC  board/freescale/m54418twr/m54418twr.o
board/freescale/m54418twr/m54418twr.c: In function 'checkboard':
board/freescale/m54418twr/m54418twr.c:26:1: warning: -fstack-usage not 
supported for this target [enabled by default]
  LD  board/freescale/m54418twr/built-in.o
  CC  common/main.o
common/main.c: In function 'delete_char.part.1':
common/main.c:1167:1: warning: -fstack-usage not supported for this target 
[enabled by default]
  CC  common/command.o
common/command.c: In function 'find_cmd_tbl':
common/command.c:120:1: warning: -fstack-usage not supported for this target 
[enabled by default]




Best Regards
Masahiro Yamada

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


Re: [U-Boot] [PATCH 1/7 V5] mmc: Add some usefull macro definition

2014-02-23 Thread Zhang Haijun
Hi, Pantelis

How about the status of this patch set now?
Did I need to do something?


Regards  Thanks

-- Haijun

On 12/30/2013 04:20 PM, Haijun Zhang wrote:
 Add command class define.
 Add mmc erase and secure erase define.
 Add secure erase and trim support bit define.

 Signed-off-by: Haijun Zhang haijun.zh...@freescale.com
 ---
 changes for V5:
   - Add some comments for definitions

  include/mmc.h | 50 +-
  1 file changed, 49 insertions(+), 1 deletion(-)

 diff --git a/include/mmc.h b/include/mmc.h
 index cb558da..607e28b 100644
 --- a/include/mmc.h
 +++ b/include/mmc.h
 @@ -53,6 +53,7 @@
  #define COMM_ERR -18 /* Communications Error */
  #define TIMEOUT  -19
  #define IN_PROGRESS  -20 /* operation is in progress */
 +#define NOT_SUPPORT  -21 /* Operation is not support */
  
  #define MMC_CMD_GO_IDLE_STATE0
  #define MMC_CMD_SEND_OP_COND 1
 @@ -105,6 +106,39 @@
  #define OCR_VOLTAGE_MASK 0x007FFF80
  #define OCR_ACCESS_MODE  0x6000
  
 +/*
 + * Card Command Classes (CCC)
 + *
 + * (0) Basic protocol functions (CMD0,1,2,3,4,7,9,10,12,13,15)
 + * (and for SPI, CMD58,59)
 + * (1) Stream read commands (CMD11)
 + * (2) Block read commands (CMD16,17,18)
 + * (3) Stream write commands (CMD20)
 + * (4) Block write commands (CMD16,24,25,26,27)
 + * (5) Ability to erase blocks (CMD32,33,34,35,36,37,38,39)
 + * (6) Able to write protect blocks (CMD28,29,30)
 + * (7) Able to lock down card (CMD16,CMD42)
 + * (8) Application specific (CMD55,56,57,ACMD*)
 + * (9) I/O mode (CMD5,39,40,52,53)
 + * (10) High speed switch (CMD6,34,35,36,37,50)
 + */
 +#define CCC_BASIC(10)
 +#define CCC_STREAM_READ  (11)
 +#define CCC_BLOCK_READ   (12)
 +#define CCC_STREAM_WRITE (13)
 +#define CCC_BLOCK_WRITE  (14)
 +#define CCC_ERASE(15)
 +#define CCC_WRITE_PROT   (16)
 +#define CCC_LOCK_CARD(17)
 +#define CCC_APP_SPEC (18)
 +#define CCC_IO_MODE  (19)
 +#define CCC_SWITCH   (110)
 +
 +#define MMC_ERASE_ARG   0x
 +#define MMC_SECURE_ERASE_ARG0x8000
 +#define MMC_TRIM_ARG0x0001
 +#define MMC_DISCARD_ARG 0x0003
 +
  #define SECURE_ERASE 0x8000
  
  #define MMC_STATUS_MASK  (~0x0206BF7F)
 @@ -160,8 +194,12 @@
  #define EXT_CSD_CARD_TYPE196 /* RO */
  #define EXT_CSD_SEC_CNT  212 /* RO, 4 bytes */
  #define EXT_CSD_HC_WP_GRP_SIZE   221 /* RO */
 +#define EXT_CSD_REL_WR_SEC_C 222 /* RO */
 +#define EXT_CSD_ERASE_TIMEOUT_MULT   223 /* RO */
  #define EXT_CSD_HC_ERASE_GRP_SIZE224 /* RO */
  #define EXT_CSD_BOOT_MULT226 /* RO */
 +#define EXT_CSD_SEC_ERASE_MULT   230 /* RO */
 +#define EXT_CSD_SEC_FEATURE_SUPPORT  231 /* RO */
  
  /*
   * EXT_CSD field definitions
 @@ -178,6 +216,12 @@
  #define EXT_CSD_BUS_WIDTH_4  1   /* Card is in 4 bit mode */
  #define EXT_CSD_BUS_WIDTH_8  2   /* Card is in 8 bit mode */
  
 +/* SEC_FEATURE_SUPPORT[231] Field definitions */
 +#define EXT_CSD_SEC_ER_EN(10)
 +#define EXT_CSD_SEC_BD_BLK_EN(12)
 +#define EXT_CSD_SEC_GB_CL_EN (14)
 +#define EXT_CSD_SEC_SANITIZE (16)  /* v4.5 later */
 +
  #define EXT_CSD_BOOT_ACK_ENABLE  (1  6)
  #define EXT_CSD_BOOT_PARTITION_ENABLE(1  3)
  #define EXT_CSD_PARTITION_ACCESS_ENABLE  (1  0)
 @@ -187,7 +231,6 @@
  #define EXT_CSD_BOOT_PART_NUM(x) (x  3)
  #define EXT_CSD_PARTITION_ACCESS(x)  (x  0)
  
 -
  #define R1_ILLEGAL_COMMAND   (1  22)
  #define R1_APP_CMD   (1  5)
  
 @@ -268,10 +311,15 @@ struct mmc {
   ushort rca;
   char part_config;
   char part_num;
 + ushort cmdclass;
   uint tran_speed;
   uint read_bl_len;
   uint write_bl_len;
   uint erase_grp_size;
 + uint erase_timeout_mult;
 + char sec_feature_support;
 + uint sec_erase_mult;
 + uint sec_erase_timeout;
   u64 capacity;
   u64 capacity_user;
   u64 capacity_boot;

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


Re: [U-Boot] [PATCH 12/15] kbuild: use shorten logs for IMX images

2014-02-23 Thread Masahiro Yamada
Hello Simon,

Thanks for your close review.
This is always appreciated.


  diff --git a/spl/Makefile b/spl/Makefile
  index 22d6323..e8c5938 100644
  --- a/spl/Makefile
  +++ b/spl/Makefile
  @@ -178,8 +178,8 @@ MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a 
  $(CONFIG_SPL_TEXT_BASE)
   MLO MLO.byteswap: $(obj)/u-boot-spl.bin
  $(call if_changed,mkimage)
 
  -$(objtree)/SPL: $(obj)/u-boot-spl.bin
  -   $(Q)$(MAKE) $(build)=spl/arch/arm/imx-common $@
  +SPL: $(obj)/u-boot-spl.bin
  +   $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
 
 This series looks good to me, but I would like to understand what is
 happening here. Are you changing it to pick up the source from the
 real arch/ directory instead of the spl copy?

Two things are happening here:
 [1] drop $(objtree)/
 [2] modify $(build)=spl/arch/arm/imx-commot  to
$(build)=arch/arm/imx-common

Let me explain the reason of each one by one.

[1]
$(objtree) ( and $(OBJTREE)) points to the absolute path of the
working directory.

I want short log should be like:
UIMAGE  SPL
rather than
UIMAGE  /home/yamada/workspace/SPL

That's why  I dropped $(objtree)/ and $(OBJTREE)/  prefixes
from all IMX related images.

[2]
I guess it's difficult to understand what's happening here.
I hope the following explanation will be clear for you..

At this commit,
Both ./Makefile and spl/Makefile descend into arch/arm/imx-common.


From the ./Makefile, here

u-boot.imx: u-boot.bin
$(Q)$(MAKE) $(build)=arch/arm/imx-common $@

u-boot-with-spl.imx u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
$(Q)$(MAKE) $(build)=arch/arm/imx-common $@


And from spl/Makefile, here

SPL: $(obj)/u-boot-spl.bin
$(Q)$(MAKE) $(build)=arch/arm/imx-common $@


I needed to specify $(build)=arch/arm/imx-common consistenty
to include .*.cmd files correctly.

I added 
   targets += $(addprefix ../../../,$(IMX_CONFIG) SPL u-boot.uim 
spl/u-boot-nand-spl.imx)
at the end of arch/arm/imx-common/Makefile.
(It may look weird. )

And it is prefixed (obj)/  at scripts/Makefile.lib  line 76
   targets := $(addprefix $(obj)/,$(targets))

If I had not changed $(build)=spl/arm/arm/imx-common,
$(targets) would have pointed to spl/arch/arm/imx-common/../../../SPL),
that is, spl/SPL.
But .SPL.cmd is not in spl/ directory.



Anyway, it is really complicated to descend into arch/arm/imx-common
from two Makefiles, ./Makefile and spl/Makefile.

So I moved the SPL rule from spl/Makefile to ./Makefile.


Best Regards
Masahiro Yamada

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


[U-Boot] [PATCH v2 10/15] kbuild: use shorten log for linking u-boot

2014-02-23 Thread Masahiro Yamada
Move sandbox-specific link rule to arch/sandbox/config.mk.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile   | 33 ++---
 arch/sandbox/config.mk |  4 
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index 091902c..adb40e4 100644
--- a/Makefile
+++ b/Makefile
@@ -738,7 +738,7 @@ endif
 endif
 endif
 
-LDFLAGS_u-boot += -T u-boot.lds $(LDFLAGS_FINAL)
+LDFLAGS_u-boot += $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
 endif
@@ -913,27 +913,22 @@ u-boot.elf: u-boot.bin
--defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
-Ttext=$(CONFIG_SYS_TEXT_BASE)
 
-ifeq ($(CONFIG_SANDBOX),y)
-GEN_UBOOT = \
-   $(CC) $(SYMS) -T u-boot.lds \
-   -Wl,--start-group $(u-boot-main) -Wl,--end-group \
-   $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
-else
-GEN_UBOOT = \
-   $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
-   $(u-boot-init) \
-   --start-group $(u-boot-main) --end-group 
$(PLATFORM_LIBS) \
-   -Map u-boot.map -o u-boot
-endif
+# Rule to link u-boot
+# May be overridden by arch/$(ARCH)/config.mk
+quiet_cmd_u-boot__ ?= LD  $@
+  cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \
+  -T u-boot.lds $(u-boot-init) \
+  --start-group $(u-boot-main) --end-group \
+  $(PLATFORM_LIBS) -Map u-boot.map
 
 u-boot:$(u-boot-init) $(u-boot-main) u-boot.lds
-   $(GEN_UBOOT)
+   $(call if_changed,u-boot__)
 ifeq ($(CONFIG_KALLSYMS),y)
-   smap=`$(call SYSTEM_MAP,u-boot) | \
-   awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 000}'` ; \
-   $(CC) $(c_flags) -DSYSTEM_MAP=\$${smap}\ \
-   -c $(srctree)/common/system_map.c -o common/system_map.o
-   $(GEN_UBOOT) common/system_map.o
+   smap=`$(call SYSTEM_MAP,u-boot) | \
+   awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 000}'` ; \
+   $(CC) $(c_flags) -DSYSTEM_MAP=\$${smap}\ \
+   -c $(srctree)/common/system_map.c -o common/system_map.o
+   $(call cmd,u-boot__) common/system_map.o
 endif
 
 # The actual objects are generated when descending, 
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 6142dd4..23b057e 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -7,3 +7,7 @@ PLATFORM_LIBS += -lrt
 
 # Support generic board on sandbox
 __HAVE_ARCH_GENERIC_BOARD := y
+
+cmd_u-boot__ = $(CC) -o $@ -T u-boot.lds \
+   -Wl,--start-group $(u-boot-main) -Wl,--end-group \
+   $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 15/15] kbuild: add misc targets, help, ubootrelease, ubootversion

2014-02-23 Thread Masahiro Yamada
help target has been copied from Linux 3.13 and adjusted
for U-Boot.
Unlike Linux, cleaning is done on 4 levels:
clean, clobber, mrproper, distclean.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2:
  - Rebase on commit 1674df60

 Makefile | 65 +---
 1 file changed, 58 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 75a1747..f647d41 100644
--- a/Makefile
+++ b/Makefile
@@ -415,7 +415,7 @@ timestamp_h := include/generated/timestamp_autogenerated.h
 
 no-dot-config-targets := clean clobber mrproper distclean \
 help %docs check% coccicheck \
-backup
+ubootversion backup
 
 config-targets := 0
 mixed-targets  := 0
@@ -1081,12 +1081,6 @@ TAG_SUBDIRS := $(u-boot-dirs) include
 FIND := find
 FINDFLAGS := -L
 
-PHONY += checkstack
-
-checkstack:
-   $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \
-   $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
-
 tags ctags:
ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
-name '*.[chS]' -print`
@@ -1252,6 +1246,51 @@ backup:
F=`basename $(TOPDIR)` ; cd .. ; \
gtar --force-local -zcvf `LC_ALL=C date +$$F-%Y-%m-%d-%T.tar.gz` $$F
 
+help:
+   @echo  'Cleaning targets:'
+   @echo  '  clean   - Remove most generated files but keep the 
config and'
+   @echo  'necessities for testing u-boot'
+   @echo  '  clobber - Remove most generated files but keep the 
config'
+   @echo  '  mrproper- Remove all generated files + config + 
various backup files'
+   @echo  '  distclean   - mrproper + remove editor backup and patch 
files'
+   @echo  ''
+# uncomment after adding Kconfig feature
+#  @echo  'Configuration targets:'
+#  @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
+#  @echo  ''
+   @echo  'Other generic targets:'
+   @echo  '  all - Build all necessary images depending on 
configuration'
+   @echo  '  u-boot  - Build the bare u-boot'
+   @echo  '  dir/- Build all files in dir and below'
+   @echo  '  dir/file.[oisS] - Build specified target only'
+   @echo  '  dir/file.lst- Build specified mixed source/assembly 
target only'
+   @echo  '(requires a recent binutils and recent 
build (System.map))'
+   @echo  '  tags/TAGS   - Generate tags file for editors'
+   @echo  '  cscope  - Generate cscope index'
+   @echo  '  ubootrelease- Output the release version string'
+   @echo  '  ubootversion- Output the version stored in Makefile'
+   @echo  ''
+   @echo  'Static analysers'
+   @echo  '  checkstack  - Generate a list of stack hogs'
+   @echo  ''
+   @echo  'Documentation targets:'
+   @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp
+   @echo  ''
+   @echo  '  make V=0|1 [targets] 0 = quiet build (default), 1 = verbose 
build'
+   @echo  '  make V=2   [targets] 2 = give reason for rebuild of target'
+   @echo  '  make O=dir [targets] Locate all output files in dir, 
including .config'
+   @echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse 
by default)'
+   @echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
+   @echo  '  make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount 
sections'
+   @echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3 where'
+   @echo  '1: warnings which may be relevant and do not 
occur too often'
+   @echo  '2: warnings which occur quite often but may 
still be relevant'
+   @echo  '3: more obscure warnings, can most likely be 
ignored'
+   @echo  'Multiple levels can be combined with W=12 or 
W=123'
+   @echo  ''
+   @echo  'Execute make or make all to build all targets marked with 
[*] '
+   @echo  'For further info see the ./README file'
+
 
 # Documentation targets
 # ---
@@ -1267,6 +1306,18 @@ scripts: ;
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
 
+PHONY += checkstack ubootrelease ubootversion
+
+checkstack:
+   $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \
+   $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
+
+ubootrelease:
+   @echo $(UBOOTVERSION)$$($(CONFIG_SHELL) 
$(srctree)/scripts/setlocalversion $(srctree))
+
+ubootversion:
+   @echo $(UBOOTVERSION)
+
 # Single targets
 # ---
 # Single targets are compatible with:
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 06/15] kbuild: use shorten logs objcopy rules

2014-02-23 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile | 41 +
 examples/api/Makefile|  6 --
 examples/standalone/Makefile | 10 ++
 spl/Makefile | 19 +--
 4 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile
index 05292ad..7a179cd 100644
--- a/Makefile
+++ b/Makefile
@@ -743,6 +743,9 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),)
 LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
 endif
 
+quiet_cmd_objcopy = OBJCOPY $@
+cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $ $@
+
 all:   $(ALL-y)
 
 PHONY += dtbs
@@ -752,27 +755,31 @@ dtbs dts/dt.dtb: checkdtc u-boot
 u-boot-dtb.bin: u-boot.bin dts/dt.dtb
cat $^ $@
 
-u-boot.hex:u-boot
-   $(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $ $@
+OBJCOPYFLAGS_u-boot.hex := -O ihex
 
-u-boot.srec:   u-boot
-   $(OBJCOPY) $(OBJCOPYFLAGS) -O srec $ $@
+OBJCOPYFLAGS_u-boot.srec := -O srec
 
-u-boot.bin:u-boot
-   $(OBJCOPY) $(OBJCOPYFLAGS) -O binary $ $@
-   $(call DO_STATIC_RELA,$,$@,$(CONFIG_SYS_TEXT_BASE))
-   $(BOARD_SIZE_CHECK)
+u-boot.hex u-boot.srec: u-boot FORCE
+   $(call if_changed,objcopy)
+
+OBJCOPYFLAGS_u-boot.bin := -O binary
+
+u-boot.bin: u-boot FORCE
+   $(call if_changed,objcopy)
+   $(call DO_STATIC_RELA,$,$@,$(CONFIG_SYS_TEXT_BASE))
+   $(BOARD_SIZE_CHECK)
 
 u-boot.ldr:u-boot
$(CREATE_LDR_ENV)
$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $ $(LDR_FLAGS)
$(BOARD_SIZE_CHECK)
 
-u-boot.ldr.hex:u-boot.ldr
-   $(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $ $@ -I binary
+OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
+
+OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
 
-u-boot.ldr.srec:   u-boot.ldr
-   $(OBJCOPY) $(OBJCOPYFLAGS) -O srec $ $@ -I binary
+u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
+   $(call if_changed,objcopy)
 
 #
 # U-Boot entry point, needed for booting of full-blown U-Boot
@@ -1253,6 +1260,16 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   
$(wildcard $(rm-dirs)))
 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard 
$(rm-files)))
   cmd_rmfiles = rm -f $(rm-files)
 
+# read all saved command lines
+
+targets := $(wildcard $(sort $(targets)))
+cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir 
$(f)).cmd))
+
+ifneq ($(cmd_files),)
+  $(cmd_files): ;  # Do not try to update included dependency files
+  include $(cmd_files)
+endif
+
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
 # Usage:
 # $(Q)$(MAKE) $(clean)=dir
diff --git a/examples/api/Makefile b/examples/api/Makefile
index 09475f8..6c19830 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -40,8 +40,10 @@ OBJS += $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y)))
 $(obj)/demo:   $(OBJS)
$(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $^ 
$(PLATFORM_LIBS)
 
-$(obj)/demo.bin: $(obj)/demo
-   $(OBJCOPY) -O binary $ $@ 2/dev/null
+# demo.bin is never genrated. Is this necessary?
+OBJCOPYFLAGS_demo.bin := -O binary
+$(obj)/demo.bin: $(obj)/demo FORCE
+   $(call if_changed,objcopy)
 
 # Rule to build generic library C files
 $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: 
$(SRCTREE)/lib/%.c FORCE
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 47c9d54..5f61043 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -72,8 +72,10 @@ $(obj)/%:$(obj)/%.o $(LIB)
-o $@ -e $(SYM_PREFIX)$(notdir $(:.o=)) $ $(LIB) \
-L$(gcclibdir) -lgcc
 
-$(obj)/%.srec: $(obj)/%
-   $(OBJCOPY) -O srec $ $@ 2/dev/null
+$(obj)/%.srec: OBJCOPYFLAGS := -O srec
+$(obj)/%.srec: $(obj)/% FORCE
+   $(call if_changed,objcopy)
 
-$(obj)/%.bin:  $(obj)/%
-   $(OBJCOPY) -O binary $ $@ 2/dev/null
+$(obj)/%.bin: OBJCOPYFLAGS := -O binary
+$(obj)/%.bin: $(obj)/% FORCE
+   $(call if_changed,objcopy)
diff --git a/spl/Makefile b/spl/Makefile
index 02312ce..bcb70df 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -199,8 +199,13 @@ $(obj)/$(BOARD)-spl.bin: $(obj)/u-boot-spl.bin
$(OBJTREE)/tools/mkexynosspl) $(VAR_SIZE_PARAM) $ $@
 endif
 
-$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)
-   $(OBJCOPY) $(OBJCOPYFLAGS) $(SPL_OBJCFLAGS) -O binary $ $@
+quiet_cmd_objcopy = OBJCOPY $@
+cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $ $@
+
+OBJCOPYFLAGS_$(SPL_BIN).bin = $(SPL_OBJCFLAGS) -O binary
+
+$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN) FORCE
+   $(call if_changed,objcopy)
 
 LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SPL_TEXT_BASE),)
@@ -228,6 +233,16 @@ cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) 
$(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
 

[U-Boot] [PATCH v2 13/15] kbuild: refactor more IMX image rules

2014-02-23 Thread Masahiro Yamada
This commit avoids generating ./SPL twice.
  - Fist time descending to spl/
  - Second time as a prerequisite of u-boot-with-spl.imx,
u-boot-with-nand-spl.imx.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile |  5 -
 arch/arm/config.mk   | 10 ++
 arch/arm/cpu/arm1136/config.mk   | 10 --
 arch/arm/cpu/arm926ejs/config.mk | 10 --
 arch/arm/cpu/armv7/config.mk | 10 --
 spl/Makefile |  3 ---
 6 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/Makefile b/Makefile
index dc04870..1311592 100644
--- a/Makefile
+++ b/Makefile
@@ -839,7 +839,10 @@ OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \
 tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE
$(call if_changed,pad_cat)
 
-u-boot-with-spl.imx u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
+SPL: spl/u-boot-spl.bin FORCE
+   $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
+
+u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE
$(Q)$(MAKE) $(build)=arch/arm/imx-common $@
 
 MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e 
$(CONFIG_SYS_TEXT_BASE)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 8a65c34..17b7408 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -112,3 +112,13 @@ OBJCOPYFLAGS += -j .text -j .rodata -j .data -j 
.u_boot_list -j .rela.dyn
 else
 OBJCOPYFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j 
.u_boot_list -j .rel.dyn
 endif
+
+ifneq ($(CONFIG_IMX_CONFIG),)
+ifdef CONFIG_SPL
+ifndef CONFIG_SPL_BUILD
+ALL-y += SPL
+endif
+else
+ALL-y += u-boot.imx
+endif
+endif
diff --git a/arch/arm/cpu/arm1136/config.mk b/arch/arm/cpu/arm1136/config.mk
index 91b0ef3..a82c6ce 100644
--- a/arch/arm/cpu/arm1136/config.mk
+++ b/arch/arm/cpu/arm1136/config.mk
@@ -7,13 +7,3 @@
 
 # Make ARMv5 to allow more compilers to work, even though its v6.
 PLATFORM_CPPFLAGS += -march=armv5
-
-ifneq ($(CONFIG_IMX_CONFIG),)
-ifdef CONFIG_SPL
-ifdef CONFIG_SPL_BUILD
-ALL-y  += SPL
-endif
-else
-ALL-y  += u-boot.imx
-endif
-endif
diff --git a/arch/arm/cpu/arm926ejs/config.mk b/arch/arm/cpu/arm926ejs/config.mk
index 918cdec..bdb3da1 100644
--- a/arch/arm/cpu/arm926ejs/config.mk
+++ b/arch/arm/cpu/arm926ejs/config.mk
@@ -6,13 +6,3 @@
 #
 
 PLATFORM_CPPFLAGS += -march=armv5te
-
-ifneq ($(CONFIG_IMX_CONFIG),)
-ifdef CONFIG_SPL
-ifdef CONFIG_SPL_BUILD
-ALL-y  += SPL
-endif
-else
-ALL-y  += u-boot.imx
-endif
-endif
diff --git a/arch/arm/cpu/armv7/config.mk b/arch/arm/cpu/armv7/config.mk
index 852f83c..247b7a5 100644
--- a/arch/arm/cpu/armv7/config.mk
+++ b/arch/arm/cpu/armv7/config.mk
@@ -13,13 +13,3 @@ PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARMV7)
 # SEE README.arm-unaligned-accesses
 PF_NO_UNALIGNED := $(call cc-option, -mno-unaligned-access,)
 PLATFORM_NO_UNALIGNED := $(PF_NO_UNALIGNED)
-
-ifneq ($(CONFIG_IMX_CONFIG),)
-ifdef CONFIG_SPL
-ifdef CONFIG_SPL_BUILD
-ALL-y  += SPL
-endif
-else
-ALL-y  += u-boot.imx
-endif
-endif
diff --git a/spl/Makefile b/spl/Makefile
index 919c3b4..da1c3c0 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -179,9 +179,6 @@ MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a 
$(CONFIG_SPL_TEXT_BASE)
 MLO MLO.byteswap: $(obj)/u-boot-spl.bin
$(call if_changed,mkimage)
 
-SPL: $(obj)/u-boot-spl.bin
-   $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
-
 ALL-y  += $(obj)/$(SPL_BIN).bin
 
 ifdef CONFIG_SAMSUNG
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 02/15] kbuild: abolish depend target

2014-02-23 Thread Masahiro Yamada
This commit moves include/generated/{generic-asm-offsets.h, asm-offsets.h}
from depend targets to prepare targets and deletes depend targets.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 7f8d8b5..aef936d 100644
--- a/Makefile
+++ b/Makefile
@@ -939,7 +939,7 @@ $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ;
 # Error messages still appears in the original language
 
 PHONY += $(u-boot-dirs)
-$(u-boot-dirs): depend prepare scripts
+$(u-boot-dirs): prepare scripts
$(Q)$(MAKE) $(build)=$@
 
 tools: prepare
@@ -988,7 +988,8 @@ prepare1: prepare2 $(version_h) $(timestamp_h)
 
 archprepare: prepare1 scripts_basic
 
-prepare0: archprepare FORCE
+prepare0: archprepare FORCE include/generated/generic-asm-offsets.h \
+   include/generated/asm-offsets.h
@:
 
 # All the preparing..
@@ -1038,27 +1039,29 @@ quiet_cmd_autoconf = GEN $@
 include/autoconf.mk: include/config.h
$(call cmd,autoconf)
 
-u-boot.lds: $(LDSCRIPT) depend prepare
+# ---
+
+PHONY += depend dep
+depend dep:
+   @echo '*** Warning: make $@ is unnecessary now.'
+
+# ---
+
+u-boot.lds: $(LDSCRIPT) prepare
$(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - $ 
$@
 
-nand_spl: depend prepare
+nand_spl: prepare
$(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
 
 u-boot-nand.bin:   nand_spl u-boot.bin
cat nand_spl/u-boot-spl-16k.bin u-boot.bin  u-boot-nand.bin
 
-spl/u-boot-spl.bin: tools depend prepare
+spl/u-boot-spl.bin: tools prepare
$(MAKE) obj=spl -f $(srctree)/spl/Makefile all
 
-tpl/u-boot-tpl.bin: tools depend prepare
+tpl/u-boot-tpl.bin: tools prepare
$(MAKE) obj=tpl -f $(srctree)/spl/Makefile all 
CONFIG_TPL_BUILD=y
 
-# Explicitly make _depend in subdirs containing multiple targets to prevent
-# parallel sub-makes creating .depend files simultaneously.
-depend dep:\
-   include/generated/generic-asm-offsets.h \
-   include/generated/asm-offsets.h
-
 TAG_SUBDIRS := $(u-boot-dirs) include
 
 FIND := find
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 09/15] kbuild: use shorten logs for combined rules of mkimage, padding and cat

2014-02-23 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile | 79 +---
 1 file changed, 41 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index cce239f..091902c 100644
--- a/Makefile
+++ b/Makefile
@@ -753,6 +753,11 @@ cmd_mkimage = $(objtree)/tools/mkimage 
$(MKIMAGEFLAGS_$(@F)) -d $ $@ \
 quiet_cmd_cat = CAT $@
 cmd_cat = cat $(filter-out $(PHONY), $^)  $@
 
+append = cat $(filter-out $ $(PHONY), $^)  $@
+
+quiet_cmd_pad_cat = CAT $@
+cmd_pad_cat = $(cmd_objcopy)  $(append) || rm -f $@
+
 all:   $(ALL-y)
 
 PHONY += dtbs
@@ -818,25 +823,21 @@ u-boot.sha1:  u-boot.bin
 u-boot.dis:u-boot
$(OBJDUMP) -d $  $@
 
-# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
-# $(4) is pad-to
-SPL_PAD_APPEND = \
-   $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(4) -I binary -O binary \
-   $(1) $(3); \
-   cat $(3) $(2)  $@; \
-   rm $(3)
-
 ifdef CONFIG_TPL
 SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
 else
 SPL_PAYLOAD := u-boot.bin
 endif
 
-u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD)
-   $(call 
SPL_PAD_APPEND,$,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
+OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
+  --pad-to=$(CONFIG_SPL_PAD_TO)
+u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE
+   $(call if_changed,pad_cat)
 
-tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin
-   $(call 
SPL_PAD_APPEND,$,u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
+OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \
+  --pad-to=$(CONFIG_TPL_PAD_TO)
+tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE
+   $(call if_changed,pad_cat)
 
 u-boot-with-spl.imx u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
$(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
@@ -846,17 +847,15 @@ MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e 
$(CONFIG_SYS_TEXT_BASE
 u-boot.ubl: u-boot-with-spl.bin FORCE
$(call if_changed,mkimage)
 
-u-boot.ais:   spl/u-boot-spl.bin u-boot.img
-   tools/mkimage -s -n $(if 
$(CONFIG_AIS_CONFIG_FILE),$(srctree)/$(CONFIG_AIS_CONFIG_FILE:%=%),/dev/null)
 \
-   -T aisimage \
-   -e $(CONFIG_SPL_TEXT_BASE) \
-   -d spl/u-boot-spl.bin \
-   spl/u-boot-spl.ais
-   $(OBJCOPY) $(OBJCOPYFLAGS) -I binary \
-   --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
-   spl/u-boot-spl.ais spl/u-boot-spl-pad.ais
-   cat spl/u-boot-spl-pad.ais u-boot.img  u-boot.ais
+MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \
+   $(srctree)/$(CONFIG_AIS_CONFIG_FILE:%=%),/dev/null) \
+   -T aisimage -e $(CONFIG_SPL_TEXT_BASE)
+spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE
+   $(call if_changed,mkimage)
 
+OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_MAX_SIZE)
+u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE
+   $(call if_changed,pad_cat)
 
 u-boot.sb: u-boot.bin spl/u-boot-spl.bin
$(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs $(objtree)/u-boot.sb
@@ -867,19 +866,20 @@ u-boot.sb: u-boot.bin spl/u-boot-spl.bin
 # SPL image (with mkimage header) and not the binary. Otherwise the resulting 
image
 # which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
 # The resulting image containing both U-Boot images is called u-boot.spr
-u-boot.spr:u-boot.img spl/u-boot-spl.bin
-   tools/mkimage -A $(ARCH) -T firmware -C none \
-   -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n 
XLOADER \
-   -d spl/u-boot-spl.bin $@
-   $(OBJCOPY) -I binary -O binary \
-   --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
-   cat u-boot.img  $@
+MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \
+   -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER
+spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE
+   $(call if_changed,mkimage)
+
+OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
+ --gap-fill=0xff
+u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE
+   $(call if_changed,pad_cat)
 
 ifneq ($(CONFIG_TEGRA),)
-u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
-   $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(CONFIG_SYS_TEXT_BASE) -O 
binary spl/u-boot-spl spl/u-boot-spl-pad.bin
-   cat spl/u-boot-spl-pad.bin u-boot.bin  $@
-   rm spl/u-boot-spl-pad.bin
+OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary 
--pad-to=$(CONFIG_SYS_TEXT_BASE)
+u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE
+   $(call if_changed,pad_cat)
 
 ifeq 

[U-Boot] [PATCH v2 14/15] kbuild: support building signle targets

2014-02-23 Thread Masahiro Yamada
Import build rules of single targets from Linux 3.13.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile | 52 
 1 file changed, 52 insertions(+)

diff --git a/Makefile b/Makefile
index 1311592..75a1747 100644
--- a/Makefile
+++ b/Makefile
@@ -1267,6 +1267,58 @@ scripts: ;
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
 
+# Single targets
+# ---
+# Single targets are compatible with:
+# - build with mixed source and output
+# - build with separate output dir 'make O=...'
+# - external modules
+#
+#  target-dir = where to store outputfile
+#  build-dir  = directory in kernel source tree to use
+
+ifeq ($(KBUILD_EXTMOD),)
+build-dir  = $(patsubst %/,%,$(dir $@))
+target-dir = $(dir $@)
+else
+zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
+build-dir  = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
+target-dir = $(if $(KBUILD_EXTMOD),$(dir $),$(dir $@))
+endif
+
+%.s: %.c prepare scripts FORCE
+   $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.i: %.c prepare scripts FORCE
+   $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.o: %.c prepare scripts FORCE
+   $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.lst: %.c prepare scripts FORCE
+   $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.s: %.S prepare scripts FORCE
+   $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.o: %.S prepare scripts FORCE
+   $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.symtypes: %.c prepare scripts FORCE
+   $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+
+# Modules
+/: prepare scripts FORCE
+   $(cmd_crmodverdir)
+   $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
+   $(build)=$(build-dir)
+%/: prepare scripts FORCE
+   $(cmd_crmodverdir)
+   $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
+   $(build)=$(build-dir)
+%.ko: prepare scripts FORCE
+   $(cmd_crmodverdir)
+   $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
+   $(build)=$(build-dir) $(@:.ko=.o)
+   $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+
+# FIXME Should go into a make.lib or something 
+# ===
+
 quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
   cmd_rmdirs = rm -rf $(rm-dirs)
 
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 12/15] kbuild: use shorten logs for IMX images

2014-02-23 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile |  4 +-
 arch/arm/cpu/arm1136/config.mk   |  2 +-
 arch/arm/cpu/arm926ejs/config.mk |  2 +-
 arch/arm/cpu/armv7/config.mk |  2 +-
 arch/arm/imx-common/Makefile | 85 
 spl/Makefile |  4 +-
 6 files changed, 58 insertions(+), 41 deletions(-)

diff --git a/Makefile b/Makefile
index 0f321d2..dc04870 100644
--- a/Makefile
+++ b/Makefile
@@ -815,7 +815,7 @@ u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
$(call if_changed,mkimage)
 
 u-boot.imx: u-boot.bin
-   $(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
+   $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
 
 u-boot.sha1:   u-boot.bin
tools/ubsha1 u-boot.bin
@@ -840,7 +840,7 @@ tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE
$(call if_changed,pad_cat)
 
 u-boot-with-spl.imx u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
-   $(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
+   $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
 
 MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e 
$(CONFIG_SYS_TEXT_BASE)
 
diff --git a/arch/arm/cpu/arm1136/config.mk b/arch/arm/cpu/arm1136/config.mk
index ab1fc4a..91b0ef3 100644
--- a/arch/arm/cpu/arm1136/config.mk
+++ b/arch/arm/cpu/arm1136/config.mk
@@ -11,7 +11,7 @@ PLATFORM_CPPFLAGS += -march=armv5
 ifneq ($(CONFIG_IMX_CONFIG),)
 ifdef CONFIG_SPL
 ifdef CONFIG_SPL_BUILD
-ALL-y  += $(OBJTREE)/SPL
+ALL-y  += SPL
 endif
 else
 ALL-y  += u-boot.imx
diff --git a/arch/arm/cpu/arm926ejs/config.mk b/arch/arm/cpu/arm926ejs/config.mk
index f27ca15..918cdec 100644
--- a/arch/arm/cpu/arm926ejs/config.mk
+++ b/arch/arm/cpu/arm926ejs/config.mk
@@ -10,7 +10,7 @@ PLATFORM_CPPFLAGS += -march=armv5te
 ifneq ($(CONFIG_IMX_CONFIG),)
 ifdef CONFIG_SPL
 ifdef CONFIG_SPL_BUILD
-ALL-y  += $(OBJTREE)/SPL
+ALL-y  += SPL
 endif
 else
 ALL-y  += u-boot.imx
diff --git a/arch/arm/cpu/armv7/config.mk b/arch/arm/cpu/armv7/config.mk
index d01f3d9..852f83c 100644
--- a/arch/arm/cpu/armv7/config.mk
+++ b/arch/arm/cpu/armv7/config.mk
@@ -17,7 +17,7 @@ PLATFORM_NO_UNALIGNED := $(PF_NO_UNALIGNED)
 ifneq ($(CONFIG_IMX_CONFIG),)
 ifdef CONFIG_SPL
 ifdef CONFIG_SPL_BUILD
-ALL-y  += $(OBJTREE)/SPL
+ALL-y  += SPL
 endif
 else
 ALL-y  += u-boot.imx
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 88d6c0b..16809fe 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -23,37 +23,54 @@ endif
 obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
 obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
 
-$(OBJTREE)/$(patsubst %,%,$(CONFIG_IMX_CONFIG)).cfgtmp: $(OBJTREE)/%.cfgtmp 
: $(SRCTREE)/%
-   mkdir -p $(dir $@)
-   $(CPP) $(cpp_flags) -x c -o $@ $
-
-$(OBJTREE)/u-boot.imx: $(OBJTREE)/u-boot.bin $(OBJTREE)/$(patsubst 
%,%,$(CONFIG_IMX_CONFIG)).cfgtmp
-   $(OBJTREE)/tools/mkimage -n $(filter-out %.bin,$^) -T imximage \
-   -e $(CONFIG_SYS_TEXT_BASE) -d $ $@
-
-$(OBJTREE)/SPL: $(OBJTREE)/spl/u-boot-spl.bin $(OBJTREE)/$(patsubst 
%,%,$(CONFIG_IMX_CONFIG)).cfgtmp
-   $(OBJTREE)/tools/mkimage -n $(filter-out %.bin,$^) -T imximage \
-   -e $(CONFIG_SPL_TEXT_BASE) -d $ $@
-
-$(OBJTREE)/u-boot-with-spl.imx: $(OBJTREE)/SPL $(OBJTREE)/u-boot.bin
-   $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(CONFIG_SPL_PAD_TO) \
-   -I binary -O binary $ $(OBJTREE)/spl/u-boot-spl-pad.imx
-   $(OBJTREE)/tools/mkimage -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \
-   -e $(CONFIG_SYS_TEXT_BASE) -C none -d $(OBJTREE)/u-boot.bin \
-   $(OBJTREE)/u-boot.uim
-   cat $(OBJTREE)/spl/u-boot-spl-pad.imx $(OBJTREE)/u-boot.uim  $@
-   rm $(OBJTREE)/spl/u-boot-spl-pad.imx $(OBJTREE)/u-boot.uim
-
-$(OBJTREE)/u-boot-with-nand-spl.imx: $(OBJTREE)/SPL $(OBJTREE)/u-boot.bin
-   (echo -ne '\x00\x00\x00\x00\x46\x43\x42\x20\x01'  \
-   dd bs=1015 count=1 if=/dev/zero 2/dev/null) | \
-   cat - $  $(OBJTREE)/spl/u-boot-nand-spl.imx
-   $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(CONFIG_SPL_PAD_TO) \
-   -I binary -O binary $(OBJTREE)/spl/u-boot-nand-spl.imx \
-   $(OBJTREE)/spl/u-boot-nand-spl-pad.imx
-   rm $(OBJTREE)/spl/u-boot-nand-spl.imx
-   $(OBJTREE)/tools/mkimage -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \
-   -e $(CONFIG_SYS_TEXT_BASE) -C none -d $(OBJTREE)/u-boot.bin \
-   $(OBJTREE)/u-boot.uim
-   cat $(OBJTREE)/spl/u-boot-nand-spl-pad.imx $(OBJTREE)/u-boot.uim  $@
-   rm $(OBJTREE)/spl/u-boot-nand-spl-pad.imx $(OBJTREE)/u-boot.uim
+quiet_cmd_cpp_cfg = CFGS$@
+  cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $
+
+IMX_CONFIG = $(CONFIG_IMX_CONFIG:%=%).cfgtmp
+
+$(IMX_CONFIG): %.cfgtmp: % FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cpp_cfg)
+
+quiet_cmd_mkimage = UIMAGE  $@
+cmd_mkimage = $(objtree)/tools/mkimage 

[U-Boot] [PATCH v2 04/15] kbuild: rename OBJCFLAGS to OBJCOPYFLAGS

2014-02-23 Thread Masahiro Yamada
Rename OBJCFLAGS to OBJCOPYFLAGS beforehand to use
cmd_objcopy in scripts/Makefile.lib in an upcoming commit.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile  | 16 
 arch/arm/config.mk|  4 ++--
 arch/arm/cpu/pxa/config.mk|  2 +-
 arch/arm/imx-common/Makefile  |  4 ++--
 arch/mips/config.mk   |  2 +-
 board/hymod/config.mk |  2 +-
 config.mk |  2 +-
 nand_spl/board/amcc/acadia/Makefile   |  4 ++--
 nand_spl/board/amcc/bamboo/Makefile   |  4 ++--
 nand_spl/board/amcc/canyonlands/Makefile  |  4 ++--
 nand_spl/board/amcc/kilauea/Makefile  |  4 ++--
 nand_spl/board/amcc/sequoia/Makefile  |  4 ++--
 nand_spl/board/freescale/mpc8315erdb/Makefile |  4 ++--
 nand_spl/board/freescale/mpc8536ds/Makefile   |  4 ++--
 nand_spl/board/freescale/mpc8569mds/Makefile  |  4 ++--
 nand_spl/board/freescale/mpc8572ds/Makefile   |  4 ++--
 nand_spl/board/freescale/p1023rds/Makefile|  4 ++--
 nand_spl/board/freescale/p1_p2_rdb/Makefile   |  4 ++--
 nand_spl/board/sheldon/simpc8313/Makefile |  4 ++--
 spl/Makefile  |  2 +-
 20 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/Makefile b/Makefile
index 14dff8f..ad91168 100644
--- a/Makefile
+++ b/Makefile
@@ -753,13 +753,13 @@ u-boot-dtb.bin: u-boot.bin dts/dt.dtb
cat $^ $@
 
 u-boot.hex:u-boot
-   $(OBJCOPY) ${OBJCFLAGS} -O ihex $ $@
+   $(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $ $@
 
 u-boot.srec:   u-boot
-   $(OBJCOPY) ${OBJCFLAGS} -O srec $ $@
+   $(OBJCOPY) $(OBJCOPYFLAGS) -O srec $ $@
 
 u-boot.bin:u-boot
-   $(OBJCOPY) ${OBJCFLAGS} -O binary $ $@
+   $(OBJCOPY) $(OBJCOPYFLAGS) -O binary $ $@
$(call DO_STATIC_RELA,$,$@,$(CONFIG_SYS_TEXT_BASE))
$(BOARD_SIZE_CHECK)
 
@@ -769,10 +769,10 @@ u-boot.ldr:   u-boot
$(BOARD_SIZE_CHECK)
 
 u-boot.ldr.hex:u-boot.ldr
-   $(OBJCOPY) ${OBJCFLAGS} -O ihex $ $@ -I binary
+   $(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $ $@ -I binary
 
 u-boot.ldr.srec:   u-boot.ldr
-   $(OBJCOPY) ${OBJCFLAGS} -O srec $ $@ -I binary
+   $(OBJCOPY) $(OBJCOPYFLAGS) -O srec $ $@ -I binary
 
 #
 # U-Boot entry point, needed for booting of full-blown U-Boot
@@ -810,7 +810,7 @@ u-boot.dis: u-boot
 # $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
 # $(4) is pad-to
 SPL_PAD_APPEND = \
-   $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
+   $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(4) -I binary -O binary \
$(1) $(3); \
cat $(3) $(2)  $@; \
rm $(3)
@@ -845,7 +845,7 @@ u-boot.ais:   spl/u-boot-spl.bin u-boot.img
-e $(CONFIG_SPL_TEXT_BASE) \
-d spl/u-boot-spl.bin \
spl/u-boot-spl.ais
-   $(OBJCOPY) ${OBJCFLAGS} -I binary \
+   $(OBJCOPY) $(OBJCOPYFLAGS) -I binary \
--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
spl/u-boot-spl.ais spl/u-boot-spl-pad.ais
cat spl/u-boot-spl-pad.ais u-boot.img  u-boot.ais
@@ -870,7 +870,7 @@ u-boot.spr: u-boot.img spl/u-boot-spl.bin
 
 ifneq ($(CONFIG_TEGRA),)
 u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
-   $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O 
binary spl/u-boot-spl spl/u-boot-spl-pad.bin
+   $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(CONFIG_SYS_TEXT_BASE) -O 
binary spl/u-boot-spl spl/u-boot-spl-pad.bin
cat spl/u-boot-spl-pad.bin u-boot.bin  $@
rm spl/u-boot-spl-pad.bin
 
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 98c1253..8a65c34 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -108,7 +108,7 @@ endif
 
 # limit ourselves to the sections we want in the .bin.
 ifdef CONFIG_ARM64
-OBJCFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
+OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
 else
-OBJCFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list 
-j .rel.dyn
+OBJCOPYFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j 
.u_boot_list -j .rel.dyn
 endif
diff --git a/arch/arm/cpu/pxa/config.mk b/arch/arm/cpu/pxa/config.mk
index 986b11b..525f5d3 100644
--- a/arch/arm/cpu/pxa/config.mk
+++ b/arch/arm/cpu/pxa/config.mk
@@ -18,5 +18,5 @@ PLATFORM_CPPFLAGS += -mcpu=xscale
 #
 
 #ifdef CONFIG_SPL_BUILD
-OBJCFLAGS += -j .text.0 -j .text.1
+OBJCOPYFLAGS += -j .text.0 -j .text.1
 #endif
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 9dda59d..88d6c0b 100644
--- 

[U-Boot] [PATCH v2 07/15] kbuild: use shorten logs for mkimage rules

2014-02-23 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile| 38 +++--
 arch/arm/cpu/armv7/am33xx/config.mk |  4 ++--
 arch/arm/cpu/armv7/omap3/config.mk  |  2 +-
 arch/arm/cpu/armv7/omap4/config.mk  |  2 +-
 arch/arm/cpu/armv7/omap5/config.mk  |  2 +-
 spl/Makefile| 15 +--
 6 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/Makefile b/Makefile
index 7a179cd..f3bdcf0 100644
--- a/Makefile
+++ b/Makefile
@@ -746,6 +746,10 @@ endif
 quiet_cmd_objcopy = OBJCOPY $@
 cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $ $@
 
+quiet_cmd_mkimage = UIMAGE  $@
+cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $ $@ \
+   $(if $(KBUILD_VERBOSE:1=), /dev/null)
+
 all:   $(ALL-y)
 
 PHONY += dtbs
@@ -789,24 +793,21 @@ ifndef CONFIG_SYS_UBOOT_START
 CONFIG_SYS_UBOOT_START := 0
 endif
 
-u-boot.img:u-boot.bin
-   tools/mkimage -A $(ARCH) -T firmware -C none \
-   -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
-   -e $(CONFIG_SYS_UBOOT_START) \
-   -n U-Boot $(UBOOTRELEASE) for $(BOARD) board \
-   -d $ $@
+MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
+   -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
+   -n U-Boot $(UBOOTRELEASE) for $(BOARD) board
 
-u-boot.imx: u-boot.bin
-   $(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
+MKIMAGEFLAGS_u-boot.kwb = -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
+   -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
 
-u-boot.kwb:   u-boot.bin
-   tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
-   -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $ $@
+MKIMAGEFLAGS_u-boot.pbl = -n $(CONFIG_SYS_FSL_PBL_RCW) \
+   -R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage
 
-u-boot.pbl:u-boot.bin
-   tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \
-   -R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \
-   -d $ $@
+u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
+   $(call if_changed,mkimage)
+
+u-boot.imx: u-boot.bin
+   $(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
 
 u-boot.sha1:   u-boot.bin
tools/ubsha1 u-boot.bin
@@ -837,9 +838,10 @@ tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin
 u-boot-with-spl.imx u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
$(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
 
-u-boot.ubl:   u-boot-with-spl.bin
-   tools/mkimage -n $(UBL_CONFIG) -T ublimage \
-   -e $(CONFIG_SYS_TEXT_BASE) -d $ u-boot.ubl
+MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e 
$(CONFIG_SYS_TEXT_BASE)
+
+u-boot.ubl: u-boot-with-spl.bin FORCE
+   $(call if_changed,mkimage)
 
 u-boot.ais:   spl/u-boot-spl.bin u-boot.img
tools/mkimage -s -n $(if 
$(CONFIG_AIS_CONFIG_FILE),$(srctree)/$(CONFIG_AIS_CONFIG_FILE:%=%),/dev/null)
 \
diff --git a/arch/arm/cpu/armv7/am33xx/config.mk 
b/arch/arm/cpu/armv7/am33xx/config.mk
index 1c06fb4..5294d16 100644
--- a/arch/arm/cpu/armv7/am33xx/config.mk
+++ b/arch/arm/cpu/armv7/am33xx/config.mk
@@ -4,8 +4,8 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 ifdef CONFIG_SPL_BUILD
-ALL-y  += $(OBJTREE)/MLO
-ALL-$(CONFIG_SPL_SPI_SUPPORT) += $(OBJTREE)/MLO.byteswap
+ALL-y  += MLO
+ALL-$(CONFIG_SPL_SPI_SUPPORT) += MLO.byteswap
 else
 ALL-y  += u-boot.img
 endif
diff --git a/arch/arm/cpu/armv7/omap3/config.mk 
b/arch/arm/cpu/armv7/omap3/config.mk
index 2a3d1c5..ad44d63 100644
--- a/arch/arm/cpu/armv7/omap3/config.mk
+++ b/arch/arm/cpu/armv7/omap3/config.mk
@@ -9,7 +9,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 ifdef CONFIG_SPL_BUILD
-ALL-y  += $(OBJTREE)/MLO
+ALL-y  += MLO
 else
 ALL-y  += u-boot.img
 endif
diff --git a/arch/arm/cpu/armv7/omap4/config.mk 
b/arch/arm/cpu/armv7/omap4/config.mk
index 2a3d1c5..ad44d63 100644
--- a/arch/arm/cpu/armv7/omap4/config.mk
+++ b/arch/arm/cpu/armv7/omap4/config.mk
@@ -9,7 +9,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 ifdef CONFIG_SPL_BUILD
-ALL-y  += $(OBJTREE)/MLO
+ALL-y  += MLO
 else
 ALL-y  += u-boot.img
 endif
diff --git a/arch/arm/cpu/armv7/omap5/config.mk 
b/arch/arm/cpu/armv7/omap5/config.mk
index 261b272..ef2725a 100644
--- a/arch/arm/cpu/armv7/omap5/config.mk
+++ b/arch/arm/cpu/armv7/omap5/config.mk
@@ -7,7 +7,7 @@
 #
 
 ifdef CONFIG_SPL_BUILD
-ALL-y  += $(OBJTREE)/MLO
+ALL-y  += MLO
 else
 ALL-y  += u-boot.img
 endif
diff --git a/spl/Makefile b/spl/Makefile
index bcb70df..c098a8e 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -168,13 +168,16 @@ LDPPFLAGS += \
$(shell $(LD) --version | \
  sed -ne 's/GNU ld version 
\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
 
-$(OBJTREE)/MLO:$(obj)/u-boot-spl.bin
-   $(OBJTREE)/tools/mkimage -T omapimage \
-   -a 

[U-Boot] [PATCH v2 05/15] kbuild: Add $(Q) when descending into subdirectories

2014-02-23 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
Acked-by: Simon Glass s...@chromium.org
---

Changes in v2: None

 Makefile | 21 -
 spl/Makefile |  4 ++--
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index ad91168..05292ad 100644
--- a/Makefile
+++ b/Makefile
@@ -790,7 +790,7 @@ u-boot.img: u-boot.bin
-d $ $@
 
 u-boot.imx: u-boot.bin
-   $(MAKE) $(build)=arch/arm/imx-common $(objtree)/u-boot.imx
+   $(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
 
 u-boot.kwb:   u-boot.bin
tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
@@ -827,13 +827,8 @@ u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD)
 tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin
$(call 
SPL_PAD_APPEND,$,u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
 
-u-boot-with-spl.imx: spl/u-boot-spl.bin u-boot.bin
-   $(MAKE) $(build)=arch/arm/imx-common \
-   $(OBJTREE)/u-boot-with-spl.imx
-
-u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
-   $(MAKE) $(build)=arch/arm/imx-common \
-   $(OBJTREE)/u-boot-with-nand-spl.imx
+u-boot-with-spl.imx u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
+   $(Q)$(MAKE) $(build)=arch/arm/imx-common $(objtree)/$@
 
 u-boot.ubl:   u-boot-with-spl.bin
tools/mkimage -n $(UBL_CONFIG) -T ublimage \
@@ -851,8 +846,8 @@ u-boot.ais:   spl/u-boot-spl.bin u-boot.img
cat spl/u-boot-spl-pad.ais u-boot.img  u-boot.ais
 
 
-u-boot.sb:   u-boot.bin spl/u-boot-spl.bin
-   $(MAKE) $(build)=$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
+u-boot.sb: u-boot.bin spl/u-boot-spl.bin
+   $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs $(objtree)/u-boot.sb
 
 # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
 # Both images are created using mkimage (crc etc), so that the ROM
@@ -1050,16 +1045,16 @@ u-boot.lds: $(LDSCRIPT) prepare
$(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - $ 
$@
 
 nand_spl: prepare
-   $(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
+   $(Q)$(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
 
 u-boot-nand.bin:   nand_spl u-boot.bin
cat nand_spl/u-boot-spl-16k.bin u-boot.bin  u-boot-nand.bin
 
 spl/u-boot-spl.bin: tools prepare
-   $(MAKE) obj=spl -f $(srctree)/spl/Makefile all
+   $(Q)$(MAKE) obj=spl -f $(srctree)/spl/Makefile all
 
 tpl/u-boot-tpl.bin: tools prepare
-   $(MAKE) obj=tpl -f $(srctree)/spl/Makefile all 
CONFIG_TPL_BUILD=y
+   $(Q)$(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y
 
 TAG_SUBDIRS := $(u-boot-dirs) include
 
diff --git a/spl/Makefile b/spl/Makefile
index 2a544af..02312ce 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -176,8 +176,8 @@ $(OBJTREE)/MLO.byteswap: $(obj)/u-boot-spl.bin
$(OBJTREE)/tools/mkimage -T omapimage -n byteswap \
-a $(CONFIG_SPL_TEXT_BASE) -d $ $@
 
-$(objtree)/SPL : $(obj)/u-boot-spl.bin
-   $(MAKE) $(build)=spl/arch/arm/imx-common $@
+$(objtree)/SPL: $(obj)/u-boot-spl.bin
+   $(Q)$(MAKE) $(build)=spl/arch/arm/imx-common $@
 
 ALL-y  += $(obj)/$(SPL_BIN).bin
 
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 01/15] kbuild: consolidate version and timestamp headers generation

2014-02-23 Thread Masahiro Yamada
 - Generate include/generated/{timestamp.h, version.h}
   more simply by using filechk rule.

 - Add $(UBOOTRELEASE) variable and re-write u-boot.imx rule
   more simply.

 - Rename U_BOOT_VERSION in Makefile to UBOOTVERSION

   Before this commit, the same variable name, U_BOOT_VERSION
   was used for two different strings.

   One of them was defined in Makefile.
   It takes the form like 2014.01-rc1 and used in
   makefiles and script files.

   The other is defined in include/generated/version.h
   It takes the form like U-Boot 2014.01-rc1-00010-gbe6d426-dirty
   and used in C and Aseembler.

   It is confusing when grepping the source tree. So, this commit
   renames the former to UBOOTVERSION.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile | 83 +---
 doc/DocBook/Makefile |  2 +-
 scripts/kernel-doc   |  4 +--
 3 files changed, 49 insertions(+), 40 deletions(-)

diff --git a/Makefile b/Makefile
index d187e6b..7f8d8b5 100644
--- a/Makefile
+++ b/Makefile
@@ -180,9 +180,6 @@ unexport CDPATH
 
 #
 
-TIMESTAMP_FILE = include/generated/timestamp_autogenerated.h
-VERSION_FILE = include/generated/version_autogenerated.h
-
 HOSTARCH := $(shell uname -m | \
sed -e s/i.86/x86/ \
-e s/sun4u/sparc64/ \
@@ -356,9 +353,11 @@ KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
   -fno-builtin -ffreestanding
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 
-U_BOOT_VERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if 
$(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
+# Read UBOOTRELEASE from include/config/uboot.release (if it exists)
+UBOOTRELEASE = $(shell cat include/config/uboot.release 2 /dev/null)
+UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if 
$(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
 
-export VERSION PATCHLEVEL SUBLEVEL U_BOOT_VERSION
+export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
 export ARCH CPU BOARD VENDOR SOC
 export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
@@ -411,6 +410,9 @@ endif
 # Detect when mixed targets is specified, and make a second invocation
 # of make so .config is not included in this case either (for *config).
 
+version_h := include/generated/version_autogenerated.h
+timestamp_h := include/generated/timestamp_autogenerated.h
+
 no-dot-config-targets := clean clobber mrproper distclean \
 help %docs check% coccicheck \
 backup
@@ -582,8 +584,6 @@ CHECKFLAGS += $(NOSTDINC_FLAGS)
 cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
 c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
 
-.PHONY : $(VERSION_FILE) $(TIMESTAMP_FILE)
-
 #
 # U-Boot objectsorder is important (i.e. start must be first)
 
@@ -786,8 +786,7 @@ u-boot.img: u-boot.bin
tools/mkimage -A $(ARCH) -T firmware -C none \
-O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
-e $(CONFIG_SYS_UBOOT_START) \
-   -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
-   sed -e 's/[ ]*$$/ for $(BOARD) board/') \
+   -n U-Boot $(UBOOTRELEASE) for $(BOARD) board \
-d $ $@
 
 u-boot.imx: u-boot.bin
@@ -943,13 +942,22 @@ PHONY += $(u-boot-dirs)
 $(u-boot-dirs): depend prepare scripts
$(Q)$(MAKE) $(build)=$@
 
-tools: $(TIMESTAMP_FILE) $(VERSION_FILE)
+tools: prepare
 # The tools are needed early
 $(filter-out tools, $(u-boot-dirs)): tools
 # The examples conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
 # is yes), so compile examples after U-Boot is compiled.
 examples: $(filter-out examples, $(u-boot-dirs))
 
+define filechk_uboot.release
+   echo $(UBOOTVERSION)$$($(CONFIG_SHELL) 
$(srctree)/scripts/setlocalversion $(srctree))
+endef
+
+# Store (new) UBOOTRELEASE string in include/config/uboot.release
+include/config/uboot.release: Makefile FORCE
+   $(call filechk,uboot.release)
+
+
 # Things we need to do before we recursively start building the kernel
 # or the modules are listed in prepare.
 # A multi level approach is used. prepareN is processed before prepareN-1.
@@ -962,7 +970,7 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 
prepare3
 # prepare3 is used to check if we are building in a separate output directory,
 # and if so do:
 # 1) Check that make has not been executed in the kernel src $(srctree)
-prepare3:
+prepare3: include/config/uboot.release
 ifneq ($(KBUILD_SRC),)
@$(kecho) '  Using $(srctree) as source for u-boot'
$(Q)if [ -f $(srctree)/include/config.mk ]; then \
@@ -975,7 +983,7 @@ endif
 # prepare2 creates a makefile if using a separate output directory
 prepare2: prepare3 outputmakefile
 
-prepare1: prepare2
+prepare1: 

[U-Boot] [PATCH v2 03/15] kbuild: move asm-offsets.h rules to ./Kbuild

2014-02-23 Thread Masahiro Yamada
Generate include/generated/generic-asm-offsets.h and
include/generated/asm-offsets.h in ./Kbuild.

This commit also changes the include guard.

Before this commit, __ASM_OFFSETS_H__ was used for both of them.
So we could not include generic-asm-offsets.h and asm-offsets.h
at the same time.

This commit renames the include guard of the former to
__GENERIC_ASM_OFFSETS_H__.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Kbuild | 87 ++
 Makefile   | 36 +
 tools/scripts/make-asm-offsets | 27 -
 3 files changed, 89 insertions(+), 61 deletions(-)
 create mode 100644 Kbuild
 delete mode 100755 tools/scripts/make-asm-offsets

diff --git a/Kbuild b/Kbuild
new file mode 100644
index 000..1d89761
--- /dev/null
+++ b/Kbuild
@@ -0,0 +1,87 @@
+#
+# Kbuild for top-level directory of U-Boot
+# This file takes care of the following:
+# 1) Generate generic-asm-offsets.h
+# 2) Generate asm-offsets.h
+
+#
+# 1) Generate generic-asm-offsets.h
+
+generic-offsets-file := include/generated/generic-asm-offsets.h
+
+always  := $(generic-offsets-file)
+targets := $(generic-offsets-file) lib/asm-offsets.s
+
+quiet_cmd_generic-offsets = GEN $@
+define cmd_generic-offsets
+   (set -e; \
+echo #ifndef __GENERIC_ASM_OFFSETS_H__; \
+echo #define __GENERIC_ASM_OFFSETS_H__; \
+echo /*; \
+echo  * DO NOT MODIFY.; \
+echo  *; \
+echo  * This file was generated by Kbuild; \
+echo  *; \
+echo  */; \
+echo ; \
+sed -ne $(sed-y) $; \
+echo ; \
+echo #endif )  $@
+endef
+
+# We use internal kbuild rules to avoid the is up to date message from make
+lib/asm-offsets.s: lib/asm-offsets.c FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cc_s_c)
+
+$(obj)/$(generic-offsets-file): lib/asm-offsets.s Kbuild
+   $(Q)mkdir -p $(dir $@)
+   $(call cmd,generic-offsets)
+
+#
+# 2) Generate asm-offsets.h
+#
+
+ifneq ($(wildcard $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c),)
+offsets-file := include/generated/asm-offsets.h
+endif
+
+always  += $(offsets-file)
+targets += $(offsets-file)
+targets += $(CPUDIR)/$(SOC)/asm-offsets.s
+
+
+# Default sed regexp - multiline due to syntax constraints
+define sed-y
+   /^-/{s:-#\(.*\):/* \1 */:; \
+   s:^-\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
+   s:^-\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+   s:-::; p;}
+endef
+
+CFLAGS_asm-offsets.o := -DDO_DEPS_ONLY
+
+quiet_cmd_offsets = GEN $@
+define cmd_offsets
+   (set -e; \
+echo #ifndef __ASM_OFFSETS_H__; \
+echo #define __ASM_OFFSETS_H__; \
+echo /*; \
+echo  * DO NOT MODIFY.; \
+echo  *; \
+echo  * This file was generated by Kbuild; \
+echo  *; \
+echo  */; \
+echo ; \
+sed -ne $(sed-y) $; \
+echo ; \
+echo #endif )  $@
+endef
+
+# We use internal kbuild rules to avoid the is up to date message from make
+$(CPUDIR)/$(SOC)/asm-offsets.s: $(CPUDIR)/$(SOC)/asm-offsets.c FORCE
+   $(Q)mkdir -p $(dir $@)
+   $(call if_changed_dep,cc_s_c)
+
+$(obj)/$(offsets-file): $(CPUDIR)/$(SOC)/asm-offsets.s
+   $(call cmd,offsets)
diff --git a/Makefile b/Makefile
index aef936d..14dff8f 100644
--- a/Makefile
+++ b/Makefile
@@ -988,9 +988,8 @@ prepare1: prepare2 $(version_h) $(timestamp_h)
 
 archprepare: prepare1 scripts_basic
 
-prepare0: archprepare FORCE include/generated/generic-asm-offsets.h \
-   include/generated/asm-offsets.h
-   @:
+prepare0: archprepare FORCE
+   $(Q)$(MAKE) $(build)=.
 
 # All the preparing..
 prepare: prepare0
@@ -1115,37 +1114,6 @@ checkdtc:
false; \
fi
 
-quiet_cmd_offsets = GEN $@
-  cmd_offsets = $(srctree)/tools/scripts/make-asm-offsets $ $@
-
-include/generated/generic-asm-offsets.h: lib/asm-offsets.s
-   $(call cmd,offsets)
-
-quiet_cmd_asm-offsets.s = CC  $@
-  cmd_asm-offsets.s = mkdir -p lib; \
-   $(CC) -DDO_DEPS_ONLY \
-   $(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
-   -o $@ $ -c -S
-
-lib/asm-offsets.s: $(srctree)/lib/asm-offsets.c include/config.h
-   $(call cmd,asm-offsets.s)
-
-include/generated/asm-offsets.h: $(CPUDIR)/$(SOC)/asm-offsets.s
-   $(call cmd,offsets)
-
-quiet_cmd_soc_asm-offsets.s = CC  $@
-  cmd_soc_asm-offsets.s = mkdir -p $(CPUDIR)/$(SOC); \
-   if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
-   $(CC) -DDO_DEPS_ONLY \
-   $(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
-   -o $@ $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
-   else \
-   touch $@; \
-   fi
-
-$(CPUDIR)/$(SOC)/asm-offsets.s:include/config.h
-   $(call cmd,soc_asm-offsets.s)
-
 

[U-Boot] [PATCH v2 0/15] Follow-up for Kbuild series: more misc targets and short logs

2014-02-23 Thread Masahiro Yamada

Kbuild series must be applied before this series.

This series refactors a little, imports more Kbuild features
and convert many rules to Kbuild style.

I think most of rules will be displayed in short log format
by applying this series.
(But I know there are still some old style rules.
I need more efforts...)


Changes in v2:
  - Rebase on commit 1674df60

Masahiro Yamada (15):
  kbuild: consolidate version and timestamp headers generation
  kbuild: abolish depend target
  kbuild: move asm-offsets.h rules to ./Kbuild
  kbuild: rename OBJCFLAGS to OBJCOPYFLAGS
  kbuild: Add $(Q) when descending into subdirectories
  kbuild: use shorten logs objcopy rules
  kbuild: use shorten logs for mkimage rules
  kbuild: use shorten logs for cat rules
  kbuild: use shorten logs for combined rules of mkimage, padding and
cat
  kbuild: use shorten log for linking u-boot
  kbuild: use shorten logs for misc targets
  kbuild: use shorten logs for IMX images
  kbuild: refactor more IMX image rules
  kbuild: support building signle targets
  kbuild: add misc targets, help, ubootrelease, ubootversion

 Kbuild|  87 +
 Makefile  | 482 --
 arch/arm/config.mk|  14 +-
 arch/arm/cpu/arm1136/config.mk|  10 -
 arch/arm/cpu/arm926ejs/config.mk  |  10 -
 arch/arm/cpu/armv7/am33xx/config.mk   |   4 +-
 arch/arm/cpu/armv7/config.mk  |  10 -
 arch/arm/cpu/armv7/omap3/config.mk|   2 +-
 arch/arm/cpu/armv7/omap4/config.mk|   2 +-
 arch/arm/cpu/armv7/omap5/config.mk|   2 +-
 arch/arm/cpu/pxa/config.mk|   2 +-
 arch/arm/imx-common/Makefile  |  85 +++--
 arch/blackfin/cpu/Makefile|   6 +-
 arch/mips/config.mk   |   2 +-
 arch/sandbox/config.mk|   4 +
 board/hymod/config.mk |   2 +-
 config.mk |   2 +-
 doc/DocBook/Makefile  |   2 +-
 examples/api/Makefile |  46 +--
 examples/standalone/Makefile  |  35 +-
 nand_spl/board/amcc/acadia/Makefile   |   4 +-
 nand_spl/board/amcc/bamboo/Makefile   |   4 +-
 nand_spl/board/amcc/canyonlands/Makefile  |   4 +-
 nand_spl/board/amcc/kilauea/Makefile  |   4 +-
 nand_spl/board/amcc/sequoia/Makefile  |   4 +-
 nand_spl/board/freescale/mpc8315erdb/Makefile |   4 +-
 nand_spl/board/freescale/mpc8536ds/Makefile   |   4 +-
 nand_spl/board/freescale/mpc8569mds/Makefile  |   4 +-
 nand_spl/board/freescale/mpc8572ds/Makefile   |   4 +-
 nand_spl/board/freescale/p1023rds/Makefile|   4 +-
 nand_spl/board/freescale/p1_p2_rdb/Makefile   |   4 +-
 nand_spl/board/sheldon/simpc8313/Makefile |   4 +-
 scripts/kernel-doc|   4 +-
 spl/Makefile  |  41 ++-
 tools/scripts/make-asm-offsets|  27 --
 35 files changed, 562 insertions(+), 367 deletions(-)
 create mode 100644 Kbuild
 delete mode 100755 tools/scripts/make-asm-offsets

-- 
1.8.3.2

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


[U-Boot] [PATCH v2 11/15] kbuild: use shorten logs for misc targets

2014-02-23 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile |  7 +--
 arch/blackfin/cpu/Makefile   |  6 +-
 examples/api/Makefile| 40 +---
 examples/standalone/Makefile | 25 +++--
 spl/Makefile |  6 +-
 5 files changed, 47 insertions(+), 37 deletions(-)

diff --git a/Makefile b/Makefile
index adb40e4..0f321d2 100644
--- a/Makefile
+++ b/Makefile
@@ -1048,9 +1048,12 @@ depend dep:
@echo '*** Warning: make $@ is unnecessary now.'
 
 # ---
+quiet_cmd_cpp_lds = LDS $@
+cmd_cpp_lds = $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ \
+   -x assembler-with-cpp -P -o $@ $
 
-u-boot.lds: $(LDSCRIPT) prepare
-   $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - $ 
$@
+u-boot.lds: $(LDSCRIPT) prepare FORCE
+   $(call if_changed,cpp_lds)
 
 PHONY += nand_spl
 nand_spl: prepare
diff --git a/arch/blackfin/cpu/Makefile b/arch/blackfin/cpu/Makefile
index 426292f..cfbcd31 100644
--- a/arch/blackfin/cpu/Makefile
+++ b/arch/blackfin/cpu/Makefile
@@ -37,5 +37,9 @@ ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
 endif
 
 CPPFLAGS_init.lds := -ansi
+
+quiet_cmd_link_init = LD  $@
+  cmd_link_init = $(LD) $(LDFLAGS) -T $^ -o $@
 $(obj)/init.elf: $(obj)/init.lds $(obj)/init.o $(obj)/initcode.o
-   $(LD) $(LDFLAGS) -T $^ -o $@
+   $(call if_changed,link_init)
+targets += init.lds init.o
diff --git a/examples/api/Makefile b/examples/api/Makefile
index 6c19830..6cf23d1 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -15,30 +15,32 @@ endif
 extra-y = demo
 
 # Source files located in the examples/api directory
-SOBJ_FILES-y += crt0.o
-COBJ_FILES-y += demo.o
-COBJ_FILES-y += glue.o
-COBJ_FILES-y += libgenwrap.o
+OBJ-y += crt0.o
+OBJ-y += demo.o
+OBJ-y += glue.o
+OBJ-y += libgenwrap.o
 
 # Source files which exist outside the examples/api directory
-EXT_COBJ_FILES-y += lib/crc32.o
-EXT_COBJ_FILES-y += lib/ctype.o
-EXT_COBJ_FILES-y += lib/div64.o
-EXT_COBJ_FILES-y += lib/string.o
-EXT_COBJ_FILES-y += lib/time.o
-EXT_COBJ_FILES-y += lib/vsprintf.o
-EXT_SOBJ_FILES-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
+EXT_COBJ-y += lib/crc32.o
+EXT_COBJ-y += lib/ctype.o
+EXT_COBJ-y += lib/div64.o
+EXT_COBJ-y += lib/string.o
+EXT_COBJ-y += lib/time.o
+EXT_COBJ-y += lib/vsprintf.o
+EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
 
 # Create a list of object files to be compiled
-OBJS   += $(addprefix $(obj)/,$(SOBJ_FILES-y))
-OBJS   += $(addprefix $(obj)/,$(COBJ_FILES-y))
-OBJS   += $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y)))
-OBJS   += $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y)))
+OBJS := $(OBJ-y) $(notdir $(EXT_COBJ-y) $(EXT_SOBJ-y))
+targets += $(OBJS)
+OBJS := $(addprefix $(obj)/,$(OBJS))
 
 #
 
-$(obj)/demo:   $(OBJS)
-   $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $^ 
$(PLATFORM_LIBS)
+quiet_cmd_link_demo = LD  $@
+cmd_link_demo = $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $(filter-out 
$(PHONY), $^) $(PLATFORM_LIBS)
+
+$(obj)/demo: $(OBJS) FORCE
+   $(call if_changed,link_demo)
 
 # demo.bin is never genrated. Is this necessary?
 OBJCOPYFLAGS_demo.bin := -O binary
@@ -46,10 +48,10 @@ $(obj)/demo.bin: $(obj)/demo FORCE
$(call if_changed,objcopy)
 
 # Rule to build generic library C files
-$(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: 
$(SRCTREE)/lib/%.c FORCE
+$(addprefix $(obj)/,$(notdir $(EXT_COBJ-y))): $(obj)/%.o: lib/%.c FORCE
$(call cmd,force_checksrc)
$(call if_changed_rule,cc_o_c)
 
 # Rule to build architecture-specific library assembly files
-$(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y))): $(obj)/%.o: 
$(SRCTREE)/arch/$(ARCH)/lib/%.S
+$(addprefix $(obj)/,$(notdir $(EXT_SOBJ-y))): $(obj)/%.o: arch/powerpc/lib/%.S 
FORCE
$(call if_changed_dep,as_o_S)
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 5f61043..5b227cd 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -24,22 +24,18 @@ ELF := $(strip $(extra-y))
 extra-y += $(addsuffix .srec,$(extra-y)) $(addsuffix .bin,$(extra-y))
 clean-files  := $(extra-) $(addsuffix .srec,$(extra-)) $(addsuffix 
.bin,$(extra-))
 
-
 COBJS  := $(ELF:=.o)
 
 LIB= $(obj)/libstubs.o
 
-LIBAOBJS-$(CONFIG_PPC) += ppc_longjmp.o ppc_setjmp.o
-LIBAOBJS-$(CONFIG_8xx) += test_burst_lib.o
-LIBAOBJS := $(LIBAOBJS-y)
-
-LIBCOBJS = stubs.o
+LIBOBJS-$(CONFIG_PPC) += ppc_longjmp.o ppc_setjmp.o
+LIBOBJS-$(CONFIG_8xx) += test_burst_lib.o
+LIBOBJS-y += stubs.o
 
 .SECONDARY: $(call objectify,$(COBJS))
-targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBAOBJS) $(LIBCOBJS)
-
-LIBOBJS= $(addprefix $(obj)/,$(LIBAOBJS) $(LIBCOBJS))
+targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) 

[U-Boot] [PATCH v2 08/15] kbuild: use shorten logs for cat rules

2014-02-23 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index f3bdcf0..cce239f 100644
--- a/Makefile
+++ b/Makefile
@@ -750,14 +750,17 @@ quiet_cmd_mkimage = UIMAGE  $@
 cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $ $@ \
$(if $(KBUILD_VERBOSE:1=), /dev/null)
 
+quiet_cmd_cat = CAT $@
+cmd_cat = cat $(filter-out $(PHONY), $^)  $@
+
 all:   $(ALL-y)
 
 PHONY += dtbs
 dtbs dts/dt.dtb: checkdtc u-boot
$(Q)$(MAKE) $(build)=dts dtbs
 
-u-boot-dtb.bin: u-boot.bin dts/dt.dtb
-   cat $^ $@
+u-boot-dtb.bin: u-boot.bin dts/dt.dtb FORCE
+   $(call if_changed,cat)
 
 OBJCOPYFLAGS_u-boot.hex := -O ihex
 
@@ -879,13 +882,13 @@ u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
rm spl/u-boot-spl-pad.bin
 
 ifeq ($(CONFIG_OF_SEPARATE),y)
-u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb
-   cat $^  $@
+u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb FORCE
+   $(call if_changed,cat)
 endif
 endif
 
-u-boot-img.bin: spl/u-boot-spl.bin u-boot.img
-   cat spl/u-boot-spl.bin u-boot.img  $@
+u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE
+   $(call if_changed,cat)
 
 # PPC4xx needs the SPL at the end of the image, since the reset vector
 # is located at 0xfffc. So we can't use the u-boot-img.bin target
@@ -1053,11 +1056,15 @@ depend dep:
 u-boot.lds: $(LDSCRIPT) prepare
$(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - $ 
$@
 
+PHONY += nand_spl
 nand_spl: prepare
$(Q)$(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
 
-u-boot-nand.bin:   nand_spl u-boot.bin
-   cat nand_spl/u-boot-spl-16k.bin u-boot.bin  u-boot-nand.bin
+nand_spl/u-boot-spl-16k.bin: nand_spl
+   @:
+
+u-boot-nand.bin: nand_spl/u-boot-spl-16k.bin u-boot.bin FORCE
+   $(call if_changed,cat)
 
 spl/u-boot-spl.bin: tools prepare
$(Q)$(MAKE) obj=spl -f $(srctree)/spl/Makefile all
-- 
1.8.3.2

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


Re: [U-Boot] [PATCH 0/15] Follow-up for Kbuild series: more misc targets and short logs

2014-02-23 Thread Masahiro Yamada
Hello Tom,

On Fri, 21 Feb 2014 08:09:18 -0500
Tom Rini tr...@ti.com wrote:

 On Fri, Feb 07, 2014 at 10:29:25PM +0900, Masahiro Yamada wrote:
 
  Kbuild series must be applied before this series.
  
  This series refactors a little, imports more Kbuild features
  and convert many rules to Kbuild style.
  
  I think most of rules will be displayed in short log formats
  by applying this series.
  (But I know there are still some old style rules.
  I need more efforts...)
 
 Since I guess this doesn't quite apply right now, can we get a v2 easily
 and I'll pick it up?  Thanks.

Sure.

I have posted v2.
It has been rebased on the current u-boot/master (commit 1674df6).
There is no other update.

Best Regards
Masahiro Yamada

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


Re: [U-Boot] [PATCH] kbuild: get back DTB at the top directory

2014-02-23 Thread Masahiro Yamada
Hello Simon,


 Well some build systems may take the u-boot.dtb and package it up with
 U-Boot in a different way. Also they may look inside this file to find
 out things about the board they are targeting. For example, you might
 imagine a flash program which gets flash programming parameters from
 this file so it knows how to flash the board.
 
 I don't consider something in the dts/ directory to be a build product
 really. I suspect one day we might support multiple .dtb files in
 U-Boot and select between them based on a setting or a hardware
 feature, and in that case perhaps everything will be put in a FIT, but
 we are not there yet.
 
 But for now I see the .dtb file as a first-class build product just
 like the main U-Boot binary.

Then, I agreed to include this version to the main line.
Thanks for your answering.

I confirmed this patch can apply on
commit 1674df60 + Follow-up for Kbuild series v2.


Best Regards
Masahiro Yamada

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


Re: [U-Boot] [PATCH v2 03/15] kbuild: move asm-offsets.h rules to ./Kbuild

2014-02-23 Thread Wolfgang Denk
Dear Masahiro,

In message 1393207943-3725-4-git-send-email-yamad...@jp.panasonic.com you 
wrote:

 +define cmd_generic-offsets
 + (set -e; \
 +  echo #ifndef __GENERIC_ASM_OFFSETS_H__; \
 +  echo #define __GENERIC_ASM_OFFSETS_H__; \
 +  echo /*; \
 +  echo  * DO NOT MODIFY.; \
 +  echo  *; \
 +  echo  * This file was generated by Kbuild; \
 +  echo  *; \
 +  echo  */; \
 +  echo ; \
 +  sed -ne $(sed-y) $; \
 +  echo ; \
 +  echo #endif )  $@
 +endef

Can we use here documents in cases like this, so the number of
shell command executions could be greatly reduced?

Does something like this work?

define cmd_generic-offsets  \
cat _END_  $@\
#ifndef __GENERIC_ASM_OFFSETS_H__   \
#define __GENERIC_ASM_OFFSETS_H__   \
/*  \
 * DO NOT MODIFY\
 *  \
 * This file was generated by Kbuild\
 */ \
$$(sed -ne $(sed-y) $) \
#endif  \
_END_

?

[I'm not sure how to mark the continuation lines here...]

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
If all the Chinese simultaneously jumped into the Pacific  off  a  10
foot platform erected 10 feet off their coast, it would cause a tidal
wave that would destroy everything in this country west of Nebraska.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 05/12] board:samsung:common: remove unused max77686 init function

2014-02-23 Thread Piotr Wilczek
Dear Minkyu Kang,

 -Original Message-
 From: Minkyu Kang [mailto:mk7.k...@samsung.com]
 Sent: Saturday, February 22, 2014 8:38 AM
 To: Rajeshwari Birje; Piotr Wilczek; Rajeshwari S Shinde
 Cc: Jaehoon Chung; u-boot@lists.denx.de; Kyungmin Park
 Subject: Re: [U-Boot] [PATCH V2 05/12] board:samsung:common: remove
 unused max77686 init function
 
 Dear Rajeshwari and Piotr,
 
 On 14/02/14 20:40, Rajeshwari Birje wrote:
  Hi Piotr,
 
  On Fri, Feb 14, 2014 at 3:18 PM, Piotr Wilczek
 p.wilc...@samsung.com wrote:
  Hi Rajeshwari,
 
  -Original Message-
  From: Rajeshwari Birje [mailto:rajeshwari.bi...@gmail.com]
  Sent: Friday, February 14, 2014 6:32 AM
  To: Piotr Wilczek
  Cc: u-boot@lists.denx.de; Jaehoon Chung; Kyungmin Park; Rajeshwari
 S
  Shinde
  Subject: Re: [U-Boot] [PATCH V2 05/12] board:samsung:common: remove
  unused max77686 init function
 
  Hi Piotr,
 
  On Thu, Feb 13, 2014 at 7:40 PM, Piotr Wilczek
  p.wilc...@samsung.com
  wrote:
  This patch removes currently unused max77686_init function.
  Despite being not used, it's implementation is board specific.
 
  MAX77686 is required for 5250, but missed it somehow when adding
  5420 support and making a common config file for both. It is my
  mistake will correct the same You can refer:
  [U-Boot] [PATCH V5 0/6] SMDK5420: Add S2MPS11 pmic support to
  SMDK5420 by Leela Krishna Amudala It adds a generic way for PMIC
  support.
  http://lists.denx.de/pipermail/u-boot/2014-January/171113.html
 
  MAX77686 is also used at Trats2 so max77686_init must be either
  generic based on DT or moved to the board file.
 
  Generic in the sense you want all registers to be set and there
 values
  have to come from DT file?
  Which ever you feel OK is fine with me.
 
 
 So.. do you agree to apply this patch?
 or need another discussion?
 
I will move max77686_init to smdk5250 board file and prepare v3 of this
patch series.
Do you have any other comments to this series?

 Thanks,
 Minkyu Kang.

Best regards,
Piotr Wilczek



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


Re: [U-Boot] [U-Boot, 2/3] mpc85xx: Add deep sleep framework support

2014-02-23 Thread Tang Yuantian-B29983


On 2014/2/18 星期二 3:18, Scott Wood wrote:

On Sun, 2014-02-16 at 21:35 -0600, Tang Yuantian-B29983 wrote:

-Original Message-
From: Wood Scott-B07421
To: Tang Yuantian-B29983
Cc: Sun York-R58495; Li Yang-Leo-R58472; u-boot@lists.denx.de; Kushwaha
Prabhakar-B32579; Jin Zhengxiong-R64188
Subject: Re: [U-Boot,2/3] mpc85xx: Add deep sleep framework support

On Thu, 2014-02-13 at 02:12 -0600, Tang Yuantian-B29983 wrote:

Use an I/O accessor.

In_be64?? No such function.

Why do you need in_be64() rather than two in_be32()s?


Avoid ECC error. Although, according to my test, in_be32() works too.

Why would you get an ECC error?

-Scott
DDR operation is always in 64bits. if writing a 32bits to memory, you 
need to
read a 32bits first, and combine it to form a 64bits. when the new 
64bits is written

to memory, ECC occurs.
I was required to do so by hardware team.

Regards,
Yuantian





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


Re: [U-Boot] [PATCH v4] socfpga: Add socfpga preloader signing to mkimage

2014-02-23 Thread Wolfgang Denk
Dear Charles,

In message 1393194939-29786-1-git-send-email-cdhmann...@gmail.com you wrote:
 Like many platforms, the Altera socfpga platform requires that the
 preloader be signed in a certain way or the built-in boot ROM will
 not boot the code.
 
 This change automatically creates an appropriately signed preloader
 from an SPL image.
 
 Signed-off-by: Charles Manning cdhmann...@gmail.com
 ---
 
 Changes for v3:
  - Fix some coding style issues.
  - Move from a standalone tool to the mkimgae framework.
 
 Changes for v4:
  - Fix more coding style issues.
  - Fix typos in Makefile.
  - Rebase on master (previous version was not on master, but on a 
working socfpga branch).

There may be perfectly valid reasons why you might decide to ingore a
review comments - sch comments may be wrong, too, after all.  But in
such a case it is always a good idea to provide feedback to the
reviewer why you decided not to follow his advice.  Otherwise he might
think you just missed or ignored the comment.

And this is what is happeneing (again) in your patch...

 diff --git a/spl/Makefile b/spl/Makefile
 index bf98024..90faaa6 100644
 --- a/spl/Makefile
 +++ b/spl/Makefile
 @@ -181,6 +181,14 @@ $(objtree)/SPL : $(obj)/u-boot-spl.bin
  
  ALL-y+= $(obj)/$(SPL_BIN).bin
  
 +$(OBJTREE)/socfpga-signed-preloader.bin: $(obj)/u-boot-spl.bin
 + $(OBJTREE)/tools/mkimage -T socfpgaimage -d $ $@
 +
 +

One blank line is sufficient.

I asked before:  socfpga-signed-preloader.bin is a terribly long
name.  Can we find a better one?

 +ifdef CONFIG_SOCFPGA
 +ALL-y += $(OBJTREE)/socfpga-signed-preloader.bin
 +endif

I asked before: Can we not use ALL-$(CONFIG_SOCFPGA) and avoid the
ifdef ?

 + * Reference doc 
 http://www.altera.com.cn/literature/hb/cyclone-v/cv_5400A.pdf
 + * Note this doc is not entirely accurate.

I aseked before: Would you care to explain the errors in the document
that might cause problems to the reader?

Noting that something contains errors without mentioning what these
are is really not helpful.

 + * This uses the CRC32 calc out of the well known Apple
 + * crc32.c code. CRC32 algorithms do not produce the same results.
 + * We need this one. Sorry about the coade bloat.

Both Gerhard and me asked before: Why exactly do we need another
implementation of CRC32.  We already have some - why cannot we use
these?

 + * Copyright for the CRC code:
 + *
 + * COPYRIGHT (C) 1986 Gary S. Brown.  You may use this program, or
 + *  code or tables extracted from it, as desired without restriction.

I asked before:  Please provide _exact_ reference. See 
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
for instructions how to do this.

I also commented before: If you really need this copied code (i. e.
you canot use one of the already existing implementations of CRC32 -
which I seriously doubt), then better move this into a separate file,
and assign a separate license ID tag for it.


I also asked this before: I cannot find a license ID tag in your new
code. Please add.

 +/* To work in with the mkimage framework, we do some ugly stuff...
 + *
 + * First we prepend a fake header big enough to make the file 64k.
 + * When set_header is called, we fix this up by moving the image
 + * around in the buffer.
 + */

Also asked before: Incorrect multiline comment style. Please fix
globally.



It turns out that you basically ignored nearly ALL of trhe review
comments which I made before, twice.


It is an exhausting experience to deal with your patches :-(


Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Until you walk a mile in another man's moccasins, you  can't  imagine
the smell.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] test

2014-02-23 Thread Yuantian Tang
have a test. please ignore.



Regards,

yuantian


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


Re: [U-Boot] [U-Boot, 2/3] mpc85xx: Add deep sleep framework support

2014-02-23 Thread Tang Yuantian-B29983


On 2014/2/15 星期六 6:21, Scott Wood wrote:

On Thu, 2014-02-13 at 01:05 -0600, Tang Yuantian-B29983 wrote:

Thanks for your review. Please see the reply inline.

Thanks,
Yuantian


-Original Message-
From: Wood Scott-B07421
Sent: 2014年2月13日 星期四 8:44
To: Tang Yuantian-B29983
Cc: Sun York-R58495; Wood Scott-B07421; Li Yang-Leo-R58472;
t...@theia.denx.de; u-boot@lists.denx.de; Kushwaha Prabhakar-B32579; Jin
Zhengxiong-R64188
Subject: Re: [U-Boot,2/3] mpc85xx: Add deep sleep framework support

On Sun, Jan 26, 2014 at 02:00:40PM +0800, tang yuantian wrote:

From: Tang Yuantian yuantian.t...@freescale.com

When system wakes up from warm reset, control is passed to the primary
core that starts executing uboot. After re-initialized some IP blocks,
like DDRC, kernel will take responsibility to continue to restore
environment it leaves before.

Signed-off-by: Tang Yuantian yuantian.t...@freescale.com

Is this for some specific mpc85xx chip (e.g. T1040)?  I'm pretty sure
this isn't necessary for deep sleep on mpc8536, for example.


Currently, it is used by t1040. But we want it to be more general so that
It can be used by later new chips.

But the mechanism is not the same for all mpc85xx derivatives.  You'll
need a more specific name.

OK, will name it as t104x


+#ifdef CONFIG_DEEP_SLEEP

CONFIG symbols need to be documented in README...


Where should I add this README?

Under 85xx CPU Options in the top-level README.

Thanks.


+   /* disable the console if boot from warm reset */
+   if (in_be32(gur-scrtsr[0])  (1  3))
+   gd-flags |=
+   GD_FLG_SILENT | GD_FLG_WARM_BOOT |

GD_FLG_DISABLE_CONSOLE; #endif

...and it should probably be a more specific CONFIG_SYS symbol that
indicates the presence of this guts bit.

where should I put this CONFIG_SYS_'s definition?


diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c
b/arch/powerpc/cpu/mpc85xx/fdt.c index 33bc900..b3b9250 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -24,6 +24,9 @@ DECLARE_GLOBAL_DATA_PTR;  extern void
ft_qe_setup(void *blob);  extern void ft_fixup_num_cores(void *blob);
extern void ft_srio_setup(void *blob);
+#ifdef CONFIG_DEEP_SLEEP
+extern ulong __bss_end;
+#endif

Don't ifdef declarations.


  #ifdef CONFIG_MP
  #include mp.h
@@ -35,6 +38,9 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
u32 bootpg = determine_mp_bootpg(NULL);
u32 id = get_my_id();
const char *enable_method;
+#ifdef CONFIG_DEEP_SLEEP
+   ulong len;
+#endif

off = fdt_node_offset_by_prop_value(blob, -1, device_type, cpu,

4);

while (off != -FDT_ERR_NOTFOUND) {
@@ -77,6 +83,25 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
device_type, cpu, 4);
}

+#ifdef CONFIG_DEEP_SLEEP
+   /*
+* reserve the memory space for warm reset.
+* This space will be re-used next time when boot from deep sleep.
+* The space includes bd_t, gd_t, stack and uboot image.
+* Reserve 1K for stack.
+*/
+   len = sizeof(bd_t) + sizeof(gd_t) + (1  10);
+   /* round up to 4K */
+   len = (len + (4096 - 1))  ~(4096 - 1);
+
+   off = fdt_add_mem_rsv(blob, gd-relocaddr - len,
+   len + ((ulong)__bss_end - gd-relocaddr));
+   if (off  0)
+   printf(Failed to reserve memory for warm reset: %s\n,
+   fdt_strerror(off));
+
+#endif

Why do you need to reserve memory for this?  We didn't need to for deep
sleep on MPC8313ERDB, which also goes through U-Boot on wake.  On
MPC8313ERDB we transfer control to the kernel before relocating, so U-
Boot never touches DDR.  bd_t, gd_t, and the stack should be in locked
L1 cache, and the u-boot image should be in flash (or locked CPC if this
is not a NOR flash boot).


In deep sleep many IP blocks are powered off like DDRC, LIODN, cpu. These IPs
are re-initialized after relocating.
So, we must jump to kernel after relocating.

The DDR controller is initialized before relocating -- and of course the
CPU is powered off on MPC8313ERDB deep sleep as well.

LIODNs are a new concern for deep sleep, but that doesn't mean we should
go through a bunch of unrelated code to get there.  Refactor the LIODN
code to be usable before relocation, and not be tied to fdt fixups.
There are other IP blocks that need to be re-initialized, like SerDes, 
SMP, PCIe and

a lot of Errata. I don't want to refactor one by one.
Besides, coding in this way will not change the current execute flow.


+#ifndef CONFIG_DEEP_SLEEP
/* Reserve spin table page */
if (spin_tbl_addr  memory_limit) {
off = fdt_add_mem_rsv(blob,
@@ -108,6 +134,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
printf(Failed to reserve memory for spin table: %s\n,
fdt_strerror(off));
}
+#endif

Explain.


Spin_tbl_addr has been reserved already.

Where, and why 

Re: [U-Boot] [PATCH v2 1/2] nand/denali: Adding Denali NAND driver support

2014-02-23 Thread Michal Simek
On 02/21/2014 09:51 PM, Chin Liang See wrote:
 To add the Denali NAND driver support into U-Boot. It required
 information such as register base address from configuration
 header file  within include/configs folder.
 
 Signed-off-by: Chin Liang See cl...@altera.com
 Cc: Artem Bityutskiy artem.bityuts...@linux.intel.com
 Cc: David Woodhouse david.woodho...@intel.com
 Cc: Brian Norris computersforpe...@gmail.com
 Cc: Scott Wood scottw...@freescale.com
 ---
 Changes for v2
 - Enable this driver support for SOCFPGA
 ---
  drivers/mtd/nand/Makefile  |1 +
  drivers/mtd/nand/denali_nand.c | 1166 
 
  drivers/mtd/nand/denali_nand.h |  501 +
  3 files changed, 1668 insertions(+)
  create mode 100644 drivers/mtd/nand/denali_nand.c
  create mode 100644 drivers/mtd/nand/denali_nand.h
 
 diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
 index 02b149c..24e8218 100644
 --- a/drivers/mtd/nand/Makefile
 +++ b/drivers/mtd/nand/Makefile
 @@ -39,6 +39,7 @@ obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o
  obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o
  obj-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
  obj-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
 +obj-$(CONFIG_NAND_DENALI) += denali_nand.o
  obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
  obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
  obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 diff --git a/drivers/mtd/nand/denali_nand.c b/drivers/mtd/nand/denali_nand.c
 new file mode 100644
 index 000..55246c9
 --- /dev/null
 +++ b/drivers/mtd/nand/denali_nand.c
 @@ -0,0 +1,1166 @@
 +/*
 + * Copyright (C) 2013 Altera Corporation www.altera.com

What about 2014?


 + * Copyright (C) 2009-2010, Intel Corporation and its suppliers.
 + *
 + * SPDX-License-Identifier:  GPL-2.0+
 + */
 +
 +#include common.h
 +#include nand.h
 +#include asm/errno.h
 +#include asm/io.h
 +
 +#include denali_nand.h
 +
 +/* We define a module parameter that allows the user to override
 + * the hardware and decide what timing mode should be used.
 + */
 +#define NAND_DEFAULT_TIMINGS -1
 +
 +static struct denali_nand_info denali;
 +static int onfi_timing_mode = NAND_DEFAULT_TIMINGS;
 +
 +/* We define a macro here that combines all interrupts this driver uses into
 + * a single constant value, for convenience. */
 +#define DENALI_IRQ_ALL   (INTR_STATUS__DMA_CMD_COMP | \
 + INTR_STATUS__ECC_TRANSACTION_DONE | \
 + INTR_STATUS__ECC_ERR | \
 + INTR_STATUS__PROGRAM_FAIL | \
 + INTR_STATUS__LOAD_COMP | \
 + INTR_STATUS__PROGRAM_COMP | \
 + INTR_STATUS__TIME_OUT | \
 + INTR_STATUS__ERASE_FAIL | \
 + INTR_STATUS__RST_COMP | \
 + INTR_STATUS__ERASE_COMP | \
 + INTR_STATUS__ECC_UNCOR_ERR | \
 + INTR_STATUS__INT_ACT | \
 + INTR_STATUS__LOCKED_BLK)
 +
 +/* indicates whether or not the internal value for the flash bank is
 + * valid or not */
 +#define CHIP_SELECT_INVALID  -1
 +
 +#define SUPPORT_8BITECC  1
 +
 +/* This macro divides two integers and rounds fractional values up
 + * to the nearest integer value. */
 +#define CEIL_DIV(X, Y) (((X)%(Y)) ? ((X)/(Y)+1) : ((X)/(Y)))
 +
 +/* These constants are defined by the driver to enable common driver
 + * configuration options. */
 +#define SPARE_ACCESS 0x41
 +#define MAIN_ACCESS  0x42
 +#define MAIN_SPARE_ACCESS0x43
 +
 +#define DENALI_UNLOCK_START  0x10
 +#define DENALI_UNLOCK_END0x11
 +#define DENALI_LOCK  0x21
 +#define DENALI_LOCK_TIGHT0x31
 +#define DENALI_BUFFER_LOAD   0x60
 +#define DENALI_BUFFER_WRITE  0x62
 +
 +#define DENALI_READ  0
 +#define DENALI_WRITE 0x100
 +
 +/* types of device accesses. We can issue commands and get status */
 +#define COMMAND_CYCLE0
 +#define ADDR_CYCLE   1
 +#define STATUS_CYCLE 2
 +
 +/* this is a helper macro that allows us to
 + * format the bank into the proper bits for the controller */
 +#define BANK(x) ((x)  24)
 +
 +/* Interrupts are cleared by writing a 1 to the appropriate status bit */
 +static inline void clear_interrupt(uint32_t irq_mask)
 +{
 + uint32_t intr_status_reg = 0;
 + intr_status_reg = INTR_STATUS(denali.flash_bank);
 + __raw_writel(irq_mask, denali.flash_reg + intr_status_reg);
 +}
 +
 +static uint32_t read_interrupt_status(void)
 +{
 + uint32_t intr_status_reg = 0;
 + intr_status_reg = INTR_STATUS(denali.flash_bank);
 + return __raw_readl(denali.flash_reg + intr_status_reg);
 +}
 +
 +static void clear_interrupts(void)
 +{
 + uint32_t status = 0x0;

just 0

 + status = read_interrupt_status();
 + clear_interrupt(status);
 + denali.irq_status = 0x0;

just 0

 +}
 +
 +static void denali_irq_enable(uint32_t int_mask)
 +{
 + int i;
 + for (i = 0; i  denali.max_banks; ++i)
 + __raw_writel(int_mask, 

Re: [U-Boot] [PATCH v3 1/2] watchdog/denali: Adding DesignWare watchdog driver support

2014-02-23 Thread Michal Simek
On 02/21/2014 09:57 PM, Chin Liang See wrote:
 To add the DesignWare watchdog driver support. It required
 information such as register base address and clock info from
 configuration header file  within include/configs folder.
 
 Signed-off-by: Chin Liang See cl...@altera.com
 Cc: Anatolij Gustschin ag...@denx.de
 Cc: Albert Aribaud albert.u.b...@aribaud.net
 Cc: Heiko Schocher h...@denx.de
 Cc: Tom Rini tr...@ti.com
 ---
 Changes for v3
 - Split to 2 series patch
 Changes for v2
 - Enable this driver at socfpga_cyclone5 board
 ---
  drivers/watchdog/Makefile |1 +
  drivers/watchdog/designware_wdt.c |   73 
 +
  2 files changed, 74 insertions(+)
  create mode 100644 drivers/watchdog/designware_wdt.c
 

Checkpatch.
total: 0 errors, 1 warnings, 1 checks, 77 lines checked


 diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
 index 06ced10..0276a10 100644
 --- a/drivers/watchdog/Makefile
 +++ b/drivers/watchdog/Makefile
 @@ -15,3 +15,4 @@ obj-$(CONFIG_S5P)   += s5p_wdt.o
  obj-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o
  obj-$(CONFIG_BFIN_WATCHDOG)  += bfin_wdt.o
  obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o
 +obj-$(CONFIG_DESIGNWARE_WATCHDOG) += designware_wdt.o
 diff --git a/drivers/watchdog/designware_wdt.c 
 b/drivers/watchdog/designware_wdt.c
 new file mode 100644
 index 000..cb88844
 --- /dev/null
 +++ b/drivers/watchdog/designware_wdt.c
 @@ -0,0 +1,73 @@
 +/*
 + * Copyright (C) 2013 Altera Corporation www.altera.com

2014?


 + *
 + * SPDX-License-Identifier:  GPL-2.0+
 + */
 +
 +#include common.h
 +#include watchdog.h
 +#include asm/io.h
 +#include asm/utils.h
 +
 +#define DW_WDT_CR0x00
 +#define DW_WDT_TORR  0x04
 +#define DW_WDT_CRR   0x0C
 +
 +#define DW_WDT_CR_EN_OFFSET  0x00
 +#define DW_WDT_CR_RMOD_OFFSET0x01
 +#define DW_WDT_CR_RMOD_VAL   0x00
 +#define DW_WDT_CRR_RESTART_VAL   0x76
 +
 +/*
 + * Set the watchdog time interval.
 + * Counter is 32 bit.
 + */
 +int designware_wdt_settimeout(unsigned int timeout)
 +{
 + signed int i;

you should separate variables from code.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




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


Re: [U-Boot] [PATCH v3 2/2] socfpga: Adding DesignWare watchdog support

2014-02-23 Thread Michal Simek
On 02/21/2014 09:57 PM, Chin Liang See wrote:
 To enable the DesignWare watchdog support at SOCFPGA Cyclone V
 dev kit.
 
 Signed-off-by: Chin Liang See cl...@altera.com
 Cc: Anatolij Gustschin ag...@denx.de
 Cc: Albert Aribaud albert.u.b...@aribaud.net
 Cc: Heiko Schocher h...@denx.de
 Cc: Tom Rini tr...@ti.com
 ---
 Changes for v3
 - Split to 2 series patch
 Changes for v2
 - Enable this driver at socfpga_cyclone5 board
 ---
  .../include/asm/arch-socfpga/socfpga_base_addrs.h  |1 +
  include/configs/socfpga_cyclone5.h |   13 +
  2 files changed, 14 insertions(+)
 
 diff --git a/arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h 
 b/arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h
 index 20f12e0..5f73824 100644
 --- a/arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h
 +++ b/arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h
 @@ -11,6 +11,7 @@
  #define SOCFPGA_UART0_ADDRESS 0xffc02000
  #define SOCFPGA_UART1_ADDRESS 0xffc03000
  #define SOCFPGA_OSC1TIMER0_ADDRESS 0xffd0
 +#define SOCFPGA_L4WD0_ADDRESS 0xffd02000
  #define SOCFPGA_CLKMGR_ADDRESS 0xffd04000
  #define SOCFPGA_RSTMGR_ADDRESS 0xffd05000
  #define SOCFPGA_SYSMGR_ADDRESS 0xffd08000
 diff --git a/include/configs/socfpga_cyclone5.h 
 b/include/configs/socfpga_cyclone5.h
 index fc921ee..1b78ccb 100644
 --- a/include/configs/socfpga_cyclone5.h
 +++ b/include/configs/socfpga_cyclone5.h
 @@ -207,6 +207,16 @@
  #define CONFIG_ENV_IS_NOWHERE
  
  /*
 + * L4 Watchdog
 + */

Why multiline comment here?

 +#define CONFIG_HW_WATCHDOG
 +#define CONFIG_HW_WATCHDOG_TIMEOUT_MS2000
 +#define CONFIG_DESIGNWARE_WATCHDOG
 +#define CONFIG_DW_WDT_BASE   SOCFPGA_L4WD0_ADDRESS

Why not just use SOCFPGA_L4WD0_ADDRESS directly?

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




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