Re: [U-Boot] [RFC][PATCH 0/7] TI: OMAP3: Use common config file.

2014-01-24 Thread Enric Balletbo Serra
Hi Tom,

2014/1/6 Tom Rini tr...@ti.com:
 On Mon, Dec 23, 2013 at 12:11:25PM +0100, Enric Balletbo Serra wrote:
 2013/12/6 Enric Balletbo i Serra eballe...@gmail.com:
  Hi all,
 
  Most of the boards based on TI processors uses common configuration files
  (ti_armv7_common.h, ti_processor_common.h) to avoid duplication of code.
  This is right except for OMAP3-based boards. In order to use the same 
  schema
  as used on am33xx, omap4, omap5 and dra7 TI processors these patches create
  a new ti_omap3_common.h (that include ti_armv7_common.h) with the purpose 
  that
  all OMAP3 board can use it.
 
  Patches 1 and 2 just renames current omap4|omap5_common.h to
  ti_omap4|omap5_common.h to be coherent with current ti_am33xx_common.h,
  ti_armv7_common.h and the new ti_omap3_common.h. It's just a cosmetic 
  change so
  if people don't like it I don't have any inconvenient to remove from these
  series.
 
  Patches 3 and 4 modifies the ti_armv7_common.h to be more compatible with 
  OMAP3
  boards. For example, patch 3 removes the assumption that all ti_armv7 have 
  an
  ELM hardware engine and patch 4 handles the case that the number of DRAM 
  banks
  is defined at board level. The patch 5 is also required to integrate the 
  use
  of ti_armv7_common.h on OMAP3 boards.
 
  Patch 6 creates the new ti_omap3_common.h to be used for any OMAP3-based 
  board.
 
  And finally, patch 7 moves the IGEP boards to use the new common file. As I
  only have IGEP hardware to test these patches I decided only implement the 
  use
  case for these boards. I don't have any inconvenient to move other OMAP3 
  boards
  to use this schema but I prefer leave the decision to the board 
  maintainers.
 
  Any comments, improvements, fixes are welcome.
 
  Best regards,
 
  Enric Balletbo i Serra (7):
ARM: OMAP4: Rename to ti_omap4_common.h
ARM: OMAP5: Rename to ti_omap5_common.h
TI: armv7: Move ELM support to SoC configuration file.
TI: armv7: Do not define the number DRAM banks if is already defined.
ARM: OMAP3: Rename OMAP3_PUBLIC_SRAM_* to NON_SECURE_SRAM_*
TI: OMAP3: Create common config files for TI OMAP3 platforms.
OMAP3: igep00x0: Convert to ti_omap3_common.h.
 
   arch/arm/include/asm/arch-omap3/omap3.h|   6 +-
   include/configs/dra7xx_evm.h   |   4 +-
   include/configs/omap3_igep00x0.h   | 190 
  +
   include/configs/omap4_panda.h  |   4 +-
   include/configs/omap4_sdp4430.h|   4 +-
   include/configs/omap5_uevm.h   |   4 +-
   include/configs/ti_am335x_common.h |   4 +
   include/configs/ti_armv7_common.h  |  11 +-
   include/configs/ti_omap3_common.h  |  73 
   .../configs/{omap4_common.h = ti_omap4_common.h}  |  10 +-
   .../configs/{omap5_common.h = ti_omap5_common.h}  |  10 +-
   11 files changed, 118 insertions(+), 202 deletions(-)
   create mode 100644 include/configs/ti_omap3_common.h
   rename include/configs/{omap4_common.h = ti_omap4_common.h} (95%)
   rename include/configs/{omap5_common.h = ti_omap5_common.h} (95%)

 Ping, any comment on this patch series ?

 I intend to pick this up after v2014.01.  Thanks!


Now that merge window is open, did you try to pick these patches?

There is an issue that affect the IGEP boards introduced by commit

  commit f33b9bd3984fb11e1d8566a866adc5957b1e1c9d
  arm: omap3: Enable clocks for peripherals only if they are used

To fix the issue, I need to modify the omap3_igep00x0.h file and I'm
thinking that it's preferable wait and send the patch after these
patches.

Also there is any plan to create a branch for 2014.01 with fixes ?

Cheers,
   Enric

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


Re: [U-Boot] [PATCH] ext4fs: Add ext4 extent cache for read operations

2014-01-24 Thread Ionut Nicu
Hi,

On 21.01.2014 10:58, Ionut Nicu wrote:
 
 +static int __ext4fs_build_extent_cache(struct ext2_data *data,
 + struct ext4_extent_header *ext_block)
  {
 + int blksz = EXT2_BLOCK_SIZE(data);
 + int log2_blksz = LOG2_BLOCK_SIZE(data)
 + - get_fs()-dev_desc-log2blksz;
 + struct ext4_extent_node *node;
   struct ext4_extent_idx *index;
 + struct ext4_extent *extent;
   unsigned long long block;
 - int blksz = EXT2_BLOCK_SIZE(data);
 - int i;
 + char *buf;
 + int i, err;
  
 - while (1) {
 - index = (struct ext4_extent_idx *)(ext_block + 1);
 + if (le16_to_cpu(ext_block-eh_magic) != EXT4_EXT_MAGIC)
 + return -EINVAL;
  
 - if (le16_to_cpu(ext_block-eh_magic) != EXT4_EXT_MAGIC)
 - return 0;
 -
 - if (ext_block-eh_depth == 0)
 - return ext_block;
 - i = -1;
 - do {
 - i++;
 - if (i = le16_to_cpu(ext_block-eh_entries))
 - break;
 - } while (fileblock = le32_to_cpu(index[i].ei_block));
 + if (ext_block-eh_depth == 0) {
 + extent = (struct ext4_extent *)(ext_block + 1);
 + for (i = 0; i  le16_to_cpu(ext_block-eh_entries); i++) {
 + node = malloc(sizeof(*node));
 + if (!node)
 + return -ENOMEM;
 + node-block = le32_to_cpu(extent[i].ee_block);
 + node-len = le16_to_cpu(extent[i].ee_len);
 + node-start = (le16_to_cpu(extent[i].ee_start_hi)  16)
 + + le32_to_cpu(extent[i].ee_start_lo);

Should be (le16_to_cpu(extent[i].ee_start_hi)  32)

 diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
 index 735b256..7963f1d 100644
 --- a/fs/ext4/ext4fs.c
 +++ b/fs/ext4/ext4fs.c
 @@ -176,10 +176,25 @@ int ext4fs_ls(const char *dirname)
  
  int ext4fs_read(char *buf, unsigned len)
  {
 + int ret;
 +
   if (ext4fs_root == NULL || ext4fs_file == NULL)
   return 0;
  
 - return ext4fs_read_file(ext4fs_file, 0, len, buf);
 + if (le32_to_cpu(ext4fs_file-inode.flags)  EXT4_EXTENTS_FL) {
 + if (ext4fs_build_extent_cache((ext4fs_file-inode))) {
 + printf(Error building extent cache!\n);
 + ret = -1;
 + goto out_exit;
 + }
 + }
 +
 + ret = ext4fs_read_file(ext4fs_file, 0, len, buf);
 +
 +out_exit:
 + ext4fs_free_extent_cache();
 +
 + return ret;
  }
  

ext4fs_read_file is also called by ext4fs_iterate_dir and ext4fs_read_symlink
so the place where we build the extent cache should be ext4fs_read_file instead
of extfs_read.

Please ignore this version of the patch for now, I will send a revised version.

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


[U-Boot] [PATCH 3/4 v2] SPL: P1022DS: fix the problem booting from spi flash

2014-01-24 Thread ying.zhang
From: Ying Zhang b40...@freescale.com

There was no enough memory for malloc in SPL booting from spi flash, so
relayout the memory in SPL: reduce the memory for global data from 16K
Bytes to 4K Bytes, save the space for malloc.

Signed-off-by: Ying Zhang b40...@freescale.com
---
Change from v1:
- Move the content about P2020RDB to 2 of patchset.

 include/configs/P1022DS.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index edc8931..e9e7e88 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -366,10 +366,10 @@
 #define CONFIG_SYS_L2_SIZE (256  10)
 #define CONFIG_SYS_INIT_L2_END (CONFIG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
 #define CONFIG_SPL_RELOC_TEXT_BASE 0xf8f81000
-#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 128 * 1024)
+#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 116 * 1024)
 #define CONFIG_SPL_RELOC_STACK_SIZE(32  10)
-#define CONFIG_SPL_RELOC_MALLOC_ADDR   (CONFIG_SYS_INIT_L2_ADDR + 160 * 1024)
-#define CONFIG_SPL_RELOC_MALLOC_SIZE   (96  10)
+#define CONFIG_SPL_RELOC_MALLOC_ADDR   (CONFIG_SYS_INIT_L2_ADDR + 148 * 1024)
+#define CONFIG_SPL_RELOC_MALLOC_SIZE   (108  10)
 #define CONFIG_SPL_GD_ADDR (CONFIG_SYS_INIT_L2_ADDR + 112 * 1024)
 #elif defined(CONFIG_NAND)
 #ifdef CONFIG_TPL_BUILD
-- 
1.8.4.1


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


[U-Boot] [PATCH 1/4 v2] SPL: powerpc: expand SPL's length to 128K

2014-01-24 Thread ying.zhang
From: Ying Zhang b40...@freescale.com

1. The SPL's length of SDCARD boot has not enough,expand the SPL's
length to 128K.
2. deleted unused symbol: CONFIG_SYS_RUN_INDDR

Signed-off-by: Ying Zhang b40...@freescale.com
---
Change from v1:
- No change.

 include/configs/P1022DS.h  | 12 ++--
 include/configs/p1_p2_rdb_pc.h | 12 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index 9c9d72b..edc8931 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -30,12 +30,12 @@
 #define CONFIG_FSL_LAW /* Use common FSL init code */
 #define CONFIG_SYS_TEXT_BASE   0x11001000
 #define CONFIG_SPL_TEXT_BASE   0xf8f81000
-#define CONFIG_SPL_PAD_TO  0x18000
-#define CONFIG_SPL_MAX_SIZE(96 * 1024)
+#define CONFIG_SPL_PAD_TO  0x2
+#define CONFIG_SPL_MAX_SIZE(128 * 1024)
 #define CONFIG_SYS_MMC_U_BOOT_SIZE (768  10)
 #define CONFIG_SYS_MMC_U_BOOT_DST  (0x1100)
 #define CONFIG_SYS_MMC_U_BOOT_START(0x1100)
-#define CONFIG_SYS_MMC_U_BOOT_OFFS (96  10)
+#define CONFIG_SYS_MMC_U_BOOT_OFFS (128  10)
 #define CONFIG_SYS_MPC85XX_NO_RESETVEC
 #define CONFIG_SYS_LDSCRIPTarch/powerpc/cpu/mpc85xx/u-boot.lds
 #define CONFIG_SPL_MMC_BOOT
@@ -60,12 +60,12 @@
 #define CONFIG_FSL_LAW /* Use common FSL init code */
 #define CONFIG_SYS_TEXT_BASE   0x11001000
 #define CONFIG_SPL_TEXT_BASE   0xf8f81000
-#define CONFIG_SPL_PAD_TO  0x18000
-#define CONFIG_SPL_MAX_SIZE(96 * 1024)
+#define CONFIG_SPL_PAD_TO  0x2
+#define CONFIG_SPL_MAX_SIZE(128 * 1024)
 #define CONFIG_SYS_SPI_FLASH_U_BOOT_SIZE   (768  10)
 #define CONFIG_SYS_SPI_FLASH_U_BOOT_DST(0x1100)
 #define CONFIG_SYS_SPI_FLASH_U_BOOT_START  (0x1100)
-#define CONFIG_SYS_SPI_FLASH_U_BOOT_OFFS   (96  10)
+#define CONFIG_SYS_SPI_FLASH_U_BOOT_OFFS   (128  10)
 #define CONFIG_SYS_MPC85XX_NO_RESETVEC
 #define CONFIG_SYS_LDSCRIPTarch/powerpc/cpu/mpc85xx/u-boot.lds
 #define CONFIG_SPL_SPI_BOOT
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 95e23ac..4cabf04 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -159,12 +159,12 @@
 #define CONFIG_FSL_LAW /* Use common FSL init code */
 #define CONFIG_SYS_TEXT_BASE   0x11001000
 #define CONFIG_SPL_TEXT_BASE   0xf8f81000
-#define CONFIG_SPL_PAD_TO  0x18000
-#define CONFIG_SPL_MAX_SIZE(96 * 1024)
+#define CONFIG_SPL_PAD_TO  0x2
+#define CONFIG_SPL_MAX_SIZE(128 * 1024)
 #define CONFIG_SYS_MMC_U_BOOT_SIZE (768  10)
 #define CONFIG_SYS_MMC_U_BOOT_DST  (0x1100)
 #define CONFIG_SYS_MMC_U_BOOT_START(0x1100)
-#define CONFIG_SYS_MMC_U_BOOT_OFFS (96  10)
+#define CONFIG_SYS_MMC_U_BOOT_OFFS (128  10)
 #define CONFIG_SYS_MPC85XX_NO_RESETVEC
 #define CONFIG_SYS_LDSCRIPTarch/powerpc/cpu/mpc85xx/u-boot.lds
 #define CONFIG_SPL_MMC_BOOT
@@ -189,12 +189,12 @@
 #define CONFIG_FSL_LAW /* Use common FSL init code */
 #define CONFIG_SYS_TEXT_BASE   0x11001000
 #define CONFIG_SPL_TEXT_BASE   0xf8f81000
-#define CONFIG_SPL_PAD_TO  0x18000
-#define CONFIG_SPL_MAX_SIZE(96 * 1024)
+#define CONFIG_SPL_PAD_TO  0x2
+#define CONFIG_SPL_MAX_SIZE(128 * 1024)
 #define CONFIG_SYS_SPI_FLASH_U_BOOT_SIZE   (768  10)
 #define CONFIG_SYS_SPI_FLASH_U_BOOT_DST(0x1100)
 #define CONFIG_SYS_SPI_FLASH_U_BOOT_START  (0x1100)
-#define CONFIG_SYS_SPI_FLASH_U_BOOT_OFFS   (96  10)
+#define CONFIG_SYS_SPI_FLASH_U_BOOT_OFFS   (128  10)
 #define CONFIG_SYS_MPC85XX_NO_RESETVEC
 #define CONFIG_SYS_LDSCRIPTarch/powerpc/cpu/mpc85xx/u-boot.lds
 #define CONFIG_SPL_SPI_BOOT
-- 
1.8.4.1


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


[U-Boot] [PATCH 4/4 v2] powerpc: p1010rdb: Enable p1010rdb to start from NAND/SD/SPI flash with SPL

2014-01-24 Thread ying.zhang
From: Ying Zhang b40...@freescale.com

In the previous patches, we introduced the SPL/TPL fraamework.
For SD/SPI flash booting way, we introduce the SPL to enable a loader stub. The
SPL was loaded by the code from the internal on-chip ROM. The SPL initializes
the DDR according to the SPD and loads the final uboot image into DDR, then
jump to the DDR to begin execution.

For NAND booting way, the nand SPL has size limitation on some board(e.g.
P1010RDB), it can not be more than 8KB, we can call it minimal SPL, So the
dynamic DDR driver doesn't fit into this minimum SPL. We added the TPL that is
loaded by the the minimal SPL. The TPL initializes the DDR according to the SPD
and loads the final uboot image into DDR,then jump to the DDR to begin 
execution.

This patch enabled SPL/TPL for P1010RDB to support starting from NAND/SD/SPI
flash with SPL framework and initializing the DDR according to SPD in the 
SPL/TPL.
Because the minimal SPL load the TPL to L2 SRAM and the jump to the L2 SRAM to
execute, so the section .resetvec is no longer needed.

Signed-off-by: Ying Zhang b40...@freescale.com
---
Change from v1:
- No change.

 board/freescale/p1010rdb/Makefile  |   4 +
 board/freescale/p1010rdb/spl.c | 108 +++
 board/freescale/p1010rdb/spl_minimal.c |  76 ++--
 board/freescale/p1010rdb/tlb.c |  12 ++-
 include/configs/P1010RDB.h | 156 +++--
 5 files changed, 275 insertions(+), 81 deletions(-)
 create mode 100644 board/freescale/p1010rdb/spl.c

diff --git a/board/freescale/p1010rdb/Makefile 
b/board/freescale/p1010rdb/Makefile
index d6f05f3..660d1bb 100644
--- a/board/freescale/p1010rdb/Makefile
+++ b/board/freescale/p1010rdb/Makefile
@@ -18,6 +18,10 @@ obj-y+= spl_minimal.o tlb.o law.o
 
 else
 
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+endif
+
 obj-y  += p1010rdb.o
 obj-y  += ddr.o
 obj-y  += law.o
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
new file mode 100644
index 000..8fed26d
--- /dev/null
+++ b/board/freescale/p1010rdb/spl.c
@@ -0,0 +1,108 @@
+/* Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include ns16550.h
+#include malloc.h
+#include mmc.h
+#include nand.h
+#include i2c.h
+#include fsl_esdhc.h
+#include spi_flash.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+ulong get_effective_memsize(void)
+{
+   return CONFIG_SYS_L2_SIZE;
+}
+
+void board_init_f(ulong bootflag)
+{
+   u32 plat_ratio;
+   ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+   struct fsl_ifc *ifc = (void *)CONFIG_SYS_IFC_ADDR;
+
+   console_init_f();
+
+   /* Clock configuration to access CPLD using IFC(GPCM) */
+   setbits_be32(ifc-ifc_gcr, 1  IFC_GCR_TBCTL_TRN_TIME_SHIFT);
+
+#ifdef CONFIG_P1010RDB_PB
+   setbits_be32(gur-pmuxcr2, MPC85xx_PMUXCR2_GPIO01_DRVVBUS);
+#endif
+
+   /* initialize selected port with appropriate baud rate */
+   plat_ratio = in_be32(gur-porpllsr)  MPC85xx_PORPLLSR_PLAT_RATIO;
+   plat_ratio = 1;
+   gd-bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
+
+   NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+gd-bus_clk / 16 / CONFIG_BAUDRATE);
+
+#ifdef CONFIG_SPL_MMC_BOOT
+   puts(\nSD boot...\n);
+#elif defined(CONFIG_SPL_SPI_BOOT)
+   puts(\nSPI Flash boot...\n);
+#endif
+   /* copy code to RAM and jump to it - this should not return */
+   /* NOTE - code has to be copied out of NAND buffer before
+* other blocks can be read.
+   */
+   relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
+}
+
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+   /* Pointer is writable since we allocated a register for it */
+   gd = (gd_t *)CONFIG_SPL_GD_ADDR;
+   bd_t *bd;
+
+   memset(gd, 0, sizeof(gd_t));
+   bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
+   memset(bd, 0, sizeof(bd_t));
+   gd-bd = bd;
+   bd-bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
+   bd-bi_memsize = CONFIG_SYS_L2_SIZE;
+
+   probecpu();
+   get_clocks();
+   mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
+   CONFIG_SPL_RELOC_MALLOC_SIZE);
+
+#ifndef CONFIG_SPL_NAND_BOOT
+   env_init();
+#endif
+#ifdef CONFIG_SPL_MMC_BOOT
+   mmc_initialize(bd);
+#endif
+
+   /* relocate environment function pointers etc. */
+#ifdef CONFIG_SPL_NAND_BOOT
+   nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+   (uchar *)CONFIG_ENV_ADDR);
+   gd-env_addr  = (ulong)(CONFIG_ENV_ADDR);
+   gd-env_valid = 1;
+#else
+   env_relocate();
+#endif
+
+   i2c_init_all();
+
+   gd-ram_size = initdram(0);
+#ifdef CONFIG_SPL_NAND_BOOT
+   puts(\nTertiary program loader running in sram...);
+#else
+   puts(\nSecond program loader running in sram...);
+#endif
+
+#ifdef CONFIG_SPL_MMC_BOOT
+   mmc_boot();

[U-Boot] [PATCH 2/4 v2] SPL: P2020RDB: fix the problem booting from spi flash

2014-01-24 Thread ying.zhang
From: Ying Zhang b40...@freescale.com

There was no enough stack in SPL, so the buffer needed in SPL is to malloc
from memory pool and to repalce the temporary variable.

Signed-off-by: Ying Zhang b40...@freescale.com
---
Change from v1:
- The malloc size expand to 364K bytes.

 common/env_sf.c|  7 ++-
 include/configs/p1_p2_rdb_pc.h | 12 
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/common/env_sf.c b/common/env_sf.c
index 9f806fb..be270f2 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -299,13 +299,16 @@ int saveenv(void)
 
 void env_relocate_spec(void)
 {
-   char buf[CONFIG_ENV_SIZE];
int ret;
+   char *buf = NULL;
 
+   buf = (char *)malloc(CONFIG_ENV_SIZE);
env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
set_default_env(!spi_flash_probe() failed);
+   if (buf)
+   free(buf);
return;
}
 
@@ -321,6 +324,8 @@ void env_relocate_spec(void)
gd-env_valid = 1;
 out:
spi_flash_free(env_flash);
+   if (buf)
+   free(buf);
env_flash = NULL;
 }
 #endif
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 4cabf04..1e8e617 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -580,11 +580,15 @@
 #define CONFIG_SYS_INIT_L2_ADDR_PHYS   CONFIG_SYS_INIT_L2_ADDR
 #define CONFIG_SYS_INIT_L2_END (CONFIG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
 #define CONFIG_SPL_RELOC_TEXT_BASE 0xf8f81000
-#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 128 * 1024)
-#define CONFIG_SPL_RELOC_STACK_SIZE(32  10)
-#define CONFIG_SPL_RELOC_MALLOC_ADDR   (CONFIG_SYS_INIT_L2_ADDR + 160 * 1024)
-#define CONFIG_SPL_RELOC_MALLOC_SIZE   (96  10)
 #define CONFIG_SPL_GD_ADDR (CONFIG_SYS_INIT_L2_ADDR + 112 * 1024)
+#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 116 * 1024)
+#define CONFIG_SPL_RELOC_STACK_SIZE(32  10)
+#define CONFIG_SPL_RELOC_MALLOC_ADDR   (CONFIG_SYS_INIT_L2_ADDR + 148 * 1024)
+#if defined(CONFIG_P2020RDB)
+#define CONFIG_SPL_RELOC_MALLOC_SIZE   (364  10)
+#else
+#define CONFIG_SPL_RELOC_MALLOC_SIZE   (108  10)
+#endif
 #elif defined(CONFIG_NAND)
 #ifdef CONFIG_TPL_BUILD
 #define CONFIG_SYS_INIT_L2_ADDR0xf8f8
-- 
1.8.4.1


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


[U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-24 Thread Zhao Qiang
T1040 has QE-related addresses different from other boards,
modify those addresses value with macro CONFIG_PPC_T1040
and CONFIG_T1040QDS.
Add function qe_board_setup to mux the bus to tdm or uart
according to hwconfig.

Signed-off-by: Jiucheng Xu jiucheng...@freescale.com
Signed-off-by: Zhao Qiang b45...@freescale.com
---
 arch/powerpc/cpu/mpc85xx/cpu_init.c   | 11 +--
 arch/powerpc/cpu/mpc85xx/qe_io.c  |  2 +-
 arch/powerpc/cpu/mpc85xx/speed.c  |  6 ++
 arch/powerpc/cpu/mpc85xx/t1040_ids.c  |  1 +
 arch/powerpc/include/asm/config_mpc85xx.h |  3 +++
 arch/powerpc/include/asm/fsl_liodn.h  |  4 
 arch/powerpc/include/asm/immap_85xx.h |  9 -
 board/freescale/t1040qds/t1040qds.c   | 29 +
 drivers/qe/qe.c   |  4 
 drivers/qe/qe.h   |  2 ++
 include/configs/T1040QDS.h|  2 ++
 11 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index b31efb7..4448e04 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -33,15 +33,15 @@
 #endif
 
 #include ../../../../drivers/block/fsl_sata.h
+#include ../../../../drivers/qe/qe.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_QE
+#ifndef CONFIG_PPC_T1040
 extern qe_iop_conf_t qe_iop_conf_tab[];
 extern void qe_config_iopin(u8 port, u8 pin, int dir,
int open_drain, int assign);
-extern void qe_init(uint qe_base);
-extern void qe_reset(void);
 
 static void config_qe_ioports(void)
 {
@@ -59,6 +59,7 @@ static void config_qe_ioports(void)
}
 }
 #endif
+#endif
 
 #ifdef CONFIG_CPM2
 void config_8560_ioports (volatile ccsr_cpm_t * cpm)
@@ -262,9 +263,11 @@ void cpu_init_f (void)
m8560_cpm_reset();
 #endif
 #ifdef CONFIG_QE
+#ifndef CONFIG_PPC_T1040
/* Config QE ioports */
config_qe_ioports();
 #endif
+#endif
 #if defined(CONFIG_FSL_DMA)
dma_init();
 #endif
