[U-Boot] [PATCH v2] arm: mx5: Add fuse supply enable in fsl_iim

2013-12-17 Thread Sergey Alyoshin
Enable fuse supply before fuse programming and disable after.

Signed-off-by: Sergey Alyoshin alyoshi...@gmail.com
Tested-by: Sergey Alyoshin alyoshi...@gmail.com

Tested on i.MX53 custom board by writing MAC addresses in fuse bank 1.
---
 arch/arm/cpu/armv7/mx5/clock.c   |   12 
 arch/arm/include/asm/arch-mx5/clock.h|1 +
 arch/arm/include/asm/arch-mx5/crm_regs.h |3 +++
 drivers/misc/fsl_iim.c   |   17 -
 4 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index fb3b128..2ca87e4 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -749,6 +749,18 @@ void enable_nfc_clk(unsigned char enable)
MXC_CCM_CCGR5_EMI_ENFC(cg));
 }
 
+#ifdef CONFIG_FSL_IIM
+void enable_efuse_prog_supply(bool enable)
+{
+   if (enable)
+   setbits_le32(mxc_ccm-cgpr,
+   MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
+   else
+   clrbits_le32(mxc_ccm-cgpr,
+   MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
+}
+#endif
+
 /* Config main_bus_clock for periphs */
 static int config_periph_clk(u32 ref, u32 freq)
 {
diff --git a/arch/arm/include/asm/arch-mx5/clock.h 
b/arch/arm/include/asm/arch-mx5/clock.h
index 9ee79ae..3db4112 100644
--- a/arch/arm/include/asm/arch-mx5/clock.h
+++ b/arch/arm/include/asm/arch-mx5/clock.h
@@ -53,5 +53,6 @@ void enable_usboh3_clk(bool enable);
 void mxc_set_sata_internal_clock(void);
 int enable_i2c_clk(unsigned char enable, unsigned i2c_num);
 void enable_nfc_clk(unsigned char enable);
+void enable_efuse_prog_supply(bool enable);
 
 #endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/include/asm/arch-mx5/crm_regs.h 
b/arch/arm/include/asm/arch-mx5/crm_regs.h
index 392881c..efe57e0 100644
--- a/arch/arm/include/asm/arch-mx5/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx5/crm_regs.h
@@ -305,6 +305,9 @@ struct mxc_ccm_reg {
 /* Define the bits in register CCDR */
 #define MXC_CCM_CCDR_IPU_HS_MASK   (0x1  17)
 
+/* Define the bits in register CGPR */
+#define MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE(1  4)
+
 /* Define the bits in register CCGRx */
 #define MXC_CCM_CCGR_CG_MASK   0x3
 #define MXC_CCM_CCGR_CG_OFF0x0
diff --git a/drivers/misc/fsl_iim.c b/drivers/misc/fsl_iim.c
index 44ae7b1..8ac4d21 100644
--- a/drivers/misc/fsl_iim.c
+++ b/drivers/misc/fsl_iim.c
@@ -16,6 +16,9 @@
 #ifndef CONFIG_MPC512X
 #include asm/arch/imx-regs.h
 #endif
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#include asm/arch/clock.h
+#endif
 
 /* FSL IIM-specific constants */
 #define STAT_BUSY  0x80
@@ -93,6 +96,14 @@ struct fsl_iim {
} bank[8];
 };
 
+#if !defined(CONFIG_MX51)  !defined(CONFIG_MX53)
+#define enable_efuse_prog_supply(enable)
+#endif
+static void enable_fuse_prog(bool enable)
+{
+   enable_efuse_prog_supply(enable);
+}
+
 static int prepare_access(struct fsl_iim **regs, u32 bank, u32 word, int 
assert,
const char *caller)
 {
@@ -237,12 +248,16 @@ int fuse_prog(u32 bank, u32 word, u32 val)
if (ret)
return ret;
 
+   enable_fuse_prog(1);
for (bit = 0; val; bit++, val = 1)
if (val  0x01) {
ret = prog_bit(regs, bank, word, bit);
-   if (ret)
+   if (ret) {
+   enable_fuse_prog(0);
return ret;
+   }
}
+   enable_fuse_prog(0);
 
return 0;
 }
-- 
1.7.10.4

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


Re: [U-Boot] [PATCH 1/3] arm: atmel: at91sam9x5: cleanup cs configure for spi

2013-12-17 Thread Andreas Bießmann
Hi Bo,

On 12/10/2013 09:14 AM, Bo Shen wrote:
 As the cs for spi is worked in gpio mode, so no need to configure
 it as peripheral and then configure to gpio.

That statement may be correct.

 
 Signed-off-by: Bo Shen voice.s...@atmel.com
 ---
 
  arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   28 
 +-
  board/atmel/at91sam9x5ek/at91sam9x5ek.c  |1 -
  2 files changed, 6 insertions(+), 23 deletions(-)
 
 diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 
 b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
 index 6d94572..745dce6 100644
 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
 +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
 @@ -130,20 +130,12 @@ void at91_spi0_hw_init(unsigned long cs_mask)
   writel(1  ATMEL_ID_SPI0, pmc-pcer);
  
   if (cs_mask  (1  0))
 - at91_set_a_periph(AT91_PIO_PORTA, 14, 0);
 - if (cs_mask  (1  1))
 - at91_set_b_periph(AT91_PIO_PORTA, 7, 0);
 - if (cs_mask  (1  2))
 - at91_set_b_periph(AT91_PIO_PORTA, 1, 0);
 - if (cs_mask  (1  3))
 - at91_set_b_periph(AT91_PIO_PORTB, 3, 0);
 - if (cs_mask  (1  4))
   at91_set_pio_output(AT91_PIO_PORTA, 14, 0);
 - if (cs_mask  (1  5))
 + if (cs_mask  (1  1))
   at91_set_pio_output(AT91_PIO_PORTA, 7, 0);
 - if (cs_mask  (1  6))
 + if (cs_mask  (1  2))
   at91_set_pio_output(AT91_PIO_PORTA, 1, 0);
 - if (cs_mask  (1  7))
 + if (cs_mask  (1  3))
   at91_set_pio_output(AT91_PIO_PORTB, 3, 0);
  }
  
 @@ -159,20 +151,12 @@ void at91_spi1_hw_init(unsigned long cs_mask)
   writel(1  ATMEL_ID_SPI1, pmc-pcer);
  
   if (cs_mask  (1  0))
 - at91_set_b_periph(AT91_PIO_PORTA, 8, 0);
 - if (cs_mask  (1  1))
 - at91_set_b_periph(AT91_PIO_PORTA, 0, 0);
 - if (cs_mask  (1  2))
 - at91_set_b_periph(AT91_PIO_PORTA, 31, 0);
 - if (cs_mask  (1  3))
 - at91_set_b_periph(AT91_PIO_PORTA, 30, 0);
 - if (cs_mask  (1  4))
   at91_set_pio_output(AT91_PIO_PORTA, 8, 0);
 - if (cs_mask  (1  5))
 + if (cs_mask  (1  1))
   at91_set_pio_output(AT91_PIO_PORTA, 0, 0);
 - if (cs_mask  (1  6))
 + if (cs_mask  (1  2))
   at91_set_pio_output(AT91_PIO_PORTA, 31, 0);
 - if (cs_mask  (1  7))
 + if (cs_mask  (1  3))
   at91_set_pio_output(AT91_PIO_PORTA, 30, 0);
  }

But these changes to at91_spiX_hw_init() are wrong!

The point is that we want to set the spi CS line to GPIO or peripheral
mode by the function. Maybe the interface is bad but all of these
functions behave like this. The assumption is that we always have 4 SPI
CS per port, to setup the first one as peripheral we need to give 0x01
as mask, to setup the same CS as GPIO we need to apply offset of 4 bits
- 0x10 mask.

  #endif
 diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c 
 b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
 index 6f67c34..fb74a30 100644
 --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
 +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
 @@ -272,7 +272,6 @@ int board_init(void)
  
  #ifdef CONFIG_ATMEL_SPI
   at91_spi0_hw_init(1  0);
 - at91_spi0_hw_init(1  4);

So the correct change would be to remove the first line and leave the
at91_spiX_hw_init() untouched.

  #endif
  
  #ifdef CONFIG_MACB
 

@jagannadh.teki: I grabbed that patch delegated to you @ patchwork.

Best regards

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


Re: [U-Boot] [PATCH 0/3] arm: atmel: clean up for at91sam9x5ek board

2013-12-17 Thread Andreas Bießmann
Hi Bo,

On 12/10/2013 09:13 AM, Bo Shen wrote:
 This patch series do a clean up for at91sam9x5ek board.

I think this series is to fixup broken things, therefore could be
applied for upcomming release. Can you please provide v1 for 1/3?

 
 Bo Shen (3):
   arm: atmel: at91sam9x5: cleanup cs configure for spi
   arm: atmel: at91sam9x5: cleanup unneeded undef
   arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position
 
  arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   28 
 +-
  board/atmel/at91sam9x5ek/at91sam9x5ek.c  |1 -
  include/configs/at91sam9x5ek.h   |   13 +++---
  3 files changed, 9 insertions(+), 33 deletions(-)
 

Best regards

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


[U-Boot] [PATCH][v4] powerpc/mpc85xx: Add support for single source clocking

2013-12-17 Thread Priyanka Jain
Single-source clocking is new feature introduced in T1040.
In this mode, a single differential clock is supplied to the
DIFF_SYSCLK_P/N inputs to the processor, which in turn is
used to supply clocks to the sysclock, ddrclock and usbclock.

So, both ddrclock and syclock are driven by same differential
sysclock in single-source clocking mode whereas in normal clocking
mode, generally separate DDRCLK and SYSCLK pins provides
reference clock for sysclock and ddrclock

DDR_REFCLK_SEL rcw bit is used to determine DDR clock source
-If DDR_REFCLK_SEL rcw bit is 0, then DDR PLLs are driven in
 normal clocking mode by DDR_Reference clock

-If DDR_REFCLK_SEL rcw bit is 1, then DDR PLLs are driven in
 single source clocking mode by DIFF_SYSCLK

Add code to determine ddrclock based on DDR_REFCLK_SEL rcw bit.

Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
---
Changes for v4:
Updated README with CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
description.

Changes for v3:
Incorporated York's comment to move declaration to
beginning of function.

Changes for v2:
Incorporated York's comment to separate out
DDR_CLK_FREQ and SINGLE_SOURCE_CLK code

 README|5 +
 arch/powerpc/cpu/mpc85xx/speed.c  |   25 +++--
 arch/powerpc/include/asm/config_mpc85xx.h |1 +
 arch/powerpc/include/asm/immap_85xx.h |3 +++
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/README b/README
index 8f0b38c..4a3d1c8 100644
--- a/README
+++ b/README
@@ -423,6 +423,11 @@ The following options need to be configured:
CONFIG_SYS_FSL_DSP_CCSRBAR_DEFAULT
This value denotes start offset of DSP CCSR space.
 
+   CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
+   Single Source Clock is clocking mode present in some of FSL 
SoC's.
+   In this mode, a single differential clock is used to supply
+   clocks to the sysclock, ddrclock and usbclock.
+
 - Generic CPU options:
CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN
 
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index 7c7467f..35867df 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -74,12 +74,33 @@ void get_sys_info(sys_info_t *sys_info)
uint ratio[CONFIG_SYS_FSL_NUM_CC_PLLS];
unsigned long sysclk = CONFIG_SYS_CLK_FREQ;
uint mem_pll_rat;
+#ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
+   uint single_src;
+#endif
 
sys_info-freq_systembus = sysclk;
+#ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
+   /*
+* DDR_REFCLK_SEL rcw bit is used to determine if DDR PLLS
+* are driven by separate DDR Refclock or single source
+* differential clock.
+*/
+   single_src = (in_be32(gur-rcwsr[5]) 
+ FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_SHIFT) 
+ FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_MASK;
+   /*
+* For single source clocking, both ddrclock and syclock
+* are driven by differential sysclock.
+*/
+   if (single_src == FSL_CORENET2_RCWSR5_DDR_REFCLK_SINGLE_CLK) {
+   printf(Single Source Clock Configuration\n);
+   sys_info-freq_ddrbus = CONFIG_SYS_CLK_FREQ;
+   } else
+#endif
 #ifdef CONFIG_DDR_CLK_FREQ
-   sys_info-freq_ddrbus = CONFIG_DDR_CLK_FREQ;
+   sys_info-freq_ddrbus = CONFIG_DDR_CLK_FREQ;
 #else
-   sys_info-freq_ddrbus = sysclk;
+   sys_info-freq_ddrbus = sysclk;
 #endif
 
sys_info-freq_systembus *= (in_be32(gur-rcwsr[0])  25)  0x1f;
diff --git a/arch/powerpc/include/asm/config_mpc85xx.h 
b/arch/powerpc/include/asm/config_mpc85xx.h
index 244ccbf..3d8bd9a 100644
--- a/arch/powerpc/include/asm/config_mpc85xx.h
+++ b/arch/powerpc/include/asm/config_mpc85xx.h
@@ -711,6 +711,7 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define CONFIG_FM_PLAT_CLK_DIV 1
 #define CONFIG_SYS_FM1_CLK CONFIG_FM_PLAT_CLK_DIV
 #define CONFIG_SYS_FM_MURAM_SIZE   0x3
+#define CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
 #define CONFIG_SYS_FSL_TBCLK_DIV   16
 #define CONFIG_SYS_FSL_PCIE_COMPAT fsl,qoriq-pcie-v2.4
 #define CONFIG_SYS_FSL_USB1_PHY_ENABLE
diff --git a/arch/powerpc/include/asm/immap_85xx.h 
b/arch/powerpc/include/asm/immap_85xx.h
index 672e8c6..68c3c82 100644
--- a/arch/powerpc/include/asm/immap_85xx.h
+++ b/arch/powerpc/include/asm/immap_85xx.h
@@ -1774,6 +1774,9 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define FSL_CORENET2_RCWSR5_SRDS_PLL_PD_S3_PLL20x0004
 #define FSL_CORENET2_RCWSR5_SRDS_PLL_PD_S4_PLL10x0002
 #define FSL_CORENET2_RCWSR5_SRDS_PLL_PD_S4_PLL20x0001
+#define FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_SHIFT 4
+#define FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_MASK0x0011
+#define 

[U-Boot] [PATCH v2 1/3] arm: atmel: at91sam9x5: cleanup cs configure for spi

2013-12-17 Thread Bo Shen
As the cs for spi is worked in gpio mode, so no need to configure
it as peripheral and then configure to gpio. Configure it to gpio
directly.

Signed-off-by: Bo Shen voice.s...@atmel.com
---
Change in v2:
  - only move line to configure it to peripheral
---
 board/atmel/at91sam9x5ek/at91sam9x5ek.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c 
b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index 6f67c34..17a2a40 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -271,7 +271,6 @@ int board_init(void)
 #endif
 
 #ifdef CONFIG_ATMEL_SPI
-   at91_spi0_hw_init(1  0);
at91_spi0_hw_init(1  4);
 #endif
 
-- 
1.7.9.5

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


Re: [U-Boot] [PATCH 0/3] arm: atmel: clean up for at91sam9x5ek board

2013-12-17 Thread Bo Shen

Hi Andreas,

On 12/17/2013 05:07 PM, Andreas Bießmann wrote:

Hi Bo,

On 12/10/2013 09:13 AM, Bo Shen wrote:

This patch series do a clean up for at91sam9x5ek board.


I think this series is to fixup broken things, therefore could be
applied for upcomming release. Can you please provide v1 for 1/3?


I have sent v2 for 1/3 of this series.



Bo Shen (3):
   arm: atmel: at91sam9x5: cleanup cs configure for spi
   arm: atmel: at91sam9x5: cleanup unneeded undef
   arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position

  arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   28 +-
  board/atmel/at91sam9x5ek/at91sam9x5ek.c  |1 -
  include/configs/at91sam9x5ek.h   |   13 +++---
  3 files changed, 9 insertions(+), 33 deletions(-)



Best regards

Andreas Bießmann



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


Re: [U-Boot] [PATCH 0/3] arm: atmel: clean up for at91sam9x5ek board

2013-12-17 Thread Bo Shen

Hi Andreas,

On 12/17/2013 05:07 PM, Andreas Bießmann wrote:

Hi Bo,

On 12/10/2013 09:13 AM, Bo Shen wrote:

This patch series do a clean up for at91sam9x5ek board.


I think this series is to fixup broken things, therefore could be
applied for upcomming release. Can you please provide v1 for 1/3?


I have sent v2 for 1/3 of this series.



Bo Shen (3):
   arm: atmel: at91sam9x5: cleanup cs configure for spi
   arm: atmel: at91sam9x5: cleanup unneeded undef
   arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position

  arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   28 +-
  board/atmel/at91sam9x5ek/at91sam9x5ek.c  |1 -
  include/configs/at91sam9x5ek.h   |   13 +++---
  3 files changed, 9 insertions(+), 33 deletions(-)



Best regards

Andreas Bießmann



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


Re: [U-Boot] [PATCH v2] arm: mx5: Add fuse supply enable in fsl_iim

2013-12-17 Thread Benoît Thébaudeau
Dear Sergey Alyoshin,

On Tuesday, December 17, 2013 9:17:58 AM, Sergey Alyoshin wrote:
 Enable fuse supply before fuse programming and disable after.
 
 Signed-off-by: Sergey Alyoshin alyoshi...@gmail.com
 Tested-by: Sergey Alyoshin alyoshi...@gmail.com
 
 Tested on i.MX53 custom board by writing MAC addresses in fuse bank 1.

Usually, SoB and other tags are at the end of commit messages, and authors do
not tag their own patches with Tested-by. However, it is possible to add such
information as notes that won't be committed by adding a '---' after the SoB
line above.

 ---
  arch/arm/cpu/armv7/mx5/clock.c   |   12 
  arch/arm/include/asm/arch-mx5/clock.h|1 +
  arch/arm/include/asm/arch-mx5/crm_regs.h |3 +++
  drivers/misc/fsl_iim.c   |   17 -
  4 files changed, 32 insertions(+), 1 deletion(-)
 
 diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
 index fb3b128..2ca87e4 100644
 --- a/arch/arm/cpu/armv7/mx5/clock.c
 +++ b/arch/arm/cpu/armv7/mx5/clock.c
 @@ -749,6 +749,18 @@ void enable_nfc_clk(unsigned char enable)
   MXC_CCM_CCGR5_EMI_ENFC(cg));
  }
  
 +#ifdef CONFIG_FSL_IIM
 +void enable_efuse_prog_supply(bool enable)
 +{
 + if (enable)
 + setbits_le32(mxc_ccm-cgpr,
 + MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
 + else
 + clrbits_le32(mxc_ccm-cgpr,
 + MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
 +}
 +#endif
 +
  /* Config main_bus_clock for periphs */
  static int config_periph_clk(u32 ref, u32 freq)
  {
 diff --git a/arch/arm/include/asm/arch-mx5/clock.h
 b/arch/arm/include/asm/arch-mx5/clock.h
 index 9ee79ae..3db4112 100644
 --- a/arch/arm/include/asm/arch-mx5/clock.h
 +++ b/arch/arm/include/asm/arch-mx5/clock.h
 @@ -53,5 +53,6 @@ void enable_usboh3_clk(bool enable);
  void mxc_set_sata_internal_clock(void);
  int enable_i2c_clk(unsigned char enable, unsigned i2c_num);
  void enable_nfc_clk(unsigned char enable);
 +void enable_efuse_prog_supply(bool enable);
  
  #endif /* __ASM_ARCH_CLOCK_H */
 diff --git a/arch/arm/include/asm/arch-mx5/crm_regs.h
 b/arch/arm/include/asm/arch-mx5/crm_regs.h
 index 392881c..efe57e0 100644
 --- a/arch/arm/include/asm/arch-mx5/crm_regs.h
 +++ b/arch/arm/include/asm/arch-mx5/crm_regs.h
 @@ -305,6 +305,9 @@ struct mxc_ccm_reg {
  /* Define the bits in register CCDR */
  #define MXC_CCM_CCDR_IPU_HS_MASK (0x1  17)
  
 +/* Define the bits in register CGPR */
 +#define MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE  (1  4)
 +
  /* Define the bits in register CCGRx */
  #define MXC_CCM_CCGR_CG_MASK 0x3
  #define MXC_CCM_CCGR_CG_OFF  0x0
 diff --git a/drivers/misc/fsl_iim.c b/drivers/misc/fsl_iim.c
 index 44ae7b1..8ac4d21 100644
 --- a/drivers/misc/fsl_iim.c
 +++ b/drivers/misc/fsl_iim.c
 @@ -16,6 +16,9 @@
  #ifndef CONFIG_MPC512X
  #include asm/arch/imx-regs.h
  #endif
 +#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
 +#include asm/arch/clock.h
 +#endif
  
  /* FSL IIM-specific constants */
  #define STAT_BUSY0x80
 @@ -93,6 +96,14 @@ struct fsl_iim {
   } bank[8];
  };
  
 +#if !defined(CONFIG_MX51)  !defined(CONFIG_MX53)
 +#define enable_efuse_prog_supply(enable)
 +#endif
 +static void enable_fuse_prog(bool enable)
 +{
 + enable_efuse_prog_supply(enable);
 +}
 +

What I meant in my review is that this enable_fuse_prog() function could just be
removed. I was probably unclear. Here, you just have to keep the #if + #define,
and in the lines below you should just use enable_efuse_prog_supply() instead of
enable_fuse_prog().

  static int prepare_access(struct fsl_iim **regs, u32 bank, u32 word, int
  assert,
   const char *caller)
  {
 @@ -237,12 +248,16 @@ int fuse_prog(u32 bank, u32 word, u32 val)
   if (ret)
   return ret;
  
 + enable_fuse_prog(1);
   for (bit = 0; val; bit++, val = 1)
   if (val  0x01) {
   ret = prog_bit(regs, bank, word, bit);
 - if (ret)
 + if (ret) {
 + enable_fuse_prog(0);
   return ret;
 + }
   }
 + enable_fuse_prog(0);
  
   return 0;
  }
 --
 1.7.10.4

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


[U-Boot] [PATCH] arm: omap3: Fix beagleboard SPL boot hangup (GPIO clocks not enabled)

2013-12-17 Thread Stefan Roese
Patch f33b9bd3
[arm: omap3: Enable clocks for peripherals only if they are used]
breaks SPL booting on Beagleboard. Since some gpio input's are
read to detect the board revision. But with this patch above, the
clocks to the GPIO subsystems are not enabled per default any more.
The GPIO banks need to be configured specifically now.

Signed-off-by: Stefan Roese s...@denx.de
Cc: Tom Rini tr...@ti.com
Cc: Michael Trimarchi mich...@amarulasolutions.com
---
 include/configs/omap3_beagle.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 3acb854..1b566c0 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -123,6 +123,9 @@
 #define CONFIG_USB_ETHER_SMSC95XX
 #define CONFIG_USB_ETHER_ASIX
 
+/* GPIO banks */
+#define CONFIG_OMAP3_GPIO_5/* GPIO128..159 is in GPIO bank 5 */
+#define CONFIG_OMAP3_GPIO_6/* GPIO160..191 is in GPIO bank 6 */
 
 /* commands to include */
 #include config_cmd_default.h
-- 
1.8.4.5

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


[U-Boot] [PATCH] arm: omap3: Add cmdline editing feature

2013-12-17 Thread Stefan Roese
This has been missing from beagleboard for quite some time. Add this
now, as its very convenient for the user.

Additionally the 1 is removed after CONFIG_AUTO_COMPLETE. An empty
define is preferred for such compile options.

Signed-off-by: Stefan Roese s...@denx.de
Cc: Tom Rini tr...@ti.com
---
 include/configs/omap3_beagle.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 1b566c0..3dad16a 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -309,7 +309,9 @@
run mmcbootz;  \
fi;  \
 
-#define CONFIG_AUTO_COMPLETE   1
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_CMDLINE_EDITING
+
 /*
  * Miscellaneous configurable options
  */
-- 
1.8.4.5

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


Re: [U-Boot] [PATCH 2/2] mtd: nand: omap: fix ecc ops assignment when changing ecc

2013-12-17 Thread Nikita Kiryanov

On 12/17/2013 01:03 AM, Scott Wood wrote:

On Mon, 2013-12-16 at 19:19 +0200, Nikita Kiryanov wrote:

If we change to software ecc and then back to hardware ecc, the nand ecc ops
pointers are populated with incorrect function pointers. This is related to the
way nand_scan_tail() handles assigning functions to ecc ops:

If we are switching to software ecc/no ecc, it assigns default functions to the
ecc ops pointers unconditionally, but if we are switching to hardware ecc,
the default hardware ecc functions are assigned to ops pointers only if these
pointers are NULL (so that drivers could set their own functions). In the case
of omap_gpmc.c driver, when we switch to sw ecc, sw ecc functions are
assigned to ecc ops by nand_scan_tail(), and when we later switch to hw ecc,
the ecc ops pointers are not NULL, so nand_scan_tail() does not overwrite
them with hw ecc functions.
The result: sw ecc functions used to write hw ecc data.

Clear the ecc ops pointers in omap_gpmc.c when switching ecc types, so that
ops which were not assigned by the driver will get the correct default values
from nand_scan_tail().

Cc: Scott Wood scottw...@freescale.com
Cc: Pekon Gupta pe...@ti.com
Signed-off-by: Nikita Kiryanov nik...@compulab.co.il
---
  drivers/mtd/nand/omap_gpmc.c | 13 +
  1 file changed, 13 insertions(+)

diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index fda1df2..19dcd45 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -765,6 +765,19 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
int eccsteps = pagesize / SECTOR_BYTES;
int i;

+   nand-ecc.calculate = NULL;
+   nand-ecc.correct = NULL;
+   nand-ecc.hwctl = NULL;
+   nand-ecc.read_oob = NULL;
+   nand-ecc.read_oob_raw = NULL;
+   nand-ecc.read_page = NULL;
+   nand-ecc.read_page_raw = NULL;
+   nand-ecc.read_subpage = NULL;
+   nand-ecc.write_oob = NULL;
+   nand-ecc.write_oob_raw = NULL;
+   nand-ecc.write_page = NULL;
+   nand-ecc.write_page_raw = NULL;
+
switch (ecc_scheme) {
case OMAP_ECC_HAM1_CODE_SW:
debug(nand: selected OMAP_ECC_HAM1_CODE_SW\n);


This will leave you with a broken nand-ecc if the function returns an
error.  Instead, each case in the switch should NULL out whichever
members it is not initializing (or perhaps just memset it, once past the
error checks).


Yes you're right. Guess I should've resisted doing a last minue
refactor. V2 coming up.



-Scott





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


[U-Boot] [PATCH V2 2/2] mtd: nand: omap: fix ecc ops assignment when changing ecc

2013-12-17 Thread Nikita Kiryanov
If we change to software ecc and then back to hardware ecc, the nand ecc ops
pointers are populated with incorrect function pointers. This is related to the
way nand_scan_tail() handles assigning functions to ecc ops:

If we are switching to software ecc/no ecc, it assigns default functions to the
ecc ops pointers unconditionally, but if we are switching to hardware ecc,
the default hardware ecc functions are assigned to ops pointers only if these
pointers are NULL (so that drivers could set their own functions). In the case
of omap_gpmc.c driver, when we switch to sw ecc, sw ecc functions are
assigned to ecc ops by nand_scan_tail(), and when we later switch to hw ecc,
the ecc ops pointers are not NULL, so nand_scan_tail() does not overwrite
them with hw ecc functions.
The result: sw ecc functions used to write hw ecc data.

Clear the ecc ops pointers in omap_gpmc.c when switching ecc types, so that
ops which were not assigned by the driver will get the correct default values
from nand_scan_tail().

Cc: Scott Wood scottw...@freescale.com
Cc: Pekon Gupta pe...@ti.com
Signed-off-by: Nikita Kiryanov nik...@compulab.co.il
---
Changes in V2:
- Clear the ops after error checks, not before.
- Use memset on ecc struct to clear the ops.

 drivers/mtd/nand/omap_gpmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index fda1df2..37822bc 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -789,6 +789,7 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
bch_priv.control= NULL;
bch_priv.type   = 0;
/* populate ecc specific fields */
+   memset(nand-ecc, 0, sizeof(struct nand_ecc_ctrl));
nand-ecc.mode  = NAND_ECC_HW;
nand-ecc.strength  = 1;
nand-ecc.size  = SECTOR_BYTES;
@@ -827,6 +828,7 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
}
bch_priv.type = ECC_BCH8;
/* populate ecc specific fields */
+   memset(nand-ecc, 0, sizeof(struct nand_ecc_ctrl));
nand-ecc.mode  = NAND_ECC_HW;
nand-ecc.strength  = 8;
nand-ecc.size  = SECTOR_BYTES;
@@ -869,6 +871,7 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,
elm_init();
bch_priv.type   = ECC_BCH8;
/* populate ecc specific fields */
+   memset(nand-ecc, 0, sizeof(struct nand_ecc_ctrl));
nand-ecc.mode  = NAND_ECC_HW;
nand-ecc.strength  = 8;
nand-ecc.size  = SECTOR_BYTES;
-- 
1.8.1.2

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


Re: [U-Boot] [PATCH v2] arm: ep9315: Return back Cirrus Logic EDB9315A board support

2013-12-17 Thread sergey kostanbaev
Hi Albert,

I modified the patch, but it didn't worked on the board. Than I
realized the cause of this problem is in interrupt_init() function. It
has IRQ_STACK_START_IN variable touched before relocation, which is in
flash.

Later I found other guys had same problem. So if it's going to be
fixed my patch works ok. I'll send it right away.

Maybe as a hack just to add a special #define for now just not to
break other platform?

Best Regards,
Sergey


On Mon, Dec 2, 2013 at 9:30 PM, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:
 Hi sergey.kostanbaev,

 On Tue, 22 Oct 2013 17:18:45 +0400, sergey.kostanbaev
 sergey.kostanb...@gmail.com wrote:

 From: Sergey Kostanbaev sergey.kostanb...@gmail.com

 This patch returns back support for old ep93xx processors family

 Signed-off-by: Sergey Kostanbaev sergey.kostanb...@fairwaves.ru
 Cc: albert.u.b...@aribaud.net
 ---

 This patch seems not to apply cleanly on current ARM. Can you rebase
 and send V3?

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


[U-Boot] [PATCH v3] arm: ep9315: Return back Cirrus Logic EDB9315A board support

2013-12-17 Thread sergey.kostanbaev
From: Sergey Kostanbaev sergey.kostanb...@gmail.com

This patch returns back support for old ep93xx processors family

Signed-off-by: Sergey Kostanbaev sergey.kostanb...@fairwaves.ru
Cc: albert.u.b...@aribaud.net
---
Changes for v3:
- Update makefiles to the new style

Changes for v2:
- Replace constants in lowlevel_init.S to defines
- Add more coments in non-trivial places in lowlevel_init.S
- Get rid of ep93xx_sdram_find_bank in lowlevel_init.S and
  move it to dram_fill_bank_addr in edb93xx.c. This procedure
  may be executed later at any time, so no need to be in lowlevel

 arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S | 465 ++--
 arch/arm/include/asm/arch-ep93xx/ep93xx.h   |  86 +
 board/cirrus/edb93xx/Makefile   |  37 +++
 board/cirrus/edb93xx/edb93xx.c  | 382 +++
 board/cirrus/edb93xx/u-boot.lds | 106 +++
 boards.cfg  |   1 +
 drivers/spi/Makefile|   1 +
 drivers/spi/ep93xx_spi.c| 274 
 drivers/usb/host/Makefile   |   1 +
 drivers/usb/host/ohci-ep93xx.c  |  38 +++
 include/configs/edb93xx.h   | 292 +
 11 files changed, 1654 insertions(+), 29 deletions(-)
 create mode 100644 board/cirrus/edb93xx/Makefile
 create mode 100644 board/cirrus/edb93xx/edb93xx.c
 create mode 100644 board/cirrus/edb93xx/u-boot.lds
 create mode 100644 drivers/spi/ep93xx_spi.c
 create mode 100644 drivers/usb/host/ohci-ep93xx.c
 create mode 100644 include/configs/edb93xx.h

diff --git a/arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S 
b/arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S
index bf2fa2a..3ac0f88 100644
--- a/arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S
+++ b/arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S
@@ -1,49 +1,456 @@
 /*
  * Low-level initialization for EP93xx
  *
- * Copyright (C) 2009 Matthias Kaehlcke matth...@kaehlcke.net
+ * Copyright (C) 2013
+ * Sergey Kostanabev sergey.kostanbaev at fairwaves.ru
  *
- * Copyright (C) 2006 Dominic Rath dominic.r...@gmx.de
+ * Copyright (C) 2006 Cirrus Logic Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
  *
  * SPDX-License-Identifier:GPL-2.0+
  */
 
-#include version.h
-#include asm/arch/ep93xx.h
+#include config.h
+#include asm/arch-ep93xx/ep93xx.h
+
+/*
+/* Configure the SDRAM based on the supplied settings.
+ *
+ * Input:  r0 - SDRAM DEVCFG register
+ * r2 - configuration for SDRAM chips
+ * Output: none
+ * Modifies:   r3, r4
+ */
+ep93xx_sdram_config:
+   /* Program the SDRAM device configuration register. */
+   ldr r3, =SDRAM_BASE
+#ifdef CONFIG_EDB93XX_SDCS0
+   str r0, [r3, #SDRAM_OFF_DEVCFG0]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS1
+   str r0, [r3, #SDRAM_OFF_DEVCFG1]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS2
+   str r0, [r3, #SDRAM_OFF_DEVCFG2]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS3
+   str r0, [r3, #SDRAM_OFF_DEVCFG3]
+#endif
+
+   /* Set the Initialize and MRS bits (issue continuous NOP commands
+* (INIT  MRS set))
+*/
+   ldr r4, =(EP93XX_SDRAMCTRL_GLOBALCFG_INIT | \
+   EP93XX_SDRAMCTRL_GLOBALCFG_MRS | \
+   EP93XX_SDRAMCTRL_GLOBALCFG_CKE)
+   str r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+   /* Delay for 200us. */
+   mov r4, #0x3000
+delay1:
+   subsr4, r4, #1
+   bne delay1
+
+   /* Clear the MRS bit to issue a precharge all. */
+   ldr r4, =(EP93XX_SDRAMCTRL_GLOBALCFG_INIT | \
+   EP93XX_SDRAMCTRL_GLOBALCFG_CKE)
+   str r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+   /* Temporarily set the refresh timer to 0x10. Make it really low so
+* that refresh cycles are generated.
+*/
+   ldr r4, =0x10
+   str r4, [r3, #SDRAM_OFF_REFRSHTIMR]
+
+   /* Delay for at least 80 SDRAM clock cycles. */
+   mov r4, #80
+delay2:
+   subsr4, r4, #1
+   bne delay2
+
+   /* Set the refresh timer to the fastest required for any device
+* that might be used. Set 9.6 ms refresh time.
+*/
+   ldr r4, =0x01e0
+   str r4, [r3, #SDRAM_OFF_REFRSHTIMR]
+
+   /* Select mode register update mode. */
+   ldr r4, =(EP93XX_SDRAMCTRL_GLOBALCFG_CKE | \
+   EP93XX_SDRAMCTRL_GLOBALCFG_MRS)
+   str r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+   /* Program the mode register on the SDRAM by performing fake read */
+   ldr r4, [r2]
+
+   /* Select normal operating mode. */
+   ldr r4, =EP93XX_SDRAMCTRL_GLOBALCFG_CKE
+   str r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+   /* Return to the caller. */
+   mov pc, lr
+
+/*
+ * Test to see if the SDRAM has been configured in a usable mode.
+ *
+ * Input:  r0 - Test address of SDRAM
+ * Output: r0 - 0 -- Test OK, -1 -- Failed

Re: [U-Boot] i.MX6 freeze when running Linux FSL 3.10.9-1.0.0-alpha AND U-Boot 2013.10

2013-12-17 Thread Fabio Estevam
Hi Otavio,

On Tue, Nov 26, 2013 at 1:59 PM, Otavio Salvador
ota...@ossystems.com.br wrote:

 isn't the last change (enabling bypass) sufficient to fix the problem
 or do you also need the 2 power_down before ?

 It does indeed. I did a full test cycle from cold boot and also from
 inside system reboot and it works.

What do you get on your board when you do?

= md.l 0x20c8140  1

Regards,

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


Re: [U-Boot] i.MX6 freeze when running Linux FSL 3.10.9-1.0.0-alpha AND U-Boot 2013.10

2013-12-17 Thread Fabio Estevam
On Tue, Dec 17, 2013 at 12:18 PM, Fabio Estevam feste...@gmail.com wrote:
 Hi Otavio,

 On Tue, Nov 26, 2013 at 1:59 PM, Otavio Salvador
 ota...@ossystems.com.br wrote:

 isn't the last change (enabling bypass) sufficient to fix the problem
 or do you also need the 2 power_down before ?

 It does indeed. I did a full test cycle from cold boot and also from
 inside system reboot and it works.

 What do you get on your board when you do?

 = md.l 0x20c8140  1

Just to clarify, please run the command above with the original
U-boot, ie, without your workaround of setting the ldo bypass mode.

Regards,

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


[U-Boot] [PATCH v3] arm: mx5: Add fuse supply enable in fsl_iim

2013-12-17 Thread Sergey Alyoshin
Enable fuse supply before fuse programming and disable after.

Signed-off-by: Sergey Alyoshin alyoshi...@gmail.com
---
 arch/arm/cpu/armv7/mx5/clock.c   |   12 
 arch/arm/include/asm/arch-mx5/clock.h|1 +
 arch/arm/include/asm/arch-mx5/crm_regs.h |3 +++
 drivers/misc/fsl_iim.c   |   17 -
 4 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index fb3b128..2ca87e4 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -749,6 +749,18 @@ void enable_nfc_clk(unsigned char enable)
MXC_CCM_CCGR5_EMI_ENFC(cg));
 }
 
+#ifdef CONFIG_FSL_IIM
+void enable_efuse_prog_supply(bool enable)
+{
+   if (enable)
+   setbits_le32(mxc_ccm-cgpr,
+   MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
+   else
+   clrbits_le32(mxc_ccm-cgpr,
+   MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
+}
+#endif
+
 /* Config main_bus_clock for periphs */
 static int config_periph_clk(u32 ref, u32 freq)
 {
diff --git a/arch/arm/include/asm/arch-mx5/clock.h 
b/arch/arm/include/asm/arch-mx5/clock.h
index 9ee79ae..3db4112 100644
--- a/arch/arm/include/asm/arch-mx5/clock.h
+++ b/arch/arm/include/asm/arch-mx5/clock.h
@@ -53,5 +53,6 @@ void enable_usboh3_clk(bool enable);
 void mxc_set_sata_internal_clock(void);
 int enable_i2c_clk(unsigned char enable, unsigned i2c_num);
 void enable_nfc_clk(unsigned char enable);
+void enable_efuse_prog_supply(bool enable);
 
 #endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/include/asm/arch-mx5/crm_regs.h 
b/arch/arm/include/asm/arch-mx5/crm_regs.h
index 392881c..efe57e0 100644
--- a/arch/arm/include/asm/arch-mx5/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx5/crm_regs.h
@@ -305,6 +305,9 @@ struct mxc_ccm_reg {
 /* Define the bits in register CCDR */
 #define MXC_CCM_CCDR_IPU_HS_MASK   (0x1  17)
 
+/* Define the bits in register CGPR */
+#define MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE(1  4)
+
 /* Define the bits in register CCGRx */
 #define MXC_CCM_CCGR_CG_MASK   0x3
 #define MXC_CCM_CCGR_CG_OFF0x0
diff --git a/drivers/misc/fsl_iim.c b/drivers/misc/fsl_iim.c
index 44ae7b1..8ac4d21 100644
--- a/drivers/misc/fsl_iim.c
+++ b/drivers/misc/fsl_iim.c
@@ -16,6 +16,9 @@
 #ifndef CONFIG_MPC512X
 #include asm/arch/imx-regs.h
 #endif
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#include asm/arch/clock.h
+#endif
 
 /* FSL IIM-specific constants */
 #define STAT_BUSY  0x80
@@ -93,6 +96,14 @@ struct fsl_iim {
} bank[8];
 };
 
+#if !defined(CONFIG_MX51)  !defined(CONFIG_MX53)
+#define enable_efuse_prog_supply(enable)
+#endif
+static void enable_fuse_prog(bool enable)
+{
+   enable_efuse_prog_supply(enable);
+}
+
 static int prepare_access(struct fsl_iim **regs, u32 bank, u32 word, int 
assert,
const char *caller)
 {
@@ -237,12 +248,16 @@ int fuse_prog(u32 bank, u32 word, u32 val)
if (ret)
return ret;
 
+   enable_fuse_prog(1);
for (bit = 0; val; bit++, val = 1)
if (val  0x01) {
ret = prog_bit(regs, bank, word, bit);
-   if (ret)
+   if (ret) {
+   enable_fuse_prog(0);
return ret;
+   }
}
+   enable_fuse_prog(0);
 
return 0;
 }
-- 
1.7.10.4

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


Re: [U-Boot] arm: keep all sections in ELF file breaks Arndale

2013-12-17 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/17/2013 10:24 AM, Andre Przywara wrote:
 Hi,
 
 the Arndale board does not work anymore with current master HEAD.
 If I turn on the board, I see exactly nothing.
 
 I bisected it down to:
 47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7 is the first bad commit
 commit 47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7
 Author: Albert ARIBAUD albert.u.b...@aribaud.net
 Date:   Thu Nov 7 14:21:46 2013 +0100
 
 arm: keep all sections in ELF file
 
 That patch looks like Chinese to me, does one of you have an idea what's
 wrong here?
 Are we missing a section, maybe for the SPL build?

So on Arndale, what file do you boot exactly?  It sounds like not
u-boot.img but some tool stripping / modifying u-boot (or
spl/u-boot-spl) and having relied on certain sections being stripped out
before being run.

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

iQIcBAEBAgAGBQJSsG4KAAoJENk4IS6UOR1Wd0gP/jve70MGVIbZ7I6ZNVfBMXlC
kUCrbskbSSNhLvp+prf7X4YGAqGkqzHm2kbdPS1BC3nEDbpJxvQodN1DYDat8I9U
7Et3fMLqpWzRSs/8FyN6ISDfo/hn4DSKKLRlHi/sg4RWYhDWIfwNByyVN2Hcpicb
grUqz27GoJbTWld8ojkDCRILYS22RgCXQCdpnDvDv+a1Yvx6pb2/etH2VykOnFdN
FVz0vHr7ecGbDgLuK7elKR0aJhyXkU8z6w2TAW713d+MkXkuHytbO8d4DtIysRrj
L7quOdVH5qWyY8UivMZbSWU/UfExu6lGF8HhzlebWc2x80Ghhyxyc8i0/PpmEL20
n5rrBAAPNBKbbN5YlhZ4XnXIbp8o9FFI6rvXj/Gx6sfbU14BtYkkYnc5IeEz2RcK
dMXYycAdp+7ZzYoMGUYOBR+GCTQ38f0ZFJgkOlmYgShPYEHDMNrW40SKm2zR7xPR
LpQ/YI1XzkuAdoQ6+Plx/Felf5KTS8ul3y55PqWPr8UFcFCggG84WL/aTOsVxCnL
6CM7h4RY0ainSHUw431JoPdILcYQIbJz84vo8hOoIdlXX3+dffSHH0g6Eg4QRHEO
75UK0JMXCHUhg519dy8OEPYwi8jZOlDyx+lEqbhaTYorXxYJzCZmTOpWFVarix7c
fhyXLvN+llrt1v3mjgbb
=siI2
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] arm: keep all sections in ELF file breaks Arndale

2013-12-17 Thread Andre Przywara

Hi,

the Arndale board does not work anymore with current master HEAD.
If I turn on the board, I see exactly nothing.

I bisected it down to:
47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7 is the first bad commit
commit 47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7
Author: Albert ARIBAUD albert.u.b...@aribaud.net
Date:   Thu Nov 7 14:21:46 2013 +0100

arm: keep all sections in ELF file

That patch looks like Chinese to me, does one of you have an idea what's 
wrong here?

Are we missing a section, maybe for the SPL build?

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


Re: [U-Boot] [PATCH] arm: omap3: Add cmdline editing feature

2013-12-17 Thread Tom Rini
On Tue, Dec 17, 2013 at 02:14:18PM +0100, Stefan Roese wrote:

 This has been missing from beagleboard for quite some time. Add this
 now, as its very convenient for the user.
 
 Additionally the 1 is removed after CONFIG_AUTO_COMPLETE. An empty
 define is preferred for such compile options.
 
 Signed-off-by: Stefan Roese s...@denx.de
 Cc: Tom Rini tr...@ti.com
 ---
  include/configs/omap3_beagle.h | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
 index 1b566c0..3dad16a 100644
 --- a/include/configs/omap3_beagle.h
 +++ b/include/configs/omap3_beagle.h
 @@ -309,7 +309,9 @@
   run mmcbootz;  \
   fi;  \
  
 -#define CONFIG_AUTO_COMPLETE 1
 +#define CONFIG_AUTO_COMPLETE
 +#define CONFIG_CMDLINE_EDITING
 +
  /*
   * Miscellaneous configurable options
   */

I'm fine with this concept, but it shouldn't be needed with Enric's
series to move omap3 to ti_armv7_common.h

-- 
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 v3] arm: mx5: Add fuse supply enable in fsl_iim

2013-12-17 Thread Benoît Thébaudeau
Dear Sergey Alyoshin,

On Tuesday, December 17, 2013 3:51:00 PM, Sergey Alyoshin wrote:
[...]
 +#if !defined(CONFIG_MX51)  !defined(CONFIG_MX53)
 +#define enable_efuse_prog_supply(enable)
 +#endif
 +static void enable_fuse_prog(bool enable)
 +{
 + enable_efuse_prog_supply(enable);
 +}
 +

Er, this is like in v2. See my comment here for v2.

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


Re: [U-Boot] arm: keep all sections in ELF file breaks Arndale

2013-12-17 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/17/2013 10:47 AM, Andre Przywara wrote:
 (CCing Inderpal, Chander and Minkyu)
 
 On 12/17/2013 04:30 PM, Tom Rini wrote:
 On 12/17/2013 10:24 AM, Andre Przywara wrote:
 Hi,

 the Arndale board does not work anymore with current master HEAD.
 If I turn on the board, I see exactly nothing.

 I bisected it down to:
 47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7 is the first bad commit
 commit 47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7
 Author: Albert ARIBAUD albert.u.b...@aribaud.net
 Date:   Thu Nov 7 14:21:46 2013 +0100

  arm: keep all sections in ELF file

 That patch looks like Chinese to me, does one of you have an idea what's
 wrong here?
 Are we missing a section, maybe for the SPL build?
 
 So on Arndale, what file do you boot exactly?  It sounds like not
 u-boot.img but some tool stripping / modifying u-boot (or
 spl/u-boot-spl) and having relied on certain sections being stripped out
 before being run.
 
 Good point. Indeed I boot u-boot-dtb.bin (the SPL is
 spl/arndale-spl.bin). So the Makefile does:
 cat u-boot.bin u-boot.dtb u-boot-dtb.bin
 
 I guess the address under which U-boot expects to find the attached dtb
 changes due to the non-discarding.
 
 Does any of the Arndale people have an idea how to fix this?

That's a little confusing as we use objcopy -O binary to make
u-boot.bin/u-boot-spl.bin and that would, I would think, drop these
sections anyhow.  But some checking of binary size with the patch in
question locally reverted would help shed some light here.

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

iQIcBAEBAgAGBQJSsHR8AAoJENk4IS6UOR1W+7MQALP3dn79SRWgTTxHQ1SVMUbB
FC0mVsupa296m5WfcDRPkijtZecAeTkFGVmizTSqjLepKhV5Tnqy4uQePhwxwdcg
v9oC5/hq7NXuJIB+bzUyc05kznrBqqJ4nyS7FGJDZNmXYhbtt6BdUDSrPMVX1eLk
TkPPZ1ksD2oyJL8el/f8LlQRrKu68GaJY63qdvgFtRfGaQ+OuRYLJZ6ow3IZDbuu
+Cl9easvbEaq/db/t2U72s5VozGyMgx855w+aU9eZW7OmS2pSpSjETx3VBRW8vDv
HsHKFwykHOtajp644oGEQHvUA7PWZdPsfFOh38POp+7x5YYYNSdNO3D0yZ0PmzrD
E7w6p4bWUlZK/xQ3Bi5BYKI4Ps+0Rf64fGUHc13ML9P0aG4quNHDhHm98UT9EEWD
ZoJLRccoGvZjGNonz/Q8Hx18NWBfcFpwSFHhxMGUGfWiyjSDwaiplpXHujcOXlSC
zZQs7WT4vPfaWsTdpyaREEZ+4W6nJgf2Zyaakdn/ul+6EUjERrHEvVIe9RrsG7Ut
NsOCk0P0txWW+gEHrViorNL6n142Fb/0gwhJnAvUmpvPqOZlQqaDvE998/PzBWmi
E7cY+CEktxaTHGFWsSo/QYS+AUZBx1k7Oq+yKnFXn+pvLnnr4Z9qF2cF/RByJ2v3
1vBudkiMaREUsuKm6H6x
=aMwD
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] arm: keep all sections in ELF file breaks Arndale

2013-12-17 Thread Andre Przywara

(CCing Inderpal, Chander and Minkyu)

On 12/17/2013 04:30 PM, Tom Rini wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/17/2013 10:24 AM, Andre Przywara wrote:

Hi,

the Arndale board does not work anymore with current master HEAD.
If I turn on the board, I see exactly nothing.

I bisected it down to:
47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7 is the first bad commit
commit 47ed5dd031d7d2c587e6afd386e79ccec1a1b7f7
Author: Albert ARIBAUD albert.u.b...@aribaud.net
Date:   Thu Nov 7 14:21:46 2013 +0100

 arm: keep all sections in ELF file

That patch looks like Chinese to me, does one of you have an idea what's
wrong here?
Are we missing a section, maybe for the SPL build?


So on Arndale, what file do you boot exactly?  It sounds like not
u-boot.img but some tool stripping / modifying u-boot (or
spl/u-boot-spl) and having relied on certain sections being stripped out
before being run.


Good point. Indeed I boot u-boot-dtb.bin (the SPL is 
spl/arndale-spl.bin). So the Makefile does:

cat u-boot.bin u-boot.dtb u-boot-dtb.bin

I guess the address under which U-boot expects to find the attached dtb 
changes due to the non-discarding.


Does any of the Arndale people have an idea how to fix this?

Regards,
Andre.



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

iQIcBAEBAgAGBQJSsG4KAAoJENk4IS6UOR1Wd0gP/jve70MGVIbZ7I6ZNVfBMXlC
kUCrbskbSSNhLvp+prf7X4YGAqGkqzHm2kbdPS1BC3nEDbpJxvQodN1DYDat8I9U
7Et3fMLqpWzRSs/8FyN6ISDfo/hn4DSKKLRlHi/sg4RWYhDWIfwNByyVN2Hcpicb
grUqz27GoJbTWld8ojkDCRILYS22RgCXQCdpnDvDv+a1Yvx6pb2/etH2VykOnFdN
FVz0vHr7ecGbDgLuK7elKR0aJhyXkU8z6w2TAW713d+MkXkuHytbO8d4DtIysRrj
L7quOdVH5qWyY8UivMZbSWU/UfExu6lGF8HhzlebWc2x80Ghhyxyc8i0/PpmEL20
n5rrBAAPNBKbbN5YlhZ4XnXIbp8o9FFI6rvXj/Gx6sfbU14BtYkkYnc5IeEz2RcK
dMXYycAdp+7ZzYoMGUYOBR+GCTQ38f0ZFJgkOlmYgShPYEHDMNrW40SKm2zR7xPR
LpQ/YI1XzkuAdoQ6+Plx/Felf5KTS8ul3y55PqWPr8UFcFCggG84WL/aTOsVxCnL
6CM7h4RY0ainSHUw431JoPdILcYQIbJz84vo8hOoIdlXX3+dffSHH0g6Eg4QRHEO
75UK0JMXCHUhg519dy8OEPYwi8jZOlDyx+lEqbhaTYorXxYJzCZmTOpWFVarix7c
fhyXLvN+llrt1v3mjgbb
=siI2
-END 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] i.MX6 (DQ/DLS): use macros for mux and pad declarations

2013-12-17 Thread Stefano Babic
On 14/11/2013 00:36, Eric Nelson wrote:
 This allows the use of either or both declarations from
 the files mx6q_pins.h and mx6dl_pins.h.
 
 All board files should include asm/arch/mx6-pins.h
 with one of the following defined in boards.cfg
 MX6Q   - for boards targeting i.MX6Q or i.MX6D
 MX6DL  - for boards targeting i.MX6DL
 MX6S   - for boards targeting i.MX6S
 MX6QDL - for boards that support any of the above with
  run-time detection
 
 Pad declarations will be MX6_PAD_x for single-variant boards
 and MX6Q_PAD_x and MX6DL_PAD_x for boards supporting both
 processor classes.
 
 Signed-off-by: Eric Nelson eric.nel...@boundarydevices.com
 ---

Applied to u-boot-imx, sorry for delay.

Best regards,
Stefano Babic


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


Re: [U-Boot] [U-Boot,v2,1/3] arm: atmel: at91sam9x5: cleanup cs configure for spi

2013-12-17 Thread Andreas Bießmann
Dear Bo Shen,

Bo Shen voice.s...@atmel.com writes:
As the cs for spi is worked in gpio mode, so no need to configure
it as peripheral and then configure to gpio. Configure it to gpio
directly.

Signed-off-by: Bo Shen voice.s...@atmel.com

---
Change in v2:
  - only move line to configure it to peripheral
---
 board/atmel/at91sam9x5ek/at91sam9x5ek.c |1 -
 1 file changed, 1 deletion(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [U-Boot,2/3] arm: atmel: at91sam9x5: cleanup unneeded undef

2013-12-17 Thread Andreas Bießmann
Dear Bo Shen,

Bo Shen voice.s...@atmel.com writes:
remove unneeded #undef for at91sam9x5ek board.

Signed-off-by: Bo Shen voice.s...@atmel.com

---
include/configs/at91sam9x5ek.h |5 -
 1 file changed, 5 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [U-Boot, 3/3] arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position

2013-12-17 Thread Andreas Bießmann
Dear Bo Shen,

Bo Shen voice.s...@atmel.com writes:
In config_cmd_default.h, it will use CONFIG_SYS_NO_FLASH to decide
whether include CONFIG_CMD_FLASH and CONFIG_CMD_IMLS. So, move the
CONFIG_SYS_NO_FLASH to proper position, then we don't need to undef
these two commands.

Signed-off-by: Bo Shen voice.s...@atmel.com

---
include/configs/at91sam9x5ek.h |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PULL] u-boot-atmel/master - u-boot-arm/master

2013-12-17 Thread Andreas Bießmann
Dear Albert Aribaud,

please pull the following fix ups from u-boot-atmel/master into
u-boot-arm/master.

The following changes since commit d2c7074b9593d822e2359a09c21747248fdf5fac:

  ARM: OMAP5: clocks: Update MPU settings for OPP_NOM (2013-12-12 17:43:39 
-0500)

are available in the git repository at:

  git://git.denx.de/u-boot-atmel.git master

for you to fetch changes up to d51a2a2d63d83207b56a7aef7a191d081058d6ae:

  arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position 
(2013-12-17 17:21:18 +0100)


Bo Shen (3):
  arm: atmel: at91sam9x5: cleanup cs configure for spi
  arm: atmel: at91sam9x5: cleanup unneeded undef
  arm: atmel: at91sam9x5: move CONFIG_SYS_NO_FLASH to proper position

 board/atmel/at91sam9x5ek/at91sam9x5ek.c |1 -
 include/configs/at91sam9x5ek.h  |   13 +++--
 2 files changed, 3 insertions(+), 11 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 0/1] nitrogen6x: Move setup_sata to common part

2013-12-17 Thread Stefano Babic
On 28/11/2013 12:32, Giuseppe Pagano wrote:
 Move setup_sata function definition from platform file nitrogen6x.c
 to arch/arm/imx-common/sata.c to avoid code duplication.
 
 Signed-off-by: Giuseppe Pagano giuseppe.pag...@seco.com
 CC: Stefano Babic sba...@denx.de
 CC: Fabio Estevam fabio.este...@freescale.com
 CC: Eric Nelson eric.nel...@boundarydevices.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic


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


Re: [U-Boot] [PATCH v4 1/1] udoo: Add SATA support on uDoo Board.

2013-12-17 Thread Stefano Babic
On 28/11/2013 12:32, Giuseppe Pagano wrote:
 Add SATA support on uDoo Board.
 
 Signed-off-by: Giuseppe Pagano giuseppe.pag...@seco.com
 CC: Stefano Babic sba...@denx.de
 CC: Fabio Estevam fabio.este...@freescale.com
 ---
 


Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH] configs: imx: Remove CONFIG_SYS_SPD_BUS_NUM option

2013-12-17 Thread Stefano Babic
On 20/11/2013 23:38, Fabio Estevam wrote:
 From: Fabio Estevam fabio.este...@freescale.com
 
 According to the README:
 
 - CONFIG_SYS_SPD_BUS_NUM
   If SPD EEPROM is on an I2C bus other than the first
   one, specify here. Note that the value must resolve
   to something your driver can deal with.
 
 There is no SPD EEPROM on the imx boards, so ged rid of this option.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic


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


Re: [U-Boot] [PATCH 1/1] MX6 SabreSD: Use readl() to read the CCM_CCGR3 register

2013-12-17 Thread Stefano Babic
On 29/11/2013 15:38, Liu Ying wrote:
 Align with the context to use readl() to read the CCM_CCGR3
 register with memory barrier instead of __raw_readl().
 
 Signed-off-by: Liu Ying ying@freescale.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH] ARM: mx53: video: Add IPUv3 LCD support for M53EVK

2013-12-17 Thread Stefano Babic
On 02/12/2013 17:01, Marek Vasut wrote:
 This patch adds support for the AMPIRE 800x480 LCD panel that is available
 for M53EVK.
 
 Signed-off-by: Marek Vasut ma...@denx.de
 Cc: Stefano Babic sba...@denx.de
 ---


Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH] ARM: mx6: Update non-Freescale boards to include CPU errata.

2013-12-17 Thread Stefano Babic
On 27/11/2013 01:40, Eric Nelson wrote:
 The CPU errata expressed in include/configs/mx6_common.h apply
 to all i.MX6DQ and i.MX6DLS parts.
 
 Signed-off-by: Eric Nelson eric.nel...@boundarydevices.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic


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


Re: [U-Boot] [PATCH v2] mx6: clock: Fix the calculation of PLL_ENET frequency

2013-12-17 Thread Stefano Babic
On 03/12/2013 21:26, Fabio Estevam wrote:
 From: Fabio Estevam fabio.este...@freescale.com
 
 According to the mx6 quad reference manual, the DIV_SELECT field of register
 CCM_ANALOG_PLL_ENETn has the following meaning:
 
 Controls the frequency of the ethernet reference clock.
 - 00 - 25MHz
 - 01 - 50MHz
 - 10 - 100MHz
 - 11 - 125MHz
 
 Current logic does not handle the 25MHz case correctly, so fix it.
 
 Signed-off-by: Rabeeh Khoury rab...@solid-run.com
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH v3 2/2] mx6sabresd: Fix LVDS width and color format

2013-12-17 Thread Stefano Babic
On 04/12/2013 04:08, Fabio Estevam wrote:
 From: Fabio Estevam fabio.este...@freescale.com
 
 mx6sabresd boards have a 18-bit LVDS data width and the correct color format
 is RGB666.
 
 Suggested-by: Liu Ying ying@freescale.com
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH v3 1/2] mx6sabresd: Allow probing HSYNC, VSYNC and DISP_CLK signals

