Re: [U-Boot] [PATCH 1/9] exynos4:pinmux:fdt: decode peripheral id

2014-01-29 Thread Minkyu Kang
On 28/01/14 21:13, Piotr Wilczek wrote:
> Hi Jaehoon,
> 
> Thanks for review. Please comments below.
> 
>> -Original Message-
>>
>> Hi, Piotr.
>>
>> On 01/27/2014 11:15 PM, Piotr Wilczek wrote:
>>> This patch adds api to decode peripheral id based in interrupt
>> number.
>>>
>>> Signed-off-by: Piotr Wilczek 
>>> Signed-off-by: Kyungmin Park 
>>> CC: Minkyu Kang 
>>> ---
>>>  arch/arm/cpu/armv7/exynos/pinmux.c |   21 +
>>>  1 file changed, 21 insertions(+)
>>>
>>> diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c
>>> b/arch/arm/cpu/armv7/exynos/pinmux.c
>>> index 904177a..3201d53 100644
>>> --- a/arch/arm/cpu/armv7/exynos/pinmux.c
>>> +++ b/arch/arm/cpu/armv7/exynos/pinmux.c
>>> @@ -741,6 +741,25 @@ int exynos_pinmux_config(int peripheral, int
>>> flags)  }
>>>
>>>  #ifdef CONFIG_OF_CONTROL
>>> +
>>
>> Remove the white space.
> Ok.
> 
>>
>>> +static int exynos4_pinmux_decode_periph_id(const void *blob, int
>>> +node) {
>>> +   int err;
>>> +   u32 cell[3];
>>> +
>>> +   err = fdtdec_get_int_array(blob, node, "interrupts", cell,
>>> +   ARRAY_SIZE(cell));
>>> +   if (err)
>>> +   return PERIPH_ID_NONE;
>>> +
>>> +   /* check for invalid peripheral id */
>>> +   if ((PERIPH_ID_SDMMC4 > cell[1]) || (cell[1] < PERIPH_ID_UART0))
>>
>> What's condition checking? i didn't understand this.
>> PERIPH_ID_SDMMC > cell[1] or PERIPH_ID_UART0 > cell[1] is valid?
>>
> It supposed to check if cell[1] is within supported periph_id range and
> should be like this:
> If ((cell[1] >= PERIPH_ID_UART0) && (cell[1] < PERIPH_ID_COUNT))

I know that you refer to exynos5 stuffs.
I think this routine unnecessary.

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


[U-Boot] [PATCH 2/3] exynos: pinmux: remove unnecessary define

2014-01-29 Thread Minkyu Kang
The value of PERIPH_ID_COUNT was wrong, and unnecessary.

Signed-off-by: Minkyu Kang 
---
 arch/arm/cpu/armv7/exynos/clock.c |2 +-
 arch/arm/include/asm/arch-exynos/periph.h |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/clock.c 
b/arch/arm/cpu/armv7/exynos/clock.c
index 5bde9d1..6807ff3 100644
--- a/arch/arm/cpu/armv7/exynos/clock.c
+++ b/arch/arm/cpu/armv7/exynos/clock.c
@@ -26,7 +26,7 @@ struct clk_bit_info {
 };
 
 /* src_bit div_bit prediv_bit */
-static struct clk_bit_info clk_bit_info[PERIPH_ID_COUNT] = {
+static struct clk_bit_info clk_bit_info[] = {
{0, 0,  -1},
{4, 4,  -1},
{8, 8,  -1},
diff --git a/arch/arm/include/asm/arch-exynos/periph.h 
b/arch/arm/include/asm/arch-exynos/periph.h
index 6d77d80..5c1c3d4 100644
--- a/arch/arm/include/asm/arch-exynos/periph.h
+++ b/arch/arm/include/asm/arch-exynos/periph.h
@@ -55,7 +55,6 @@ enum periph_id {
PERIPH_ID_PWM4,
PERIPH_ID_I2C10 = 203,
 
-   PERIPH_ID_COUNT,
PERIPH_ID_NONE = -1,
 };
 
-- 
1.7.9.5
-- 
Thanks,
Minkyu Kang.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/3] exynos: pinmux: sort the list of peripherals

2014-01-29 Thread Minkyu Kang
Signed-off-by: Minkyu Kang 
---
 arch/arm/include/asm/arch-exynos/periph.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-exynos/periph.h 
b/arch/arm/include/asm/arch-exynos/periph.h
index 30c7f18..6d77d80 100644
--- a/arch/arm/include/asm/arch-exynos/periph.h
+++ b/arch/arm/include/asm/arch-exynos/periph.h
@@ -36,7 +36,6 @@ enum periph_id {
PERIPH_ID_SDMMC3,
PERIPH_ID_I2C8 = 87,
PERIPH_ID_I2C9,
-   PERIPH_ID_I2C10 = 203,
PERIPH_ID_I2S0 = 98,
PERIPH_ID_I2S1 = 99,
 
@@ -54,6 +53,7 @@ enum periph_id {
PERIPH_ID_PWM2,
PERIPH_ID_PWM3,
PERIPH_ID_PWM4,
+   PERIPH_ID_I2C10 = 203,
 
PERIPH_ID_COUNT,
PERIPH_ID_NONE = -1,
-- 
1.7.9.5
-- 
Thanks,
Minkyu Kang.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] exynos: pinmux: remove unnecessary routine

2014-01-29 Thread Minkyu Kang
Because of the list of peripherals is not sequential,
such a routine does not check for valid correctly.
Error check will be done when call the exynos_pinmux_config function.

Signed-off-by: Minkyu Kang 
---
 arch/arm/cpu/armv7/exynos/pinmux.c |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
b/arch/arm/cpu/armv7/exynos/pinmux.c
index 904177a..645c497 100644
--- a/arch/arm/cpu/armv7/exynos/pinmux.c
+++ b/arch/arm/cpu/armv7/exynos/pinmux.c
@@ -751,12 +751,7 @@ static int exynos5_pinmux_decode_periph_id(const void 
*blob, int node)
if (err)
return PERIPH_ID_NONE;
 
-   /* check for invalid peripheral id */
-   if ((PERIPH_ID_SDMMC4 > cell[1]) || (cell[1] < PERIPH_ID_UART0))
-   return cell[1];
-
-   debug(" invalid peripheral id\n");
-   return PERIPH_ID_NONE;
+   return cell[1];
 }
 
 int pinmux_decode_periph_id(const void *blob, int node)
-- 
1.7.9.5
-- 
Thanks,
Minkyu Kang.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] net/bootp: add CONFIG_BOOTP_BOOTFILE

2014-01-29 Thread Christian Gmeiner
2014-01-15 Wolfgang Denk :
> Dear Christian Gmeiner,
>
> In message <1389688171-31688-1-git-send-email-christian.gmei...@gmail.com> 
> you wrote:
>> In some cases the TFTP server provides a bootfile name, which
>> does not expects our requirements. Make it possible to
>> not store the TFTP provided bootfile in the environment.
>
> There is no need to change the code for that.  If you don't like the
> settings provided by your BOOTP (or rather DHCP?) server, then just
> don't use them.  Otherwise we would have to add new options for all
> data fields the DHCP server could send, and this would grow into a
> terrible mess.
>
> In your case, just do the following:
>
> => setenv autostart no
> => dhcp
> => tftp $addr $your_file_name
>
> It is much more efficient to handle such special cases by scripting
> than adding specialized code for each and every corner case.
>

I finally found time to incorporate your feedback and everything works as
expected.

thanks for your hint
--
Christian Gmeiner, MSc
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ventana: Add Gateworks Ventana family support

2014-01-29 Thread Stefano Babic
Hi Tim,

On 29/01/2014 02:26, Tim Harvey wrote:

> 
> I should not have used the word 'header'.
> 
> I _am_ talking about the Image Vector Table (IVT) and Device
> Configuration Data (DCD) data structures that the IMX6 BOOT ROM needs
> to boot and which are present in u-boot.imx.

Right.

>  The kobs-ng (at least
> for IMX6) needs u-boot.imx because it contains these structures built
> from imximage and it must flash them onto the boot media.

ok, got it. My suggestion is then only to headline that kons-ng uses a
imximage, that contains IVT and DCD.

> 
>>
>> As far as I know, kobs-ng is a flasher - a utility to install u-boot on
>> the target. It is not the only method to install the binary. I think you
>> should rework the text making the statements more clearer.
> 
> Can you re-read the README instructions?  Other than the bad link I
> feel they are very clear.  I think perhaps your thinking that I was in
> error specifying that kobs-ng needing u-boot.imx added to some
> confusion?

Yes, it had confused me. IMHO you could add that kobs-ng adds the FCB
structure that it is not (yet) provided by imximage.

>>
>> If as I think kobs-ng is only a flasher, it does not take part to the
>> build of U-Boot binaries. IMHO it should be not part of U-Boot sources,
>> but maybe there are some features that can be interesting.
>>
> 
> I was not referring to making the code a part of uboot sources but
> adding the functionality that it provides such that one could use
> uboot to update itself on an IMX NAND device.  I'm actually surprised
> nobody has done this before for IMX in general as its a bit
> inconvenient to boot to a linux based OS in order to run kobs-ng to
> flash the bootloader.
>  Regardless, this would be functionality added
> later.

It would be great. Of course, it will be great if we can flash NAND
exactly as we do for other SOCs. We will need to improve imximage to add
the FCB at the beginning of the image.

> 
> It appears the only other mainlined IMX6 bootloader to support NAND is
> the Titanium and there is no README for it at all.  If there were, I
> would expect it to say pretty much the same thing that my proposed
> Ventana README states.  There was a comment by Fabio on original
> titanium patch to include a README explaining how to flash and boot
> from NAND but it apparently didn't make it in:
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/158436/focus=158441

Good point. Stefan, how do you flash the titanium ? At the moment I do
not see any other way as using the kobs-ng. Or do you have some early
improvement for mkimage adding the FCB/DBBT data ?

> 
> No - the only communication channel to the GSC is the i2c bus.  The
> only way it has to respond is to ACK or fail to ACK (aka NAK) within
> the i2c bit time (aka NAK).  The device does not and can not support
> i2c clock stretching.  The nature of GSC is such that the worst case
> failure when talking at 100kbps will be at most 2 times in a row (due
> to the latency of the timer tick) which is why I have a retry of 3.

ok - I think it will be cleaner if you split your patch and move gsc
code in a separate file, still in your board directory. I understand the
point - if the hardware does not provide any way to check if it is busy,
it is ok to retry when first access fails.

>> If it is at the moment dead code, please remove. Dead code that passes a
>> review will only confuse people.
> 
> once I realized I could #define CONFIG_DISPLAY_BOARDINFO_LATE to make
> checkconfig() run after relocation I no longer needed to have EEPROM
> read prior to relocation and that removed the need for this structure
> to be in the data segement.  I still have the structure so that eeprom
> can be read just once (as its used in several places) but it no longer
> needs to be in the data segment so the attribute will be removed in
> the next patch version.

Fine.

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


[U-Boot] arm post tests in uboot

2014-01-29 Thread shobin b
Hi,

I am doing post for arm in uboot-toradex(in iris based colibri t20 board).When
i enabled post in my board file(colibri_t20.h) it showing following errors
after making uboot,

i=aapcs-linux -mno-thumb-interwork -march=armv5 -Werror -Wall
-Wstrict-prototypes -fno-stack-protector   -o display.o display.c -c
/home/shobin/toradex/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin/arm-linux-gnueabihf-ld
 -r -o libtegra2.o  board.o pinmux.o sys_info.o display.o
make[1]: Leaving directory
`/home/shobin/iris/u-boot-toradex/arch/arm/cpu/armv7/tegra2'
make -C arch/arm/lib/
make[1]: Entering directory `/home/shobin/iris/u-boot-toradex/arch/arm/lib'
In file included from board.c:56:0:
/home/shobin/iris/u-boot-toradex/include/post.h:75:2: error: #error
"_POST_WORD_ADDR currently not implemented for this platform!"
make[1]: Leaving directory `/home/shobin/iris/u-boot-toradex/arch/arm/lib'
make[1]: Entering directory `/home/shobin/iris/u-boot-toradex/arch/arm/lib'
/home/shobin/toradex/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin/arm-linux-gnueabihf-gcc
 -g  -O2   -fno-common -ffixed-r8 -msoft-float  -D__KERNEL__
-DCONFIG_SYS_TEXT_BASE=0x00108000
-I/home/shobin/iris/u-boot-toradex/include -fno-builtin -ffreestanding
-nostdinc -isystem
/home/shobin/toradex/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/include
-pipe  -DCONFIG_ARM -D__ARM__ -marm  -mabi=aapcs-linux -mno-thumb-interwork
-march=armv5 -Werror -Wall -Wstrict-prototypes -fno-stack-protector
-march=armv4t  -o board.o board.c -c
In file included from board.c:56:0:
/home/shobin/iris/u-boot-toradex/include/post.h:75:2: error: #error
"_POST_WORD_ADDR currently not implemented for this platform!"
/home/shobin/iris/u-boot-toradex/include/post.h: In function
'post_word_load':
/home/shobin/iris/u-boot-toradex/include/post.h:81:1: error:
'_POST_WORD_ADDR' undeclared (first use in this function)
/home/shobin/iris/u-boot-toradex/include/post.h:81:1: note: each undeclared
identifier is reported only once for each function it appears in
/home/shobin/iris/u-boot-toradex/include/post.h: In function
'post_word_store':
/home/shobin/iris/u-boot-toradex/include/post.h:86:1: error:
'_POST_WORD_ADDR' undeclared (first use in this function)
make[1]: *** [board.o] Error 1
make[1]: Leaving directory `/home/shobin/iris/u-boot-toradex/arch/arm/lib'
make: *** [arch/arm/lib/libarm.o] Error 2


how to solve this problem.

please give me a solution.


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


Re: [U-Boot] [PATCH] ventana: Add Gateworks Ventana family support

2014-01-29 Thread Stefan Roese

Hi Stefano,

On 29.01.2014 09:19, Stefano Babic wrote:

It appears the only other mainlined IMX6 bootloader to support NAND is
the Titanium and there is no README for it at all.  If there were, I
would expect it to say pretty much the same thing that my proposed
Ventana README states.  There was a comment by Fabio on original
titanium patch to include a README explaining how to flash and boot
from NAND but it apparently didn't make it in:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/158436/focus=158441


Good point. Stefan, how do you flash the titanium ? At the moment I do
not see any other way as using the kobs-ng. Or do you have some early
improvement for mkimage adding the FCB/DBBT data ?


No. As already mentioned in my previous mail, I also used kobs-ng via 
Linux to flash the NAND booting image.


Thanks,
Stefan

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


Re: [U-Boot] [PATCH 1/9] arc: add architecture header files

2014-01-29 Thread Alexey Brodkin
Hello Heiko,

On Wed, 2014-01-29 at 06:44 +0100, Heiko Schocher wrote:
> Hello Alexey,
> 
> Thanks for your patches, more or less just nitpicking comments ...

Thanks for prompt review.

> Am 29.01.2014 00:09, schrieb Alexey Brodkin:
> > Signed-off-by: Alexey Brodkin
> 
> No commit message, please add one. (Are this files from the Linux
> kernel? If so please add a comment in the commit message + add a
> hint which linux commit you used, thanks!)

I thought from commit subject it's already clear what's presented in
each particular patch so I left commit messages empty.
Frankly I'm not sure still what info may I put in commit messages except
mention of headers borrowed from Linux - or this is exactly what is
needed?

Agree I forgot to mention which header files came from Linux kernel.
Will add mentions.


> > diff --git a/arch/arc/include/asm/arch-arc700/hardware.h 
> > b/arch/arc/include/asm/arch-arc700/hardware.h
> > new file mode 100644
> > index 000..e69de29
> 
> Empty file ?

Right, it looks weird, but I had to add this empty file just because of
"designware_i2c" driver which refers to "asm/arch/hardware.h".

http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/i2c/designware_i2c.c;h=9ed929521a8944dc870fc2eff546507632b6e86a;hb=HEAD

And to remove "asm/arch/hardware.h" I would need to modify
"arch/hardware.h" and "include/configs/..." files for platform/boards I
don't own.

Basically this is just a work-around that allows me to use
"designware_i2c" driver as it is.

There was a similar dependency ("asm/arch/clk.h") in "dw_mmc" but in
that case it was possible to just remove it - what I did -
http://git.denx.de/?p=u-boot.git;a=commit;h=ca6d4d0f8f0fb8ae09a7ba271177367bdfdf3136

So if you insist on removal of this file we would need to fix
"designware_i2c" first.

Please let me know what do you think about this item.

> > diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
> > new file mode 100644
> > index 000..87b0a60
...
> > +
> > +#ifndef __ASSEMBLY__
> > +
> > +/*
> > + **
> 
> Bad comment style
> 
> > + *  Inline ASM macros to read/write AUX Regs
> > + *  Essentially invocation of lr/sr insns from "C"
> > + */
> > +
> > +#if 1
> > +
> > +#define read_aux_reg(reg)  __builtin_arc_lr(reg)
> > +
> > +/* gcc builtin sr needs reg param to be long immediate */
> > +#define write_aux_reg(reg_immed, val)  \
> > +   __builtin_arc_sr((unsigned int)val, reg_immed)
> > +
> > +#else
> 
> Please remove dead code ...
> 
> > +
> > +#define read_aux_reg(reg)  \
...
> > +   bogus_undefined();  \
> > +   }   \
> > +}
> 
> Why do you use defines here instead of real functions?
> 
> > +
> > +#define WRITE_BCR(reg, into)   \
> > +{  \
> > +   unsigned int tmp;   \
> > +   if (sizeof(tmp) == sizeof(into)) {  \
> > +   tmp = (*(unsigned int *)(into));\
> > +   write_aux_reg(reg, tmp);\
> > +   } else  {   \
> > +   extern void bogus_undefined(void);  \
> > +   bogus_undefined();  \
> > +   }   \
> > +}
> 
> and here?

Ok, so this header is borrowed from Linux sources. That's why I didn't
do any modifications and took it as it is on kernel.org.

> > diff --git a/arch/arc/include/asm/processor.h 
> > b/arch/arc/include/asm/processor.h
> > new file mode 100644
> > index 000..e69de29
> 
> Hups, one more empty file ...

I thought it was required by some common file. Double-checked and now
see that it could be safely removed.

> > diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
> > new file mode 100644
> > index 000..3b2df87
> > --- /dev/null
> > +++ b/arch/arc/include/asm/ptrace.h
> > @@ -0,0 +1,101 @@
> > +/*
> > + * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights 
> > reserved.
> > + *
> > + * SPDX-License-Identifier:GPL-2.0+
> > + */
> > +
> > +#ifndef __ASM_ARC_PTRACE_H
> > +#define __ASM_ARC_PTRACE_H
> > +
> > +#ifndef __ASSEMBLY__
> > +
> > +/* THE pt_regs: Defines how regs are saved during entry into kernel */
> 
> Is the "THE" a shortcut?
> 

Another copy from Linux sources - thus taken as it is.

> > diff --git a/arch/arc/include/asm/string.h b/arch/arc/include/asm/string.h
> > new file mode 100644
> > index 000..e69de29
> 
> empty file

Somehow I missed a fact that ARC already has optimized "string"
routines. Will add them in re-spin.

Will send a v2 series soon.

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


Re: [U-Boot] [PATCH 1/3] exynos: pinmux: sort the list of peripherals

2014-01-29 Thread Rajeshwari Birje
Hi All,

This looks fine.

Acked-by: Rajehswari Shinde 

On Wed, Jan 29, 2014 at 1:33 PM, Minkyu Kang  wrote:
>
> Signed-off-by: Minkyu Kang 
> ---
>  arch/arm/include/asm/arch-exynos/periph.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/arch-exynos/periph.h
> b/arch/arm/include/asm/arch-exynos/periph.h
> index 30c7f18..6d77d80 100644
> --- a/arch/arm/include/asm/arch-exynos/periph.h
> +++ b/arch/arm/include/asm/arch-exynos/periph.h
> @@ -36,7 +36,6 @@ enum periph_id {
> PERIPH_ID_SDMMC3,
> PERIPH_ID_I2C8 = 87,
> PERIPH_ID_I2C9,
> -   PERIPH_ID_I2C10 = 203,
> PERIPH_ID_I2S0 = 98,
> PERIPH_ID_I2S1 = 99,
>
> @@ -54,6 +53,7 @@ enum periph_id {
> PERIPH_ID_PWM2,
> PERIPH_ID_PWM3,
> PERIPH_ID_PWM4,
> +   PERIPH_ID_I2C10 = 203,
>
> PERIPH_ID_COUNT,
> PERIPH_ID_NONE = -1,
> --
> 1.7.9.5
> --
> Thanks,
> Minkyu Kang.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot




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


Re: [U-Boot] [uBoot 2/2] ARM: O5/dra7xx: Add SATA boot support

2014-01-29 Thread Roger Quadros
Hi Dan,

On 01/28/2014 10:01 PM, Dan Murphy wrote:
> Add the SATA boot support for OMAP5 and dra7xx.
> 
> Renamed the omap_sata_init to the common init_sata(int dev)
> for commonality in with sata stack.
> 
> Added the ROM boot device ID for SATA.
> 
> Signed-off-by: Dan Murphy 
> ---
>  arch/arm/cpu/armv7/omap-common/sata.c |3 ++-
>  arch/arm/include/asm/arch-omap5/spl.h |1 +
>  board/ti/dra7xx/evm.c |2 +-
>  board/ti/omap5_uevm/evm.c |2 +-
>  4 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/omap-common/sata.c 
> b/arch/arm/cpu/armv7/omap-common/sata.c
> index f5468c4..cad4fee 100644
> --- a/arch/arm/cpu/armv7/omap-common/sata.c
> +++ b/arch/arm/cpu/armv7/omap-common/sata.c
> @@ -12,6 +12,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include "pipe3-phy.h"
>  
> @@ -31,7 +32,7 @@ struct omap_pipe3 sata_phy = {
>   .dpll_map = dpll_map_sata,
>  };
>  
> -int omap_sata_init(void)
> +int init_sata(int dev)
>  {
>   int ret;
>   u32 val;
> diff --git a/arch/arm/include/asm/arch-omap5/spl.h 
> b/arch/arm/include/asm/arch-omap5/spl.h
> index 2d5a62e..4a279cf 100644
> --- a/arch/arm/include/asm/arch-omap5/spl.h
> +++ b/arch/arm/include/asm/arch-omap5/spl.h
> @@ -15,6 +15,7 @@
>  #define BOOT_DEVICE_MMC15
>  #define BOOT_DEVICE_MMC26
>  #define BOOT_DEVICE_MMC2_2   7
> +#define BOOT_DEVICE_SATA 9
>  #define BOOT_DEVICE_SPI  10
>  #define BOOT_DEVICE_UART 0x43
>  
> diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
> index 1b60b8f..38d656c 100644
> --- a/board/ti/dra7xx/evm.c
> +++ b/board/ti/dra7xx/evm.c
> @@ -80,7 +80,7 @@ int board_init(void)
>  
>  int board_late_init(void)
>  {
> - omap_sata_init();
> + init_sata(0);
>   return 0;
>  }
>  
> diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
> index af854da..abf7fe3 100644
> --- a/board/ti/omap5_uevm/evm.c
> +++ b/board/ti/omap5_uevm/evm.c
> @@ -70,7 +70,7 @@ int board_init(void)
>  
>  int board_late_init(void)
>  {
> - omap_sata_init();
> + init_sata(0);
>   return 0;
>  }
>  
> 
Still need to get rid of omap_sata_init() from 
arch/arm/include/asm/arch-omap5/sata.h

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


Re: [U-Boot] [PATCH 1/9] arc: add architecture header files

2014-01-29 Thread Heiko Schocher

Hello Alexey,

Am 29.01.2014 09:57, schrieb Alexey Brodkin:

Hello Heiko,

On Wed, 2014-01-29 at 06:44 +0100, Heiko Schocher wrote:

Hello Alexey,

Thanks for your patches, more or less just nitpicking comments ...


Thanks for prompt review.


Am 29.01.2014 00:09, schrieb Alexey Brodkin:

Signed-off-by: Alexey Brodkin


No commit message, please add one. (Are this files from the Linux
kernel? If so please add a comment in the commit message + add a
hint which linux commit you used, thanks!)


I thought from commit subject it's already clear what's presented in
each particular patch so I left commit messages empty.
Frankly I'm not sure still what info may I put in commit messages except
mention of headers borrowed from Linux - or this is exactly what is
needed?


Maybe this site helps you:

http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign


Agree I forgot to mention which header files came from Linux kernel.
Will add mentions.



diff --git a/arch/arc/include/asm/arch-arc700/hardware.h 
b/arch/arc/include/asm/arch-arc700/hardware.h
new file mode 100644
index 000..e69de29


Empty file ?


Right, it looks weird, but I had to add this empty file just because of
"designware_i2c" driver which refers to "asm/arch/hardware.h".

http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/i2c/designware_i2c.c;h=9ed929521a8944dc870fc2eff546507632b6e86a;hb=HEAD

And to remove "asm/arch/hardware.h" I would need to modify
"arch/hardware.h" and "include/configs/..." files for platform/boards I
don't own.

Basically this is just a work-around that allows me to use
"designware_i2c" driver as it is.

There was a similar dependency ("asm/arch/clk.h") in "dw_mmc" but in
that case it was possible to just remove it - what I did -
http://git.denx.de/?p=u-boot.git;a=commit;h=ca6d4d0f8f0fb8ae09a7ba271177367bdfdf3136

So if you insist on removal of this file we would need to fix
"designware_i2c" first.

Please let me know what do you think about this item.


Hmm.. at least you should an comment in this file, why it is necessary.


diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
new file mode 100644
index 000..87b0a60

...

+
+#ifndef __ASSEMBLY__
+
+/*
+ **


Bad comment style


+ *  Inline ASM macros to read/write AUX Regs
+ *  Essentially invocation of lr/sr insns from "C"
+ */
+
+#if 1
+
+#define read_aux_reg(reg)  __builtin_arc_lr(reg)
+
+/* gcc builtin sr needs reg param to be long immediate */
+#define write_aux_reg(reg_immed, val)  \
+   __builtin_arc_sr((unsigned int)val, reg_immed)
+
+#else


Please remove dead code ...


+
+#define read_aux_reg(reg)  \

...

+   bogus_undefined();  \
+   }   \
+}


Why do you use defines here instead of real functions?


+
+#define WRITE_BCR(reg, into)   \
+{  \
+   unsigned int tmp;   \
+   if (sizeof(tmp) == sizeof(into)) {  \
+   tmp = (*(unsigned int *)(into));\
+   write_aux_reg(reg, tmp);\
+   } else  {   \
+   extern void bogus_undefined(void);  \
+   bogus_undefined();  \
+   }   \
+}


and here?


Ok, so this header is borrowed from Linux sources. That's why I didn't
do any modifications and took it as it is on kernel.org.


Ah, ok, so this is ok I think.


diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
new file mode 100644
index 000..e69de29


Hups, one more empty file ...


I thought it was required by some common file. Double-checked and now
see that it could be safely removed.


Great!


diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
new file mode 100644
index 000..3b2df87
--- /dev/null
+++ b/arch/arc/include/asm/ptrace.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __ASM_ARC_PTRACE_H
+#define __ASM_ARC_PTRACE_H
+
+#ifndef __ASSEMBLY__
+
+/* THE pt_regs: Defines how regs are saved during entry into kernel */


Is the "THE" a shortcut?



Another copy from Linux sources - thus taken as it is.


diff --git a/arch/arc/include/asm/string.h b/arch/arc/include/asm/string.h
new file mode 100644
index 000..e69de29


empty file


Somehow I missed a fact that ARC already has optimized "string"
routines. Will add them in re-spin.

Will send a v2 series soon.


Ok, hope to find time for your other patches ...

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Ge

Re: [U-Boot] [PATCH 3/3] exynos: pinmux: remove unnecessary routine

2014-01-29 Thread Rajeshwari Birje
Hi Minkyu Knag,

On Wed, Jan 29, 2014 at 1:34 PM, Minkyu Kang  wrote:
> Because of the list of peripherals is not sequential,
> such a routine does not check for valid correctly.
> Error check will be done when call the exynos_pinmux_config function.
>
> Signed-off-by: Minkyu Kang 
> ---
>  arch/arm/cpu/armv7/exynos/pinmux.c |7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c 
> b/arch/arm/cpu/armv7/exynos/pinmux.c
> index 904177a..645c497 100644
> --- a/arch/arm/cpu/armv7/exynos/pinmux.c
> +++ b/arch/arm/cpu/armv7/exynos/pinmux.c
> @@ -751,12 +751,7 @@ static int exynos5_pinmux_decode_periph_id(const void 
> *blob, int node)
> if (err)
> return PERIPH_ID_NONE;
>
> -   /* check for invalid peripheral id */
> -   if ((PERIPH_ID_SDMMC4 > cell[1]) || (cell[1] < PERIPH_ID_UART0))
> -   return cell[1];

Cant we check if less than PERIPH_ID_COUNT, this way we can atleast
cut down some wrong values.
Or value has to range between PERIPH_ID_UART0 and PERIPH_ID_COUNT
-- 
Regards,
Rajeshwari Shinde
> -
> -   debug(" invalid peripheral id\n");
> -   return PERIPH_ID_NONE;
> +   return cell[1];
>  }
>
>  int pinmux_decode_periph_id(const void *blob, int node)
> --
> 1.7.9.5
> --
> Thanks,
> Minkyu Kang.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] exynos: pinmux: sort the list of peripherals

2014-01-29 Thread Rajeshwari Birje
Acked-by: Rajeshwari Shinde 

On Wed, Jan 29, 2014 at 2:27 PM, Rajeshwari Birje
 wrote:
> Hi All,
>
> This looks fine.
>
> Acked-by: Rajehswari Shinde 
>
> On Wed, Jan 29, 2014 at 1:33 PM, Minkyu Kang  wrote:
>>
>> Signed-off-by: Minkyu Kang 
>> ---
>>  arch/arm/include/asm/arch-exynos/periph.h |2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/include/asm/arch-exynos/periph.h
>> b/arch/arm/include/asm/arch-exynos/periph.h
>> index 30c7f18..6d77d80 100644
>> --- a/arch/arm/include/asm/arch-exynos/periph.h
>> +++ b/arch/arm/include/asm/arch-exynos/periph.h
>> @@ -36,7 +36,6 @@ enum periph_id {
>> PERIPH_ID_SDMMC3,
>> PERIPH_ID_I2C8 = 87,
>> PERIPH_ID_I2C9,
>> -   PERIPH_ID_I2C10 = 203,
>> PERIPH_ID_I2S0 = 98,
>> PERIPH_ID_I2S1 = 99,
>>
>> @@ -54,6 +53,7 @@ enum periph_id {
>> PERIPH_ID_PWM2,
>> PERIPH_ID_PWM3,
>> PERIPH_ID_PWM4,
>> +   PERIPH_ID_I2C10 = 203,
>>
>> PERIPH_ID_COUNT,
>> PERIPH_ID_NONE = -1,
>> --
>> 1.7.9.5
>> --
>> Thanks,
>> Minkyu Kang.
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>
>
>
>
> --
> Regards,
> Rajeshwari Shinde



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


Re: [U-Boot] [uBoot 1/2] common: spl: Add spl sata boot support

2014-01-29 Thread Roger Quadros
Hi Dan,

On 01/28/2014 10:01 PM, Dan Murphy wrote:
> Add spl_sata to read a fat partition from a bootable SATA
> drive.
> 
> Signed-off-by: Dan Murphy 
> ---
>  common/Makefile   |3 +++
>  common/cmd_scsi.c |2 ++
>  common/spl/Makefile   |1 +
>  common/spl/spl.c  |5 +
>  common/spl/spl_sata.c |   51 
> +
>  include/spl.h |3 +++
>  spl/Makefile  |1 +
>  7 files changed, 66 insertions(+)
>  create mode 100644 common/spl/spl_sata.c
> 
> diff --git a/common/Makefile b/common/Makefile
> index 4d99ecd..b0f5b62 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -201,6 +201,9 @@ ifdef CONFIG_SPL_USB_HOST_SUPPORT
>  obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
>  obj-$(CONFIG_USB_STORAGE) += usb_storage.o
>  endif
> +ifdef CONFIG_SPL_SATA_SUPPORT
> +obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o
> +endif
>  ifneq ($(CONFIG_SPL_NET_SUPPORT),y)
>  obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
>  obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
> index 7b97dc9..b3f7687 100644
> --- a/common/cmd_scsi.c
> +++ b/common/cmd_scsi.c
> @@ -168,7 +168,9 @@ removable:
>   scsi_curr_dev = -1;
>  
>   printf("Found %d device(s).\n", scsi_max_devs);
> +#ifndef CONFIG_SPL_BUILD
>   setenv_ulong("scsidevs", scsi_max_devs);
> +#endif
>  }
>  
>  int scsi_get_disk_count(void)
> diff --git a/common/spl/Makefile b/common/spl/Makefile
> index 65a1484f..64569c2 100644
> --- a/common/spl/Makefile
> +++ b/common/spl/Makefile
> @@ -18,4 +18,5 @@ obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
>  obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
>  obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
>  obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
> +obj-$(CONFIG_SPL_SATA_SUPPORT) += spl_sata.o
>  endif
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 0645cee..774fdad 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -210,6 +210,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   spl_usb_load_image();
>   break;
>  #endif
> +#ifdef CONFIG_SPL_SATA_SUPPORT
> + case BOOT_DEVICE_SATA:
> + spl_sata_load_image();
> + break;
> +#endif
>   default:
>   debug("SPL: Un-supported Boot Device\n");
>   hang();
> diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
> new file mode 100644
> index 000..88d6b06
> --- /dev/null
> +++ b/common/spl/spl_sata.c
> @@ -0,0 +1,51 @@
> +/*
> + * (C) Copyright 2013
> + * Texas Instruments, 
> + *
> + * Dan Murphy 
> + *
> + * SPDX-License-Identifier:  GPL-2.0+
> + *
> + * Derived work from spl_usb.c
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +void spl_sata_load_image(void)
> +{
> + int err;
> + block_dev_desc_t *stor_dev;
> +
> + err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
> + if (err) {
> +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> + printf("spl: sata init failed: err - %d\n", err);

Why the conditional print only if CONFIG_SPL_LIBCOMMON_SUPPORT.

> +#endif
> + hang();
> + } else {
> + /* try to recognize storage devices immediately */
> + stor_dev = scsi_get_dev(0);
> + }
> +
> + debug("boot mode - FAT\n");

Do you really need this debug message? If yes could it be more descriptive like 
printing function name
to point out where it comes from?

> +
> +#ifdef CONFIG_SPL_OS_BOOT
> + if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
> + 
> CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
> +#endif
> + err = spl_load_image_fat(stor_dev,

Do you need to tab space this to align with the above if statement?

> + CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
> + CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);

Just cross checking. If CONFIG_SPL_OS_BOOT is defined then you need to call
both spl_load_image_fat_os() as well as spl_load_image_fat ?

> + if (err) {
> + puts("Error loading sata device\n");
> + hang();
> + }
> +}
> diff --git a/include/spl.h b/include/spl.h
> index 5e24856..ee09fb6 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -64,6 +64,9 @@ void spl_net_load_image(const char *device);
>  /* USB SPL functions */
>  void spl_usb_load_image(void);
>  
> +/* SATA SPL functions */
> +void spl_sata_load_image(void);
> +
>  /* SPL FAT image functions */
>  int spl_load_image_fat(block_dev_desc_t *block_dev, int partition, const 
> char *filename);
>  int spl_load_image_fat_os(block_dev_desc_t *block_dev, int partition);
> diff --git a/spl/Makefile b/spl/Makefile
> index 4143e38..28fcfdd 100644
> --- a/spl/Makefile
> +++ b/spl/Makefile
> @@ -85,6 +85,7 @@ LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/
>  LIBS-$(CONFIG_SPL_WATCHDOG_SUPPORT) +

Re: [U-Boot] [PATCH 1/9] arc: add architecture header files

2014-01-29 Thread Alexey Brodkin
Hello Heiko,

On Wed, 2014-01-29 at 10:04 +0100, Heiko Schocher wrote:
> Maybe this site helps you:
> 
> http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
> 

Indeed I even went through this readme a while ago but didn't pay enough
attention to it on submission.

The question is - if only some files in "arch/arc/include" are copies
from Linux sources may I still have a cumulative patch with all arc
headers and just list borrowed files in commit message or I need to put
borrowed files in a separate patch?

> > Agree I forgot to mention which header files came from Linux kernel.
> > Will add mentions.
> >
> >
> >>> diff --git a/arch/arc/include/asm/arch-arc700/hardware.h 
> >>> b/arch/arc/include/asm/arch-arc700/hardware.h
> >>> new file mode 100644
> >>> index 000..e69de29
> >>
> >> Empty file ?
> >
> > Right, it looks weird, but I had to add this empty file just because of
> > "designware_i2c" driver which refers to "asm/arch/hardware.h".
> >
> > http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/i2c/designware_i2c.c;h=9ed929521a8944dc870fc2eff546507632b6e86a;hb=HEAD
> >
> > And to remove "asm/arch/hardware.h" I would need to modify
> > "arch/hardware.h" and "include/configs/..." files for platform/boards I
> > don't own.
> >
> > Basically this is just a work-around that allows me to use
> > "designware_i2c" driver as it is.
> >
> > There was a similar dependency ("asm/arch/clk.h") in "dw_mmc" but in
> > that case it was possible to just remove it - what I did -
> > http://git.denx.de/?p=u-boot.git;a=commit;h=ca6d4d0f8f0fb8ae09a7ba271177367bdfdf3136
> >
> > So if you insist on removal of this file we would need to fix
> > "designware_i2c" first.
> >
> > Please let me know what do you think about this item.
> 
> Hmm.. at least you should an comment in this file, why it is necessary.

Once again may I just mention it in commit message?
Otherwise because of this mention in file itself I would need to add
licensing (copyright) info in the file and then we have a file which
only needs to exist to satisfy pre-processor but with contents of about
10 lines (which doesn't have any technical purpose).

> Ok, hope to find time for your other patches ...
Much appreciated!

Thanks a lot,
Alexey
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: bcm2835: config.mk isn't needed

2014-01-29 Thread Andreas Färber
Hi,

Am 29.01.2014 06:42, schrieb Stephen Warren:
> The entries in config.mk were needed so that U-Boot could be built
> with an old version of the Raspberry Pi Foundation's toolchain. Without
> them, the build would error out with:
> 
> ...-ld: error: .../libgcc.a(_bswapsi2.o) uses VFP register arguments,
> u-boot does not
> 
> However, none of the 3 toolchains in the latest version of their
> tools.git, nor the Ubuntu/Linaro ARM compilers in at least Ubuntu Quantal
> or Saucy, need these options set in order to compile a working U-Boot.
> Hence, remove the options for simplicity.
> 
> Reported-by: Tom Rini 
> Signed-off-by: Stephen Warren 
> ---
>  arch/arm/cpu/arm1176/bcm2835/config.mk | 19 ---
>  1 file changed, 19 deletions(-)
>  delete mode 100644 arch/arm/cpu/arm1176/bcm2835/config.mk

No objection against the patch, but why was arch/arm/config.mk using
-msoft-float in the first place? It's been changed from hardcoded to
$(call cc-option ...)-wrapped [1], which may explain your experimental
results, but IIUC it will still prefer -msoft-float if the compiler
supports it [2] rather than if the SoC needs it, right? tegra20 for
instance does support the hard-float ABI, too.

Regards,
Andreas

[1]
http://git.denx.de/?p=u-boot.git;a=commit;h=0ae7653128c80a4f2920cbe9b124792c2fd9d9e0
[2]
http://git.denx.de/?p=u-boot.git;a=blob;f=config.mk;h=b824bb3469dd577909ad804d655f29d56f0b14cd;hb=HEAD#l103

> diff --git a/arch/arm/cpu/arm1176/bcm2835/config.mk 
> b/arch/arm/cpu/arm1176/bcm2835/config.mk
> deleted file mode 100644
> index b87ce24..000
> --- a/arch/arm/cpu/arm1176/bcm2835/config.mk
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -#
> -# (C) Copyright 2012 Stephen Warren
> -#
> -# See file CREDITS for list of people who contributed to this
> -# project.
> -#
> -# This program is free software; you can redistribute it and/or
> -# modify it under the terms of the GNU General Public License
> -# version 2 as published by the Free Software Foundation.
> -#
> -# This program is distributed in the hope that it will be useful, but
> -# WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -
> -# Don't attempt to override the target CPU/ABI options;
> -# the Raspberry Pi toolchain does the right thing by default.
> -PLATFORM_RELFLAGS := $(filter-out -msoft-float,$(PLATFORM_RELFLAGS))
> -PLATFORM_CPPFLAGS := $(filter-out -march=armv5t,$(PLATFORM_CPPFLAGS))

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] initial support for pengwyn board

2014-01-29 Thread Lothar Felten
Signed-off-by: Lothar Felten 
---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   16 ++
 board/silica/pengwyn/Makefile   |   13 ++
 board/silica/pengwyn/board.c|  216 +
 board/silica/pengwyn/board.h|   15 ++
 board/silica/pengwyn/mux.c  |  107 +++
 boards.cfg  |1 +
 include/configs/pengwyn.h   |  274 +++
 7 files changed, 642 insertions(+)
 create mode 100644 board/silica/pengwyn/Makefile
 create mode 100644 board/silica/pengwyn/board.c
 create mode 100644 board/silica/pengwyn/board.h
 create mode 100644 board/silica/pengwyn/mux.c
 create mode 100644 include/configs/pengwyn.h

diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index c1777df..60cb098 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -58,6 +58,22 @@
 #define MT41J128MJT125_PHY_FIFO_WE 0x100
 #define MT41J128MJT125_IOCTRL_VALUE0x18B
 
+/* Micron MT41K128M16JT-187E */
+#define MT41K128MJT187E_EMIF_READ_LATENCY  0x06
+#define MT41K128MJT187E_EMIF_TIM1  0x0888B3DB
+#define MT41K128MJT187E_EMIF_TIM2  0x36337FDA
+#define MT41K128MJT187E_EMIF_TIM3  0x501F830F
+#define MT41K128MJT187E_EMIF_SDCFG 0x61C04AB2
+#define MT41K128MJT187E_EMIF_SDREF 0x093B
+#define MT41K128MJT187E_ZQ_CFG 0x50074BE4
+#define MT41K128MJT187E_RATIO  0x40
+#define MT41K128MJT187E_INVERT_CLKOUT  0x1
+#define MT41K128MJT187E_RD_DQS 0x3B
+#define MT41K128MJT187E_WR_DQS 0x85
+#define MT41K128MJT187E_PHY_WR_DATA0xC1
+#define MT41K128MJT187E_PHY_FIFO_WE0x100
+#define MT41K128MJT187E_IOCTRL_VALUE   0x18B
+
 /* Micron MT41J64M16JT-125 */
 #define MT41J64MJT125_EMIF_SDCFG   0x61C04A32
 
diff --git a/board/silica/pengwyn/Makefile b/board/silica/pengwyn/Makefile
new file mode 100644
index 000..c8b4f9a
--- /dev/null
+++ b/board/silica/pengwyn/Makefile
@@ -0,0 +1,13 @@
+#
+# Makefile
+#
+# Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_NOR_BOOT),y)
+obj-y  := mux.o
+endif
+
+obj-y  += board.o
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
new file mode 100644
index 000..d5dbd3b
--- /dev/null
+++ b/board/silica/pengwyn/board.c
@@ -0,0 +1,216 @@
+/*
+ * board.c
+ *
+ * Copyright (C) 2013 Lothar Felten 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "board.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
+
+/* DDR3 RAM timings */
+static const struct ddr_data ddr3_data = {
+   .datardsratio0 = MT41K128MJT187E_RD_DQS,
+   .datawdsratio0 = MT41K128MJT187E_WR_DQS,
+   .datafwsratio0 = MT41K128MJT187E_PHY_FIFO_WE,
+   .datawrsratio0 = MT41K128MJT187E_PHY_WR_DATA,
+};
+
+static const struct cmd_control ddr3_cmd_ctrl_data = {
+   .cmd0csratio = MT41K128MJT187E_RATIO,
+   .cmd0iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+   .cmd1csratio = MT41K128MJT187E_RATIO,
+   .cmd1iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+   .cmd2csratio = MT41K128MJT187E_RATIO,
+   .cmd2iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+};
+
+static struct emif_regs ddr3_emif_reg_data = {
+   .sdram_config = MT41K128MJT187E_EMIF_SDCFG,
+   .ref_ctrl = MT41K128MJT187E_EMIF_SDREF,
+   .sdram_tim1 = MT41K128MJT187E_EMIF_TIM1,
+   .sdram_tim2 = MT41K128MJT187E_EMIF_TIM2,
+   .sdram_tim3 = MT41K128MJT187E_EMIF_TIM3,
+   .zq_config = MT41K128MJT187E_ZQ_CFG,
+   .emif_ddr_phy_ctlr_1 = MT41K128MJT187E_EMIF_READ_LATENCY |
+   PHY_EN_DYN_PWRDN,
+};
+
+const struct ctrl_ioregs ddr3_ioregs = {
+   .cm0ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .cm1ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .cm2ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .dt0ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .dt1ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+};
+
+#ifdef CONFIG_SPL_OS_BOOT
+int spl_start_uboot(void)
+{
+   /* break into full u-boot on 'c' */
+   return serial_tstc() && serial_getc() == 'c';
+}
+#endif
+
+#define OSC(V_OSCK/100)
+const struct dpll_params dpll_ddr_266 = {
+   266, OSC-1, 1, -1, -1, -1, -1};
+const struct dpll_params dpll_ddr_303 = {
+   303, OSC-1, 1, -1, -1, -1, -1};
+const struct dpll_params dpll_ddr_400 = {
+   400, OSC-1, 1, -1, -1, -1, -1};
+
+void am33xx_spl_board_init(void)
+{

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

2014-01-29 Thread Gerhard Sittig
On Tue, Jan 28, 2014 at 14:44 +0100, Gerhard Sittig wrote:
> 
> Tested-by: Gerhard Sittig 
> 
> [ ... ]
> 
> The most recent test setup was created from
> - U-Boot master e222b1f36fed "powerpc/mpc85xx:Increase binary
>   size for P, B & T series boards."
> - the "sandbox: Use system headers first for sandbox's os.c in a
>   different way" prerequisite patch
> - the v7 version of this Kbuild series

Tested the above source stack on Beagle (C4) and Wand (quad) as well.


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


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

2014-01-29 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 
---

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

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

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

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


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

2014-01-29 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 
---

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

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

diff --git a/Makefile b/Makefile
index 0c1eef3..e4045bc 100644
--- a/Makefile
+++ b/Makefile
@@ -102,9 +102,10 @@ OBJTREE:= $(if 
$(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
 SPLTREE:= $(OBJTREE)/spl
 TPLTREE:= $(OBJTREE)/tpl
 SRCTREE:= $(CURDIR)
+srctree:= $(SRCTREE)
 TOPDIR := $(SRCTREE)
 LNDIR  := $(OBJTREE)
-export TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
+export TOPDIR SRCTREE srctree OBJTREE SPLTREE TPLTREE
 
 MKCONFIG   := $(SRCTREE)/mkconfig
 export MKCONFIG
@@ -126,8 +127,6 @@ unexport CDPATH
 
 #
 
-build := -f $(TOPDIR)/scripts/Makefile.build -C
-
 # The "tools" are needed early, so put this first
 # Don't include stuff already done in $(LIBS)
 # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
@@ -198,6 +197,10 @@ HOSTCFLAGS  += $(call os_x_before, 10, 4, 
"-traditional-cpp")
 HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
 endif
 
+# We need some generic definitions (do not try to remake the file).
+$(srctree)/scripts/Kbuild.include: ;
+include $(srctree)/scripts/Kbuild.include
+
 # Make variables (CC, etc...)
 
 AS = $(CROSS_COMPILE)as
diff --git a/config.mk b/config.mk
index dfe81fa..ba42641 100644
--- a/config.mk
+++ b/config.mk
@@ -48,35 +48,6 @@ PLATFORM_CPPFLAGS =
 PLATFORM_LDFLAGS =
 
 #
-#
-# Option checker, gcc version (courtesy linux kernel) to ensure
-# only supported compiler options are used
-#
-CC_OPTIONS_CACHE_FILE := $(OBJTREE)/include/generated/cc_options.mk
-CC_TEST_OFILE := $(OBJTREE)/include/generated/cc_test_file.o
-
--include $(CC_OPTIONS_CACHE_FILE)
-
-cc-option-sys = $(shell mkdir -p $(dir $(CC_TEST_OFILE)); \
-   if $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o $(CC_TEST_OFILE) \
-   > /dev/null 2>&1; 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 example

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

2014-01-29 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 
---

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

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

diff --git a/Makefile b/Makefile
index 2e28fba..1ac6399 100644
--- a/Makefile
+++ b/Makefile
@@ -1094,7 +1094,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 v8 03/38] tools: convert makefiles to kbuild style

2014-01-29 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 
---

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

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

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

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

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

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

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

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

Signed-off-by: Masahiro Yamada 
---

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

Changes in v2: None

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

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

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


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

2014-01-29 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 
---

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

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

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

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

2014-01-29 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 
---

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

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

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

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

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


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

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

Signed-off-by: Masahiro Yamada 
---

Note1:
Samsung boards have tools under board/samsung//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 v8: None
Changes in v7: None
Changes in v6: None
Changes in v5:
  - Rebase on the current u-boot/master

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

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

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

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


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

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

We do not need XECHO any more.

And also change checkstack target like Linux Kernel.

Signed-off-by: Masahiro Yamada 
---

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

Changes in v3: None
Changes in v2: None

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

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

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

2014-01-29 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada 
---

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

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

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

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

2014-01-29 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 
---

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

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

diff --git a/Makefile b/Makefile
index e4045bc..3a97483 100644
--- a/Makefile
+++ b/Makefile
@@ -226,11 +226,46 @@ CHECK = sparse
 CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
 
+KBUILD_CPPFLAGS := -D__KERNEL__
+
+KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
+  -Wno-format-security \
+  -fno-builtin -ffreestanding
+KBUILD_AFLAGS   := -D__ASSEMBLY__
+
 export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
 export MAKE AWK
 export DTC CHECK CHECKFLAGS
 
+export KBUILD_CPPFLAGS
+export KBUILD_CFLAGS KBUILD_AFLAGS
+
+KBUILD_CFLAGS += -Os #-fomit-frame-pointer
+
+ifdef BUILD_TAG
+KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
+endif
+
+KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
+
+KBUILD_CFLAGS  += -g
+# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g
+# 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 -g
-# 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 v8 07/38] Makfile: move suffix rules to Makefile.build

2014-01-29 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 
---

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

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

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

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

2014-01-29 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 
---

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 v8: None
Changes in v7: None
Changes in v6: None
Changes in v5:
  - Remove "*.imx" and "*.map" files by pattern matching.
  - Remove u-boot.elf

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

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

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

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

2014-01-29 Thread Masahiro Yamada

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

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

 Kbuild without Kconfig
 --

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

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

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

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

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

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

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

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

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

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

 Prerequisite
 

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

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

I confirmed this series can apply on:
Commit 0876703cf + prerequisite[1].

 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=" like this
 $ mkdir build_dir
 $ make omap4_panda_config all O=build_dir CROSS_COMPILE=arm-linux-gnueabi-

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

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

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

 My Next Plan
 

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

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

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

 Note
 

 - I marked dirty parts with "FIX ME".

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

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

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

 Run Test
 

 - Tested for MPC5121 on an ifm AC14xx board,
 Beagle (C4) board and Wand (quad) board by Gerhard Sittig

 - Tested for Zynq ZC706 board by me

Run test report for your board is welcome!

Changes for v8:
  - Rebase on commit 0876703c.
  - Fix a typo in comment in 38/38

Changes 

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

2014-01-29 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada 
---

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

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

Changes in v3: None
Changes in v2: None

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

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

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


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

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

Signed-off-by: Masahiro Yamada 
---

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

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

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

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


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

2014-01-29 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 
---

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

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

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

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


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

2014-01-29 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 
---

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

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

diff --git a/Makefile b/Makefile
index 7af404a..1611957 100644
--- a/Makefile
+++ b/Makefile
@@ -890,9 +890,6 @@ tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend scripts_basic
 # Explicitly make _depend in subdirs containing multiple targets to prevent
 # parallel sub-makes creating .depend files simultaneously.
 depend dep:$(TIMESTAMP_FILE) $(VERSION_FILE) \
-   include/spl-autoconf.mk \
-   include/tpl-autoconf.mk \
-   include/autoconf.mk \
include/generated/generic-asm-offsets.h \
include/generated/asm-offsets.h
 
@@ -974,26 +971,6 @@ quiet_cmd_autoconf = GEN $@
 include/autoconf.mk: include/config.h
$(call cmd,autoconf)
 
-# Auto-generate the spl-autoconf.mk file (which is included by all makefiles 
for SPL)
-quiet_cmd_tpl-autoconf = GEN $@
-  cmd_tpl-autoconf = \
-   $(CPP) $(c_flags) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
-   -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp 
&& \
-   sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
-   rm $@.tmp
-
-include/tpl-autoconf.mk: include/config.h
-   $(call cmd,tpl-autoconf)
-
-quiet_cmd_spl-autoconf = GEN $@
-  cmd_spl-autoconf = \
-   $(CPP) $(c_flags) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM 
$(srctree)/include/common.h > $@.tmp && \
-   sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
-   rm $@.tmp
-
-include/spl-autoconf.mk: include/config.h
-   $(call cmd,spl-autoconf)
-
 quiet_cmd_offsets = GEN $@
   cmd_offsets = $(srctree)/tools/scripts/make-asm-offsets $< $@
 
diff --git a/spl/Makefile b/spl/Makefile
index 65fd42e..48eec65 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 v8 14/38] Makefile: move more stuff to top Makefile

2014-01-29 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada 
---

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

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

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

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


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

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

Signed-off-by: Masahiro Yamada 
---

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

Changes in v3: None
Changes in v2: None

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

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

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


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

2014-01-29 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 
---

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

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

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

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


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

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

Signed-off-by: Masahiro Yamada 
---

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

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

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

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

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


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

2014-01-29 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 
---

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

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

diff --git a/config.mk b/config.mk
index 1336ef8..5b886aa 100644
--- a/config.mk
+++ b/config.mk
@@ -13,21 +13,6 @@ PLATFORM_LDFLAGS =
 
 #
 
-# Load generated board configuration
-ifeq ($(CONFIG_TPL_BUILD),y)
-# Include TPL autoconf
-sinclude include/tpl-autoconf.mk
-else
-ifeq ($(CONFIG_SPL_BUILD),y)
-# Include SPL autoconf
-sinclude include/spl-autoconf.mk
-else
-# Include normal autoconf
-sinclude include/autoconf.mk
-endif
-endif
-sinclude $(OBJTREE)/include/config.mk
-
 # Some architecture config.mk files need to know what CPUDIR is set to,
 # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
 # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 921fbbf..f37957f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -42,6 +42,17 @@ subdir-ccflags-y :=
 # Read auto.conf if it exists, otherwise ignore
 -include include/config/auto.conf
 
+# Added for U-Boot: Load U-Boot configuration
+ifeq ($(CONFIG_TPL_BUILD),y)
+  -include include/tpl-autoconf.mk
+else
+  ifeq ($(CONFIG_SPL_BUILD),y)
+-include include/spl-autoconf.mk
+  else
+-include include/autoconf.mk
+  endif
+endif
+
 include scripts/Kbuild.include
 # Modified for U-Boot
 #  We must include config.mk after Kbuild.include:
diff --git a/spl/Makefile b/spl/Makefile
index e2728fd..65fd42e 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 v8 20/38] kbuild: import more build scripts from Linux v3.13 tag

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

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

Signed-off-by: Masahiro Yamada 
---

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

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

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

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

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

Before switching to Kbuild, we needed to set HOSTCC at the
command line like this:
make HOSTCC= env

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

Signed-off-by: Masahiro Yamada 
Tested-by: Gerhard Sittig 
---

Changes in v8:
  - Fix a typo in comment

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

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

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

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

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


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

2014-01-29 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 
---

Changes in v8:
  - Rebase on the current u-boot/master

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

 Makefile | 165 ++-
 spl/Makefile | 111 
 2 files changed, 140 insertions(+), 136 deletions(-)

diff --git a/Makefile b/Makefile
index 32642aa..2e28fba 100644
--- a/Makefile
+++ b/Makefile
@@ -584,17 +584,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)
@@ -603,70 +593,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))
-LIB

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

2014-01-29 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 _config u-boot

 They are handled one by one.

 - config targets
 _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 
---

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

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

 Makefile | 287 ---
 1 file changed, 166 insertions(+), 121 deletions(-)

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

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

2014-01-29 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada 
---

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

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

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

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
new file mode 100644
index 000..547e15d
--- /dev/null
+++ b/scripts/Kbuild.include
@@ -0,0 +1,278 @@
+
+# kbuild: Generic definitions
+
+# Convenient variables
+comma   := ,
+squote  := '
+empty   :=
+space   := $(empty) $(empty)
+
+###
+# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
+dot-target = $(dir $@).$(notdir $@)
+
+###
+# The temporary file to save gcc -MD generated dependencies must not
+# contain a comma
+depfile = $(subst $(comma),_,$(dot-target).d)
+
+###
+# filename of target with directory and extension stripped
+basetarget = $(basename $(notdir $@))
+
+###
+# filename of first prerequisite with directory and extension stripped
+baseprereq = $(basename $(notdir $<))
+
+###
+# Escape single quote for use in echo statements
+escsq = $(subst $(squote),'\$(squote)',$1)
+
+###
+# Easy method for doing a status message
+   kecho := :
+ quiet_kecho := echo
+silent_kecho := :
+kecho := $($(quiet)kecho)
+
+###
+# filechk is used to check if the content of a generated file is updated.
+# Sample usage:
+# define filechk_sample
+#  echo $KERNELRELEASE
+# endef
+# version.h : Makefile
+#  $(call filechk,sample)
+# The rule defined shall write to stdout the content of the new file.
+# The existing file will be compared with the new one.
+# - If no file exist it is created
+# - If the content differ the new file is used
+# - If they are equal no change, and no timestamp update
+# - stdin is piped in from the first prerequisite ($<) so one has
+#   to specify a valid file as first prerequisite (often the kbuild file)
+define filechk
+   $(Q)set -e; \
+   $(kecho) '  CHK $@';\
+   mkdir -p $(dir $@); \
+   $(filechk_$(1)) < $< > $@.tmp;  \
+   if [ -r $@ ] && cmp -s $@ $@.tmp; then  \
+   rm -f $@.tmp;   \
+   else\
+   $(kecho) '  UPD $@';\
+   mv -f $@.tmp $@;\
+   fi
+endef
+
+##
+# gcc support functions
+# See documentation in Documentation/kbuild/makefiles.txt
+
+# cc-cross-prefix
+# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
+# Return first prefix where a prefix$(CC) is found in PATH.
+# If no $(CC) found in PATH with listed prefixes return nothing
+cc-cross-prefix =  \
+   $(word 1, $(foreach c,$(1),   \
+   $(shell set -e;   \
+   if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; 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 2>&1;  \
+   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

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

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

Signed-off-by: Masahiro Yamada 
---

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

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

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

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


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

2014-01-29 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 
---

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

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

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

___
U-Boot mailing li

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

2014-01-29 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada 
---

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

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

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

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


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

2014-01-29 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 
---

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

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

diff --git a/arch/arm/cpu/armv7/tegra114/Makefile 
b/arch/arm/cpu/armv7/tegra114/Makefile
index 886b509..77e2319 100644
--- a/arch/arm/cpu/armv7/tegra114/Makefile
+++ b/arch/arm/cpu/armv7/tegra114/Makefile
@@ -17,4 +17,5 @@
 # along with this program.  If not, see .
 #
 
-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 .
 #
 
-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 v8 34/38] kbuild: support simultaneous board configuration and "make all"

2014-01-29 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 
---

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

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

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

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


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

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

Signed-off-by: Masahiro Yamada 
---

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

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

diff --git a/rules.mk b/rules.mk
deleted file mode 100644
index e4fd337..000
--- a/rules.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# (C) Copyright 2006-2013
-# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
-#
-# SPDX-License-Identifier: GPL-2.0+
-#
-#
-
-_depend:   $(obj)/.depend
-
-# Split the source files into two camps: those in the current directory, and
-# those somewhere else. For the first camp we want to support CPPFLAGS_
-# 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 

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

2014-01-29 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 
---

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

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

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

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


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

2014-01-29 Thread Masahiro Yamada
Signed-off-by: Masahiro Yamada 
---

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

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

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

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

2014-01-29 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 
---

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

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

diff --git a/Makefile b/Makefile
index 6ae16d0..21274be 100644
--- a/Makefile
+++ b/Makefile
@@ -392,6 +392,17 @@ scripts_basic:
 # To avoid any implicit rule to kick in, define an empty command.
 scripts/basic/%: scripts_basic ;
 
+PHONY += outputmakefile
+# outputmakefile generates a Makefile in the output directory, if using a
+# separate output directory. This allows convenient use of make in the
+# output directory.
+outputmakefile:
+ifneq ($(KBUILD_SRC),)
+   $(Q)ln -fsn $(srctree) source
+   $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
+   $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+endif
+
 # To make sure we do not include .config for any of the *config targets
 # catch them early, and hand them over to scripts/kconfig/Makefile
 # It is allowed to specify more targets when calling make, including
@@ -449,7 +460,7 @@ ifeq ($(config-targets),1)
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
 
-%_config::
+%_config:: outputmakefile
@$(MKCONFIG) -A $(@:_config=)
 
 else
@@ -951,7 +962,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)
@@ -962,19 +973,56 @@ $(filter-out tools, $(u-boot-dirs)): tools
 examples: $(filter-out examples, $(u-boot-dirs))
 
 
+# Things we need to do before we recursively start building the kernel
+# or the modules are listed in "prepare".
+# A multi level approach is used. prepareN is processed before prepareN-1.
+# archprepare is used in arch Makefiles and when processed asm symlink,
+# version.h and scripts_basic is processed / created.
+
+# Listed in dependency order
+PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
+
+# prepare3 is used to check if we are building in a separate output directory,
+# and if so do:
+# 1) Check that make has not been executed in the kernel src $(srctree)
+prepare3:
+ifneq ($(KBUILD_SRC),)
+   @$(kecho) '  Using $(srctree) as source for u-boot'
+   $(Q)if [ -f $(srctree)/include/config.mk ]; then \
+   echo >&2 "  $(srctree) is not clean, please run 'make 
mrproper'"; \
+   echo >&2 "  in the '$(srctree)' directory.";\
+   /bin/false; \
+   fi;
+endif
+
+# prepare2 creates a makefile if using a separate output directory
+prepare2: prepare3 outputmakefile
+
+prepare1: prepare2
+   @:
+
+archprepare: prepare1 scripts_basic
+
+prepare0: archprepare FORCE
+   @:
+
+# All the preparing..
+prepare: prepare0
+
+
 u-boot.lds: $(LDSCRIPT) depend
$(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< 
>$@
 
-nand_spl:  $(TIMESTAMP_FILE) $(VERSION_FILE) depend scripts_basic
+nand_spl:  $(TIMESTAMP_FILE) $(VERSION_FILE) depend prepare
$(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
 
 u-boot-nand.bin:   nand_spl u-boot.bin
cat nand_spl/u-boot-spl-16k.bin u-boot.bin > u-boot-nand.bin
 
-spl/u-boot-spl.bin: tools depend scripts_basic
+spl/u-boot-spl.bin: tools depend prepare 
$(MAKE) obj=spl -f $(srctree)/spl/Makefile all
 
-tpl/u-boot-tpl.bin: tools depend scripts_basic
+tpl/u-boot-tpl.bin: tools depend prepare
$(MAKE) obj=tpl -f $(srctree)/spl/Makefile all 
CONFIG_TPL_BUILD=y
 
 # Explicitly make _depend in subdirs containing multiple targets to prevent
@@ -1224,7 +1272,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


Re: [U-Boot] [PATCH v3] mx6: Enable L2 cache support

2014-01-29 Thread Stefano Babic
Hi Dirk,

On 28/01/2014 17:53, Dirk Behme wrote:

> 
> Just for better understanding: Do you want to keep this intentionally
> simple? Or is there any special reason why you don't set additional
> (performance) registers here? E.g. the L2 PREFETCH and POWER registers,
> and the tag and data latency settings? Like done in the kernel.

This is a good point ! If it is true that  L2 PREFETCH is turned on in
mainline kernel, but it was *explicitely* turned off by Jason in FSL
Kernel with the patch with subject ENGR00278489 (ARM PL310 errata: 7522719).

It seems to me that Fabio has already applied Jason's patch - maybe
should we check as in FSL kernel which i.MX6 is running (DL and Solo are
not affected). Jason, can you a little explain this topic ? Was the
patch sent to Shaw, too (set in CC) ?

Thanks,
Stefano


-- 
=
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] [uBoot 2/2] ARM: O5/dra7xx: Add SATA boot support

2014-01-29 Thread Dan Murphy
Roger

On 01/29/2014 03:03 AM, Roger Quadros wrote:
> Hi Dan,
>
> On 01/28/2014 10:01 PM, Dan Murphy wrote:
>> Add the SATA boot support for OMAP5 and dra7xx.
>>
>> Renamed the omap_sata_init to the common init_sata(int dev)
>> for commonality in with sata stack.
>>
>> Added the ROM boot device ID for SATA.
>>
>> Signed-off-by: Dan Murphy 
>> ---
>>  arch/arm/cpu/armv7/omap-common/sata.c |3 ++-
>>  arch/arm/include/asm/arch-omap5/spl.h |1 +
>>  board/ti/dra7xx/evm.c |2 +-
>>  board/ti/omap5_uevm/evm.c |2 +-
>>  4 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/omap-common/sata.c 
>> b/arch/arm/cpu/armv7/omap-common/sata.c
>> index f5468c4..cad4fee 100644
>> --- a/arch/arm/cpu/armv7/omap-common/sata.c
>> +++ b/arch/arm/cpu/armv7/omap-common/sata.c
>> @@ -12,6 +12,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include "pipe3-phy.h"
>>  
>> @@ -31,7 +32,7 @@ struct omap_pipe3 sata_phy = {
>>  .dpll_map = dpll_map_sata,
>>  };
>>  
>> -int omap_sata_init(void)
>> +int init_sata(int dev)
>>  {
>>  int ret;
>>  u32 val;
>> diff --git a/arch/arm/include/asm/arch-omap5/spl.h 
>> b/arch/arm/include/asm/arch-omap5/spl.h
>> index 2d5a62e..4a279cf 100644
>> --- a/arch/arm/include/asm/arch-omap5/spl.h
>> +++ b/arch/arm/include/asm/arch-omap5/spl.h
>> @@ -15,6 +15,7 @@
>>  #define BOOT_DEVICE_MMC15
>>  #define BOOT_DEVICE_MMC26
>>  #define BOOT_DEVICE_MMC2_2  7
>> +#define BOOT_DEVICE_SATA9
>>  #define BOOT_DEVICE_SPI 10
>>  #define BOOT_DEVICE_UART0x43
>>  
>> diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
>> index 1b60b8f..38d656c 100644
>> --- a/board/ti/dra7xx/evm.c
>> +++ b/board/ti/dra7xx/evm.c
>> @@ -80,7 +80,7 @@ int board_init(void)
>>  
>>  int board_late_init(void)
>>  {
>> -omap_sata_init();
>> +init_sata(0);
>>  return 0;
>>  }
>>  
>> diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
>> index af854da..abf7fe3 100644
>> --- a/board/ti/omap5_uevm/evm.c
>> +++ b/board/ti/omap5_uevm/evm.c
>> @@ -70,7 +70,7 @@ int board_init(void)
>>  
>>  int board_late_init(void)
>>  {
>> -omap_sata_init();
>> +init_sata(0);
>>  return 0;
>>  }
>>  
>>
> Still need to get rid of omap_sata_init() from 
> arch/arm/include/asm/arch-omap5/sata.h

Will do in v2

> cheers,
> -roger


-- 
--
Dan Murphy

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


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

2014-01-29 Thread Albert ARIBAUD
Hi Tom,

On Fri, 24 Jan 2014 15:20:25 -0500, Tom Rini  wrote:

> Hey,
> 
> The following changes since commit c71b4dd2da0dcddabd7c29e6c3dc8a495d4bd928:
> 
>   arm: koelsch: Add support QSPI device and enable boot from SPI flash 
> (2014-01-16 08:07:20 +0900)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-ti master
> 
> for you to fetch changes up to b1cde7e21f950e05d18c102976c3b7d232b65e13:
> 
>   am43xx_evm.h: Correct SPL max size (2014-01-24 11:41:17 -0500)

On it right now, sorry for the delay.

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


Re: [U-Boot] [uBoot 1/2] common: spl: Add spl sata boot support

2014-01-29 Thread Dan Murphy
Roger

On 01/29/2014 03:16 AM, Roger Quadros wrote:
> Hi Dan,
>
> On 01/28/2014 10:01 PM, Dan Murphy wrote:
>> Add spl_sata to read a fat partition from a bootable SATA
>> drive.
>>
>> Signed-off-by: Dan Murphy 
>> ---
>>  common/Makefile   |3 +++
>>  common/cmd_scsi.c |2 ++
>>  common/spl/Makefile   |1 +
>>  common/spl/spl.c  |5 +
>>  common/spl/spl_sata.c |   51 
>> +
>>  include/spl.h |3 +++
>>  spl/Makefile  |1 +
>>  7 files changed, 66 insertions(+)
>>  create mode 100644 common/spl/spl_sata.c
>>
>> diff --git a/common/Makefile b/common/Makefile
>> index 4d99ecd..b0f5b62 100644
>> --- a/common/Makefile
>> +++ b/common/Makefile
>> @@ -201,6 +201,9 @@ ifdef CONFIG_SPL_USB_HOST_SUPPORT
>>  obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
>>  obj-$(CONFIG_USB_STORAGE) += usb_storage.o
>>  endif
>> +ifdef CONFIG_SPL_SATA_SUPPORT
>> +obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o
>> +endif
>>  ifneq ($(CONFIG_SPL_NET_SUPPORT),y)
>>  obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
>>  obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
>> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
>> index 7b97dc9..b3f7687 100644
>> --- a/common/cmd_scsi.c
>> +++ b/common/cmd_scsi.c
>> @@ -168,7 +168,9 @@ removable:
>>  scsi_curr_dev = -1;
>>  
>>  printf("Found %d device(s).\n", scsi_max_devs);
>> +#ifndef CONFIG_SPL_BUILD
>>  setenv_ulong("scsidevs", scsi_max_devs);
>> +#endif
>>  }
>>  
>>  int scsi_get_disk_count(void)
>> diff --git a/common/spl/Makefile b/common/spl/Makefile
>> index 65a1484f..64569c2 100644
>> --- a/common/spl/Makefile
>> +++ b/common/spl/Makefile
>> @@ -18,4 +18,5 @@ obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
>>  obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
>>  obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
>>  obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
>> +obj-$(CONFIG_SPL_SATA_SUPPORT) += spl_sata.o
>>  endif
>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>> index 0645cee..774fdad 100644
>> --- a/common/spl/spl.c
>> +++ b/common/spl/spl.c
>> @@ -210,6 +210,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>  spl_usb_load_image();
>>  break;
>>  #endif
>> +#ifdef CONFIG_SPL_SATA_SUPPORT
>> +case BOOT_DEVICE_SATA:
>> +spl_sata_load_image();
>> +break;
>> +#endif
>>  default:
>>  debug("SPL: Un-supported Boot Device\n");
>>  hang();
>> diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
>> new file mode 100644
>> index 000..88d6b06
>> --- /dev/null
>> +++ b/common/spl/spl_sata.c
>> @@ -0,0 +1,51 @@
>> +/*
>> + * (C) Copyright 2013
>> + * Texas Instruments, 
>> + *
>> + * Dan Murphy 
>> + *
>> + * SPDX-License-Identifier: GPL-2.0+
>> + *
>> + * Derived work from spl_usb.c
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +void spl_sata_load_image(void)
>> +{
>> +int err;
>> +block_dev_desc_t *stor_dev;
>> +
>> +err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
>> +if (err) {
>> +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
>> +printf("spl: sata init failed: err - %d\n", err);
> Why the conditional print only if CONFIG_SPL_LIBCOMMON_SUPPORT.

As the file header indicates this is a copy/paste of the other SPL files.

>> +#endif
>> +hang();
>> +} else {
>> +/* try to recognize storage devices immediately */
>> +stor_dev = scsi_get_dev(0);
>> +}
>> +
>> +debug("boot mode - FAT\n");
> Do you really need this debug message? If yes could it be more descriptive 
> like printing function name
> to point out where it comes from?

We really don't need this since only FAT is supported here.  I can remove it in 
v2

>> +
>> +#ifdef CONFIG_SPL_OS_BOOT
>> +if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
>> +
>> CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
>> +#endif
>> +err = spl_load_image_fat(stor_dev,
> Do you need to tab space this to align with the above if statement?

Well that depends on if the ifdef is honored.  If the SPL_OS_BOOT is not 
defined then this statement is lined
up properly.  if it is defined then it is not.  Again this is the precedence 
for the other spl file (mmc and usb)

>
>> +CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
>> +CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
> Just cross checking. If CONFIG_SPL_OS_BOOT is defined then you need to call
> both spl_load_image_fat_os() as well as spl_load_image_fat ?

spl_load_image_fat is called within spl_load_image_fat_os.

spl_load_image_fat is only needed to be called if the other functions return a 
failure

>> +if (err) {
>> +puts("Error loading sata device\n");
>> +hang();
>> +}
>> +}
>> diff --git a/include/spl.h b/include/spl.h
>> index 5

Re: [U-Boot] [PATCH] initial support for pengwyn board

2014-01-29 Thread Wolfgang Denk
Dear Lothar Felten,

In message <1390992013-4277-1-git-send-email-lothar.fel...@gmail.com> you wrote:
> Signed-off-by: Lothar Felten 

First, you do not provide a commit message.  When adding support for a
new board, it makes sense to give some description what this boar dis,
who manufactures it, which peripherals of it are supported by his
port, etc.

Second, it appears this is actually version 2 of you patch.  But you
fail to mark this in the Subject, and there is no change log included.
Please see [1] for detailed instructions what is needed.

[1]
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

> +void am33xx_spl_board_init(void)
> +{
> + /* the pengwyn board uses the TPS650250 PMIC  without I2C */
> + /* interface and will output the following fixed voltages: */
> + /* DCDC1=3V3 (IO) DCDC2=1V5 (DDR) DCDC3=1V26 (Vmpu) */
> + /* VLDO1=1V8 (IO) VLDO2=1V8(IO) */
> + /* Vcore=1V1 is fixed, generated by TPS62231 */

Please use

/*
 * this style
 * for all your
 * multi-line
 * comments only
 */


> diff --git a/include/configs/pengwyn.h b/include/configs/pengwyn.h
> new file mode 100644
> index 000..7a41151
...
> +#define V_SCLK   (V_OSCK)
...
> +#define CONFIG_ENV_SIZE  (0x4000)

There is no need for braces around simple values.

> +/* SPL */
> +#define CONFIG_SPL_POWER_SUPPORT
> +#define CONFIG_SPL_YMODEM_SUPPORT
> +
> +
> +

A single blank line should be sufficient.



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Defaults are wonderful, just like fire.
  - Larry Wall in <1996mar6.004121.27...@netlabs.com>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [uBoot 1/2] common: spl: Add spl sata boot support

2014-01-29 Thread Roger Quadros
On 01/29/2014 03:07 PM, Dan Murphy wrote:
> Roger
> 
> On 01/29/2014 03:16 AM, Roger Quadros wrote:
>> Hi Dan,
>>
>> On 01/28/2014 10:01 PM, Dan Murphy wrote:
>>> Add spl_sata to read a fat partition from a bootable SATA
>>> drive.
>>>
>>> Signed-off-by: Dan Murphy 
>>> ---
>>>  common/Makefile   |3 +++
>>>  common/cmd_scsi.c |2 ++
>>>  common/spl/Makefile   |1 +
>>>  common/spl/spl.c  |5 +
>>>  common/spl/spl_sata.c |   51 
>>> +
>>>  include/spl.h |3 +++
>>>  spl/Makefile  |1 +
>>>  7 files changed, 66 insertions(+)
>>>  create mode 100644 common/spl/spl_sata.c
>>>
>>> diff --git a/common/Makefile b/common/Makefile
>>> index 4d99ecd..b0f5b62 100644
>>> --- a/common/Makefile
>>> +++ b/common/Makefile
>>> @@ -201,6 +201,9 @@ ifdef CONFIG_SPL_USB_HOST_SUPPORT
>>>  obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
>>>  obj-$(CONFIG_USB_STORAGE) += usb_storage.o
>>>  endif
>>> +ifdef CONFIG_SPL_SATA_SUPPORT
>>> +obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o
>>> +endif
>>>  ifneq ($(CONFIG_SPL_NET_SUPPORT),y)
>>>  obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
>>>  obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
>>> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
>>> index 7b97dc9..b3f7687 100644
>>> --- a/common/cmd_scsi.c
>>> +++ b/common/cmd_scsi.c
>>> @@ -168,7 +168,9 @@ removable:
>>> scsi_curr_dev = -1;
>>>  
>>> printf("Found %d device(s).\n", scsi_max_devs);
>>> +#ifndef CONFIG_SPL_BUILD
>>> setenv_ulong("scsidevs", scsi_max_devs);
>>> +#endif
>>>  }
>>>  
>>>  int scsi_get_disk_count(void)
>>> diff --git a/common/spl/Makefile b/common/spl/Makefile
>>> index 65a1484f..64569c2 100644
>>> --- a/common/spl/Makefile
>>> +++ b/common/spl/Makefile
>>> @@ -18,4 +18,5 @@ obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
>>>  obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
>>>  obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
>>>  obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
>>> +obj-$(CONFIG_SPL_SATA_SUPPORT) += spl_sata.o
>>>  endif
>>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>>> index 0645cee..774fdad 100644
>>> --- a/common/spl/spl.c
>>> +++ b/common/spl/spl.c
>>> @@ -210,6 +210,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>> spl_usb_load_image();
>>> break;
>>>  #endif
>>> +#ifdef CONFIG_SPL_SATA_SUPPORT
>>> +   case BOOT_DEVICE_SATA:
>>> +   spl_sata_load_image();
>>> +   break;
>>> +#endif
>>> default:
>>> debug("SPL: Un-supported Boot Device\n");
>>> hang();
>>> diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
>>> new file mode 100644
>>> index 000..88d6b06
>>> --- /dev/null
>>> +++ b/common/spl/spl_sata.c
>>> @@ -0,0 +1,51 @@
>>> +/*
>>> + * (C) Copyright 2013
>>> + * Texas Instruments, 
>>> + *
>>> + * Dan Murphy 
>>> + *
>>> + * SPDX-License-Identifier:GPL-2.0+
>>> + *
>>> + * Derived work from spl_usb.c
>>> + */
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +DECLARE_GLOBAL_DATA_PTR;
>>> +
>>> +void spl_sata_load_image(void)
>>> +{
>>> +   int err;
>>> +   block_dev_desc_t *stor_dev;
>>> +
>>> +   err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
>>> +   if (err) {
>>> +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
>>> +   printf("spl: sata init failed: err - %d\n", err);
>> Why the conditional print only if CONFIG_SPL_LIBCOMMON_SUPPORT.
> 
> As the file header indicates this is a copy/paste of the other SPL files.
> 
>>> +#endif
>>> +   hang();
>>> +   } else {
>>> +   /* try to recognize storage devices immediately */
>>> +   stor_dev = scsi_get_dev(0);
>>> +   }
>>> +
>>> +   debug("boot mode - FAT\n");
>> Do you really need this debug message? If yes could it be more descriptive 
>> like printing function name
>> to point out where it comes from?
> 
> We really don't need this since only FAT is supported here.  I can remove it 
> in v2
> 
>>> +
>>> +#ifdef CONFIG_SPL_OS_BOOT
>>> +   if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
>>> +   
>>> CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
>>> +#endif
>>> +   err = spl_load_image_fat(stor_dev,
>> Do you need to tab space this to align with the above if statement?
> 
> Well that depends on if the ifdef is honored.  If the SPL_OS_BOOT is not 
> defined then this statement is lined
> up properly.  if it is defined then it is not.  Again this is the precedence 
> for the other spl file (mmc and usb)
> 
>>
>>> +   CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
>>> +   CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
>> Just cross checking. If CONFIG_SPL_OS_BOOT is defined then you need to call
>> both spl_load_image_fat_os() as well as spl_load_image_fat ?
> 
> spl_load_image_fat is called within spl_load_image_fat_os.
> 
> spl_load_image_fat is only needed to be called if the other f

Re: [U-Boot] Pull request: u-boot-nds32

2014-01-29 Thread Tom Rini
On Tue, Jan 28, 2014 at 08:12:51PM +0800, ub...@andestech.com wrote:

> Hi Tom,
> 
> Please pull the following patch from u-boot-nds32 into your tree.
> Thanks!
> 
> The following changes since commit 0876703cf2ee107372b56037d4eeeb7604c56796:
> 
>   boards.cfg: Keep the entries sorted (2014-01-27 08:28:35 -0500)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-nds32.git master
> 
> for you to fetch changes up to f889cc81c1572f4af0be950fd49bb6b67bc580fb:
> 
>   nds32: add support for leopard and orca board boot flow auto detect 
> (2014-01-28 19:23:01 +0800)
> 
> 
> rick (1):
>   nds32: add support for leopard and orca board boot flow auto detect
> 
>  arch/nds32/cpu/n1213/ag101/asm-offsets.c   |1 +
>  arch/nds32/cpu/n1213/ag101/lowlevel_init.S |   88 ++-
>  2 files changed, 85 insertions(+), 4 deletions(-)

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [RFC] [PATCH] omap3_beagle: fdt: xMA/B set hsusb2_power_reg active-high

2014-01-29 Thread Robert Nelson
On Tue, Jan 28, 2014 at 5:31 PM, Robert Nelson  wrote:
> With the xM revision C, the DC control of the usb hub was inverted.
>
> By adding the enable-active-high property to hsusb2_power_reg, mainline 
> omap3-beagle-xm.dtb
> will now activiate properly activate the usb hub on older xMA/B varients.
>
> Signed-off-by: Robert Nelson 
> CC: Tom Rini 
> ---
>  include/configs/omap3_beagle.h | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
> index c58bc91..d7d63ce 100644
> --- a/include/configs/omap3_beagle.h
> +++ b/include/configs/omap3_beagle.h
> @@ -249,6 +249,9 @@
> "setenv fdtfile omap3-beagle-xm.dtb; fi; " \
> "if test $fdtfile = undefined; then " \
> "echo WARNING: Could not determine device tree to 
> use; fi; \0" \
> +   "fixfdt=" \
> +   "if test $beaglerev = xMAB; then " \
> +   "fdt addr ${fdtaddr}; fdt resize; fdt set 
> /hsusb2_power_reg enable-active-high; fi; \0" \
> "bootenv=uEnv.txt\0" \
> "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
> "importbootenv=echo Importing environment from mmc ...; " \
> @@ -308,6 +311,7 @@
> "setenv bootfile zImage;" \
> "if run loadimage; then " \
> "run loadfdt;" \
> +   "run fixfdt;" \
> "run mmcbootz; " \
> "fi; " \
>
> --
> 1.8.5.3

I've listed this as an RFC, as i'm not sure if there is a generic way
we should be doing device tree fixup's in u-boot.

I have thought about splitting omap3-beagle-xm.dtb into two variants
"ab" and "c" with just a simple one line delta:

https://github.com/RobertCNelson/armv7-multiplatform/blob/v3.13.x/patches/omap3_beagle_xm_rework/0002-ARM-dts-omap3-beagle-xm-ab-usb-host-is-active-high-t.patch

But it's just so trivial to just fix it in u-boot instead.

Thoughts?

Regards,

-- 
Robert Nelson
http://www.rcn-ee.com/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2014-01-29 Thread Albert ARIBAUD
Hi Tom,

On Fri, 24 Jan 2014 15:20:25 -0500, Tom Rini  wrote:

> Hey,
> 
> The following changes since commit c71b4dd2da0dcddabd7c29e6c3dc8a495d4bd928:
> 
>   arm: koelsch: Add support QSPI device and enable boot from SPI flash 
> (2014-01-16 08:07:20 +0900)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-ti master
> 
> for you to fetch changes up to b1cde7e21f950e05d18c102976c3b7d232b65e13:
> 
>   am43xx_evm.h: Correct SPL max size (2014-01-24 11:41:17 -0500)
> 
> 
> Enric Balletbò i Serra (7):
>   ARM: OMAP4: Rename to ti_omap4_common.h
>   ARM: OMAP5: Rename to ti_omap5_common.h
>   TI: armv7: Move ELM support to SoC configuration file.
>   TI: armv7: Do not define the number DRAM banks if is already defined.
>   ARM: OMAP3: Rename OMAP3_PUBLIC_SRAM_* to NON_SECURE_SRAM_*
>   TI: OMAP3: Create common config files for TI OMAP3 platforms.
>   OMAP3: igep00x0: Convert to ti_omap3_common.h.
> 
> Jassi Brar (2):
>   ARM: OMAP4/5: Remove dead code against CONFIG_SYS_CLOCKS_ENABLE_ALL
>   ARM: OMAP4/5: Remove dead code against CONFIG_SYS_ENABLE_PADS_ALL
> 
> Lokesh Vutla (1):
>   ARM: AM43xx: Enable DDR dynamic IO power down for DDR3
> 
> Nishanth Menon (2):
>   DRA7: Add support for ES1.1 silicon ID code
>   DRA7: add ABB setup for MPU voltage domain
> 
> Satyanarayana, Sandhya (1):
>   ARM: AM335x: Enable DDR dynamic IO power down
> 
> Tom Rini (2):
>   feature-removal-schedule.txt: Drop  
> CONFIG_SYS_ENABLE_PADS_ALL/CLOCKS_ENABLE_ALL
>   am43xx_evm.h: Correct SPL max size
> 
>  arch/arm/cpu/armv7/omap-common/clocks-common.c |   53 -
>  arch/arm/cpu/armv7/omap-common/emif-common.c   |5 +-
>  arch/arm/cpu/armv7/omap-common/hwinit-common.c |6 -
>  arch/arm/cpu/armv7/omap4/hw_data.c |   85 ---
>  arch/arm/cpu/armv7/omap5/abb.c |   13 +-
>  arch/arm/cpu/armv7/omap5/hw_data.c |   90 +---
>  arch/arm/cpu/armv7/omap5/hwinit.c  |3 +
>  arch/arm/cpu/armv7/omap5/prcm-regs.c   |8 +
>  arch/arm/cpu/armv7/omap5/sdram.c   |4 +
>  arch/arm/include/asm/arch-am33xx/ddr_defs.h|8 +-
>  arch/arm/include/asm/arch-omap3/omap3.h|6 +-
>  arch/arm/include/asm/arch-omap4/sys_proto.h|1 -
>  arch/arm/include/asm/arch-omap5/omap.h |3 +
>  arch/arm/include/asm/arch-omap5/sys_proto.h|1 -
>  arch/arm/include/asm/omap_common.h |2 +-
>  board/ti/am43xx/board.c|2 +-
>  board/ti/omap5_uevm/evm.c  |   13 --
>  board/ti/omap5_uevm/mux_data.h |  234 
> 
>  board/ti/panda/panda.c |   30 ---
>  board/ti/panda/panda_mux_data.h|  186 
>  board/ti/sdp4430/sdp.c |   20 --
>  board/ti/sdp4430/sdp4430_mux_data.h|  197 
>  doc/feature-removal-schedule.txt   |   16 --
>  include/configs/am43xx_evm.h   |2 +-
>  include/configs/dra7xx_evm.h   |4 +-
>  include/configs/omap3_igep00x0.h   |  189 +---
>  include/configs/omap4_panda.h  |4 +-
>  include/configs/omap4_sdp4430.h|4 +-
>  include/configs/omap5_uevm.h   |4 +-
>  include/configs/ti_am335x_common.h |4 +
>  include/configs/ti_armv7_common.h  |   11 +-
>  include/configs/ti_omap3_common.h  |   73 ++
>  .../configs/{omap4_common.h => ti_omap4_common.h}  |   10 +-
>  .../configs/{omap5_common.h => ti_omap5_common.h}  |   10 +-
>  34 files changed, 157 insertions(+), 1144 deletions(-)
>  create mode 100644 include/configs/ti_omap3_common.h
>  rename include/configs/{omap4_common.h => ti_omap4_common.h} (95%)
>  rename include/configs/{omap5_common.h => ti_omap5_common.h} (95%)
> 
> Thanks!
> 

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

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


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

2014-01-29 Thread Michal Simek
Hi,

I have also problem with this patch but from the other side.
Tool for booting image generation expects that LOAD section
is the first.
That's why I have to remove PHDR, INTERP sections.
Not sure about DYNAMIC section which is also there but behind
LOAD section.

I can easily create zynq private linker script but
maybe there is better way how to remove these section for us
via LDFLAGS_FINAL in config.mk.
Unfortunatelly I haven't found how to do it.

Can someone know if it is possible to remove some sections
via ld command line?

Thanks,
Michal

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




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


[U-Boot] [PATCH v3 1/2] initial support for pengwyn board

2014-01-29 Thread Lothar Felten
Signed-off-by: Lothar Felten 
---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   16 ++
 board/silica/pengwyn/Makefile   |   13 ++
 board/silica/pengwyn/board.c|  216 +
 board/silica/pengwyn/board.h|   15 ++
 board/silica/pengwyn/mux.c  |  107 +++
 boards.cfg  |1 +
 include/configs/pengwyn.h   |  274 +++
 7 files changed, 642 insertions(+)
 create mode 100644 board/silica/pengwyn/Makefile
 create mode 100644 board/silica/pengwyn/board.c
 create mode 100644 board/silica/pengwyn/board.h
 create mode 100644 board/silica/pengwyn/mux.c
 create mode 100644 include/configs/pengwyn.h

diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index c1777df..60cb098 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -58,6 +58,22 @@
 #define MT41J128MJT125_PHY_FIFO_WE 0x100
 #define MT41J128MJT125_IOCTRL_VALUE0x18B
 
+/* Micron MT41K128M16JT-187E */
+#define MT41K128MJT187E_EMIF_READ_LATENCY  0x06
+#define MT41K128MJT187E_EMIF_TIM1  0x0888B3DB
+#define MT41K128MJT187E_EMIF_TIM2  0x36337FDA
+#define MT41K128MJT187E_EMIF_TIM3  0x501F830F
+#define MT41K128MJT187E_EMIF_SDCFG 0x61C04AB2
+#define MT41K128MJT187E_EMIF_SDREF 0x093B
+#define MT41K128MJT187E_ZQ_CFG 0x50074BE4
+#define MT41K128MJT187E_RATIO  0x40
+#define MT41K128MJT187E_INVERT_CLKOUT  0x1
+#define MT41K128MJT187E_RD_DQS 0x3B
+#define MT41K128MJT187E_WR_DQS 0x85
+#define MT41K128MJT187E_PHY_WR_DATA0xC1
+#define MT41K128MJT187E_PHY_FIFO_WE0x100
+#define MT41K128MJT187E_IOCTRL_VALUE   0x18B
+
 /* Micron MT41J64M16JT-125 */
 #define MT41J64MJT125_EMIF_SDCFG   0x61C04A32
 
diff --git a/board/silica/pengwyn/Makefile b/board/silica/pengwyn/Makefile
new file mode 100644
index 000..c8b4f9a
--- /dev/null
+++ b/board/silica/pengwyn/Makefile
@@ -0,0 +1,13 @@
+#
+# Makefile
+#
+# Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_NOR_BOOT),y)
+obj-y  := mux.o
+endif
+
+obj-y  += board.o
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
new file mode 100644
index 000..d5dbd3b
--- /dev/null
+++ b/board/silica/pengwyn/board.c
@@ -0,0 +1,216 @@
+/*
+ * board.c
+ *
+ * Copyright (C) 2013 Lothar Felten 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "board.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
+
+/* DDR3 RAM timings */
+static const struct ddr_data ddr3_data = {
+   .datardsratio0 = MT41K128MJT187E_RD_DQS,
+   .datawdsratio0 = MT41K128MJT187E_WR_DQS,
+   .datafwsratio0 = MT41K128MJT187E_PHY_FIFO_WE,
+   .datawrsratio0 = MT41K128MJT187E_PHY_WR_DATA,
+};
+
+static const struct cmd_control ddr3_cmd_ctrl_data = {
+   .cmd0csratio = MT41K128MJT187E_RATIO,
+   .cmd0iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+   .cmd1csratio = MT41K128MJT187E_RATIO,
+   .cmd1iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+   .cmd2csratio = MT41K128MJT187E_RATIO,
+   .cmd2iclkout = MT41K128MJT187E_INVERT_CLKOUT,
+};
+
+static struct emif_regs ddr3_emif_reg_data = {
+   .sdram_config = MT41K128MJT187E_EMIF_SDCFG,
+   .ref_ctrl = MT41K128MJT187E_EMIF_SDREF,
+   .sdram_tim1 = MT41K128MJT187E_EMIF_TIM1,
+   .sdram_tim2 = MT41K128MJT187E_EMIF_TIM2,
+   .sdram_tim3 = MT41K128MJT187E_EMIF_TIM3,
+   .zq_config = MT41K128MJT187E_ZQ_CFG,
+   .emif_ddr_phy_ctlr_1 = MT41K128MJT187E_EMIF_READ_LATENCY |
+   PHY_EN_DYN_PWRDN,
+};
+
+const struct ctrl_ioregs ddr3_ioregs = {
+   .cm0ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .cm1ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .cm2ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .dt0ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+   .dt1ioctl   = MT41K128MJT187E_IOCTRL_VALUE,
+};
+
+#ifdef CONFIG_SPL_OS_BOOT
+int spl_start_uboot(void)
+{
+   /* break into full u-boot on 'c' */
+   return serial_tstc() && serial_getc() == 'c';
+}
+#endif
+
+#define OSC(V_OSCK/100)
+const struct dpll_params dpll_ddr_266 = {
+   266, OSC-1, 1, -1, -1, -1, -1};
+const struct dpll_params dpll_ddr_303 = {
+   303, OSC-1, 1, -1, -1, -1, -1};
+const struct dpll_params dpll_ddr_400 = {
+   400, OSC-1, 1, -1, -1, -1, -1};
+
+void am33xx_spl_board_init(void)
+{

[U-Boot] [PATCH v3 0/2] Initial support for the silica pengwyn board

2014-01-29 Thread Lothar Felten
This patch add support for the Silica Pengwyn board [1]
The board is basen on a TI AM3354 CPU [2]
All jumpers removed it will boot from the SDcard, the console is on
UART1 accessible via the FDTI -> USB. The on board NAND chip is
supported and can act as boot medium, depending on jumper settings.
USB Host, USB Device and Ethernet are also provided but untested.

[1]
http://www.silica.com/product/silica-pengwyn-board.html
[2]
http://www.ti.com/product/am3354

Lothar Felten (2):
  initial support for pengwyn board
  cosmetics: braces, comment and whitespace formatting
Signed-off-by: Lothar Felten 

 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   16 ++
 board/silica/pengwyn/Makefile   |   13 ++
 board/silica/pengwyn/board.c|  216 +
 board/silica/pengwyn/board.h|   15 ++
 board/silica/pengwyn/mux.c  |  107 +++
 boards.cfg  |1 +
 include/configs/pengwyn.h   |  272 +++
 7 files changed, 640 insertions(+)
 create mode 100644 board/silica/pengwyn/Makefile
 create mode 100644 board/silica/pengwyn/board.c
 create mode 100644 board/silica/pengwyn/board.h
 create mode 100644 board/silica/pengwyn/mux.c
 create mode 100644 include/configs/pengwyn.h

-- 
1.7.9.5

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


[U-Boot] [PATCH v3 2/2] cosmetics: braces, comment and whitespace formatting Signed-off-by: Lothar Felten

2014-01-29 Thread Lothar Felten
Signed-off-by: Lothar Felten 
---
 board/silica/pengwyn/board.c |   10 +-
 include/configs/pengwyn.h|6 ++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index d5dbd3b..97d7de4 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -77,11 +77,11 @@ const struct dpll_params dpll_ddr_400 = {
 
 void am33xx_spl_board_init(void)
 {
-   /* the pengwyn board uses the TPS650250 PMIC  without I2C */
-   /* interface and will output the following fixed voltages: */
-   /* DCDC1=3V3 (IO) DCDC2=1V5 (DDR) DCDC3=1V26 (Vmpu) */
-   /* VLDO1=1V8 (IO) VLDO2=1V8(IO) */
-   /* Vcore=1V1 is fixed, generated by TPS62231 */
+   /* The pengwyn board uses the TPS650250 PMIC  without I2C
+* interface and will output the following fixed voltages:
+* DCDC1=3V3 (IO) DCDC2=1V5 (DDR) DCDC3=1V26 (Vmpu)
+* VLDO1=1V8 (IO) VLDO2=1V8(IO)
+* Vcore=1V1 is fixed, generated by TPS62231 */
 
/* Get the frequency */
dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
diff --git a/include/configs/pengwyn.h b/include/configs/pengwyn.h
index 7a41151..f35cee6 100644
--- a/include/configs/pengwyn.h
+++ b/include/configs/pengwyn.h
@@ -19,10 +19,10 @@
 
 /* Clock Defines */
 #define V_OSCK 2400
-#define V_SCLK (V_OSCK)
+#define V_SCLK V_OSCK
 
 /* set env size */
-#define CONFIG_ENV_SIZE(0x4000)
+#define CONFIG_ENV_SIZE0x4000
 
 #ifdef CONFIG_NAND
 #define NANDARGS \
@@ -179,8 +179,6 @@
 #define CONFIG_SPL_POWER_SUPPORT
 #define CONFIG_SPL_YMODEM_SUPPORT
 
-
-
 /* General network SPL, both CPSW and USB gadget RNDIS */
 #define CONFIG_SPL_NET_SUPPORT
 #define CONFIG_SPL_ENV_SUPPORT
-- 
1.7.9.5

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


[U-Boot] [PATCH v2 1/9] arc: add architecture header files

2014-01-29 Thread Alexey Brodkin
These are header files used by ARC700 architecture.

Following files were borrowed from Linux kernel sources,
commit 5ee54f38171b9b3541c5e9cf9c3a9e53455fd8b4 (Linux 3.11.10):

 * arcregs.h
 * linkage.h
 * ptrace.h
 * string.h

Also note that "arch-arc700/hardware.h" is only required for compilation of
"designware_i2c" driver which refers to "asm/arch/hardware.h".
It would be good to fix mentioned driver sometime soon but it will cause
changes in ARM board configs that use "designware_i2c".

Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

Changes for v2:

 * Deleted unused empty file "asm/processor.h"
 * Added commit message
 * Added explicit mention of header files borrowed from Linux sources with
   reference to versoin/commit in Linux git repository
---
 arch/arc/include/asm/arch-arc700/hardware.h |   0
 arch/arc/include/asm/arcregs.h  | 324 
 arch/arc/include/asm/bitops.h   |  19 ++
 arch/arc/include/asm/byteorder.h|  23 ++
 arch/arc/include/asm/cache.h|  23 ++
 arch/arc/include/asm/config.h   |  12 ++
 arch/arc/include/asm/errno.h|   1 +
 arch/arc/include/asm/global_data.h  |  19 ++
 arch/arc/include/asm/io.h   | 287 
 arch/arc/include/asm/linkage.h  |  63 ++
 arch/arc/include/asm/posix_types.h  |  73 +++
 arch/arc/include/asm/ptrace.h   | 101 +
 arch/arc/include/asm/sections.h |   1 +
 arch/arc/include/asm/string.h   |  27 +++
 arch/arc/include/asm/types.h|  55 +
 arch/arc/include/asm/u-boot.h   |  15 ++
 arch/arc/include/asm/unaligned.h|   1 +
 17 files changed, 1044 insertions(+)
 create mode 100644 arch/arc/include/asm/arch-arc700/hardware.h
 create mode 100644 arch/arc/include/asm/arcregs.h
 create mode 100644 arch/arc/include/asm/bitops.h
 create mode 100644 arch/arc/include/asm/byteorder.h
 create mode 100644 arch/arc/include/asm/cache.h
 create mode 100644 arch/arc/include/asm/config.h
 create mode 100644 arch/arc/include/asm/errno.h
 create mode 100644 arch/arc/include/asm/global_data.h
 create mode 100644 arch/arc/include/asm/io.h
 create mode 100644 arch/arc/include/asm/linkage.h
 create mode 100644 arch/arc/include/asm/posix_types.h
 create mode 100644 arch/arc/include/asm/ptrace.h
 create mode 100644 arch/arc/include/asm/sections.h
 create mode 100644 arch/arc/include/asm/string.h
 create mode 100644 arch/arc/include/asm/types.h
 create mode 100644 arch/arc/include/asm/u-boot.h
 create mode 100644 arch/arc/include/asm/unaligned.h

diff --git a/arch/arc/include/asm/arch-arc700/hardware.h 
b/arch/arc/include/asm/arch-arc700/hardware.h
new file mode 100644
index 000..e69de29
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
new file mode 100644
index 000..87b0a60
--- /dev/null
+++ b/arch/arc/include/asm/arcregs.h
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _ASM_ARC_ARCREGS_H
+#define _ASM_ARC_ARCREGS_H
+
+#ifdef __KERNEL__
+
+/* Build Configuration Registers */
+#define ARC_REG_DCCMBASE_BCR   0x61/* DCCM Base Addr */
+#define ARC_REG_CRC_BCR0x62
+#define ARC_REG_DVFB_BCR   0x64
+#define ARC_REG_EXTARITH_BCR   0x65
+#define ARC_REG_VECBASE_BCR0x68
+#define ARC_REG_PERIBASE_BCR   0x69
+#define ARC_REG_FP_BCR 0x6B/* Single-Precision FPU */
+#define ARC_REG_DPFP_BCR   0x6C/* Dbl Precision FPU */
+#define ARC_REG_DCCM_BCR   0x74/* DCCM Present + SZ */
+#define ARC_REG_TIMERS_BCR 0x75
+#define ARC_REG_ICCM_BCR   0x78
+#define ARC_REG_XY_MEM_BCR 0x79
+#define ARC_REG_MAC_BCR0x7a
+#define ARC_REG_MUL_BCR0x7b
+#define ARC_REG_SWAP_BCR   0x7c
+#define ARC_REG_NORM_BCR   0x7d
+#define ARC_REG_MIXMAX_BCR 0x7e
+#define ARC_REG_BARREL_BCR 0x7f
+#define ARC_REG_D_UNCACH_BCR   0x6A
+
+/* status32 Bits Positions */
+#define STATUS_AE_BIT  5   /* Exception active */
+#define STATUS_DE_BIT  6   /* PC is in delay slot */
+#define STATUS_U_BIT   7   /* User/Kernel mode */
+#define STATUS_L_BIT   12  /* Loop inhibit */
+
+/* These masks correspond to the status word(STATUS_32) bits */
+#define STATUS_AE_MASK (1<> 10)
+#define TO_MB(bytes)   (TO_KB(bytes) >> 10)
+#define PAGES_TO_KB(n_pages)   ((n_pages) << (PAGE_SHIFT - 10))
+#define PAGES_TO_MB(n_pages)   (PAGES_TO_KB(n_pages) >> 10)
+
+#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
+/* These DPFP regs need to be saved/restored across ctx-sw */
+struct arc_fpu {
+   struct {
+   unsigned int l, h;
+   } aux_dpfp[2];
+};
+#endif
+
+/*
+ ***
+ * Build Configuration Registers, wi

[U-Boot] [PATCH v2 5/9] arc: add support for standalone programs

2014-01-29 Thread Alexey Brodkin
Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

No changes for v2.
---
 examples/standalone/stubs.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 32a19ce..9346bc2 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -210,6 +210,19 @@ gd_t *global_data;
 "  l.jrr13\n"  \
 "  l.nop\n"\
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r13");
+#elif defined(CONFIG_ARC)
+/*
+ * r25 holds the pointer to the global_data. r10 is call clobbered.
+  */
+#define EXPORT_FUNC(x) \
+   asm volatile( \
+"  .align 4\n" \
+"  .globl " #x "\n" \
+#x ":\n" \
+"  ld  %%r10, [%%r25, %0]\n" \
+"  ld  %%r10, [%%r10, %1]\n" \
+"  j   [%%r10]\n" \
+   : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r10");
 #else
 /*"addi$sp, $sp, -24\n"\
 "  br  $r16\n" \*/
-- 
1.8.5.3

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


[U-Boot] [PATCH v2 3/9] arc: add library functions

2014-01-29 Thread Alexey Brodkin
These are library functions used by ARC700 architecture.

Following files were borrowed from Linux kernel sources,
commit 5ee54f38171b9b3541c5e9cf9c3a9e53455fd8b4 (Linux 3.11.10):

 * memcmp.S
 * memcpy-700.S
 * memset.S
 * strchr-700.S
 * strcmp.S
 * strcpy-700.S
 * strlen.S

Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

Changes for v2:

 * Added commit message
 * Added borrowed from Linux optimized string routines
 * Added explicit mention of files borrowed from Linux sources with
   reference to versoin/commit in Linux git repository
---
 arch/arc/lib/Makefile |  16 ++
 arch/arc/lib/bootm.c  | 106 
 arch/arc/lib/memcmp.S | 122 ++
 arch/arc/lib/memcpy-700.S |  64 ++
 arch/arc/lib/memset.S |  59 
 arch/arc/lib/relocate.c   |  74 ++
 arch/arc/lib/sections.c   |  21 
 arch/arc/lib/strchr-700.S | 133 ++
 arch/arc/lib/strcmp.S |  96 +
 arch/arc/lib/strcpy-700.S |  70 
 arch/arc/lib/strlen.S |  83 +
 11 files changed, 844 insertions(+)
 create mode 100644 arch/arc/lib/Makefile
 create mode 100644 arch/arc/lib/bootm.c
 create mode 100644 arch/arc/lib/memcmp.S
 create mode 100644 arch/arc/lib/memcpy-700.S
 create mode 100644 arch/arc/lib/memset.S
 create mode 100644 arch/arc/lib/relocate.c
 create mode 100644 arch/arc/lib/sections.c
 create mode 100644 arch/arc/lib/strchr-700.S
 create mode 100644 arch/arc/lib/strcmp.S
 create mode 100644 arch/arc/lib/strcpy-700.S
 create mode 100644 arch/arc/lib/strlen.S

diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile
new file mode 100644
index 000..7675f85
--- /dev/null
+++ b/arch/arc/lib/Makefile
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += sections.o
+obj-y += relocate.o
+obj-y += strchr-700.o
+obj-y += strcmp.o
+obj-y += strcpy-700.o
+obj-y += strlen.o
+obj-y += memcmp.o
+obj-y += memcpy-700.o
+obj-y += memset.o
+obj-$(CONFIG_CMD_BOOTM) += bootm.o
diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
new file mode 100644
index 000..d185a50
--- /dev/null
+++ b/arch/arc/lib/bootm.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static ulong get_sp(void)
+{
+   ulong ret;
+
+   asm("mov %0, sp" : "=r"(ret) : );
+   return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+   ulong sp;
+
+   /*
+* Booting a (Linux) kernel image
+*
+* Allocate space for command line and board info - the
+* address should be as high as possible within the reach of
+* the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
+* memory, which means far enough below the current stack
+* pointer.
+*/
+   sp = get_sp();
+   debug("## Current stack ends at 0x%08lx ", sp);
+
+   /* adjust sp by 4K to be safe */
+   sp -= 4096;
+   lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
+}
+
+static int cleanup_before_linux(void)
+{
+   disable_interrupts();
+   flush_dcache_all();
+   invalidate_icache_all();
+
+   return 0;
+}
+
+/* Subcommand: PREP */
+static void boot_prep_linux(bootm_headers_t *images)
+{
+   if (image_setup_linux(images))
+   hang();
+}
+
+/* Subcommand: GO */
+static void boot_jump_linux(bootm_headers_t *images, int flag)
+{
+   void (*kernel_entry)(int zero, int arch, uint params);
+   unsigned int r0, r2;
+   int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
+
+   kernel_entry = (void (*)(int, int, uint))images->ep;
+
+   debug("## Transferring control to Linux (at address %08lx)...\n",
+ (ulong) kernel_entry);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
+
+   printf("\nStarting kernel ...%s\n\n", fake ?
+  "(fake run for tracing)" : "");
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+   cleanup_before_linux();
+
+   if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
+   r0 = 2;
+   r2 = (unsigned int)images->ft_addr;
+   } else {
+   r0 = 1;
+   r2 = (unsigned int)getenv("bootargs");
+   }
+
+   if (!fake)
+   kernel_entry(r0, 0, r2);
+}
+
+int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
+{
+   /* No need for those on ARC */
+   if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE))
+   return -1;
+
+   if (flag & BOOTM_STATE_OS_PREP) {
+   boot_prep_linux(images);
+   return 0;
+   }
+
+   if (flag & (BOOTM_S

[U-Boot] [PATCH v2 4/9] arc: bdinfo and image support

2014-01-29 Thread Alexey Brodkin
Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

No changes for v2.
---
 common/cmd_bdinfo.c | 18 ++
 common/image.c  |  1 +
 include/image.h |  1 +
 3 files changed, 20 insertions(+)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 713de14..15119a7 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -517,6 +517,24 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return 0;
 }
 
+#elif defined(CONFIG_ARC700)
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   bd_t *bd = gd->bd;
+
+   print_num("mem start",  bd->bi_memstart);
+   print_lnum("mem size",  bd->bi_memsize);
+
+#if defined(CONFIG_CMD_NET)
+   print_eth(0);
+   printf("ip_addr = %s\n", getenv("ipaddr"));
+#endif
+   printf("baudrate= %d bps\n", bd->bi_baudrate);
+
+   return 0;
+}
+
 #else
  #error "a case for this architecture does not exist!"
 #endif
diff --git a/common/image.c b/common/image.c
index ae95c3f..9c6bec5 100644
--- a/common/image.c
+++ b/common/image.c
@@ -82,6 +82,7 @@ static const table_entry_t uimage_arch[] = {
{   IH_ARCH_OPENRISC,   "or1k", "OpenRISC 1000",},
{   IH_ARCH_SANDBOX,"sandbox",  "Sandbox",  },
{   IH_ARCH_ARM64,  "arm64","AArch64",  },
+   {   IH_ARCH_ARC,"arc",  "ARC",  },
{   -1, "", "", },
 };
 
diff --git a/include/image.h b/include/image.h
index 7de2bb2..3ba8c2e 100644
--- a/include/image.h
+++ b/include/image.h
@@ -157,6 +157,7 @@ struct lmb;
 #define IH_ARCH_NDS32  20  /* ANDES Technology - NDS32  */
 #define IH_ARCH_OPENRISC21 /* OpenRISC 1000  */
 #define IH_ARCH_ARM64  22  /* ARM64*/
+#define IH_ARCH_ARC23  /* Synopsys DesignWare ARC */
 
 /*
  * Image Types
-- 
1.8.5.3

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


[U-Boot] [PATCH v2 9/9] arc: add README for architecture

2014-01-29 Thread Alexey Brodkin
Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

No changes for v2.
---
 doc/README.ARC | 27 +++
 1 file changed, 27 insertions(+)
 create mode 100644 doc/README.ARC

diff --git a/doc/README.ARC b/doc/README.ARC
new file mode 100644
index 000..5f414fb
--- /dev/null
+++ b/doc/README.ARC
@@ -0,0 +1,27 @@
+Synopsys' DesignWare(r) ARC(r) Processors are a family of 32-bit CPUs
+that SoC designers can optimize for a wide range of uses, from deeply embedded
+to high-performance host applications.
+
+More information on ARC cores avaialble here:
+http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/Pages/default.aspx
+
+Designers can differentiate their products by using patented configuration
+technology to tailor each ARC processor instance to meet specific performance,
+power and area requirements.
+
+The DesignWare ARC processors are also extendable, allowing designers to add
+their own custom instructions that dramatically increase performance.
+
+Synopsys' ARC processors have been used by over 170 customers worldwide who
+collectively ship more than 1 billion ARC-based chips annually.
+
+All DesignWare ARC processors utilize a 16-/32-bit ISA that provides excellent
+performance and code density for embedded and host SoC applications.
+
+The RISC microprocessors are synthesizable and can be implemented in any 
foundry
+or process, and are supported by a complete suite of development tools.
+
+The ARC GNU toolchain with support for all ARC Processors can be downloaded
+from here (available pre-built toolchains as well):
+
+https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases
-- 
1.8.5.3

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


[U-Boot] [PATCH v2 8/9] arc: add architecture to MAKEALL

2014-01-29 Thread Alexey Brodkin
Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

No changes for v2.
---
 MAKEALL | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAKEALL b/MAKEALL
index 562071a..54b0d89 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -529,6 +529,12 @@ LIST_sparc="$(targets_by_arch sparc)"
 
 LIST_nds32="$(targets_by_arch nds32)"
 
+#
+## ARC Systems
+#
+
+LIST_arc="$(targets_by_arch arc)"
+
 #---
 
 get_target_location() {
-- 
1.8.5.3

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


[U-Boot] [PATCH v2 7/9] arc: add AXS101 board support

2014-01-29 Thread Alexey Brodkin
AXS101 is a new generation of devlopment boards from Synopsys that houses
ASIC with ARC700 and lots of DesignWare peripherals:

 * DW APB UART
 * DW Mobile Storage (MMC/SD)
 * DW I2C
 * DW GMAC

Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

Changes for v2:

 * Added commit message
---
 board/synopsys/axs101/Makefile |   8 ++
 board/synopsys/axs101/axs101.c |  61 +++
 board/synopsys/axs101/nand.c   | 224 +
 boards.cfg |   1 +
 include/configs/axs101.h   | 194 +++
 5 files changed, 488 insertions(+)
 create mode 100644 board/synopsys/axs101/Makefile
 create mode 100644 board/synopsys/axs101/axs101.c
 create mode 100644 board/synopsys/axs101/nand.c
 create mode 100644 include/configs/axs101.h

diff --git a/board/synopsys/axs101/Makefile b/board/synopsys/axs101/Makefile
new file mode 100644
index 000..f0965f7
--- /dev/null
+++ b/board/synopsys/axs101/Makefile
@@ -0,0 +1,8 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += axs101.o
+obj-$(CONFIG_CMD_NAND) += nand.o
diff --git a/board/synopsys/axs101/axs101.c b/board/synopsys/axs101/axs101.c
new file mode 100644
index 000..93e44dd
--- /dev/null
+++ b/board/synopsys/axs101/axs101.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+   gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
+   gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+   return 0;
+}
+
+int board_early_init_r(void)
+{
+   gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+   gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+
+   return 0;
+}
+
+int board_mmc_init(bd_t *bis)
+{
+   struct dwmci_host *host = NULL;
+
+   host = malloc(sizeof(struct dwmci_host));
+   if (!host) {
+   printf("dwmci_host malloc fail!\n");
+   return 1;
+   }
+
+   memset(host, 0, sizeof(struct dwmci_host));
+   host->name = "Synopsys Mobile storage";
+   host->ioaddr = (void *)ARC_DWMMC_BASE;
+   host->buswidth = 4;
+   host->dev_index = 0;
+   host->bus_hz = 2500;
+
+   add_dwmci(host, 5200, 40);
+
+   return 0;
+}
+
+int board_eth_init(bd_t *bis)
+{
+   if (designware_initialize(0, ARC_DWGMAC_BASE, 0,
+ PHY_INTERFACE_MODE_RGMII) >= 0)
+   return 1;
+
+   return 0;
+}
diff --git a/board/synopsys/axs101/nand.c b/board/synopsys/axs101/nand.c
new file mode 100644
index 000..9667080
--- /dev/null
+++ b/board/synopsys/axs101/nand.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BUS_WIDTH  8   /* AXI data bus width in bytes  */
+
+/* DMA buffer descriptor bits & masks */
+#define BD_STAT_OWN(1 << 31)
+#define BD_STAT_BD_FIRST   (1 << 3)
+#define BD_STAT_BD_LAST(1 << 2)
+#define BD_SIZES_BUFFER1_MASK  0xfff
+
+#define BD_STAT_BD_COMPLETE(BD_STAT_BD_FIRST | BD_STAT_BD_LAST)
+
+/* Controller command flags */
+#define B_WFR  (1 << 19)   /* 1b - Wait for ready  */
+#define B_LC   (1 << 18)   /* 1b - Last cycle  */
+#define B_IWC  (1 << 13)   /* 1b - Interrupt when complete */
+
+/* NAND cycle types */
+#define B_CT_ADDRESS   (0x0 << 16) /* Address operation*/
+#define B_CT_COMMAND   (0x1 << 16) /* Command operation*/
+#define B_CT_WRITE (0x2 << 16) /* Write operation  */
+#define B_CT_READ  (0x3 << 16) /* Write operation  */
+
+enum nand_isr_t {
+   NAND_ISR_DATAREQUIRED = 0,
+   NAND_ISR_TXUNDERFLOW,
+   NAND_ISR_TXOVERFLOW,
+   NAND_ISR_DATAAVAILABLE,
+   NAND_ISR_RXUNDERFLOW,
+   NAND_ISR_RXOVERFLOW,
+   NAND_ISR_TXDMACOMPLETE,
+   NAND_ISR_RXDMACOMPLETE,
+   NAND_ISR_DESCRIPTORUNAVAILABLE,
+   NAND_ISR_CMDDONE,
+   NAND_ISR_CMDAVAILABLE,
+   NAND_ISR_CMDERROR,
+   NAND_ISR_DATATRANSFEROVER,
+   NAND_ISR_NONE
+};
+
+enum nand_regs_t {
+   AC_FIFO = 0,/* address and command fifo */
+   IDMAC_BDADDR = 0x18,/* idmac descriptor list base address */
+   INT_STATUS = 0x118, /* interrupt status register */
+   INT_CLR_STATUS = 0x120, /* interrupt clear status register */
+};
+
+struct nand_bd {
+   uint32_t status;/* DES0 */
+   uint32_t sizes; /* DES1 */
+   uint32_t buffer_ptr0;   /* DES2 */
+   uint32_t buffer_ptr1;   /* DES3 */
+};
+
+#define NAND_REG_WRITE(r, v)   writel(v, CONFIG_SYS_NAND_

[U-Boot] [PATCH v2 2/9] arc: add cpu files

2014-01-29 Thread Alexey Brodkin
Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

No changes for v2.

---
 arch/arc/config.mk   |  31 +
 arch/arc/cpu/arc700/Makefile |  13 ++
 arch/arc/cpu/arc700/cache.c  | 161 
 arch/arc/cpu/arc700/config.mk|   7 ++
 arch/arc/cpu/arc700/cpu.c|  37 ++
 arch/arc/cpu/arc700/interrupts.c | 211 +++
 arch/arc/cpu/arc700/reset.c  |  19 +++
 arch/arc/cpu/arc700/start.S  | 262 +++
 arch/arc/cpu/arc700/timer.c  |  28 +
 arch/arc/cpu/arc700/u-boot.lds   |  72 +++
 10 files changed, 841 insertions(+)
 create mode 100644 arch/arc/config.mk
 create mode 100644 arch/arc/cpu/arc700/Makefile
 create mode 100644 arch/arc/cpu/arc700/cache.c
 create mode 100644 arch/arc/cpu/arc700/config.mk
 create mode 100644 arch/arc/cpu/arc700/cpu.c
 create mode 100644 arch/arc/cpu/arc700/interrupts.c
 create mode 100644 arch/arc/cpu/arc700/reset.c
 create mode 100644 arch/arc/cpu/arc700/start.S
 create mode 100644 arch/arc/cpu/arc700/timer.c
 create mode 100644 arch/arc/cpu/arc700/u-boot.lds

diff --git a/arch/arc/config.mk b/arch/arc/config.mk
new file mode 100644
index 000..76f4f7c
--- /dev/null
+++ b/arch/arc/config.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifndef CONFIG_SYS_BIG_ENDIAN
+CONFIG_SYS_LITTLE_ENDIAN = 1
+endif
+
+ifdef CONFIG_SYS_LITTLE_ENDIAN
+CROSS_COMPILE ?= arc-buildroot-linux-uclibc-
+endif
+
+ifdef CONFIG_SYS_BIG_ENDIAN
+CROSS_COMPILE ?= arceb-buildroot-linux-uclibc-
+PLATFORM_LDFLAGS += -EB
+endif
+
+PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -DCONFIG_ARC -gdwarf-2
+
+LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
+
+# Needed for relocation
+LDFLAGS_FINAL += -pie
+
+# Load address for standalone apps
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x8200
+
+# Support generic board on ARC
+__HAVE_ARCH_GENERIC_BOARD := y
diff --git a/arch/arc/cpu/arc700/Makefile b/arch/arc/cpu/arc700/Makefile
new file mode 100644
index 000..cdc5002
--- /dev/null
+++ b/arch/arc/cpu/arc700/Makefile
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+extra-y+= start.o
+
+obj-y  += cache.o
+obj-y  += cpu.o
+obj-y  += interrupts.o
+obj-y  += reset.o
+obj-y  += timer.o
diff --git a/arch/arc/cpu/arc700/cache.c b/arch/arc/cpu/arc700/cache.c
new file mode 100644
index 000..2e6dc18
--- /dev/null
+++ b/arch/arc/cpu/arc700/cache.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+
+/* Instruction cache related Auxiliary registers */
+#define ARC_REG_IC_BCR 0x77
+#define ARC_REG_IC_IVIC0x10
+#define ARC_REG_IC_CTRL0x11
+#define ARC_REG_IC_IVIL0x19
+#if (CONFIG_ARC_MMU_VER > 2)
+#define ARC_REG_IC_PTAG0x1E
+#endif
+
+/* Bit values in IC_CTRL */
+#define IC_CTRL_CACHE_DISABLE  (1 << 0)
+
+/* Data cache related Auxiliary registers */
+#define ARC_REG_DC_BCR 0x72
+#define ARC_REG_DC_IVDC0x47
+#define ARC_REG_DC_CTRL0x48
+#define ARC_REG_DC_IVDL0x4A
+#define ARC_REG_DC_FLSH0x4B
+#define ARC_REG_DC_FLDL0x4C
+#if (CONFIG_ARC_MMU_VER > 2)
+#define ARC_REG_DC_PTAG0x5C
+#endif
+
+/* Bit values in DC_CTRL */
+#define DC_CTRL_CACHE_DISABLE  (1 << 0)
+#define DC_CTRL_INV_MODE_FLUSH (1 << 6)
+#define DC_CTRL_FLUSH_STATUS   (1 << 8)
+
+#define CACHE_LINE_SIZECONFIG_SYS_CACHELINE_SIZE
+
+int icache_status(void)
+{
+   return (read_aux_reg(ARC_REG_IC_CTRL) & IC_CTRL_CACHE_DISABLE) !=
+   IC_CTRL_CACHE_DISABLE;
+}
+
+void icache_enable(void)
+{
+   write_aux_reg(ARC_REG_IC_CTRL, read_aux_reg(ARC_REG_IC_CTRL) &
+ ~IC_CTRL_CACHE_DISABLE);
+}
+
+void icache_disable(void)
+{
+   write_aux_reg(ARC_REG_IC_CTRL, read_aux_reg(ARC_REG_IC_CTRL) |
+ IC_CTRL_CACHE_DISABLE);
+}
+
+void invalidate_icache_all(void)
+{
+#ifndef CONFIG_SYS_ICACHE_OFF
+   /* Any write to IC_IVIC register triggers invalidation of entire I$ */
+   write_aux_reg(ARC_REG_IC_IVIC, 1);
+#endif /* CONFIG_SYS_ICACHE_OFF */
+}
+
+int dcache_status(void)
+{
+   return (read_aux_reg(ARC_REG_DC_CTRL) & DC_CTRL_CACHE_DISABLE) !=
+   DC_CTRL_CACHE_DISABLE;
+}
+
+void dcache_enable(void)
+{
+   unsigned int temp = read_aux_reg(ARC_REG_DC_CTRL);
+   temp &= ~DC_CTRL_INV_MODE_FLUSH;
+   write_aux_reg(ARC_REG_DC_CTRL, temp & ~DC_CTRL_CACHE_DISABLE);
+}
+
+void dcache_disable(void)
+{
+   write_aux_reg(ARC_REG_DC_CTRL, read_aux_reg(ARC_REG_DC_CTRL) |
+ DC_CTRL_CACHE_DISABLE);
+}
+
+void flush_dcache_all(void)
+{
+   /* Do flush of entire

[U-Boot] [PATCH v2 6/9] arc: add Arcangel4 board support

2014-01-29 Thread Alexey Brodkin
Arcangel4 is a FPGA-based development board that is used for prototyping and
verificationof of both ARC hardware (CPUs) and software running upon CPU.

Prerequisite is http://patchwork.ozlabs.org/patch/300901/

Signed-off-by: Alexey Brodkin 

Cc: Mischa Jonker 
Cc: Francois Bedard 

Changes for v2:

 * Added commit message
---
 board/synopsys/arcangel4/Makefile|  7 +++
 board/synopsys/arcangel4/arcangel4.c | 25 ++
 boards.cfg   |  1 +
 include/configs/arcangel4.h  | 96 
 4 files changed, 129 insertions(+)
 create mode 100644 board/synopsys/arcangel4/Makefile
 create mode 100644 board/synopsys/arcangel4/arcangel4.c
 create mode 100644 include/configs/arcangel4.h

diff --git a/board/synopsys/arcangel4/Makefile 
b/board/synopsys/arcangel4/Makefile
new file mode 100644
index 000..f849750
--- /dev/null
+++ b/board/synopsys/arcangel4/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += arcangel4.o
diff --git a/board/synopsys/arcangel4/arcangel4.c 
b/board/synopsys/arcangel4/arcangel4.c
new file mode 100644
index 000..e2ffcd0
--- /dev/null
+++ b/board/synopsys/arcangel4/arcangel4.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_early_init_f(void)
+{
+   gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
+   gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+   return 0;
+}
+
+int board_early_init_r(void)
+{
+   gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+   gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+
+   return 0;
+}
diff --git a/boards.cfg b/boards.cfg
index 2dfd2b4..41269fe 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -1229,6 +1229,7 @@ Active  sparc   leon3  -   gaisler
 -
 Active  sparc   leon3  -   gaisler -   
gr_xc3s_1500 -  

   -
 Active  sparc   leon3  -   gaisler -   
grsim-  

   -
 Active  x86 x86corebootchromebook-x86  coreboot
coreboot-x86 coreboot:SYS_TEXT_BASE=0x0111  

   -
+Active  arc arc700 -   synopsysarcangel4   
arcangel4-  

   Alexey Brodkin 
 Orphan  arm arm1136mx31-   imx31_phycore   
imx31_phycore_eetimx31_phycore:IMX31_PHYCORE_EET

   (resigned) Guennadi Liakhovetski 
 Orphan  arm arm1136mx31freescale   -   
mx31ads  -  

   (resigned) Guennadi Liakhovetski 
 Orphan  arm pxa-   -   -   
lubbock  -  

   (dead address) Kyle Harris 
diff --git a/include/configs/arcangel4.h b/include/configs/arcangel4.h
new file mode 100644
index 000..3d415a0
--- /dev/null
+++ b/include/configs/arcangel4.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _CONFIG_ARCANGEL4_H_
+#define _CONFIG_ARCANGEL4_H_
+
+/*
+ *  CPU configuration
+ */
+#define CONFIG_ARC700
+#define CONFIG_ARC_MMU_VER 3
+#define CONFIG_SYS_CACHELINE_SIZE  64
+#define CONFIG_SYS_CLK_FREQ7000
+#define CONFIG_SYS_TIMER_RATE  CONFIG_SYS_CLK_FREQ
+
+/*
+ * Board configuration
+ */
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_SKIP_LOWLEVEL_INIT  /* U-Boot is in RAM already */
+
+#define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_EARLY_INIT_R
+
+/*
+ * Memory configuration
+ */
+#define CONFIG_SYS_TEXT_BASE   0x8100
+#define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_DDR_SDRAM_BASE  0x8000
+#define CONFIG_SYS_SDRAM_BASE  CONFIG_SYS_DDR_SDRAM_BASE
+#define CONFIG_SYS_SDRAM_SIZE  0x1000  

[U-Boot] [PATCH v2 0/9] Add support for the ARC700 architecture

2014-01-29 Thread Alexey Brodkin
This patch series adds support for the Synopsys DesignWare ARC700 architecture.

DesignWare ARC700 is family of 32-bit CPUs developed by Synopsys, Inc.

Since version 3.9 ARC architecture is supported in mainline Linux developemnt.
And now to get better support in commonly used boot-loader we are introducing
port of U-Boot for ARC700 CPUs.

Patches included in this series are also available on GitHub in the
'for-upstream-v2' branch:

g...@github.com:foss-for-synopsys-dwc-arc-processors/u-boot.git

Also browsable here:

https://github.com/foss-for-synopsys-dwc-arc-processors/u-boot/tree/for-upstream-v2

NOTE: there's an acked by Tom Rini prerequisite for Arcangel4 board:

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

For those who are interested in building this port please download pre-built
toolchains for x86_64 hosts.

For RedHat-based distros:
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-4.8-R2/arc_gnu_4.8-R2_prebuilt_uclibc_le_rhel6_install.tar.gz

For Debian-based distros:
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-4.8-R2/arc_gnu_4.8-R2_prebuilt_uclibc_le_ubuntu_install.tar.gz

Changes for v2:

 * Deleted unused empty file "asm/processor.h"
 * Added borrowed from Linux optimized string routines
 * Added commit messages for most of patches
 * Added explicit mention of files borrowed from Linux sources with
   reference to versoin/commit in Linux git repository


Alexey Brodkin (9):
  arc: add architecture header files
  arc: add cpu files
  arc: add library functions
  arc: bdinfo and image support
  arc: add support for standalone programs
  arc: add Arcangel4 board support
  arc: add AXS101 board support
  arc: add architecture to MAKEALL
  arc: add README for architecture

 MAKEALL |   6 +
 arch/arc/config.mk  |  31 +++
 arch/arc/cpu/arc700/Makefile|  13 ++
 arch/arc/cpu/arc700/cache.c | 161 ++
 arch/arc/cpu/arc700/config.mk   |   7 +
 arch/arc/cpu/arc700/cpu.c   |  37 
 arch/arc/cpu/arc700/interrupts.c| 211 ++
 arch/arc/cpu/arc700/reset.c |  19 ++
 arch/arc/cpu/arc700/start.S | 262 ++
 arch/arc/cpu/arc700/timer.c |  28 +++
 arch/arc/cpu/arc700/u-boot.lds  |  72 +++
 arch/arc/include/asm/arch-arc700/hardware.h |   0
 arch/arc/include/asm/arcregs.h  | 324 
 arch/arc/include/asm/bitops.h   |  19 ++
 arch/arc/include/asm/byteorder.h|  23 ++
 arch/arc/include/asm/cache.h|  23 ++
 arch/arc/include/asm/config.h   |  12 ++
 arch/arc/include/asm/errno.h|   1 +
 arch/arc/include/asm/global_data.h  |  19 ++
 arch/arc/include/asm/io.h   | 287 
 arch/arc/include/asm/linkage.h  |  63 ++
 arch/arc/include/asm/posix_types.h  |  73 +++
 arch/arc/include/asm/ptrace.h   | 101 +
 arch/arc/include/asm/sections.h |   1 +
 arch/arc/include/asm/string.h   |  27 +++
 arch/arc/include/asm/types.h|  55 +
 arch/arc/include/asm/u-boot.h   |  15 ++
 arch/arc/include/asm/unaligned.h|   1 +
 arch/arc/lib/Makefile   |  16 ++
 arch/arc/lib/bootm.c| 106 +
 arch/arc/lib/memcmp.S   | 122 +++
 arch/arc/lib/memcpy-700.S   |  64 ++
 arch/arc/lib/memset.S   |  59 +
 arch/arc/lib/relocate.c |  74 +++
 arch/arc/lib/sections.c |  21 ++
 arch/arc/lib/strchr-700.S   | 133 
 arch/arc/lib/strcmp.S   |  96 +
 arch/arc/lib/strcpy-700.S   |  70 ++
 arch/arc/lib/strlen.S   |  83 +++
 board/synopsys/arcangel4/Makefile   |   7 +
 board/synopsys/arcangel4/arcangel4.c|  25 +++
 board/synopsys/axs101/Makefile  |   8 +
 board/synopsys/axs101/axs101.c  |  61 ++
 board/synopsys/axs101/nand.c| 224 +++
 boards.cfg  |   2 +
 common/cmd_bdinfo.c |  18 ++
 common/image.c  |   1 +
 doc/README.ARC  |  27 +++
 examples/standalone/stubs.c |  13 ++
 include/configs/arcangel4.h |  96 +
 include/configs/axs101.h| 194 +
 include/image.h |   1 +
 52 files changed, 3412 insertions(+)
 create mode 100644 arch/arc/config.mk
 create mode 100644 arch/arc/cpu/arc700/Makefile
 create mode 100644 arch/arc/cpu/arc700/cache.c
 create mode

Re: [U-Boot] [PATCH v3 2/2] cosmetics: braces, comment and whitespace formatting Signed-off-by: Lothar Felten

2014-01-29 Thread Tom Rini
On Wed, Jan 29, 2014 at 04:39:03PM +0100, Lothar Felten wrote:

> Signed-off-by: Lothar Felten 
> ---
>  board/silica/pengwyn/board.c |   10 +-
>  include/configs/pengwyn.h|6 ++
>  2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
> index d5dbd3b..97d7de4 100644
> --- a/board/silica/pengwyn/board.c
> +++ b/board/silica/pengwyn/board.c
> @@ -77,11 +77,11 @@ const struct dpll_params dpll_ddr_400 = {
>  
>  void am33xx_spl_board_init(void)
>  {
> - /* the pengwyn board uses the TPS650250 PMIC  without I2C */
> - /* interface and will output the following fixed voltages: */
> - /* DCDC1=3V3 (IO) DCDC2=1V5 (DDR) DCDC3=1V26 (Vmpu) */
> - /* VLDO1=1V8 (IO) VLDO2=1V8(IO) */
> - /* Vcore=1V1 is fixed, generated by TPS62231 */
> + /* The pengwyn board uses the TPS650250 PMIC  without I2C
> +  * interface and will output the following fixed voltages:
> +  * DCDC1=3V3 (IO) DCDC2=1V5 (DDR) DCDC3=1V26 (Vmpu)
> +  * VLDO1=1V8 (IO) VLDO2=1V8(IO)
> +  * Vcore=1V1 is fixed, generated by TPS62231 */

Not quite right, and please squash this patch into the first one, in the
next posting.  Thanks.

-- 
Tom


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


Re: [U-Boot] [PATCH v3 1/2] initial support for pengwyn board

2014-01-29 Thread Tom Rini
On Wed, Jan 29, 2014 at 04:39:02PM +0100, Lothar Felten wrote:

[snip]
> +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_NOR_BOOT),y)
> +obj-y:= mux.o
> +endif

Here and elsewhere, correct these tests as you don't support
CONFIG_NOR_BOOT on this platform.

> + /* the pengwyn board uses the TPS650250 PMIC  without I2C */
> + /* interface and will output the following fixed voltages: */

/*
 * Like this
 * please.
 */

> +#ifdef CONFIG_BOARD_LATE_INIT
> +int board_late_init(void)
> +{
> + return 0;
> +}
> +#endif

Please do a pre-patch that moves CONFIG_BOARD_LATE_INIT from
 to the board ports, and then you can drop
this hunk.

> + "nandsrcaddr=0x28\0" \
> + "nandboot=echo Booting from nand ...; " \
> + "run nandargs; " \
> + "nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \
> + "bootz ${loadaddr}\0" \

(a) indentation is wrong (and a copy/pasted problem) and (b) you don't
handle the device tree here.

> + "spiboot=echo Booting from spi ...; " \
> + "run spiargs; " \
> + "sf probe ${spibusno}:0; " \
> + "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
> + "bootz ${loadaddr}\0" \

Same and unused?

> + "findfdt="\
> + "if test $board_name = A335BONE; then " \
> + "setenv fdtfile am335x-bone.dtb; fi; " \
> + "if test $board_name = A335BNLT; then " \
> + "setenv fdtfile am335x-boneblack.dtb; fi; " \
> + "if test $board_name = A33515BB; then " \
> + "setenv fdtfile am335x-evm.dtb; fi; " \
> + "if test $board_name = A335X_SK; then " \
> + "setenv fdtfile am335x-evmsk.dtb; fi; " \
> + "if test $fdtfile = undefined; then " \
> + "echo WARNING: no device tree found; fi; \0" \

Nonsense for this board.

Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] ARM: bcm2835: config.mk isn't needed

2014-01-29 Thread Tom Rini
On Wed, Jan 29, 2014 at 10:22:18AM +0100, Andreas Färber wrote:
> Hi,
> 
> Am 29.01.2014 06:42, schrieb Stephen Warren:
> > The entries in config.mk were needed so that U-Boot could be built
> > with an old version of the Raspberry Pi Foundation's toolchain. Without
> > them, the build would error out with:
> > 
> > ...-ld: error: .../libgcc.a(_bswapsi2.o) uses VFP register arguments,
> > u-boot does not
> > 
> > However, none of the 3 toolchains in the latest version of their
> > tools.git, nor the Ubuntu/Linaro ARM compilers in at least Ubuntu Quantal
> > or Saucy, need these options set in order to compile a working U-Boot.
> > Hence, remove the options for simplicity.
> > 
> > Reported-by: Tom Rini 
> > Signed-off-by: Stephen Warren 
> > ---
> >  arch/arm/cpu/arm1176/bcm2835/config.mk | 19 ---
> >  1 file changed, 19 deletions(-)
> >  delete mode 100644 arch/arm/cpu/arm1176/bcm2835/config.mk
> 
> No objection against the patch, but why was arch/arm/config.mk using
> -msoft-float in the first place? It's been changed from hardcoded to
> $(call cc-option ...)-wrapped [1], which may explain your experimental
> results, but IIUC it will still prefer -msoft-float if the compiler
> supports it [2] rather than if the SoC needs it, right? tegra20 for
> instance does support the hard-float ABI, too.

U-Boot for ARM _is_ soft-float.  There's some issue with an older RPi
foundation toolchain that causes what at first glance looks like an odd
choice of VFP using function to be used when it doesn't need to be.
That's not to say we cannot compile with an armhf-only toolchain.  We
can and I do daily.

-- 
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] mx6: Enable L2 cache support

2014-01-29 Thread Fabio Estevam
Hi Stefano,

On Wed, Jan 29, 2014 at 10:47 AM, Stefano Babic  wrote:
> Hi Dirk,
>
> On 28/01/2014 17:53, Dirk Behme wrote:
>
>>
>> Just for better understanding: Do you want to keep this intentionally
>> simple? Or is there any special reason why you don't set additional
>> (performance) registers here? E.g. the L2 PREFETCH and POWER registers,
>> and the tag and data latency settings? Like done in the kernel.
>
> This is a good point ! If it is true that  L2 PREFETCH is turned on in
> mainline kernel, but it was *explicitely* turned off by Jason in FSL
> Kernel with the patch with subject ENGR00278489 (ARM PL310 errata: 7522719).

Mainline kernel and recent FSL kernels (3.0.35 4.1.0 or 3.10.17) keep
L2 prefetch enabled.

Check this commit:
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/commit/?h=imx_3.0.35_4.1.0&id=517182a385808f60bf94e2361712d714f0a78a61

Regards,

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


Re: [U-Boot] [PATCH] ARM: bcm2835: config.mk isn't needed

2014-01-29 Thread Stephen Warren
On 01/29/2014 02:22 AM, Andreas Färber wrote:
> Hi,
> 
> Am 29.01.2014 06:42, schrieb Stephen Warren:
>> The entries in config.mk were needed so that U-Boot could be built
>> with an old version of the Raspberry Pi Foundation's toolchain. Without
>> them, the build would error out with:
>>
>> ...-ld: error: .../libgcc.a(_bswapsi2.o) uses VFP register arguments,
>> u-boot does not
>>
>> However, none of the 3 toolchains in the latest version of their
>> tools.git, nor the Ubuntu/Linaro ARM compilers in at least Ubuntu Quantal
>> or Saucy, need these options set in order to compile a working U-Boot.
>> Hence, remove the options for simplicity.
>>
>> Reported-by: Tom Rini 
>> Signed-off-by: Stephen Warren 
>> ---
>>  arch/arm/cpu/arm1176/bcm2835/config.mk | 19 ---
>>  1 file changed, 19 deletions(-)
>>  delete mode 100644 arch/arm/cpu/arm1176/bcm2835/config.mk
> 
> No objection against the patch, but why was arch/arm/config.mk using
> -msoft-float in the first place?

It wasn't. It was filtering -msoft-float out of the compiler flags,
which then left the ABI up to the toolchain default, which was hardfp
for one of the Raspberry Pi Foundation's toolchains - the same one that
caused the error messages quoted above unless -msoft-float was removed
from the compiler options.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/2] cosmetics: braces, comment and whitespace formatting Signed-off-by: Lothar Felten

2014-01-29 Thread Wolfgang Denk
Dear Lothar Felten,

In message <1391009943-8028-3-git-send-email-lothar.fel...@gmail.com> you wrote:
> Signed-off-by: Lothar Felten 
> ---
>  board/silica/pengwyn/board.c |   10 +-
>  include/configs/pengwyn.h|6 ++
>  2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
> index d5dbd3b..97d7de4 100644
> --- a/board/silica/pengwyn/board.c
> +++ b/board/silica/pengwyn/board.c
> @@ -77,11 +77,11 @@ const struct dpll_params dpll_ddr_400 = {
>  
>  void am33xx_spl_board_init(void)
>  {
> - /* the pengwyn board uses the TPS650250 PMIC  without I2C */
> - /* interface and will output the following fixed voltages: */
> - /* DCDC1=3V3 (IO) DCDC2=1V5 (DDR) DCDC3=1V26 (Vmpu) */
> - /* VLDO1=1V8 (IO) VLDO2=1V8(IO) */
> - /* Vcore=1V1 is fixed, generated by TPS62231 */
> + /* The pengwyn board uses the TPS650250 PMIC  without I2C
> +  * interface and will output the following fixed voltages:
> +  * DCDC1=3V3 (IO) DCDC2=1V5 (DDR) DCDC3=1V26 (Vmpu)
> +  * VLDO1=1V8 (IO) VLDO2=1V8(IO)
> +  * Vcore=1V1 is fixed, generated by TPS62231 */

This is still wrong.  Please see the example I gave in my previous
message, and/or read the Linux CodingStyle document.

Also, it does not make sense to first knowingly add bad code and then
fix it in a later patch of the same seirs - please squash your
patches.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
You see things; and you say ``Why?'' But I dream  things  that  never
were; and I say ``Why not?''
   - George Bernard Shaw _Back to Methuselah_ (1921) pt. 1, act 1
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/2] initial support for pengwyn board

2014-01-29 Thread Wolfgang Denk
Dear Lothar Felten,

In message <1391009943-8028-2-git-send-email-lothar.fel...@gmail.com> you wrote:
> Signed-off-by: Lothar Felten 

You still fail to provide a comit message here.

The comments in the cover letter may be helpful, but they will not
show up in the git log, i. e. they are lost.  We need this information
here.


> ---

This is patch version 3, and even though I explicitly pointed you at
the documentation, you fail to tell us here (below this little "---"
line) what exactly has been changed since version 2.  We don;t have
time and resources to compare your patch versions ourself to fuind out
which of the review commetns you might have addressed, or not.

Sorry, but my review stops here with a NAK (see the other message).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Programmer's Lament: (Shakespeare, Macbeth, Act I, Scene vii)
"That we but teach bloody instructions,
which, being taught, return to plague the inventor..."
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: bcm2835: config.mk isn't needed

2014-01-29 Thread Andreas Färber
Am 29.01.2014 19:38, schrieb Stephen Warren:
> On 01/29/2014 02:22 AM, Andreas Färber wrote:
>> Am 29.01.2014 06:42, schrieb Stephen Warren:
>>> The entries in config.mk were needed so that U-Boot could be built
>>> with an old version of the Raspberry Pi Foundation's toolchain. Without
>>> them, the build would error out with:
>>>
>>> ...-ld: error: .../libgcc.a(_bswapsi2.o) uses VFP register arguments,
>>> u-boot does not
>>>
>>> However, none of the 3 toolchains in the latest version of their
>>> tools.git, nor the Ubuntu/Linaro ARM compilers in at least Ubuntu Quantal
>>> or Saucy, need these options set in order to compile a working U-Boot.
>>> Hence, remove the options for simplicity.
>>>
>>> Reported-by: Tom Rini 
>>> Signed-off-by: Stephen Warren 
>>> ---
>>>  arch/arm/cpu/arm1176/bcm2835/config.mk | 19 ---
>>>  1 file changed, 19 deletions(-)
>>>  delete mode 100644 arch/arm/cpu/arm1176/bcm2835/config.mk
>>
>> No objection against the patch, but why was arch/arm/config.mk using
>> -msoft-float in the first place?
> 
> It wasn't. It was filtering -msoft-float out of the compiler flags,
> which then left the ABI up to the toolchain default, which was hardfp
> for one of the Raspberry Pi Foundation's toolchains - the same one that
> caused the error messages quoted above unless -msoft-float was removed
> from the compiler options.

You seem to have misread my question, it was not about bcm2835/config.mk
but about arm/config.mk, which bcm2835 was filtering.

I didn't quite get Tom's response about U-Boot being soft-float. It is
what I compile it to be, no? If I compile it with an hardfp toolchain
such as openSUSE's, without -msoft-float it is going to be hardfp IIUC.
softfp is for compatibility with non-VFP hardware I thought, but U-Boot
is clearly built with a per-board config, so it's not portable anyway.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4] mx6: Enable L2 cache support

2014-01-29 Thread Fabio Estevam
From: Fabio Estevam 

Add L2 cache support and enable it by default.

Configure the L2 cache in the same way as done by FSL kernel:
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/mach-mx6/mm.c?h=imx_3.0.35_4.1.0

Signed-off-by: Fabio Estevam 
---
Changes since v3:
- Enable l2 cache using the same method as the kernel
Changes since v2:
- Add L2_PL310_BASE definition in imx_regs.h
Changes since v1:
- Fx typo in commit log

 arch/arm/cpu/armv7/mx6/soc.c | 58 
 arch/arm/include/asm/arch-mx6/imx-regs.h |  1 +
 arch/arm/include/asm/pl310.h | 21 
 include/configs/mx6_common.h |  5 +++
 4 files changed, 85 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 0208cba..396bba5 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -8,6 +8,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -336,3 +338,59 @@ void imx_setup_hdmi(void)
writel(reg, &mxc_ccm->chsccdr);
 }
 #endif
+
+#ifndef CONFIG_SYS_L2CACHE_OFF
+#define IOMUXC_GPR11_L2CACHE_AS_OCRAM 0x0002
+void v7_outer_cache_enable(void)
+{
+   struct pl310_regs *const pl310 = (struct pl310_regs *)L2_PL310_BASE;
+   unsigned int val;
+
+#if defined CONFIG_MX6SL
+   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
+   val = readl(&iomux->gpr[11]);
+   if (val & IOMUXC_GPR11_L2CACHE_AS_OCRAM) {
+   /* L2 cache configured as OCRAM, reset it */
+   val &= ~IOMUXC_GPR11_L2CACHE_AS_OCRAM;
+   writel(val, &iomux->gpr[11]);
+   }
+#endif
+
+   writel(0x132, &pl310->pl310_tag_latency_ctrl);
+   writel(0x132, &pl310->pl310_data_latency_ctrl);
+
+   val = readl(&pl310->pl310_prefetch_ctrl);
+
+   /* Turn on the L2 I/D prefetch */
+   val |= 0x3000;
+
+   /*
+* The L2 cache controller(PL310) version on the i.MX6D/Q is r3p1-50rel0
+* The L2 cache controller(PL310) version on the i.MX6DL/SOLO/SL is r3p2
+* But according to ARM PL310 errata: 752271
+* ID: 752271: Double linefill feature can cause data corruption
+* Fault Status: Present in: r3p0, r3p1, r3p1-50rel0. Fixed in r3p2
+* Workaround: The only workaround to this erratum is to disable the
+* double linefill feature. This is the default behavior.
+*/
+
+#ifndef CONFIG_MX6Q
+   val |= 0x4080;
+#endif
+   writel(val, &pl310->pl310_prefetch_ctrl);
+
+   val = readl(&pl310->pl310_power_ctrl);
+   val |= L2X0_DYNAMIC_CLK_GATING_EN;
+   val |= L2X0_STNDBY_MODE_EN;
+   writel(val, &pl310->pl310_power_ctrl);
+
+   setbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
+}
+
+void v7_outer_cache_disable(void)
+{
+   struct pl310_regs *const pl310 = (struct pl310_regs *)L2_PL310_BASE;
+
+   clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
+}
+#endif /* !CONFIG_SYS_L2CACHE_OFF */
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index f2ad6e9..c2d210a 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -53,6 +53,7 @@
 #define GLOBAL_TIMER_BASE_ADDR  0x00A00200
 #define PRIVATE_TIMERS_WD_BASE_ADDR 0x00A00600
 #define IC_DISTRIBUTOR_BASE_ADDR0x00A01000
+#define L2_PL310_BASE  0x00A02000
 #define GPV0_BASE_ADDR  0x00B0
 #define GPV1_BASE_ADDR  0x00C0
 #define PCIE_ARB_BASE_ADDR  0x0100
diff --git a/arch/arm/include/asm/pl310.h b/arch/arm/include/asm/pl310.h
index f41ad8c..d4526af 100644
--- a/arch/arm/include/asm/pl310.h
+++ b/arch/arm/include/asm/pl310.h
@@ -12,6 +12,9 @@
 
 /* Register bit fields */
 #define PL310_AUX_CTRL_ASSOCIATIVITY_MASK  (1 << 16)
+#define L2X0_DYNAMIC_CLK_GATING_EN (1 << 1)
+#define L2X0_STNDBY_MODE_EN(1 << 0)
+#define L2X0_CTRL_EN   1
 
 struct pl310_regs {
u32 pl310_cache_id;
@@ -47,6 +50,24 @@ struct pl310_regs {
u32 pad9[1];
u32 pl310_clean_inv_line_idx;
u32 pl310_clean_inv_way;
+   u32 pad10[64];
+   u32 pl310_lockdown_dbase;
+   u32 pl310_lockdown_ibase;
+   u32 pad11[190];
+   u32 pl310_addr_filter_start;
+   u32 pl310_addr_filter_end;
+   u32 pad12[190];
+   u32 pl310_test_operation;
+   u32 pad13[3];
+   u32 pl310_line_data;
+   u32 pad14[7];
+   u32 pl310_line_tag;
+   u32 pad15[3];
+   u32 pl310_debug_ctrl;
+   u32 pad16[7];
+   u32 pl310_prefetch_ctrl;
+   u32 pad17[7];
+   u32 pl310_power_ctrl;
 };
 
 void pl310_inval_all(void);
diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h
index 514d634..eb107d3 100644
--- a/include/configs/mx6_common.h
+++ b/include/configs/mx6_common.h
@@ -22,4 +22,9 @@
 #define CONFIG_ARM_ERRATA_751472
 #de

Re: [U-Boot] [PATCH] ARM: bcm2835: config.mk isn't needed

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

On 01/29/2014 02:41 PM, Andreas Färber wrote:
> Am 29.01.2014 19:38, schrieb Stephen Warren:
>> On 01/29/2014 02:22 AM, Andreas Färber wrote:
>>> Am 29.01.2014 06:42, schrieb Stephen Warren:
 The entries in config.mk were needed so that U-Boot could be
 built with an old version of the Raspberry Pi Foundation's
 toolchain. Without them, the build would error out with:
 
 ...-ld: error: .../libgcc.a(_bswapsi2.o) uses VFP register
 arguments, u-boot does not
 
 However, none of the 3 toolchains in the latest version of
 their tools.git, nor the Ubuntu/Linaro ARM compilers in at
 least Ubuntu Quantal or Saucy, need these options set in
 order to compile a working U-Boot. Hence, remove the options
 for simplicity.
 
 Reported-by: Tom Rini  Signed-off-by: Stephen
 Warren  --- 
 arch/arm/cpu/arm1176/bcm2835/config.mk | 19
 --- 1 file changed, 19 deletions(-) delete
 mode 100644 arch/arm/cpu/arm1176/bcm2835/config.mk
>>> 
>>> No objection against the patch, but why was arch/arm/config.mk
>>> using -msoft-float in the first place?
>> 
>> It wasn't. It was filtering -msoft-float out of the compiler
>> flags, which then left the ABI up to the toolchain default, which
>> was hardfp for one of the Raspberry Pi Foundation's toolchains -
>> the same one that caused the error messages quoted above unless
>> -msoft-float was removed from the compiler options.
> 
> You seem to have misread my question, it was not about
> bcm2835/config.mk but about arm/config.mk, which bcm2835 was
> filtering.

No, I know what you said.

> I didn't quite get Tom's response about U-Boot being soft-float. It
> is what I compile it to be, no? If I compile it with an hardfp
> toolchain such as openSUSE's, without -msoft-float it is going to
> be hardfp IIUC. softfp is for compatibility with non-VFP hardware I
> thought, but U-Boot is clearly built with a per-board config, so
> it's not portable anyway.

This isn't quite correct.  U-Boot is like the kernel.  We say how
we're built and like the kernel, we are soft float (and unless the
board says we need it, we aren't thumb/thumb2 either).  That's why
arch/arm/config.mk (like arch/arm/Makefile in the kernel) enforces
- -msoft-float.

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

iQIcBAEBAgAGBQJS6Vq5AAoJENk4IS6UOR1WMCYQAIn6ki/N2ts1S27/PHuUqJRM
ogEvhpejaYv35GxKMqMvlz264r/8WCzXJHhATpjST3gP0NTgD5ATHJMIW0gvjMEi
F855bSr+lRo1bAbzdrn14bWprqCCSnKGQp3f5H4V1pt8Zck3g+lZay+9d+hwW/8k
SXylTjqhsCqseq5D+FdUbcuVZmeqUBbX3iM9kfPD9IvTaYDvEFDCj5JcFpQnM62h
Eo/i0id2hV9dTaeC2UPSBKZ0xyNajGZAMTrZTeSPNfHLnAjPyG1UVOl29V3LHME6
qwBmZwbtWhSJARaNW8HwT/6ngewetjyJdjb9hi4HGlBJDJtfJIH/XanBZOVaSW9B
jwmjpxF7n3drqODTKWb5GXOUkUbojPfKtWVvDsLKRuZgkpxUnTM208EL7aebQ1zs
N84FkiUsbcIBDwkLBtTLl8spE9ZFNk/LgGUnTiBe0oF3+GAxqC8rx8rz9kn8D5Xa
668k8uT0PiXCXtPM2PVQN7HTCIuUcaBRV4FOjJy6UNVS0QV96MY5Gnou44I0cmZH
OY5r3g4tekWpUOL1904Rur2KbhP01nhw4PPKZBU6q2Kk6zlA1BWNVEXN3lT+WY0g
wHtvD2vhS0MiBNpNBIhgeKghW3B/2SMUDbP1BEI1kq8pccLObA9kMluTjnaw7TPt
NOZs19lCtOsJKb3Ot5Mu
=Lob9
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/9] arc: add architecture header files

2014-01-29 Thread Wolfgang Denk
Dear Alexey Brodkin,

In message <1391011745-22239-2-git-send-email-abrod...@synopsys.com> you wrote:
> These are header files used by ARC700 architecture.
...
> +/* Build Configuration Registers */
> +#define ARC_REG_DCCMBASE_BCR 0x61/* DCCM Base Addr */
> +#define ARC_REG_CRC_BCR  0x62
> +#define ARC_REG_DVFB_BCR 0x64
> +#define ARC_REG_EXTARITH_BCR 0x65
> +#define ARC_REG_VECBASE_BCR  0x68
> +#define ARC_REG_PERIBASE_BCR 0x69
> +#define ARC_REG_FP_BCR   0x6B/* Single-Precision FPU */
> +#define ARC_REG_DPFP_BCR 0x6C/* Dbl Precision FPU */
> +#define ARC_REG_DCCM_BCR 0x74/* DCCM Present + SZ */
> +#define ARC_REG_TIMERS_BCR   0x75
> +#define ARC_REG_ICCM_BCR 0x78
> +#define ARC_REG_XY_MEM_BCR   0x79
> +#define ARC_REG_MAC_BCR  0x7a
> +#define ARC_REG_MUL_BCR  0x7b
> +#define ARC_REG_SWAP_BCR 0x7c
> +#define ARC_REG_NORM_BCR 0x7d
> +#define ARC_REG_MIXMAX_BCR   0x7e
> +#define ARC_REG_BARREL_BCR   0x7f
> +#define ARC_REG_D_UNCACH_BCR 0x6A

Are you sure that this should not become a C struct declaration?  This
looks much like offsets, and we so not allow a base address + offset
notation for device I/O ...

> +/* status32 Bits Positions */
> +#define STATUS_AE_BIT5   /* Exception active */
> +#define STATUS_DE_BIT6   /* PC is in delay slot */
> +#define STATUS_U_BIT 7   /* User/Kernel mode */
> +#define STATUS_L_BIT 12  /* Loop inhibit */

Please uses masks instead of bit numbers.  Bitfields are inherently
non-portable and dangerous.

> +/* These masks correspond to the status word(STATUS_32) bits */
> +#define STATUS_AE_MASK   (1< +#define STATUS_DE_MASK   (1< +#define STATUS_U_MASK(1< +#define STATUS_L_MASK(1< +/*
> + **
> + *  Inline ASM macros to read/write AUX Regs
> + *  Essentially invocation of lr/sr insns from "C"
> + */

Can we drop this "***" line?

> +#if 1
> +
> +#define read_aux_reg(reg)__builtin_arc_lr(reg)
> +
> +/* gcc builtin sr needs reg param to be long immediate */
> +#define write_aux_reg(reg_immed, val)\
> + __builtin_arc_sr((unsigned int)val, reg_immed)
> +
> +#else
> +
> +#define read_aux_reg(reg)\
...
> +#endif

This pretty long else branch is just dead code.  Please get rid of all
such "#if 1" or "#if 0" blocks in your code, globally.

> +#define READ_BCR(reg, into)  \
> +{\
> + unsigned int tmp;   \
> + tmp = read_aux_reg(reg);\
> + if (sizeof(tmp) == sizeof(into)) {  \
> + into = *((typeof(into) *)&tmp); \
> + } else {\
> + extern void bogus_undefined(void);  \
> + bogus_undefined();  \
> + }   \
> +}
> +
> +#define WRITE_BCR(reg, into) \
> +{\
> + unsigned int tmp;   \
> + if (sizeof(tmp) == sizeof(into)) {  \
> + tmp = (*(unsigned int *)(into));\
> + write_aux_reg(reg, tmp);\
> + } else  {   \
> + extern void bogus_undefined(void);  \
> + bogus_undefined();  \
> + }   \
> +}

Do we really need this?  No other architecture does anything like
that.  Can you not just use standard I/O accessors?

> +/* Helpers */
> +#define TO_KB(bytes) ((bytes) >> 10)
> +#define TO_MB(bytes) (TO_KB(bytes) >> 10)
> +#define PAGES_TO_KB(n_pages) ((n_pages) << (PAGE_SHIFT - 10))
> +#define PAGES_TO_MB(n_pages) (PAGES_TO_KB(n_pages) >> 10)

Please drop these.  The just make the code harder to read.

> +struct bcr_identity {
> +#ifdef CONFIG_CPU_BIG_ENDIAN
> + unsigned int chip_id:16, cpu_id:8, family:8;
> +#else
> + unsigned int family:8, cpu_id:8, chip_id:16;
> +#endif
> +};

Arghh... Please by all means try to avoid bitfields!  They are pure
evil and are strongly discouraged!

> +struct bcr_extn {
> +#ifdef CONFIG_CPU_BIG_ENDIAN
> + unsigned int pad:20, crc:1, ext_arith:2, mul:2, barrel:2, minmax:2,
> +  norm:2, swap:1;
> +#else
> + unsigned int swap:1, norm:2, minmax:2, barrel:2, mul:2, ext_arith:2,
> +  crc:1, pad:20;
> +#endif
> +};

Do you really need your own definition CONFIG_CPU_BIG_ENDIAN here?
Can you not use the existing standard defines instead?  If you do,
please keep inmind that all new CONFIG_ optins must be explained in
the README.

> +/* DSP Options Ref Manual */
> +struct bcr_e

Re: [U-Boot] [PATCH v2 2/9] arc: add cpu files

2014-01-29 Thread Wolfgang Denk
Dear Alexey Brodkin,

In message <1391011745-22239-3-git-send-email-abrod...@synopsys.com> you wrote:
> Signed-off-by: Alexey Brodkin 
> 
> Cc: Mischa Jonker 
> Cc: Francois Bedard 
> 
> No changes for v2.

This belongs into the comment section (below the "---" line), not into
the commit message.

> ---
...
> +int icache_status(void)
> +{
> + return (read_aux_reg(ARC_REG_IC_CTRL) & IC_CTRL_CACHE_DISABLE) !=
> + IC_CTRL_CACHE_DISABLE;
> +}
> +
> +void icache_enable(void)
> +{
> + write_aux_reg(ARC_REG_IC_CTRL, read_aux_reg(ARC_REG_IC_CTRL) &
> +   ~IC_CTRL_CACHE_DISABLE);
> +}


I missed this in patch # 1 - why do you need these read_aux_reg() /
write_aux_reg() macros?  Why cannot you use standard I/O accessors
instead?


> +/* STATUS32 register bits related to Interrupt Handling */
> +#define STATUS_E1_BIT1   /* Int 1 enable */
> +#define STATUS_E2_BIT2   /* Int 2 enable */
> +#define STATUS_A1_BIT3   /* Int 1 active */
> +#define STATUS_A2_BIT4   /* Int 2 active */
> +
> +#define STATUS_E1_MASK   (1< +#define STATUS_E2_MASK   (1< +#define STATUS_A1_MASK   (1< +#define STATUS_A2_MASK   (1< +int disable_interrupts(void)
> +{
> + int status = read_aux_reg(ARC_REG_STATUS32);
> + int state = (status | STATUS_E1_MASK | STATUS_E2_MASK) ? 1 : 0;
> + status &= ~(STATUS_E1_MASK | STATUS_E2_MASK);
> + __asm__("flag %0" : : "r" (status));
> + return state;
> +}

Please insert blankk line between declarations and code.  Please fix
globally.

> +void enable_interrupts(void)
> +{
> + unsigned int status = read_aux_reg(ARC_REG_STATUS32);
> + status |= STATUS_E1_MASK | STATUS_E2_MASK;
> + __asm__("flag %0" : : "r" (status));
> +}
> +
> +/*
> + * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25)
> + *   -Prints 3 regs per line and a CR.

Comment and code disagree: You print "\n", not "\r" !


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
GUIs  are  virtually  useless.  Learn  tools.  They're  configurable,
scriptable, automatable, cron-able, interoperable, etc. We don't need
no brain-dead winslurping monolithic claptrap.
   -- Tom Christiansen in 371140df@csnews
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/9] arc: add library functions

2014-01-29 Thread Wolfgang Denk
Dear Alexey Brodkin,

In message <1391011745-22239-4-git-send-email-abrod...@synopsys.com> you wrote:
> These are library functions used by ARC700 architecture.

checkpatch says:

WARNING: line over 80 characters
#610: FILE: arch/arc/lib/relocate.c:61:
+   debug("   %p: rom reloc %x, ram %p, value %x, 
limit %x\n",


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
 This message was made from 100% recycled electrons. 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/9] arc: add AXS101 board support

2014-01-29 Thread Wolfgang Denk
Dear Alexey Brodkin,

In message <1391011745-22239-8-git-send-email-abrod...@synopsys.com> you wrote:
> AXS101 is a new generation of devlopment boards from Synopsys that houses
> ASIC with ARC700 and lots of DesignWare peripherals:


> +#define  CONFIG_HOSTNAME axs101
> +#define  CONFIG_ETHADDR  4a:56:49:22:3e:43
> +#define  CONFIG_IPADDR   10.121.8.200
> +#define  CONFIG_SERVERIP 10.121.8.31
> +#define  CONFIG_GATEWAYIP10.121.8.1
> +#define  CONFIG_NETMASK  255.255.255.0

We do not allow any such fixed network parameters in the board config
headers.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Things are not as simple as they seem at first.- Edward Thorp
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC] [PATCH] omap3_beagle: fdt: xMA/B set hsusb2_power_reg active-high

2014-01-29 Thread Tom Rini
On Wed, Jan 29, 2014 at 08:51:27AM -0600, Robert Nelson wrote:
> On Tue, Jan 28, 2014 at 5:31 PM, Robert Nelson  
> wrote:
> > With the xM revision C, the DC control of the usb hub was inverted.
> >
> > By adding the enable-active-high property to hsusb2_power_reg, mainline 
> > omap3-beagle-xm.dtb
> > will now activiate properly activate the usb hub on older xMA/B varients.
> >
> > Signed-off-by: Robert Nelson 
> > CC: Tom Rini 
> > ---
> >  include/configs/omap3_beagle.h | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
> > index c58bc91..d7d63ce 100644
> > --- a/include/configs/omap3_beagle.h
> > +++ b/include/configs/omap3_beagle.h
> > @@ -249,6 +249,9 @@
> > "setenv fdtfile omap3-beagle-xm.dtb; fi; " \
> > "if test $fdtfile = undefined; then " \
> > "echo WARNING: Could not determine device tree to 
> > use; fi; \0" \
> > +   "fixfdt=" \
> > +   "if test $beaglerev = xMAB; then " \
> > +   "fdt addr ${fdtaddr}; fdt resize; fdt set 
> > /hsusb2_power_reg enable-active-high; fi; \0" \
> > "bootenv=uEnv.txt\0" \
> > "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
> > "importbootenv=echo Importing environment from mmc ...; " \
> > @@ -308,6 +311,7 @@
> > "setenv bootfile zImage;" \
> > "if run loadimage; then " \
> > "run loadfdt;" \
> > +   "run fixfdt;" \
> > "run mmcbootz; " \
> > "fi; " \
> >
> > --
> > 1.8.5.3
> 
> I've listed this as an RFC, as i'm not sure if there is a generic way
> we should be doing device tree fixup's in u-boot.
> 
> I have thought about splitting omap3-beagle-xm.dtb into two variants
> "ab" and "c" with just a simple one line delta:
> 
> https://github.com/RobertCNelson/armv7-multiplatform/blob/v3.13.x/patches/omap3_beagle_xm_rework/0002-ARM-dts-omap3-beagle-xm-ab-usb-host-is-active-high-t.patch
> 
> But it's just so trivial to just fix it in u-boot instead.
> 
> Thoughts?

Well, we have per-platform fixups in the tree today.  However this now
means that only u-boot is going to provide a correct and fully
functional tree for those revs, which isn't good imho for the
beagleboard community use cases of older u-boots / distro support /
non-u-boot bootloader support, so it'd probably be best to have per rev
DTs and update findfdt to use the right one.

-- 
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 3/3] PPC 85xx: Add qemu-ppce500 machine

2014-01-29 Thread York Sun
On 01/24/2014 06:19 AM, Alexander Graf wrote:
> Hrm, let me try that.
> 

Looks you got plenty feedback from Scott. I am going to mark this set as "change
requested" so they will drop off from my to-do list. Please submit a v2 when
they are ready (all three patches together) with change log.

York


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


Re: [U-Boot] [PATCH] fsl_esdhc: Add Auto command 12 interrupt bit detecting

2014-01-29 Thread York Sun
On 11/01/2013 12:47 AM, Zhang Haijun wrote:
> :-)
> 
> Thanks.
> 
> 于 2013/11/1 15:45, Pantelis Antoniou 写道:
>> Hi Zhang,
>>
>> I'll take a look at it over the weekend.
>>
>> Regards
>>
>> -- Pantelis
>>

Where are we on this patch?

York

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


Re: [U-Boot] [PATCH V2] disk:efi: avoid unaligned access on efi partition

2014-01-29 Thread Tom Rini
On Tue, Jan 28, 2014 at 01:46:52PM +0100, Piotr Wilczek wrote:

> This patch fixes part_efi code to avoid unaligned access exception
> on some ARM platforms.
> 
> Signed-off-by: Piotr Wilczek 
> Signed-off-by: Kyungmin Park 
> CC: Tom Rini 
> CC: Albert ARIBAUD 
> ---
> Chnages for V2:
>  - used put_unaligned to copy value;
>  - use __aligned to align local array;
> 
>  disk/part_efi.c |7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Sorry.  After re-reading the thread here again I've posted a patch to
globally switch to -mno-unaligned-access for our armv7 tunes instead.
Thanks for your effort however!

-- 
Tom


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


Re: [U-Boot] [RFC] [PATCH] omap3_beagle: fdt: xMA/B set hsusb2_power_reg active-high

2014-01-29 Thread Robert Nelson
> Well, we have per-platform fixups in the tree today.  However this now
> means that only u-boot is going to provide a correct and fully
> functional tree for those revs, which isn't good imho for the
> beagleboard community use cases of older u-boots / distro support /
> non-u-boot bootloader support, so it'd probably be best to have per rev
> DTs and update findfdt to use the right one.

Thanks Tom,

The thing is, usb has been broken on the xMA/B's ever since we first
setup findfdt to use the omap3-beagle-xm.dtb.  Although the usb ehci
port was finally fixed in v3.13-rcX, so nobody really noticed these
pre-xMC's where broken in the first place.

That's why I thought it made more sense to fix it in u-boot, as we
then get mainline v3.13.x working out of the box for free. (if the
distro upgrades u-boot) Otherwise all distro's need to carry a kernel
patch for v3.13/v3.14 adding a new omap3-beagle-xm-ab.dtb variant.

I can go either way, as i've been pushing out images with the *-ab.dtb
/ *-c.dtb variants running v3.12/v3.13 to the beagleboard community.
But while updating my base image to v2014.01, i thought pushing it to
u-boot might be better in the long run.

Regards,

-- 
Robert Nelson
http://www.rcn-ee.com/
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] u-boot spl with fat32 on arm

2014-01-29 Thread Tom Rini
On Tue, Jan 28, 2014 at 03:23:23PM +0100, Michal Simek wrote:

> Hi guys,
> 
> I do play a little bit with u-boot spl and I am curious
> about fat32 implementation. There is MAX_CLUSTSIZE which is 65k
> and there are 3 buffers in fat.c code
> do_fat_read_at_block
> get_contents_vfatname_block
> get_dentfromdir_block
> 
> All these 3 are placed to bss section.
> I have just 192k of memory for SPL that's why I tried 2 things
> 1. Place these 3 fat arrays to different memory which is working fine
> 2. Decrease MAX_CLUSTSIZE to any low value (I do use 8k).
> 
> Unfortunately if I decrease MAX_CLUSTSIZE and add them to bss section
> SPL doesn't work. If I add them to a different section in front of
> or behind bss everything is just fine.
> 
> That's why I have a question where can be the problem in this behaviour
> that keeping 8k MAX_CLUSTSIZE in bss section doesn't work
> and keeping 8k MAX_CLUSTSIZE out of bss section works.
> 
> bss relocation is not done in SPL.

To be clear, are you saying you cannot do this in your case?  We support
CONFIG_SPL_BSS_START_ADDR / CONFIG_SPL_BSS_MAX_SIZE which is how on TI
platforms for example we put BSS into DDR, as we've configured that
before needing BSS.

-- 
Tom


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


Re: [U-Boot] [PATCH 2/2] powerpc/t2081qds: Add T2081 QDS board support

2014-01-29 Thread York Sun
On 01/20/2014 10:15 PM, Shengzhou Liu wrote:
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -973,11 +973,16 @@ Active  powerpc mpc85xx-   
> freescale   t4qds
>  Active  powerpc mpc85xx-   freescale   t1040qds  
>   T1040QDS T1040QDS:PPC_T1040 
>   
>   Poonam Aggrwal 
>  Active  powerpc mpc85xx-   freescale   t104xrdb  
>   T1040RDB T1040RDB:PPC_T1040 
>   
>   Poonam Aggrwal  
>  Active  powerpc mpc85xx-   freescale   t104xrdb  
>   T1042RDB_PI  T1042RDB_PI:PPC_T1042  
>   
>   Poonam Aggrwal  
> -Active  powerpc mpc85xx-   freescale   t2080qds  
>   T2080QDS  T2080QDS:PPC_T2080
> -Active  powerpc mpc85xx-   freescale   t2080qds  
>   T2080QDS_SDCARD   
> T2080QDS:PPC_T2080,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF8
> -Active  powerpc mpc85xx-   freescale   t2080qds  
>   T2080QDS_SPIFLASH 
> T2080QDS:PPC_T2080,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF8
> -Active  powerpc mpc85xx-   freescale   t2080qds  
>   T2080QDS_NAND 
> T2080QDS:PPC_T2080,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF8
> -Active  powerpc mpc85xx-   freescale   t2080qds  
>   T2080QDS_SRIO_PCIE_BOOT  
> T2080QDS:PPC_T2080,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2080QDS  T208xQDS:PPC_T2080
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2080QDS_SDCARD   T208xQDS:PPC_T2080, 
> RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2080QDS_SPIFLASH T208xQDS:PPC_T2080, 
> RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2080QDS_NAND T208xQDS:PPC_T2080, 
> RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2080QDS_SRIO_PCIE_BOOT  
> T208xQDS:PPC_T2080,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2081QDS  T208xQDS:PPC_T2081
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2081QDS_SDCARD   T208xQDS:PPC_T2081, 
> RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2081QDS_SPIFLASH T208xQDS:PPC_T2081, 
> RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2081QDS_NAND T208xQDS:PPC_T2081, 
> RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF8
> +Active  powerpc mpc85xx-   freescale   t208xqds  
>   T2081QDS_SRIO_PCIE_BOOT  T208xQDS:PPC_T2081, 
> SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF8
>  Active  powerpc mpc85xx-   gdsys   p1022 
>   controlcenterd_36BIT_SDCARD  controlcenterd:36BIT,SDCARD
>   
>  Dirk Eibach 
>  Active  powerpc mpc85xx-   gdsys   p1022 
>   controlcenterd_36BIT_SDCARD_DEVELOP  
> controlcenterd:36BIT,SDCARD,DEVELOP   
> Dirk Eibach 
> 
>  Active  powerpc mpc85xx-   gdsys   p1022 
>   controlcenterd_TRAILBLAZER   
> controlcenterd:TRAILBLAZER,SPIFLASH   
> Dirk Eibach 
> 

Shengzhou,

Do you want to update this patch to use 768KB size?

York


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


  1   2   >