@@ -736,7 +739,11 @@ int sata_initialize(void)
 void cpu_secondary_init_r(void)
 {
 #ifdef CONFIG_QE
+#ifdef CONFIG_PPC_T1040
+   uint qe_base = CONFIG_SYS_IMMR + 0x0014; /* QE immr base */
+#else
uint qe_base = CONFIG_SYS_IMMR + 0x0008; /* QE immr base */
+#endif
 #ifdef CONFIG_SYS_QE_FMAN_FW_IN_NAND
int ret;
size_t fw_length = CONFIG_SYS_QE_FMAN_FW_LENGTH;
diff --git a/arch/powerpc/cpu/mpc85xx/qe_io.c b/arch/powerpc/cpu/mpc85xx/qe_io.c
index 76c60da..a495080 100644
--- a/arch/powerpc/cpu/mpc85xx/qe_io.c
+++ b/arch/powerpc/cpu/mpc85xx/qe_io.c
@@ -12,7 +12,7 @@
 #include asm/io.h
 #include asm/immap_85xx.h
 
-#if defined(CONFIG_QE)
+#if defined(CONFIG_QE)  !defined(CONFIG_T1040QDS)
 #defineNUM_OF_PINS 32
 void qe_config_iopin(u8 port, u8 pin, int dir, int open_drain, int assign)
 {
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index 35867df..634f107 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -335,6 +335,12 @@ void get_sys_info(sys_info_t *sys_info)
 
 #endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
 
+#ifdef CONFIG_QE
+#if defined(CONFIG_PPC_T1040)
+   sys_info-freq_qe =  sys_info-freq_systembus / 2;
+#endif
+#endif
+
 #else /* CONFIG_FSL_CORENET */
uint plat_ratio, e500_ratio, half_freq_systembus;
int i;
diff --git a/arch/powerpc/cpu/mpc85xx/t1040_ids.c 
b/arch/powerpc/cpu/mpc85xx/t1040_ids.c
index 32075ce..4984727 100644
--- a/arch/powerpc/cpu/mpc85xx/t1040_ids.c
+++ b/arch/powerpc/cpu/mpc85xx/t1040_ids.c
@@ -66,6 +66,7 @@ struct liodn_id_table liodn_tbl[] = {
SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
 
/* SET_NEXUS_LIODN(557), -- not yet implemented */
+   SET_QE_LIODN(559),
 };
 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
 
diff --git a/arch/powerpc/include/asm/config_mpc85xx.h 
b/arch/powerpc/include/asm/config_mpc85xx.h
index 54ce2f0..ee994cc 100644
--- a/arch/powerpc/include/asm/config_mpc85xx.h
+++ b/arch/powerpc/include/asm/config_mpc85xx.h
@@ -718,6 +718,9 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define CONFIG_SYS_FSL_USB2_PHY_ENABLE
 #define CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY
 #define CONFIG_SYS_CCSRBAR_DEFAULT 0xfe00
+#define QE_MURAM_SIZE  0x6000UL
+#define MAX_QE_RISC1
+#define QE_NUM_OF_SNUM 28
 
 #elif defined(CONFIG_PPC_T2080) || defined(CONFIG_PPC_T2081)
 #define CONFIG_E6500
diff --git a/arch/powerpc/include/asm/fsl_liodn.h 
b/arch/powerpc/include/asm/fsl_liodn.h
index 44bc88d..f658bcb 100644
--- a/arch/powerpc/include/asm/fsl_liodn.h
+++ b/arch/powerpc/include/asm/fsl_liodn.h
@@ -99,6 +99,10 @@ extern void fdt_fixup_liodn(void *blob);
SET_GUTS_LIODN(fsl,esdhc, liodn, sdmmc##sdhcNum##liodnr,\
CONFIG_SYS_MPC85xx_ESDHC_OFFSET)
 
+#define SET_QE_LIODN(liodn) \
+   SET_GUTS_LIODN(fsl,qe, liodn, qeliodnr,\
+   

[U-Boot] [PATCH] nds32: add support for leopard and orca board boot flow auto detect

2014-01-24 Thread Andes
From: rick r...@andestech.com

hardware difference between leopard and orca as below:

flash setting leoaprd orca
bank size 32MB64MB
bus width 32-bits 16-bits

Signed-off-by: rick r...@andestech.com
---
 arch/nds32/cpu/n1213/ag101/asm-offsets.c   |1 +
 arch/nds32/cpu/n1213/ag101/lowlevel_init.S |   88 ++-
 2 files changed, 85 insertions(+), 4 deletions(-)

diff --git a/arch/nds32/cpu/n1213/ag101/asm-offsets.c 
b/arch/nds32/cpu/n1213/ag101/asm-offsets.c
index 92ada8a..cfe52d1 100644
--- a/arch/nds32/cpu/n1213/ag101/asm-offsets.c
+++ b/arch/nds32/cpu/n1213/ag101/asm-offsets.c
@@ -21,6 +21,7 @@ int main(void)
 #endif
BLANK();
 #ifdef CONFIG_FTAHBC020S
+   OFFSET(FTAHBC020S_SLAVE_BSR_4,  ftahbc02s, s_bsr[4]);
OFFSET(FTAHBC020S_SLAVE_BSR_6,  ftahbc02s, s_bsr[6]);
OFFSET(FTAHBC020S_CR,   ftahbc02s, cr);
 #endif
diff --git a/arch/nds32/cpu/n1213/ag101/lowlevel_init.S 
b/arch/nds32/cpu/n1213/ag101/lowlevel_init.S
index 810326d..d6484b9 100644
--- a/arch/nds32/cpu/n1213/ag101/lowlevel_init.S
+++ b/arch/nds32/cpu/n1213/ag101/lowlevel_init.S
@@ -32,6 +32,15 @@
 #define SDMC_B0_BSR_D  CONFIG_SYS_FTSDMC021_BANK0_BSR
 #define SDMC_B1_BSR_D  CONFIG_SYS_FTSDMC021_BANK1_BSR
 
+
+/*
+ * for Orca and Emerald
+ */
+#define BOARD_ID_REG   0x104
+#define BOARD_ID_FAMILY_MASK   0xfff000
+#define BOARD_ID_FAMILY_V5 0x556000
+#define BOARD_ID_FAMILY_K7 0x74b000
+
 /*
  * parameters for the static memory controller
  */
@@ -47,6 +56,10 @@
 #define AHBC_CR_A  (CONFIG_FTAHBC020S_BASE + FTAHBC020S_CR)
 #define AHBC_BSR6_A(CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_6)
 
+/*
+ * for Orca and Emerald
+ */
+#define AHBC_BSR4_A(CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_4)
 #define AHBC_BSR6_DCONFIG_SYS_FTAHBC020S_SLAVE_BSR_6
 
 /*
@@ -100,14 +113,49 @@ mem_init:
 *  we need to set onboard SDRAM before remap and relocation.
 */
led 0x01
-   write32 SMC_BANK0_CR_A, SMC_BANK0_CR_D  ! 0x1052
-   write32 SMC_BANK0_TPR_A, SMC_BANK0_TPR_D! 0x00151151
+
+  /*
+   * for Orca and Emerald
+   * disable write protection and reset bank size
+   */
+   li  $r0, SMC_BANK0_CR_A
+   lwi $r1, [$r0+#0x00]
+   ori $r1, $r1, 0x8f0
+   xori $r1, $r1, 0x8f0
+  /*
+   * check board
+   */
+   li  $r3, CONFIG_FTPMU010_BASE + BOARD_ID_REG
+  lwi $r3, [$r3]
+  li  $r4, BOARD_ID_FAMILY_MASK
+  and $r3, $r3, $r4
+  li  $r4, BOARD_ID_FAMILY_K7
+  xor $r4, $r3, $r4
+  beqz$r4, use_flash_16bit_boot
+  /*
+   * 32-bit mode
+   */
+use_flash_32bit_boot:
+   ori $r1, $r1, 0x50
+  li  $r2, 0x00151151
+  j   sdram_b0_cr
+  /*
+   * 16-bit mode
+   */
+use_flash_16bit_boot:
+  ori $r1, $r1, 0x60
+  li  $r2, 0x00153153
+  /*
+   * SRAM bank0 config
+   */
+sdram_b0_cr:
+  swi $r1, [$r0+#0x00]
+  swi $r2, [$r0+#0x04]
 
/*
 * config AHB Controller
 */
led 0x02
-   write32 AHBC_BSR6_A, AHBC_BSR6_D
 
/*
 * config PMU controller
@@ -194,7 +242,16 @@ relo_base:
 * a FLASH connected to bank0.
 */
led 0x11
-   li  $r4, PHYS_SDRAM_0_AT_INIT   /* 0x1000 */
+   /*
+* for Orca and Emerald
+* read sdram base address automatically
+*/
+   li  $r5, AHBC_BSR6_A
+   lwi $r8, [$r5]
+   li  $r4, 0xfff0
+   and $r4, $r4, $r8
+
+
li  $r5, 0x0
la  $r1, relo_base  /* get $pc or $lp */
sub $r2, $r0, $r1
@@ -218,6 +275,29 @@ relo_base:
write32 SDMC_B1_BSR_A, 0x1040
setbf15 AHBC_CR_A, FTAHBC020S_CR_REMAP  ! 0x1
 
+  /*
+   * for Orca and Emerald
+   * extend sdram size from 256MB to 2GB
+   */
+   li  $r5, AHBC_BSR6_A
+   lwi $r6, [$r5]
+   li  $r4, 0xfff0
+   and $r6 ,$r4 , $r6
+   li  $r4, 0x000b
+   or  $r6, $r4,   $r6
+   swi $r6, [$r5]
+
+  /*
+   * for Orca and Emerald
+   * extend rom base from 256MB to 2GB
+   */
+   li  $r4, AHBC_BSR4_A
+   lwi $r5, [$r4]
+   li  $r6, 0xff
+   and $r5, $r5, $r6
+   li  $r6, 0x8000
+   or  $r5, $r5, $r6
+   swi $r5,[$r4]
 #endif /* #ifdef CONFIG_MEM_REMAP */
move$lp, $r11
 2:
-- 
1.7.6

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


Re: [U-Boot] [PATCH] config: trats: trats2: extend dfu_alt_info by env update settings

2014-01-24 Thread Jaehoon Chung
Acked-by: Jaehoon Chung jh80.ch...@samsung.com

Best Regards,
Jaehoon Chung

On 01/22/2014 08:08 PM, Przemyslaw Marczak wrote:
 CC
 
 On 01/22/2014 12:02 PM, Przemyslaw Marczak wrote:
 This change allows updating environment stored on MMC by dfu or thor.

 New setting:
 - params.bin mmc 0x38 0x8

 File params.bin can be generated by: tools/mkenvimage.
 e.g. ./mkenvimage -s 4096 -o params.bin env_text_file

 Every new env variable in text file should start with a new line.

 Sample env text file:
 - board/samsung/common/dfu_sample_env.txt

 Requirements:
 - file name: params.bin
 - file size: 4096 Bytes - the same as CONFIG_ENV_SIZE.
Other size will cause CRC miscalculation at boot.

 Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com
 CC: Piotr Wilczek p.wilc...@samsung.com
 CC: Lukasz Majewski l.majew...@samsung.com
 ---
   board/samsung/common/dfu_sample_env.txt |9 +
   include/configs/trats.h |3 ++-
   include/configs/trats2.h|3 ++-
   3 files changed, 13 insertions(+), 2 deletions(-)
   create mode 100644 board/samsung/common/dfu_sample_env.txt

 diff --git a/board/samsung/common/dfu_sample_env.txt 
 b/board/samsung/common/dfu_sample_env.txt
 new file mode 100644
 index 000..d6ee8a2
 --- /dev/null
 +++ b/board/samsung/common/dfu_sample_env.txt
 @@ -0,0 +1,9 @@
 +mmcboot=setenv bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} 
 ${rootfstype} rootwait ${console}; run loaduimage; bootm 0x40007FC0
 +rootfstype=ext4
 +loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 uImage
 +mmcdev=0
 +mmcbootpart=2
 +mmcrootpart=5
 +console=console=ttySAC2,115200n8
 +bootcmd=run mmcboot
 +dfu_alt_info=u-boot mmc 80 800;params.bin mmc 0x38 0x8;uImage ext4 0 2
 diff --git a/include/configs/trats.h b/include/configs/trats.h
 index fdd8b46..d09f7c7 100644
 --- a/include/configs/trats.h
 +++ b/include/configs/trats.h
 @@ -147,7 +147,8 @@
   PARTS_BOOT part 0 2; \
   PARTS_ROOT part 0 5; \
   PARTS_DATA part 0 6; \
 -PARTS_UMS part 0 7\0
 +PARTS_UMS part 0 7; \
 +params.bin mmc 0x38 0x8\0

   #define CONFIG_ENV_OVERWRITE
   #define CONFIG_SYS_CONSOLE_INFO_QUIET
 diff --git a/include/configs/trats2.h b/include/configs/trats2.h
 index 83633b0..31c52f1 100644
 --- a/include/configs/trats2.h
 +++ b/include/configs/trats2.h
 @@ -178,7 +178,8 @@
   PARTS_BOOT part 0 2; \
   PARTS_ROOT part 0 5; \
   PARTS_DATA part 0 6; \
 -PARTS_UMS part 0 7\0
 +PARTS_UMS part 0 7; \
 +params.bin mmc 0x38 0x8\0

   #define CONFIG_EXTRA_ENV_SETTINGS \
   bootk= \

 
 Thank you,

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


[U-Boot] [PATCH v7 06/38] nand-spl: Use scripts/Makefile.build

2014-01-24 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile  |  2 +-
 nand_spl/board/amcc/acadia/Makefile   |  8 
 nand_spl/board/amcc/bamboo/Makefile   |  8 
 nand_spl/board/amcc/canyonlands/Makefile  |  8 
 nand_spl/board/amcc/kilauea/Makefile  |  8 
 nand_spl/board/amcc/sequoia/Makefile  |  8 
 nand_spl/board/freescale/mpc8315erdb/Makefile | 10 --
 nand_spl/board/freescale/mpc8536ds/Makefile   | 10 --
 nand_spl/board/freescale/mpc8569mds/Makefile  | 10 --
 nand_spl/board/freescale/mpc8572ds/Makefile   | 10 --
 nand_spl/board/freescale/p1023rds/Makefile| 11 +--
 nand_spl/board/freescale/p1_p2_rdb/Makefile   | 10 --
 nand_spl/board/sheldon/simpc8313/Makefile | 11 ---
 13 files changed, 2 insertions(+), 112 deletions(-)

diff --git a/Makefile b/Makefile
index b10d3b1..5204ab4 100644
--- a/Makefile
+++ b/Makefile
@@ -567,7 +567,7 @@ $(obj)u-boot.lds: $(LDSCRIPT) depend
$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - $ 
$@
 
 nand_spl:  $(TIMESTAMP_FILE) $(VERSION_FILE) depend
-   $(MAKE) -C nand_spl/board/$(BOARDDIR) all
+   $(MAKE) $(build) nand_spl/board/$(BOARDDIR) all
 
 $(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin
cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin  
$(obj)u-boot-nand.bin
diff --git a/nand_spl/board/amcc/acadia/Makefile 
b/nand_spl/board/amcc/acadia/Makefile
index 022a205..3b00d49 100644
--- a/nand_spl/board/amcc/acadia/Makefile
+++ b/nand_spl/board/amcc/acadia/Makefile
@@ -5,7 +5,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-include $(TOPDIR)/config.mk
 include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 
 nandobj:= $(OBJTREE)/nand_spl/
@@ -94,10 +93,3 @@ $(obj)%.o:   $(obj)%.S
 
 $(obj)%.o: $(obj)%.c
$(CC) $(CFLAGS) -c -o $@ $
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#
diff --git a/nand_spl/board/amcc/bamboo/Makefile 
b/nand_spl/board/amcc/bamboo/Makefile
index d413a48..4063274 100644
--- a/nand_spl/board/amcc/bamboo/Makefile
+++ b/nand_spl/board/amcc/bamboo/Makefile
@@ -5,7 +5,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-include $(TOPDIR)/config.mk
 include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 
 nandobj:= $(OBJTREE)/nand_spl/
@@ -82,10 +81,3 @@ $(obj)%.o:   $(obj)%.S
 
 $(obj)%.o: $(obj)%.c
$(CC) $(CFLAGS) -c -o $@ $
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#
diff --git a/nand_spl/board/amcc/canyonlands/Makefile 
b/nand_spl/board/amcc/canyonlands/Makefile
index b2ef03f..13c8b36 100644
--- a/nand_spl/board/amcc/canyonlands/Makefile
+++ b/nand_spl/board/amcc/canyonlands/Makefile
@@ -5,7 +5,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-include $(TOPDIR)/config.mk
 include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 
 nandobj:= $(OBJTREE)/nand_spl/
@@ -87,10 +86,3 @@ $(obj)%.o:   $(obj)%.S
 
 $(obj)%.o: $(obj)%.c
$(CC) $(CFLAGS) -c -o $@ $
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#
diff --git a/nand_spl/board/amcc/kilauea/Makefile 
b/nand_spl/board/amcc/kilauea/Makefile
index 5899b9e..9d07147 100644
--- a/nand_spl/board/amcc/kilauea/Makefile
+++ b/nand_spl/board/amcc/kilauea/Makefile
@@ -5,7 +5,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-include $(TOPDIR)/config.mk
 include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 
 nandobj:= $(OBJTREE)/nand_spl/
@@ -83,10 +82,3 @@ $(obj)%.o:   $(obj)%.S
 
 $(obj)%.o: $(obj)%.c
$(CC) $(CFLAGS) -c -o $@ $
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#
diff --git a/nand_spl/board/amcc/sequoia/Makefile 
b/nand_spl/board/amcc/sequoia/Makefile
index fea6c4e..111bb0d 100644
--- a/nand_spl/board/amcc/sequoia/Makefile
+++ b/nand_spl/board/amcc/sequoia/Makefile
@@ -5,7 +5,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-include $(TOPDIR)/config.mk
 include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 
 nandobj:= $(OBJTREE)/nand_spl/
@@ -86,10 +85,3 @@ $(obj)%.o:   $(obj)%.S
 
 $(obj)%.o: $(obj)%.c
$(CC) $(CFLAGS) -c -o $@ $
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#
diff --git a/nand_spl/board/freescale/mpc8315erdb/Makefile 

[U-Boot] [PATCH v7 23/38] kbuild: move some lines to more suitable place

2014-01-24 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v7: None
Changes in v6:
  - Rebase on the current u-boot/master

Changes in v5: None
Changes in v4:
  - Move the line where U_BOOT_VERSION is defined

Changes in v3: None
Changes in v2: None

 Makefile | 66 
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index 4f00f08..baa7b3d 100644
--- a/Makefile
+++ b/Makefile
@@ -9,39 +9,7 @@ VERSION = 2014
 PATCHLEVEL = 01
 SUBLEVEL =
 EXTRAVERSION =
-ifneq $(SUBLEVEL) 
-U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
-else
-U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
-endif
-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/ \
-   -e s/arm.*/arm/ \
-   -e s/sa110/arm/ \
-   -e s/ppc64/powerpc/ \
-   -e s/ppc/powerpc/ \
-   -e s/macppc/powerpc/\
-   -e s/sh.*/sh/)
-
-HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
-   sed -e 's/\(cygwin\).*/cygwin/')
-
-export HOSTARCH HOSTOS
-
-# Deal with colliding definitions from tcsh etc.
-VENDOR=
-
-#
-# Allow for silent builds
-ifeq (,$(findstring s,$(MAKEFLAGS)))
-XECHO = echo
-else
-XECHO = :
-endif
+NAME =
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute make help
@@ -212,6 +180,35 @@ 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/ \
+   -e s/arm.*/arm/ \
+   -e s/sa110/arm/ \
+   -e s/ppc64/powerpc/ \
+   -e s/ppc/powerpc/ \
+   -e s/macppc/powerpc/\
+   -e s/sh.*/sh/)
+
+HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
+   sed -e 's/\(cygwin\).*/cygwin/')
+
+export HOSTARCH HOSTOS
+
+# Deal with colliding definitions from tcsh etc.
+VENDOR=
+
+#
+# Allow for silent builds
+ifeq (,$(findstring s,$(MAKEFLAGS)))
+XECHO = echo
+else
+XECHO = :
+endif
+
 # The tools are needed early, so put this first
 # Don't include stuff already done in $(LIBS)
 # The examples conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
@@ -402,6 +399,9 @@ KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
   -fno-builtin -ffreestanding
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 
+U_BOOT_VERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if 
$(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
+
+export VERSION PATCHLEVEL SUBLEVEL U_BOOT_VERSION
 export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
 export MAKE AWK
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 0/38] Switch over to real Kbuild

2014-01-24 Thread Masahiro Yamada

We switched to Kbuild style makefiles at v2014.01-rc1 release.
With that modification, we can write makefiles simpler.
But it is NOT real Kbuild. We need more progress.

As the next step, this series imports (+ adjusts) build scripts
from Linux Kernel under scripts/ directory.
By applying this series, we can get more advantages:
  - short log
  - perfect dependency tracking
  - preparation to the next step, Kconfig
  - other things...

 Kbuild without Kconfig
 --

First of all, to make things clearer, let me explain
the difference between Kbuild and Kconfig.
They are, I think, sometimes confusing.

 Kbuild - build system used for Linux Kernel.
Some features of Kbuild are:

   (a) We can describe makefiles simply.
  Just add objects to obj-y like this:
  obj-$(CONFIG_FOO) += foo.o

   (b) We can describe directory descending nicely.
  Add directories with a slash to obj-y like this:
  obj-$(CONFIG_BAR) += bar/

   (c) Short log like follows:
  CC  common/foo.o
  CC  common/bar.o
  LD  common/built-in.o

   (d) Perfect dependency tracking
  I think this is the biggest advantage.
  To be honest, the dependency tracing of U-Boot build system
  was not reliable.

 Kconfig - A tool to manage CONFIG macros.
  We can handle the dependency among CONFIG macros.
  Kconfig allows us to modify CONFIG settings easily
  by make config.
  GUI interface are also available by make menuconfig
  All defined CONFIG macros are stored into .config file

I think most of U-boot developers are already familiar with above.
(In most cases, they are Linux Kernel developers too.)

I definitely want to port both of these, but I want to do them separately: 
Kbuild first.
(If we do Kbuild and Kconfig at the same time, it might be messed up.)

So, I want to do Kbuild without Kconfig in this series.
The conventional tool (mkconfig + boards.cfg file)
is used for board configuration.

 Prerequisite
 

You need to apply the followings beforehand to use this series.

[1] sandbox: Use system headers first for sandbox's os.c in a different way
http://patchwork.ozlabs.org/patch/294233/

[2] board: tec-ng: Do not make directories in a board Makefile
http://patchwork.ozlabs.org/patch/310825/

 How to Build ?
 --

We can build the same as before.
Do board configuraton first and then run make.

  $ make  omap4_panda_config
  Configuring for omap4_panda board...
  $ make  CROSS_COMPILE=arm-linux-gnueabi-
  GEN include/autoconf.mk.dep
  GEN include/autoconf.mk
  CC  lib/asm-offsets.s
  GEN include/generated/generic-asm-offsets.h
  CC  arch/arm/cpu/armv7/omap4/asm-offsets.s
  GEN include/generated/asm-offsets.h
  HOSTCC  scripts/basic/fixdep
   ...

You will find a difference at a glance: short log.
If you need detail log message, please add V=1.
(You can also use V=2)

Please note we can no longer use
  $ make omap4_panda CROSS_COMPILE=arm-linux-gnueabi-
to do board configuration and make at the same time.

Instead, we can use Kbuild-ish way for that purpose:
  $ make omap4_panda_config all CROSS_COMPILE=arm-linux-gnuabi-

This series keeps the other features:

  - Support out-of-tree build
 You can use O=dir_name like this
 $ mkdir build_dir
 $ make omap4_panda_config all O=build_dir CROSS_COMPILE=arm-linux-gnueabi-

  - Works with parallel make option
 Add -j option for this. Compiling will get faster.

  - Of cource, SPL, TPL build are supported
(nand_spl also works. But nand_spl is obsolete and we should switch to 
spl.
 Until when should we continue to maintain nand_spl?)

  - Breaks no boards (except some boards which are already broken)
 I built all target boards to prove correctness of this series
 at least for compile test.

 My Next Plan
 

  - Import Kconfig
  Use make config, make menuconfig, make defconfig, etc. in U-Boot.

  - More refactoring
  Some parts of makefiles are still dirty.
  I want to refactor more makefiles in follow-up patches.

  - Use obj-m for standalone program?? Loadable module??
  I have not deceided about this yet.

 Note
 

 - I marked dirty parts with FIX ME.

   In some board-specific config.mk files.
 # FIX ME
 ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
 ccflags-y := -O2
 endif

   In the top Makefile
 # FIX ME
 cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) 
$(NOSTDINC_FLAGS)
 c_flags := $(KBUILD_CFLAGS) $(cpp_flags)

   I will re-write them more nicely after other parts are prepared.

Changes for v7:
  - Fix a bug in spl build:
In v6, build failed if we try to build another SPL board
without doing make clobber.
For example,
  $ make omap3_beagle_config
  $ make CROSS_COMPILE=your_gcc_prefix
  $ make am335x_evm_config
  $ make CROSS_COMPILE=your_gcc_prefix
   

[U-Boot] [PATCH v7 18/38] kbuild: add dummy obj-y to create built-in.o

2014-01-24 Thread Masahiro Yamada
We are going to switch over to Kbuild in upcoming commits.

Each makefile must have non-empty obj- or obj-y
to generate built-in.o on Kbuild.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/armv7/tegra114/Makefile | 3 ++-
 arch/arm/cpu/armv7/tegra30/Makefile  | 3 ++-
 arch/nds32/cpu/n1213/Makefile| 3 +++
 board/freescale/common/Makefile  | 5 -
 board/samsung/origen/Makefile| 3 +++
 board/samsung/smdkv310/Makefile  | 3 +++
 board/spear/common/Makefile  | 5 -
 board/spear/x600/Makefile| 5 -
 8 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/armv7/tegra114/Makefile 
b/arch/arm/cpu/armv7/tegra114/Makefile
index 886b509..77e2319 100644
--- a/arch/arm/cpu/armv7/tegra114/Makefile
+++ b/arch/arm/cpu/armv7/tegra114/Makefile
@@ -17,4 +17,5 @@
 # along with this program.  If not, see http://www.gnu.org/licenses/.
 #
 
-obj- :=
+# necessary to create built-in.o
+obj- := __dummy__.o
diff --git a/arch/arm/cpu/armv7/tegra30/Makefile 
b/arch/arm/cpu/armv7/tegra30/Makefile
index 518d6d1..413eba1 100644
--- a/arch/arm/cpu/armv7/tegra30/Makefile
+++ b/arch/arm/cpu/armv7/tegra30/Makefile
@@ -17,4 +17,5 @@
 # along with this program.  If not, see http://www.gnu.org/licenses/.
 #
 
-obj- :=
+# necessary to create built-in.o
+obj- := __dummy__.o
diff --git a/arch/nds32/cpu/n1213/Makefile b/arch/nds32/cpu/n1213/Makefile
index bb3550e..206d304 100644
--- a/arch/nds32/cpu/n1213/Makefile
+++ b/arch/nds32/cpu/n1213/Makefile
@@ -9,4 +9,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+# necessary to create built-in.o
+obj- := __dummy__.o
+
 extra-y= start.o
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile
index 25f063d..f6a0879 100644
--- a/board/freescale/common/Makefile
+++ b/board/freescale/common/Makefile
@@ -13,7 +13,10 @@ MINIMAL=y
 endif
 endif
 
-ifndef MINIMAL
+ifdef MINIMAL
+# necessary to create built-in.o
+obj- := __dummy__.o
+else
 obj-$(CONFIG_FSL_CADMUS)   += cadmus.o
 obj-$(CONFIG_FSL_VIA)  += cds_via.o
 obj-$(CONFIG_FMAN_ENET)+= fman.o
diff --git a/board/samsung/origen/Makefile b/board/samsung/origen/Makefile
index 37acba7..1add9fe 100644
--- a/board/samsung/origen/Makefile
+++ b/board/samsung/origen/Makefile
@@ -5,6 +5,9 @@
 #
 
 ifdef CONFIG_SPL_BUILD
+# necessary to create built-in.o
+obj- := __dummy__.o
+
 hostprogs-y := tools/mkorigenspl
 always := $(hostprogs-y)
 
diff --git a/board/samsung/smdkv310/Makefile b/board/samsung/smdkv310/Makefile
index 9e37b4e..de0da16 100644
--- a/board/samsung/smdkv310/Makefile
+++ b/board/samsung/smdkv310/Makefile
@@ -5,6 +5,9 @@
 #
 
 ifdef CONFIG_SPL_BUILD
+# necessary to create built-in.o
+obj- := __dummy__.o
+
 hostprogs-y := tools/mksmdkv310spl
 always := $(hostprogs-y)
 else
diff --git a/board/spear/common/Makefile b/board/spear/common/Makefile
index 08dc09f..b0ba320 100644
--- a/board/spear/common/Makefile
+++ b/board/spear/common/Makefile
@@ -5,7 +5,10 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-ifndef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_BUILD
+# necessary to create built-in.o
+obj- := __dummy__.o
+else
 obj-y  := spr_misc.o
 obj-y  += spr_lowlevel_init.o
 endif
diff --git a/board/spear/x600/Makefile b/board/spear/x600/Makefile
index f9053fe..18d3dd2 100644
--- a/board/spear/x600/Makefile
+++ b/board/spear/x600/Makefile
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-ifndef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_BUILD
+# necessary to create built-in.o
+obj- := __dummy__.o
+else
 obj-y  := fpga.o x600.o
 endif
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 29/38] examples: move api/ and standalone/ entry to examples/Makefile

2014-01-24 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile | 5 +
 examples/Makefile| 9 +
 examples/api/Makefile| 4 
 examples/standalone/Makefile | 4 
 4 files changed, 10 insertions(+), 12 deletions(-)
 create mode 100644 examples/Makefile

diff --git a/Makefile b/Makefile
index 421a148..8654eb8 100644
--- a/Makefile
+++ b/Makefile
@@ -594,11 +594,8 @@ SUBDIRS = $(SUBDIR_TOOLS)
 
 .PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
 
-SUBDIR_EXAMPLES-y := examples/standalone
-SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
-ifndef CONFIG_SANDBOX
+SUBDIR_EXAMPLES-y := examples
 SUBDIRS += $(SUBDIR_EXAMPLES-y)
-endif
 
 #
 # U-Boot objectsorder is important (i.e. start must be first)
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 000..18d008e
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,9 @@
+ifndef CONFIG_SANDBOX
+
+ifdef FTRACE
+subdir-ccflags-y += -finstrument-functions -DFTRACE
+endif
+
+subdir-y += standalone
+subdir-$(CONFIG_API) += api
+endif
diff --git a/examples/api/Makefile b/examples/api/Makefile
index 8b79886..09475f8 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -4,10 +4,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-ifdef FTRACE
-ccflags-y += -finstrument-functions -DFTRACE
-endif
-
 ifeq ($(ARCH),powerpc)
 LOAD_ADDR = 0x4
 endif
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 90e173b..47c9d54 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -5,10 +5,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-ifdef FTRACE
-ccflags-y += -finstrument-functions -DFTRACE
-endif
-
 extra-y:= hello_world
 extra-$(CONFIG_SMC9)   += smc9_eeprom
 extra-$(CONFIG_SMC911X)+= smc911x_eeprom
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 09/38] Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile

2014-01-24 Thread Masahiro Yamada
BFD_ROOT_DIR is used only in tools/gdb/Makefile

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 config.mk  | 23 ---
 tools/gdb/Makefile | 21 +
 2 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/config.mk b/config.mk
index 74617d3..dfe81fa 100644
--- a/config.mk
+++ b/config.mk
@@ -220,29 +220,6 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),)
 LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
 endif
 
-# Location of a usable BFD library, where we define usable as
-# built for ${HOST}, supports ${TARGET}.  Sensible values are
-# - When cross-compiling: the root of the cross-environment
-# - Linux/ppc (native): /usr
-# - NetBSD/ppc (native): you lose ... (must extract these from the
-#   binutils build directory, plus the native and U-Boot include
-#   files don't like each other)
-#
-# So far, this is used only by tools/gdb/Makefile.
-
-ifeq ($(HOSTOS),darwin)
-BFD_ROOT_DIR = /usr/local/tools
-else
-ifeq ($(HOSTARCH),$(ARCH))
-# native
-BFD_ROOT_DIR = /usr
-else
-#BFD_ROOT_DIR =/LinuxPPC/CDK   # Linux/i386
-#BFD_ROOT_DIR =/usr/pkg/cross  # NetBSD/i386
-BFD_ROOT_DIR = /opt/powerpc
-endif
-endif
-
 #
 
 export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS 
CFLAGS AFLAGS
diff --git a/tools/gdb/Makefile b/tools/gdb/Makefile
index 850bb9b..4513320 100644
--- a/tools/gdb/Makefile
+++ b/tools/gdb/Makefile
@@ -10,6 +10,27 @@
 
 ifneq ($(HOSTOS),cygwin)
 
+# Location of a usable BFD library, where we define usable as
+# built for ${HOST}, supports ${TARGET}.  Sensible values are
+# - When cross-compiling: the root of the cross-environment
+# - Linux/ppc (native): /usr
+# - NetBSD/ppc (native): you lose ... (must extract these from the
+#   binutils build directory, plus the native and U-Boot include
+#   files don't like each other)
+
+ifeq ($(HOSTOS),darwin)
+BFD_ROOT_DIR = /usr/local/tools
+else
+ifeq ($(HOSTARCH),$(ARCH))
+# native
+BFD_ROOT_DIR = /usr
+else
+#BFD_ROOT_DIR =/LinuxPPC/CDK   # Linux/i386
+#BFD_ROOT_DIR =/usr/pkg/cross  # NetBSD/i386
+BFD_ROOT_DIR = /opt/powerpc
+endif
+endif
+
 #
 # Use native tools and options
 #
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 10/38] kbuild: import Kbuild.include from linux v3.13 tag

2014-01-24 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v7: None
Changes in v6:
  - Import from linux v3.13

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 scripts/Kbuild.include | 278 +
 1 file changed, 278 insertions(+)
 create mode 100644 scripts/Kbuild.include

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
new file mode 100644
index 000..547e15d
--- /dev/null
+++ b/scripts/Kbuild.include
@@ -0,0 +1,278 @@
+
+# kbuild: Generic definitions
+
+# Convenient variables
+comma   := ,
+squote  := '
+empty   :=
+space   := $(empty) $(empty)
+
+###
+# Name of target with a '.' as filename prefix. foo/bar.o = foo/.bar.o
+dot-target = $(dir $@).$(notdir $@)
+
+###
+# The temporary file to save gcc -MD generated dependencies must not
+# contain a comma
+depfile = $(subst $(comma),_,$(dot-target).d)
+
+###
+# filename of target with directory and extension stripped
+basetarget = $(basename $(notdir $@))
+
+###
+# filename of first prerequisite with directory and extension stripped
+baseprereq = $(basename $(notdir $))
+
+###
+# Escape single quote for use in echo statements
+escsq = $(subst $(squote),'\$(squote)',$1)
+
+###
+# Easy method for doing a status message
+   kecho := :
+ quiet_kecho := echo
+silent_kecho := :
+kecho := $($(quiet)kecho)
+
+###
+# filechk is used to check if the content of a generated file is updated.
+# Sample usage:
+# define filechk_sample
+#  echo $KERNELRELEASE
+# endef
+# version.h : Makefile
+#  $(call filechk,sample)
+# The rule defined shall write to stdout the content of the new file.
+# The existing file will be compared with the new one.
+# - If no file exist it is created
+# - If the content differ the new file is used
+# - If they are equal no change, and no timestamp update
+# - stdin is piped in from the first prerequisite ($) so one has
+#   to specify a valid file as first prerequisite (often the kbuild file)
+define filechk
+   $(Q)set -e; \
+   $(kecho) '  CHK $@';\
+   mkdir -p $(dir $@); \
+   $(filechk_$(1))  $  $@.tmp;  \
+   if [ -r $@ ]  cmp -s $@ $@.tmp; then  \
+   rm -f $@.tmp;   \
+   else\
+   $(kecho) '  UPD $@';\
+   mv -f $@.tmp $@;\
+   fi
+endef
+
+##
+# gcc support functions
+# See documentation in Documentation/kbuild/makefiles.txt
+
+# cc-cross-prefix
+# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
+# Return first prefix where a prefix$(CC) is found in PATH.
+# If no $(CC) found in PATH with listed prefixes return nothing
+cc-cross-prefix =  \
+   $(word 1, $(foreach c,$(1),   \
+   $(shell set -e;   \
+   if (which $(strip $(c))$(CC))  /dev/null 21 ; then \
+   echo $(c);\
+   fi)))
+
+# output directory for tests below
+TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
+
+# try-run
+# Usage: option = $(call try-run, $(CC)...-o $$TMP,option-ok,otherwise)
+# Exit code chooses option. $$TMP is can be used as temporary file and
+# is automatically cleaned up.
+try-run = $(shell set -e;  \
+   TMP=$(TMPOUT)..tmp;   \
+   TMPO=$(TMPOUT)..o;\
+   if ($(1)) /dev/null 21;  \
+   then echo $(2);   \
+   else echo $(3);   \
+   fi; \
+   rm -f $$TMP $$TMPO)
+
+# as-option
+# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
+
+as-option = $(call try-run,\
+   $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o 
$$TMP,$(1),$(2))
+
+# as-instr
+# Usage: cflags-y += $(call as-instr,instr,option1,option2)
+
+as-instr = $(call try-run,\
+   printf %b\n $(1) | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o 
$$TMP -,$(2),$(3))
+
+# cc-option
+# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
+
+cc-option = $(call try-run,\
+   $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o 
$$TMP,$(1),$(2))
+
+# cc-option-yn
+# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
+cc-option-yn = $(call try-run,\
+   $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o 
$$TMP,y,n)
+
+# cc-option-align
+# Prefix align with either -falign or -malign
+cc-option-align = $(subst -functions=0,,\
+   $(call cc-option,-falign-functions=0,-malign-functions=0))
+
+# cc-disable-warning
+# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
+cc-disable-warning = $(call try-run,\
+   $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c 
/dev/null -o $$TMP,-Wno-$(strip $(1)))
+
+# cc-version
+# Usage gcc-ver 

[U-Boot] [PATCH v7 02/38] Makefile.host.tmp: add a new script to refactor tools

2014-01-24 Thread Masahiro Yamada
This commit adds scripts/Makefile.host.tmp which will
be used in the next commit to convert makefiles
under tools/ directory to Kbuild style.

Notice this script, scripts/Makefile.host.tmp
is temporary.

When switching over to real Kbuild,
it will be replaced with scripts/Makefile.host of Linux Kernel.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 scripts/Makefile.build| 17 ++---
 scripts/Makefile.host.tmp | 61 +++
 2 files changed, 75 insertions(+), 3 deletions(-)
 create mode 100644 scripts/Makefile.host.tmp

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e3354aa..c451fbf 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -7,15 +7,23 @@ include $(TOPDIR)/config.mk
 LIB := $(obj)built-in.o
 LIBGCC = $(obj)libgcc.o
 SRCS :=
+subdir-y :=
+obj-dirs :=
 
 include Makefile
 
+# Do not include host rules unless needed
+ifneq ($(hostprogs-y)$(hostprogs-m),)
+include $(SRCTREE)/scripts/Makefile.host.tmp
+endif
+
 # Going forward use the following
 obj-y := $(sort $(obj-y))
 extra-y := $(sort $(extra-y))
+always := $(sort $(always))
 lib-y := $(sort $(lib-y))
 
-subdir-y   := $(patsubst %/,%,$(filter %/, $(obj-y)))
+subdir-y   += $(patsubst %/,%,$(filter %/, $(obj-y)))
 obj-y  := $(patsubst %/, %/built-in.o, $(obj-y))
 subdir-obj-y   := $(filter %/built-in.o, $(obj-y))
 subdir-obj-y   := $(addprefix $(obj),$(subdir-obj-y))
@@ -25,7 +33,8 @@ SRCS  += $(wildcard $(obj-y:.o=.c) $(obj-y:.o=.S) 
$(lib-y:.o=.c) \
 OBJS   := $(addprefix $(obj),$(obj-y))
 
 # $(obj-dirs) is a list of directories that contain object files
-obj-dirs := $(dir $(OBJS))
+
+obj-dirs += $(dir $(OBJS))
 
 # Create directories for object files if directory does not exist
 # Needed when obj-y := dir/file.o syntax is used
@@ -33,7 +42,7 @@ _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || 
mkdir -p $(d)))
 
 LGOBJS := $(addprefix $(obj),$(sort $(lib-y)))
 
-all: $(LIB) $(addprefix $(obj),$(extra-y))
+all: $(LIB) $(addprefix $(obj),$(extra-y) $(always)) $(subdir-y)
 
 $(LIB):$(obj).depend $(OBJS)
$(call cmd_link_o_target, $(OBJS))
@@ -48,7 +57,9 @@ endif
 ifneq ($(subdir-obj-y),)
 # Descending
 $(subdir-obj-y): $(subdir-y)
+endif
 
+ifneq ($(subdir-y),)
 $(subdir-y): FORCE
$(MAKE) -C $@ -f $(TOPDIR)/scripts/Makefile.build
 endif