2013-12-17 Thread Stefano Babic
On 04/12/2013 04:08, Fabio Estevam wrote:
 From: Fabio Estevam fabio.este...@freescale.com
 
 HSYNC, VSYNC and DISP_CLK are very useful display signals for debugging.
 
 Configure them as active pins.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---


Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH] ARM: mxs: tools: Fix errno handling in strtoul() invocation

2013-12-17 Thread Stefano Babic
On 04/12/2013 14:27, Marek Vasut wrote:
 According to NOTE in strtoul(3), the errno must be zeroed before strtoul()
 is called. Zero the errno. The NOTE reads as such:
 
   Since strtoul() can legitimately return 0 or ULONG_MAX (ULLONG_MAX for
   strtoull()) on both success and failure, the calling program should set
   errno  to  0  before the call, and then determine if an error occurred
   by checking whether errno has a nonzero value after the call.
 
 This issue was detected on Fedora 19 with glibc 2.17 .
 
 Signed-off-by: Marek Vasut ma...@denx.de
 Cc: Stefano Babic sba...@denx.de
 Cc: Tom Rini tr...@ti.com
 ---


Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH 1/1] imx6: fix random hang when download by usb

2013-12-17 Thread Stefano Babic
On 13/11/2013 17:58, Frank Li wrote:
 ROM did not invalidate L1 cache when download by usb
 Need invalidate L1 cache before enable cache
 
 Signed-off-by: Huang yongcai b20...@freescale.com
 Signed-off-by: Frank Li frank...@freescale.com
 ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic



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