diff --git a/scripts/Makefile.host.tmp b/scripts/Makefile.host.tmp
new file mode 100644
index 000..4b57846
--- /dev/null
+++ b/scripts/Makefile.host.tmp
@@ -0,0 +1,61 @@
+
+__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
+
+# C code
+# Executables compiled from a single .c file
+host-csingle   := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
+
+# C executables linked based on several .o files
+host-cmulti:= $(foreach m,$(__hostprogs),$(if $($(m)-objs),$(m)))
+
+# Object (.o) files compiled from .c files
+host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
+
+# output directory for programs/.o files
+# hostprogs-y := tools/build may have been specified. Retrieve directory
+host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f
+# directory of .o files from prog-objs notation
+host-objdirs += $(foreach f,$(host-cmulti),  \
+$(foreach m,$($(f)-objs),\
+$(if $(dir $(m)),$(dir $(m)
+
+host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs
+
+__hostprogs := $(addprefix $(obj),$(__hostprogs))
+host-csingle   := $(addprefix $(obj),$(host-csingle))
+host-cmulti:= $(addprefix $(obj),$(host-cmulti))
+host-cobjs := $(addprefix $(obj),$(host-cobjs))
+host-objdirs:= $(addprefix $(obj),$(host-objdirs))
+
+obj-dirs += $(host-objdirs)
+
+#
+# Handle options to gcc. Support building with separate output directory
+
+_hostc_flags   = $(HOSTCFLAGS)   $(HOST_EXTRACFLAGS)   \
+ $(HOSTCFLAGS_$(basetarget).o)
+
+# Find all -I options and call addtree
+flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
+
+ifeq ($(OBJTREE),$(SRCTREE))
+__hostc_flags  = $(_hostc_flags)
+else
+__hostc_flags  = -I$(obj) $(call flags,_hostc_flags)
+endif
+
+hostc_flags= $(__hostc_flags)
+
+#
+# Compile programs on the host
+
+$(host-csingle): $(obj)%: %.c
+   $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTLDFLAGS) 
$(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $
+
+$(host-cmulti): $(obj)%: $(host-cobjs)
+   $(HOSTCC) $(HOSTLDFLAGS) -o $@ $(addprefix $(obj),$($(@F)-objs)) 
$(HOSTLOADLIBES_$(@F))
+
+$(host-cobjs): $(obj)%.o: %.c
+   $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(@F)) 
$(HOSTCFLAGS_$(BCURDIR)) -o $@ $ -c
+
+targets += $(host-csingle)  $(host-cmulti) $(host-cobjs)
-- 
1.8.3.2

___
U-Boot 

[U-Boot] [PATCH v7 36/38] board: sandburst: delete FORCEBUILD

2014-01-24 Thread Masahiro Yamada
We had switched to Kbuild, so we do not need to
delete sandburst board files at every build.

U-Boot conventional build system did not check the
update of command line option, -DBUILDUSER.

Kbuild can handle it nicely and re-builds object files
when command line options are changed.
(The file .*.cmd stores the information how the file
was generated at the previous build.)

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
  - Newly added

Changes in v2: None

 board/sandburst/karef/Makefile| 6 +-
 board/sandburst/metrobox/Makefile | 6 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/board/sandburst/karef/Makefile b/board/sandburst/karef/Makefile
index d5a9b34..ce29b41 100644
--- a/board/sandburst/karef/Makefile
+++ b/board/sandburst/karef/Makefile
@@ -10,11 +10,7 @@
 #
 
 # TBS: add for debugging purposes
-BUILDUSER := $(shell whoami)
-FORCEBUILD := $(shell rm -f karef.o)
-
-ccflags-y += -DBUILDUSER='$(BUILDUSER)'
-# TBS: end debugging
+ccflags-y += -DBUILDUSER='$(shell whoami)'
 
 obj-y  = karef.o ../common/flash.o ../common/sb_common.o
 extra-y+= init.o
diff --git a/board/sandburst/metrobox/Makefile 
b/board/sandburst/metrobox/Makefile
index 8121cce..2c1028b 100644
--- a/board/sandburst/metrobox/Makefile
+++ b/board/sandburst/metrobox/Makefile
@@ -9,11 +9,7 @@
 #
 
 # TBS: add for debugging purposes
-BUILDUSER := $(shell whoami)
-FORCEBUILD := $(shell rm -f metrobox.o)
-
-ccflags-y += -DBUILDUSER='$(BUILDUSER)'
-# TBS: end debugging
+ccflags-y += -DBUILDUSER='$(shell whoami)'
 
 obj-y  = metrobox.o ../common/flash.o ../common/sb_common.o
 extra-y+= init.o
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 33/38] kbuild: use scripts/Makefile.clean

2014-01-24 Thread Masahiro Yamada
This commit refactors cleaning targets such as
clean, clobber, mrpropper, distclean
with scripts/Makefile.clean.

By using scripts/Makefile.clean, we can recursively descend
into subdirectories and delete generated files there.

We do not need add a big list of generated files
to the clean target.

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

We can delete ugly stuff like follows:

  clean:
@rm -f examples/standalone/atmel_df_pow2  \
   examples/standalone/hello_world\
   examples/standalone/interrupt  \
   examples/standalone/mem_to_mem_idma2intr   \
   examples/standalone/sched  \
   $(addprefix examples/standalone/, smc9_eeprom 
smc911x_eeprom) \
   examples/standalone/test_burst \
   examples/standalone/timer
@rm -f $(addprefix examples/api/, demo demo.bin)
@rm -f tools/bmp_logo  tools/easylogo/easylogo\
   tools/env/fw_printenv  \
   tools/envcrc   \
   $(addprefix tools/gdb/, gdbcont gdbsend)   \
   tools/gen_eth_addrtools/img2srec   \
   tools/dumpimage\
   $(addprefix tools/, mkenvimage mkimage)\
   tools/mpc86x_clk   \
   $(addprefix tools/, mk$(BOARD)spl mkexynosspl) \
   tools/mxsboot  \
   tools/ncb   tools/ubsha1   \
   tools/kernel-doc/docproc   \
   tools/proftool
@rm -f $(addprefix board/cray/L1/, bootscript.c bootscript.image) \
   board/matrix_vision/*/bootscript.img   \
   spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl \
   u-boot.lds \
   $(addprefix arch/blackfin/cpu/, init.lds init.elf)
   $(obj)arch/blackfin/cpu/init.{lds,elf}

By the way, I am keeping make clobber for now.
Do we need make clobber?
If we like 3-level cleaning targets, clean, mrproper, distclean,
like Linux Kernel, we can squash clobber to clean.


Changes in v7: None
Changes in v6: None
Changes in v5:
  - Remove *.imx and *.map files by pattern matching.
  - Remove u-boot.elf

Changes in v4: None
Changes in v3: None
Changes in v2:
  - Rebase on v2014.01-rc2 tag

 Makefile   | 188 +
 arch/blackfin/cpu/Makefile |   1 +
 board/cray/L1/Makefile |   2 +
 dts/Makefile   |  12 +--
 scripts/Makefile   |   2 +
 scripts/Makefile.clean |   4 +
 6 files changed, 121 insertions(+), 88 deletions(-)
 create mode 100644 scripts/Makefile

diff --git a/Makefile b/Makefile
index 506fd51..0f78418 100644
--- a/Makefile
+++ b/Makefile
@@ -1112,93 +1112,106 @@ include/license.h: tools/bin2header COPYING
cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip  
include/license.h
 #
 
+###
+# Cleaning is done on three levels.
+# make clean Delete most generated files
+#Leave enough to build external modules
+# make mrproper  Delete the current configuration, and all generated files
+# make distclean Remove editor backup files, patch leftover files and the like
+
+# Directories  files removed with 'make clean'
+CLEAN_DIRS  += $(MODVERDIR)
+CLEAN_FILES += u-boot.lds include/bmp_logo.h include/bmp_logo_data.h \
+   board/*/config.tmp board/*/*/config.tmp dts/*.tmp \
+   include/autoconf.mk include/autoconf.mk.dep \
+   include/spl-autoconf.mk include/tpl-autoconf.mk
+
+# Directories  files removed with 'make clobber'
+CLOBBER_DIRS  += tpl \
+$(patsubst %/,spl/%, $(filter-out Makefile, $(filter %/, \
+   $(shell ls -1 --file-type spl 2/dev/null
+CLOBBER_FILES += u-boot u-boot.elf u-boot.hex u-boot.img  \
+u-boot.kwb u-boot.pbl u-boot.ldr \
+u-boot.ubl u-boot.ais u-boot.dtb \
+u-boot.sb u-boot.spr MLO MLO.byteswap SPL \
+$(patsubst %,spl/%, $(filter-out Makefile %/, \
+   $(shell ls -1 --file-type spl 2/dev/null))) \
+$(addprefix nand_spl/, u-boot.lds u-boot.lst \
+u-boot-nand_spl.lds u-boot-spl)
+
+# Directories  files removed with 'make mrproper'
+MRPROPER_DIRS  += include/config include/generated
+MRPROPER_FILES += .config .config.old \
+   

[U-Boot] [PATCH v7 25/38] kbuild: move include directives of board configuration files

2014-01-24 Thread Masahiro Yamada
This commit changes the location of include directives
of board configuration files.

The purpose of this change is:
 - Slim down $(TOPDIR)/config.mk
 - Prevent $(TOPDIR)/Makefile from including the same
configuration file twice
 - Do not include include/config.mk multiple times
because ARCH, CPU, BOARD, VENDOR, SOC are exported

Before this commit:

 - include/autoconf.mk was included from $(TOPDIR)/Makefile
   and $(TOPDIR)/config.mk
   (This means $(TOPDIR)/Makefile included include/autoconf.mk twice)

 - include/{spl,tpl}-autoconf.mk was included from $(TOPDIR)/config.mk

 - include/config.mk was included from $(TOPDIR)/Makefile
   and $(TOPDIR)/config.mk
   (This means $(TOPDIR)/Makefile included include/config.mk twice)

After this commit:

 - include/autoconf.mk is included from $(TOPDIR)/Makefile
   and $(TOPDIR)/scripts/Makefile.build

 - include/{spl,tpl}-autoconf.mk is included from $(TOPDIR)/spl/Makefile
   and $(TOPDIR)/scripts/Makefile.build

 - include/config.mk is included from $(TOPDIR)/config.mk and
   $(TOPDIR)/spl/Makefile

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 config.mk  | 15 ---
 scripts/Makefile.build | 11 +++
 spl/Makefile   |  8 
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/config.mk b/config.mk
index 1336ef8..5b886aa 100644
--- a/config.mk
+++ b/config.mk
@@ -13,21 +13,6 @@ PLATFORM_LDFLAGS =
 
 #
 
-# Load generated board configuration
-ifeq ($(CONFIG_TPL_BUILD),y)
-# Include TPL autoconf
-sinclude include/tpl-autoconf.mk
-else
-ifeq ($(CONFIG_SPL_BUILD),y)
-# Include SPL autoconf
-sinclude include/spl-autoconf.mk
-else
-# Include normal autoconf
-sinclude include/autoconf.mk
-endif
-endif
-sinclude $(OBJTREE)/include/config.mk
-
 # Some architecture config.mk files need to know what CPUDIR is set to,
 # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
 # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 921fbbf..f37957f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -42,6 +42,17 @@ subdir-ccflags-y :=
 # Read auto.conf if it exists, otherwise ignore
 -include include/config/auto.conf
 
+# Added for U-Boot: Load U-Boot configuration
+ifeq ($(CONFIG_TPL_BUILD),y)
+  -include include/tpl-autoconf.mk
+else
+  ifeq ($(CONFIG_SPL_BUILD),y)
+-include include/spl-autoconf.mk
+  else
+-include include/autoconf.mk
+  endif
+endif
+
 include scripts/Kbuild.include
 # Modified for U-Boot
 #  We must include config.mk after Kbuild.include:
diff --git a/spl/Makefile b/spl/Makefile
index 705dae3..3fe89cc 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -38,6 +38,14 @@ else
 SPL_BIN := u-boot-spl
 endif
 
+include include/config.mk
+
+ifeq ($(CONFIG_TPL_BUILD),y)
+  -include include/tpl-autoconf.mk
+else
+  -include include/spl-autoconf.mk
+endif
+
 include $(srctree)/scripts/Kbuild.include
 
 include $(TOPDIR)/config.mk
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 07/38] Makfile: move suffix rules to Makefile.build

2014-01-24 Thread Masahiro Yamada
This commit moves suffix rules from config.mk
to scripts/Makefile.build, which will allow us
to switch smoothly to real Kbuild.

Note1:
post/lib_powerpc/fpu/Makefile has
its own rule to compile C sources.
We need to tweak it to keep the same behavior.

Note2:
There are two file2 with the same name:
arch/arm/lib/crt0.S and eamples/api/crt0.S.
To keep the same build behavior,
examples/api/Makefile also has to be treaked.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 config.mk | 35 ---
 examples/api/Makefile |  4 ++--
 post/lib_powerpc/fpu/Makefile |  2 +-
 scripts/Makefile.build| 31 +++
 4 files changed, 34 insertions(+), 38 deletions(-)

diff --git a/config.mk b/config.mk
index 07afb35..b08be7a 100644
--- a/config.mk
+++ b/config.mk
@@ -318,38 +318,3 @@ endif
 export HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE \
AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
 export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS 
CFLAGS AFLAGS
-
-#
-
-# Allow boards to use custom optimize flags on a per dir/file basis
-ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
-ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
-EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
-ALL_CFLAGS += $(EXTRA_CPPFLAGS)
-
-# The _DEP version uses the $ file target (for dependency generation)
-# See rules.mk
-EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $))) \
-   $(CPPFLAGS_$(BCURDIR))
-$(obj)%.s: %.S
-   $(CPP) $(ALL_AFLAGS) -o $@ $
-$(obj)%.o: %.S
-   $(CC)  $(ALL_AFLAGS) -o $@ $ -c
-$(obj)%.o: %.c
-ifneq ($(CHECKSRC),0)
-   $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $
-endif
-   $(CC)  $(ALL_CFLAGS) -o $@ $ -c
-$(obj)%.i: %.c
-   $(CPP) $(ALL_CFLAGS) -o $@ $ -c
-$(obj)%.s: %.c
-   $(CC)  $(ALL_CFLAGS) -o $@ $ -c -S
-
-#
-
-# If the list of objects to link is empty, just create an empty built-in.o
-cmd_link_o_target = $(if $(strip $1),\
- $(LD) $(LDFLAGS) -r -o $@ $1,\
- rm -f $@; $(AR) rcs $@ )
-
-#
diff --git a/examples/api/Makefile b/examples/api/Makefile
index f770859..52f4368 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -50,9 +50,9 @@ $(obj)demo.bin: $(obj)demo
$(OBJCOPY) -O binary $ $@ 2/dev/null
 
 # Rule to build generic library C files
-$(obj)%.o: $(SRCTREE)/lib/%.c
+$(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y))): $(obj)%.o: 
$(SRCTREE)/lib/%.c
$(CC) -g $(CFLAGS) -c -o $@ $
 
 # Rule to build architecture-specific library assembly files
-$(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
+$(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y))): $(obj)%.o: 
$(SRCTREE)/arch/$(ARCH)/lib/%.S
$(CC) -g $(CFLAGS) -c -o $@ $
diff --git a/post/lib_powerpc/fpu/Makefile b/post/lib_powerpc/fpu/Makefile
index ae56a82..a7aa5bc 100644
--- a/post/lib_powerpc/fpu/Makefile
+++ b/post/lib_powerpc/fpu/Makefile
@@ -18,7 +18,7 @@ obj-y += darwin-ldouble.o
 CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//)
 CFLAGS += -mhard-float -fkeep-inline-functions
 
-$(obj)%.o: %.c
+$(addprefix $(obj),$(obj-y)): $(obj)%.o:   %.c
$(CC)  $(ALL_CFLAGS) -o $@.fp $ -c
$(OBJCOPY) -R .gnu.attributes $@.fp $@
rm -f $@.fp
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 50c0394..1b3d77f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -67,6 +67,37 @@ endif
 
 #
 
+# Allow boards to use custom optimize flags on a per dir/file basis
+ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
+ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
+EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
+ALL_CFLAGS += $(EXTRA_CPPFLAGS)
+
+# The _DEP version uses the $ file target (for dependency generation)
+# See rules.mk
+EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $))) \
+   $(CPPFLAGS_$(BCURDIR))
+$(obj)%.s: %.S
+   $(CPP) $(ALL_AFLAGS) -o $@ $
+$(obj)%.o: %.S
+   $(CC)  $(ALL_AFLAGS) -o $@ $ -c
+$(obj)%.o: %.c
+ifneq ($(CHECKSRC),0)
+   $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $
+endif
+   $(CC)  $(ALL_CFLAGS) -o $@ $ -c
+$(obj)%.i: %.c
+   $(CPP) $(ALL_CFLAGS) -o $@ $ -c
+$(obj)%.s: %.c
+   $(CC)  $(ALL_CFLAGS) -o $@ $ -c -S
+
+# If the list of objects to link is empty, just create an empty built-in.o
+cmd_link_o_target = $(if 

[U-Boot] [PATCH v7 35/38] kbuild: check clean source and generate Makefile for out-of-tree build

2014-01-24 Thread Masahiro Yamada
For out-of-tree build
  - Check if the source tree is clean
  - Create a Makefile in the output directory

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
  - Newly added

 Makefile | 63 +--
 1 file changed, 57 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 73bea4b..0e35f4f 100644
--- a/Makefile
+++ b/Makefile
@@ -392,6 +392,17 @@ scripts_basic:
 # To avoid any implicit rule to kick in, define an empty command.
 scripts/basic/%: scripts_basic ;
 
+PHONY += outputmakefile
+# outputmakefile generates a Makefile in the output directory, if using a
+# separate output directory. This allows convenient use of make in the
+# output directory.
+outputmakefile:
+ifneq ($(KBUILD_SRC),)
+   $(Q)ln -fsn $(srctree) source
+   $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
+   $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+endif
+
 # To make sure we do not include .config for any of the *config targets
 # catch them early, and hand them over to scripts/kconfig/Makefile
 # It is allowed to specify more targets when calling make, including
@@ -449,7 +460,7 @@ ifeq ($(config-targets),1)
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
 
-%_config::
+%_config:: outputmakefile
@$(MKCONFIG) -A $(@:_config=)
 
 else
@@ -952,7 +963,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 scripts_basic
+$(u-boot-dirs): depend prepare
$(Q)$(MAKE) $(build)=$@
 
 tools: $(TIMESTAMP_FILE) $(VERSION_FILE)
@@ -963,19 +974,56 @@ $(filter-out tools, $(u-boot-dirs)): tools
 examples: $(filter-out examples, $(u-boot-dirs))
 
 
+# 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.
+# archprepare is used in arch Makefiles and when processed asm symlink,
+# version.h and scripts_basic is processed / created.
+
+# Listed in dependency order
+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:
+ifneq ($(KBUILD_SRC),)
+   @$(kecho) '  Using $(srctree) as source for u-boot'
+   $(Q)if [ -f $(srctree)/include/config.mk ]; then \
+   echo 2   $(srctree) is not clean, please run 'make 
mrproper'; \
+   echo 2   in the '$(srctree)' directory.;\
+   /bin/false; \
+   fi;
+endif
+
+# prepare2 creates a makefile if using a separate output directory
+prepare2: prepare3 outputmakefile
+
+prepare1: prepare2
+   @:
+
+archprepare: prepare1 scripts_basic
+
+prepare0: archprepare FORCE
+   @:
+
+# All the preparing..
+prepare: prepare0
+
+
 u-boot.lds: $(LDSCRIPT) depend
$(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - $ 
$@
 
-nand_spl:  $(TIMESTAMP_FILE) $(VERSION_FILE) depend scripts_basic
+nand_spl:  $(TIMESTAMP_FILE) $(VERSION_FILE) depend 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 scripts_basic
+spl/u-boot-spl.bin: tools depend prepare 
$(MAKE) obj=spl -f $(srctree)/spl/Makefile all
 
-tpl/u-boot-tpl.bin: tools depend scripts_basic
+tpl/u-boot-tpl.bin: tools depend prepare
$(MAKE) obj=tpl -f $(srctree)/spl/Makefile all 
CONFIG_TPL_BUILD=y
 
 # Explicitly make _depend in subdirs containing multiple targets to prevent
@@ -1225,7 +1273,10 @@ backup:
F=`basename $(TOPDIR)` ; cd .. ; \
gtar --force-local -zcvf `LC_ALL=C date +$$F-%Y-%m-%d-%T.tar.gz` $$F
 
-#
+# Dummies...
+PHONY += prepare scripts
+prepare: ;
+scripts: ;
 
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 14/38] Makefile: move more stuff to top Makefile

2014-01-24 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile  | 20 +---
 config.mk | 19 +--
 2 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index 9c39022..b24b425 100644
--- a/Makefile
+++ b/Makefile
@@ -281,13 +281,27 @@ endif
 # load other configuration
 include $(TOPDIR)/config.mk
 
+ifneq ($(CONFIG_SYS_TEXT_BASE),)
+KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
+endif
+
+export CONFIG_SYS_TEXT_BASE
+
+LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
+ifneq ($(CONFIG_SYS_TEXT_BASE),)
+LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
+endif
+
 # Targets which don't build the source code
-NON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig
+NON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig 
%_config
 
 # Only do the generic board check when actually building, not configuring
 ifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
-ifeq ($(findstring _config,$(MAKECMDGOALS)),)
-$(CHECK_GENERIC_BOARD)
+ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
+ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
+CHECK_GENERIC_BOARD = $(error Your architecture does not support generic 
board. \
+Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
+endif
 endif
 endif
 
diff --git a/config.mk b/config.mk
index f700ee1..54d1d8b 100644
--- a/config.mk
+++ b/config.mk
@@ -102,10 +102,6 @@ CPPFLAGS += -ffunction-sections -fdata-sections
 LDFLAGS_FINAL += --gc-sections
 endif
 
-ifneq ($(CONFIG_SYS_TEXT_BASE),)
-CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
-endif
-
 ifeq ($(CONFIG_SPL_BUILD),y)
 CPPFLAGS += -DCONFIG_SPL_BUILD
 ifeq ($(CONFIG_TPL_BUILD),y)
@@ -113,14 +109,6 @@ CPPFLAGS += -DCONFIG_TPL_BUILD
 endif
 endif
 
-# Does this architecture support generic board init?
-ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
-ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
-CHECK_GENERIC_BOARD = $(error Your architecture does not support generic 
board. \
-Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
-endif
-endif
-
 CPPFLAGS += $(UBOOTINCLUDE)
 CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
 
@@ -141,11 +129,6 @@ AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
 LDFLAGS += $(PLATFORM_LDFLAGS)
 LDFLAGS_FINAL += -Bstatic
 
-LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
-ifneq ($(CONFIG_SYS_TEXT_BASE),)
-LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
-endif
-
 LDFLAGS_$(SPL_BIN) += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SPL_TEXT_BASE),)
 LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
@@ -153,4 +136,4 @@ endif
 
 #
 
-export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS 
CFLAGS AFLAGS
+export PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 13/38] Makefile: refactor include path settings

2014-01-24 Thread Masahiro Yamada
This commit merges commonly-used header include paths
to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed
at the top Makefile.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile   | 14 +-
 config.mk  | 11 ++-
 tools/Makefile |  8 +++-
 tools/env/Makefile |  4 +---
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index 3a97483..9c39022 100644
--- a/Makefile
+++ b/Makefile
@@ -226,6 +226,15 @@ CHECK  = sparse
 CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
 
+# Use UBOOTINCLUDE when you must reference the include/ directory.
+# Needed to be compatible with the O= option
+UBOOTINCLUDE:=
+ifneq ($(OBJTREE),$(SRCTREE))
+UBOOTINCLUDE   += -I$(OBJTREE)/include
+endif
+UBOOTINCLUDE   += -I$(srctree)/include \
+   -I$(srctree)/arch/$(ARCH)/include
+
 KBUILD_CPPFLAGS := -D__KERNEL__
 
 KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
@@ -238,7 +247,7 @@ export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
 export MAKE AWK
 export DTC CHECK CHECKFLAGS
 
-export KBUILD_CPPFLAGS
+export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
 export KBUILD_CFLAGS KBUILD_AFLAGS
 
 KBUILD_CFLAGS += -Os #-fomit-frame-pointer
@@ -254,6 +263,9 @@ KBUILD_CFLAGS   += -g
 # option to the assembler.
 KBUILD_AFLAGS  += -g
 
+NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+CHECKFLAGS += $(NOSTDINC_FLAGS)
+
 # Report stack usage if supported
 KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
 
diff --git a/config.mk b/config.mk
index 04b63f6..f700ee1 100644
--- a/config.mk
+++ b/config.mk
@@ -94,8 +94,6 @@ RELFLAGS= $(PLATFORM_RELFLAGS)
 
 OBJCFLAGS += --gap-fill=0xff
 
-gccincdir := $(shell $(CC) -print-file-name=include)
-
 CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
 
 # Enable garbage collection of un-used sections for SPL
@@ -123,13 +121,8 @@ Please undefined CONFIG_SYS_GENERIC_BOARD in your board 
config file)
 endif
 endif
 
-ifneq ($(OBJTREE),$(SRCTREE))
-CPPFLAGS += -I$(OBJTREE)/include
-endif
-
-CPPFLAGS += -I$(TOPDIR)/include -I$(SRCTREE)/arch/$(ARCH)/include
-CPPFLAGS += -nostdinc  \
-   -isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
+CPPFLAGS += $(UBOOTINCLUDE)
+CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
 
 CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
 
diff --git a/tools/Makefile b/tools/Makefile
index c3cdaf0..21341b7 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -175,11 +175,9 @@ HOSTSRCS += $(addprefix 
$(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
 # Define _GNU_SOURCE to obtain the getline prototype from stdio.h
 #
 HOST_EXTRACFLAGS += -include $(SRCTREE)/include/libfdt_env.h \
-   -idirafter $(SRCTREE)/include \
-   -idirafter $(SRCTREE)/arch/$(ARCH)/include \
-   -idirafter $(OBJTREE)/include \
-   -I $(SRCTREE)/lib/libfdt \
-   -I $(SRCTREE)/tools \
+   $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
+   -I$(SRCTREE)/lib/libfdt \
+   -I$(SRCTREE)/tools \
-DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \
-DUSE_HOSTCC \
-D__KERNEL_STRICT_NAMES \
diff --git a/tools/env/Makefile b/tools/env/Makefile
index c303815..d47fe16 100644
--- a/tools/env/Makefile
+++ b/tools/env/Makefile
@@ -6,9 +6,7 @@
 #
 
 # Compile for a hosted environment on the target
-HOST_EXTRACFLAGS  = -idirafter $(SRCTREE)/include \
-   -idirafter $(SRCTREE)/arch/$(ARCH)/include \
-   -idirafter $(OBJTREE)/include \
+HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
-idirafter $(SRCTREE)/tools/env \
-DUSE_HOSTCC \
-DTEXT_BASE=$(TEXT_BASE)
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 24/38] kbuild: convert some make rules to Kbuild style

2014-01-24 Thread Masahiro Yamada
We can get Kbuild-ish log style like this:
  GEN include/autoconf.mk
  GEN include/autoconf.mk.dep

We do not need XECHO any more.

And also change checkstack target like Linux Kernel.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
  - Change checkstack target

Changes in v3: None
Changes in v2: None

 Makefile | 77 
 1 file changed, 43 insertions(+), 34 deletions(-)

diff --git a/Makefile b/Makefile
index baa7b3d..7af404a 100644
--- a/Makefile
+++ b/Makefile
@@ -202,12 +202,6 @@ export HOSTARCH HOSTOS
 VENDOR=
 
 #
-# Allow for silent builds
-ifeq (,$(findstring s,$(MAKEFLAGS)))
-XECHO = echo
-else
-XECHO = :
-endif
 
 # The tools are needed early, so put this first
 # Don't include stuff already done in $(LIBS)
@@ -909,10 +903,11 @@ TAG_SUBDIRS += include
 FIND := find
 FINDFLAGS := -L
 
+PHONY += checkstack
+
 checkstack:
-   $(CROSS_COMPILE)objdump -d u-boot \
-   `$(FIND) . -name u-boot-spl -print` | \
-   perl $(src)/scripts/checkstack.pl $(ARCH)
+   $(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) \
@@ -962,52 +957,63 @@ checkdtc:
 # This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
 # the dep file is only include in this top level makefile to determine when
 # to regenerate the autoconf.mk file.
+
+quiet_cmd_autoconf_dep = GEN $@
+  cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
+   -MQ include/autoconf.mk $(srctree)/include/common.h  $@ || rm $@
+
 include/autoconf.mk.dep: include/config.h include/common.h
-   @$(XECHO) Generating $@ ; \
-   : Generate the dependancies ; \
-   $(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
-   -MQ include/autoconf.mk $(srctree)/include/common.h  $@ || \
-   rm $@
+   $(call cmd,autoconf_dep)
 
-include/autoconf.mk: include/config.h
-   @$(XECHO) Generating $@ ; \
-   : Extract the config macros ; \
+quiet_cmd_autoconf = GEN $@
+  cmd_autoconf = \
$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h  
$@.tmp  \
-   sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp  $@; \
+   sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp  $@; \
rm $@.tmp
 
+include/autoconf.mk: include/config.h
+   $(call cmd,autoconf)
+
 # Auto-generate the spl-autoconf.mk file (which is included by all makefiles 
for SPL)
-include/tpl-autoconf.mk: include/config.h
-   @$(XECHO) Generating $@ ; \
-   : Extract the config macros ; \
+quiet_cmd_tpl-autoconf = GEN $@
+  cmd_tpl-autoconf = \
$(CPP) $(c_flags) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
-DDO_DEPS_ONLY -dM $(srctree)/include/common.h  $@.tmp 
 \
sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp  $@; \
rm $@.tmp
 
-include/spl-autoconf.mk: include/config.h
-   @$(XECHO) Generating $@ ; \
-   : Extract the config macros ; \
+include/tpl-autoconf.mk: include/config.h
+   $(call cmd,tpl-autoconf)
+
+quiet_cmd_spl-autoconf = GEN $@
+  cmd_spl-autoconf = \
$(CPP) $(c_flags) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM 
$(srctree)/include/common.h  $@.tmp  \
sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp  $@; \
rm $@.tmp
 
+include/spl-autoconf.mk: include/config.h
+   $(call cmd,spl-autoconf)
+
+quiet_cmd_offsets = GEN $@
+  cmd_offsets = $(srctree)/tools/scripts/make-asm-offsets $ $@
+
 include/generated/generic-asm-offsets.h: lib/asm-offsets.s
-   @$(XECHO) Generating $@
-   $(srctree)/tools/scripts/make-asm-offsets lib/asm-offsets.s $@
+   $(call cmd,offsets)
 
-lib/asm-offsets.s: include/config.h $(srctree)/lib/asm-offsets.c
-   @mkdir -p lib
-   $(CC) -DDO_DEPS_ONLY \
+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 $@ $(srctree)/lib/asm-offsets.c -c -S
+   -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
-   @$(XECHO) Generating $@
-   $(srctree)/tools/scripts/make-asm-offsets 
$(CPUDIR)/$(SOC)/asm-offsets.s $@
+   $(call cmd,offsets)
 
-$(CPUDIR)/$(SOC)/asm-offsets.s:include/config.h
-   @mkdir -p $(CPUDIR)/$(SOC)
+quiet_cmd_soc_asm-offsets.s = CC  $@
+  cmd_soc_asm-offsets.s = mkdir -p $(CPUDIR)/$(SOC); \
if [ -f 

[U-Boot] [PATCH v7 19/38] Makefile: rename scripts/Makefile.build to scripts/Makefile.build.tmp

2014-01-24 Thread Masahiro Yamada
Some build scripts including scripts/Makefile.build
will be imported from Linux Kernel in the next commit.
We need to adjust them for U-Boot in the following commits.

To make it easier for reviewers to track the modification,
this commit renames scripts/Makefile.build to
scripts/Makefile.build.tmp beforehand.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 scripts/Kbuild.include | 2 +-
 scripts/{Makefile.build = Makefile.build.tmp} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename scripts/{Makefile.build = Makefile.build.tmp} (100%)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 6113c13..30a5551 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -165,7 +165,7 @@ ar-option = $(call try-run, $(AR) rc$(1) $$TMP,$(1),$(2))
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
 # Usage:
 # $(Q)$(MAKE) $(build)=dir
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
 
 ###
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
diff --git a/scripts/Makefile.build b/scripts/Makefile.build.tmp
similarity index 100%
rename from scripts/Makefile.build
rename to scripts/Makefile.build.tmp
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 32/38] Makefile: refactor tools-all targets

2014-01-24 Thread Masahiro Yamada
 - Move easylogo, gdb tagets to tools/Makefile
 - Delete gdbtools target (same as gdb)

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

Changes in v7: None
Changes in v6: None
Changes in v5:
 - Revive env target

Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile   | 8 +++-
 tools/Makefile | 8 +++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 7ca56bf..506fd51 100644
--- a/Makefile
+++ b/Makefile
@@ -1094,16 +1094,14 @@ $(TIMESTAMP_FILE):
@LC_ALL=C date +'#define U_BOOT_TIME %T'  $@.tmp
@cmp -s $@ $@.tmp  rm -f $@.tmp || mv -f $@.tmp $@
 
-easylogo env gdb:
+env: depend scripts_basic
$(Q)$(MAKE) $(build)=tools/$@
 
-gdbtools: gdb
-
 xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
$(Q)$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) $(build)=doc/DocBook $@
 
-tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
-   $(Q)$(MAKE) $(build)=tools HOST_TOOLS_ALL=y
+tools-all: HOST_TOOLS_ALL=y
+tools-all: env tools ;
 
 .PHONY : CHANGELOG
 CHANGELOG:
diff --git a/tools/Makefile b/tools/Makefile
index 70a3fc2..783e643 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -24,6 +24,9 @@ CONFIG_NETCONSOLE = y
 CONFIG_SHA1_CHECK_UB_IMG = y
 endif
 
+subdir-$(HOST_TOOLS_ALL) += easylogo
+subdir-$(HOST_TOOLS_ALL) += gdb
+
 # Merge all the different vars for envcrc into one
 ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y
 ENVCRC-$(CONFIG_ENV_IS_IN_DATAFLASH) = y
@@ -180,10 +183,13 @@ HOST_EXTRACFLAGS += -include 
$(SRCTREE)/include/libfdt_env.h \
 
 __build:   $(LOGO-y)
 
-subdir-y := kernel-doc
+subdir-y += kernel-doc
 
 $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-info $(LOGO_BMP)  $@
 
 $(LOGO_DATA_H):$(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-data $(LOGO_BMP)  $@
+
+# Let clean descend into subdirs
+subdir- += env
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 22/38] kbuild: delete temporary build scripts

2014-01-24 Thread Masahiro Yamada
We had switched to Kbuild.
We do not need old build scripts any more.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 rules.mk   |  47 -
 scripts/Makefile.build.tmp | 127 -
 scripts/Makefile.host.tmp  |  61 --
 3 files changed, 235 deletions(-)
 delete mode 100644 rules.mk
 delete mode 100644 scripts/Makefile.build.tmp
 delete mode 100644 scripts/Makefile.host.tmp

diff --git a/rules.mk b/rules.mk
deleted file mode 100644
index e4fd337..000
--- a/rules.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2006-2013
-# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
-#
-# SPDX-License-Identifier: GPL-2.0+
-#
-#
-
-_depend:   $(obj)/.depend
-
-# Split the source files into two camps: those in the current directory, and
-# those somewhere else. For the first camp we want to support CPPFLAGS_fname
-# and for the second we don't / can't.
-PWD_SRCS := $(foreach f,$(SRCS), $(if \
-   $(filter $(if $(KBUILD_SRC),$(srctree)/)$(src)/$(notdir $f),$f), $f))
-OTHER_SRCS := $(filter-out $(PWD_SRCS),$(SRCS))
-
-# This is a list of dependency files to generate
-DEPS := $(basename $(addprefix $(obj)/.depend., $(notdir $(PWD_SRCS
-
-# Join all the dependencies into a single file, in three parts
-#  1 .Concatenate all the generated depend files together
-#  2. Add in the deps from OTHER_SRCS which we couldn't process
-#  3. Add in the HOSTSRCS
-$(obj)/.depend:$(TOPDIR)/config.mk $(DEPS) $(OTHER_SRCS) \
-   $(HOSTSRCS)
-   cat /dev/null $(DEPS) $@
-   @for f in $(OTHER_SRCS); do \
-   g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \
-   $(CC) -M $(CPPFLAGS) -MQ $(obj)/$$g $$f  $@ ; \
-   done
-   @for f in $(HOSTSRCS); do \
-   g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \
-   $(HOSTCC) -M $(HOSTCPPFLAGS) -MQ $(obj)/$$g $$f  $@ ; \
-   done
-
-MAKE_DEPEND = $(CC) -M $(CPPFLAGS) $(EXTRA_CPPFLAGS_DEP) \
-   -MQ $(addsuffix .o,$(obj)$(basename $)) $ $@
-
-
-$(obj)/.depend.%:  $(src)/%.c
-   $(MAKE_DEPEND)
-
-$(obj)/.depend.%:  $(src)/%.S
-   $(MAKE_DEPEND)
-
-#
diff --git a/scripts/Makefile.build.tmp b/scripts/Makefile.build.tmp
deleted file mode 100644
index 52a44ff..000
--- a/scripts/Makefile.build.tmp
+++ /dev/null
@@ -1,127 +0,0 @@
-# our default target
-.PHONY: all
-all:
-
-ifeq ($(CONFIG_TPL_BUILD),y)
-  src := $(patsubst tpl/%,%,$(obj))
-else
-  ifeq ($(CONFIG_SPL_BUILD),y)
-src := $(patsubst spl/%,%,$(obj))
-  else
-src := $(obj)
-  endif
-endif
-
-include $(srctree)/scripts/Kbuild.include
-include $(srctree)/config.mk
-
-# variable LIB is used in examples/standalone/Makefile
-__LIB := $(obj)/built-in.o
-LIBGCC = $(obj)/libgcc.o
-SRCS :=
-subdir-y :=
-obj-dirs :=
-
-kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
-include $(kbuild-dir)/Makefile
-
-# Do not include host rules unless needed
-ifneq ($(hostprogs-y)$(hostprogs-m),)
-include $(SRCTREE)/scripts/Makefile.host.tmp
-endif
-
-# Going forward use the following
-obj-y := $(sort $(obj-y))
-extra-y := $(sort $(extra-y))
-always := $(sort $(always))
-lib-y := $(sort $(lib-y))
-
-subdir-y   += $(patsubst %/,%,$(filter %/, $(obj-y)))
-obj-y  := $(patsubst %/, %/built-in.o, $(obj-y))
-subdir-obj-y   := $(filter %/built-in.o, $(obj-y))
-subdir-obj-y   := $(addprefix $(obj)/,$(subdir-obj-y))
-
-SRCS   += $(obj-y:.o=.c) $(obj-y:.o=.S) $(lib-y:.o=.c) \
-   $(lib-y:.o=.S) $(extra-y:.o=.c) $(extra-y:.o=.S)
-
-SRCS := $(addprefix $(if $(KBUILD_SRC),$(srctree)/$(src)/,$(src)/),$(SRCS))
-SRCS := $(wildcard $(SRCS))
-
-OBJS   := $(addprefix $(obj)/,$(obj-y))
-
-# $(obj-dirs) is a list of directories that contain object files
-
-obj-dirs += $(dir $(OBJS))
-
-_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
-
-# Create directories for object files if directory does not exist
-# Needed when obj-y := dir/file.o syntax is used
-_dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
-
-LGOBJS := $(addprefix $(obj)/,$(sort $(lib-y)))
-
-all: $(__LIB) $(addprefix $(obj)/,$(extra-y) $(always)) $(subdir-y)
-
-$(__LIB):  $(obj)/.depend $(OBJS)
-   $(call cmd_link_o_target, $(OBJS))
-
-ifneq ($(strip $(lib-y)),)
-all: $(LIBGCC)
-
-$(LIBGCC): $(obj)/.depend $(LGOBJS)
-   $(call cmd_link_o_target, $(LGOBJS))
-endif
-
-ifneq ($(subdir-obj-y),)
-# Descending
-$(subdir-obj-y): $(subdir-y)
-endif
-
-ifneq ($(subdir-y),)
-$(subdir-y): FORCE
-   $(MAKE) $(build)=$(obj)/$@
-endif
-
-#
-
-# Allow boards 

[U-Boot] [PATCH v7 01/38] .gitignore: ingore files generated by Kbuild

2014-01-24 Thread Masahiro Yamada
Ignore generated files by Kbuild such as .*.cmd, *.order, etc.

Besides above,
 - Ignore *.s files
   We do not need to ignore with file name, asm-offsets.s
 - Do not ignore *.rej (for quilt)
 - Ignore backup files, \#*#

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

Changes in v7: None
Changes in v6:
 - ignore *.elf

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
 - Do not double *~
 - Ignore more patterns

 .gitignore | 29 -
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index d7d5538..b613586 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,16 +5,20 @@
 #
 # Normal rules
 #
-
-*.rej
-*.orig
-*.a
+.*
 *.o
+*.o.*
+*.a
+*.s
 *.su
-*~
+*.mod.c
+*.i
+*.lst
+*.order
+*.elf
 *.swp
-*.patch
 *.bin
+*.patch
 *.cfgtmp
 *.dts.tmp
 
@@ -24,12 +28,10 @@
 #
 # Top-level generic files
 #
-
 /MLO*
 /SPL
 /System.map
 /u-boot
-/u-boot.elf
 /u-boot.hex
 /u-boot.imx
 /u-boot-with-spl.imx
@@ -50,6 +52,12 @@
 /u-boot.sb
 
 #
+# git files that we don't want to ignore even it they are dot-files
+#
+!.gitignore
+!.mailmap
+
+#
 # Generated files
 #
 
@@ -65,7 +73,6 @@
 /include/generated/
 /include/spl-autoconf.mk
 /include/tpl-autoconf.mk
-asm-offsets.s
 
 # stgit generated dirs
 patches-*
@@ -91,3 +98,7 @@ GPATH
 GRTAGS
 GSYMS
 GTAGS
+
+*.orig
+*~
+\#*#
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 30/38] kbuild: refactor Makefile and spl/Makefile more

2014-01-24 Thread Masahiro Yamada
This commit refactors rules of directory descending
and defines u-boot-dirs and u-boot-all-dirs.
(We will need u-boot-all-dirs when using
scripts/Makefile.clean)

Additionally, rename LIBS-y to libs-y.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile | 165 ++-
 spl/Makefile | 107 +++---
 2 files changed, 138 insertions(+), 134 deletions(-)

diff --git a/Makefile b/Makefile
index 8654eb8..c3411cd 100644
--- a/Makefile
+++ b/Makefile
@@ -585,17 +585,7 @@ CHECKFLAGS += $(NOSTDINC_FLAGS)
 cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
 c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
 
-# The tools are needed early, so put this first
-# Don't include stuff already done in $(LIBS)
-# The examples conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
-# is yes), so compile examples after U-Boot is compiled.
-SUBDIR_TOOLS = tools
-SUBDIRS = $(SUBDIR_TOOLS)
-
-.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
-
-SUBDIR_EXAMPLES-y := examples
-SUBDIRS += $(SUBDIR_EXAMPLES-y)
+.PHONY : $(VERSION_FILE) $(TIMESTAMP_FILE)
 
 #
 # U-Boot objectsorder is important (i.e. start must be first)
@@ -604,70 +594,76 @@ head-y := $(CPUDIR)/start.o
 head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
 head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
 
-OBJS := $(head-y)
-
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard 
$(srctree)/board/$(VENDOR)/common/Makefile),y,n)
 
-LIBS-y += lib/
-LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
-LIBS-y += $(CPUDIR)/
+libs-y += lib/
+libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
+libs-y += $(CPUDIR)/
 ifdef SOC
-LIBS-y += $(CPUDIR)/$(SOC)/
+libs-y += $(CPUDIR)/$(SOC)/
 endif
-LIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
-LIBS-$(CONFIG_OF_EMBED) += dts/
-LIBS-y += arch/$(ARCH)/lib/
-LIBS-y += fs/
-LIBS-y += net/
-LIBS-y += disk/
-LIBS-y += drivers/
-LIBS-y += drivers/dma/
-LIBS-y += drivers/gpio/
-LIBS-y += drivers/i2c/
-LIBS-y += drivers/input/
-LIBS-y += drivers/mmc/
-LIBS-y += drivers/mtd/
-LIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
-LIBS-y += drivers/mtd/onenand/
-LIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
-LIBS-y += drivers/mtd/spi/
-LIBS-y += drivers/net/
-LIBS-y += drivers/net/phy/
-LIBS-y += drivers/pci/
-LIBS-y += drivers/power/ \
+libs-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
+libs-$(CONFIG_OF_EMBED) += dts/
+libs-y += arch/$(ARCH)/lib/
+libs-y += fs/
+libs-y += net/
+libs-y += disk/
+libs-y += drivers/
+libs-y += drivers/dma/
+libs-y += drivers/gpio/
+libs-y += drivers/i2c/
+libs-y += drivers/input/
+libs-y += drivers/mmc/
+libs-y += drivers/mtd/
+libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
+libs-y += drivers/mtd/onenand/
+libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
+libs-y += drivers/mtd/spi/
+libs-y += drivers/net/
+libs-y += drivers/net/phy/
+libs-y += drivers/pci/
+libs-y += drivers/power/ \
drivers/power/fuel_gauge/ \
drivers/power/mfd/ \
drivers/power/pmic/ \
drivers/power/battery/
-LIBS-y += drivers/spi/
-LIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
-LIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
-LIBS-y += drivers/serial/
-LIBS-y += drivers/usb/eth/
-LIBS-y += drivers/usb/gadget/
-LIBS-y += drivers/usb/host/
-LIBS-y += drivers/usb/musb/
-LIBS-y += drivers/usb/musb-new/
-LIBS-y += drivers/usb/phy/
-LIBS-y += drivers/usb/ulpi/
-LIBS-y += common/
-LIBS-y += lib/libfdt/
-LIBS-$(CONFIG_API) += api/
-LIBS-$(CONFIG_HAS_POST) += post/
-LIBS-y += test/
+libs-y += drivers/spi/
+libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/
+libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
+libs-y += drivers/serial/
+libs-y += drivers/usb/eth/
+libs-y += drivers/usb/gadget/
+libs-y += drivers/usb/host/
+libs-y += drivers/usb/musb/
+libs-y += drivers/usb/musb-new/
+libs-y += drivers/usb/phy/
+libs-y += drivers/usb/ulpi/
+libs-y += common/
+libs-y += lib/libfdt/
+libs-$(CONFIG_API) += api/
+libs-$(CONFIG_HAS_POST) += post/
+libs-y += test/
 
 ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
-LIBS-y += arch/$(ARCH)/imx-common/
+libs-y += arch/$(ARCH)/imx-common/
 endif
 
-LIBS-$(CONFIG_ARM) += arch/arm/cpu/
-LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
+libs-$(CONFIG_ARM) += arch/arm/cpu/
+libs-$(CONFIG_PPC) += arch/powerpc/cpu/
+
+libs-y += board/$(BOARDDIR)/
+
+libs-y := $(sort $(libs-y))
 
-LIBS-y += board/$(BOARDDIR)/
+u-boot-dirs:= $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples
+
+u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, 
$(libs-
+
+libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
+
+u-boot-init := $(head-y)
+u-boot-main := $(libs-y)
 
-LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
-LIBS := $(sort $(LIBS-y))
-.PHONY : 

[U-Boot] [PATCH v7 38/38] tools/env: cross-compile fw_printenv without setting HOSTCC

2014-01-24 Thread Masahiro Yamada
fw_printenv is a program which mostly runs on the target Linux.

Before switching to Kbuild, we needed to set HOSTCC at the
command line like this:
make HOSTCC=your CC cross-compiler env

Going forward we can cross compile it by specifying CROSS_COMPILE:
make CROSS_COMPILE=your cross-compiler prefix env
This looks more natural.

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

Changes in v7: None
Changes in v6: None
Changes in v5:
  - Newly added

Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/.gitignore |  1 -
 tools/env/.gitignore |  2 ++
 tools/env/Makefile   | 17 ++---
 tools/env/README |  5 ++---
 4 files changed, 18 insertions(+), 7 deletions(-)
 create mode 100644 tools/env/.gitignore

diff --git a/tools/.gitignore b/tools/.gitignore
index 13283b7..6e4a287 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -16,7 +16,6 @@
 /xway-swap-bytes
 /*.exe
 /easylogo/easylogo
-/env/fw_printenv
 /gdb/gdbcont
 /gdb/gdbsend
 /kernel-doc/docproc
diff --git a/tools/env/.gitignore b/tools/env/.gitignore
new file mode 100644
index 000..804abac
--- /dev/null
+++ b/tools/env/.gitignore
@@ -0,0 +1,2 @@
+fw_printenv
+fw_printenv_unstripped
diff --git a/tools/env/Makefile b/tools/env/Makefile
index d47fe16..a917db8 100644
--- a/tools/env/Makefile
+++ b/tools/env/Makefile
@@ -5,6 +5,11 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+# fw_printenv is supposed to run on the target system, which means it should be
+# built with cross tools. Although it may look weird, we only HOSTCC with
+# CC here for the maximum code reuse of scripts/Makefile.host.
+HOSTCC = $(CC)
+
 # Compile for a hosted environment on the target
 HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
-idirafter $(SRCTREE)/tools/env \
@@ -15,9 +20,15 @@ ifeq ($(MTD_VERSION),old)
 HOST_EXTRACFLAGS += -DMTD_OLD
 endif
 
-hostprogs-y := fw_printenv
-always := $(hostprogs-y)
+always := fw_printenv
+hostprogs-y := fw_printenv_unstripped
 
-fw_printenv-objs := fw_env.o fw_env_main.o \
+fw_printenv_unstripped-objs := fw_env.o fw_env_main.o \
crc32.o ctype.o linux_string.o \
env_attr.o env_flags.o
+
+quiet_cmd_strip = STRIP   $@
+  cmd_strip = $(STRIP) -o $@ $
+
+$(obj)/fw_printenv: $(obj)/fw_printenv_unstripped FORCE
+   $(call if_changed,strip)
diff --git a/tools/env/README b/tools/env/README
index 1020b57..24e31bc 100644
--- a/tools/env/README
+++ b/tools/env/README
@@ -2,11 +2,10 @@
 This is a demo implementation of a Linux command line tool to access
 the U-Boot's environment variables.
 
-In the current version, there is an issue in cross-compilation.
 In order to cross-compile fw_printenv, run
-make HOSTCC=your CC cross-compiler env
+make CROSS_COMPILE=your cross-compiler prefix env
 in the root directory of the U-Boot distribution. For example,
-make HOSTCC=arm-linux-gcc env
+make CROSS_COMPILE=arm-linux- env
 
 For the run-time utility configuration uncomment the line
 #define CONFIG_FILE  /etc/fw_env.config
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 05/38] examples: Use scripts/Makefile.build

2014-01-24 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile |  5 +
 examples/api/Makefile| 21 +---
 examples/standalone/Makefile | 46 ++--
 scripts/Makefile.build   |  7 ---
 4 files changed, 24 insertions(+), 55 deletions(-)

diff --git a/Makefile b/Makefile
index 8c585b6..b10d3b1 100644
--- a/Makefile
+++ b/Makefile
@@ -558,12 +558,9 @@ $(OBJS):
 $(LIBS):   depend $(SUBDIR_TOOLS)
$(MAKE) $(build) $(dir $(subst $(obj),,$@))
 
-tools: depend
+$(SUBDIRS):depend
$(MAKE) $(build) $@ all
 
-$(filter-out tools,$(SUBDIRS)):depend
-   $(MAKE) -C $@ all
-
 $(SUBDIR_EXAMPLES-y): $(obj)u-boot
 
 $(obj)u-boot.lds: $(LDSCRIPT) depend
diff --git a/examples/api/Makefile b/examples/api/Makefile
index cad10a3..f770859 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -11,10 +11,8 @@ ifeq ($(ARCH),arm)
 LOAD_ADDR = 0x100
 endif
 
-include $(TOPDIR)/config.mk
-
 # Resulting ELF and binary exectuables will be named demo and demo.bin
-OUTPUT = $(obj)demo
+extra-y = demo
 
 # Source files located in the examples/api directory
 SOBJ_FILES-y += crt0.o
@@ -43,13 +41,13 @@ OBJS+= $(addprefix $(obj),$(COBJ_FILES-y))
 OBJS   += $(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y)))
 OBJS   += $(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y)))
 
-all:   $(obj).depend $(OUTPUT)
-
 #
 
-$(OUTPUT): $(OBJS)
+$(obj)demo:$(OBJS)
$(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $^ 
$(PLATFORM_LIBS)
-   $(OBJCOPY) -O binary $@ $(OUTPUT).bin 2/dev/null
+
+$(obj)demo.bin: $(obj)demo
+   $(OBJCOPY) -O binary $ $@ 2/dev/null
 
 # Rule to build generic library C files
 $(obj)%.o: $(SRCTREE)/lib/%.c
@@ -58,12 +56,3 @@ $(obj)%.o: $(SRCTREE)/lib/%.c
 # Rule to build architecture-specific library assembly files
 $(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
$(CC) -g $(CFLAGS) -c -o $@ $
-
-#
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 0841c75..cad4409 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -5,27 +5,25 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-include $(TOPDIR)/config.mk
-
-ELF-y:= hello_world
-
-ELF-$(CONFIG_SMC9)   += smc9_eeprom
-ELF-$(CONFIG_SMC911X)+= smc911x_eeprom
-ELF-$(CONFIG_SPI_FLASH_ATMEL)+= atmel_df_pow2
-ELF-$(CONFIG_MPC5xxx)+= interrupt
-ELF-$(CONFIG_8xx)+= test_burst timer
-ELF-$(CONFIG_8260)   += mem_to_mem_idma2intr
-ELF-$(CONFIG_PPC)+= sched
+extra-y:= hello_world
+extra-$(CONFIG_SMC9)   += smc9_eeprom
+extra-$(CONFIG_SMC911X)+= smc911x_eeprom
+extra-$(CONFIG_SPI_FLASH_ATMEL)+= atmel_df_pow2
+extra-$(CONFIG_MPC5xxx)+= interrupt
+extra-$(CONFIG_8xx)+= test_burst timer
+extra-$(CONFIG_8260)   += mem_to_mem_idma2intr
+extra-$(CONFIG_PPC)+= sched
 
 #
 # Some versions of make do not handle trailing white spaces properly;
 # leading to build failures. The problem was found with GNU Make 3.80.
 # Using 'strip' as a workaround for the problem.
 #
-ELF := $(strip $(ELF-y))
+ELF := $(strip $(extra-y))
+
+extra-y += $(addsuffix .srec,$(extra-y)) $(addsuffix .bin,$(extra-y))
+clean-files  := $(extra-) $(addsuffix .srec,$(extra-)) $(addsuffix 
.bin,$(extra-))
 
-SREC := $(addsuffix .srec,$(ELF))
-BIN  := $(addsuffix .bin,$(ELF))
 
 COBJS  := $(ELF:=.o)
 
@@ -42,8 +40,6 @@ LIBOBJS   = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
 SRCS   := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
 OBJS   := $(addprefix $(obj),$(COBJS))
 ELF:= $(addprefix $(obj),$(ELF))
-BIN:= $(addprefix $(obj),$(BIN))
-SREC   := $(addprefix $(obj),$(SREC))
 
 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
 
@@ -60,13 +56,10 @@ endif
 # We don't want gcc reordering functions if possible.  This ensures that an
 # application's entry point will be the first function in the application's
 # source file.
-CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
-CFLAGS += $(CFLAGS_NTR)
-
-all:   $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
+CFLAGS += $(call cc-option,-fno-toplevel-reorder)
 
 #
-$(LIB):$(obj).depend $(LIBOBJS)
+$(LIB):$(LIBOBJS)
$(call cmd_link_o_target, $(LIBOBJS))
 
 $(ELF):
@@ -75,19 +68,8 @@ $(obj)%: 

[U-Boot] [PATCH v7 11/38] kbuild: Use Kbuild.include

2014-01-24 Thread Masahiro Yamada
This commit adjusts some files to use Kbuild.include.

 - Use cc-option defined in Kbuild.include
(Delete cc-option in config.mk)
 - Use cc-version defined in
(Delete cc-version in config.mk)
 - Move binutils-version and dtc-version to Kbuild.include
 by analogy to cc-version

This commit also adds srctree (same as SRCTREE)
to use Kbuild scripts.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile   |  9 ++---
 config.mk  | 29 -
 scripts/Kbuild.include |  8 +++-
 scripts/Makefile.build |  1 +
 spl/Makefile   |  4 ++--
 5 files changed, 16 insertions(+), 35 deletions(-)

diff --git a/Makefile b/Makefile
index 0c1eef3..e4045bc 100644
--- a/Makefile
+++ b/Makefile
@@ -102,9 +102,10 @@ OBJTREE:= $(if 
$(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
 SPLTREE:= $(OBJTREE)/spl
 TPLTREE:= $(OBJTREE)/tpl
 SRCTREE:= $(CURDIR)
+srctree:= $(SRCTREE)
 TOPDIR := $(SRCTREE)
 LNDIR  := $(OBJTREE)
-export TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
+export TOPDIR SRCTREE srctree OBJTREE SPLTREE TPLTREE
 
 MKCONFIG   := $(SRCTREE)/mkconfig
 export MKCONFIG
@@ -126,8 +127,6 @@ unexport CDPATH
 
 #
 
-build := -f $(TOPDIR)/scripts/Makefile.build -C
-
 # The tools are needed early, so put this first
 # Don't include stuff already done in $(LIBS)
 # The examples conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
@@ -198,6 +197,10 @@ HOSTCFLAGS  += $(call os_x_before, 10, 4, 
-traditional-cpp)
 HOSTLDFLAGS += $(call os_x_before, 10, 5, -multiply_defined suppress)
 endif
 
+# We need some generic definitions (do not try to remake the file).
+$(srctree)/scripts/Kbuild.include: ;
+include $(srctree)/scripts/Kbuild.include
+
 # Make variables (CC, etc...)
 
 AS = $(CROSS_COMPILE)as
diff --git a/config.mk b/config.mk
index dfe81fa..ba42641 100644
--- a/config.mk
+++ b/config.mk
@@ -48,35 +48,6 @@ PLATFORM_CPPFLAGS =
 PLATFORM_LDFLAGS =
 
 #
-#
-# Option checker, gcc version (courtesy linux kernel) to ensure
-# only supported compiler options are used
-#
-CC_OPTIONS_CACHE_FILE := $(OBJTREE)/include/generated/cc_options.mk
-CC_TEST_OFILE := $(OBJTREE)/include/generated/cc_test_file.o
-
--include $(CC_OPTIONS_CACHE_FILE)
-
-cc-option-sys = $(shell mkdir -p $(dir $(CC_TEST_OFILE)); \
-   if $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o $(CC_TEST_OFILE) \
-/dev/null 21; then \
-   echo 'CC_OPTIONS += $(strip $1)'  $(CC_OPTIONS_CACHE_FILE); \
-   echo $(1); fi)
-
-ifeq ($(CONFIG_CC_OPT_CACHE_DISABLE),y)
-cc-option = $(strip $(if $(call cc-option-sys,$1),$1,$2))
-else
-cc-option = $(strip $(if $(findstring $1,$(CC_OPTIONS)),$1,\
-   $(if $(call cc-option-sys,$1),$1,$2)))
-endif
-
-# cc-version
-# Usage gcc-ver := $(call cc-version)
-cc-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/gcc-version.sh $(CC))
-binutils-version = $(shell $(CONFIG_SHELL) 
$(SRCTREE)/scripts/binutils-version.sh $(AS))
-dtc-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/dtc-version.sh $(DTC))
-
-#
 
 # Load generated board configuration
 ifeq ($(CONFIG_TPL_BUILD),y)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 547e15d..ca5fd56 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -140,6 +140,10 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
 cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ]  echo $(3))
 
+# added for U-Boot
+binutils-version = $(shell $(CONFIG_SHELL) 
$(srctree)/scripts/binutils-version.sh $(AS))
+dtc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/dtc-version.sh $(DTC))
+
 # cc-ldoption
 # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
 cc-ldoption = $(call try-run,\
@@ -161,7 +165,9 @@ ar-option = $(call try-run, $(AR) rc$(1) $$TMP,$(1),$(2))
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
 # Usage:
 # $(Q)$(MAKE) $(build)=dir
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
+#build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
+# temporary
+build := -f $(srctree)/scripts/Makefile.build -C
 
 ###
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 1b3d77f..7789efa 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -2,6 +2,7 @@
 .PHONY: all
 all:
 
+include $(srctree)/scripts/Kbuild.include
 include $(TOPDIR)/config.mk
 
 # variable LIB is used in 

[U-Boot] [PATCH v7 20/38] kbuild: import more build scripts from Linux v3.13 tag

2014-01-24 Thread Masahiro Yamada
This commit imports build scripts from Linux Kernel v3.13
as they are.

I know they include some trailing spaces
but I keep intentionally them untouched.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 scripts/Makefile.build   | 479 +++
 scripts/Makefile.clean   | 104 ++
 scripts/Makefile.host| 170 +
 scripts/Makefile.lib | 373 
 scripts/basic/.gitignore |   1 +
 scripts/basic/Makefile   |  15 ++
 scripts/basic/fixdep.c   | 462 +
 scripts/mkmakefile   |  59 ++
 8 files changed, 1663 insertions(+)
 create mode 100644 scripts/Makefile.build
 create mode 100644 scripts/Makefile.clean
 create mode 100644 scripts/Makefile.host
 create mode 100644 scripts/Makefile.lib
 create mode 100644 scripts/basic/.gitignore
 create mode 100644 scripts/basic/Makefile
 create mode 100644 scripts/basic/fixdep.c
 create mode 100644 scripts/mkmakefile

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
new file mode 100644
index 000..d5d859c
--- /dev/null
+++ b/scripts/Makefile.build
@@ -0,0 +1,479 @@
+# ==
+# Building
+# ==
+
+src := $(obj)
+
+PHONY := __build
+__build:
+
+# Init all relevant variables used in kbuild files so
+# 1) they have correct type
+# 2) they do not inherit any value from the environment
+obj-y :=
+obj-m :=
+lib-y :=
+lib-m :=
+always :=
+targets :=
+subdir-y :=
+subdir-m :=
+EXTRA_AFLAGS   :=
+EXTRA_CFLAGS   :=
+EXTRA_CPPFLAGS :=
+EXTRA_LDFLAGS  :=
+asflags-y  :=
+ccflags-y  :=
+cppflags-y :=
+ldflags-y  :=
+
+subdir-asflags-y :=
+subdir-ccflags-y :=
+
+# Read auto.conf if it exists, otherwise ignore
+-include include/config/auto.conf
+
+include scripts/Kbuild.include
+
+# For backward compatibility check that these variables do not change
+save-cflags := $(CFLAGS)
+
+# The filename Kbuild has precedence over Makefile
+kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
+kbuild-file := $(if $(wildcard 
$(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
+include $(kbuild-file)
+
+# If the save-* variables changed error out
+ifeq ($(KBUILD_NOPEDANTIC),)
+ifneq ($(save-cflags),$(CFLAGS))
+$(error CFLAGS was changed in $(kbuild-file). Fix it to use 
ccflags-y)
+endif
+endif
+
+#
+# make W=... settings
+#
+# W=1 - warnings that may be relevant and does not occur too often
+# W=2 - warnings that occur quite often but may still be relevant
+# W=3 - the more obscure warnings, can most likely be ignored
+#
+# $(call cc-option, -W...) handles gcc -W.. options which
+# are not supported by all versions of the compiler
+ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
+warning-  := $(empty)
+
+warning-1 := -Wextra -Wunused -Wno-unused-parameter
+warning-1 += -Wmissing-declarations
+warning-1 += -Wmissing-format-attribute
+warning-1 += -Wmissing-prototypes
+warning-1 += -Wold-style-definition
+warning-1 += $(call cc-option, -Wmissing-include-dirs)
+warning-1 += $(call cc-option, -Wunused-but-set-variable)
+warning-1 += $(call cc-disable-warning, missing-field-initializers)
+
+warning-2 := -Waggregate-return
+warning-2 += -Wcast-align
+warning-2 += -Wdisabled-optimization
+warning-2 += -Wnested-externs
+warning-2 += -Wshadow
+warning-2 += $(call cc-option, -Wlogical-op)
+warning-2 += $(call cc-option, -Wmissing-field-initializers)
+
+warning-3 := -Wbad-function-cast
+warning-3 += -Wcast-qual
+warning-3 += -Wconversion
+warning-3 += -Wpacked
+warning-3 += -Wpadded
+warning-3 += -Wpointer-arith
+warning-3 += -Wredundant-decls
+warning-3 += -Wswitch-default
+warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
+warning-3 += $(call cc-option, -Wvla)
+
+warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
+warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
+warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
+
+ifeq ($(strip $(warning)),)
+$(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
+endif
+
+KBUILD_CFLAGS += $(warning)
+endif
+
+include scripts/Makefile.lib
+
+ifdef host-progs
+ifneq ($(hostprogs-y),$(host-progs))
+$(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please 
replace with hostprogs-y!)
+hostprogs-y += $(host-progs)
+endif
+endif
+
+# Do not include host rules unless needed
+ifneq ($(hostprogs-y)$(hostprogs-m),)
+include scripts/Makefile.host
+endif
+
+ifneq ($(KBUILD_SRC),)
+# Create output directory if not already present
+_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
+
+# Create directories for object files if directory does not exist
+# Needed when obj-y := dir/file.o syntax is used
+_dummy := 

[U-Boot] [PATCH v7 27/38] Makefile: remove a cleaning target tidy

2014-01-24 Thread Masahiro Yamada
Before this commit, make tidy did
make clean + delete *.depend* files.

But, we do not have *.depend* files any more,
which means make tidy is the same as make clean.

This commit removes the redandant target tidy.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
  - Rebase on v2014.01-rc2 tag
  - Omit *.depend* from .gitignore

 .gitignore | 1 -
 MAKEALL| 2 +-
 Makefile   | 8 ++--
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index b613586..24019b3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,7 +61,6 @@
 # Generated files
 #
 
-*.depend*
 /LOG
 /errlog
 /reloc_off
diff --git a/MAKEALL b/MAKEALL
index 01d0598..27147ff 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -696,7 +696,7 @@ build_target() {
if [ $BUILD_MANY == 1 ] ; then
trap - TERM
 
-   ${MAKE} -s tidy
+   ${MAKE} -s clean
 
if [ -s ${LOG_DIR}/${target}.ERR ] ; then
cp ${LOG_DIR}/${target}.ERR 
${OUTPUT_PREFIX}/ERR/${target}
diff --git a/Makefile b/Makefile
index 1611957..ac7dccd 100644
--- a/Makefile
+++ b/Makefile
@@ -472,7 +472,7 @@ LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
 endif
 
 # Targets which don't build the source code
-NON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig 
%_config
+NON_BUILD_TARGETS = backup clean clobber distclean mrproper unconfig %_config
 
 # Only do the generic board check when actually building, not configuring
 ifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
@@ -1119,11 +1119,7 @@ clean:
-o -name '*.cfgtmp' \) -print \
| xargs rm -f
 
-# Removes everything not needed for testing u-boot
-tidy:  clean
-   @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
-
-clobber:   tidy
+clobber: clean
@find $(OBJTREE) -type f \( -name '*.srec' \
-o -name '*.bin' -o -name u-boot.img \) \
-print0 | xargs -0 rm -f
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 28/38] kbuild: change the top Makefile to more Kbuild-ish structure

2014-01-24 Thread Masahiro Yamada
This commit changes the top Makefile to handle various targets
nicely.
Make targets are divided into four categories:

 - mixed-targets
 We can call a configuration target and build targets
 at one command line like follows:
 $ make board_name_config u-boot

 They are handled one by one.

 - config targets
 board_name_config

 - no-dot-config-targets
 Targets we can run without board configuration such as
   clean, mrproper, distclean, TAGS, %docs, etc.

 - build targets
 The other target which need board configuration.

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

Changes in v7: None
Changes in v6: None
Changes in v5:
  - Rebase on the current u-boot/master
  - Fix a bug:
make board; make tools
  failed at version 4.

Changes in v4: None
Changes in v3: None
Changes in v2:
  - Rebase on v2014.01-rc2 tag

 Makefile | 288 ---
 1 file changed, 167 insertions(+), 121 deletions(-)

diff --git a/Makefile b/Makefile
index ac7dccd..421a148 100644
--- a/Makefile
+++ b/Makefile
@@ -203,34 +203,6 @@ VENDOR=
 
 #
 
-# The tools are needed early, so put this first
-# Don't include stuff already done in $(LIBS)
-# The examples conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
-# is yes), so compile examples after U-Boot is compiled.
-SUBDIR_TOOLS = tools
-SUBDIRS = $(SUBDIR_TOOLS)
-
-.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
-
-ifeq (include/config.mk,$(wildcard include/config.mk))
-
-# Include autoconf.mk before config.mk so that the config options are available
-# to all top level build files.  We need the dummy all: target to prevent the
-# dependency target in autoconf.mk.dep from being the default.
-all:
-sinclude include/autoconf.mk.dep
-sinclude include/autoconf.mk
-
-SUBDIR_EXAMPLES-y := examples/standalone
-SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
-ifndef CONFIG_SANDBOX
-SUBDIRS += $(SUBDIR_EXAMPLES-y)
-endif
-
-# load ARCH, BOARD, and CPU configuration
-include include/config.mk
-export ARCH CPU BOARD VENDOR SOC
-
 # set default to nothing for native builds
 ifeq ($(HOSTARCH),$(ARCH))
 CROSS_COMPILE ?=
@@ -377,15 +349,6 @@ CHECK  = sparse
 CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
 
-# Use UBOOTINCLUDE when you must reference the include/ directory.
-# Needed to be compatible with the O= option
-UBOOTINCLUDE:=
-ifneq ($(OBJTREE),$(SRCTREE))
-UBOOTINCLUDE   += -I$(OBJTREE)/include
-endif
-UBOOTINCLUDE   += -I$(srctree)/include \
-   -I$(srctree)/arch/$(ARCH)/include
-
 KBUILD_CPPFLAGS := -D__KERNEL__
 
 KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
@@ -396,6 +359,7 @@ KBUILD_AFLAGS   := -D__ASSEMBLY__
 U_BOOT_VERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if 
$(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
 
 export VERSION PATCHLEVEL SUBLEVEL U_BOOT_VERSION
+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
 export MAKE AWK
@@ -428,65 +392,108 @@ scripts_basic:
 # To avoid any implicit rule to kick in, define an empty command.
 scripts/basic/%: scripts_basic ;
 
+# To make sure we do not include .config for any of the *config targets
+# catch them early, and hand them over to scripts/kconfig/Makefile
+# It is allowed to specify more targets when calling make, including
+# mixing *config targets and build targets.
+# For example 'make oldconfig all'.
+# Detect when mixed targets is specified, and make a second invocation
+# of make so .config is not included in this case either (for *config).
+
+no-dot-config-targets := clean clobber mrproper distclean \
+cscope TAGS %tags help %docs check% coccicheck \
+backup
+
+config-targets := 0
+mixed-targets  := 0
+dot-config := 1
+
+ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
+   ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
+   dot-config := 0
+   endif
+endif
 
-KBUILD_CFLAGS += -Os #-fomit-frame-pointer
-
-ifdef BUILD_TAG
-KBUILD_CFLAGS += -DBUILD_TAG='$(BUILD_TAG)'
+ifeq ($(KBUILD_EXTMOD),)
+ifneq ($(filter config %config,$(MAKECMDGOALS)),)
+config-targets := 1
+ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
+mixed-targets := 1
+endif
+endif
 endif
 
-KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
+ifeq ($(mixed-targets),1)
+# ===
+# We're called with mixed targets (*config and build targets).
+# Handle them one by one.
 
-KBUILD_CFLAGS  += -g
-# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -gformat
-# option to the assembler.

Re: [U-Boot] U-Boot execution sequence

2014-01-24 Thread Fabio Estevam
On Fri, Jan 24, 2014 at 4:14 AM, JYOTI DUBEY jyoti0...@gmail.com wrote:
 while compiling I got an error System not configured - see README. SO how
 can I configure it for NItrogen6x board?

Please read chapter 4 from board/boundary/nitrogen6x/README

Regards,

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


[U-Boot] [PATCH] powerpc/t104xrdb: Update T1040RDB.h in config folder

2014-01-24 Thread Priyanka Jain
-Add usb2 node entry in hwconfig string

-Remove controller interleaving from hwconfig string as T1040
 has only one DDR conroller

-SPI related macros which were earlier under #ifdef CONFIG_SPIFLASH
 are move outside so that they are defined for all cases as these
 macros are also used by other u-boot code

-Add CONFIG_SYS_CSPR2_EXT to make cpld accessible in u-boot

Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
---
 include/configs/T1040RDB.h |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/configs/T1040RDB.h b/include/configs/T1040RDB.h
index 65b4b26..f3e7882 100644
--- a/include/configs/T1040RDB.h
+++ b/include/configs/T1040RDB.h
@@ -80,10 +80,6 @@
 #if defined(CONFIG_SPIFLASH)
 #define CONFIG_SYS_EXTRA_ENV_RELOC
 #define CONFIG_ENV_IS_IN_SPI_FLASH
-#define CONFIG_ENV_SPI_BUS  0
-#define CONFIG_ENV_SPI_CS   0
-#define CONFIG_ENV_SPI_MAX_HZ   1000
-#define CONFIG_ENV_SPI_MODE 0
 #define CONFIG_ENV_SIZE 0x2000  /* 8KB */
 #define CONFIG_ENV_OFFSET   0x10/* 1MB */
 #define CONFIG_ENV_SECT_SIZE0x1
@@ -203,6 +199,7 @@
 /* CPLD on IFC */
 #define CONFIG_SYS_CPLD_BASE   0xffdf
 #define CONFIG_SYS_CPLD_BASE_PHYS  (0xfull | CONFIG_SYS_CPLD_BASE)
+#define CONFIG_SYS_CSPR2_EXT   (0xf)
 #define CONFIG_SYS_CSPR2   (CSPR_PHYS_ADDR(CONFIG_SYS_CPLD_BASE_PHYS) \
| CSPR_PORT_SIZE_8 \
| CSPR_MSEL_GPCM \
@@ -387,6 +384,10 @@
 #define CONFIG_CMD_SF
 #define CONFIG_SF_DEFAULT_SPEED 1000
 #define CONFIG_SF_DEFAULT_MODE  0
+#define CONFIG_ENV_SPI_BUS  0
+#define CONFIG_ENV_SPI_CS   0
+#define CONFIG_ENV_SPI_MAX_HZ   1000
+#define CONFIG_ENV_SPI_MODE 0
 
 /*
  * General PCI
@@ -628,9 +629,9 @@
 #define __USB_PHY_TYPE utmi
 
 #defineCONFIG_EXTRA_ENV_SETTINGS   \
-   hwconfig=fsl_ddr:ctlr_intlv=cacheline,\
-   bank_intlv=cs0_cs1;   \
-   usb1:dr_mode=host,phy_type= __stringify(__USB_PHY_TYPE) \0\
+   hwconfig=fsl_ddr:bank_intlv=cs0_cs1;  \
+   usb1:dr_mode=host,phy_type= __stringify(__USB_PHY_TYPE) \
+   usb2:dr_mode=host,phy_type= __stringify(__USB_PHY_TYPE) \0\
netdev=eth0\0 \
uboot= __stringify(CONFIG_UBOOTPATH) \0 \
ubootaddr= __stringify(CONFIG_SYS_TEXT_BASE) \0 \
-- 
1.7.4.1



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


[U-Boot] [PATCH] nitrogen6x: README: Only calling 'make' is enough

2014-01-24 Thread Fabio Estevam
From: Fabio Estevam fabio.este...@freescale.com

No need to pass 'u-boot.imx' as parameter for 'make' because u-boot.imx is
built by default.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 board/boundary/nitrogen6x/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/boundary/nitrogen6x/README b/board/boundary/nitrogen6x/README
index 5049093..6f449be 100644
--- a/board/boundary/nitrogen6x/README
+++ b/board/boundary/nitrogen6x/README
@@ -67,7 +67,7 @@ override auto-detection and force activation of the specified 
panel.
 To build U-Boot for one of the Nitrogen6x or SabreLite board:
 
make nitrogen6x_config
-   make u-boot.imx
+   make
 
 Note that 'nitrogen6x' is a placeholder. The complete list of supported
 board configurations is shown in tha MAINTAINERS file:
-- 
1.8.1.2

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


[U-Boot] [PATCH v7 31/38] Makefile: Do not pass MTD_VERSION from the top Makefile

2014-01-24 Thread Masahiro Yamada
$(MTD_VERSION) is used in tools/env/Makefile

If you specify a variable at a command line like:
  $ make MTD_VERSION=old env
or specify it thru an envrionment variable like:
  $ export MTD_VERSION=old
  $ make env
it is inherited to the sub-make too.
We do not need to pass it from the top Makefile explicitely.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c3411cd..7ca56bf 100644
--- a/Makefile
+++ b/Makefile
@@ -1095,7 +1095,7 @@ $(TIMESTAMP_FILE):
@cmp -s $@ $@.tmp  rm -f $@.tmp || mv -f $@.tmp $@
 
 easylogo env gdb:
-   $(Q)$(MAKE) $(build)=tools/$@ MTD_VERSION=${MTD_VERSION}
+   $(Q)$(MAKE) $(build)=tools/$@
 
 gdbtools: gdb
 
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 34/38] kbuild: support simultaneous board configuration and make all

2014-01-24 Thread Masahiro Yamada
This commit fixes two problems:

[1] We could not do board configuration and make all
in one command line.

For example, the following did not work as we expect:
  $ make sandbox_config all
  Configuring for sandbox board...
  make: Nothing to be done for `all'.

[2] mixed-target build did not work with -j option

For example, the following did not work:
  $ make -j8 sandbox_config u-boot
  Makefile:481: *** System not configured - see README.  Stop.
  make: *** [u-boot] Error 2
  make: *** Waiting for unfinished jobs
  Configuring for sandbox board...

Going forward, we can do
  $ make -j8 sandbox_config all

This is the same as
  $ make sandbox_config
  $ make -j8

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 0f78418..73bea4b 100644
--- a/Makefile
+++ b/Makefile
@@ -428,8 +428,16 @@ ifeq ($(mixed-targets),1)
 # We're called with mixed targets (*config and build targets).
 # Handle them one by one.
 
-%:: FORCE
-   $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
+PHONY += $(MAKECMDGOALS) build-one-by-one
+
+$(MAKECMDGOALS): build-one-by-one
+   @:
+
+build-one-by-one:
+   $(Q)set -e; \
+   for i in $(MAKECMDGOALS); do \
+   $(MAKE) -f $(srctree)/Makefile $$i; \
+   done
 
 else
 ifeq ($(config-targets),1)
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 37/38] kbuild: Do not generate .*.su files at the top directory

2014-01-24 Thread Masahiro Yamada
Without this workaround, you will see a lot of .*.su files
at the top directory after building with a compiler
which supports -fstack-usage option.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
  - Newly added

Changes in v3: None
Changes in v2: None

 scripts/Kbuild.include | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 6113c13..6504571 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -85,14 +85,16 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword 
$(KBUILD_EXTMOD))/)
 # Usage: option = $(call try-run, $(CC)...-o $$TMP,option-ok,otherwise)
 # Exit code chooses option. $$TMP is can be used as temporary file and
 # is automatically cleaned up.
+# modifed for U-Boot: prevent cc-option from leaving .*.su files
 try-run = $(shell set -e;  \
TMP=$(TMPOUT)..tmp;   \
TMPO=$(TMPOUT)..o;\
+   TMPSU=$(TMPOUT)..su;  \
if ($(1)) /dev/null 21;  \
then echo $(2);   \
else echo $(3);   \
fi; \
-   rm -f $$TMP $$TMPO)
+   rm -f $$TMP $$TMPO $$TMPSU)
 
 # as-option
 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 16/38] Makefile: move some flags to examples makefiles

2014-01-24 Thread Masahiro Yamada
This commit moves some flags which are used
under examples/ directory only.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 config.mk| 8 
 examples/api/Makefile| 4 
 examples/standalone/Makefile | 4 
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/config.mk b/config.mk
index 597a566..ed1a519 100644
--- a/config.mk
+++ b/config.mk
@@ -102,14 +102,6 @@ CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
 
 BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
 
-ifeq ($(findstring examples/,$(BCURDIR)),)
-ifeq ($(CONFIG_SPL_BUILD),)
-ifdef FTRACE
-CFLAGS += -finstrument-functions -DFTRACE
-endif
-endif
-endif
-
 AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
 
 LDFLAGS += $(PLATFORM_LDFLAGS)
diff --git a/examples/api/Makefile b/examples/api/Makefile
index 52f4368..ee3c487 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -4,6 +4,10 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+ifdef FTRACE
+CFLAGS += -finstrument-functions -DFTRACE
+endif
+
 ifeq ($(ARCH),powerpc)
 LOAD_ADDR = 0x4
 endif
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index cad4409..1f8d70c 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -5,6 +5,10 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+ifdef FTRACE
+CFLAGS += -finstrument-functions -DFTRACE
+endif
+
 extra-y:= hello_world
 extra-$(CONFIG_SMC9)   += smc9_eeprom
 extra-$(CONFIG_SMC911X)+= smc911x_eeprom
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 15/38] Makefile: move some flags to spl/Makefile

2014-01-24 Thread Masahiro Yamada
Some flags are used for SPL (and TPL) build only.
This commit moves them from config.mk to spl/Makefile.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 config.mk| 19 ---
 spl/Makefile | 14 ++
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/config.mk b/config.mk
index 54d1d8b..597a566 100644
--- a/config.mk
+++ b/config.mk
@@ -95,20 +95,6 @@ RELFLAGS= $(PLATFORM_RELFLAGS)
 OBJCFLAGS += --gap-fill=0xff
 
 CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
-
-# Enable garbage collection of un-used sections for SPL
-ifeq ($(CONFIG_SPL_BUILD),y)
-CPPFLAGS += -ffunction-sections -fdata-sections
-LDFLAGS_FINAL += --gc-sections
-endif
-
-ifeq ($(CONFIG_SPL_BUILD),y)
-CPPFLAGS += -DCONFIG_SPL_BUILD
-ifeq ($(CONFIG_TPL_BUILD),y)
-CPPFLAGS += -DCONFIG_TPL_BUILD
-endif
-endif
-
 CPPFLAGS += $(UBOOTINCLUDE)
 CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
 
@@ -129,11 +115,6 @@ AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
 LDFLAGS += $(PLATFORM_LDFLAGS)
 LDFLAGS_FINAL += -Bstatic
 
-LDFLAGS_$(SPL_BIN) += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
-ifneq ($(CONFIG_SPL_TEXT_BASE),)
-LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
-endif
-
 #
 
 export PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
diff --git a/spl/Makefile b/spl/Makefile
index b5153da..01f4c9e 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -17,6 +17,15 @@
 CONFIG_SPL_BUILD := y
 export CONFIG_SPL_BUILD
 
+KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
+ifeq ($(CONFIG_TPL_BUILD),y)
+KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
+endif
+
+# Enable garbage collection of un-used sections for SPL
+KBUILD_CFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS_FINAL += --gc-sections
+
 ifeq ($(CONFIG_TPL_BUILD),y)
 export CONFIG_TPL_BUILD
 SPL_BIN := u-boot-tpl
@@ -170,6 +179,11 @@ endif
 $(obj)$(SPL_BIN).bin:  $(obj)$(SPL_BIN)
$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $ $@
 
+LDFLAGS_$(SPL_BIN) += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
+ifneq ($(CONFIG_SPL_TEXT_BASE),)
+LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
+endif
+
 GEN_UBOOT = \
cd $(obj)  $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 26/38] kbuild: generate {spl, tpl}-autoconf.mk only when it is necessary

2014-01-24 Thread Masahiro Yamada
Before this commit, {spl,tpl}-autoconf.mk was always generated
at the top Makefile even if SPL(TPL) build was not selected.

This commit moves the build rule of {spl,tpl}-autoconf.mk
from the top Makefile to spl/Makefile.
It prevents unnecessary {spl,tpl}-autoconf.mk from being
generated.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile | 23 ---
 spl/Makefile | 16 
 2 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index 7af404a..1611957 100644
--- a/Makefile
+++ b/Makefile
@@ -890,9 +890,6 @@ tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend scripts_basic
 # Explicitly make _depend in subdirs containing multiple targets to prevent
 # parallel sub-makes creating .depend files simultaneously.
 depend dep:$(TIMESTAMP_FILE) $(VERSION_FILE) \
-   include/spl-autoconf.mk \
-   include/tpl-autoconf.mk \
-   include/autoconf.mk \
include/generated/generic-asm-offsets.h \
include/generated/asm-offsets.h
 
@@ -974,26 +971,6 @@ quiet_cmd_autoconf = GEN $@
 include/autoconf.mk: include/config.h
$(call cmd,autoconf)
 
-# Auto-generate the spl-autoconf.mk file (which is included by all makefiles 
for SPL)
-quiet_cmd_tpl-autoconf = GEN $@
-  cmd_tpl-autoconf = \
-   $(CPP) $(c_flags) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
-   -DDO_DEPS_ONLY -dM $(srctree)/include/common.h  $@.tmp 
 \
-   sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp  $@; \
-   rm $@.tmp
-
-include/tpl-autoconf.mk: include/config.h
-   $(call cmd,tpl-autoconf)
-
-quiet_cmd_spl-autoconf = GEN $@
-  cmd_spl-autoconf = \
-   $(CPP) $(c_flags) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM 
$(srctree)/include/common.h  $@.tmp  \
-   sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp  $@; \
-   rm $@.tmp
-
-include/spl-autoconf.mk: include/config.h
-   $(call cmd,spl-autoconf)
-
 quiet_cmd_offsets = GEN $@
   cmd_offsets = $(srctree)/tools/scripts/make-asm-offsets $ $@
 
diff --git a/spl/Makefile b/spl/Makefile
index 3fe89cc..3c4afb9 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -50,6 +50,22 @@ include $(srctree)/scripts/Kbuild.include
 
 include $(TOPDIR)/config.mk
 
+# FIX ME
+c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) 
$(NOSTDINC_FLAGS)
+
+# Auto-generate the spl-autoconf.mk file (which is included by all makefiles 
for SPL)
+quiet_cmd_autoconf = GEN $@
+  cmd_autoconf = \
+   $(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h  
$@.tmp  \
+   sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp  $@; \
+   rm $@.tmp
+
+include/tpl-autoconf.mk: include/config.h
+   $(call cmd,autoconf)
+
+include/spl-autoconf.mk: include/config.h
+   $(call cmd,autoconf)
+
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard 
$(SRCTREE)/board/$(VENDOR)/common/Makefile),y,n)
 
 ifdef  CONFIG_SPL_START_S_PATH
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 04/38] board: samsung: refactor host programs

2014-01-24 Thread Masahiro Yamada
Some Samsung boards have their own tools under board/samsung/board/tools/.
This commit refactor more makefiles with hostprogs-y.

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

Note1:
Samsung boards have tools under board/samsung/board/tools/
and have tools/mkexynosspl.c too.
It is inconsistent, so we should choose the appropriate
directory in which Samsung-specific tools are stored.

Note2:

I marded TODO item in board/samsung/origen/Makefile.

Samsung engineers, I hope you will fix the root cause of the warning.

 # omit -O2 option to suppress
 #   warning: dereferencing type-punned pointer will break strict-aliasing rules
 #
 # TODO:
 # Fix the root cause in tools/mkorigenspl.c and delete the following 
work-around
 $(obj)/tools/mkorigenspl: HOSTCFLAGS:=$(filter-out -O2,$(HOSTCFLAGS))


Changes in v7: None
Changes in v6: None
Changes in v5:
  - Rebase on the current u-boot/master

Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile |  1 +
 board/samsung/origen/Makefile| 20 ++--
 .../origen/tools/{mkv310_image.c = mkorigenspl.c}   |  0
 board/samsung/smdkv310/Makefile  | 15 ---
 .../tools/{mkv310_image.c = mksmdkv310spl.c}|  0
 spl/Makefile |  4 ++--
 6 files changed, 17 insertions(+), 23 deletions(-)
 rename board/samsung/origen/tools/{mkv310_image.c = mkorigenspl.c} (100%)
 rename board/samsung/smdkv310/tools/{mkv310_image.c = mksmdkv310spl.c} (100%)

diff --git a/Makefile b/Makefile
index a1e2810..8c585b6 100644
--- a/Makefile
+++ b/Makefile
@@ -809,6 +809,7 @@ clean:
   $(obj)tools/proftool
@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}\
   $(obj)board/matrix_vision/*/bootscript.img \
+  $(obj)spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl   \
   $(obj)u-boot.lds   \
   $(obj)arch/blackfin/cpu/init.{lds,elf}
@rm -f $(obj)include/bmp_logo.h
diff --git a/board/samsung/origen/Makefile b/board/samsung/origen/Makefile
index e8818bf..31e88f4 100644
--- a/board/samsung/origen/Makefile
+++ b/board/samsung/origen/Makefile
@@ -4,16 +4,16 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-ifndef CONFIG_SPL_BUILD
-obj-y  += origen.o
-endif
-
 ifdef CONFIG_SPL_BUILD
-all: $(OBJTREE)/tools/mk$(BOARD)spl
-endif
+hostprogs-y := tools/mkorigenspl
+always := $(hostprogs-y)
 
-# Fix ME after we implement hostprogs-y.
-ifdef CONFIG_SPL_BUILD
-$(OBJTREE)/tools/mk$(BOARD)spl:tools/mkv310_image.c
-   $(HOSTCC) tools/mkv310_image.c -o $(OBJTREE)/tools/mk$(BOARD)spl
+# omit -O2 option to suppress
+#   warning: dereferencing type-punned pointer will break strict-aliasing rules
+#
+# TODO:
+# Fix the root cause in tools/mkorigenspl.c and delete the following 
work-around
+$(obj)tools/mkorigenspl: HOSTCFLAGS:=$(filter-out -O2,$(HOSTCFLAGS))
+else
+obj-y  += origen.o
 endif
diff --git a/board/samsung/origen/tools/mkv310_image.c 
b/board/samsung/origen/tools/mkorigenspl.c
similarity index 100%
rename from board/samsung/origen/tools/mkv310_image.c
rename to board/samsung/origen/tools/mkorigenspl.c
diff --git a/board/samsung/smdkv310/Makefile b/board/samsung/smdkv310/Makefile
index dbc621b..9e37b4e 100644
--- a/board/samsung/smdkv310/Makefile
+++ b/board/samsung/smdkv310/Makefile
@@ -4,16 +4,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-ifndef CONFIG_SPL_BUILD
-obj-y  += smdkv310.o
-endif
-
 ifdef CONFIG_SPL_BUILD
-all: $(OBJTREE)/tools/mk$(BOARD)spl
-endif
-
-# Fix ME after we implement hostprogs-y.
-ifdef CONFIG_SPL_BUILD
-$(OBJTREE)/tools/mk$(BOARD)spl:tools/mkv310_image.c
-   $(HOSTCC) tools/mkv310_image.c -o $(OBJTREE)/tools/mk$(BOARD)spl
+hostprogs-y := tools/mksmdkv310spl
+always := $(hostprogs-y)
+else
+obj-y  += smdkv310.o
 endif
diff --git a/board/samsung/smdkv310/tools/mkv310_image.c 
b/board/samsung/smdkv310/tools/mksmdkv310spl.c
similarity index 100%
rename from board/samsung/smdkv310/tools/mkv310_image.c
rename to board/samsung/smdkv310/tools/mksmdkv310spl.c
diff --git a/spl/Makefile b/spl/Makefile
index 120c304..7bc063d 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -162,8 +162,8 @@ else
 VAR_SIZE_PARAM =
 endif
 $(obj)$(BOARD)-spl.bin: $(obj)u-boot-spl.bin
-   $(if $(wildcard $(OBJTREE)/tools/mk$(BOARD)spl),\
-   $(OBJTREE)/tools/mk$(BOARD)spl,\
+   $(if $(wildcard 
$(OBJTREE)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl),\
+   $(OBJTREE)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl,\
$(OBJTREE)/tools/mkexynosspl) $(VAR_SIZE_PARAM) $ $@
 endif
 
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 12/38] Makefile: move more flags to the top Makefile

2014-01-24 Thread Masahiro Yamada
Before this commit, most of compiler flags were defined in config.mk.
But it is redundant because config.mk is included from all recursive make.

This commit moves many complier flags to the top Makefile
and export them.
And we use new vaiarables to store them:
KBUILD_CPPFLAGS, KBUILD_CFLAGS, KBUILD_AFLAGS.
This will allow us to switch more smoothly to Kbuild.

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

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
  - At version 1, nand_spl boards got broken by this commit
(and fixed again in the lator commit.)
Fix this problem

 Makefile  | 35 +++
 config.mk | 41 -
 2 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/Makefile b/Makefile
index e4045bc..3a97483 100644
--- a/Makefile
+++ b/Makefile
@@ -226,11 +226,46 @@ CHECK = sparse
 CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
 
+KBUILD_CPPFLAGS := -D__KERNEL__
+
+KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
+  -Wno-format-security \
+  -fno-builtin -ffreestanding
+KBUILD_AFLAGS   := -D__ASSEMBLY__
+
 export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
 export MAKE AWK
 export DTC CHECK CHECKFLAGS
 
+export KBUILD_CPPFLAGS
+export KBUILD_CFLAGS KBUILD_AFLAGS
+
+KBUILD_CFLAGS += -Os #-fomit-frame-pointer
+
+ifdef BUILD_TAG
+KBUILD_CFLAGS += -DBUILD_TAG='$(BUILD_TAG)'
+endif
+
+KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
+
+KBUILD_CFLAGS  += -g
+# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -gformat
+# option to the assembler.
+KBUILD_AFLAGS  += -g
+
+# Report stack usage if supported
+KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
+
+KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
+
+# turn jbsr into jsr for m68k
+ifeq ($(ARCH),m68k)
+ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
+KBUILD_AFLAGS += -Wa,-gstabs,-S
+endif
+endif
+
 # load other configuration
 include $(TOPDIR)/config.mk
 
diff --git a/config.mk b/config.mk
index ba42641..04b63f6 100644
--- a/config.mk
+++ b/config.mk
@@ -90,19 +90,13 @@ endif
 
 #
 
-# We don't actually use $(ARFLAGS) anywhere anymore, so catch people
-# who are porting old code to latest mainline but not updating $(AR).
-ARFLAGS = $(error update your Makefile to use cmd_link_o_target and not AR)
 RELFLAGS= $(PLATFORM_RELFLAGS)
-DBGFLAGS= -g # -DDEBUG
-OPTFLAGS= -Os #-fomit-frame-pointer
 
 OBJCFLAGS += --gap-fill=0xff
 
 gccincdir := $(shell $(CC) -print-file-name=include)
 
-CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)\
-   -D__KERNEL__
+CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
 
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
@@ -134,26 +128,10 @@ CPPFLAGS += -I$(OBJTREE)/include
 endif
 
 CPPFLAGS += -I$(TOPDIR)/include -I$(SRCTREE)/arch/$(ARCH)/include
-CPPFLAGS += -fno-builtin -ffreestanding -nostdinc  \
+CPPFLAGS += -nostdinc  \
-isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
 
-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
-
-ifdef BUILD_TAG
-CFLAGS += -DBUILD_TAG='$(BUILD_TAG)'
-endif
-
-CFLAGS_SSP := $(call cc-option,-fno-stack-protector)
-CFLAGS += $(CFLAGS_SSP)
-# Some toolchains enable security related warning flags by default,
-# but they don't make much sense in the u-boot world, so disable them.
-CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \
-  $(call cc-option,-Wno-format-security)
-CFLAGS += $(CFLAGS_WARN)
-
-# Report stack usage if supported
-CFLAGS_STACK := $(call cc-option,-fstack-usage)
-CFLAGS += $(CFLAGS_STACK)
+CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
 
 BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
 
@@ -165,18 +143,7 @@ endif
 endif
 endif
 
-# $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -gformat
-# option to the assembler.
-AFLAGS_DEBUG :=
-
-# turn jbsr into jsr for m68k
-ifeq ($(ARCH),m68k)
-ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
-AFLAGS_DEBUG := -Wa,-gstabs,-S
-endif
-endif
-
-AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
+AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
 
 LDFLAGS += $(PLATFORM_LDFLAGS)
 LDFLAGS_FINAL += -Bstatic
-- 
1.8.3.2

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


[U-Boot] [PATCH v7 08/38] Makefile: move some variable definitions to the top Makefile

2014-01-24 Thread Masahiro Yamada
This commit moves some variable definitions from config.mk
to the top Makefile:

  - HOSTCC, HOSTCFLAGS, HOSTLDFLAGS
  - AS, LD, CC, CPP, etc.
  - SHELL (renamed to CONFIG_SHELL)

I'd like to slim down config.mk file
because it is included from all recursive make.
It is redundant to re-define the variables
every time descending into sub directories.
We should rather define them at the top Makefile
and export them.

U-Boot makefiles has been used SHELL variable to store shell
chosen for the user, whereas Linux Kernel uses CONFIG_SHELL.

We should never use SHELL variable because it is
a special variable for GNU Make.
Changing SHELL may cause unpredictable side effects
whose root cause is usually difficult to find.
We should use a generic variable name CONFIG_SHELL.

We should not use the syntax as follows either:

rm -f $(obj)tools/env/{fw_printenv,fw_setenv}

This depends on bash although GNU Make generally
invokes sh to run the each rule.

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

O'REILLY GNU Make says like follows about SHELL variable:

By default, /bin/sh is used for the shell.
This shell is controlled by the make variable SHELL
but it is not inherited from the environment.
When make starts, it imports all the variables
from the user’s environment as make variables, except SHELL.
This is because the user’s choice of shell should not cause a
makefile (possibly included in some downloaded software package) to fail.
If a user really wants to change the default shell used by make,
he can set the SHELL variable explicitly in the makefile.

Please refer to the first page of the following PDF file:
http://oreilly.com/catalog/make3/book/ch05.pdf


Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
  - Do not use bash-dependent clean rules:
 For example,
 rm -f $(obj)tools/env/{fw_printenv,fw_setenv}
   should be converted to
 rm -f $(addprefix $(obj)tools/env/, fw_printenv fw_setenv)
  - Add more comments in commit log
  - Rebase on v2014.01-rc2 tag

 Makefile  | 94 ++-
 config.mk | 78 ++--
 2 files changed, 84 insertions(+), 88 deletions(-)

diff --git a/Makefile b/Makefile
index 5204ab4..0c1eef3 100644
--- a/Makefile
+++ b/Makefile
@@ -161,6 +161,73 @@ ifeq ($(HOSTARCH),$(ARCH))
 CROSS_COMPILE ?=
 endif
 
+# SHELL used by kbuild
+CONFIG_SHELL := $(shell if [ -x $$BASH ]; then echo $$BASH; \
+ else if [ -x /bin/bash ]; then echo /bin/bash; \
+ else echo sh; fi ; fi)
+
+HOSTCC   = gcc
+HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+
+ifeq ($(HOSTOS),cygwin)
+HOSTCFLAGS += -ansi
+endif
+
+# Mac OS X / Darwin's C preprocessor is Apple specific.  It
+# generates numerous errors and warnings.  We want to bypass it
+# and use GNU C's cpp. To do this we pass the -traditional-cpp
+# option to the compiler.  Note that the -traditional-cpp flag
+# DOES NOT have the same semantics as GNU C's flag, all it does
+# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
+#
+# Apple's linker is similar, thanks to the new 2 stage linking
+# multiple symbol definitions are treated as errors, hence the
+# -multiply_defined suppress option to turn off this error.
+#
+ifeq ($(HOSTOS),darwin)
+# get major and minor product version (e.g. '10' and '6' for Snow Leopard)
+DARWIN_MAJOR_VERSION   = $(shell sw_vers -productVersion | cut -f 1 -d '.')
+DARWIN_MINOR_VERSION   = $(shell sw_vers -productVersion | cut -f 2 -d '.')
+
+os_x_before= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
+   $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo $(3); else echo 
$(4); fi ;)
+
+# Snow Leopards build environment has no longer restrictions as described above
+HOSTCC   = $(call os_x_before, 10, 5, cc, gcc)
+HOSTCFLAGS  += $(call os_x_before, 10, 4, -traditional-cpp)
+HOSTLDFLAGS += $(call os_x_before, 10, 5, -multiply_defined suppress)
+endif
+
+# Make variables (CC, etc...)
+
+AS = $(CROSS_COMPILE)as
+# Always use GNU ld
+ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2 /dev/null),)
+LD = $(CROSS_COMPILE)ld.bfd
+else
+LD = $(CROSS_COMPILE)ld
+endif
+CC = $(CROSS_COMPILE)gcc
+CPP= $(CC) -E
+AR = $(CROSS_COMPILE)ar
+NM = $(CROSS_COMPILE)nm
+LDR= $(CROSS_COMPILE)ldr
+STRIP  = $(CROSS_COMPILE)strip
+OBJCOPY= $(CROSS_COMPILE)objcopy
+OBJDUMP= $(CROSS_COMPILE)objdump
+AWK= awk
+RANLIB = $(CROSS_COMPILE)RANLIB
+DTC= dtc
+CHECK  = sparse
+
+CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
+ -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
+
+export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
+export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
+export MAKE 

[U-Boot] [PATCH v7 03/38] tools: convert makefiles to kbuild style

2014-01-24 Thread Masahiro Yamada
Before this commit, makefiles under tools/ directory
were implemented with their own way.

This commit refactors them by using hostprogs-y variable.

Several C sources have been added to wrap other C sources
to simplify Makefile.
For example, tools/crc32.c includes lib/crc32.c

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

Changes in v7: None
Changes in v6: None
Changes in v5:
  - Rebase on the current u-boot/master

Changes in v4: None
Changes in v3: None
Changes in v2:
  - Rebase on v2014.01-rc2 tag

 Makefile  |  18 ++-
 config.mk |  28 +---
 rules.mk  |   5 -
 spl/Makefile  |   4 +-
 tools/.gitignore  |   2 +-
 tools/Makefile| 338 ++
 tools/crc32.c |   1 +
 tools/easylogo/Makefile   |  12 +-
 tools/env/Makefile|  32 +
 tools/env/crc32.c |   1 +
 tools/env/ctype.c |   1 +
 tools/env/env_attr.c  |   1 +
 tools/env/env_flags.c |   1 +
 tools/env/linux_string.c  |   1 +
 tools/env_embedded.c  |   1 +
 tools/fdt.c   |   1 +
 tools/fdt_ro.c|   1 +
 tools/fdt_rw.c|   1 +
 tools/fdt_strerror.c  |   1 +
 tools/fdt_wip.c   |   1 +
 tools/gdb/Makefile|  43 +-
 tools/image-fit.c |   1 +
 tools/image-sig.c |   1 +
 tools/image.c |   1 +
 tools/kernel-doc/Makefile |  21 +--
 tools/md5.c   |   1 +
 tools/rsa-sign.c  |   1 +
 tools/sha1.c  |   1 +
 28 files changed, 156 insertions(+), 365 deletions(-)
 create mode 100644 tools/crc32.c
 create mode 100644 tools/env/crc32.c
 create mode 100644 tools/env/ctype.c
 create mode 100644 tools/env/env_attr.c
 create mode 100644 tools/env/env_flags.c
 create mode 100644 tools/env/linux_string.c
 create mode 100644 tools/env_embedded.c
 create mode 100644 tools/fdt.c
 create mode 100644 tools/fdt_ro.c
 create mode 100644 tools/fdt_rw.c
 create mode 100644 tools/fdt_strerror.c
 create mode 100644 tools/fdt_wip.c
 create mode 100644 tools/image-fit.c
 create mode 100644 tools/image-sig.c
 create mode 100644 tools/image.c
 create mode 100644 tools/md5.c
 create mode 100644 tools/rsa-sign.c
 create mode 100644 tools/sha1.c