Re: [U-Boot] [PATCH v4] arm: mx5: Add fuse supply enable in fsl_iim

2013-12-17 Thread Benoît Thébaudeau
Dear Sergey Alyoshin,

On Tuesday, December 17, 2013 8:24:54 PM, Sergey Alyoshin wrote:
 Enable fuse supply before fuse programming and disable after.
 
 Signed-off-by: Sergey Alyoshin alyoshi...@gmail.com
 ---
  arch/arm/cpu/armv7/mx5/clock.c   |   12 
  arch/arm/include/asm/arch-mx5/clock.h|1 +
  arch/arm/include/asm/arch-mx5/crm_regs.h |3 +++
  drivers/misc/fsl_iim.c   |   13 -
  4 files changed, 28 insertions(+), 1 deletion(-)
 
 diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
 index fb3b128..2ca87e4 100644
 --- a/arch/arm/cpu/armv7/mx5/clock.c
 +++ b/arch/arm/cpu/armv7/mx5/clock.c
 @@ -749,6 +749,18 @@ void enable_nfc_clk(unsigned char enable)
   MXC_CCM_CCGR5_EMI_ENFC(cg));
  }
  
 +#ifdef CONFIG_FSL_IIM
 +void enable_efuse_prog_supply(bool enable)
 +{
 + if (enable)
 + setbits_le32(mxc_ccm-cgpr,
 + MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
 + else
 + clrbits_le32(mxc_ccm-cgpr,
 + MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
 +}
 +#endif
 +
  /* Config main_bus_clock for periphs */
  static int config_periph_clk(u32 ref, u32 freq)
  {
 diff --git a/arch/arm/include/asm/arch-mx5/clock.h
 b/arch/arm/include/asm/arch-mx5/clock.h
 index 9ee79ae..3db4112 100644
 --- a/arch/arm/include/asm/arch-mx5/clock.h
 +++ b/arch/arm/include/asm/arch-mx5/clock.h
 @@ -53,5 +53,6 @@ void enable_usboh3_clk(bool enable);
  void mxc_set_sata_internal_clock(void);
  int enable_i2c_clk(unsigned char enable, unsigned i2c_num);
  void enable_nfc_clk(unsigned char enable);
 +void enable_efuse_prog_supply(bool enable);
  
  #endif /* __ASM_ARCH_CLOCK_H */
 diff --git a/arch/arm/include/asm/arch-mx5/crm_regs.h
 b/arch/arm/include/asm/arch-mx5/crm_regs.h
 index 392881c..efe57e0 100644
 --- a/arch/arm/include/asm/arch-mx5/crm_regs.h
 +++ b/arch/arm/include/asm/arch-mx5/crm_regs.h
 @@ -305,6 +305,9 @@ struct mxc_ccm_reg {
  /* Define the bits in register CCDR */
  #define MXC_CCM_CCDR_IPU_HS_MASK (0x1  17)
  
 +/* Define the bits in register CGPR */
 +#define MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE  (1  4)
 +
  /* Define the bits in register CCGRx */
  #define MXC_CCM_CCGR_CG_MASK 0x3
  #define MXC_CCM_CCGR_CG_OFF  0x0
 diff --git a/drivers/misc/fsl_iim.c b/drivers/misc/fsl_iim.c
 index 44ae7b1..36433a7 100644
 --- a/drivers/misc/fsl_iim.c
 +++ b/drivers/misc/fsl_iim.c
 @@ -16,6 +16,9 @@
  #ifndef CONFIG_MPC512X
  #include asm/arch/imx-regs.h
  #endif
 +#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
 +#include asm/arch/clock.h
 +#endif
  
  /* FSL IIM-specific constants */
  #define STAT_BUSY0x80
 @@ -93,6 +96,10 @@ struct fsl_iim {
   } bank[8];
  };
  
 +#if !defined(CONFIG_MX51)  !defined(CONFIG_MX53)
 +#define enable_efuse_prog_supply(enable)
 +#endif
 +
  static int prepare_access(struct fsl_iim **regs, u32 bank, u32 word, int
  assert,
   const char *caller)
  {
 @@ -237,12 +244,16 @@ int fuse_prog(u32 bank, u32 word, u32 val)
   if (ret)
   return ret;
  
 + enable_efuse_prog_supply(1);
   for (bit = 0; val; bit++, val = 1)
   if (val  0x01) {
   ret = prog_bit(regs, bank, word, bit);
 - if (ret)
 + if (ret) {
 + enable_efuse_prog_supply(0);
   return ret;
 + }
   }
 + enable_efuse_prog_supply(0);
  
   return 0;
  }
 --
 1.7.10.4

Reviewed-by: Benoît Thébaudeau benoit.thebaud...@advansee.com

Thanks for this contribution and for your patience.

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


[U-Boot] [PATCH 2/2] mx6sabre_common.h: Add CONFIG_CMD_FUSE support

2013-12-17 Thread Fabio Estevam
From: Fabio Estevam fabio.este...@freescale.com

Add CONFIG_CMD_FUSE option, so that the fuse API can be used.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 include/configs/mx6sabre_common.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/mx6sabre_common.h 
b/include/configs/mx6sabre_common.h
index d52c9a8..63405aa 100644
--- a/include/configs/mx6sabre_common.h
+++ b/include/configs/mx6sabre_common.h
@@ -34,6 +34,11 @@
 
 #define CONFIG_MXC_UART
 
+#define CONFIG_CMD_FUSE
+#ifdef CONFIG_CMD_FUSE
+#define CONFIG_MXC_OCOTP
+#endif
+
 /* MMC Configs */
 #define CONFIG_FSL_ESDHC
 #define CONFIG_FSL_USDHC
-- 
1.8.1.2

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


[U-Boot] [PATCH 1/2] powerpc/P1022DS: Define new nand_ecclayout structure macros

2013-12-17 Thread York Sun
Define CONFIG_SYS_NAND_MAX_ECCPOS and CONFIG_SYS_NAND_MAX_OOBFREE to
reduce the image size, by taking advantage of the new nand_ecclayout
structure.

Signed-off-by: York Sun york...@freescale.com
CC: Prabhakar Kushwaha prabha...@freescale.com
CC: Scott Wood scottw...@freescale.com
---
 include/configs/P1022DS.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index ba43cce..934a6cb 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -75,6 +75,8 @@
 #endif
 
 #define CONFIG_NAND_FSL_ELBC
+#define CONFIG_SYS_NAND_MAX_ECCPOS 56
+#define CONFIG_SYS_NAND_MAX_OOBFREE5
 
 #ifdef CONFIG_NAND
 #define CONFIG_SPL
-- 
1.7.9.5


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


[U-Boot] [PATCH 1/2] doc: README.fuse: Add an example on how to use the fuse API on mx6q

2013-12-17 Thread Fabio Estevam
From: Fabio Estevam fabio.este...@freescale.com

When using the fuse API in U-boot user must calculate the 'bank' and 'word' 
values. 

Provide a real example on how to calculate such values for the mx6q.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 doc/README.fuse | 57 +
 1 file changed, 57 insertions(+)

diff --git a/doc/README.fuse b/doc/README.fuse
index 1bc91c4..aca1e5e 100644
--- a/doc/README.fuse
+++ b/doc/README.fuse
@@ -65,3 +65,60 @@ Configuration:
 
CONFIG_CMD_FUSE
   Define this to enable the fuse commands.
+
+Example:
+
+For reading the MAC address fuses on a MX6Q:
+
+- The MAC address are stored in two fuse addresses (the fuse addresses are
+described in the Fusemap Descriptions table from the mx6q Reference Manual):
+
+0x620[31:0] - MAC_ADDR[31:0]
+0x630[15:0] - MAC_ADDR[47:32]
+
+In order to use the fuse API, we need to pass the bank and word values, which
+are calculated as below:
+
+Fuse address for the lower MAC address: 0x620
+Base address for the fuses: 0x400
+
+(0x620 - 0x400)/0x10 = 0x22 = 34 decimal
+
+As the fuses are arranged in banks of 8 words:
+
+34 / 8 = 4 and the remainder is 2, so in this case:
+
+bank = 4
+word = 2
+
+And the U-boot command would be:
+
+= fuse read 4 2
+Reading bank 4:
+
+Word 0x0002: 9f027772
+
+Doing the same for the upper MAC address:
+
+Fuse address for the upper MAC address: 0x630
+Base address for the fuses: 0x400
+
+(0x630 - 0x400)/0x10 = 0x23 = 35 decimal
+
+As the fuses are arranged in banks of 8 words:
+
+35 / 8 = 4 and the remainder is 3, so in this case:
+
+bank = 4
+word = 3
+
+And the U-boot command would be:
+
+= fuse read 4 3
+Reading bank 4:
+
+Word 0x0003: 0004
+
+,which matches the ethaddr value:
+= echo ${ethaddr}
+00:04:9f:02:77:72
-- 
1.8.1.2

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


[U-Boot] [PATCH v4] arm: mx5: Add fuse supply enable in fsl_iim

2013-12-17 Thread Sergey Alyoshin
Enable fuse supply before fuse programming and disable after.

Signed-off-by: Sergey Alyoshin alyoshi...@gmail.com
---
 arch/arm/cpu/armv7/mx5/clock.c   |   12 
 arch/arm/include/asm/arch-mx5/clock.h|1 +
 arch/arm/include/asm/arch-mx5/crm_regs.h |3 +++
 drivers/misc/fsl_iim.c   |   13 -
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index fb3b128..2ca87e4 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -749,6 +749,18 @@ void enable_nfc_clk(unsigned char enable)
MXC_CCM_CCGR5_EMI_ENFC(cg));
 }
 
+#ifdef CONFIG_FSL_IIM
+void enable_efuse_prog_supply(bool enable)
+{
+   if (enable)
+   setbits_le32(mxc_ccm-cgpr,
+   MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
+   else
+   clrbits_le32(mxc_ccm-cgpr,
+   MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE);
+}
+#endif
+
 /* Config main_bus_clock for periphs */
 static int config_periph_clk(u32 ref, u32 freq)
 {
diff --git a/arch/arm/include/asm/arch-mx5/clock.h 
b/arch/arm/include/asm/arch-mx5/clock.h
index 9ee79ae..3db4112 100644
--- a/arch/arm/include/asm/arch-mx5/clock.h
+++ b/arch/arm/include/asm/arch-mx5/clock.h
@@ -53,5 +53,6 @@ void enable_usboh3_clk(bool enable);
 void mxc_set_sata_internal_clock(void);
 int enable_i2c_clk(unsigned char enable, unsigned i2c_num);
 void enable_nfc_clk(unsigned char enable);
+void enable_efuse_prog_supply(bool enable);
 
 #endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/include/asm/arch-mx5/crm_regs.h 
b/arch/arm/include/asm/arch-mx5/crm_regs.h
index 392881c..efe57e0 100644
--- a/arch/arm/include/asm/arch-mx5/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx5/crm_regs.h
@@ -305,6 +305,9 @@ struct mxc_ccm_reg {
 /* Define the bits in register CCDR */
 #define MXC_CCM_CCDR_IPU_HS_MASK   (0x1  17)
 
+/* Define the bits in register CGPR */
+#define MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE(1  4)
+
 /* Define the bits in register CCGRx */
 #define MXC_CCM_CCGR_CG_MASK   0x3
 #define MXC_CCM_CCGR_CG_OFF0x0
diff --git a/drivers/misc/fsl_iim.c b/drivers/misc/fsl_iim.c
index 44ae7b1..36433a7 100644
--- a/drivers/misc/fsl_iim.c
+++ b/drivers/misc/fsl_iim.c
@@ -16,6 +16,9 @@
 #ifndef CONFIG_MPC512X
 #include asm/arch/imx-regs.h
 #endif
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#include asm/arch/clock.h
+#endif
 
 /* FSL IIM-specific constants */
 #define STAT_BUSY  0x80
@@ -93,6 +96,10 @@ struct fsl_iim {
} bank[8];
 };
 
+#if !defined(CONFIG_MX51)  !defined(CONFIG_MX53)
+#define enable_efuse_prog_supply(enable)
+#endif
+
 static int prepare_access(struct fsl_iim **regs, u32 bank, u32 word, int 
assert,
const char *caller)
 {
@@ -237,12 +244,16 @@ int fuse_prog(u32 bank, u32 word, u32 val)
if (ret)
return ret;
 
+   enable_efuse_prog_supply(1);
for (bit = 0; val; bit++, val = 1)
if (val  0x01) {
ret = prog_bit(regs, bank, word, bit);
-   if (ret)
+   if (ret) {
+   enable_efuse_prog_supply(0);
return ret;
+   }
}
+   enable_efuse_prog_supply(0);
 
return 0;
 }
-- 
1.7.10.4

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


[U-Boot] [PATCH 2/2] powerpc/B4860QDS: Define new nand_ecclayout structure macros

2013-12-17 Thread York Sun
Define CONFIG_SYS_NAND_MAX_ECCPOS and CONFIG_SYS_NAND_MAX_OOBFREE to
reduce the image size, by taking advantage of the new nand_ecclayout
structure.

Signed-off-by: York Sun york...@freescale.com
CC: Prabhakar Kushwaha prabha...@freescale.com
CC: Scott Wood scottw...@freescale.com
---
 include/configs/B4860QDS.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index 3c6cd61..c182158 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -289,6 +289,8 @@ unsigned long get_board_ddr_clk(void);
 
 /* NAND Flash on IFC */
 #define CONFIG_NAND_FSL_IFC
+#define CONFIG_SYS_NAND_MAX_ECCPOS 256
+#define CONFIG_SYS_NAND_MAX_OOBFREE2
 #define CONFIG_SYS_NAND_BASE   0xff80
 #ifdef CONFIG_PHYS_64BIT
 #define CONFIG_SYS_NAND_BASE_PHYS  (0xfull | CONFIG_SYS_NAND_BASE)
-- 
1.7.9.5


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


Re: [U-Boot] [PATCH 1/2] doc: README.fuse: Add an example on how to use the fuse API on mx6q

2013-12-17 Thread Benoît Thébaudeau
Hi Fabio,

On Tuesday, December 17, 2013 9:03:40 PM, Fabio Estevam wrote:
 From: Fabio Estevam fabio.este...@freescale.com
 
 When using the fuse API in U-boot user must calculate the 'bank' and 'word'
 values.
 
 Provide a real example on how to calculate such values for the mx6q.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---
  doc/README.fuse | 57
  +
  1 file changed, 57 insertions(+)
 
 diff --git a/doc/README.fuse b/doc/README.fuse
 index 1bc91c4..aca1e5e 100644
 --- a/doc/README.fuse
 +++ b/doc/README.fuse
 @@ -65,3 +65,60 @@ Configuration:
  
 CONFIG_CMD_FUSE
Define this to enable the fuse commands.
 +
 +Example:
 +
 +For reading the MAC address fuses on a MX6Q:
 +
 +- The MAC address are stored in two fuse addresses (the fuse addresses are
 +described in the Fusemap Descriptions table from the mx6q Reference Manual):
 +
 +0x620[31:0] - MAC_ADDR[31:0]
 +0x630[15:0] - MAC_ADDR[47:32]
 +
 +In order to use the fuse API, we need to pass the bank and word values,
 which
 +are calculated as below:
 +
 +Fuse address for the lower MAC address: 0x620
 +Base address for the fuses: 0x400
 +
 +(0x620 - 0x400)/0x10 = 0x22 = 34 decimal
 +
 +As the fuses are arranged in banks of 8 words:
 +
 +34 / 8 = 4 and the remainder is 2, so in this case:
 +
 +bank = 4
 +word = 2
 +
 +And the U-boot command would be:
 +
 += fuse read 4 2
 +Reading bank 4:
 +
 +Word 0x0002: 9f027772
 +
 +Doing the same for the upper MAC address:
 +
 +Fuse address for the upper MAC address: 0x630
 +Base address for the fuses: 0x400
 +
 +(0x630 - 0x400)/0x10 = 0x23 = 35 decimal
 +
 +As the fuses are arranged in banks of 8 words:
 +
 +35 / 8 = 4 and the remainder is 3, so in this case:
 +
 +bank = 4
 +word = 3
 +
 +And the U-boot command would be:
 +
 += fuse read 4 3
 +Reading bank 4:
 +
 +Word 0x0003: 0004
 +
 +,which matches the ethaddr value:
 += echo ${ethaddr}
 +00:04:9f:02:77:72
 --
 1.8.1.2

Note that the documentation in this file is also completed for i.MX6 by
doc/README.mxc_ocotp and doc/README.imx6, as explained in each README. The
information that you add here regarding the location of the MAC fuses for i.MX6Q
is already present in doc/README.imx6.

Regarding the 'calculation' part, it is actually not needed since the values
obtained with these calculations are already given by the reference manual in
'46.5 OCOTP Memory Map/Register Definition'.

Examples could still be interesting though. What do you think?
 - Should the calculation part be removed and replaced with a reference to the
   RM §46.5 be added?
 - Should this example be moved to doc/README.imx6, or kept in doc/README.fuse
   as a generic example for the fuse API?
 - Should an example be added to show how to read the whole MAC address with a
   single fuse command (i.e. 'fuse read 4 2 2')?

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


Re: [U-Boot] [PATCH 2/2] mx6sabre_common.h: Add CONFIG_CMD_FUSE support

2013-12-17 Thread Benoît Thébaudeau
Hi Fabio,

On Tuesday, December 17, 2013 9:03:41 PM, Fabio Estevam wrote:
 From: Fabio Estevam fabio.este...@freescale.com
 
 Add CONFIG_CMD_FUSE option, so that the fuse API can be used.
 
 Signed-off-by: Fabio Estevam fabio.este...@freescale.com
 ---
  include/configs/mx6sabre_common.h | 5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/include/configs/mx6sabre_common.h
 b/include/configs/mx6sabre_common.h
 index d52c9a8..63405aa 100644
 --- a/include/configs/mx6sabre_common.h
 +++ b/include/configs/mx6sabre_common.h
 @@ -34,6 +34,11 @@
  
  #define CONFIG_MXC_UART
  
 +#define CONFIG_CMD_FUSE
 +#ifdef CONFIG_CMD_FUSE
 +#define CONFIG_MXC_OCOTP
 +#endif
 +
  /* MMC Configs */
  #define CONFIG_FSL_ESDHC
  #define CONFIG_FSL_USDHC
 --
 1.8.1.2

Reviewed-by: Benoît Thébaudeau benoit.thebaud...@advansee.com

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


Re: [U-Boot] how to limit sandbox to a single thread/core?

2013-12-17 Thread Simon Glass
Hi,

On 16 December 2013 21:59, Abraham V. abraham.varric...@vvdntech.com wrote:
 On Tue, Dec 17, 2013 at 2:00 AM, Simon Glass s...@chromium.org wrote:
 Hi,

 On 13 December 2013 01:47, Abraham V. abraham.varric...@vvdntech.com wrote:
 Hello,

 I just discovered that uboot has a sandbox build - output binary is
 a standard linux application. This prompted me to try stepping through
 the code with gdb and I'm running into an annoyance.

 The sandbox binary is splitting into 4 threads (I'm guessing one for
 each of my cores, am running this on an intel i3). This results in gdb
 jumping between the different threads every once in a while.

 Is there anyway to setup the sandbox to run as a single thread?

 This is news to me - I have not hit this problem yet. Can you see what
 the threads are?

 Regards,
 Simon

 I'm ... embarrassed to report that this is a false alarm. Took me a
 couple of days and I was about to send a reply today morning when I
 saw your response. What happened is that I used the eclipse-cdt
 debugger to try tracing the sandbox application. An interesting
 'feature' of this debugger is that it shows which core a process is
 running on. Here are a few (links) screenshots,

 http://imageshack.us/a/img14/2202/ze37.png
 http://imageshack.us/a/img855/1153/uwul.png
 http://imageshack.us/a/img585/8499/ibz3.png

 It wasn't until yesterday when I realized that, while the application
 was jumping between cores, the thread number was exactly the same - it
 wasn't a multi-threaded application, but a single threaded one just
 bouncing around! This puzzled me so much that I even started a SO
 question over the matter,

 http://stackoverflow.com/questions/20608032/while-debugging-will-a-single-threaded-application-jump-between-cores

 Turns out that the scheduler knocked me off-balance. Can't believe I'm
 saying this, but I miss the days when everything ran on a single
 thread/processor core.

OK that's good, thanks for the detailed explanation, I'm sure others
will hit this.

Regards,
Simon


 A little embarrassed,
 Abraham V.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/4] Add dumpimage, a tool to extract data from U-Boot images

2013-12-17 Thread Simon Glass
Hi Masahiro,

On 16 December 2013 19:25, Masahiro Yamada yamad...@jp.panasonic.com wrote:
 Hello Guilherme, Simon


 diff --git a/Makefile b/Makefile
 index a2fb037..653d3b3 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -796,6 +796,7 @@ clean:
  $(obj)tools/envcrc \
  $(obj)tools/gdb/{astest,gdbcont,gdbsend}   \
  $(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/mxsboot\

 Where is tools/dumpenvimage created?

I don't see it.

Regards,
Simon



 Best Regards
 Masahiro Yamada

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


Re: [U-Boot] mtd: nand: omap: fix ecc-layout for HAM1 ecc-scheme

2013-12-17 Thread Scott Wood
On Thu, Dec 05, 2013 at 05:54:21PM +0530, pekon gupta wrote:
 As per OMAP3530 TRM referenced below [1]
 
 For large-page NAND, ROM code expects following ecc-layout for HAM1 ecc-scheme
  - OOB[1] (offset of 1 *byte* from start of OOB) for x8 NAND device
  - OOB[2] (offset of 1 *word* from start of OOB) for x16 NAND device
 
 Thus ecc-layout expected by ROM code for HAM1 ecc-scheme is:
  *for x8 NAND Device*
  ++-+-+-+-+-+-+
  |    | ECC[A0] | ECC[A1] | ECC[A2] | ECC[B0] | ECC[B1] | ECC[B2] | ...
  ++-+-+-+-+-+-+
 
  *for x16 NAND Device*
  
 +++-+-+-+-+-+-+
  | x  | x  | ECC[A0] | ECC[A1] | ECC[A2] | ECC[B0] | ECC[B1] | 
 ECC[B2] |
  
 +++-+-+-+-+-+-+
 
 This patch fixes ecc-layout *only* for HAM1, as required by ROM-code
 For other ecc-schemes like (BCH8) ecc-layout is same for x8 or x16 devices.
 
 [1] OMAP3530: http://www.ti.com/product/omap3530
 TRM: http://www.ti.com/litv/pdf/spruf98x
   Chapter-25: Initialization Sub-topic: Memory Booting
   Section: 25.4.7.4 NAND
   Figure 25-19. ECC Locations in NAND Spare Areas
 
 Reported-by: Stefan Roese s...@denx.de
 Signed-off-by: Pekon Gupta pe...@ti.com
 Tested-by: Stefan Roese s...@denx.de
 
 ---
 drivers/mtd/nand/omap_gpmc.c | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

Applied to u-boot-nand-flash.git

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


Re: [U-Boot] mtd: nand: omap_gpmc: cosmetic: Fix indentation

2013-12-17 Thread Scott Wood
On Thu, Dec 05, 2013 at 07:58:06AM +0100, Stefan Roese wrote:
 Signed-off-by: Stefan Roese s...@denx.de
 Cc: Pekon Gupta pe...@ti.com
 Cc: Scott Wood scottw...@freescale.com
 
 ---
 drivers/mtd/nand/omap_gpmc.c | 86 ++--
  1 file changed, 43 insertions(+), 43 deletions(-)

Applied to u-boot-nand-flash.git with long lines wrapped.

I'm applying this even though the optimize OMAP NAND driver patchset
addresses the indentation, because it's too late in the release cycle for
that patchset (rc2 is already out, and v9 of the patchset was posted 10
days after the merge window closed) and the misindentation isn't just
ugly, but misleading as to the code flow (when I applied the patch that
introduced this, I thought Pekon had fixed it in the last version
posted).  I didn't want to let this significant readability regression
into the release.

Plus, this keeps the history cleaner than if the indentation fix were
combined with other changes.

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


Re: [U-Boot] [U-Boot, V2] mtd: nand: omap: fix HAM1_SW ecc using default value for ecc.size

2013-12-17 Thread Scott Wood
On Thu, Dec 12, 2013 at 03:19:31PM +0200, Nikita Kiryanov wrote:
 Commit mtd: nand: omap: enable BCH ECC scheme using ELM for generic
 platform (d016dc42cedbf6102e100fa9ecb58462edfb14f8) changed the way
 software ECC is configured, both during boot, and during ecc switch, in a way
 that is not backwards compatible with older systems:
 
 Older version of omap_gpmc.c always assigned ecc.size = 0 when configuring
 for software ecc, relying on nand_scan_tail() to select a default for ecc.size
 (256), while the new version of omap_gpmc.c assigns ecc.size = pagesize,
 which is likely to not be 256.
 
 Since 1 bit hamming sw ecc is only meant to be used by legacy devices, revert
 to the original behavior.
 
 Cc: Igor Grinberg grinb...@compulab.co.il
 Cc: Tom Rini tr...@ti.com
 Cc: Scott Wood scottw...@freescale.com
 Cc: Pekon Gupta pe...@ti.com
 Signed-off-by: Nikita Kiryanov nik...@compulab.co.il
 Acked-by: Pekon Gupta pe...@ti.com
 
 ---
 Changes in V2:
   - reworded commit title to better reflect what is being affected (Pekon
   Gupta)
 
  drivers/mtd/nand/omap_gpmc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-nand-flash.git

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


Re: [U-Boot] [U-Boot, v2] nand_util.c: Use '%zd' for length in nand_unlock debug print

2013-12-17 Thread Scott Wood
On Mon, Dec 16, 2013 at 09:59:34AM -0500, Tom Rini wrote:
 length is size_t so needs to be '%zd' not '%d' to avoid warnings.
 
 Cc: Scott Wood scottw...@freescale.com
 Signed-off-by: Tom Rini tr...@ti.com
 Acked-by: Scott Wood scottw...@freescale.com
 
 ---
 Changes in v2:
 - Use %zd, the correct format, rather than %ld, a differntly incorrect
   one.
 ---
  drivers/mtd/nand/nand_util.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-nand-flash.git

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


Re: [U-Boot] [U-Boot, 1/2] mtd: nand: omap: fix sw-hw-sw ecc switch

2013-12-17 Thread Scott Wood
On Mon, Dec 16, 2013 at 07:19:01PM +0200, Nikita Kiryanov wrote:
 When switching ecc mode, omap_select_ecc_scheme() assigns the appropriate 
 values
 into the current nand chip's ecc.layout struct. This is done under the
 assumption that the struct exists only to store values, so it is OK to 
 overwrite
 it, but there is at least one situation where this assumption is incorrect:
 
 When switching to 1 bit hamming code sw ecc, the job of assigning layout data
 is outsourced to nand_scan_tail(), which simply assigns into ecc.layout a
 pointer to an existing struct prefilled with the appropriate values. This 
 struct
 doubles as both data and layout definition, and therefore shouldn't be
 overwritten, but on the next switch to hardware ecc, this is exactly what's
 going to happen. The next time the user switches to software ecc, they're
 going to get a messed up ecc layout.
 
 Prevent this and possible similar bugs by explicitly using the
 private-to-omap_gpmc.c omap_ecclayout struct when switching ecc mode.
 
 Cc: Scott Wood scottw...@freescale.com
 Cc: Pekon Gupta pe...@ti.com
 Signed-off-by: Nikita Kiryanov nik...@compulab.co.il
 
 ---
 drivers/mtd/nand/omap_gpmc.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

Applied to u-boot-nand-flash.git

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


Re: [U-Boot] [U-Boot, V2, 2/2] mtd: nand: omap: fix ecc ops assignment when changing ecc

2013-12-17 Thread Scott Wood
On Tue, Dec 17, 2013 at 03:18:01PM +0200, Nikita Kiryanov wrote:
 If we change to software ecc and then back to hardware ecc, the nand ecc ops
 pointers are populated with incorrect function pointers. This is related to 
 the
 way nand_scan_tail() handles assigning functions to ecc ops:
 
 If we are switching to software ecc/no ecc, it assigns default functions to 
 the
 ecc ops pointers unconditionally, but if we are switching to hardware ecc,
 the default hardware ecc functions are assigned to ops pointers only if these
 pointers are NULL (so that drivers could set their own functions). In the case
 of omap_gpmc.c driver, when we switch to sw ecc, sw ecc functions are
 assigned to ecc ops by nand_scan_tail(), and when we later switch to hw ecc,
 the ecc ops pointers are not NULL, so nand_scan_tail() does not overwrite
 them with hw ecc functions.
 The result: sw ecc functions used to write hw ecc data.
 
 Clear the ecc ops pointers in omap_gpmc.c when switching ecc types, so that
 ops which were not assigned by the driver will get the correct default values
 from nand_scan_tail().
 
 Cc: Scott Wood scottw...@freescale.com
 Cc: Pekon Gupta pe...@ti.com
 Signed-off-by: Nikita Kiryanov nik...@compulab.co.il
 
 ---
 Changes in V2:
   - Clear the ops after error checks, not before.
   - Use memset on ecc struct to clear the ops.
 
  drivers/mtd/nand/omap_gpmc.c | 3 +++
  1 file changed, 3 insertions(+)

Applied to u-boot-nand-flash.git

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


[U-Boot] [PATCH REPOST2] ARM: rpi_b: power on SDHCI and USB HW modules

2013-12-17 Thread Stephen Warren
Send RPC commands to the VideoCore to turn on the SDHCI and USB modules.
For SDHCI this isn't needed in practice, since the firmware already
turned on the power in order to load U-Boot. However, it's best to be
explicit. For USB, this is necessary, since the module isn't powered
otherwise. This will allow the kernel USB driver to work.

Cc: Andre Heider a.hei...@gmail.com
Signed-off-by: Stephen Warren swar...@wwwdotorg.org
---
 arch/arm/include/asm/arch-bcm2835/mbox.h |   48 ++
 board/raspberrypi/rpi_b/rpi_b.c  |   34 -
 2 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-bcm2835/mbox.h 
b/arch/arm/include/asm/arch-bcm2835/mbox.h
index 6b806ec..38cb42a 100644
--- a/arch/arm/include/asm/arch-bcm2835/mbox.h
+++ b/arch/arm/include/asm/arch-bcm2835/mbox.h
@@ -133,6 +133,54 @@ struct bcm2835_mbox_tag_get_arm_mem {
} body;
 };
 
+#define BCM2835_MBOX_POWER_DEVID_SDHCI 0
+#define BCM2835_MBOX_POWER_DEVID_UART0 1
+#define BCM2835_MBOX_POWER_DEVID_UART1 2
+#define BCM2835_MBOX_POWER_DEVID_USB_HCD   3
+#define BCM2835_MBOX_POWER_DEVID_I2C0  4
+#define BCM2835_MBOX_POWER_DEVID_I2C1  5
+#define BCM2835_MBOX_POWER_DEVID_I2C2  6
+#define BCM2835_MBOX_POWER_DEVID_SPI   7
+#define BCM2835_MBOX_POWER_DEVID_CCP2TX8
+
+#define BCM2835_MBOX_POWER_STATE_RESP_ON   (1  1)
+/* Device doesn't exist */
+#define BCM2835_MBOX_POWER_STATE_RESP_NODEV(1  1)
+
+#define BCM2835_MBOX_TAG_GET_POWER_STATE   0x00020001
+
+struct bcm2835_mbox_tag_get_power_state {
+   struct bcm2835_mbox_tag_hdr tag_hdr;
+   union {
+   struct {
+   u32 device_id;
+   } req;
+   struct {
+   u32 device_id;
+   u32 state;
+   } resp;
+   } body;
+};
+
+#define BCM2835_MBOX_TAG_SET_POWER_STATE   0x00028001
+
+#define BCM2835_MBOX_SET_POWER_STATE_REQ_ON(1  0)
+#define BCM2835_MBOX_SET_POWER_STATE_REQ_WAIT  (1  1)
+
+struct bcm2835_mbox_tag_set_power_state {
+   struct bcm2835_mbox_tag_hdr tag_hdr;
+   union {
+   struct {
+   u32 device_id;
+   u32 state;
+   } req;
+   struct {
+   u32 device_id;
+   u32 state;
+   } resp;
+   } body;
+};
+
 #define BCM2835_MBOX_TAG_GET_CLOCK_RATE0x00030002
 
 #define BCM2835_MBOX_CLOCK_ID_EMMC 1
diff --git a/board/raspberrypi/rpi_b/rpi_b.c b/board/raspberrypi/rpi_b/rpi_b.c
index 16d442a..f33fae9 100644
--- a/board/raspberrypi/rpi_b/rpi_b.c
+++ b/board/raspberrypi/rpi_b/rpi_b.c
@@ -29,6 +29,12 @@ struct msg_get_arm_mem {
u32 end_tag;
 };
 
+struct msg_set_power_state {
+   struct bcm2835_mbox_hdr hdr;
+   struct bcm2835_mbox_tag_set_power_state set_power_state;
+   u32 end_tag;
+};
+
 struct msg_get_clock_rate {
struct bcm2835_mbox_hdr hdr;
struct bcm2835_mbox_tag_get_clock_rate get_clock_rate;
@@ -54,11 +60,35 @@ int dram_init(void)
return 0;
 }
 
+static int power_on_module(u32 module)
+{
+   ALLOC_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1, 16);
+   int ret;
+
+   BCM2835_MBOX_INIT_HDR(msg_pwr);
+   BCM2835_MBOX_INIT_TAG(msg_pwr-set_power_state,
+ SET_POWER_STATE);
+   msg_pwr-set_power_state.body.req.device_id = module;
+   msg_pwr-set_power_state.body.req.state =
+   BCM2835_MBOX_SET_POWER_STATE_REQ_ON |
+   BCM2835_MBOX_SET_POWER_STATE_REQ_WAIT;
+
+   ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN,
+msg_pwr-hdr);
+   if (ret) {
+   printf(bcm2835: Could not set module %u power state\n,
+  module);
+   return -1;
+   }
+
+   return 0;
+}
+
 int board_init(void)
 {
gd-bd-bi_boot_params = 0x100;
 
-   return 0;
+   return power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD);
 }
 
 int board_mmc_init(void)