diff --git a/Makefile b/Makefile
index 1687e2e..a1e2810 100644
--- a/Makefile
+++ b/Makefile
@@ -126,6 +126,8 @@ unexport CDPATH
 
 #
 
+build := -f $(TOPDIR)/scripts/Makefile.build -C
+
 # The tools are needed early, so put this first
 # Don't include stuff already done in $(LIBS)
 # The examples conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
@@ -362,8 +364,6 @@ endif
 endif
 endif
 
-build := -f $(TOPDIR)/scripts/Makefile.build -C
-
 all:   $(ALL-y) $(SUBDIR_EXAMPLES-y)
 
 $(obj)u-boot.dtb:  checkdtc $(obj)u-boot
@@ -558,7 +558,10 @@ $(OBJS):
 $(LIBS):   depend $(SUBDIR_TOOLS)
$(MAKE) $(build) $(dir $(subst $(obj),,$@))
 
-$(SUBDIRS):depend
+tools: depend
+   $(MAKE) $(build) $@ all
+
+$(filter-out tools,$(SUBDIRS)):depend
$(MAKE) -C $@ all
 
 $(SUBDIR_EXAMPLES-y): $(obj)u-boot
@@ -711,7 +714,7 @@ depend dep tags ctags etags cscope $(obj)System.map:
@ exit 1
 
 tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
-   $(MAKE) -C $@ all
+   $(MAKE) $(build) $@ all
 endif  # config.mk
 
 # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
@@ -746,14 +749,15 @@ $(TIMESTAMP_FILE):
@cmp -s $@ $@.tmp  rm -f $@.tmp || mv -f $@.tmp $@
 
 easylogo env gdb:
-   $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION}
+   $(MAKE) $(build) tools/$@ MTD_VERSION=${MTD_VERSION}
+
 gdbtools: gdb
 
 xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@
 
 tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
-   $(MAKE) -C tools HOST_TOOLS_ALL=y
+   $(MAKE) $(build) tools HOST_TOOLS_ALL=y
 
 .PHONY : CHANGELOG
 CHANGELOG:
@@ -798,7 +802,7 @@ clean:
   $(obj)tools/gen_eth_addr$(obj)tools/img2srec   \
   $(obj)tools/dump{env,}image\
   $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk \
-  $(obj)tools/mk{$(BOARD),}spl   \
+  $(obj)tools/mk{$(BOARD),exynos}spl \
   $(obj)tools/mxsboot\
   $(obj)tools/ncb $(obj)tools/ubsha1 \
   $(obj)tools/kernel-doc/docproc \
diff --git a/config.mk b/config.mk
index 60e297a..07afb35 100644
--- a/config.mk
+++ b/config.mk
@@ -58,7 +58,6 @@ PLATFORM_LDFLAGS =
 
 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
  $(HOSTCPPFLAGS)
-HOSTSTRIP  = strip
 
 #
 

[U-Boot] [PATCH] nitrogen6x: README: Do not refer to MAINTAINERS file

2014-01-24 Thread Fabio Estevam
From: Fabio Estevam fabio.este...@freescale.com

MAINTAINERS file has been removed from the project.

Replace its reference with 'boards.cfg' file instead.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 board/boundary/nitrogen6x/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/boundary/nitrogen6x/README b/board/boundary/nitrogen6x/README
index 6f449be..9d84265 100644
--- a/board/boundary/nitrogen6x/README
+++ b/board/boundary/nitrogen6x/README
@@ -70,7 +70,7 @@ To build U-Boot for one of the Nitrogen6x or SabreLite board:
make
 
 Note that 'nitrogen6x' is a placeholder. The complete list of supported
-board configurations is shown in tha MAINTAINERS file:
+board configurations is shown in the boards.cfg file:
nitrogen6q  i.MX6Q/6D   1GB
nitrogen6dl i.MX6DL 1GB
nitrogen6s  i.MX6S  512MB
-- 
1.8.1.2

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


[U-Boot] [PATCH] powerpc/mpc85xx: Update serdes protocols for T1040

2014-01-24 Thread Prabhakar Kushwaha
T1040 has only one SerDes block. so update the code accordingly.

Also, add support of SerDes Protocol 0x00, 0x06, 0x40, 0x69 0x85,
0xA7 and 0xAA

Signed-off-by: Arpit Goel b44...@freescale.com
Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
---
 arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c |2 +
 arch/powerpc/cpu/mpc85xx/t1040_serdes.c|   63 ++--
 arch/powerpc/include/asm/fsl_serdes.h  |8 +--
 3 files changed, 30 insertions(+), 43 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c 
b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
index 25db899..70e09ea 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
@@ -75,6 +75,8 @@ static const char *serdes_prtcl_str[] = {
[XFI_FM2_MAC9] = XFI_FM2_MAC9,
[XFI_FM2_MAC10] = XFI_FM2_MAC10,
[INTERLAKEN] = INTERLAKEN,
+   [QSGMII_SW1_A] = QSGMII_SW1_A,
+   [QSGMII_SW1_B] = QSGMII_SW1_B,
 };
 #endif
 
diff --git a/arch/powerpc/cpu/mpc85xx/t1040_serdes.c 
b/arch/powerpc/cpu/mpc85xx/t1040_serdes.c
index 94814ac..d86bb27 100644
--- a/arch/powerpc/cpu/mpc85xx/t1040_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/t1040_serdes.c
@@ -8,68 +8,59 @@
 #include asm/fsl_serdes.h
 #include asm/processor.h
 #include asm/io.h
-#include fsl_corenet2_serdes.h
 
-static u8 serdes_cfg_tbl[MAX_SERDES][0xC4][SRDS_MAX_LANES] = {
-   {   /* SerDes 1 */
-   [0x69] = {PCIE1, SGMII_FM1_DTSEC3, QSGMII_SW1_A, QSGMII_SW1_B,
-   PCIE2, PCIE3, SGMII_FM1_DTSEC4, SATA1},
+
+static u8 serdes_cfg_tbl[][SRDS_MAX_LANES] = {
+   [0x00] = {PCIE1, PCIE1, PCIE1, PCIE1,
+   PCIE2, PCIE2, PCIE2, PCIE2},
+   [0x06] = {PCIE1, PCIE1, PCIE1, PCIE1,
+   PCIE2, PCIE3, PCIE4, SATA1},
+   [0x08] = {PCIE1, PCIE1, PCIE1, PCIE1,
+   PCIE2, PCIE3, SATA2, SATA1},
+   [0x40] = {PCIE1, PCIE1, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
+   PCIE2, PCIE2, PCIE2, PCIE2},
+   [0x60] = {PCIE1, SGMII_FM1_DTSEC3, QSGMII_SW1_A, QSGMII_SW1_B,
+   PCIE2, PCIE2, PCIE2, PCIE2},
[0x66] = {PCIE1, SGMII_FM1_DTSEC3, QSGMII_SW1_A, QSGMII_SW1_B,
PCIE2, PCIE3, PCIE4, SATA1},
[0x67] = {PCIE1, SGMII_FM1_DTSEC3, QSGMII_SW1_A, QSGMII_SW1_B,
PCIE2, PCIE3, PCIE4, SGMII_FM1_DTSEC5},
-   [0x60] = {PCIE1, SGMII_FM1_DTSEC3, QSGMII_SW1_A, QSGMII_SW1_B,
-   PCIE2, PCIE2, PCIE2, PCIE2},
-   [0x8D] = {PCIE1, SGMII_SW1_DTSEC3, SGMII_SW1_DTSEC1, SGMII_SW1_DTSEC2,
-   PCIE2, SGMII_SW1_DTSEC6, SGMII_SW1_DTSEC4, SGMII_SW1_DTSEC5},
-   [0x89] = {PCIE1, SGMII_SW1_DTSEC3, SGMII_SW1_DTSEC1, SGMII_SW1_DTSEC2,
-   PCIE2, PCIE3, SGMII_SW1_DTSEC4, SATA1},
+   [0x69] = {PCIE1, SGMII_FM1_DTSEC3, QSGMII_SW1_A, QSGMII_SW1_B,
+   PCIE2, PCIE3, SGMII_FM1_DTSEC4, SATA1},
[0x86] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
PCIE2, PCIE3, PCIE4, SATA1},
+   [0x85] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
+   PCIE2, PCIE2, SGMII_FM1_DTSEC4, SGMII_FM1_DTSEC5},
[0x87] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
PCIE2, PCIE3, PCIE4, SGMII_FM1_DTSEC5},
-   [0xA7] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
-PCIE2, PCIE3, PCIE4, SGMII_FM1_DTSEC5},
-   [0xAA] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
-PCIE2, PCIE3, SGMII_FM1_DTSEC4, SGMII_FM1_DTSEC5},
-   [0x40] = {PCIE1, PCIE1, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
-   PCIE2, PCIE2, PCIE2, PCIE2},
-   [0x06] = {PCIE1, PCIE1, PCIE1, PCIE1,
-   PCIE2, PCIE3, PCIE4, SATA1},
-   [0x08] = {PCIE1, PCIE1, PCIE1, PCIE1,
-   PCIE2, PCIE3, SATA2, SATA1},
+   [0x89] = {PCIE1, QSGMII_SW1_A, QSGMII_SW1_A, QSGMII_SW1_A,
+   PCIE2, PCIE3, QSGMII_SW1_B, SATA1},
+   [0x8D] = {PCIE1, QSGMII_SW1_A, QSGMII_SW1_A, QSGMII_SW1_A,
+   PCIE2, QSGMII_SW1_B, QSGMII_SW1_B, QSGMII_SW1_B},
[0x8F] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
AURORA, NONE, SGMII_FM1_DTSEC4, SGMII_FM1_DTSEC5},
-   [0x85] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
-   PCIE2, PCIE2, SGMII_FM1_DTSEC4, SGMII_FM1_DTSEC5},
[0xA5] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
PCIE2, PCIE2, SGMII_FM1_DTSEC4, SGMII_FM1_DTSEC5},
-   [0x00] = {PCIE1, PCIE1, PCIE1, PCIE1,
-   PCIE2, PCIE2, PCIE2, PCIE2},
-   },
-   {
-   },
-   {
-   },
-   {
-   },
+   [0xA7] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
+PCIE2, PCIE3, PCIE4, 

[U-Boot] [PATCH] boards/t1040qds: Adds ethernet support for T1040

2014-01-24 Thread Prabhakar Kushwaha
Enable entherent for T1040QDS. It enables FM1@DTSEC3, FM1@DTSEC4, FM1@DTSEC5
 - Define MDIO related configs
 - Added eth.c file
 - Update t1040.c to support RGMII and SGMII
 - Update t1040qds.c to support ethernet
 - Define the PHY address

Signed-off-by: Arpit Goel b44...@freescale.com
Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
Signed-off-by: Prabhakar Kushwaha prabha...@freescale.com
---
 arch/powerpc/include/asm/immap_85xx.h |   11 +
 board/freescale/t1040qds/Makefile |1 +
 board/freescale/t1040qds/eth.c|  492 +
 board/freescale/t1040qds/t1040qds.c   |1 +
 drivers/net/fm/t1040.c|   56 
 include/configs/T1040QDS.h|5 +-
 6 files changed, 563 insertions(+), 3 deletions(-)
 create mode 100644 board/freescale/t1040qds/eth.c

diff --git a/arch/powerpc/include/asm/immap_85xx.h 
b/arch/powerpc/include/asm/immap_85xx.h
index 68c3c82..9d08321 100644
--- a/arch/powerpc/include/asm/immap_85xx.h
+++ b/arch/powerpc/include/asm/immap_85xx.h
@@ -1759,6 +1759,17 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT  24
 #define FSL_CORENET2_RCWSR4_SRDS2_PRTCL0x00fe
 #define FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT  17
+#define FSL_CORENET_RCWSR13_EC10x3000 /* bits 418..419 */
+#define FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_RGMII   0x
+#define FSL_CORENET_RCWSR13_EC1_FM1_GPIO   0x1000
+#define FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_MII 0x2000
+#define FSL_CORENET_RCWSR13_EC20x0c00 /* bits 420..421 */
+#define FSL_CORENET_RCWSR13_EC2_FM1_DTSEC5_RGMII   0x
+#define FSL_CORENET_RCWSR13_EC2_FM1_GPIO   0x1000
+#define FSL_CORENET_RCWSR13_EC2_FM1_DTSEC5_MII 0x2000
+#define FSL_CORENET_RCWSR13_MAC2_GMII_SEL  0x0080
+#define FSL_CORENET_RCWSR13_MAC2_GMII_SEL_L2_SWITCH0x
+#define FSL_CORENET_RCWSR13_MAC2_GMII_SEL_ENET_PORT0x8000
 #elif defined(CONFIG_PPC_T2080) || defined(CONFIG_PPC_T2081)
 #define FSL_CORENET2_RCWSR4_SRDS1_PRTCL0xff00
 #define FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT  24
diff --git a/board/freescale/t1040qds/Makefile 
b/board/freescale/t1040qds/Makefile
index 93af9eb..c7470d7 100644
--- a/board/freescale/t1040qds/Makefile
+++ b/board/freescale/t1040qds/Makefile
@@ -9,3 +9,4 @@ obj-y   += ddr.o
 obj-$(CONFIG_PCI) += pci.o
 obj-y  += law.o
 obj-y  += tlb.o
+obj-y  += eth.o
diff --git a/board/freescale/t1040qds/eth.c b/board/freescale/t1040qds/eth.c
new file mode 100644
index 000..3077b4a
--- /dev/null
+++ b/board/freescale/t1040qds/eth.c
@@ -0,0 +1,492 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+/*
+ * The RGMII PHYs are provided by the two on-board PHY connected to
+ * dTSEC instances 4 and 5. The SGMII PHYs are provided by one on-board
+ * PHY or by the standard four-port SGMII riser card (VSC).
+ */
+
+#include common.h
+#include netdev.h
+#include asm/fsl_serdes.h
+#include asm/immap_85xx.h
+#include fm_eth.h
+#include fsl_mdio.h
+#include malloc.h
+#include asm/fsl_dtsec.h
+
+#include ../common/fman.h
+#include ../common/qixis.h
+
+#include t1040qds_qixis.h
+
+#ifdef CONFIG_FMAN_ENET
+ /* - In T1040 there are only 8 SERDES lanes, spread across 2 SERDES banks.
+ *   Bank 1 - Lanes A, B, C, D
+ *   Bank 2 - Lanes E, F, G, H
+ */
+
+ /* Mapping of 8 SERDES lanes to T1040 QDS board slots. A value of '0' here
+  * means that the mapping must be determined dynamically, or that the lane
+  * maps to something other than a board slot.
+  */
+static u8 lane_to_slot[] = {
+   0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* On the Vitesse VSC8234XHG SGMII riser card there are 4 SGMII PHYs
+ * housed.
+ */
+static int riser_phy_addr[] = {
+   CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR,
+   CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR,
+   CONFIG_SYS_FM1_DTSEC3_RISER_PHY_ADDR,
+   CONFIG_SYS_FM1_DTSEC4_RISER_PHY_ADDR,
+};
+
+/* Slot2 does not have EMI connections */
+#define EMI_NONE   0x
+#define EMI1_RGMII00
+#define EMI1_RGMII11
+#define EMI1_SLOT1 2
+#define EMI1_SLOT3 3
+#define EMI1_SLOT4 4
+#define EMI1_SLOT5 5
+#define EMI1_SLOT6 6
+#define EMI1_SLOT7 7
+#define EMI2   8
+
+static int mdio_mux[NUM_FM_PORTS];
+
+static const char * const mdio_names[] = {
+   T1040_QDS_MDIO0,
+   T1040_QDS_MDIO1,
+   T1040_QDS_MDIO2,
+   T1040_QDS_MDIO3,
+   T1040_QDS_MDIO4,
+   T1040_QDS_MDIO5,
+   T1040_QDS_MDIO6,
+   T1040_QDS_MDIO7,
+};
+
+struct t1040_qds_mdio {
+   u8 muxval;
+   struct mii_dev *realbus;
+};
+
+static const char *t1040_qds_mdio_name_for_muxval(u8 muxval)
+{
+   return mdio_names[muxval];
+}
+
+struct mii_dev *mii_dev_for_muxval(u8 muxval)
+{
+   struct mii_dev *bus;
+   const char *name = 

[U-Boot] [RFC PATCH 1/1] Add support for pengwyn board

2014-01-24 Thread micro1183
This patch adds support for the silica pengwyn board with AM335x SoC

Signed-off-by: Lothar Felten lothar.fel...@gmail.com
---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   16 ++
 board/silica/pengwyn/Makefile   |   13 +
 board/silica/pengwyn/board.c|  245 +++
 board/silica/pengwyn/board.h|   22 ++
 board/silica/pengwyn/mux.c  |  109 +
 boards.cfg  |1 +
 include/configs/pengwyn.h   |  340
+++
 7 files changed, 746 insertions(+)

diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index c1777df..60cb098 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -58,6 +58,22 @@
 #define MT41J128MJT125_PHY_FIFO_WE 0x100
 #define MT41J128MJT125_IOCTRL_VALUE0x18B

+/* Micron MT41K128M16JT-187E */
+#define MT41K128MJT187E_EMIF_READ_LATENCY  0x06
+#define MT41K128MJT187E_EMIF_TIM1  0x0888B3DB
+#define MT41K128MJT187E_EMIF_TIM2  0x36337FDA
+#define MT41K128MJT187E_EMIF_TIM3  0x501F830F
+#define MT41K128MJT187E_EMIF_SDCFG 0x61C04AB2
+#define MT41K128MJT187E_EMIF_SDREF 0x093B
+#define MT41K128MJT187E_ZQ_CFG 0x50074BE4
+#define MT41K128MJT187E_RATIO  0x40
+#define MT41K128MJT187E_INVERT_CLKOUT  0x1
+#define MT41K128MJT187E_RD_DQS 0x3B
+#define MT41K128MJT187E_WR_DQS 0x85
+#define MT41K128MJT187E_PHY_WR_DATA0xC1
+#define MT41K128MJT187E_PHY_FIFO_WE0x100
+#define MT41K128MJT187E_IOCTRL_VALUE   0x18B
+
 /* Micron MT41J64M16JT-125 */
 #define MT41J64MJT125_EMIF_SDCFG   0x61C04A32

diff --git a/board/silica/pengwyn/Makefile b/board/silica/pengwyn/Makefile
new file mode 100644
index 000..c8b4f9a
--- /dev/null
+++ b/board/silica/pengwyn/Makefile
@@ -0,0 +1,13 @@
+#
+# Makefile
+#
+# Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_NOR_BOOT),y)
+obj-y  := mux.o
+endif
+
+obj-y  += board.o
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
new file mode 100644
index 000..e6f59d4
--- /dev/null
+++ b/board/silica/pengwyn/board.c
@@ -0,0 +1,245 @@
+/*
+ * board.c
+ *
+ * Copyright (C) 2013 Lothar Felten lothar.fel...@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include common.h
+#include errno.h
+#include spl.h
+#include asm/arch/cpu.h
+#include asm/arch/hardware.h
+#include asm/arch/omap.h
+#include asm/arch/ddr_defs.h
+#include asm/arch/clock.h
+#include asm/arch/gpio.h
+#include asm/arch/mmc_host_def.h
+#include asm/arch/sys_proto.h
+#include asm/io.h
+#include asm/emif.h
+#include asm/gpio.h
+#include i2c.h
+#include miiphy.h
+#include cpsw.h
+#include power/tps65217.h
+#include board.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+
+/* MII mode defines */
+#define RMII_RGMII2_MODE_ENABLE 0x49
+
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
+
+/* DDR3 RAM timings */
+static const struct ddr_data ddr3_data = {
+   .datardsratio0 = MT41K128MJT187E_RD_DQS,
+   .datawdsratio0 = MT41K128MJT187E_WR_DQS,
+   .datafwsratio0 = MT41K128MJT187E_PHY_FIFO_WE,
+   .datawrsratio0 = MT41K128MJT187E_PHY_WR_DATA,
+};
+
+static const struct cmd_control ddr3_cmd_ctrl_data = {
+   .cmd0csratio = MT41K128MJT187E_RATIO,
+   .cmd0iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+   .cmd1csratio = MT41K128MJT187E_RATIO,
+   .cmd1iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+   .cmd2csratio = MT41K128MJT187E_RATIO,
+   .cmd2iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+};
+
+static struct emif_regs ddr3_emif_reg_data = {
+   .sdram_config = MT41K128MJT187E_EMIF_SDCFG,
+   .ref_ctrl = MT41K128MJT187E_EMIF_SDREF,
+   .sdram_tim1 = MT41K128MJT187E_EMIF_TIM1,
+   .sdram_tim2 = MT41K128MJT187E_EMIF_TIM2,
+   .sdram_tim3 = MT41K128MJT187E_EMIF_TIM3,
+   .zq_config = MT41K128MJT187E_ZQ_CFG,
+   .emif_ddr_phy_ctlr_1 = MT41K128MJT187E_EMIF_READ_LATENCY |
+   PHY_EN_DYN_PWRDN,
+};
+
+const struct ctrl_ioregs ddr3_ioregs = {
+   .cm0ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .cm1ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .cm2ioctl   = 

Re: [U-Boot] [PATCH 0/2] Add External SD Card support for Marvell GplugD

2014-01-24 Thread Prafulla Wadaskar
Hi Ajay,

Please avoid re-post with the same subject.
I think, Yesterday you posted the same patches.
If there is any diff or updates, then you should add next version info to them.

Regards...
Prafulla . . .

 -Original Message-
 From: Ajay Bhargav [mailto:ajay.bhar...@einfochips.com]
 Sent: 24 January 2014 18:15
 To: Prafulla Wadaskar; u-boot@lists.denx.de
 Cc: Ajay Bhargav
 Subject: [PATCH 0/2] Add External SD Card support for
 Marvell GplugD
 
 Following series of patches adds support for external
 SD card
 slot on Marvell GplugD.
 
 Ajay Bhargav (2):
   Armada100: Adds SD/MMC Register definitions
   Armada100: Add SD card support for Marvell gplugD
 
  arch/arm/include/asm/arch-armada100/armada100.h | 10
 +++
  arch/arm/include/asm/arch-armada100/cpu.h   |  1 +
  arch/arm/include/asm/arch-armada100/mfp.h   | 17
 +++
  board/Marvell/gplugd/gplugd.c   | 39
 +
  include/configs/gplugd.h|  9
 ++
  5 files changed, 76 insertions(+)
 
 --
 1.8.3.rc3
 
 ***
 ***
 ***
 eInfochips Business Disclaimer : This e-mail message
 and all attachments transmitted with it are intended
 solely for the use of the addressee and may contain
 legally privileged and confidential information. If the
 reader of this message is not the intended recipient,
 or an employee or agent responsible for delivering this
 message to the intended recipient, you are hereby
 notified that any dissemination, distribution, copying,
 or other use of this message or its attachments is
 strictly prohibited. If you have received this message
 in error, please notify the sender immediately by
 replying to this message and please delete it from your
 computer. Any views expressed in this message are those
 of the individual sender unless otherwise stated.
 Company has taken enough precautions to prevent the
 spread of viruses. However the company accepts no
 liability for any damage caused by any virus
 transmitted by this email.
 ***
 ***
 ***
 
 
 ---
 --
 Notice:
 This message has been scanned by Trend Micro Mail
 Security scanner and is believed to be clean
 ---
 --
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][PATCH 0/7] TI: OMAP3: Use common config file.

2014-01-24 Thread Tom Rini
On Fri, Jan 24, 2014 at 09:45:36AM +0100, Enric Balletbo Serra wrote:
 Hi Tom,
 
 2014/1/6 Tom Rini tr...@ti.com:
  On Mon, Dec 23, 2013 at 12:11:25PM +0100, Enric Balletbo Serra wrote:
  2013/12/6 Enric Balletbo i Serra eballe...@gmail.com:
   Hi all,
  
   Most of the boards based on TI processors uses common configuration files
   (ti_armv7_common.h, ti_processor_common.h) to avoid duplication of 
   code.
   This is right except for OMAP3-based boards. In order to use the same 
   schema
   as used on am33xx, omap4, omap5 and dra7 TI processors these patches 
   create
   a new ti_omap3_common.h (that include ti_armv7_common.h) with the 
   purpose that
   all OMAP3 board can use it.
  
   Patches 1 and 2 just renames current omap4|omap5_common.h to
   ti_omap4|omap5_common.h to be coherent with current ti_am33xx_common.h,
   ti_armv7_common.h and the new ti_omap3_common.h. It's just a cosmetic 
   change so
   if people don't like it I don't have any inconvenient to remove from 
   these
   series.
  
   Patches 3 and 4 modifies the ti_armv7_common.h to be more compatible 
   with OMAP3
   boards. For example, patch 3 removes the assumption that all ti_armv7 
   have an
   ELM hardware engine and patch 4 handles the case that the number of DRAM 
   banks
   is defined at board level. The patch 5 is also required to integrate the 
   use
   of ti_armv7_common.h on OMAP3 boards.
  
   Patch 6 creates the new ti_omap3_common.h to be used for any OMAP3-based 
   board.
  
   And finally, patch 7 moves the IGEP boards to use the new common file. 
   As I
   only have IGEP hardware to test these patches I decided only implement 
   the use
   case for these boards. I don't have any inconvenient to move other OMAP3 
   boards
   to use this schema but I prefer leave the decision to the board 
   maintainers.
  
   Any comments, improvements, fixes are welcome.
  
   Best regards,
  
   Enric Balletbo i Serra (7):
 ARM: OMAP4: Rename to ti_omap4_common.h
 ARM: OMAP5: Rename to ti_omap5_common.h
 TI: armv7: Move ELM support to SoC configuration file.
 TI: armv7: Do not define the number DRAM banks if is already defined.
 ARM: OMAP3: Rename OMAP3_PUBLIC_SRAM_* to NON_SECURE_SRAM_*
 TI: OMAP3: Create common config files for TI OMAP3 platforms.
 OMAP3: igep00x0: Convert to ti_omap3_common.h.
  
arch/arm/include/asm/arch-omap3/omap3.h|   6 +-
include/configs/dra7xx_evm.h   |   4 +-
include/configs/omap3_igep00x0.h   | 190 
   +
include/configs/omap4_panda.h  |   4 +-
include/configs/omap4_sdp4430.h|   4 +-
include/configs/omap5_uevm.h   |   4 +-
include/configs/ti_am335x_common.h |   4 +
include/configs/ti_armv7_common.h  |  11 +-
include/configs/ti_omap3_common.h  |  73 
.../configs/{omap4_common.h = ti_omap4_common.h}  |  10 +-
.../configs/{omap5_common.h = ti_omap5_common.h}  |  10 +-
11 files changed, 118 insertions(+), 202 deletions(-)
create mode 100644 include/configs/ti_omap3_common.h
rename include/configs/{omap4_common.h = ti_omap4_common.h} (95%)
rename include/configs/{omap5_common.h = ti_omap5_common.h} (95%)
 
  Ping, any comment on this patch series ?
 
  I intend to pick this up after v2014.01.  Thanks!
 
 
 Now that merge window is open, did you try to pick these patches?

I'm planning to today.

 There is an issue that affect the IGEP boards introduced by commit
 
   commit f33b9bd3984fb11e1d8566a866adc5957b1e1c9d
   arm: omap3: Enable clocks for peripherals only if they are used
 
 To fix the issue, I need to modify the omap3_igep00x0.h file and I'm
 thinking that it's preferable wait and send the patch after these
 patches.
 
 Also there is any plan to create a branch for 2014.01 with fixes ?

Depends on how many other boards also need to re-enable some clocks I
guess.

-- 
Tom


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


Re: [U-Boot] T4QDS e6500 core and U-Boot 64-bit

2014-01-24 Thread Wolfgang Denk
Dear Danny,

In message 52e15bad.1020...@coloradoengineeringinc.com you wrote:
 
  Yes - if you add support for 64 bit configurations in general, and
  for powerpc64 in particular.
 I don't even have a sense for what would be involved here. How 
 fundamentally would the U-Boot code need to change?

It's probably heavy.  There is a ton of places where we assume we can
put an address in a long data type, etc.

 My reason for wanting to run 64-bit is that this system has 12 GB of 
 RAM. Will 32-bit U-Boot be able to access and test more than 4 GB of RAM?

No.  For the access part: usually this i not really needed.  U-Boot
is a boot loader, intended to load and start an OS.  for this, a 32
bit address space should be more than sufficient.  For the test
part, it is probably much easier to add a customized memory test (or
fix just the existing memory test such that it can be built for a 64
bit mode) and use this, then trying to run all of U-Boot in 64 bit
mode.

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
No matter where you go, there you are...  - Buckaroo Banzai
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] cmd_pxe.c add any option for filesystem with sysboot uses generic load

2014-01-24 Thread Wolfgang Denk
Dear Dennis Gilmore,

In message 1390501358-4564-2-git-send-email-den...@ausil.us you wrote:
 Signed-off-by: Dennis Gilmore den...@ausil.us

add any option for filesystem with sysboot uses generic load ?

I'm sorry, but I cannot understand what this is supposed to mean.

 +#ifdef CONFIG_CMD_FS_GENERIC

Can you please add some documentation to the README what this (so far
undocumented) option means?

Thanks.

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
F u cn rd ths u cnt spl wrth a dm!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/6] ARM: tegra: MASK_BITS_ no longer needs specific values

2014-01-24 Thread Thierry Reding
On Wed, Jan 22, 2014 at 01:20:35PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com
 
 Since all code that sets or interprets MASK_BITS_* now uses the enums
 to define/compare the values, there is no need for MASK_BITS_* to have
 a specific integer value. In fact, having a specific integer value may
 encourage people to hard-code those values, or interpret the values in
 incorrect ways.
 
 As such, remove the logic that assigns a specific value to the enum
 values in order to make it completely clear that it's just an enum, not
 something that directly represents some integer value.

Ah yes, that's a nice way to clean it up as well, so my earlier comment
about turning these into defines can be considered obsolete.

 diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
 b/arch/arm/include/asm/arch-tegra/clock.h
 index cb89bd91f40c..357d9c592b55 100644
 --- a/arch/arm/include/asm/arch-tegra/clock.h
 +++ b/arch/arm/include/asm/arch-tegra/clock.h
 @@ -30,7 +30,7 @@ enum clock_osc_freq {
   * them all together and pretends they're all 31:28.
   */
  enum {
 - MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
 + MASK_BITS_31_30,/* num of bits used to specify clock source */

Should the comment not be removed as well now?

Thierry


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


Re: [U-Boot] [PATCH 2/2] config: add config_distro_defaults.h

2014-01-24 Thread Wolfgang Denk
Dear Dennis Gilmore,

In message 1390501358-4564-3-git-send-email-den...@ausil.us you wrote:
 describe a set of default features that distros can rely on being available.
 having this common definition means that distros can easily support systems
 implementing them.
 
 Signed-off-by: Dennis Gilmore den...@ausil.us
 ---
  include/config_distro_defaults.h | 55 
 
  1 file changed, 55 insertions(+)
  create mode 100644 include/config_distro_defaults.h

For this patch set this adds dead code.  Please resubmit as part of a
series that actually uses this.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
An Elephant is a mouse with an Operating System.  - Knuth
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/6] ARM: tegra: rename MASK_BITS_29_28 to MASK_BITS_31_28

2014-01-24 Thread Thierry Reding
On Wed, Jan 22, 2014 at 01:20:32PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com
 
 The only place where the MASK_BITS_* values are used is in
 adjust_periph_pll(), which interprets the value 4 (old MASK_BITS_29_28,
 new MASK_BITS_31_28) as being associated with mask OUT_CLK_SOURCE4_MASK,
 i.e. bits 31:28. Rename the MASK_BITS_ macro to reflect how it's actually
 implemented.
 
 Note that no Tegra clock register actually uses all of bits 31:28 as
 the mux field. Rather, bits 30:28, 29:28, or 28 are used. However, in
 those cases, nothing is stored in the bits about the mux field, so it's

s/about/above/ perhaps?

 safe to pretend that the mux field extends all the way to the end of the
 register. As such, the U-Boot clock driver is currently a bit lazy, and
 doesn't distinguish between 31:28, 30:28, 29:29 and 29; it just lumps

Shouldn't that list be: 31:28, 30:28, 29:28 and 28?

 them all together and pretends they're all 31:28. This patch doesn't
 cause this issue; it was pre-existing. Hopefully, future patches will
 clean this up.

Yes, that'd be nice.

 diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
 b/arch/arm/include/asm/arch-tegra/clock.h
[...]
 +/*
 + * Note that no Tegra clock register actually uses all of bits 31:28 as
 + * the mux field. Rather, bits 30:28, 29:28, or 28 are used. However, in
 + * those cases, nothing is stored in the bits about the mux field, so it's
 + * safe to pretend that the mux field extends all the way to the end of the
 + * register. As such, the U-Boot clock driver is currently a bit lazy, and
 + * doesn't distinguish between 31:28, 30:28, 29:29 and 29; it just lumps

The list seems wrong here as well, but it looks like it's copy/pasted to
or from the commit message.

  enum {
   MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
   MASK_BITS_31_29,
 - MASK_BITS_29_28,
 + MASK_BITS_31_28,
  };

If this ever gets cleaned up I think it'd be clearer to explicitly
define them to the number of bits that they use by turning them into
#defines.

Thierry


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


Re: [U-Boot] [PATCH 3/6] ARM: tegra: rename OUT_CLK_SOURCE_*

2014-01-24 Thread Thierry Reding
On Wed, Jan 22, 2014 at 01:20:33PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com
 
 OUT_CLK_SOURCE_ are currently named after the number of bits the mask
 they represent includes. However, bit count is not the only possible
 variable; bit position may also vary. Rename OUT_CLK_SOURCE_ to
 OUT_CLK_SOURCE_31_30_ and OUT_CLK_SOURCE4_ to OUT_CLK_SOURCE_31_28 to
 more completely describe exactly what they represent, without having to

Nit: I think you should pick either completely or exactly.

Thierry


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


Re: [U-Boot] [PATCH 1/6] ARM: tegra: deduplicate MASK_BITS_xxx clock mux enum

2014-01-24 Thread Thierry Reding
On Wed, Jan 22, 2014 at 01:20:31PM -0700, Stephen Warren wrote:
 From: Tom Warren twarren.nvi...@gmail.com
 
 The enum used to define the set of register bits used to represent a
 clock's input mux, MUX_BITS_*, is defined separately for each SoC at
 present. Move this definition to a common location to ease fixing up
 some issues with the definition, and the code that uses it.
 
 Signed-off-by: Tom Warren twar...@nvidia.com
 [swarren, extracted from a larger patch by Tom]
 Signed-off-by: Stephen Warren swar...@nvidia.com
 ---
  arch/arm/cpu/tegra114-common/clock.c| 6 --
  arch/arm/cpu/tegra30-common/clock.c | 6 --
  arch/arm/include/asm/arch-tegra/clock.h | 6 ++
  3 files changed, 6 insertions(+), 12 deletions(-)

With the few small comments addressed, the series:

Reviewed-by: Thierry Reding tred...@nvidia.com

I've also given these a spin together with your reworked Tegra124
patches and it all works great, so:

Tested-by: Thierry Reding tred...@nvidia.com

And since Tom asked for it:

Acked-by: Thierry Reding tred...@nvidia.com

Thierry


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


Re: [U-Boot] about the DABT handler in imx_pcie.c

2014-01-24 Thread Marek Vasut
On Friday, January 24, 2014 at 12:55:07 PM, Wally Yeh wrote:
 Dear Marek:
 I'm sorry to send this email bothering you.
 but I'm so curious about your patch in uboot:
 http://patchwork.ozlabs.org/patch/301216/
 
 in your patch imx_pcie.c, there's a fuction replace the DABT handler for
 freescale i.mx6 series.
 
 and you write this memory address to replace DABT handler:
 static const uint32_t data_abort_bounce_handler = 0xe25ef004;
 
 I'm curious does this memory address stands for what?

That's an instruction, subs pc, r14, #4 , means return from DABT.

 can I replace this value for what I want?

No, see above.

 I would be appreciated If you can give me some hint. thank you.

What do you need to do? Also next time, make sure to send email to the ML 
(CC'd).

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


Re: [U-Boot] Nand Erase/Write Fails with mtd error -5

2014-01-24 Thread Wolfgang Denk
Dear mks,

it would be nice if you could use a real name here...

In message 1310410193.3166.2.camel@debian you wrote:
 
 Im getting a trouble with mtd on my imx27 27 board, I can't write or
 erase it on U-Boot-1.3.4, here is the log :

I'm sorry, but v1.3.4 is more than 5 years old - this is hopelessly
obsolete.  Please do yourself (and us) a favour and upgrade to a
recent version (say, v2014.01) an try again.  It is pretty much likely
that your error has long been fixed sice.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
I can type faster than I can move a  mouse,  so  I  find  menu-driven
drawing packages time consuming and frustrating.  - W. R. Stevens
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: tegra: amend pmc.h for Tegra114+

2014-01-24 Thread Thierry Reding
On Wed, Jan 22, 2014 at 01:20:59PM -0700, Stephen Warren wrote:
[...]
 diff --git a/arch/arm/include/asm/arch-tegra/pmc.h 
 b/arch/arm/include/asm/arch-tegra/pmc.h
[...]
 @@ -21,7 +21,11 @@ struct pmc_ctlr {
   uint pmc_dpd_sample;/* _DPD_PADS_SAMPLE_0, offset 20 */
   uint pmc_dpd_enable;/* _DPD_PADS_ENABLE_0, offset 24 */
   uint pmc_pwrgate_timer_off; /* _PWRGATE_TIMER_OFF_0, offset 28 */
 - uint pmc_pwrgate_timer_on;  /* _PWRGATE_TIMER_ON_0, offset 2C */
 +#if defined(CONFIG_TEGRA20) || defined(CONFIG_TEGRA30)
 + uint pmc_pwrgate_timer_on;  /* _PWRGATE_TIMER_ON_0, offset 28 */

The comment here is wrong, it's still at offset 0x2c. Other than that:

Reviewed-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com

I've also applied this to my local tree that I booted the Venice2 from,
along with your other patches, so:

Tested-by: Thierry Reding tred...@nvidia.com

Thierry


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


Re: [U-Boot] [PATCH] nitrogen6x: README: Only calling 'make' is enough

2014-01-24 Thread Eric Nelson

Thanks Fabio,

On 01/24/2014 04:15 AM, Fabio Estevam wrote:

From: Fabio Estevam fabio.este...@freescale.com

No need to pass 'u-boot.imx' as parameter for 'make' because u-boot.imx is
built by default.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
  board/boundary/nitrogen6x/README | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/boundary/nitrogen6x/README b/board/boundary/nitrogen6x/README
index 5049093..6f449be 100644
--- a/board/boundary/nitrogen6x/README
+++ b/board/boundary/nitrogen6x/README
@@ -67,7 +67,7 @@ override auto-detection and force activation of the specified 
panel.
  To build U-Boot for one of the Nitrogen6x or SabreLite board:

make nitrogen6x_config
-   make u-boot.imx
+   make

  Note that 'nitrogen6x' is a placeholder. The complete list of supported
  board configurations is shown in tha MAINTAINERS file:



Acked-by: Eric Nelson eric.nel...@boundarydevices.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] nitrogen6x: README: Do not refer to MAINTAINERS file

2014-01-24 Thread Eric Nelson

On 01/24/2014 04:27 AM, Fabio Estevam wrote:

From: Fabio Estevam fabio.este...@freescale.com

MAINTAINERS file has been removed from the project.

Replace its reference with 'boards.cfg' file instead.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
  board/boundary/nitrogen6x/README | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/boundary/nitrogen6x/README b/board/boundary/nitrogen6x/README
index 6f449be..9d84265 100644
--- a/board/boundary/nitrogen6x/README
+++ b/board/boundary/nitrogen6x/README
@@ -70,7 +70,7 @@ To build U-Boot for one of the Nitrogen6x or SabreLite board:
make

  Note that 'nitrogen6x' is a placeholder. The complete list of supported
-board configurations is shown in tha MAINTAINERS file:
+board configurations is shown in the boards.cfg file:
nitrogen6q  i.MX6Q/6D   1GB
nitrogen6dl i.MX6DL 1GB
nitrogen6s  i.MX6S  512MB



Acked-by: Eric Nelson eric.nel...@boundarydevices.com

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


Re: [U-Boot] [RFC PATCH 1/1] Add support for pengwyn board

2014-01-24 Thread Gerhard Sittig
On Fri, Jan 24, 2014 at 13:49 +0100, micro1183 wrote:
 
 This patch adds support for the silica pengwyn board with AM335x SoC
 
 Signed-off-by: Lothar Felten lothar.fel...@gmail.com

Please consider using git send-email for submission.  Your MUA
broke the patch so it doesn't apply, and the From and S-o-b specs
don't match.


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


Re: [U-Boot] [RFC PATCH 1/1] Add support for pengwyn board

2014-01-24 Thread Wolfgang Denk
Dear micro1183,

In message 52e2615c.1000...@gmail.com you wrote:
 This patch adds support for the silica pengwyn board with AM335x SoC

Your patch is line-wrapped and does not apply.  Please fix your mailer
configuration.

 +/*
 + * board.c
 + *
 + * Copyright (C) 2013 Lothar Felten lothar.fel...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation version 2.

Please use a SPDX license tag instead.  And please notice that new code
should have GPL-2.0+; GPL-2.0 is not sufficient.

Please fix globally.

 +#include common.h
 +#include errno.h
 +#include spl.h
 +#include asm/arch/cpu.h
 +#include asm/arch/hardware.h
 +#include asm/arch/omap.h
 +#include asm/arch/ddr_defs.h
 +#include asm/arch/clock.h
 +#include asm/arch/gpio.h
 +#include asm/arch/mmc_host_def.h
 +#include asm/arch/sys_proto.h
 +#include asm/io.h
 +#include asm/emif.h
 +#include asm/gpio.h
 +#include i2c.h
 +#include miiphy.h
 +#include cpsw.h
 +#include power/tps65217.h
 +#include board.h

Do you really need all these headers?


 +#define MACH_TYPE_PENGWYN1234

MACH-ID 1234 is registered for the gene1270 bord.  Please do not
hijack other board's IDs!  Register your own instead, please.

 +/* Always 128 KiB env size */
 +#define CONFIG_ENV_SIZE  (128  10)

This makes no sense.  You will never need that much, and such a huge
size just slows down booting etc.

 +/* NS16550 Configuration */
 +#define CONFIG_SYS_NS16550_COM1  0x44e09000  /* Base EVM has 
 UART0 */
 +#define CONFIG_SYS_NS16550_COM2  0x48022000  /* UART1 */
 +#define CONFIG_SYS_NS16550_COM3  0x48024000  /* UART2 */
 +#define CONFIG_SYS_NS16550_COM4  0x481a6000  /* UART3 */
 +#define CONFIG_SYS_NS16550_COM5  0x481a8000  /* UART4 */
 +#define CONFIG_SYS_NS16550_COM6  0x481aa000  /* UART5 */

Do you really need all of these?


 +#define CONFIG_USBNET_HOST_ADDR  de:ad:be:af:00:00

Is this a good idea?

 +/* USB TI's IDs */
 +#define CONFIG_G_DNL_VENDOR_NUM 0x0403
 +#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00
 +#define CONFIG_G_DNL_MANUFACTURER Texas Instruments

Is this really a TI board?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
In any group of employed individuals the only naturally  early  riser
is  _always_  the office manager, who will _always_ leave reproachful
little notes ... on the desks of their subordinates.
- Terry Pratchett, _Lords and Ladies_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2] ARM: tegra: don't exceed AVP limits when configuring PLLP