@@ -66,6 +96,8 @@ int board_mmc_init(void)
ALLOC_ALIGN_BUFFER(struct msg_get_clock_rate, msg_clk, 1, 16);
int ret;
 
+   power_on_module(BCM2835_MBOX_POWER_DEVID_SDHCI);
+
BCM2835_MBOX_INIT_HDR(msg_clk);
BCM2835_MBOX_INIT_TAG(msg_clk-get_clock_rate, GET_CLOCK_RATE);
msg_clk-get_clock_rate.body.req.clock_id = BCM2835_MBOX_CLOCK_ID_EMMC;
-- 
1.7.10.4

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


Re: [U-Boot] [PATCH v2 3/4] Add dumpimage, a tool to extract data from U-Boot images

2013-12-17 Thread Masahiro Yamada
Hello Simon.

  diff --git a/Makefile b/Makefile
  index a2fb037..653d3b3 100644
  --- a/Makefile
  +++ b/Makefile
  @@ -796,6 +796,7 @@ clean:
   $(obj)tools/envcrc \
   $(obj)tools/gdb/{astest,gdbcont,gdbsend}   \
   $(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/mxsboot\
 
  Where is tools/dumpenvimage created?
 
 I don't see it.

OK.
Anyway, I will fix it in my Kbuild series.

Best Regards
Masahiro Yamada

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


[U-Boot] [PATCH] powerpc/t208x: fix macro CONFIG_SYS_FSL_NUM_USB_CTRLS

2013-12-17 Thread Shengzhou Liu
CONFIG_SYS_FSL_NUM_USB_CTRLS is no longer used,
update it to new CONFIG_USB_MAX_CONTROLLER_COUNT.

Signed-off-by: Shengzhou Liu shengzhou@freescale.com
---
 arch/powerpc/include/asm/config_mpc85xx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/config_mpc85xx.h 
b/arch/powerpc/include/asm/config_mpc85xx.h
index 244ccbf..c8679a5 100644
--- a/arch/powerpc/include/asm/config_mpc85xx.h
+++ b/arch/powerpc/include/asm/config_mpc85xx.h
@@ -745,7 +745,7 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define CONFIG_SYS_NUM_FM1_DTSEC   6
 #define CONFIG_SYS_NUM_FM1_10GEC   2
 #endif
-#define CONFIG_SYS_FSL_NUM_USB_CTRLS   2
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_NUM_DDR_CONTROLLERS 1
 #define CONFIG_PME_PLAT_CLK_DIV1
 #define CONFIG_SYS_PME_CLK CONFIG_PME_PLAT_CLK_DIV
-- 
1.8.0


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


Re: [U-Boot] mtd: nand: oob data structures taking up a lot of space

2013-12-17 Thread Scott Wood
On Fri, 2013-12-13 at 21:11 -0800, Aaron Williams wrote:
 Hi all,
 
 I am working on trying to shrink down a bootloader for one of our chips 
 where the bootloader must fit in around 448K of memory and things are 
 fairly tight. I found that the oob data structures for 8, 16, 64 and 128 
 bytes were taking up a fair amount of space. I had to increase the 
 eccpos size to 640 to match the Linux kernel since the existing size was 
 too small for some of the NAND devices we are working with.

This increase has already been done in top-of-tree U-Boot.

Note that (again with top-of-tree) you can override with a lower limit
to exactly match what your board requires.

 This caused each oob data structure to consume around 2.5K in the binary. By 
 initializing the layout data structures at runtime I was able to 
 eliminate most of the space taken since now the linker can place these 
 in BSS.

Yes, there's a lot of bloat in the NAND code -- both code and data --
that we could know at compile time is not going to get used for a
particular target.  Patches welcome.

-Scott


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


[U-Boot] [PATCH] powerpc/cms700: limit NAND data structure size

2013-12-17 Thread Scott Wood
This fixes a build break due to excessively large NAND data structures.

Signed-off-by: Scott Wood scottw...@freescale.com
Cc: Matthias Fuchs matthias.fu...@esd-electronics.com
---
 include/configs/CMS700.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/configs/CMS700.h b/include/configs/CMS700.h
index 4a5fc86..0bb22be 100644
--- a/include/configs/CMS700.h
+++ b/include/configs/CMS700.h
@@ -149,6 +149,9 @@
 #define CONFIG_SYS_NAND_SKIP_BAD_DOT_I 1   /* .i read skips bad blocks   
*/
 #define CONFIG_SYS_NAND_QUIET  1
 
+#define CONFIG_SYS_NAND_MAX_OOBFREE2
+#define CONFIG_SYS_NAND_MAX_ECCPOS 48
+
 /*
  * For booting Linux, the board info and command line data
  * have to be in the first 8 MB of memory, since this is
-- 
1.8.1.2

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


Re: [U-Boot] [PATCH 00/11 V11] EXYNOS5420: Add SMDK5420 board support

2013-12-17 Thread Rajeshwari Birje
Hi Minkyu,

Can we please, get these patches reviewed and merged.

Regards,
Rajeshwari.

On Mon, Dec 16, 2013 at 2:12 PM, Rajeshwari S Shinde
rajeshwar...@samsung.com wrote:
 This patch adds basic board support for SMDK5420 board.
 These patches are tested for booting fine on EVT1 SMDK5420.

 Changes in V2:
 - Corrected a compilation issue for SMDK5420.

 Changes in V3:
 - Add patch to support variable size SPL support
 - Add patch to disable SMU for eMMC.

 Changes in V4:
 - Added check for MAX77686 pmic compilation.
 - Added correct calculation of gpio based addresses.
 - Rebased on the latest u-boot code.
 - Removed patches for UART and TZPC changes as
 they were not needed.
 - Added flag to disable SMU for eMMC.

 Changes in V5:
 - Moved functions board_mmc_init and board_eth_init
 to common/board.c in case of device tree support.

 Changes in V6:
 - Rebased on the latest mainline branch.
 - Moved the definitions for SMU to arch/arm dwmmc.h

 Changes in V7:
 - Removed below patch as it is already merged
 DWMMC: SMDK5420: Disable SMU for eMMC
 - Corrected the multi line comments and removal of
 blank spaces and lines.
 - Corrected the license.

 Changes in V8:
 - corrected the if loops with if conditions of
 pro_id and cpu_id.

 Changes in V9:
 - Added macros to get the base address
 - Rebased on latest code.

 Changes in V10:
 - Added new structures for Power and DMC registers for
 5420.
 - Changed the input parameters for common dmc functions.
 - Removed unnecesarry blank lines and added where ever required.

 Changes in V11:
 -Rebased on latest u-boot-samsung branch.

 Rajeshwari S Shinde (11):
   EXYNOS5: Create a common board file
   Exynos5420: Add base addresses for 5420
   EXYNOS5420: Add power register structure.
   EXYNOS5420: Add dmc and phy_control register structure
   Exynos5420: Add clock initialization for 5420
   Exynos5420: Add DDR3 initialization for 5420
   Exynos5420: Add support for 5420 in pinmux and gpio
   Exynos5420: Add base patch for SMDK5420
   DTS: Add dts support for SMDK5420
   Config: Add initial config for SMDK5420
   SPL: EXYNOS: Prepare for variable size SPL support

  arch/arm/cpu/armv7/exynos/clock.c  | 279 -
  arch/arm/cpu/armv7/exynos/clock_init.h |  17 +
  arch/arm/cpu/armv7/exynos/clock_init_exynos5.c | 352 ++-
  arch/arm/cpu/armv7/exynos/dmc_common.c |  60 +-
  arch/arm/cpu/armv7/exynos/dmc_init_ddr3.c  | 439 -
  arch/arm/cpu/armv7/exynos/exynos5_setup.h  | 764 --
  arch/arm/cpu/armv7/exynos/pinmux.c | 260 +++-
  arch/arm/dts/exynos5.dtsi  | 198 ++
  arch/arm/dts/exynos5250.dtsi   | 194 +-
  arch/arm/dts/exynos5420.dtsi   |  70 +++
  arch/arm/include/asm/arch-exynos/board.h   |  17 +
  arch/arm/include/asm/arch-exynos/clk.h |   1 +
  arch/arm/include/asm/arch-exynos/clock.h   | 494 +++
  arch/arm/include/asm/arch-exynos/cpu.h |  52 +-
  arch/arm/include/asm/arch-exynos/dmc.h | 177 ++
  arch/arm/include/asm/arch-exynos/gpio.h| 143 -
  arch/arm/include/asm/arch-exynos/periph.h  |   3 +
  arch/arm/include/asm/arch-exynos/power.h   | 837 
 +
  board/samsung/common/Makefile  |   4 +
  board/samsung/common/board.c   | 410 
  board/samsung/dts/exynos5420-smdk5420.dts  | 169 +
  board/samsung/smdk5250/exynos5-dt.c| 352 +--
  board/samsung/smdk5250/smdk5250.c  | 182 +-
  board/samsung/smdk5420/Makefile|  11 +
  board/samsung/smdk5420/smdk5420.c  | 159 +
  board/samsung/smdk5420/smdk5420_spl.c  |  52 ++
  boards.cfg |   1 +
  include/configs/arndale.h  |   1 +
  include/configs/exynos5-dt.h   | 289 +
  include/configs/exynos5250-dt.h| 283 +
  include/configs/smdk5420.h |  56 ++
  spl/Makefile   |   7 +-
  tools/Makefile |   3 +-
  tools/mkexynosspl.c| 167 +++--
  34 files changed, 5188 insertions(+), 1315 deletions(-)
  create mode 100644 arch/arm/dts/exynos5.dtsi
  create mode 100644 arch/arm/dts/exynos5420.dtsi
  create mode 100644 arch/arm/include/asm/arch-exynos/board.h
  create mode 100644 board/samsung/common/board.c
  create mode 100644 board/samsung/dts/exynos5420-smdk5420.dts
  create mode 100644 board/samsung/smdk5420/Makefile
  create mode 100644 board/samsung/smdk5420/smdk5420.c
  create mode 100644 board/samsung/smdk5420/smdk5420_spl.c
  create mode 100644 

[U-Boot] [PATCH v2 26/35] Kbuild: generate {spl, tpl}-autoconf.mk only when it is necessary

2013-12-17 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 v2: None

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

diff --git a/Makefile b/Makefile
index 49edab8..0372a2e 100644
--- a/Makefile
+++ b/Makefile
@@ -868,9 +868,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
 
@@ -951,26 +948,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 bf886f7..55d6824 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 v2 22/35] Kbuild: delete temporary build scripts

2013-12-17 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 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 to use custom optimize flags on a per dir/file basis
-ALL_AFLAGS = $(AFLAGS) 

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

2013-12-17 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 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 2bacdbf..ce590ce 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 AWK
+export DTC CHECK CHECKFLAGS
+
 # load other configuration
 include $(TOPDIR)/config.mk
 
@@ 

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

2013-12-17 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 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 mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 05/35] examples: Use scripts/Makefile.build

2013-12-17 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

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 2ab24bd..3c7f5c2 100644
--- a/Makefile
+++ b/Makefile
@@ -535,12 +535,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)%: $(obj)%.o $(LIB)
-o $@ -e $(SYM_PREFIX)$(notdir $(:.o=)) $ $(LIB) \

[U-Boot] [PATCH v2 04/35] board: samsung: refactor host programs

2013-12-17 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 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 cd32ba3..2ab24bd 100644
--- a/Makefile
+++ b/Makefile
@@ -782,6 +782,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 b23ade8..a3253ba 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -156,8 +156,8 @@ all:$(ALL-y)
 
 ifdef CONFIG_SAMSUNG
 $(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) $ $@
 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 v2 19/35] Makefile: rename scripts/Makefile.build to scripts/Makefile.build.tmp

2013-12-17 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 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 v2 18/35] Kbuild: add dummy obj-y to create built-in.o

2013-12-17 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 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 v2 11/35] Kbuild: Use Kbuild.include

2013-12-17 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 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 ce590ce..68a9d13 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 examples/standalone/Makefile
diff --git a/spl/Makefile b/spl/Makefile
index a3253ba..13dd616 100644
--- a/spl/Makefile

[U-Boot] [PATCH v2 10/35] Kbuild: import Kbuild.include from linux v3.12 tag

2013-12-17 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

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 := $(call cc-version)
+cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
+
+# cc-fullversion
+# 

[U-Boot] [PATCH v2 27/35] Makefile: remove a cleaning target tidy

2013-12-17 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 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 d18ebf3..4f51264 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,7 +60,6 @@
 # Generated files
 #
 
-*.depend*
 /LOG
 /errlog
 /reloc_off
diff --git a/MAKEALL b/MAKEALL
index 3c216d5..9616506 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -686,7 +686,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 0372a2e..6bbe86f 100644
--- a/Makefile
+++ b/Makefile
@@ -473,7 +473,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)),)
@@ -1092,11 +1092,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 v2 14/35] Makefile: move more stuff to top Makefile

2013-12-17 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

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

diff --git a/Makefile b/Makefile
index f29673a..99e0de5 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 v2 06/35] nand-spl: Use scripts/Makefile.build

2013-12-17 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

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 3c7f5c2..2bacdbf 100644
--- a/Makefile
+++ b/Makefile
@@ -544,7 +544,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)
 
 $(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 
b/nand_spl/board/freescale/mpc8315erdb/Makefile
index c49a6e0..7813823 100644
--- 

[U-Boot] [PATCH v2 15/35] Makefile: move some flags to spl/Makefile

2013-12-17 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 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 13dd616..798c9f3 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
@@ -164,6 +173,11 @@ endif
 $(obj)$(SPL_BIN).bin:  $(obj)$(SPL_BIN)
$(OBJCOPY) $(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 v2 03/35] tools: convert makefiles to kbuild style

2013-12-17 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 v2:
  - Rebase on v2014.01-rc2 tag

 Makefile  |  18 ++-
 config.mk |  28 +---
 rules.mk  |   5 -
 spl/Makefile  |   4 +-
 tools/.gitignore  |   2 +-
 tools/Makefile| 329 ++
 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, 154 insertions(+), 358 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 de36187..cd32ba3 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
@@ -348,8 +350,6 @@ ALL-y += $(obj)u-boot-nodtb-tegra.bin
 endif
 endif
 
-build := -f $(TOPDIR)/scripts/Makefile.build -C
-
 all:   $(ALL-y) $(SUBDIR_EXAMPLES-y)
 
 $(obj)u-boot.dtb:  checkdtc $(obj)u-boot
@@ -535,7 +535,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
@@ -688,7 +691,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.
@@ -719,14 +722,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:
@@ -771,7 +775,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
 
 #
 # Mac OS X / Darwin's C preprocessor is Apple specific.  It
@@ -93,13 +92,6 @@ ifeq ($(HOSTOS),cygwin)
 HOSTCFLAGS 

[U-Boot] [PATCH v2 0/35] Switch over to real Kbuild

2013-12-17 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.

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 simple.
  Just addi objects to obj-y like this:
  obj-$(CONFIG_FOO) += foo.o

   (b) We can describe directory descending nicely
  Add a directory name 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 some patches beforehand to use this series.
This series uses the followings as prerequisites:

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

[2] Makefile: fix the typo error for mrproper (posted by Bo Shen)
http://patchwork.ozlabs.org/patch/301493/

[3] nand_util.c: Use '%zd' for length in nand_unlock debug print (posted by Tom 
Rini)
http://patchwork.ozlabs.org/patch/301740/
This is not mandatory, but recommended.
It fixes some warnings, so you can get cleaner buildman log.

 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.

 Known Problems
 --

 - .*.su files at the top directory
  After build, you will notice .*.su files at the top directory.
   $ ls -a
   .  .20193.su CREDITS api disk  include   
scripts  u-boot-nand.bin  u-boot.srec
   .. .20198.su Licensesarchdoc   lib   
snapshot.commit  u-boot-pad.img
   .18993.su  .20203.su MAKEALL board   drivers   mkconfig  spl 
 u-boot.bin
   

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

2013-12-17 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 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 $(strip $1),\
+ $(LD) $(LDFLAGS) -r -o $@ $1,\
+ rm -f $@; 

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

2013-12-17 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 v2:
  - Newly added

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

diff --git a/Makefile b/Makefile
index fc31135..87e6596 100644
--- a/Makefile
+++ b/Makefile
@@ -393,6 +393,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
@@ -450,7 +461,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
@@ -930,7 +941,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)
@@ -941,19 +952,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)
 
 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
@@ -1195,7 +1243,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 v2 13/35] Makefile: refactor include path settings

2013-12-17 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 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 bf4f427..f29673a 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 6c2a29c..3c186ba 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -173,11 +173,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 v2 32/35] Makefile: refactor tools-all targets

2013-12-17 Thread Masahiro Yamada
 - Move easylogo, env, gdb tagets to tools/Makefile
 - Delete gdbtools target (same as gdb)

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

Changes in v2: None

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

diff --git a/Makefile b/Makefile
index 31b6ebe..4c0f71b 100644
--- a/Makefile
+++ b/Makefile
@@ -1067,15 +1067,10 @@ $(TIMESTAMP_FILE):
@LC_ALL=C date +'#define U_BOOT_TIME %T'  $@.tmp
@cmp -s $@ $@.tmp  rm -f $@.tmp || mv -f $@.tmp $@
 
-easylogo env gdb:
-   $(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)
+tools-all: $(VERSION_FILE) $(TIMESTAMP_FILE)
$(Q)$(MAKE) $(build)=tools HOST_TOOLS_ALL=y
 
 .PHONY : CHANGELOG
diff --git a/tools/Makefile b/tools/Makefile
index 143bbe0..1ff8c13 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -24,6 +24,10 @@ CONFIG_NETCONSOLE = y
 CONFIG_SHA1_CHECK_UB_IMG = y
 endif
 
+subdir-$(HOST_TOOLS_ALL) += easylogo
+subdir-$(HOST_TOOLS_ALL) += env
+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
@@ -178,7 +182,7 @@ 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)  $@
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 29/35] examples: move api/ and standalone/ to examples/Makefile

2013-12-17 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

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 0626b2a..f181c1a 100644
--- a/Makefile
+++ b/Makefile
@@ -595,11 +595,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 ca62e2a..6a5f1ff 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 v2 20/35] Kbuild: import more build scripts from Linux v3.12 tag

2013-12-17 Thread Masahiro Yamada
This commit imports build scripts from Linux Kernel v3.12
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 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 := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
+endif
+
+ifndef obj
+$(warning 

[U-Boot] [PATCH v2 34/35] Kbuild: support simultaneous board configuration and make all

2013-12-17 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 v2: None

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

diff --git a/Makefile b/Makefile
index 4e888e8..fc31135 100644
--- a/Makefile
+++ b/Makefile
@@ -429,8 +429,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 v2 12/35] Makefile: move more flags to the top Makefile

2013-12-17 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 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 68a9d13..bf4f427 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 v2 33/35] Kbuild: use scripts/Makefile.clean

2013-12-17 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 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 4c0f71b..4e888e8 100644
--- a/Makefile
+++ b/Makefile
@@ -1082,93 +1082,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.map u-boot.hex u-boot.img $(ALL-y) \
+u-boot.kwb u-boot.pbl u-boot.imx u-boot-with-spl.imx \
+u-boot-with-nand-spl.imx 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 System.map \
+u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
+
+# Directories  files removed with 'make mrproper'
+MRPROPER_DIRS  += include/config include/generated
+MRPROPER_FILES += .config .config.old \
+ tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
+ include/config.h 

[U-Boot] [PATCH v2 30/35] Kbuild: refactor Makefile and spl/Makefile more

2013-12-17 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 v2: None

 Makefile | 163 ++-
 spl/Makefile | 106 +++---
 2 files changed, 139 insertions(+), 130 deletions(-)

diff --git a/Makefile b/Makefile
index f181c1a..b1fc4ad 100644
--- a/Makefile
+++ b/Makefile
@@ -586,17 +586,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)
@@ -605,70 +595,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 : $(LIBS)
 
 # Add GCC lib
 ifdef USE_PRIVATE_LIBGCC
@@ -738,7 +734,7 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),)
 

[U-Boot] [PATCH v2 25/35] Kbuild: move include directives of board configuration files

2013-12-17 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 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 fd5294b..bf886f7 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 v2 23/35] Kbuild: move some lines to more suitable place

2013-12-17 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2: None

 Makefile | 57 +
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index 54fbe2a..56e0135 100644
--- a/Makefile
+++ b/Makefile
@@ -14,34 +14,6 @@ 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
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute make help
@@ -212,6 +184,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
-- 
1.8.3.2

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


[U-Boot] [PATCH v2 24/35] Kbuild: convert some make rules to Kbuild style

2013-12-17 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.

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

Changes in v2: None

 Makefile | 70 
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/Makefile b/Makefile
index 56e0135..49edab8 100644
--- a/Makefile
+++ b/Makefile
@@ -206,12 +206,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)
@@ -940,52 +934,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 $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
$(CC) -DDO_DEPS_ONLY \
$(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
@@ -994,6 +999,9 @@ $(CPUDIR)/$(SOC)/asm-offsets.s: include/config.h
touch $@; \
fi
 
+$(CPUDIR)/$(SOC)/asm-offsets.s:include/config.h
+   $(call cmd,soc_asm-offsets.s)
+
 #
 else   # !config.mk
 all u-boot.hex u-boot.srec u-boot.bin \
-- 
1.8.3.2

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


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

2013-12-17 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 v2: None

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

diff --git a/Makefile b/Makefile
index b1fc4ad..31b6ebe 100644
--- a/Makefile
+++ b/Makefile
@@ -1068,7 +1068,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 v2 28/35] Kbuild: change the top Makefile to more Kbuild-ish structure

2013-12-17 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 v2:
  - Rebase on v2014.01-rc2 tag

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

diff --git a/Makefile b/Makefile
index 6bbe86f..0626b2a 100644
--- a/Makefile
+++ b/Makefile
@@ -207,34 +207,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 ?=
@@ -381,15 +353,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 \
@@ -397,6 +360,7 @@ KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
   -fno-builtin -ffreestanding
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 
+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
@@ -429,65 +393,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 \
+tools 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.
-KBUILD_AFLAGS  += -g
+%:: FORCE
+   $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
 
-NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
-CHECKFLAGS += $(NOSTDINC_FLAGS)
+else
+ifeq ($(config-targets),1)
+# 

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

2013-12-17 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 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 v2 01/35] .gitignore: ingore files generated by Kbuild

2013-12-17 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 v2:
 - Do not double *~
 - Ignore more patterns

 .gitignore | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3b14c25..d18ebf3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,16 +5,19 @@
 #
 # Normal rules
 #
-
-*.rej
-*.orig
-*.a
+.*
 *.o
+*.o.*
+*.a
+*.s
 *.su
-*~
+*.mod.c
+*.i
+*.lst
+*.order
 *.swp
-*.patch
 *.bin
+*.patch
 *.cfgtmp
 *.dts.tmp
 
@@ -24,7 +27,6 @@
 #
 # Top-level generic files
 #
-
 /MLO*
 /SPL
 /System.map
@@ -49,6 +51,12 @@
 /u-boot.sb
 
 #
+# git files that we don't want to ignore even it they are dot-files
+#
+!.gitignore
+!.mailmap
+
+#
 # Generated files
 #
 
@@ -64,7 +72,6 @@
 /include/generated/
 /include/spl-autoconf.mk
 /include/tpl-autoconf.mk
-asm-offsets.s
 
 # stgit generated dirs
 patches-*
@@ -90,3 +97,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 v2 09/35] Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile

2013-12-17 Thread Masahiro Yamada
BFD_ROOT_DIR is used only in tools/gdb/Makefile

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

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] spi: Add support SH Quad SPI driver

2013-12-17 Thread Nobuhiro Iwamatsu
This patch adds a driver for Renesas SoC's Quad SPI bus.
This supports with 8 bits per transfer to use with SPI flash.

Signed-off-by: Kouei Abe kouei.abe...@renesas.com
Signed-off-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com
Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com
---

Changes for v7:
  - Add comments on each initialization steps and others.
  - Change to using clrbits_* and setbits_*.
  - Add documet file for test.
Changes for v6:
  - Update Makefile to new style.
Changes for v5: 
  - Add print abort when call ctrlc().
  - Move source code in spi_xfer() which should be processed by
spi_cs_activate(). 
  - Move source code in spi_xfer() which should be processed by
spi_cs_deactivate().
  - Remove sh_qspi_xfer, move to spi_xfer().
Changes for v4: 
  - Added tabs
  - Added comments
  - Added sh_qspi_init()
Changes for v3: 
  - Change Queued to Quad.
  - Remove path of file from file header.
  - Use read* and write* directly instead of sh_qspi_write* sh_qspi_read*. 
  - Change driver format.
Changes for v2: 
  - SH QSPI to SH QSPI (Queued SPI).
  - Remove magic number.


 doc/SPI/README.sh_qspi_test |  38 ++
 drivers/spi/Makefile|   1 +
 drivers/spi/sh_qspi.c   | 277 
 3 files changed, 316 insertions(+)
 create mode 100644 doc/SPI/README.sh_qspi_test
 create mode 100644 drivers/spi/sh_qspi.c

diff --git a/doc/SPI/README.sh_qspi_test b/doc/SPI/README.sh_qspi_test
new file mode 100644
index 000..8a33fec
--- /dev/null
+++ b/doc/SPI/README.sh_qspi_test
@@ -0,0 +1,38 @@
+-
+   Simple steps used to test the SH-QSPI at U-Boot
+-
+
+#0, Currently, SH-QSPI is used by lager board (Renesas ARM SoC R8A7790)
+and koelsch board (Renesas ARM SoC R8A7791). These boot from SPI ROM
+basically. Thus, U-Boot start, SH-QSPI will is operating normally.
+
+#1, build U-Boot and load u-boot.bin
+
+  = tftpboot 4000 u-boot.bin
+  sh_eth Waiting for PHY auto negotiation to complete.. done
+  sh_eth: 100Base/Half
+  Using sh_eth device
+  TFTP from server 192.168.169.1; our IP address is 192.168.169.79
+  Filename 'u-boot.bin'.
+  Load address: 0x4000
+  Loading: 
+2.5 MiB/s
+  done
+  Bytes transferred = 175364 (2ad04 hex)
+
+#2, Commands to erase/write u-boot to flash device
+
+  Note: This method is description of the lager board. If you want to use the
+  other boards, please change the value according to each environment.
+
+  =  sf probe 0
+  SF: Detected S25FL512S_256K with page size 512 Bytes, erase size 64 KiB, 
total 64 MiB
+  = sf erase 8 4
+  SF: 262144 bytes @ 0x8 Erased: OK
+  = sf write 4000 8 175364
+  SF: 1528676 bytes @ 0x8 Written: OK
+  =
+
+#3, Push reset button.
+
+  If you're written correctly and driver works properly, U-Boot starts.
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 27902fe..914e71f 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_OC_TINY_SPI) += oc_tiny_spi.o
 obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SH_SPI) += sh_spi.o
+obj-$(CONFIG_SH_QSPI) += sh_qspi.o
 obj-$(CONFIG_FSL_ESPI) += fsl_espi.o
 obj-$(CONFIG_FDT_SPI) += fdt_spi.o
 obj-$(CONFIG_TEGRA20_SFLASH) += tegra20_sflash.o
diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c
new file mode 100644
index 000..edeb42d
--- /dev/null
+++ b/drivers/spi/sh_qspi.c
@@ -0,0 +1,277 @@
+/*
+ * SH QSPI (Quad SPI) driver
+ *
+ * Copyright (C) 2013 Renesas Electronics Corporation
+ * Copyright (C) 2013 Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#include common.h
+#include malloc.h
+#include spi.h
+#include asm/io.h
+
+/* SH QSPI register bit masks REG_BIT */
+#define SPCR_MSTR  0x08
+#define SPCR_SPE   0x40
+#define SPSR_SPRFF 0x80
+#define SPSR_SPTEF 0x20
+#define SPPCR_IO3FV0x04
+#define SPPCR_IO2FV0x02
+#define SPPCR_IO1FV0x01
+#define SPBDCR_RXBC0   (1  0)
+#define SPCMD_SCKDEN   (1  15)
+#define SPCMD_SLNDEN   (1  14)
+#define SPCMD_SPNDEN   (1  13)
+#define SPCMD_SSLKP(1  7)
+#define SPCMD_BRDV0(1  2)
+#define SPCMD_INIT1SPCMD_SCKDEN | SPCMD_SLNDEN | \
+   SPCMD_SPNDEN | SPCMD_SSLKP | \
+   SPCMD_BRDV0
+#define SPCMD_INIT2SPCMD_SPNDEN | SPCMD_SSLKP | \
+   SPCMD_BRDV0
+#define SPBFCR_TXRST   (1  7)
+#define SPBFCR_RXRST   (1  6)
+
+/* SH QSPI register set */
+struct sh_qspi_regs {
+   unsigned char spcr;
+   unsigned char sslp;
+   unsigned char sppcr;
+   unsigned char spsr;
+   unsigned long spdr;
+   unsigned char spscr;
+   unsigned char spssr;
+   unsigned char spbr;
+   unsigned char spdcr;
+   unsigned char spckd;
+   unsigned char sslnd;
+   unsigned char spnd;
+  

Re: [U-Boot] [PATCH v2 0/35] Switch over to real Kbuild

2013-12-17 Thread Masahiro Yamada
Hello Simon


  Prerequisite
  
 
 You need to apply some patches beforehand to use this series.
 This series uses the followings as prerequisites:
 
 [1] sandbox: Use system headers first for sandbox's os.c in a different way
 http://patchwork.ozlabs.org/patch/294233/
 
 [2] Makefile: fix the typo error for mrproper (posted by Bo Shen)
 http://patchwork.ozlabs.org/patch/301493/
 
 [3] nand_util.c: Use '%zd' for length in nand_unlock debug print (posted by 
 Tom Rini)
 http://patchwork.ozlabs.org/patch/301740/
 This is not mandatory, but recommended.
 It fixes some warnings, so you can get cleaner buildman log.


To make your life easier, I pushed my local branch to my Github space.

Please try this:
git clone git://github.com/masahir0y/u-boot-kbuild.git
cd u-boot-kbuild
git checktout kbuild_v2


kbuild_v2 branch is equivalent to:
v2014.01-rc2 tag + 3 prerequisites + this series.


Best Regards
Masahiro Yamada

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


[U-Boot] [PATCH 1/3 v2] sh: add support for sh7753evb board

2013-12-17 Thread Shimoda, Yoshihiro
The SH7753 EVB board has SH7753, 512MB DDR3-SDRAM, SPI ROM,
Gigabit Ethernet, and eMMC.

This patch support the following functions:
 - 512MB DDR3-SDRAM, SCIF4, SPI ROM, Gigabit Ethernet, eMMC

Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
---
 about v2:
  - The patch doesn't remove the sh7752evb source codes.

 arch/sh/include/asm/cpu_sh4.h   |2 +
 arch/sh/include/asm/cpu_sh7753.h|  197 +++
 board/renesas/sh7753evb/Makefile|7 +
 board/renesas/sh7753evb/lowlevel_init.S |  416 +++
 board/renesas/sh7753evb/sh7753evb.c |  326 
 board/renesas/sh7753evb/spi-boot.c  |  134 ++
 board/renesas/sh7753evb/u-boot.lds  |   81 ++
 boards.cfg  |1 +
 doc/README.sh7753evb|   67 +
 include/configs/sh7753evb.h |  137 ++
 10 files changed, 1368 insertions(+), 0 deletions(-)
 create mode 100644 arch/sh/include/asm/cpu_sh7753.h
 create mode 100644 board/renesas/sh7753evb/Makefile
 create mode 100644 board/renesas/sh7753evb/lowlevel_init.S
 create mode 100644 board/renesas/sh7753evb/sh7753evb.c
 create mode 100644 board/renesas/sh7753evb/spi-boot.c
 create mode 100644 board/renesas/sh7753evb/u-boot.lds
 create mode 100644 doc/README.sh7753evb
 create mode 100644 include/configs/sh7753evb.h

diff --git a/arch/sh/include/asm/cpu_sh4.h b/arch/sh/include/asm/cpu_sh4.h
index 9181d59..9f48e4f 100644
--- a/arch/sh/include/asm/cpu_sh4.h
+++ b/arch/sh/include/asm/cpu_sh4.h
@@ -37,6 +37,8 @@
 # include asm/cpu_sh7734.h
 #elif defined (CONFIG_CPU_SH7752)
 # include asm/cpu_sh7752.h
+#elif defined (CONFIG_CPU_SH7753)
+# include asm/cpu_sh7753.h
 #elif defined (CONFIG_CPU_SH7757)
 # include asm/cpu_sh7757.h
 #elif defined (CONFIG_CPU_SH7763)
diff --git a/arch/sh/include/asm/cpu_sh7753.h b/arch/sh/include/asm/cpu_sh7753.h
new file mode 100644
index 000..cd0e0bb
--- /dev/null
+++ b/arch/sh/include/asm/cpu_sh7753.h
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _ASM_CPU_SH7753_H_
+#define _ASM_CPU_SH7753_H_
+
+#define CCR0xFF1C
+#define WTCNT  0xFFCC
+#define CCR_CACHE_INIT 0x090b
+#define CACHE_OC_NUM_WAYS  1
+
+#ifndef __ASSEMBLY__   /* put C only stuff in this section */
+/* MMU */
+struct mmu_regs {
+   unsigned intreserved[4];
+   unsigned intmmucr;
+};
+#define MMU_BASE   ((struct mmu_regs *)0xff00)
+
+/* Watchdog */
+#define WTCSR0 0xffcc0002
+#define WRSTCSR_R  0xffcc0003
+#define WRSTCSR_W  0xffcc0002
+#define WTCSR_PREFIX   0xa500
+#define WRSTCSR_PREFIX 0x6900
+#define WRSTCSR_WOVF_PREFIX0x9600
+
+/* SCIF */
+#define SCIF0_BASE 0xfe4b  /* The real name is SCIF2 */
+#define SCIF1_BASE 0xfe4c  /* The real name is SCIF3 */
+#define SCIF2_BASE 0xfe4d  /* The real name is SCIF4 */
+
+/* TMU0 */
+#define TMU_BASE0xFE43
+
+/* ETHER, GETHER MAC address */
+struct ether_mac_regs {
+   unsigned intreserved[114];
+   unsigned intmahr;
+   unsigned intreserved2;
+   unsigned intmalr;
+};
+#define GETHER0_MAC_BASE   ((struct ether_mac_regs *)0xfee0400)
+#define GETHER1_MAC_BASE   ((struct ether_mac_regs *)0xfee0c00)
+#define ETHER0_MAC_BASE((struct ether_mac_regs *)0xfef)
+#define ETHER1_MAC_BASE((struct ether_mac_regs *)0xfef0800)
+
+/* GETHER */
+struct gether_control_regs {
+   unsigned intgbecont;
+};
+#define GETHER_CONTROL_BASE((struct gether_control_regs *)0xffc10100)
+#define GBECONT_RMII1  0x0002
+#define GBECONT_RMII0  0x0001
+
+/* SerMux */
+struct sermux_regs {
+   unsigned char   smr0;
+   unsigned char   smr1;
+   unsigned char   smr2;
+   unsigned char   smr3;
+   unsigned char   smr4;
+   unsigned char   smr5;
+};
+#define SERMUX_BASE((struct sermux_regs *)0xfe47)
+
+
+/* USB0/1 */
+struct usb_common_regs {
+   unsigned short  reserved[129];
+   unsigned short  suspmode;
+};
+#define USB0_COMMON_BASE   ((struct usb_common_regs *)0xfe45)
+#define USB1_COMMON_BASE   ((struct usb_common_regs *)0xfe4f)
+
+struct usb0_phy_regs {
+   unsigned short  reset;
+   unsigned short  reserved[4];
+   unsigned short  portsel;
+};
+#define USB0_PHY_BASE  ((struct usb0_phy_regs *)0xfe5f)
+
+struct usb1_port_regs {
+   unsigned intport1sel;
+   unsigned intreserved;
+   unsigned intusb1intsts;
+};
+#define USB1_PORT_BASE ((struct usb1_port_regs *)0xfe4f2000)
+
+struct usb1_alignment_regs {
+   unsigned intehcidatac;  /* 0xfe4fe018 */
+   unsigned intreserved[63];
+   unsigned intohcidatac;
+};
+#define USB1_ALIGNMENT_BASE((struct usb1_alignment_regs 

[U-Boot] [PATCH 3/3 v2] serial_sh: add support for SH7753

2013-12-17 Thread Shimoda, Yoshihiro
Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
---
 about v2:
  - The patch doesn't remove the CONFIG_CPU_SH7752.

 drivers/serial/serial_sh.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/serial_sh.h b/drivers/serial/serial_sh.h
index 556b868..f5e9854 100644
--- a/drivers/serial/serial_sh.h
+++ b/drivers/serial/serial_sh.h
@@ -143,7 +143,9 @@ struct uart_port {
 #elif defined(CONFIG_H8S2678)
 # define SCSCR_INIT(port)  0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
 # define H8300_SCI_DR(ch) (*(volatile char *)(P1DR + h8300_sci_pins[ch].port))
-#elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
+#elif defined(CONFIG_CPU_SH7757) || \
+   defined(CONFIG_CPU_SH7752) || \
+   defined(CONFIG_CPU_SH7753)
 # define SCSPTR0 0xfe4b0020
 # define SCSPTR1 0xfe4b0020
 # define SCSPTR2 0xfe4b0020
-- 
1.7.1
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/3 v2] net: sh-eth: add support for SH7753

2013-12-17 Thread Shimoda, Yoshihiro
SH7753 has two fast ethernet controllers and two gigabit ethernet
controllers. It is similar to SH7757.

Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
---
 about v2:
  - The patch doesn't remove the CONFIG_CPU_SH7752.

 drivers/net/sh_eth.h |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h
index 8aa7109..331c07c 100644
--- a/drivers/net/sh_eth.h
+++ b/drivers/net/sh_eth.h
@@ -287,7 +287,9 @@ static const u16 
sh_eth_offset_fast_sh4[SH_ETH_MAX_REGISTER_OFFSET] = {
 #if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734)
 #define SH_ETH_TYPE_GETHER
 #define BASE_IO_ADDR   0xfee0
-#elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
+#elif defined(CONFIG_CPU_SH7757) || \
+   defined(CONFIG_CPU_SH7752) || \
+   defined(CONFIG_CPU_SH7753)
 #if defined(CONFIG_SH_ETHER_USE_GETHER)
 #define SH_ETH_TYPE_GETHER
 #define BASE_IO_ADDR   0xfee0
@@ -356,7 +358,9 @@ enum DMAC_T_BIT {

 /* GECMR */
 enum GECMR_BIT {
-#if defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)
+#if defined(CONFIG_CPU_SH7757) || \
+   defined(CONFIG_CPU_SH7752) || \
+   defined(CONFIG_CPU_SH7753)
GECMR_1000B = 0x20, GECMR_100B = 0x01, GECMR_10B = 0x00,
 #else
GECMR_1000B = 0x01, GECMR_100B = 0x04, GECMR_10B = 0x00,
-- 
1.7.1

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


  1   2   >