2014-01-24 Thread Thierry Reding
On Thu, Jan 23, 2014 at 11:58:13AM -0700, Stephen Warren wrote:
[...]
 diff --git a/arch/arm/cpu/tegra-common/clock.c 
 b/arch/arm/cpu/tegra-common/clock.c
[...]
 @@ -575,3 +575,91 @@ void clock_init(void)
   /* Do any special system timer/TSC setup */
   arch_timer_init();
  }
 +
 +static void set_avp_clock_to(u32 src)

Perhaps a better name would be set_avp_clock_source()? _to had me
confused at first because I assumed it would be setting a frequency.

 +void tegra30_or_later_adjust_pllp(void)

I would've called this simply tegra30_adjust_pllp(), where it's implied
that when you call tegra30_*() from code targetted at later generations
these would be compatible with Tegra30.

But if you'd rather make it implicit that's fine too.

Either way:

Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com

Thierry


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


Re: [U-Boot] [PATCH 1/2] cmd_pxe.c add any option for filesystem with sysboot uses generic load

2014-01-24 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/24/2014 08:49 AM, Wolfgang Denk wrote:
 Dear Dennis Gilmore,
 
 In message 1390501358-4564-2-git-send-email-den...@ausil.us you wrote:
 Signed-off-by: Dennis Gilmore den...@ausil.us
 
 add any option for filesystem with sysboot uses generic load ?
 
 I'm sorry, but I cannot understand what this is supposed to mean.
 
 +#ifdef CONFIG_CMD_FS_GENERIC
 
 Can you please add some documentation to the README what this (so far
 undocumented) option means?

For the record, this is another (relatively) long-standing undocumented
option.

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

iQIcBAEBAgAGBQJS4nG/AAoJENk4IS6UOR1WpowQAJ9mvamsYIp9/EiyG7+i6Y5x
rjPNTiwWq0CVCpQsHOkTkzC0Fsgu1Pv9zPBqiVE+u4R/oItnEXxPZVexKreaT6YN
F4BP2z4+x65TCMclbMKSmRMgaQOlnaowofP6vesE5NwwEtdC1wPG5cx0cAXYSE3E
CsqADFm1O62Zpi5uNSkQjYZ0dJhX1Iupykx+nFpwx/mrGis9iyDnqHD6cKTGFMwn
58knHK0/r6icda04LPUTaZ6M8lmvgSvNhgjS76we/EhkFTeCgvbwQa8wOJynZoYE
Nralsd4c8JlUjLtTaHnB8TQACq4wE9/EYNeGwJmutrUnBAHLV0AH7QS4gnPvSyXQ
HO+fuA4g/6zAAMIPDrLWDn6jsAHQ4IIDmCcvqI7g2Irut9OHw2kKdyktKFcIW4+x
VLkZoi8pFrpSdHab9o4xzqpehSNA/bTKp1q2foHrdfxbRw6BIwEkwgrqUNI7XRg9
rzFb9eTdKedTszHBX7WQquyAZhSx1YqvGYXXGRZj1MQ6uvl+X2As1eva9ajoNKqQ
x2ahXpXr5+di3AZmGYgfD6TG7jnOnYynEj3ATxpLkR615tXnojByvCKR4fJeyio3
q9BZqEq8Zc9CTU7aZUCRyI88Ewvn6Q3lYE/E57xAoyoXMPvTmErmmxbgZAy8qZWh
sNEV+Jl6A2w5QxzfGqGt
=wHiM
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 01/13] mmc: tegra: support Tegra124

2014-01-24 Thread Pantelis Antoniou
Hi Stephen,

Looks fine to me..

On Jan 24, 2014, at 2:42 AM, Stephen Warren wrote:

 From: Stephen Warren swar...@nvidia.com
 
 Tegra124's MMC controller is very similar to earlier SoC generations,
 and can be supported by the same driver.
 
 However, there are some non-backwards-compatible HW differences, and
 hence a new DT compatible value must be used to describe the HW. This
 patch updates the driver to support that new compatible value.
 
 That said, the HW differences are only relevant when enabling certain
 high-performance transfer modes. Since the driver is currently very
 simple and doesn't enable those modes, we don't actually need to address
 any of these HW differences in the code yet, hence the simple nature of
 this patch.
 
 Cc: Pantelis Antoniou pa...@antoniou-consulting.com
 Signed-off-by: Stephen Warren swar...@nvidia.com
 ---
 v2: New patch.
 
 This patch is needed for MMC support on Tegra124 at run-time, but not
 strictly required at compile-time. So, it can either go into the MMC
 tree and all get merged together in the main U-Boot repo, or the MMC
 maintainer can ack it to go through the Tegra tree with the rest of
 the changes.
 ---
 drivers/mmc/tegra_mmc.c | 9 +
 include/fdtdec.h| 1 +
 lib/fdtdec.c| 1 +
 3 files changed, 11 insertions(+)
 
 diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c
 index e1817e24f6d4..3d1ce1263c82 100644
 --- a/drivers/mmc/tegra_mmc.c
 +++ b/drivers/mmc/tegra_mmc.c
 @@ -668,6 +668,15 @@ void tegra_mmc_init(void)
   const void *blob = gd-fdt_blob;
   debug(%s entry\n, __func__);
 
 + /* See if any Tegra124 MMC controllers are present */
 + count = fdtdec_find_aliases_for_id(blob, sdhci,
 + COMPAT_NVIDIA_TEGRA124_SDMMC, node_list, MAX_HOSTS);
 + debug(%s: count of Tegra124 sdhci nodes is %d\n, __func__, count);
 + if (process_nodes(blob, node_list, count)) {
 + printf(%s: Error processing T30 mmc node(s)!\n, __func__);
 + return;
 + }
 +
   /* See if any Tegra30 MMC controllers are present */
   count = fdtdec_find_aliases_for_id(blob, sdhci,
   COMPAT_NVIDIA_TEGRA30_SDMMC, node_list, MAX_HOSTS);
 diff --git a/include/fdtdec.h b/include/fdtdec.h
 index 433d6a7c0256..19bab7944817 100644
 --- a/include/fdtdec.h
 +++ b/include/fdtdec.h
 @@ -59,6 +59,7 @@ enum fdt_compat_id {
   COMPAT_NVIDIA_TEGRA20_NAND, /* Tegra2 NAND controller */
   COMPAT_NVIDIA_TEGRA20_PWM,  /* Tegra 2 PWM controller */
   COMPAT_NVIDIA_TEGRA20_DC,   /* Tegra 2 Display controller */
 + COMPAT_NVIDIA_TEGRA124_SDMMC,   /* Tegra124 SDMMC controller */
   COMPAT_NVIDIA_TEGRA30_SDMMC,/* Tegra30 SDMMC controller */
   COMPAT_NVIDIA_TEGRA20_SDMMC,/* Tegra20 SDMMC controller */
   COMPAT_NVIDIA_TEGRA20_SFLASH,   /* Tegra 2 SPI flash controller */
 diff --git a/lib/fdtdec.c b/lib/fdtdec.c
 index 207314fa72fb..1fecab3fbc30 100644
 --- a/lib/fdtdec.c
 +++ b/lib/fdtdec.c
 @@ -32,6 +32,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
   COMPAT(NVIDIA_TEGRA20_NAND, nvidia,tegra20-nand),
   COMPAT(NVIDIA_TEGRA20_PWM, nvidia,tegra20-pwm),
   COMPAT(NVIDIA_TEGRA20_DC, nvidia,tegra20-dc),
 + COMPAT(NVIDIA_TEGRA124_SDMMC, nvidia,tegra124-sdhci),
   COMPAT(NVIDIA_TEGRA30_SDMMC, nvidia,tegra30-sdhci),
   COMPAT(NVIDIA_TEGRA20_SDMMC, nvidia,tegra20-sdhci),
   COMPAT(NVIDIA_TEGRA20_SFLASH, nvidia,tegra20-sflash),
 -- 
 1.8.1.5
 

Acked-by: Pantelis Antoniou pa...@antoniou-consulting.com

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


Re: [U-Boot] [RFC][PATCH 0/7] TI: OMAP3: Use common config file.

2014-01-24 Thread Enric Balletbo Serra
Hi Tom,

2014/1/24 Tom Rini tr...@ti.com:
 On Fri, Jan 24, 2014 at 09:45:36AM +0100, Enric Balletbo Serra wrote:
 Hi Tom,

 2014/1/6 Tom Rini tr...@ti.com:
  On Mon, Dec 23, 2013 at 12:11:25PM +0100, Enric Balletbo Serra wrote:
  2013/12/6 Enric Balletbo i Serra eballe...@gmail.com:
   Hi all,
  
   Most of the boards based on TI processors uses common configuration 
   files
   (ti_armv7_common.h, ti_processor_common.h) to avoid duplication of 
   code.
   This is right except for OMAP3-based boards. In order to use the same 
   schema
   as used on am33xx, omap4, omap5 and dra7 TI processors these patches 
   create
   a new ti_omap3_common.h (that include ti_armv7_common.h) with the 
   purpose that
   all OMAP3 board can use it.
  
   Patches 1 and 2 just renames current omap4|omap5_common.h to
   ti_omap4|omap5_common.h to be coherent with current ti_am33xx_common.h,
   ti_armv7_common.h and the new ti_omap3_common.h. It's just a cosmetic 
   change so
   if people don't like it I don't have any inconvenient to remove from 
   these
   series.
  
   Patches 3 and 4 modifies the ti_armv7_common.h to be more compatible 
   with OMAP3
   boards. For example, patch 3 removes the assumption that all ti_armv7 
   have an
   ELM hardware engine and patch 4 handles the case that the number of 
   DRAM banks
   is defined at board level. The patch 5 is also required to integrate 
   the use
   of ti_armv7_common.h on OMAP3 boards.
  
   Patch 6 creates the new ti_omap3_common.h to be used for any 
   OMAP3-based board.
  
   And finally, patch 7 moves the IGEP boards to use the new common file. 
   As I
   only have IGEP hardware to test these patches I decided only implement 
   the use
   case for these boards. I don't have any inconvenient to move other 
   OMAP3 boards
   to use this schema but I prefer leave the decision to the board 
   maintainers.
  
   Any comments, improvements, fixes are welcome.
  
   Best regards,
  
   Enric Balletbo i Serra (7):
 ARM: OMAP4: Rename to ti_omap4_common.h
 ARM: OMAP5: Rename to ti_omap5_common.h
 TI: armv7: Move ELM support to SoC configuration file.
 TI: armv7: Do not define the number DRAM banks if is already defined.
 ARM: OMAP3: Rename OMAP3_PUBLIC_SRAM_* to NON_SECURE_SRAM_*
 TI: OMAP3: Create common config files for TI OMAP3 platforms.
 OMAP3: igep00x0: Convert to ti_omap3_common.h.
  
arch/arm/include/asm/arch-omap3/omap3.h|   6 +-
include/configs/dra7xx_evm.h   |   4 +-
include/configs/omap3_igep00x0.h   | 190 
   +
include/configs/omap4_panda.h  |   4 +-
include/configs/omap4_sdp4430.h|   4 +-
include/configs/omap5_uevm.h   |   4 +-
include/configs/ti_am335x_common.h |   4 +
include/configs/ti_armv7_common.h  |  11 +-
include/configs/ti_omap3_common.h  |  73 
.../configs/{omap4_common.h = ti_omap4_common.h}  |  10 +-
.../configs/{omap5_common.h = ti_omap5_common.h}  |  10 +-
11 files changed, 118 insertions(+), 202 deletions(-)
create mode 100644 include/configs/ti_omap3_common.h
rename include/configs/{omap4_common.h = ti_omap4_common.h} (95%)
rename include/configs/{omap5_common.h = ti_omap5_common.h} (95%)
 
  Ping, any comment on this patch series ?
 
  I intend to pick this up after v2014.01.  Thanks!
 

 Now that merge window is open, did you try to pick these patches?

 I'm planning to today.


Good to know, I'll wait then.

 There is an issue that affect the IGEP boards introduced by commit

   commit f33b9bd3984fb11e1d8566a866adc5957b1e1c9d
   arm: omap3: Enable clocks for peripherals only if they are used

 To fix the issue, I need to modify the omap3_igep00x0.h file and I'm
 thinking that it's preferable wait and send the patch after these
 patches.

 Also there is any plan to create a branch for 2014.01 with fixes ?

 Depends on how many other boards also need to re-enable some clocks I
 guess.


I don't know, maybe someone with OMAP3 hardware can verify if it's
affected. IGEP boards are affected, my bad that I don't had time to
test in RC cycle :(


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


Re: [U-Boot] [PATCH 0/2] Add External SD Card support for Marvell GplugD

2014-01-24 Thread Ajay Bhargav
- Prafulla Wadaskar prafu...@marvell.com wrote:

 Hi Ajay,
 
 Please avoid re-post with the same subject.
 I think, Yesterday you posted the same patches.
 If there is any diff or updates, then you should add next version info
 to them.
 
 Regards...
 Prafulla . . .
 

Hi Prafulla,

I apologize for this mistake but I got error message from u-boot mailing list.

Message rejected. No base64 encoded MIME text parts allowed.

I did not know if message reached successfully or not. So I tried to send 
patches again. May I know why I got such message? or if anything I can do to 
remove this message.

Regards,
Ajay Bhargav
*
eInfochips Business Disclaimer : This e-mail message and all attachments 
transmitted with it are intended solely for the use of the addressee and may 
contain legally privileged and confidential information. If the reader of this 
message is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution, copying, or other use of this message or its 
attachments is strictly prohibited. If you have received this message in error, 
please notify the sender immediately by replying to this message and please 
delete it from your computer. Any views expressed in this message are those of 
the individual sender unless otherwise stated. Company has taken enough 
precautions to prevent the spread of viruses. However the company accepts no 
liability for any damage caused by any virus transmitted by this email.
*


-
Notice: 
This message has been scanned by Trend Micro Mail Security scanner and is 
believed to be clean
-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] PPC 85xx: Add qemu-ppce500 machine

2014-01-24 Thread Alexander Graf

On 24.01.2014, at 02:39, Scott Wood scottw...@freescale.com wrote:

 On Fri, 2014-01-24 at 02:25 +0100, Alexander Graf wrote:
 On 24.01.2014, at 01:49, Scott Wood scottw...@freescale.com wrote:
 
 On Thu, 2014-01-23 at 14:08 +0100, Alexander Graf wrote:
 On 21.01.2014, at 03:25, Scott Wood scottw...@freescale.com wrote:
 
 On Sun, 2014-01-19 at 16:19 +0100, Alexander Graf wrote:
 For KVM we have a special PV machine type called ppce500. This machine
 is inspired by the MPC8544DS board, but implements a lot less features
 than that one.
 
 It also provides more PCI slots and is supposed to be enumerated by
 device tree only.
 
 This patch adds support for the current generation ppce500 machine as
 it is implemented today.
 
 Signed-off-by: Alexander Graf ag...@suse.de
 ---
 arch/powerpc/cpu/mpc85xx/start.S|7 +
 arch/powerpc/include/asm/config_mpc85xx.h   |4 +
 board/freescale/qemu-ppce500/Makefile   |   10 ++
 board/freescale/qemu-ppce500/qemu-ppce500.c |  260 
 +++
 board/freescale/qemu-ppce500/tlb.c  |   59 ++
 boards.cfg  |1 +
 include/configs/qemu-ppce500.h  |  235 
 
 7 files changed, 576 insertions(+)
 create mode 100644 board/freescale/qemu-ppce500/Makefile
 create mode 100644 board/freescale/qemu-ppce500/qemu-ppce500.c
 create mode 100644 board/freescale/qemu-ppce500/tlb.c
 create mode 100644 include/configs/qemu-ppce500.h
 
 diff --git a/arch/powerpc/cpu/mpc85xx/start.S 
 b/arch/powerpc/cpu/mpc85xx/start.S
 index db84d10..ccbcc03 100644
 --- a/arch/powerpc/cpu/mpc85xx/start.S
 +++ b/arch/powerpc/cpu/mpc85xx/start.S
 @@ -80,6 +80,13 @@ _start_e500:
  li  r1,MSR_DE
  mtmsr   r1
 
 +#ifdef CONFIG_QEMU_E500
 +/* Save our ePAPR device tree off before we clobber it */
 +lis r2, CONFIG_QEMU_DT_ADDR@h
 +ori r2, r2, CONFIG_QEMU_DT_ADDR@l
 +stw r3, 0(r2)
 +#endif
 
 r2 has a special purpose -- please don't use it for other things, even
 if it's too early to be a problem and other code is similarly bad.
 
 Heh, ok. I'll use r4 instead.
 
 Instead of saving the DT pointer in some random hardcoded address, how
 about sticking it in a callee-saved register until you're able to store
 it in the global data struct?
 
 I did that at first but that didn't survive relocation. However, I just
 remembered that I had my global variable in bss, so maybe relocation
 doesn't work properly there. Instead I put it in .data now and that
 seems to work.
 
 It's certainly the nicer solution, I agree.
 
 I don't mean a global variable, but a field in the global data struct
 (gd_t).  BSS should not be accessed, and global variables should not be
 written, before relocation (although you may get away with the latter
 pre-relocation in ramboot cases, you still shouldn't).
 
 But the global data gets cleared in cpu_init_early_f(). So I'd have to
 shove it to some non-volatile, make sure no other code uses that
 particular register and then move it into gd.
 
 Right.
 
 And how do I get offsets into the gd structure from asm in the first place?
 
 See lib/asm-offsets.c
 
 Or are you suggesting I move r3 into r2x, leave it there until after
 cpu_init_early_f(), copy it back to r3 and then call a C helper that
 puts it into gd? Sounds quite excessive for something that works quite
 well with a global variable in .data :).
 
 It only works because you are booting directly from RAM, and the
 variable you're writing to isn't subject to relocation, and isn't in the
 BSS (unlike most uninitialized/zero-initialized data).  It's not good
 practice.  What if you later want to simulate NOR flash and boot from
 that?

Ok, I'll change it :)

Saving it from asm only doesn't work though because we end up accessing the fdt 
pointer inside of cpu_early_init_f() which clears the gd. I've made the fdt 
pointer a function argument now.

 
 which is the only place where we actually use $ramdisk_addr. If a user
 wants to specify the initrd within U-Boot he can do that easily because
 he would specify his own boot command anyway, right?
 
 Oh.  I was confusing it with the existing $ramdiskaddr.  So I'm changing
 my objection to the fact that it's confusing. :-)
 
 Likewise $fdt_addr versus $fdtaddr.
 
 Mind to explain what the difference is between $fdtaddr, $fdt_addr (pxe 
 boot?) and $fdt_addr_r? Which one should I set?
 
 I don't know what the _r is supposed to mean, but the underscore seems
 to just be something that varies from board to board.  Our boards use
 $fdtaddr and until now I didn't realize other boards do it differently.

Bah - I'll just set all of them.

 
 +unsigned long
 +get_board_sys_clk(ulong dummy)
 +{
 +/* The actual clock doesn't matter in a PV machine */
 +return ;
 +}
 
 s/doesn't matter/doesn't exist/
 
 Where is this used from?  Can it be skipped for this target?  Is the CPU
 timebase handled properly?
 
 Turns out it's not 

Re: [U-Boot] [PATCH 2/2] config: add config_distro_defaults.h

2014-01-24 Thread Dennis Gilmore
Hi Wolfgang,


El Fri, 24 Jan 2014 14:50:10 +0100
Wolfgang Denk w...@denx.de escribió:
 Dear Dennis Gilmore,
 
 In message 1390501358-4564-3-git-send-email-den...@ausil.us you
 wrote:
  describe a set of default features that distros can rely on being
  available. having this common definition means that distros can
  easily support systems implementing them.
  
  Signed-off-by: Dennis Gilmore den...@ausil.us
  ---
   include/config_distro_defaults.h | 55
   1 file changed, 55
  insertions(+) create mode 100644 include/config_distro_defaults.h
 
 For this patch set this adds dead code.  Please resubmit as part of a
 series that actually uses this.

in the cover email i put

I have left out any implementations in this set of patches. I am
working to redo all the implementations based on the work done by
Stephen Warren in his recent set to base on top of these and his exists
work. 


Stephen has submitted patches that use this code. and I will be
submitting further patches that use it in the next few days.

I will be submitting a V2 that fixes Stephens comment

Dennis

 
 Best regards,
 
 Wolfgang Denk
 

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


Re: [U-Boot] [PATCH V2 07/13] ARM: tegra: add/edit headers for Tegra124

2014-01-24 Thread Thierry Reding
On Thu, Jan 23, 2014 at 05:42:54PM -0700, Stephen Warren wrote:
[...]
 diff --git a/arch/arm/include/asm/arch-tegra/clk_rst.h 
 b/arch/arm/include/asm/arch-tegra/clk_rst.h
[...]
 @@ -105,10 +128,10 @@ struct clk_rst_ctlr {
   uint crc_clk_cpug_cmplx;/* _CLK_CPUG_CMPLX_0,   0x378 */
   uint crc_clk_cpulp_cmplx;   /* _CLK_CPULP_CMPLX_0,  0x37C */
   uint crc_cpu_softrst_ctrl;  /* _CPU_SOFTRST_CTRL_0, 0x380 */
 - uint crc_cpu_softrst_ctrl1; /* _CPU_SOFTRST_CTR1L_0,0x384 */
 + uint crc_cpu_softrst_ctrl1; /* _CPU_SOFTRST_CTRL1_0,0x384 */
   uint crc_cpu_softrst_ctrl2; /* _CPU_SOFTRST_CTRL2_0,0x388 */
   uint crc_reserved33[9]; /* _reserved_33,0x38c-3ac */
 - uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW]; /* _G3D2_0..., 0x3b0-0x42c */
 + uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW];  /* 0x3B0-0x42C */

While at it, perhaps also make the offsets in the comment for
crc_reserved33 also all caps?

 @@ -142,6 +165,47 @@ struct clk_rst_ctlr {
[...]
 + uint crs_reserved_50[7];/* _reserved_50, 0x4CC-0x4E4 */
[...]
 + uint crc_reserved51[1]; /* _reserved_51, 0x538 */
[...]
 + uint crc_reserved52[1]; /* _reserved_52, 0x554 */
[...]
 + uint crc_reserved60[40];/* _reserved_60, 0x560 - 0x5FC */

Spacing in these is all somewhat inconsistent.

 +/* CLK_RST_CONTROLLER_RST_CPUxx_CMPLX_CLR 0x344 */
 +#define CLR_CPURESET0(1  0)
 +#define CLR_CPURESET1(1  1)
 +#define CLR_CPURESET2(1  2)
 +#define CLR_CPURESET3(1  3)
[...]
 +/* CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR 0x34c */
 +#define CLR_CPU3_CLK_STP (1  11)
 +#define CLR_CPU2_CLK_STP (1  10)
 +#define CLR_CPU1_CLK_STP (1  9)
 +#define CLR_CPU0_CLK_STP (1  8)

Sometimes these are listed in order of increasing bit positions, other
times they are in order of decreasing bit positions.

 diff --git a/arch/arm/include/asm/arch-tegra/pmc.h 
 b/arch/arm/include/asm/arch-tegra/pmc.h
[...]
 +/* APBDEV_PMC_PWRGATE_TOGGLE_0 0x30 */
 +#define PWRGATE_TOGGLE_PARTID_CRAIL  0
 +#define PWRGATE_TOGGLE_PARTID_TD 1
 +#define PWRGATE_TOGGLE_PARTID_VE 2

  +#define PWRGATE_TOGGLE_PARTID_PCX3

 +#define PWRGATE_TOGGLE_PARTID_VDE4
 +#define PWRGATE_TOGGLE_PARTID_L2C5
 +#define PWRGATE_TOGGLE_PARTID_MPE6
 +#define PWRGATE_TOGGLE_PARTID_HEG7

  +#define PWRGATE_TOGGLE_PARTID_SAX8

 +#define PWRGATE_TOGGLE_PARTID_CE19
 +#define PWRGATE_TOGGLE_PARTID_CE210
 +#define PWRGATE_TOGGLE_PARTID_CE311
 +#define PWRGATE_TOGGLE_PARTID_CELP   12
 +#define PWRGATE_TOGGLE_PARTID_CE014
 +#define PWRGATE_TOGGLE_PARTID_C0NC   15
 +#define PWRGATE_TOGGLE_PARTID_C1NC   16

  +#define PWRGATE_TOGGLE_PARTID_SOR17

 +#define PWRGATE_TOGGLE_PARTID_DIS18
 +#define PWRGATE_TOGGLE_PARTID_DISB   19
 +#define PWRGATE_TOGGLE_PARTID_XUSBA  20
 +#define PWRGATE_TOGGLE_PARTID_XUSBB  21
 +#define PWRGATE_TOGGLE_PARTID_XUSBC  22

  +#define PWRGATE_TOGGLE_PARTID_VIC23
  +#define PWRGATE_TOGGLE_PARTID_IRAM   24

 +/* APBDEV_PMC_PWRGATE_STATUS_0 0x38 */
 +#define PWRGATE_STATUS_CRAIL_ENABLE  (1  0)
 +#define PWRGATE_STATUS_TD_ENABLE (1  1)
 +#define PWRGATE_STATUS_VE_ENABLE (1  2)

  +#define PWRGATE_STATUS_PCX_ENABLE(1  3)

 +#define PWRGATE_STATUS_VDE_ENABLE(1  4)
 +#define PWRGATE_STATUS_L2C_ENABLE(1  5)
 +#define PWRGATE_STATUS_MPE_ENABLE(1  6)
 +#define PWRGATE_STATUS_HEG_ENABLE(1  7)

  +#define PWRGATE_STATUS_SAX_ENABLE(1  8)

 +#define PWRGATE_STATUS_CE1_ENABLE(1  9)
 +#define PWRGATE_STATUS_CE2_ENABLE(1  10)
 +#define PWRGATE_STATUS_CE3_ENABLE(1  11)
 +#define PWRGATE_STATUS_CELP_ENABLE   (1  12)
 +#define PWRGATE_STATUS_CE0_ENABLE(1  14)
 +#define PWRGATE_STATUS_C0NC_ENABLE   (1  15)
 +#define PWRGATE_STATUS_C1NC_ENABLE   (1  16)

  +#define PWRGATE_STATUS_SOR_ENABLE(1  17)

 +#define PWRGATE_STATUS_DIS_ENABLE(1  18)
 +#define PWRGATE_STATUS_DISB_ENABLE   (1  19)
 +#define PWRGATE_STATUS_XUSBA_ENABLE  (1  20)
 +#define PWRGATE_STATUS_XUSBB_ENABLE  (1  21)
 +#define PWRGATE_STATUS_XUSBC_ENABLE  (1  22)

  +#define PWRGATE_STATUS_VIC_ENABLE(1  23)
  +#define PWRGATE_STATUS_IRAM_ENABLE   (1  24)

 diff --git a/arch/arm/include/asm/arch-tegra124/clock-tables.h 
 b/arch/arm/include/asm/arch-tegra124/clock-tables.h
 +/* The PLLs supported by the hardware */
 +enum clock_id {
 + CLOCK_ID_FIRST,
 + CLOCK_ID_CGENERAL = CLOCK_ID_FIRST,
 + 

Re: [U-Boot] about the DABT handler in imx_pcie.c

2014-01-24 Thread Marek Vasut
On Friday, January 24, 2014 at 04:15:37 PM, Wally Yeh wrote:
 Dear Marek:
 thank you very much! you really help me a lot. :D
 
 and I see you in the community at the samw post about uboot pcie:
 https://community.freescale.com/message/375723?et=watches.email.thread#3757
 23
 
 I'm Wally Yeh in the post. so you possible know what I need to do now, I'm
 fix the issue if pcie bridge not attach pcie device, uboot will hang up.
 
 sorry for send this private mail to you, next I will send to the mailing
 list.

That's already fixed in the V2 of the patches (see the patchwork link I posted).

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


[U-Boot] [PATCH] pci: mx6: Implement reset callback

2014-01-24 Thread Marek Vasut
Add a callback so that a board can implement it's own specific routine to
toggle the port's nRESET line.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Stefano Babic sba...@denx.de
---
 drivers/pci/pcie_imx.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 0a74867..b554075 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -450,6 +450,13 @@ static int imx6_pcie_init_phy(void)
return 0;
 }
 
+__weak int imx6_pcie_toggle_reset(void)
+{
+   /* This function ought to be overridden ! */
+   puts(WARNING: Make sure the PCIe nRESET line is connected!\n);
+   return 0;
+}
+
 static int imx6_pcie_deassert_core_reset(void)
 {
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
@@ -466,10 +473,9 @@ static int imx6_pcie_deassert_core_reset(void)
 * Wait for the clock to settle a bit, when the clock are sourced
 * from the CPU, we need about 30mS to settle.
 */
-   mdelay(30);
+   mdelay(50);
 
-   /* FIXME: GPIO reset goes here */
-   mdelay(100);
+   imx6_pcie_toggle_reset();
 
return 0;
 }
-- 
1.8.4.2

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


Re: [U-Boot] [PATCH V2 08/13] ARM: tegra: add SPL/AVP (arm720t) CPU files for Tegra124

2014-01-24 Thread Thierry Reding
On Thu, Jan 23, 2014 at 05:42:55PM -0700, Stephen Warren wrote:
[...]
 diff --git a/arch/arm/cpu/arm720t/tegra-common/cpu.c 
 b/arch/arm/cpu/arm720t/tegra-common/cpu.c
[...]
 @@ -128,6 +144,18 @@ int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, 
 u32 divm,
  
   debug( pllx_set_rate entry\n);
  
 +#if defined(CONFIG_TEGRA124)
 + struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;

Eek! You're mixing declarations and code! I'd prefer this to be moved up
to where the other variables are declared.

We could turn the #if defined(CONFIG_TEGRA124) into something like this:

if (CONFIG_TEGRA124) {
...
}

so that you get a new scope in which the variable can be declared. Of
course that won't work since in U-Boot variables aren't usually defined
empty...

 diff --git a/arch/arm/cpu/arm720t/tegra124/cpu.c 
 b/arch/arm/cpu/arm720t/tegra124/cpu.c
[...]
 +static void enable_cpu_power_rail(void)
 +{
[...]
 + /* un-tristate PWR_I2C SCL/SDA, rest of the defaults are correct */
 + pinmux_tristate_disable(PINGRP_PWR_I2C_SCL);
 + pinmux_tristate_disable(PINGRP_PWR_I2C_SDA);
 +
 + pmic_enable_cpu_vdd();

Should the pinmux changes perhaps be moved to the pmic_enable_cpu_vdd()
function?

I guess it doesn't really matter since it should be pretty safe to
assume that all boards will always use the power I2C to talk to the
PMU?

 +static bool is_partition_powered(u32 mask)
 +{
 + struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
 + u32 reg;
 +
 + /* Get power gate status */
 + reg = readl(pmc-pmc_pwrgate_status);
 + return (reg  mask) == mask;
 +}

Why can't we pass in the partition ID? That way we don't even have to
define the masks in the header file. It's pretty redundant.

 +static void power_partition(u32 status, u32 partid)
 +{
 + struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
 +
 + debug(%s: status = %08X, part ID = %08X\n, __func__, status, partid);
 + /* Is the partition already on? */
 + if (!is_partition_powered(status)) {
 + /* No, toggle the partition power state (OFF - ON) */
 + debug(power_partition, toggling state\n);
 + writel(START_CP | partid, pmc-pmc_pwrgate_toggle);
 +
 + /* Wait for the power to come up */
 + while (!is_partition_powered(status))
 + ;
 +
 + /* Give I/O signals time to stabilize */
 + udelay(IO_STABILIZATION_DELAY);
 + }
 +}

This is being called as follows:

power_partition(CRAIL, CRAILID);
power_partition(C0NC, C0NCID);
power_partition(CE0, CE0ID);

So instead of passing in (1  CRAILID, CRAILID), why not just pass
around the partition ID only and compute the status mask as needed?

Now that I mention it, I do have a vague recollection that I said the
exact same thing during my initial review of Tom's patches.

Thierry


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


Re: [U-Boot] [PATCH V2 01/13] mmc: tegra: support Tegra124

2014-01-24 Thread Thierry Reding
I've been booting Venice2 with these patches for a day now, everything
seems to work as expected, so:

Tested-by: Thierry Reding tred...@nvidia.com


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


Re: [U-Boot] [PATCH] pxe: implement fdtdir extlinux.conf tag

2014-01-24 Thread Tom Rini
On Thu, Jan 23, 2014 at 12:55:27PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com
 
 People who write (or scripts that auto-generate) extlinux.conf don't
 want to know about HW-specific information such as FDT filenames. Create
 a new extlinux.conf tag fdtdir that specifies only the directory where
 FDT files are located, and defer all knowledge of the filename to U-Boot.
 The algorithm implemented is:
 
 ==
 if $fdt_addr_r is set:
   if fdt tag was specified in extlinux.conf:
 load the FDT from the filename in the tag
   else if fdtdir tag was specified in extlinux.conf:
 if fdtfile is set in the environment:
   load the FDT from filename in $fdtfile
 else:
   load the FDT from some automatically generated filename
 
 if no FDT file was loaded, and $fdtaddr is set:
   # This indicates an FDT packaged with firmware
   use the FDT at $fdtaddr
 ==
 
 A small part of an example /boot/extlinux.conf might be:
 
 ==
 LABEL primary
 LINUX zImage
 FDTDIR ./
 
 LABEL failsafe
 LINUX bkp/zImage
 FDTDIR bkp/
 ==
 
 ... with /boot/tegra20-seaboard.dtb or /boot/bkp/tegra20-seaboard.dtb
 being loaded by the sysboot/pxe code.
 
 Signed-off-by: Stephen Warren swar...@nvidia.com

My only real concern is that
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ is as
best I can see the spec for extlinux.conf and it doesn't talk about this
tag.  So while it sounds like a good idea, if we implement it and it's
not documented outside of U-Boot, will anyone use it?

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-mpc85xx

2014-01-24 Thread Tom Rini
On Wed, Jan 22, 2014 at 09:45:53AM -0800, York Sun wrote:

 Tom,
 
 The following changes since commit e222b1f36fedb0363dbc21e0add7dc3848bae553:
 
   powerpc/mpc85xx:Increase binary size for P, B  T series boards. (2014-01-21
 14:06:30 -0800)
 
 are available in the git repository at:
 
   git://git.denx.de/u-boot-mpc85xx.git master
 
 for you to fetch changes up to f28bea0003536976ebe2fb299cfc140702fec489:
 
   eSDHC: Calculate envaddr accroding to the address format (2014-01-22 
 08:56:44
 -0800)
 
 
 Haijun.Zhang (3):
   esdhc: Workaround for card can't be detected on T4240QDS
   esdhc: Detecting 8 bit width before mmc initialization
   eSDHC: Calculate envaddr accroding to the address format
 
  arch/powerpc/include/asm/config_mpc85xx.h |3 +++
  board/freescale/common/sdhc_boot.c|   29 
 +
  drivers/mmc/fsl_esdhc.c   |9 +
  include/configs/T4240QDS.h|8 
  4 files changed, 49 insertions(+)

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 2/6] ARM: tegra: rename MASK_BITS_29_28 to MASK_BITS_31_28

2014-01-24 Thread Stephen Warren
On 01/24/2014 06:44 AM, Thierry Reding wrote:
 On Wed, Jan 22, 2014 at 01:20:32PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com

 The only place where the MASK_BITS_* values are used is in
 adjust_periph_pll(), which interprets the value 4 (old MASK_BITS_29_28,
 new MASK_BITS_31_28) as being associated with mask OUT_CLK_SOURCE4_MASK,
 i.e. bits 31:28. Rename the MASK_BITS_ macro to reflect how it's actually
 implemented.

  enum {
  MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
  MASK_BITS_31_29,
 -MASK_BITS_29_28,
 +MASK_BITS_31_28,
  };
 
 If this ever gets cleaned up I think it'd be clearer to explicitly
 define them to the number of bits that they use by turning them into
 #defines.

The specific values are actually removed later in the series. I'll fix
the other issues you found.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] ARM: tegra: rename OUT_CLK_SOURCE_*

2014-01-24 Thread Stephen Warren
On 01/24/2014 06:47 AM, Thierry Reding wrote:
 On Wed, Jan 22, 2014 at 01:20:33PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com

 OUT_CLK_SOURCE_ are currently named after the number of bits the mask
 they represent includes. However, bit count is not the only possible
 variable; bit position may also vary. Rename OUT_CLK_SOURCE_ to
 OUT_CLK_SOURCE_31_30_ and OUT_CLK_SOURCE4_ to OUT_CLK_SOURCE_31_28 to
 more completely describe exactly what they represent, without having to
 
 Nit: I think you should pick either completely or exactly.

Complete and exact mean different things.

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


Re: [U-Boot] [PATCH 1/6] ARM: tegra: deduplicate MASK_BITS_xxx clock mux enum

2014-01-24 Thread Stephen Warren
On 01/24/2014 06:54 AM, Thierry Reding wrote:
 On Wed, Jan 22, 2014 at 01:20:31PM -0700, Stephen Warren wrote:
...
 With the few small comments addressed, the series:
 
   Reviewed-by: Thierry Reding tred...@nvidia.com
 
 I've also given these a spin together with your reworked Tegra124
 patches and it all works great, so:
 
   Tested-by: Thierry Reding tred...@nvidia.com
 
 And since Tom asked for it:
 
   Acked-by: Thierry Reding tred...@nvidia.com

Thanks!

For me at least, a Reviewed-by implies an Acked-by, at least in the case
where the patches are going through the normal tree, and you're just
acking that can be applied.

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


[U-Boot] [PATCH V2 1/6] ARM: tegra: deduplicate MASK_BITS_xxx clock mux enum

2014-01-24 Thread Stephen Warren
From: Tom Warren twarren.nvi...@gmail.com

The enum used to define the set of register bits used to represent a
clock's input mux, MUX_BITS_*, is defined separately for each SoC at
present. Move this definition to a common location to ease fixing up
some issues with the definition, and the code that uses it.

Signed-off-by: Tom Warren twar...@nvidia.com
[swarren, extracted from a larger patch by Tom]
Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
---
 arch/arm/cpu/tegra114-common/clock.c| 6 --
 arch/arm/cpu/tegra30-common/clock.c | 6 --
 arch/arm/include/asm/arch-tegra/clock.h | 6 ++
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/arm/cpu/tegra114-common/clock.c 
b/arch/arm/cpu/tegra114-common/clock.c
index 5c4305a418cc..47612e12d262 100644
--- a/arch/arm/cpu/tegra114-common/clock.c
+++ b/arch/arm/cpu/tegra114-common/clock.c
@@ -61,12 +61,6 @@ enum {
CLOCK_MAX_MUX   = 8 /* number of source options for each clock */
 };
 
-enum {
-   MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
-   MASK_BITS_31_29,
-   MASK_BITS_29_28,
-};
-
 /*
  * Clock source mux for each clock type. This just converts our enum into
  * a list of mux sources for use by the code.
diff --git a/arch/arm/cpu/tegra30-common/clock.c 
b/arch/arm/cpu/tegra30-common/clock.c
index 74bd22be1aeb..89c3529c885b 100644
--- a/arch/arm/cpu/tegra30-common/clock.c
+++ b/arch/arm/cpu/tegra30-common/clock.c
@@ -60,12 +60,6 @@ enum {
CLOCK_MAX_MUX   = 8 /* number of source options for each clock */
 };
 
-enum {
-   MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
-   MASK_BITS_31_29,
-   MASK_BITS_29_28,
-};
-
 /*
  * Clock source mux for each clock type. This just converts our enum into
  * a list of mux sources for use by the code.
diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
b/arch/arm/include/asm/arch-tegra/clock.h
index e7d0fd45ee1d..052c0208b18a 100644
--- a/arch/arm/include/asm/arch-tegra/clock.h
+++ b/arch/arm/include/asm/arch-tegra/clock.h
@@ -20,6 +20,12 @@ enum clock_osc_freq {
CLOCK_OSC_FREQ_COUNT,
 };
 
+enum {
+   MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
+   MASK_BITS_31_29,
+   MASK_BITS_29_28,
+};
+
 #include asm/arch/clock-tables.h
 /* PLL stabilization delay in usec */
 #define CLOCK_PLL_STABLE_DELAY_US 300
-- 
1.8.1.5

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


Re: [U-Boot] [PATCH 5/6] ARM: tegra: MASK_BITS_ no longer needs specific values

2014-01-24 Thread Stephen Warren
On 01/24/2014 06:50 AM, Thierry Reding wrote:
 On Wed, Jan 22, 2014 at 01:20:35PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com

 Since all code that sets or interprets MASK_BITS_* now uses the enums
 to define/compare the values, there is no need for MASK_BITS_* to have
 a specific integer value. In fact, having a specific integer value may
 encourage people to hard-code those values, or interpret the values in
 incorrect ways.

 As such, remove the logic that assigns a specific value to the enum
 values in order to make it completely clear that it's just an enum, not
 something that directly represents some integer value.
 
 Ah yes, that's a nice way to clean it up as well, so my earlier comment
 about turning these into defines can be considered obsolete.

I guess I should read all the replies first:-)

 diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
 b/arch/arm/include/asm/arch-tegra/clock.h

  enum {
 -MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
 +MASK_BITS_31_30,/* num of bits used to specify clock source */
 
 Should the comment not be removed as well now?

Well, it the enum name still defines the position (and size), just not
the value any more:-)

But yes, it's obvious enough without the commment, so I'll remove that.

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


[U-Boot] [PATCH V2 2/6] ARM: tegra: rename MASK_BITS_29_28 to MASK_BITS_31_28

2014-01-24 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

The only place where the MASK_BITS_* values are used is in
adjust_periph_pll(), which interprets the value 4 (old MASK_BITS_29_28,
new MASK_BITS_31_28) as being associated with mask OUT_CLK_SOURCE4_MASK,
i.e. bits 31:28. Rename the MASK_BITS_ macro to reflect how it's actually
implemented.

Note that no Tegra clock register actually uses all of bits 31:28 as
the mux field. Rather, bits 30:28, 29:28, or 28 are used. However, in
those cases, nothing is stored in the bits above the mux field, so it's
safe to pretend that the mux field extends all the way to the end of the
register. As such, the U-Boot clock driver is currently a bit lazy, and
doesn't distinguish between 31:28, 30:28, 29:28 and 28; it just lumps
them all together and pretends they're all 31:28. This patch doesn't
cause this issue; it was pre-existing. Hopefully, future patches will
clean this up.

Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
---
v2: Fixed typo in comment  patch description
---
 arch/arm/cpu/tegra114-common/clock.c|  2 +-
 arch/arm/cpu/tegra30-common/clock.c |  2 +-
 arch/arm/include/asm/arch-tegra/clock.h | 11 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/tegra114-common/clock.c 
b/arch/arm/cpu/tegra114-common/clock.c
index 47612e12d262..3bede71a7a1f 100644
--- a/arch/arm/cpu/tegra114-common/clock.c
+++ b/arch/arm/cpu/tegra114-common/clock.c
@@ -103,7 +103,7 @@ static enum clock_id 
clock_source[CLOCK_TYPE_COUNT][CLOCK_MAX_MUX+1] = {
MASK_BITS_31_29},
{ CLK(PERIPH),  CLK(CGENERAL),  CLK(SFROM32KHZ),CLK(OSC),
CLK(NONE),  CLK(NONE),  CLK(NONE),  CLK(NONE),
-   MASK_BITS_29_28}
+   MASK_BITS_31_28}
 };
 
 /*
diff --git a/arch/arm/cpu/tegra30-common/clock.c 
b/arch/arm/cpu/tegra30-common/clock.c
index 89c3529c885b..33528702185e 100644
--- a/arch/arm/cpu/tegra30-common/clock.c
+++ b/arch/arm/cpu/tegra30-common/clock.c
@@ -102,7 +102,7 @@ static enum clock_id 
clock_source[CLOCK_TYPE_COUNT][CLOCK_MAX_MUX+1] = {
MASK_BITS_31_29},
{ CLK(PERIPH),  CLK(CGENERAL),  CLK(SFROM32KHZ), CLK(OSC),
CLK(NONE),  CLK(NONE),  CLK(NONE),  CLK(NONE),
-   MASK_BITS_29_28}
+   MASK_BITS_31_28}
 };
 
 /*
diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
b/arch/arm/include/asm/arch-tegra/clock.h
index 052c0208b18a..80825e30f8e3 100644
--- a/arch/arm/include/asm/arch-tegra/clock.h
+++ b/arch/arm/include/asm/arch-tegra/clock.h
@@ -20,10 +20,19 @@ enum clock_osc_freq {
CLOCK_OSC_FREQ_COUNT,
 };
 
+/*
+ * Note that no Tegra clock register actually uses all of bits 31:28 as
+ * the mux field. Rather, bits 30:28, 29:28, or 28 are used. However, in
+ * those cases, nothing is stored in the bits about the mux field, so it's
+ * safe to pretend that the mux field extends all the way to the end of the
+ * register. As such, the U-Boot clock driver is currently a bit lazy, and
+ * doesn't distinguish between 31:28, 30:28, 29:28 and 28; it just lumps
+ * them all together and pretends they're all 31:28.
+ */
 enum {
MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
MASK_BITS_31_29,
-   MASK_BITS_29_28,
+   MASK_BITS_31_28,
 };
 
 #include asm/arch/clock-tables.h
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 6/6] ARM: tegra: implement MASK_BITS_31_29

2014-01-24 Thread Stephen Warren
From: Tom Warren twarren.nvi...@gmail.com

Some clock sources have 3-bit muxes in bits 31:29. Implement core
support for this mux field.

Signed-off-by: Tom Warren twar...@nvidia.com
[swarren, extracted from a larger patch by Tom]
Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
---
 arch/arm/cpu/tegra-common/clock.c | 22 ++
 arch/arm/include/asm/arch-tegra/clk_rst.h |  3 +++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/tegra-common/clock.c 
b/arch/arm/cpu/tegra-common/clock.c
index 96b705f2f6a4..33bb19084b8c 100644
--- a/arch/arm/cpu/tegra-common/clock.c
+++ b/arch/arm/cpu/tegra-common/clock.c
@@ -304,13 +304,27 @@ static int adjust_periph_pll(enum periph_id periph_id, 
int source,
/* work out the source clock and set it */
if (source  0)
return -1;
-   if (mux_bits == MASK_BITS_31_28) {
-   clrsetbits_le32(reg, OUT_CLK_SOURCE_31_28_MASK,
-   source  OUT_CLK_SOURCE_31_28_SHIFT);
-   } else {
+
+   switch (mux_bits) {
+   case MASK_BITS_31_30:
clrsetbits_le32(reg, OUT_CLK_SOURCE_31_30_MASK,
source  OUT_CLK_SOURCE_31_30_SHIFT);
+   break;
+
+   case MASK_BITS_31_29:
+   clrsetbits_le32(reg, OUT_CLK_SOURCE_31_29_MASK,
+   source  OUT_CLK_SOURCE_31_29_SHIFT);
+   break;
+
+   case MASK_BITS_31_28:
+   clrsetbits_le32(reg, OUT_CLK_SOURCE_31_28_MASK,
+   source  OUT_CLK_SOURCE_31_28_SHIFT);
+   break;
+
+   default:
+   return -1;
}
+
udelay(2);
return 0;
 }
diff --git a/arch/arm/include/asm/arch-tegra/clk_rst.h 
b/arch/arm/include/asm/arch-tegra/clk_rst.h
index 9f81237d2865..f07b83d26af4 100644
--- a/arch/arm/include/asm/arch-tegra/clk_rst.h
+++ b/arch/arm/include/asm/arch-tegra/clk_rst.h
@@ -236,6 +236,9 @@ enum {
 #define OUT_CLK_SOURCE_31_30_SHIFT 30
 #define OUT_CLK_SOURCE_31_30_MASK  (3U  OUT_CLK_SOURCE_31_30_SHIFT)
 
+#define OUT_CLK_SOURCE_31_29_SHIFT 29
+#define OUT_CLK_SOURCE_31_29_MASK  (7U  OUT_CLK_SOURCE_31_29_SHIFT)
+
 /* Note: See comment for MASK_BITS_31_28 in arch-tegra/clock.h */
 #define OUT_CLK_SOURCE_31_28_SHIFT 28
 #define OUT_CLK_SOURCE_31_28_MASK  (15U  OUT_CLK_SOURCE_31_28_SHIFT)
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 3/6] ARM: tegra: rename OUT_CLK_SOURCE_*

2014-01-24 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

OUT_CLK_SOURCE_ are currently named after the number of bits the mask
they represent includes. However, bit count is not the only possible
variable; bit position may also vary. Rename OUT_CLK_SOURCE_ to
OUT_CLK_SOURCE_31_30_ and OUT_CLK_SOURCE4_ to OUT_CLK_SOURCE_31_28 to
more completely describe exactly what they represent, without having to
go look up the definitions.

Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
---
 arch/arm/cpu/tegra-common/clock.c | 16 
 arch/arm/include/asm/arch-tegra/clk_rst.h |  9 +
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/arm/cpu/tegra-common/clock.c 
b/arch/arm/cpu/tegra-common/clock.c
index 268fb912b502..d9f2c767d5d1 100644
--- a/arch/arm/cpu/tegra-common/clock.c
+++ b/arch/arm/cpu/tegra-common/clock.c
@@ -142,8 +142,8 @@ void clock_ll_set_source_divisor(enum periph_id periph_id, 
unsigned source,
 
value = readl(reg);
 
-   value = ~OUT_CLK_SOURCE_MASK;
-   value |= source  OUT_CLK_SOURCE_SHIFT;
+   value = ~OUT_CLK_SOURCE_31_30_MASK;
+   value |= source  OUT_CLK_SOURCE_31_30_SHIFT;
 
value = ~OUT_CLK_DIVISOR_MASK;
value |= divisor  OUT_CLK_DIVISOR_SHIFT;
@@ -155,8 +155,8 @@ void clock_ll_set_source(enum periph_id periph_id, unsigned 
source)
 {
u32 *reg = get_periph_source_reg(periph_id);
 
-   clrsetbits_le32(reg, OUT_CLK_SOURCE_MASK,
-   source  OUT_CLK_SOURCE_SHIFT);
+   clrsetbits_le32(reg, OUT_CLK_SOURCE_31_30_MASK,
+   source  OUT_CLK_SOURCE_31_30_SHIFT);
 }
 
 /**
@@ -305,11 +305,11 @@ static int adjust_periph_pll(enum periph_id periph_id, 
int source,
if (source  0)
return -1;
if (mux_bits == 4) {
-   clrsetbits_le32(reg, OUT_CLK_SOURCE4_MASK,
-   source  OUT_CLK_SOURCE4_SHIFT);
+   clrsetbits_le32(reg, OUT_CLK_SOURCE_31_28_MASK,
+   source  OUT_CLK_SOURCE_31_28_SHIFT);
} else {
-   clrsetbits_le32(reg, OUT_CLK_SOURCE_MASK,
-   source  OUT_CLK_SOURCE_SHIFT);
+   clrsetbits_le32(reg, OUT_CLK_SOURCE_31_30_MASK,
+   source  OUT_CLK_SOURCE_31_30_SHIFT);
}
udelay(2);
return 0;
diff --git a/arch/arm/include/asm/arch-tegra/clk_rst.h 
b/arch/arm/include/asm/arch-tegra/clk_rst.h
index 074b3bca0b4f..9f81237d2865 100644
--- a/arch/arm/include/asm/arch-tegra/clk_rst.h
+++ b/arch/arm/include/asm/arch-tegra/clk_rst.h
@@ -233,11 +233,12 @@ enum {
 #define OUT_CLK_DIVISOR_SHIFT  0
 #define OUT_CLK_DIVISOR_MASK   (0x  OUT_CLK_DIVISOR_SHIFT)
 
-#define OUT_CLK_SOURCE_SHIFT   30
-#define OUT_CLK_SOURCE_MASK(3U  OUT_CLK_SOURCE_SHIFT)
+#define OUT_CLK_SOURCE_31_30_SHIFT 30
+#define OUT_CLK_SOURCE_31_30_MASK  (3U  OUT_CLK_SOURCE_31_30_SHIFT)
 
-#define OUT_CLK_SOURCE4_SHIFT  28
-#define OUT_CLK_SOURCE4_MASK   (15U  OUT_CLK_SOURCE4_SHIFT)
+/* Note: See comment for MASK_BITS_31_28 in arch-tegra/clock.h */
+#define OUT_CLK_SOURCE_31_28_SHIFT 28
+#define OUT_CLK_SOURCE_31_28_MASK  (15U  OUT_CLK_SOURCE_31_28_SHIFT)
 
 /* CLK_RST_CONTROLLER_SCLK_BURST_POLICY */
 #define SCLK_SYS_STATE_SHIFT28U
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 4/6] ARM: tegra: use MASK_BITS_* macros everywhere

2014-01-24 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

Not all code that set or interpreted mux_bits was using the named
macros, but rather some was simply using hard-coded integer constants.
This makes it hard to determine which pieces of code are affected by
changes to those constants.

Replace the integer constants with the equivalent macro definitions so
that everything is nicely tied together.

Note that I'm not convinced all the code was using the correct integer
constants, and hence I'm not convinced that all the code is now using
the desired macros. However, this change is a purely mechanical
replacement and should have no functional change. Fixing any bugs will
come later, separately.

Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
---
 arch/arm/cpu/tegra-common/clock.c   | 2 +-
 arch/arm/cpu/tegra20-common/clock.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/tegra-common/clock.c 
b/arch/arm/cpu/tegra-common/clock.c
index d9f2c767d5d1..96b705f2f6a4 100644
--- a/arch/arm/cpu/tegra-common/clock.c
+++ b/arch/arm/cpu/tegra-common/clock.c
@@ -304,7 +304,7 @@ static int adjust_periph_pll(enum periph_id periph_id, int 
source,
/* work out the source clock and set it */
if (source  0)
return -1;
-   if (mux_bits == 4) {
+   if (mux_bits == MASK_BITS_31_28) {
clrsetbits_le32(reg, OUT_CLK_SOURCE_31_28_MASK,
source  OUT_CLK_SOURCE_31_28_SHIFT);
} else {
diff --git a/arch/arm/cpu/tegra20-common/clock.c 
b/arch/arm/cpu/tegra20-common/clock.c
index 34124f9bbac3..0c4f5fb288a0 100644
--- a/arch/arm/cpu/tegra20-common/clock.c
+++ b/arch/arm/cpu/tegra20-common/clock.c
@@ -412,9 +412,9 @@ int get_periph_clock_source(enum periph_id periph_id,
 * with its 16-bit divisor
 */
if (type == CLOCK_TYPE_PCXTS)
-   *mux_bits = 4;
+   *mux_bits = MASK_BITS_31_28;
else
-   *mux_bits = 2;
+   *mux_bits = MASK_BITS_31_30;
if (type == CLOCK_TYPE_PCMT16)
*divider_bits = 16;
else
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 5/6] ARM: tegra: MASK_BITS_ no longer needs specific values

2014-01-24 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

Since all code that sets or interprets MASK_BITS_* now uses the enums
to define/compare the values, there is no need for MASK_BITS_* to have
a specific integer value. In fact, having a specific integer value may
encourage people to hard-code those values, or interpret the values in
incorrect ways.

As such, remove the logic that assigns a specific value to the enum
values in order to make it completely clear that it's just an enum, not
something that directly represents some integer value.

Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
---
v2: Remove comment that described the removed assignment of numbers to
MASK_BITS_*
---
 arch/arm/include/asm/arch-tegra/clock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-tegra/clock.h 
b/arch/arm/include/asm/arch-tegra/clock.h
index 80825e30f8e3..2f85696a5854 100644
--- a/arch/arm/include/asm/arch-tegra/clock.h
+++ b/arch/arm/include/asm/arch-tegra/clock.h
@@ -30,7 +30,7 @@ enum clock_osc_freq {
  * them all together and pretends they're all 31:28.
  */
 enum {
-   MASK_BITS_31_30 = 2,/* num of bits used to specify clock source */
+   MASK_BITS_31_30,
MASK_BITS_31_29,
MASK_BITS_31_28,
 };
-- 
1.8.1.5

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


Re: [U-Boot] [PATCH] pxe: implement fdtdir extlinux.conf tag

2014-01-24 Thread Stephen Warren
On 01/24/2014 09:15 AM, Tom Rini wrote:
 On Thu, Jan 23, 2014 at 12:55:27PM -0700, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com

 People who write (or scripts that auto-generate) extlinux.conf don't
 want to know about HW-specific information such as FDT filenames. Create
 a new extlinux.conf tag fdtdir that specifies only the directory where
 FDT files are located, and defer all knowledge of the filename to U-Boot.
 The algorithm implemented is:
...
 Signed-off-by: Stephen Warren swar...@nvidia.com
 
 My only real concern is that
 http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ is as
 best I can see the spec for extlinux.conf and it doesn't talk about this
 tag.  So while it sounds like a good idea, if we implement it and it's
 not documented outside of U-Boot, will anyone use it?

Well, Dennis is actively working on making Fedora support extlinux.conf
for at least ARM, and said on IRC that he was going to patch the Fedora
generator to use it, so yes:-)

Dennis, should you or I simply edit that wiki, or is there some other
process for changing it?

Related, I notice that it documents a devicetree tag, whereas U-Boot
(prior to my patches) actually implements an fdt tag for the same
purpose...
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V2] ARM: tegra: amend pmc.h for Tegra114+

2014-01-24 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

Tegra114 and later's PMC module removes the pwrgate_timer_on register
and replaces it with a clamp_status register. Adjust pmc.h to reflect
this, and update any code affected by the change.

The cpu.c change in this patch was extracted from a much larger patch
by Jimmy Zhang. The pmc.h change was written from scratch, but inspired
by related changes made by Tom Warren.

There could well be other differences in the PMC register set for chips
after Tegra20/30. However, they don't affect the code in U-Boot at
present, so I haven't attempted an exhaustive update of pmc.h.

Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
---
v2: Fix typo in register offset
---
 arch/arm/cpu/arm720t/tegra114/cpu.c   | 4 ++--
 arch/arm/include/asm/arch-tegra/pmc.h | 6 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/arm720t/tegra114/cpu.c 
b/arch/arm/cpu/arm720t/tegra114/cpu.c
index 51ecff794fb7..7a1747a3beb8 100644
--- a/arch/arm/cpu/arm720t/tegra114/cpu.c
+++ b/arch/arm/cpu/arm720t/tegra114/cpu.c
@@ -219,8 +219,8 @@ static int is_clamp_enabled(u32 mask)
struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
u32 reg;
 
-   /* Get clamp status. TODO: Add pmc_clamp_status alias to pmc.h */
-   reg = readl(pmc-pmc_pwrgate_timer_on);
+   /* Get clamp status. */
+   reg = readl(pmc-pmc_clamp_status);
return (reg  mask) == mask;
 }
 
diff --git a/arch/arm/include/asm/arch-tegra/pmc.h 
b/arch/arm/include/asm/arch-tegra/pmc.h
index ba22236ee3b7..6e5f61e7fa4c 100644
--- a/arch/arm/include/asm/arch-tegra/pmc.h
+++ b/arch/arm/include/asm/arch-tegra/pmc.h
@@ -1,5 +1,5 @@
 /*
- *  (C) Copyright 2010,2011
+ *  (C) Copyright 2010,2011,2014
  *  NVIDIA Corporation www.nvidia.com
  *
  * SPDX-License-Identifier:GPL-2.0+
@@ -21,7 +21,11 @@ struct pmc_ctlr {
uint pmc_dpd_sample;/* _DPD_PADS_SAMPLE_0, offset 20 */
uint pmc_dpd_enable;/* _DPD_PADS_ENABLE_0, offset 24 */
uint pmc_pwrgate_timer_off; /* _PWRGATE_TIMER_OFF_0, offset 28 */
+#if defined(CONFIG_TEGRA20) || defined(CONFIG_TEGRA30)
uint pmc_pwrgate_timer_on;  /* _PWRGATE_TIMER_ON_0, offset 2C */
+#else
+   uint pmc_clamp_status;  /* _CLAMP_STATUS_0, offset 2C */
+#endif
uint pmc_pwrgate_toggle;/* _PWRGATE_TOGGLE_0, offset 30 */
uint pmc_remove_clamping;   /* _REMOVE_CLAMPING_CMD_0, offset 34 */
uint pmc_pwrgate_status;/* _PWRGATE_STATUS_0, offset 38 */
-- 
1.8.1.5

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


Re: [U-Boot] [PATCH V2] ARM: tegra: don't exceed AVP limits when configuring PLLP

2014-01-24 Thread Stephen Warren
On 01/24/2014 07:13 AM, Thierry Reding wrote:
 On Thu, Jan 23, 2014 at 11:58:13AM -0700, Stephen Warren wrote:
 [...]
 diff --git a/arch/arm/cpu/tegra-common/clock.c 
 b/arch/arm/cpu/tegra-common/clock.c
 [...]
 @@ -575,3 +575,91 @@ void clock_init(void)
  /* Do any special system timer/TSC setup */
  arch_timer_init();
  }
 +
 +static void set_avp_clock_to(u32 src)
 
 Perhaps a better name would be set_avp_clock_source()? _to had me
 confused at first because I assumed it would be setting a frequency.

Yes, that name is better.

 +void tegra30_or_later_adjust_pllp(void)
 
 I would've called this simply tegra30_adjust_pllp(), where it's implied
 that when you call tegra30_*() from code targetted at later generations
 these would be compatible with Tegra30.
 
 But if you'd rather make it implicit that's fine too.

I wondered about that, and thought it'd be odd for e.g. Tegra114 clock
code to be calling Tegra30 functions. That said, if we start encoding
into function names a complete description of which chips they support,
we'll have very long function names, so I guess renaming it makes sense.
I'll post V3.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V3] ARM: tegra: don't exceed AVP limits when configuring PLLP

2014-01-24 Thread Stephen Warren
From: Jimmy Zhang jimmzh...@nvidia.com

Based on the Tegra TRM, the system clock (which is the AVP clock) can
run up to 275MHz. On power on, the default sytem clock source is set to
PLLP_OUT0. In function clock_early_init(), PLLP_OUT0 will be set to
408MHz which is beyond system clock's upper limit.

The fix is to set the system clock to CLK_M before initializing PLLP,
and then switch back to PLLP_OUT4, which has an appropriate divider
configured, after PLLP has been configured

Implement this logic in new function tegra30_set_up_pllp(),
which sets up PLLP and all PLLP_OUT* dividers, and handles the AVP
clock switching. Remove the duplicate PLLP setup from pllx_set_rate()
and adjust_pllp_out_freqs().

Signed-off-by: Jimmy Zhang jimmzh...@nvidia.com
[swarren, significantly refactored the change]
Signed-off-by: Stephen Warren swar...@nvidia.com
Reviewed-by: Thierry Reding tred...@nvidia.com
Tested-by: Thierry Reding tred...@nvidia.com
Acked-by: Thierry Reding tred...@nvidia.com
---
v3:
* s/tegra30_or_later_adjust_pllp/tegra30_set_up_pllp/ to avoid encoding
  too much information about which SoCs a function supports in its name,
  and make it clear that the function is setting up PLLP, not merely
  adjusting some small aspect of its configuration.
* s/set_avp_clock_to/set_avp_clock_source/ to make it clearer exactly
  what aspect of the AVP clock is being modified.
v2:
* Remove duplicate adjustment of PLLP dividers from pllx_set_rate()
* Adjust PLLP_OUT1/PLLP_OUT2 dividers from clock_early_init() so that
  everything related to PLLP is set up at once.
* Initialize PLLP from a new common function tegra30_or_later_adjust_pllp()
  so the code isn't duplicated.
---
 arch/arm/cpu/arm720t/tegra-common/cpu.c   | 26 +
 arch/arm/cpu/arm720t/tegra114/cpu.c   | 14 +
 arch/arm/cpu/arm720t/tegra30/cpu.c| 14 +
 arch/arm/cpu/tegra-common/clock.c | 94 ++-
 arch/arm/cpu/tegra114-common/clock.c  |  8 +--
 arch/arm/cpu/tegra30-common/clock.c   | 31 +-
 arch/arm/include/asm/arch-tegra/clk_rst.h | 16 +-
 arch/arm/include/asm/arch-tegra/clock.h   |  2 +
 8 files changed, 118 insertions(+), 87 deletions(-)

diff --git a/arch/arm/cpu/arm720t/tegra-common/cpu.c 
b/arch/arm/cpu/arm720t/tegra-common/cpu.c
index 72c69b914c7f..03f67b163cc5 100644
--- a/arch/arm/cpu/arm720t/tegra-common/cpu.c
+++ b/arch/arm/cpu/arm720t/tegra-common/cpu.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2010-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -114,24 +114,6 @@ struct clk_pll_table 
tegra_pll_x_table[TEGRA_SOC_CNT][CLOCK_OSC_FREQ_COUNT] = {
},
 };
 
-void adjust_pllp_out_freqs(void)
-{
-   struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
-   struct clk_pll *pll = clkrst-crc_pll[CLOCK_ID_PERIPH];
-   u32 reg;
-
-   /* Set T30 PLLP_OUT1, 2, 3  4 freqs to 9.6, 48, 102  204MHz */
-   reg = readl(pll-pll_out[0]);  /* OUTA, contains OUT2 / OUT1 */
-   reg |= (IN_408_OUT_48_DIVISOR  PLLP_OUT2_RATIO) | PLLP_OUT2_OVR
-   | (IN_408_OUT_9_6_DIVISOR  PLLP_OUT1_RATIO) | PLLP_OUT1_OVR;
-   writel(reg, pll-pll_out[0]);
-
-   reg = readl(pll-pll_out[1]);   /* OUTB, contains OUT4 / OUT3 */
-   reg |= (IN_408_OUT_204_DIVISOR  PLLP_OUT4_RATIO) | PLLP_OUT4_OVR
-   | (IN_408_OUT_102_DIVISOR  PLLP_OUT3_RATIO) | PLLP_OUT3_OVR;
-   writel(reg, pll-pll_out[1]);
-}
-
 int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm,
u32 divp, u32 cpcon)
 {
@@ -207,12 +189,6 @@ void init_pllx(void)
/* set pllx */
sel = tegra_pll_x_table[chip_sku][osc];
pllx_set_rate(pll, sel-n, sel-m, sel-p, sel-cpcon);
-
-   /* adjust PLLP_out1-4 on T3x/T114 */
-   if (soc_type = CHIPID_TEGRA30) {
-   debug(  init_pllx: adjusting PLLP out freqs\n);
-   adjust_pllp_out_freqs();
-   }
 }
 
 void enable_cpu_clock(int enable)
diff --git a/arch/arm/cpu/arm720t/tegra114/cpu.c 
b/arch/arm/cpu/arm720t/tegra114/cpu.c
index 7a1747a3beb8..385e1a1c86e0 100644
--- a/arch/arm/cpu/arm720t/tegra114/cpu.c
+++ b/arch/arm/cpu/arm720t/tegra114/cpu.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2010-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -126,18 +126,6 @@ void t114_init_clocks(void)
/* Set active CPU cluster to G */
clrbits_le32(flow-cluster_control, 1);
 
-   /*
-* Switch system clock to PLLP_OUT4 (108 MHz), AVP will now run
-* at 108 MHz. This is glitch free as only the source is 

Re: [U-Boot] [PATCH V2 07/13] ARM: tegra: add/edit headers for Tegra124

2014-01-24 Thread Stephen Warren
On 01/24/2014 08:20 AM, Thierry Reding wrote:
 On Thu, Jan 23, 2014 at 05:42:54PM -0700, Stephen Warren wrote:

 diff --git a/arch/arm/include/asm/arch-tegra124/gpio.h 
 b/arch/arm/include/asm/arch-tegra124/gpio.h
 [...]
 +enum gpio_pin {
 +GPIO_PA0 = 0,   /* pin 0 */
 [...]
 +GPIO_PFF7,  /* pin 255 */
 +};
 
 Perhaps this should be converted to something similar to what we have in
 the kernel? We essentially duplicate this list for every SoC generation.

I think there's quite a bit of opportunity to unify the headers and
drivers for the on-SoC devices. I keep dreaming of an intern that can do
a whole bunch of that. Maybe I'll manage to slowly trickle in some
patches for it; we'll see.

I'll fix up the other issues you mentioned.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 08/13] ARM: tegra: add SPL/AVP (arm720t) CPU files for Tegra124

2014-01-24 Thread Stephen Warren
On 01/24/2014 08:44 AM, Thierry Reding wrote:
 On Thu, Jan 23, 2014 at 05:42:55PM -0700, Stephen Warren wrote:

 +static bool is_partition_powered(u32 mask)
 +{
 +struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
 +u32 reg;
 +
 +/* Get power gate status */
 +reg = readl(pmc-pmc_pwrgate_status);
 +return (reg  mask) == mask;
 +}
 
 Why can't we pass in the partition ID? That way we don't even have to
 define the masks in the header file. It's pretty redundant.
 
 +static void power_partition(u32 status, u32 partid)
 +{
 +struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
 +
 +debug(%s: status = %08X, part ID = %08X\n, __func__, status, partid);
 +/* Is the partition already on? */
 +if (!is_partition_powered(status)) {
 +/* No, toggle the partition power state (OFF - ON) */
 +debug(power_partition, toggling state\n);
 +writel(START_CP | partid, pmc-pmc_pwrgate_toggle);
 +
 +/* Wait for the power to come up */
 +while (!is_partition_powered(status))
 +;
 +
 +/* Give I/O signals time to stabilize */
 +udelay(IO_STABILIZATION_DELAY);
 +}
 +}
 
 This is being called as follows:
 
   power_partition(CRAIL, CRAILID);
   power_partition(C0NC, C0NCID);
   power_partition(CE0, CE0ID);
 
 So instead of passing in (1  CRAILID, CRAILID), why not just pass
 around the partition ID only and compute the status mask as needed?
 
 Now that I mention it, I do have a vague recollection that I said the
 exact same thing during my initial review of Tom's patches.

Oh, I see what you mean now. I hadn't realized that CRAIL == 1 
CRAILID, so hadn't understood what you meant before. I'll certainly fix
that up.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH][v2] driver/ifc:Change accessor function to take care of endianness

2014-01-24 Thread York Sun
On 01/21/2014 09:34 AM, York Sun wrote:
 On 01/21/2014 09:29 AM, Scott Wood wrote:
 On Tue, 2014-01-21 at 10:14 +0100, Wolfgang Denk wrote:
 Dear York,

 In message f1d691e4-180a-4a2d-be07-812547d46...@freescale.com you wrote:

 On second thought, I also think we should avoid solutions where the
 BE/LE test has to be done for each and every I/O accessor call again
 and again.  We should rather do this just once, and for example set
 function pointers as needed (hoping that this driver will only be
 needed after relocation, so we have writable data segment).

 I like the idea of setting it just once, but I don't see how to
 implement it. A pointer is probably not the solution, because we do need
 some drivers before relocation.

 some drivers before relocation - how many which are these?
 
 IFC, DDR, I2C (only 32-bit controller is concerned), GUT
 

 Also, is it really necessary to make the decision about endianess at
 runtime?  We don't have multi-board support in U-Boot yet, so when you
 build an image you know exactly which SoC you are building for, so you
 should be able to make the selection at compile time?

 It is done at compile time in this patch.

 
 No. It is not necessary to do it at run time. It would be easier to use a 
 switch
 to decide at compiling time. It does involve many changes to implement the 
 wrapper.
 

Acked-by: York Sun york...@freescale.com

Do we all agree on this patch?

York


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


  1   2   >