Re: [U-Boot] [PATCH V2 5/8] board:samsung:universal: add env variables describing platform

2014-01-23 Thread Przemyslaw Marczak

Hello Piotr,

On 01/22/2014 03:54 PM, Piotr Wilczek wrote:

This patch adds variables describing platform (soc, board, vendor)
to default environment.

Signed-off-by: Piotr Wilczek 
Signed-off-by: Kyungmin Park 
Cc: Przemyslaw Marczak 
---
Changes for V2:
  - rebased on patchset [PATCH v6 00/11] Introduce Samsung misc file and LCD 
menu

  board/samsung/universal_c210/universal.c |3 +++
  include/configs/s5pc210_universal.h  |3 +++
  2 files changed, 6 insertions(+)

diff --git a/board/samsung/universal_c210/universal.c 
b/board/samsung/universal_c210/universal.c
index 98b387f..5ce74b7 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -516,6 +516,9 @@ int board_init(void)
  #ifdef CONFIG_MISC_INIT_R
  int misc_init_r(void)
  {
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+   set_board_info();
+#endif
  #ifdef CONFIG_LCD_MENU
keys_init();
check_boot_mode();
diff --git a/include/configs/s5pc210_universal.h 
b/include/configs/s5pc210_universal.h
index bfb044b..67921e9 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -124,6 +124,9 @@
  #define CONFIG_SYS_CONSOLE_INFO_QUIET
  #define CONFIG_SYS_CONSOLE_IS_IN_ENV

+#define CONFIG_ENV_VARS_UBOOT_CONFIG
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+
  #define CONFIG_EXTRA_ENV_SETTINGS \
"updateb=" \
"onenand erase 0x0 0x10;" \



Acked-by: Przemyslaw Marczak 

--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] POST in u-boot for P2020 process

2014-01-23 Thread pshambhu
Hi,

I am interested in performing POST (Power On Self Test ) operation in
u-boot. As soon as the system starts booting , it should perform some basic
functionality Testing,

- Cache test
- Memory Test
- RAM test
- I2C test
- SPI Test
- Ethernet Test
- UART test
- Watch Dog Timer Test


Please let me know the changes required in U-boot Code to perform POST
operation while System bootup.


Thanks & Regards
Pradeep S



--
View this message in context: 
http://u-boot.10912.n7.nabble.com/POST-in-u-boot-for-P2020-process-tp172115.html
Sent from the U-Boot mailing list archive at Nabble.com.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 1/8] arm:exynos: add cpu revision

2014-01-23 Thread Wolfgang Denk
Dear Piotr Wilczek,

In message <1390402477-24340-2-git-send-email-p.wilc...@samsung.com> you wrote:
> This patch enables to read cpu revision on Exynos CPU.

Sorry,  you really need to refactor your patches.

In this commit you add references to "s5p_cpu_id":

> @@ -196,10 +198,12 @@ static inline void s5p_set_cpu_id(void)
>   case 0x210:
>   /* Exynos4210 EVT1 */
>   s5p_cpu_id = 0x4210;
> + s5p_cpu_rev = cpu_rev;
>   break;
>   case 0x412:
>   /* Exynos4412 */
>   s5p_cpu_id = 0x4412;
> + s5p_cpu_rev = cpu_rev;
>   break;
>   case 0x520:
>   /* Exynos5250 */

But this variable does not exist anywhere.  It is only added in the
next patch.  Adding this patch causes build breakage, i. e. your patch
series is not bisectable.

Please fix!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"If that makes any sense to you, you have a big problem."
  -- C. Durance, Computer Science 234
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] POST in u-boot for P2020 process

2014-01-23 Thread Wolfgang Denk
Dear pshambhu,

In message <1390469712091-172115.p...@n7.nabble.com> you wrote:
> 
> I am interested in performing POST (Power On Self Test ) operation in
> u-boot. As soon as the system starts booting , it should perform some basic
> functionality Testing,
> 
> - Cache test
> - Memory Test
> - RAM test
> - I2C test
> - SPI Test
> - Ethernet Test
> - UART test
> - Watch Dog Timer Test
> 
> 
> Please let me know the changes required in U-boot Code to perform POST
> operation while System bootup.

You have to implement the required tests for your hardware (unless
these already exist) and then enable them in your board config file;
please see doc/README.POST for details.

BTW: running these tests always for each and every boot is probably a
very bad idea, as some of these testes are pretty expensive in terms
of time needed.  Also, some may have specific requirements to the
hardware configuration (like there must [or nust not] be network
cable attached, etc.).

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
Be careful what you wish for. You never know who will be listening.
  - Terry Pratchett, _Soul Music_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 2/2] boards.cfg: Delete the equivalent entries

2014-01-23 Thread Masahiro Yamada
There are some entries which produce the same binaries:
 - ep8248E   is equivalent to ep8248
 - MPC8360ERDK_66is equivalent to MPC8360ERDK
 - Adder87x/AdderUSB is equivalent to Adder
 - EVB64260_750CXis equivalent to EVB64260

I also notice
 - Lite5200   is equivalent to icecube_5200
 - Lite5200_LOWBOOT   is equivalent to icecube_5200_LOWBOOT
 - Lite5200_LOWBOOT08 is equivalent to icecube_5200_LOWBOOT08
But I am keeping them.
(Wolfgang suggested to do so because Lite5200* are referenced
in misc documents.)

Signed-off-by: Masahiro Yamada 
---

Changes in v4: None
Changes in v3:
  - Fix a typo in commit log

Changes in v2:
  - Do not delete Lite5200*

 boards.cfg | 5 -
 1 file changed, 5 deletions(-)

diff --git a/boards.cfg b/boards.cfg
index ee2f53e..0bbb0ec 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -663,7 +663,6 @@ Active  powerpc mpc8260-   -
   cpu86
 Active  powerpc mpc8260-   -   cpu87   
CPU87-  

   -
 Active  powerpc mpc8260-   -   cpu87   
CPU87_ROMBOOTCPU87:BOOT_ROM 

   -
 Active  powerpc mpc8260-   -   ep8248  
ep8248   -  

   Yuli Barcohen 
-Active  powerpc mpc8260-   -   ep8248  
ep8248E  ep8248 

   Yuli Barcohen 
 Active  powerpc mpc8260-   -   ids8247 
IDS8247  -  

   Heiko Schocher 
 Active  powerpc mpc8260-   -   iphase4539  
IPHASE4539   -  

   Wolfgang Grandegger 
 Active  powerpc mpc8260-   -   ispan   
ISPAN-  

   Yuli Barcohen 
@@ -753,7 +752,6 @@ Active  powerpc mpc83xx-   freescale
   mpc8360emds
 Active  powerpc mpc83xx-   freescale   mpc8360emds 
MPC8360EMDS_66_SLAVE MPC8360EMDS:CLKIN_66MHZ,PCI,PCISLAVE   

   Dave Liu 
 Active  powerpc mpc83xx-   freescale   mpc8360erdk 
MPC8360ERDK  -  

   Anton Vorontsov 
 Active  powerpc mpc83xx-   freescale   mpc8360erdk 
MPC8360ERDK_33   MPC8360ERDK:CLKIN_33MHZ

   Anton Vorontsov 
-Active  powerpc mpc83xx-   freescale   mpc8360erdk 
MPC8360ERDK_66   MPC8360ERDK

   Anton Vorontsov 
 Active  powerpc mpc83xx-   freescale   mpc837xemds 
MPC837XEMDS  -  

   Dave Liu 
 Active  powerpc mpc83xx-   freescale   mpc837xemds 
MPC837XEMDS_HOST MPC837XEMDS:PCI

   Dave Liu 
 Active  powerpc mpc83xx-   freescale   mpc837xerdb 
MPC837XERDB  -  

   Joe D'Abbraccio 
@@ -1010,9 +1008,7 @@ Active  powerpc mpc8xx -   -  
 -
 Active  powerpc mpc8xx -   -   -   
svm_sc8xx-   

[U-Boot] [PATCH v4 0/2] Refactoring of boards.cfg

2014-01-23 Thread Masahiro Yamada


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

Changes in v3:
  - Rebase on the current u-boot/master
  - Fix a typo in commit log

Changes in v2:
  - Do not delete Lite5200*

Masahiro Yamada (2):
  boards.cfg: Place "-" in the 8th field if it is the same as 7th
  boards.cfg: Delete the equivalent entries

 boards.cfg | 85 +-
 1 file changed, 40 insertions(+), 45 deletions(-)

-- 
1.8.3.2

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


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

2014-01-23 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 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 aa5f664..5e23a11 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 v6 30/38] kbuild: refactor Makefile and spl/Makefile more

2014-01-23 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 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, 142 insertions(+), 134 deletions(-)

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

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

2014-01-23 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 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 v6 10/38] kbuild: import Kbuild.include from linux v3.13 tag

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

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)))
+
+# cc-version
+# Usage gcc-ver := 

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

2014-01-23 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 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 v6 34/38] kbuild: support simultaneous board configuration and "make all"

2014-01-23 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

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

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

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


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

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

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 v6 33/38] kbuild: use scripts/Makefile.clean

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

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

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

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

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

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

Signed-off-by: Masahiro Yamada 
---

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 v6 38/38] tools/env: cross-compile fw_printenv without setting HOSTCC

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

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

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

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

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

2014-01-23 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 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 examples/standalone/Makefile
diff --git a/spl/M

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

2014-01-23 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 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 v6 22/38] kbuild: delete temporary build scripts

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

Signed-off-by: Masahiro Yamada 
---

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 use custom optimize flags on a per dir/f

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

2014-01-23 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 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 v6 24/38] kbuild: convert some make rules to Kbuild style

2014-01-23 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 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)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \

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

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

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

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

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

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


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

2014-01-23 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

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

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

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

2014-01-23 Thread Masahiro Yamada

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

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

 Kbuild without Kconfig
 --

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

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

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

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

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

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

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

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

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

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

 Prerequisite
 

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

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

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

 How to Build ?
 --

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

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

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

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

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

This series keeps the other features:

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

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

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

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

 My Next Plan
 

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

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

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

 Note
 

 - I marked dirty parts with "FIX ME".

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

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

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

Changes for v6:
   - Rebase on the current u-boot/master
   - Linux Kernel 3.13 was released on Jan. 20, so import build scripts
 from v3.13 to be breeding edge.
   - Minor change in post/lib_powerpc/fpu/Makefile
   - Include cmd_files under nand_spl/board/*/*/Makefile

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

2014-01-23 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 v6: None
Changes in v5:
  - Rebase on the current u-boot/master

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

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

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

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


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

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

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

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

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

2014-01-23 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 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 v6 32/38] Makefile: refactor tools-all targets

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

Signed-off-by: Masahiro Yamada 
---

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

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

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

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

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


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

2014-01-23 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 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 | 288 ---
 1 file changed, 167 insertions(+), 121 deletions(-)

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

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

2014-01-23 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

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

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

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


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

2014-01-23 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 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 v6 03/38] tools: convert makefiles to kbuild style

2014-01-23 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 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
 
 #
 # Mac OS X / Darwin's C preprocessor 

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

2014-01-23 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

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

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

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


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

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

Signed-off-by: Masahiro Yamada 
---

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 v6 05/38] examples: Use scripts/Makefile.build

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

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)%: $(obj)%.o $(LIB)

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

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

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

Signed-off-by: Masahiro Yamada 
---

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

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

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

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

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

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 
b/nand_spl/board/freescale/mpc8315erdb/

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

2014-01-23 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 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 v6 23/38] kbuild: move some lines to more suitable place

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

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 v6 02/38] Makefile.host.tmp: add a new script to refactor tools

2014-01-23 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 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 list
U-Boot@lists.denx.de
http://lists.den

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

2014-01-23 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 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 v6 26/38] kbuild: generate {spl, tpl}-autoconf.mk only when it is necessary

2014-01-23 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 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 5e23a11..48f1200 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 v6 35/38] kbuild: check clean source and generate Makefile for out-of-tree build

2014-01-23 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 v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
  - Newly added

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

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

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


[U-Boot] U-Boot execution sequence

2014-01-23 Thread JYOTI DUBEY
Can anyone tell how to understand the flow of u-boot source code? I am
working on ARM processor and the board used is Nitrogen6X.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] PPC 85xx: Detect e500v2 / e500mc during runtime

2014-01-23 Thread Alexander Graf

On 21.01.2014, at 03:25, Scott Wood  wrote:

> On Sun, 2014-01-19 at 16:19 +0100, Alexander Graf wrote:
>> With the qemu-ppce500 machine type we can run the same board with
>> either an e500v2 or an e500mc core plugged in.
>> 
>> This means that the IVOR setup can't be based on compile time decisions,
>> so instead we have to do a runtime check which CPU generation we're
>> running on.
> 
> Is this really the only place where you ran into this?

Yup. At least the only place where the difference actually matters for a VM.

> Also consider that you'll be adding extra size, and some of our 85xx
> targets are pretty close to the limit as is (though at least this code
> isn't used in SPLs).
> 
> I guess nobody ever bothered to set IVORs for e6500-specific exceptions.
> 
> For that matter, I don't see why we need this code at all.  These aren't
> the addresses that U-Boot keeps its exception vectors at; it's setting
> them up for the OS, apparently trying to imitate some other type of
> book3e chip that has fixed ivors.  Apparently U-Boot has done this only
> since 2009 (commit 26f4cdba6b51deab4ec99d60be381244068ef950), so it's
> not even something that an OS could depend on (and certainly Linux
> doesn't).  So I don't see the point.

Kumar, do you remember why you put this in? Was it only for prototyping 
purposes?

I certainly wouldn't mind removing the whole thing altogether.


Alex

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


[U-Boot] [PATCH v3 1/2] env_mmc: make board configurable the partition for the environment

2014-01-23 Thread Hector Palacios
This complements commit 9404a5fc7cb58 "env_mmc: allow environment to be
in an eMMC partition" by allowing boards to accommodate the partition
to use for the environment in different scenarios (similarly to what is
done with the mmc dev number). Depending on the detected boot media,
boards may decide to store the environment in a different partition.

The __weak function also allows to remove some ifdefs from the code.
If CONFIG_SYS_MMC_ENV_PART is not defined, partition 0 is assumed
(default value for U-Boot when a partition is not provided).

Signed-off-by: Hector Palacios 
Reviewed-by: Stephen Warren 
---

Notes:
Changes since v2:
- Move CONFIG_SYS_MMC_ENV_PART to config_fallbacks
Changes since v1:
- Use default define if not set

 common/env_mmc.c   | 25 +
 include/config_fallbacks.h |  6 ++
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/common/env_mmc.c b/common/env_mmc.c
index 78c2bc7a1f08..8dbeb057a3c4 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -66,6 +66,11 @@ __weak int mmc_get_env_devno(void)
return CONFIG_SYS_MMC_ENV_DEV;
 }
 
+__weak int mmc_get_env_partno(void)
+{
+   return CONFIG_SYS_MMC_ENV_PART;
+}
+
 int env_init(void)
 {
/* use default */
@@ -77,6 +82,9 @@ int env_init(void)
 
 static int init_mmc_for_env(struct mmc *mmc)
 {
+   int mmc_env_devno = mmc_get_env_devno();
+   int mmc_env_partno = mmc_get_env_partno();
+
if (!mmc) {
puts("No MMC card found\n");
return -1;
@@ -87,30 +95,23 @@ static int init_mmc_for_env(struct mmc *mmc)
return -1;
}
 
-#ifdef CONFIG_SYS_MMC_ENV_PART
-   if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num) {
-   int mmc_env_devno = mmc_get_env_devno();
-
-   if (mmc_switch_part(mmc_env_devno,
-   CONFIG_SYS_MMC_ENV_PART)) {
+   if (mmc_env_partno != mmc->part_num) {
+   if (mmc_switch_part(mmc_env_devno, mmc_env_partno)) {
puts("MMC partition switch failed\n");
return -1;
}
}
-#endif
 
return 0;
 }
 
 static void fini_mmc_for_env(struct mmc *mmc)
 {
-#ifdef CONFIG_SYS_MMC_ENV_PART
int mmc_env_devno = mmc_get_env_devno();
+   int mmc_env_partno = mmc_get_env_partno();
 
-   if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num)
-   mmc_switch_part(mmc_env_devno,
-   mmc->part_num);
-#endif
+   if (mmc_env_partno != mmc->part_num)
+   mmc_switch_part(mmc_env_devno, mmc->part_num);
 }
 
 #ifdef CONFIG_CMD_SAVEENV
diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
index e59ee963f71f..7a6f55feb12e 100644
--- a/include/config_fallbacks.h
+++ b/include/config_fallbacks.h
@@ -53,4 +53,10 @@
 #define HAVE_BLOCK_DEVICE
 #endif
 
+#if defined(CONFIG_MMC)
+#if !defined(CONFIG_SYS_MMC_ENV_PART)
+#define CONFIG_SYS_MMC_ENV_PART 0
+#endif
+#endif
+
 #endif /* __CONFIG_FALLBACKS_H */
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/2] config_fallbacks: default CONFIG_SYS_MMC_ENV_DEV to 0

2014-01-23 Thread Hector Palacios
Since function mmc_get_env_devno is __weak and can be overridden by
board code, boards do not need to mandatory define
CONFIG_SYS_MMC_ENV_DEV.
If the constant is not defined, define it to 0 by default.

Signed-off-by: Hector Palacios 
Reviewed-by: Stephen Warren 
---

Notes:
Changes since v2:
- Move CONFIG_SYS_MMC_ENV_DEV to config_fallbacks
Changes since v1:
- Use default define if not set

 include/config_fallbacks.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
index 7a6f55feb12e..b17fb28d90b9 100644
--- a/include/config_fallbacks.h
+++ b/include/config_fallbacks.h
@@ -54,6 +54,9 @@
 #endif
 
 #if defined(CONFIG_MMC)
+#if !defined(CONFIG_SYS_MMC_ENV_DEV)
+#define CONFIG_SYS_MMC_ENV_DEV 0
+#endif
 #if !defined(CONFIG_SYS_MMC_ENV_PART)
 #define CONFIG_SYS_MMC_ENV_PART 0
 #endif
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2014-01-23 Thread Abraham Varricatt
On Thu, Jan 23, 2014 at 3:48 PM, JYOTI DUBEY  wrote:
> Can anyone tell how to understand the flow of u-boot source code? I am
> working on ARM processor and the board used is Nitrogen6X.

Ideally, it would be best to have a JTAG debugger and step through the
execution. A quick-and-dirty approach, is to sprinkle printf()
statements after your serial console has been initialized.

Off-topic, but for sake of understanding u-boot in general, I'm using
the gdb debugger and tracing over the sandbox build (it configures
u-boot as a normal linux application). Alternatively, if you can
figure out how to use qemu with ARM, that might give you a better idea
for your board, instead of following what x86 does. Sadly, I couldn't
get qemu-arm working with uboot even after months of trying. :(

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


Re: [U-Boot] [PATCH v3 1/2] env_mmc: make board configurable the partition for the environment

2014-01-23 Thread Otavio Salvador
On Thu, Jan 23, 2014 at 10:39 AM, Hector Palacios
 wrote:
> This complements commit 9404a5fc7cb58 "env_mmc: allow environment to be
> in an eMMC partition" by allowing boards to accommodate the partition
> to use for the environment in different scenarios (similarly to what is
> done with the mmc dev number). Depending on the detected boot media,
> boards may decide to store the environment in a different partition.
>
> The __weak function also allows to remove some ifdefs from the code.
> If CONFIG_SYS_MMC_ENV_PART is not defined, partition 0 is assumed
> (default value for U-Boot when a partition is not provided).
>
> Signed-off-by: Hector Palacios 
> Reviewed-by: Stephen Warren 

Acked-by: Otavio Salvador 


-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/2] config_fallbacks: default CONFIG_SYS_MMC_ENV_DEV to 0

2014-01-23 Thread Otavio Salvador
On Thu, Jan 23, 2014 at 10:39 AM, Hector Palacios
 wrote:
> Since function mmc_get_env_devno is __weak and can be overridden by
> board code, boards do not need to mandatory define
> CONFIG_SYS_MMC_ENV_DEV.
> If the constant is not defined, define it to 0 by default.
>
> Signed-off-by: Hector Palacios 
> Reviewed-by: Stephen Warren 


Acked-by: Otavio Salvador 

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2014-01-23 Thread Mj Embd
a) step 1 - compile and build the bin / etf
b) step 2 - create an asm - objdump -DS
c) find the lds file
d) locate uboot.map

start from __start. (keep an arm manual handy) & begin.

:)

On 1/23/14, JYOTI DUBEY  wrote:
> Can anyone tell how to understand the flow of u-boot source code? I am
> working on ARM processor and the board used is Nitrogen6X.
>


-- 
-mj
___
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-23 Thread Alexander Graf

On 21.01.2014, at 03:25, Scott Wood  wrote:

> On Sun, 2014-01-19 at 16:19 +0100, Alexander Graf wrote:
>> For KVM we have a special PV machine type called "ppce500". This machine
>> is inspired by the MPC8544DS board, but implements a lot less features
>> than that one.
>> 
>> It also provides more PCI slots and is supposed to be enumerated by
>> device tree only.
>> 
>> This patch adds support for the current generation ppce500 machine as
>> it is implemented today.
>> 
>> Signed-off-by: Alexander Graf 
>> ---
>> arch/powerpc/cpu/mpc85xx/start.S|7 +
>> arch/powerpc/include/asm/config_mpc85xx.h   |4 +
>> board/freescale/qemu-ppce500/Makefile   |   10 ++
>> board/freescale/qemu-ppce500/qemu-ppce500.c |  260 
>> +++
>> board/freescale/qemu-ppce500/tlb.c  |   59 ++
>> boards.cfg  |1 +
>> include/configs/qemu-ppce500.h  |  235 
>> 7 files changed, 576 insertions(+)
>> create mode 100644 board/freescale/qemu-ppce500/Makefile
>> create mode 100644 board/freescale/qemu-ppce500/qemu-ppce500.c
>> create mode 100644 board/freescale/qemu-ppce500/tlb.c
>> create mode 100644 include/configs/qemu-ppce500.h
>> 
>> diff --git a/arch/powerpc/cpu/mpc85xx/start.S 
>> b/arch/powerpc/cpu/mpc85xx/start.S
>> index db84d10..ccbcc03 100644
>> --- a/arch/powerpc/cpu/mpc85xx/start.S
>> +++ b/arch/powerpc/cpu/mpc85xx/start.S
>> @@ -80,6 +80,13 @@ _start_e500:
>>  li  r1,MSR_DE
>>  mtmsr   r1
>> 
>> +#ifdef CONFIG_QEMU_E500
>> +/* Save our ePAPR device tree off before we clobber it */
>> +lis r2, CONFIG_QEMU_DT_ADDR@h
>> +ori r2, r2, CONFIG_QEMU_DT_ADDR@l
>> +stw r3, 0(r2)
>> +#endif
> 
> r2 has a special purpose -- please don't use it for other things, even
> if it's too early to be a problem and other code is similarly bad.

Heh, ok. I'll use r4 instead.

> Instead of saving the DT pointer in some random hardcoded address, how
> about sticking it in a callee-saved register until you're able to store
> it in the global data struct?

I did that at first but that didn't survive relocation. However, I just 
remembered that I had my global variable in bss, so maybe relocation doesn't 
work properly there. Instead I put it in .data now and that seems to work.

It's certainly the nicer solution, I agree.

> 
>> diff --git a/arch/powerpc/include/asm/config_mpc85xx.h 
>> b/arch/powerpc/include/asm/config_mpc85xx.h
>> index 54ce2f0..a0ab453 100644
>> --- a/arch/powerpc/include/asm/config_mpc85xx.h
>> +++ b/arch/powerpc/include/asm/config_mpc85xx.h
>> @@ -776,6 +776,10 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
>> #define CONFIG_SYS_CCSRBAR_DEFAULT   0xff70
>> #define CONFIG_SYS_FSL_ERRATUM_A005125
>> 
>> +#elif defined(CONFIG_QEMU_E500)
>> +#define CONFIG_MAX_CPUS 1
>> +#define CONFIG_SYS_CCSRBAR_DEFAULT  0xe000
> 
> This is supposed to come from the device tree.  We will want to change
> that address eventually to support larger guest memory.

That's a lot easier said than done. There is a lot of code in u-boot that puts 
the CCSRBAR or addresses derived from CCSRBAR into arrays which fails miserably 
when you make it a variable.

It's certainly a reasonably big task.

> 
>> diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c 
>> b/board/freescale/qemu-ppce500/qemu-ppce500.c
>> new file mode 100644
>> index 000..c6c4b4a
>> --- /dev/null
>> +++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
>> @@ -0,0 +1,260 @@
>> +/*
>> + * Copyright 2007,2009-2014 Freescale Semiconductor, Inc.
>> + *
>> + * SPDX-License-Identifier: GPL-2.0+
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
> 
> Do you really need all these headers?  miiphy?

Ah, I missed that one during my header cleaning :). Reved that and immap_85xx.h.

> 
>> +int checkboard(void)
>> +{
>> +return 0;
>> +}
>> +
>> +static struct pci_controller pci1_hose;
>> +
>> +void pci_init_board(void)
>> +{
>> +volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
>> +struct fsl_pci_info pci_info;
>> +u32 devdisr, pordevsr;
>> +u32 porpllsr, pci_agent, pci_speed, pci_32, pci_arb, pci_clk_sel;
>> +int first_free_busno = 0;
>> +
>> +devdisr = in_be32(&gur->devdisr);
>> +pordevsr = in_be32(&gur->pordevsr);
>> +porpllsr = in_be32(&gur->porpllsr);
> 
> Why are you reading registers that don't exist in QEMU?

Dropped

> 
>> +int last_stage_init(void)
>> +{
>> +int ret;
>> +int len = 0;
>> +const void *prop;
>> +int chosen;
>> +uint32_t *dt_base_ptr = (void*)CONFIG_QEMU_DT_ADDR;
> 
> Whitespace
> 
>> +uint32_t dt_base = *dt_base_ptr;
>> +uint32_t dt_size;
>> +void *fdt;
>> +
>> +dt_size = fdt_totalsize((void*)dt_base);
> 
> Please

[U-Boot] [ Uboot code understanding guide ]

2014-01-23 Thread Devarsh gadhia
Hi All,

I have started working on uboot porting on beaglebone black.
I want to learn the code flow of uboot code so that i can add necessary
HOOKs for the porting and understanding the kernel and fs porting further.

i am new to uboot and linux so could you please let me know the way to
start with the walk through of the code ?



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


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

2014-01-23 Thread Jagan Teki
Have some boot flow png's long back with previous version (not the current) [1]
I thought it could be a starter - not equivalently same.
If possible better take this as a reference and start tagging around the source.

[1] http://jagannadhteki.blog.com/2014/01/23/u-boot-functional-flowarm/

thanks!

On Thu, Jan 23, 2014 at 6:10 PM, Mj Embd  wrote:
> a) step 1 - compile and build the bin / etf
> b) step 2 - create an asm - objdump -DS
> c) find the lds file
> d) locate uboot.map
>
> start from __start. (keep an arm manual handy) & begin.
>
> :)
>
> On 1/23/14, JYOTI DUBEY  wrote:
>> Can anyone tell how to understand the flow of u-boot source code? I am
>> working on ARM processor and the board used is Nitrogen6X.

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


Re: [U-Boot] how to get u-boot code with arm64: core support

2014-01-23 Thread Detlev Zundel
Hi Bhupesh,

>> -Original Message-
>> From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de]
>> On Behalf Of drambo
>> Sent: Thursday, January 23, 2014 12:32 AM
>> To: u-boot@lists.denx.de
>> Subject: Re: [U-Boot] how to get u-boot code with arm64: core support
>> 
>> Hi Bhupesh,
>> 
>> > U-boot doesn't have ARM trusted firmware support as of now. U-boot for
>> > ARMv8 starts in EL3, whereas UEFI starts in EL2 as trusted firmware
>> > itself is working in EL3.
>> 
>> Since the ATF software doesn't really care whether it is loading uefi or
>> u-boot and since it wants to load non-secure images as EL2 or EL1
>> (https://github.com/ARM-software/arm-trusted-
>> firmware/blob/master/docs/user-guide.md
>> See section "Normal World Software Execution"), why would we want to
>> assume u-boot starts in EL3 mode by default?
>> 
>> If we want to support EL3 execution for convenience to those that don't
>> have ATF setup, that might make sense, but then shouldn't initial EL3
>> execution and subsequent switching levels be debug CONFIG options?
>> Thanks.
>> 
>
> In the past I remember using u-boot as the bare-metal s/w to debug a
> Silicon without any BootROM/firmware code running before the same on
> ARM 32-bit architectures.

Many of our customers (in the embedded market) use U-Boot in such a way
very successfully.

> The ATF is presently tested only for UEFI and UEFI comes up in EL2
> while the ATF itself is running in EL3.
>
> I don't know what would be the popular vote on this, but personally I
> feel that the u-boot for ARMv8 should also be launched by the ATF
> (similar to UEFI) and should start execution in EL2 so that it can
> launch a hypervisor (running in EL2) or Linux (running in EL1).  But
> this might hurt the popular premise that u-boot can be used as a
> bare-metal s/w to debug a silicon without additional firmware
> components.
>
> Perhaps u-boot experts can guide us on this !

I have to admit that I'm only reading up on the complexities of the
security model of aarch64, but my gut response (cf. [1] is that "real
security" stems from "few code" rather than adding layer over layer.
With this in mind, I'd really like to see that U-Boot with its well
known and tested code base can still be the "root of trust" in an
embedded product (i.e. EL3 as far as I understand).

Many of the embedded U-Boot users who excercise full control over the
whole software stack very likely want to see the same.

The interesting question will be if we can reconcile the requirements of
"classic embedded U-Boot users" and this "OEM server market" that seems
to drive much of these new concepts here.  But I sincerely hope so.
After all, in the end we want to boot an OS to get the real work done ;)

Best wishes
  Detlev

[1] Reading one presentation I found about ATF[2] actually made my head
hurt around page 12 which looks more like "security soup" than
clearcut concepts, but maybe I'm just not into all the details yet.

[2] http://lcu-13.zerista.com/event/member/85121

-- 
Our choice isn't between a digital world where the NSA can eavesdrop and one
where the NSA is prevented from eavesdropping; it's between a digital world
that is vulnerable to allattackers, and one that is secure for all users.
  -- Bruce Schneier
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] U-boot porting experiment -- which board or CPU will be good for doing it first time

2014-01-23 Thread Detlev Zundel
Hi Allan,

> I have been reading u-boot documentation for last few weeks.

I hope it was fun :)

> I am looking forward to configure & write my own u-boot for some board
> or CPU .  I will be doing it first time.
>
> Please suggest some existing board for which we have opensource U-boot
> software available, which are good for someone to start ?

This is a very broad question and without giving us more context like
price range, expected features, CPU architecture, etc. it is very hard
to answer.

An "objective" start however would be to look into boards.cfg in
mainline to see what boards we support.  If you have narrowed down your
choice a little bit, I'm optimistic that people will then be glad to
help find a local optimum amongst them.

> I can study that & apply same concept to other Processors or boards. I
> will like to be an expert in u-boot porting.

> TI sitara controllers or RPi(I have an Rpi) or some thing else ?

I am no expert on either one, but the Rpi is not an easy beast to tame.
If you want to learn, I'd suggest looking for less complicated
architectures that have been supported already for a while.

Best wishes
  Detlev

-- 
Our choice isn't between a digital world where the NSA can eavesdrop and one
where the NSA is prevented from eavesdropping; it's between a digital world
that is vulnerable to allattackers, and one that is secure for all users.
  -- Bruce Schneier
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] how to get u-boot code with arm64: core support

2014-01-23 Thread Darwin Rambo



On 14-01-23 07:58 AM, Detlev Zundel wrote:

Hi Bhupesh,


-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de]
On Behalf Of drambo
Sent: Thursday, January 23, 2014 12:32 AM
To: u-boot@lists.denx.de
Subject: Re: [U-Boot] how to get u-boot code with arm64: core support

Hi Bhupesh,


U-boot doesn't have ARM trusted firmware support as of now. U-boot for
ARMv8 starts in EL3, whereas UEFI starts in EL2 as trusted firmware
itself is working in EL3.


Since the ATF software doesn't really care whether it is loading uefi or
u-boot and since it wants to load non-secure images as EL2 or EL1
(https://github.com/ARM-software/arm-trusted-
firmware/blob/master/docs/user-guide.md
See section "Normal World Software Execution"), why would we want to
assume u-boot starts in EL3 mode by default?

If we want to support EL3 execution for convenience to those that don't
have ATF setup, that might make sense, but then shouldn't initial EL3
execution and subsequent switching levels be debug CONFIG options?
Thanks.



In the past I remember using u-boot as the bare-metal s/w to debug a
Silicon without any BootROM/firmware code running before the same on
ARM 32-bit architectures.


Many of our customers (in the embedded market) use U-Boot in such a way
very successfully.
armv8 and ATF bring in a new security model and with that, secure 
monitor/dispatch, secure OS support and secure power control. It may not 
be good to assume that we can work in a historical way here.





The ATF is presently tested only for UEFI and UEFI comes up in EL2
while the ATF itself is running in EL3.

I don't know what would be the popular vote on this, but personally I
feel that the u-boot for ARMv8 should also be launched by the ATF
(similar to UEFI) and should start execution in EL2 so that it can
launch a hypervisor (running in EL2) or Linux (running in EL1).  But
this might hurt the popular premise that u-boot can be used as a
bare-metal s/w to debug a silicon without additional firmware
components.

Perhaps u-boot experts can guide us on this !


I have to admit that I'm only reading up on the complexities of the
security model of aarch64, but my gut response (cf. [1] is that "real
security" stems from "few code" rather than adding layer over layer.
With this in mind, I'd really like to see that U-Boot with its well
known and tested code base can still be the "root of trust" in an
embedded product (i.e. EL3 as far as I understand).
EL3 is the highest level of trust, and the new armv8 security model 
treats uefi/u-boot as non-secure firmware. The ATF trusted firmware 
needs to run, initialize secure hardware, load trusted images, and 
ultimately launch the non-secure OS loader (uefi or u-boot). As such, I 
think that running uefi or u-boot at EL3 violates the current arm 
security model i.e. u-boot cannot be the "root of trust" in this 
architecture since it is non-secure. Having non-secure firmware run at 
the same level as the secure dispatcher and secure monitor will fail any 
secure audit in my opinion.


However, if we set up u-boot so that it can wake up at any security 
level and migrate to non-secure EL1, that might be a nice compromise. 
But having specific EL3 startup assumptions and code that is always 
present in u-boot seems like the wrong approach to me. At the very 
least, we should wrap the EL3 code in a CONFIG option since this is not 
the planned entry state for final deployment.


Note that these are just my opinions above. Any ARM security experts 
would be welcome to contribute thoughts here.




Many of the embedded U-Boot users who excercise full control over the
whole software stack very likely want to see the same.

The ATF secure software is freely available.



The interesting question will be if we can reconcile the requirements of
"classic embedded U-Boot users" and this "OEM server market" that seems
to drive much of these new concepts here.  But I sincerely hope so.
After all, in the end we want to boot an OS to get the real work done ;)
As armv8 goes mobile, we have less of a server market issue and more of 
a mobile security issue.




Best wishes
   Detlev

[1] Reading one presentation I found about ATF[2] actually made my head
 hurt around page 12 which looks more like "security soup" than
 clearcut concepts, but maybe I'm just not into all the details yet.

[2] http://lcu-13.zerista.com/event/member/85121


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


[U-Boot] implementation of generic distro options

2014-01-23 Thread Dennis Gilmore
In this set of patches I am adding a generic set of config options for Distros
to work with. this enables for simplified support of systems by distros.

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

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


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

2014-01-23 Thread Dennis Gilmore
describe a set of default features that distros can rely on being available.
having this common definition means that distros can easily support systems
implementing them.

Signed-off-by: Dennis Gilmore 
---
 include/config_distro_defaults.h | 55 
 1 file changed, 55 insertions(+)
 create mode 100644 include/config_distro_defaults.h

diff --git a/include/config_distro_defaults.h b/include/config_distro_defaults.h
new file mode 100644
index 000..7b13586
--- /dev/null
+++ b/include/config_distro_defaults.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef _CONFIG_CMD_DISTRO_DEFAULT_H
+#define _CONFIG_CMD_DISTRO_DEFAULT_H
+
+/*
+ * List of all commands and options that when defined enables support for 
features
+ * required by distros to support boards in a standardised and consitant 
manner.
+ */
+
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+#define CONFIG_BOOTP_PXE
+#define CONFIG_BOOTP_SUBNETMASK
+
+#if defined(__arm__)
+#define CONFIG_BOOTP_PXE_CLIENTARCH 0x100
+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
+#define CONFIG_BOOTP_VCI_STRING "U-boot.armv7"
+#else
+#define CONFIG_BOOTP_VCI_STRING "U-boot.arm"
+#endif
+#endif
+
+#define CONFIG_OF_LIBFDT
+
+#define CONFIG_CMD_BOOTZ
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_FS_GENERIC
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_PXE
+
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_BOOTDELAY 2
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_MENU
+#define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+#define CONFIG_SUPPORT_RAW_INITRD
+#define CONFIG_SYS_HUSH_PARSER
+
+#endif /* _CONFIG_CMD_DISTRO_DEFAULT_H */
-- 
1.8.5.3

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


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

2014-01-23 Thread Dennis Gilmore
Signed-off-by: Dennis Gilmore 
---
 common/cmd_pxe.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index c27ec35..20569bb 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "menu.h"
 
@@ -160,6 +161,19 @@ static int do_get_fat(cmd_tbl_t *cmdtp, const char 
*file_path, char *file_addr)
return -ENOENT;
 }
 
+static int do_get_any(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+{
+#ifdef CONFIG_CMD_FS_GENERIC
+   fs_argv[0] = "load";
+   fs_argv[3] = file_addr;
+   fs_argv[4] = (void *)file_path;
+
+   if (!do_load(cmdtp, 0, 5, fs_argv, FS_TYPE_ANY))
+   return 1;
+#endif
+   return -ENOENT;
+}
+
 /*
  * As in pxelinux, paths to files referenced from files we retrieve are
  * relative to the location of bootfile. get_relfile takes such a path and
@@ -1539,6 +1553,8 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
do_getfile = do_get_ext2;
else if (strstr(argv[3], "fat"))
do_getfile = do_get_fat;
+   else if (strstr(argv[3], "any"))
+   do_getfile = do_get_any;
else {
printf("Invalid filesystem: %s\n", argv[3]);
return 1;
@@ -1576,7 +1592,7 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 U_BOOT_CMD(
sysboot, 7, 1, do_sysboot,
"command to get and boot from syslinux files",
-   "[-p][addr] [filename]\n"
-   "- load and parse syslinux menu file 'filename' from ext2 or fat\n"
-   "  filesystem on 'dev' on 'interface' to address 'addr'"
+   "[-p][addr] [filename]\n"
+   "- load and parse syslinux menu file 'filename' from ext2, fat\n"
+   "  or any filesystem on 'dev' on 'interface' to address 'addr'"
 );
-- 
1.8.5.3

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


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

2014-01-23 Thread Danny Gale

Hi Wolfgang,

Thanks for your reply. My responses are inline below.

On 1/22/2014 2:06 AM, Wolfgang Denk wrote:

Dear Danny Gale,

In message <52df18b3.1080...@coloradoengineeringinc.com> you wrote:

The T4240 on the T4QDS board is a PPC e6500 core (64 bit), but it is
configured in U-Boot as an e500 core, which is 32 bit. Why is this?

Becuase it simply works :-)


Can it be updated to e6500?

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

This leads directly into another question: can U-Boot be compiled and
run 64-bit? So far, I have been unable to make it work with a 64-bit
compiler. I'm running into these errors:

Not out of the box.


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


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


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

2014-01-23 Thread Stephen Warren
From: Jimmy Zhang 

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

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

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

Signed-off-by: Jimmy Zhang 
[swarren, significantly refactored the change]
Signed-off-by: Stephen Warren 
---
v2:
* Remove duplicate adjustment of PLLP dividers from pllx_set_rate()
* Adjust PLLP_OUT1/PLLP_OUT2 dividers from clock_early_init() so that
  everything related to PLLP is set up at once.
* Initialize PLLP from a new common function tegra30_or_later_adjust_pllp()
  so the code isn't duplicated.
---
 arch/arm/cpu/arm720t/tegra-common/cpu.c   | 26 +
 arch/arm/cpu/arm720t/tegra114/cpu.c   | 14 +
 arch/arm/cpu/arm720t/tegra30/cpu.c| 14 +
 arch/arm/cpu/tegra-common/clock.c | 90 ++-
 arch/arm/cpu/tegra114-common/clock.c  |  8 ++-
 arch/arm/cpu/tegra30-common/clock.c   | 31 +--
 arch/arm/include/asm/arch-tegra/clk_rst.h | 16 +-
 arch/arm/include/asm/arch-tegra/clock.h   |  2 +
 8 files changed, 114 insertions(+), 87 deletions(-)

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

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

2014-01-23 Thread Scott Wood
On Thu, 2014-01-23 at 11:13 -0700, Danny Gale wrote:
> Hi Wolfgang,
> 
> Thanks for your reply. My responses are inline below.
> 
> On 1/22/2014 2:06 AM, Wolfgang Denk wrote:
> > Dear Danny Gale,
> >
> > In message <52df18b3.1080...@coloradoengineeringinc.com> you wrote:
> >> The T4240 on the T4QDS board is a PPC e6500 core (64 bit), but it is
> >> configured in U-Boot as an e500 core, which is 32 bit. Why is this?
> > Becuase it simply works :-)
> >
> >> Can it be updated to e6500?
> > Yes - if you add support for 64 bit configurations in general, and
> > for powerpc64 in particular.
> I don't even have a sense for what would be involved here. How 
> fundamentally would the U-Boot code need to change?

The common U-Boot code should be more or less OK -- the armv8 target
runs as 64-bit, and sandbox can as well.  The PPC code is another
matter, though.  You'd need to hack up or replace a bunch of asm code at
the least.

> >> This leads directly into another question: can U-Boot be compiled and
> >> run 64-bit? So far, I have been unable to make it work with a 64-bit
> >> compiler. I'm running into these errors:
> > Not out of the box.
> >
> >
> > What is your actual reason for wanting to run a 64 bit boot loader?
> My reason for wanting to run 64-bit is that this system has 12 GB of 
> RAM. Will 32-bit U-Boot be able to access and test more than 4 GB of RAM?

32-bit U-Boot can detect (or otherwise know about) and tell the OS about
large amounts of RAM, but it can only directly access 2 GiB.

-Scott


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


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

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

People who write (or scripts that auto-generate) extlinux.conf don't
want to know about HW-specific information such as FDT filenames. Create
a new extlinux.conf tag "fdtdir" that specifies only the directory where
FDT files are located, and defer all knowledge of the filename to U-Boot.
The algorithm implemented is:

==
if $fdt_addr_r is set:
  if "fdt" tag was specified in extlinux.conf:
load the FDT from the filename in the tag
  else if "fdtdir" tag was specified in extlinux.conf:
if "fdtfile" is set in the environment:
  load the FDT from filename in "$fdtfile"
else:
  load the FDT from some automatically generated filename

if no FDT file was loaded, and $fdtaddr is set:
  # This indicates an FDT packaged with firmware
  use the FDT at $fdtaddr
==

A small part of an example /boot/extlinux.conf might be:

==
LABEL primary
LINUX zImage
FDTDIR ./

LABEL failsafe
LINUX bkp/zImage
FDTDIR bkp/
==

... with /boot/tegra20-seaboard.dtb or /boot/bkp/tegra20-seaboard.dtb
being loaded by the sysboot/pxe code.

Signed-off-by: Stephen Warren 
---
v1 (relative to RFC): no change; just reposting as non-RFC

This patch depends on the following from Dennis Gilmore:
- cmd_pxe.c add any option for filesystem with sysboot uses generic load
- config: add config_distro_defaults.h
---
 common/cmd_pxe.c | 77 +++-
 1 file changed, 71 insertions(+), 6 deletions(-)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 20569bb04201..5d356295e48e 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -459,6 +459,7 @@ struct pxe_label {
char *append;
char *initrd;
char *fdt;
+   char *fdtdir;
int ipappend;
int attempted;
int localboot;
@@ -531,6 +532,9 @@ static void label_destroy(struct pxe_label *label)
if (label->fdt)
free(label->fdt);
 
+   if (label->fdtdir)
+   free(label->fdtdir);
+
free(label);
 }
 
@@ -689,13 +693,67 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label 
*label)
bootm_argv[3] = getenv("fdt_addr_r");
 
/* if fdt label is defined then get fdt from server */
-   if (bootm_argv[3] && label->fdt) {
-   if (get_relfile_envaddr(cmdtp, label->fdt, "fdt_addr_r") < 0) {
-   printf("Skipping %s for failure retrieving fdt\n",
-   label->name);
-   return 1;
+   if (bootm_argv[3]) {
+   char *fdtfile = NULL;
+   char *fdtfilefree = NULL;
+
+   if (label->fdt) {
+   fdtfile = label->fdt;
+   } else if (label->fdtdir) {
+   fdtfile = getenv("fdtfile");
+   /*
+* For complex cases, it might be worth calling a
+* board- or SoC-provided function here to provide a
+* better default:
+*
+* if (!fdtfile)
+* fdtfile = gen_fdtfile();
+*
+* If this is added, be sure to keep the default below,
+* or move it to the default weak implementation of
+* gen_fdtfile().
+*/
+   if (!fdtfile) {
+   char *soc = getenv("soc");
+   char *board = getenv("board");
+   char *slash;
+
+   len = strlen(label->fdtdir);
+   if (!len)
+   slash = "./";
+   else if (label->fdtdir[len - 1] != '/')
+   slash = "/";
+   else
+   slash = "";
+
+   len = strlen(label->fdtdir) + strlen(slash) +
+   strlen(soc) + 1 + strlen(board) + 5;
+   fdtfilefree = malloc(len);
+   if (!fdtfilefree) {
+   printf("malloc fail (FDT filename)\n");
+   return 1;
+   }
+
+   snprintf(fdtfilefree, len, "%s%s%s-%s.dtb",
+   label->fdtdir, slash, soc, board);
+   fdtfile = fdtfilefree;
+   }
}
-   } else
+
+   if (fdtfile) {
+   int err = get_relfile_envaddr(cmdtp, fdtfile, 
"fdt_addr_r");
+   free(fdtfilefree);
+   if (err < 0) {
+   printf("Skipping %s for failure retriev

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

2014-01-23 Thread Stephen Warren
On 01/23/2014 11:22 AM, Dennis Gilmore wrote:
> describe a set of default features that distros can rely on being available.
> having this common definition means that distros can easily support systems
> implementing them.

The series,
Tested-by: Stephen Warren 
Reviewed-by: Stephen Warren 

with one tiny nit:

> diff --git a/include/config_distro_defaults.h 
> b/include/config_distro_defaults.h

> +#ifndef _CONFIG_CMD_DISTRO_DEFAULT_H
> +#define _CONFIG_CMD_DISTRO_DEFAULT_H

This file got renamed from config_distro_default.h in the RFC to
config_distro_defaults.h in this patch, but the include guard wasn't
updated.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V2 4/5] ext4: implement exists() for ext4fs

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

This hooks into the generic "file exists" support added in an earlier
patch, and provides an implementation for the ext4 filesystem.

Signed-off-by: Stephen Warren 
---
 fs/ext4/ext4fs.c | 8 
 fs/fs.c  | 2 +-
 include/ext4fs.h | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 735b2564175b..71ecdd8e9a31 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -174,6 +174,14 @@ int ext4fs_ls(const char *dirname)
return 0;
 }
 
+int ext4fs_exists(const char *filename)
+{
+   int file_len;
+
+   file_len = ext4fs_open(filename);
+   return (file_len >= 0) ? 0 : 1;
+}
+
 int ext4fs_read(char *buf, unsigned len)
 {
if (ext4fs_root == NULL || ext4fs_file == NULL)
diff --git a/fs/fs.c b/fs/fs.c
index 4f344c6d6d72..3f14d0169b43 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -91,7 +91,7 @@ static struct fstype_info fstypes[] = {
.probe = ext4fs_probe,
.close = ext4fs_close,
.ls = ext4fs_ls,
-   .exists = fs_exists_unsupported,
+   .exists = ext4fs_exists,
.read = ext4_read_file,
.write = fs_write_unsupported,
},
diff --git a/include/ext4fs.h b/include/ext4fs.h
index 242938039662..aacb147de24b 100644
--- a/include/ext4fs.h
+++ b/include/ext4fs.h
@@ -134,6 +134,7 @@ int ext4fs_read(char *buf, unsigned len);
 int ext4fs_mount(unsigned part_length);
 void ext4fs_close(void);
 int ext4fs_ls(const char *dirname);
+int ext4fs_exists(const char *filename);
 void ext4fs_free_node(struct ext2fs_node *node, struct ext2fs_node *currroot);
 int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf);
 void ext4fs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info);
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 5/5] fat: implement exists() for FAT fs

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

This hooks into the generic "file exists" support added in an earlier
patch, and provides an implementation for the ext4 filesystem.

Signed-off-by: Stephen Warren 
---
v2: s/ext/fat/ in the commit subject
---
 fs/fat/fat.c  | 18 ++
 fs/fs.c   |  2 +-
 include/fat.h |  1 +
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index b41d62e3c386..bc06c0a3c688 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -808,7 +808,7 @@ __u8 do_fat_read_at_block[MAX_CLUSTSIZE]
 
 long
 do_fat_read_at(const char *filename, unsigned long pos, void *buffer,
-  unsigned long maxsize, int dols)
+  unsigned long maxsize, int dols, int dogetsize)
 {
char fnamecopy[2048];
boot_sector bs;
@@ -1152,7 +1152,10 @@ rootdir_done:
subname = nextname;
}
 
-   ret = get_contents(mydata, dentptr, pos, buffer, maxsize);
+   if (dogetsize)
+   ret = FAT2CPU32(dentptr->size);
+   else
+   ret = get_contents(mydata, dentptr, pos, buffer, maxsize);
debug("Size: %d, got: %ld\n", FAT2CPU32(dentptr->size), ret);
 
 exit:
@@ -1163,7 +1166,7 @@ exit:
 long
 do_fat_read(const char *filename, void *buffer, unsigned long maxsize, int 
dols)
 {
-   return do_fat_read_at(filename, 0, buffer, maxsize, dols);
+   return do_fat_read_at(filename, 0, buffer, maxsize, dols, 0);
 }
 
 int file_fat_detectfs(void)
@@ -1233,11 +1236,18 @@ int file_fat_ls(const char *dir)
return do_fat_read(dir, NULL, 0, LS_YES);
 }
 
+int fat_exists(const char *filename)
+{
+   int sz;
+   sz = do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1);
+   return (sz >= 0) ? 0 : 1;
+}
+
 long file_fat_read_at(const char *filename, unsigned long pos, void *buffer,
  unsigned long maxsize)
 {
printf("reading %s\n", filename);
-   return do_fat_read_at(filename, pos, buffer, maxsize, LS_NO);
+   return do_fat_read_at(filename, pos, buffer, maxsize, LS_NO, 0);
 }
 
 long file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
diff --git a/fs/fs.c b/fs/fs.c
index 3f14d0169b43..d2bc8d0f1459 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -80,7 +80,7 @@ static struct fstype_info fstypes[] = {
.probe = fat_set_blk_dev,
.close = fat_close,
.ls = file_fat_ls,
-   .exists = fs_exists_unsupported,
+   .exists = fat_exists,
.read = fat_read_file,
.write = fs_write_unsupported,
},
diff --git a/include/fat.h b/include/fat.h
index 2c951e7d79c6..c8eb7ccd2904 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -188,6 +188,7 @@ file_read_func  file_fat_read;
 int file_cd(const char *path);
 int file_fat_detectfs(void);
 int file_fat_ls(const char *dir);
+int fat_exists(const char *filename);
 long file_fat_read_at(const char *filename, unsigned long pos, void *buffer,
  unsigned long maxsize);
 long file_fat_read(const char *filename, void *buffer, unsigned long maxsize);
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 3/5] sandbox: implement fs_exists() and 'sb exists' shell function

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

This hooks into the generic "file exists" support added in the previous
patch, and provides an implementation for the sandbox test environment.

Signed-off-by: Stephen Warren 
---
 common/cmd_sandbox.c   | 7 +++
 fs/fs.c| 2 +-
 fs/sandbox/sandboxfs.c | 8 
 include/sandboxfs.h| 1 +
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/common/cmd_sandbox.c b/common/cmd_sandbox.c
index 00982b164dd3..c8d36b747d6a 100644
--- a/common/cmd_sandbox.c
+++ b/common/cmd_sandbox.c
@@ -22,6 +22,12 @@ static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int 
argc,
return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
+static int do_sandbox_exists(cmd_tbl_t *cmdtp, int flag, int argc,
+char * const argv[])
+{
+   return do_exists(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
+}
+
 static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc,
   char * const argv[])
 {
@@ -88,6 +94,7 @@ static int do_sandbox_info(cmd_tbl_t *cmdtp, int flag, int 
argc,
 static cmd_tbl_t cmd_sandbox_sub[] = {
U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
+   U_BOOT_CMD_MKENT(exists, 3, 0, do_sandbox_exists, "", ""),
U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
U_BOOT_CMD_MKENT(bind, 3, 0, do_sandbox_bind, "", ""),
U_BOOT_CMD_MKENT(info, 3, 0, do_sandbox_info, "", ""),
diff --git a/fs/fs.c b/fs/fs.c
index f3d9a1c6bc7d..4f344c6d6d72 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -102,7 +102,7 @@ static struct fstype_info fstypes[] = {
.probe = sandbox_fs_set_blk_dev,
.close = sandbox_fs_close,
.ls = sandbox_fs_ls,
-   .exists = fs_exists_unsupported,
+   .exists = sandbox_fs_exists,
.read = fs_read_sandbox,
.write = fs_write_sandbox,
},
diff --git a/fs/sandbox/sandboxfs.c b/fs/sandbox/sandboxfs.c
index dd028da8e32b..7940c93dc6a3 100644
--- a/fs/sandbox/sandboxfs.c
+++ b/fs/sandbox/sandboxfs.c
@@ -72,6 +72,14 @@ int sandbox_fs_ls(const char *dirname)
return 0;
 }
 
+int sandbox_fs_exists(const char *filename)
+{
+   ssize_t sz;
+
+   sz = os_get_filesize(filename);
+   return (sz >= 0) ? 0 : -1;
+}
+
 void sandbox_fs_close(void)
 {
 }
diff --git a/include/sandboxfs.h b/include/sandboxfs.h
index 8ea8cb7e2e62..a51ad13044e1 100644
--- a/include/sandboxfs.h
+++ b/include/sandboxfs.h
@@ -25,6 +25,7 @@ long sandbox_fs_read_at(const char *filename, unsigned long 
pos,
 
 void sandbox_fs_close(void);
 int sandbox_fs_ls(const char *dirname);
+int sandbox_fs_exists(const char *filename);
 int fs_read_sandbox(const char *filename, void *buf, int offset, int len);
 int fs_write_sandbox(const char *filename, void *buf, int offset, int len);
 
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 1/5] fs: fix generic save command implementation

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

Fix a few issues with the generic "save" shell command, and fs_write()
function.

1) fstypes[].write wasn't filled in for some file-systems, and isn't
   checked when used, which could cause crashes/... if executing save
   on e.g. fat/ext filesystems.

2) fs_write() requires the length argument to be non-zero, since it needs
   to know exactly how many bytes to write. Adjust the comments and code
   according to this.

3) fs_write() wasn't prototyped in  like other generic functions;
   other code should be able to call this directly rather than invoking
   the "save" shell command.

Cc: Simon Glass 
Signed-off-by: Stephen Warren 
---
 fs/fs.c  |  9 +++--
 include/fs.h | 10 ++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index be1855d1291f..9c2ef6b6597c 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -75,6 +75,7 @@ static struct fstype_info fstypes[] = {
.close = fat_close,
.ls = file_fat_ls,
.read = fat_read_file,
+   .write = fs_write_unsupported,
},
 #endif
 #ifdef CONFIG_FS_EXT4
@@ -84,6 +85,7 @@ static struct fstype_info fstypes[] = {
.close = ext4fs_close,
.ls = ext4fs_ls,
.read = ext4_read_file,
+   .write = fs_write_unsupported,
},
 #endif
 #ifdef CONFIG_SANDBOX
@@ -212,16 +214,11 @@ int fs_write(const char *filename, ulong addr, int 
offset, int len)
void *buf;
int ret;
 
-   /*
-* We don't actually know how many bytes are being read, since len==0
-* means read the whole file.
-*/
buf = map_sysmem(addr, len);
ret = info->write(filename, buf, offset, len);
unmap_sysmem(buf);
 
-   /* If we requested a specific number of bytes, check we got it */
-   if (ret >= 0 && len && ret != len) {
+   if (ret >= 0 && ret != len) {
printf("** Unable to write file %s **\n", filename);
ret = -1;
}
diff --git a/include/fs.h b/include/fs.h
index 7d9403ed8758..97b0094e954b 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -55,6 +55,16 @@ int fs_ls(const char *dirname);
 int fs_read(const char *filename, ulong addr, int offset, int len);
 
 /*
+ * Write file "filename" to the partition previously set by fs_set_blk_dev(),
+ * from address "addr", starting at byte offset "offset", and writing "len"
+ * bytes. "offset" may be 0 to write to the start of the file. Note that not
+ * all filesystem types support offset!=0.
+ *
+ * Returns number of bytes read on success. Returns <= 0 on error.
+ */
+int fs_write(const char *filename, ulong addr, int offset, int len);
+
+/*
  * Common implementation for various filesystem commands, optionally limited
  * to a specific filesystem type via the fstype parameter.
  */
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 2/5] fs: implement infra-structure for an 'exists' function

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

This could be used in scripts such as:

if exists mmc 0:1 /boot/boot.scr; then
load mmc 0:1 ${scriptaddr} /boot/boot.scr
source ${scriptaddr}
fi

rather than:

if load mmc 0:1 ${scriptaddr} /boot/boot.scr; then
source ${scriptaddr}
fi

This prevents errors being printed by attempts to load non-existent
files, which can be important when checking for a large set of files,
such as /boot/boot.scr.uimg, /boot/boot.scr, /boot/extlinux.conf,
/boot.scr.uimg, /boot.scr, /extlinux.conf.

Signed-off-by: Stephen Warren 
---
 common/cmd_fs.c | 14 ++
 fs/fs.c | 38 ++
 include/fs.h| 10 ++
 3 files changed, 62 insertions(+)

diff --git a/common/cmd_fs.c b/common/cmd_fs.c
index 91a205ac1e69..44b00cd125b7 100644
--- a/common/cmd_fs.c
+++ b/common/cmd_fs.c
@@ -49,3 +49,17 @@ U_BOOT_CMD(
"- List files in directory 'directory' of partition 'part' on\n"
"  device type 'interface' instance 'dev'."
 );
+
+int do_exists_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
+{
+   return do_exists(cmdtp, flag, argc, argv, FS_TYPE_ANY);
+}
+
+U_BOOT_CMD(
+   exists, 4,  0,  do_exists_wrapper,
+   "determine whether a file exists",
+   "  filename\n"
+   "- Determine whether 'filename' exists in partition 'part' on\n"
+   "  device type 'interface' instance 'dev', and set the command.\n"
+   "  exit status so that 'if exists ...; then' works.\n"
+);
diff --git a/fs/fs.c b/fs/fs.c
index 9c2ef6b6597c..f3d9a1c6bc7d 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -41,6 +41,11 @@ static inline int fs_ls_unsupported(const char *dirname)
return -1;
 }
 
+static inline int fs_exists_unsupported(const char *filename)
+{
+   return -1;
+}
+
 static inline int fs_read_unsupported(const char *filename, void *buf,
  int offset, int len)
 {
@@ -62,6 +67,7 @@ struct fstype_info {
int (*probe)(block_dev_desc_t *fs_dev_desc,
 disk_partition_t *fs_partition);
int (*ls)(const char *dirname);
+   int (*exists)(const char *filename);
int (*read)(const char *filename, void *buf, int offset, int len);
int (*write)(const char *filename, void *buf, int offset, int len);
void (*close)(void);
@@ -74,6 +80,7 @@ static struct fstype_info fstypes[] = {
.probe = fat_set_blk_dev,
.close = fat_close,
.ls = file_fat_ls,
+   .exists = fs_exists_unsupported,
.read = fat_read_file,
.write = fs_write_unsupported,
},
@@ -84,6 +91,7 @@ static struct fstype_info fstypes[] = {
.probe = ext4fs_probe,
.close = ext4fs_close,
.ls = ext4fs_ls,
+   .exists = fs_exists_unsupported,
.read = ext4_read_file,
.write = fs_write_unsupported,
},
@@ -94,6 +102,7 @@ static struct fstype_info fstypes[] = {
.probe = sandbox_fs_set_blk_dev,
.close = sandbox_fs_close,
.ls = sandbox_fs_ls,
+   .exists = fs_exists_unsupported,
.read = fs_read_sandbox,
.write = fs_write_sandbox,
},
@@ -103,6 +112,7 @@ static struct fstype_info fstypes[] = {
.probe = fs_probe_unsupported,
.close = fs_close_unsupported,
.ls = fs_ls_unsupported,
+   .exists = fs_exists_unsupported,
.read = fs_read_unsupported,
.write = fs_write_unsupported,
},
@@ -184,6 +194,19 @@ int fs_ls(const char *dirname)
return ret;
 }
 
+int fs_exists(const char *filename)
+{
+   int ret;
+
+   struct fstype_info *info = fs_get_info(fs_type);
+
+   ret = info->exists(filename);
+
+   fs_close();
+
+   return ret;
+}
+
 int fs_read(const char *filename, ulong addr, int offset, int len)
 {
struct fstype_info *info = fs_get_info(fs_type);
@@ -309,6 +332,21 @@ int do_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[],
return 0;
 }
 
+int do_exists(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+   int fstype)
+{
+   if (argc != 4)
+   return CMD_RET_USAGE;
+
+   if (fs_set_blk_dev(argv[1], argv[2], fstype))
+   return 1;
+
+   if (fs_exists(argv[3]))
+   return 1;
+
+   return 0;
+}
+
 int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
int fstype)
 {
diff --git a/include/fs.h b/include/fs.h
index 97b0094e954b..b8b7706410ad 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -44,6 +44,14 @@ int fs_set_blk_dev(const char *ifname, const char 
*dev_part_str, int fstype);
 int fs_ls(const char *dirname);
 
 /*
+ * Determine whether a file exists
+ *
+ * Returns 0 if the file exists, non-zero if it doesn't exist.

[U-Boot] [PATCH V2 5/5] ARM: tegra: clear $usb_need_init each boot

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

$usb_need_init prevents "usb start" from being run multiple times for
each boot attempt, i.e. once for USB storage, another for PXE, and
another for DHCP. However, the flag that's used to determine when to run
"usb start" is never cleared, so a subsequent "boot" command will never
probe for a freshly plugged in USB device. Fix this so that new USB
devices will be probed once per boot attempt.

Signed-off-by: Stephen Warren 
---
v2: New patch
---
 include/configs/tegra-common-post.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index b3e1cfd5de8c..99448cf3dedc 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -136,6 +136,7 @@
BOOTCMDS_PXE
 
 #define CONFIG_BOOTCOMMAND \
+   "set usb_need_init; " \
"for target in ${boot_targets}; do run bootcmd_${target}; done"
 
 #endif
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 1/5] ARM: tegra: set env vars to indicate Cardhu A04 support

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

The U-Boot "cardhu" build supports only revision 4 of the Cardhu board
and later compatible revisions. Hence, set $board_name in the default
environment to "cardhu-a04" rather than just "cardhu".

The Linux kernel has separate DTs for Cardhu A02 and A04, although the
former isn't really supported any more. Consequently, the kernel DT file
that matches the U-Boot cardhu build is "tegra30-cardhu-a04.dtb" rather
than "tegra30-cardhu.dtb". Set the $fdtfile default environment variable
to reflect this.

Signed-off-by: Stephen Warren 
---
v2: New patch.

Note that this series depends on the following, which are not yet
applied:

(dgilmore) cmd_pxe.c add any option for filesystem with sysboot uses generic 
load
(dgilmore) config: add config_distro_defaults.h
(swarren) pxe: implement fdtdir extlinux.conf tag
(swarren) fs: fix generic save command implementation
(swarren) fs: implement infra-structure for an 'exists' function
(swarren) sandbox: implement fs_exists() and 'sb exists' shell function
(swarren) ext4: implement exists() for ext4fs
(swarren) fat: implement exists() for FAT fs
---
 include/configs/cardhu.h| 4 
 include/configs/tegra-common-post.h | 7 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h
index 4abb03ea56dd..e80d1a6fa3a4 100644
--- a/include/configs/cardhu.h
+++ b/include/configs/cardhu.h
@@ -30,6 +30,10 @@
 #define V_PROMPT   "Tegra30 (Cardhu) # "
 #define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Cardhu"
 
+#define BOARD_EXTRA_ENV_SETTINGS \
+   "board_name=cardhu-a04\0" \
+   "fdtfile=tegra30-cardhu-a04.dtb\0"
+
 /* Board-specific serial config */
 #define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTA
diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index a3242fe61299..020b9b17b1d0 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -129,10 +129,15 @@
"stderr=serial" STDOUT_LCD "\0" \
""
 
+#ifndef BOARD_EXTRA_ENV_SETTINGS
+#define BOARD_EXTRA_ENV_SETTINGS
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
TEGRA_DEVICE_SETTINGS \
MEM_LAYOUT_ENV_SETTINGS \
-   BOOTCMDS_COMMON
+   BOOTCMDS_COMMON \
+   BOARD_EXTRA_ENV_SETTINGS
 
 #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || 
defined(CONFIG_TEGRA114_SPI)
 #define CONFIG_FDT_SPI
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 3/5] ARM: tegra: rework boot scripts

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

Update the common Tegra boot scripts in the default environment to

a) Make use of the new "exists" shell command to avoid some error
   messges.

b) Allow booting using the sysboot command and extlinux.conf. This
   allows easy creation of boot menus, and provides a simple interface
   for distros to parameterize/configure the boot process.

Signed-off-by: Stephen Warren 
---
v2: No change
---
 include/configs/tegra-common-post.h | 39 -
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index 020b9b17b1d0..fa69709e5a3d 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -69,20 +69,41 @@
 #define BOOTCMDS_COMMON \
"rootpart=1\0" \
\
+   "do_script_boot=" \
+   "load ${devtype} ${devnum}:${rootpart} "  \
+   "${scriptaddr} ${prefix}${script}; "  \
+   "source ${scriptaddr}\0"  \
+   \
"script_boot="\
-   "if load ${devtype} ${devnum}:${rootpart} "   \
-   "${scriptaddr} ${prefix}${script}; then " \
-   "echo ${script} found! Executing ...;"\
-   "source ${scriptaddr};"   \
-   "fi;\0"   \
+   "for script in ${boot_scripts}; do "  \
+   "if exists ${devtype} ${devnum}:${rootpart} " \
+   "${prefix}${script}; then "   \
+   "echo Found U-Boot script "   \
+   "${prefix}${script}; "\
+   "run do_script_boot;" \
+   "echo SCRIPT FAILED; continuing...; " \
+   "fi; "\
+   "done\0"  \
+   \
+   "do_sysboot_boot="\
+   "sysboot ${devtype} ${devnum}:${rootpart} any "   \
+   "${scriptaddr} ${prefix}extlinux.conf\0"  \
+   \
+   "sysboot_boot="   \
+   "if exists ${devtype} ${devnum}:${rootpart} " \
+   "${prefix}extlinux.conf; then "   \
+   "echo Found extlinux config " \
+   "${prefix}extlinux.conf; "\
+   "run do_sysboot_boot;"\
+   "echo SCRIPT FAILED; continuing...; " \
+   "fi\0"\
\
"scan_boot="  \
"echo Scanning ${devtype} ${devnum}...; " \
"for prefix in ${boot_prefixes}; do " \
-   "for script in ${boot_scripts}; do "  \
-   "run script_boot; "   \
-   "done; "  \
-   "done;\0" \
+   "run script_boot; "   \
+   "run sysboot_boot; "  \
+   "done\0"  \
\
"boot_targets=" \
BOOT_TARGETS_MMC " " \
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 4/5] ARM: tegra: implement bootcmd_pxe

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

This retrieves a PXE config file over the network, and executes it. This
allows an extlinux config file  to be retrieved over the network and
executed, whereas the existing bootcmd_dhcp retrieves a U-Boot script.

Signed-off-by: Stephen Warren 
---
v2: No change
---
 include/configs/tegra-common-post.h | 18 +-
 include/configs/tegra114-common.h   |  4 
 include/configs/tegra20-common.h|  4 
 include/configs/tegra30-common.h|  4 
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index fa69709e5a3d..b3e1cfd5de8c 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -66,6 +66,20 @@
 #define BOOT_TARGETS_DHCP ""
 #endif
 
+#if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
+#define BOOTCMDS_PXE \
+   "bootcmd_pxe=" \
+   BOOTCMD_INIT_USB \
+   "dhcp; " \
+   "if pxe get; then " \
+   "pxe boot; " \
+   "fi\0"
+#define BOOT_TARGETS_PXE "pxe"
+#else
+#define BOOTCMDS_PXE ""
+#define BOOT_TARGETS_PXE ""
+#endif
+
 #define BOOTCMDS_COMMON \
"rootpart=1\0" \
\
@@ -108,6 +122,7 @@
"boot_targets=" \
BOOT_TARGETS_MMC " " \
BOOT_TARGETS_USB " " \
+   BOOT_TARGETS_PXE " " \
BOOT_TARGETS_DHCP " " \
"\0" \
\
@@ -117,7 +132,8 @@
\
BOOTCMDS_MMC \
BOOTCMDS_USB \
-   BOOTCMDS_DHCP
+   BOOTCMDS_DHCP \
+   BOOTCMDS_PXE
 
 #define CONFIG_BOOTCOMMAND \
"for target in ${boot_targets}; do run bootcmd_${target}; done"
diff --git a/include/configs/tegra114-common.h 
b/include/configs/tegra114-common.h
index a4e8a5f5eb53..e7d4373c1eca 100644
--- a/include/configs/tegra114-common.h
+++ b/include/configs/tegra114-common.h
@@ -51,6 +51,9 @@
  * scriptaddr can be pretty much anywhere that doesn't conflict with something
  *   else. Put it above BOOTMAPSZ to eliminate conflicts.
  *
+ * pxefile_addr_r can be pretty much anywhere that doesn't conflict with
+ *   something else. Put it above BOOTMAPSZ to eliminate conflicts.
+ *
  * kernel_addr_r must be within the first 128M of RAM in order for the
  *   kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will
  *   decompress itself to 0x8000 after the start of RAM, kernel_addr_r
@@ -68,6 +71,7 @@
  */
 #define MEM_LAYOUT_ENV_SETTINGS \
"scriptaddr=0x9000\0" \
+   "pxefile_addr_r=0x9010\0" \
"kernel_addr_r=0x8100\0" \
"fdt_addr_r=0x8200\0" \
"ramdisk_addr_r=0x8210\0"
diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
index b009a316b14c..ca3972235bba 100644
--- a/include/configs/tegra20-common.h
+++ b/include/configs/tegra20-common.h
@@ -49,6 +49,9 @@
  * scriptaddr can be pretty much anywhere that doesn't conflict with something
  *   else. Put it above BOOTMAPSZ to eliminate conflicts.
  *
+ * pxefile_addr_r can be pretty much anywhere that doesn't conflict with
+ *   something else. Put it above BOOTMAPSZ to eliminate conflicts.
+ *
  * kernel_addr_r must be within the first 128M of RAM in order for the
  *   kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will
  *   decompress itself to 0x8000 after the start of RAM, kernel_addr_r
@@ -66,6 +69,7 @@
  */
 #define MEM_LAYOUT_ENV_SETTINGS \
"scriptaddr=0x1000\0" \
+   "pxefile_addr_r=0x1010\0" \
"kernel_addr_r=0x0100\0" \
"fdt_addr_r=0x0200\0" \
"ramdisk_addr_r=0x0210\0"
diff --git a/include/configs/tegra30-common.h b/include/configs/tegra30-common.h
index b5550d7d099c..95d154744041 100644
--- a/include/configs/tegra30-common.h
+++ b/include/configs/tegra30-common.h
@@ -48,6 +48,9 @@
  * scriptaddr can be pretty much anywhere that doesn't conflict with something
  *   else. Put it above BOOTMAPSZ to eliminate conflicts.
  *
+ * pxefile_addr_r can be pretty much anywhere that doesn't conflict with
+ *   something else. Put it above BOOTMAPSZ to eliminate conflicts.
+ *
  * kernel_addr_r must be within the first 128M of RAM in order for the
  *   kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will
  *   decompress itself to 0x8000 after the start of RAM, kernel_addr_r
@@ -65,6 +68,7 @@
  */
 #define MEM_LAYOUT_ENV_SETTINGS \
"scriptaddr=0x9000\0" \
+   "pxefile_addr_r=0x9010\0" \
"kernel_addr_r=0x8100\0" \
"fdt_addr_r=0x8200\0" \
"ramdisk_addr_r=0x8210\0"
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 2/5] ARM: tegra: convert tegra to use distro defaults

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

Modify all Tegra boards to include the "distro defaults" header, so that
all the config options distros expect are enabled. Remove any #defines
that enable the same options from the Tegra files.

Signed-off-by: Stephen Warren 
---
v2: No change
---
 include/configs/tegra-common.h | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
index 522cd4133d77..bbe417a13ec7 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -29,7 +29,6 @@
 #define CONFIG_DISPLAY_BOARDINFO
 
 #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
-#define CONFIG_OF_LIBFDT   /* enable passing of devicetree */
 
 /* Environment */
 #define CONFIG_ENV_VARS_UBOOT_CONFIG
@@ -69,33 +68,20 @@
 #undef CONFIG_CMD_NET  /* network support */
 
 /* turn on command-line edit/hist/auto */
-#define CONFIG_CMDLINE_EDITING
 #define CONFIG_COMMAND_HISTORY
-#define CONFIG_AUTO_COMPLETE
 
 /* turn on commonly used storage-related commands */
-
-#define CONFIG_DOS_PARTITION
-#define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
-#define CONFIG_FS_EXT4
-#define CONFIG_FS_FAT
-#define CONFIG_CMD_EXT2
-#define CONFIG_CMD_FAT
-#define CONFIG_CMD_FS_GENERIC
 #define CONFIG_CMD_PART
 
 #define CONFIG_SYS_NO_FLASH
 
 #define CONFIG_CONSOLE_MUX
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
-#define CONFIG_BOOTDELAY   2   /* -1 to disable auto boot */
 
 /*
  * Miscellaneous configurable options
  */
-#define CONFIG_SYS_LONGHELP/* undef to save memory */
-#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */
 #define CONFIG_SYS_PROMPT  V_PROMPT
 /*
  * Increasing the size of the IO buffer as default nfsargs size is more
@@ -133,8 +119,6 @@
 #define CONFIG_TEGRA_GPIO
 #define CONFIG_CMD_GPIO
 #define CONFIG_CMD_ENTERRCM
-#define CONFIG_CMD_BOOTZ
-#define CONFIG_SUPPORT_RAW_INITRD
 
 /* Defines for SPL */
 #define CONFIG_SPL
@@ -157,4 +141,8 @@
 #define CONFIG_BOUNCE_BUFFER
 #define CONFIG_CRC32_VERIFY
 
+#ifndef CONFIG_SPL_BUILD
+#include 
+#endif
+
 #endif /* _TEGRA_COMMON_H_ */
-- 
1.8.1.5

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


[U-Boot] [PATCH][v0] powerpc/mpc85xx: Update LIODNs for T1040

2014-01-23 Thread Poonam Aggrwal
Removed LIODNs for RMAN, RIO, 10G. T1040 has 10 QMAN portals so assigned
LIODNs accordingly.

Signed-off-by: Poonam Aggrwal 
---
 arch/powerpc/cpu/mpc85xx/t1040_ids.c |   36 --
 1 files changed, 0 insertions(+), 36 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/t1040_ids.c 
b/arch/powerpc/cpu/mpc85xx/t1040_ids.c
index 32075ce..68160a9 100644
--- a/arch/powerpc/cpu/mpc85xx/t1040_ids.c
+++ b/arch/powerpc/cpu/mpc85xx/t1040_ids.c
@@ -21,21 +21,6 @@ struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
SET_QP_INFO(8, 34, 1, 3),
SET_QP_INFO(9, 35, 1, 0),
SET_QP_INFO(10, 36, 1, 0),
-   SET_QP_INFO(11, 37, 1, 1),
-   SET_QP_INFO(12, 38, 1, 1),
-   SET_QP_INFO(13, 39, 1, 2),
-   SET_QP_INFO(14, 40, 1, 2),
-   SET_QP_INFO(15, 41, 1, 3),
-   SET_QP_INFO(16, 42, 1, 3),
-   SET_QP_INFO(17, 43, 1, 0),
-   SET_QP_INFO(18, 44, 1, 0),
-   SET_QP_INFO(19, 45, 1, 1),
-   SET_QP_INFO(20, 46, 1, 1),
-   SET_QP_INFO(21, 47, 1, 2),
-   SET_QP_INFO(22, 48, 1, 2),
-   SET_QP_INFO(23, 49, 1, 3),
-   SET_QP_INFO(24, 50, 1, 3),
-   SET_QP_INFO(25, 51, 1, 0),
 };
 #endif
 
@@ -60,11 +45,6 @@ struct liodn_id_table liodn_tbl[] = {
SET_DMA_LIODN(1, 147),
SET_DMA_LIODN(2, 227),
 
-   SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0),
-   SET_GUTS_LIODN(NULL, 200, rio2liodnr, 0),
-   SET_GUTS_LIODN(NULL, 201, rio1maintliodnr, 0),
-   SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
-
/* SET_NEXUS_LIODN(557), -- not yet implemented */
 };
 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
@@ -77,8 +57,6 @@ struct liodn_id_table fman1_liodn_tbl[] = {
SET_FMAN_RX_1G_LIODN(1, 3, 91),
SET_FMAN_RX_1G_LIODN(1, 4, 92),
SET_FMAN_RX_1G_LIODN(1, 5, 93),
-   SET_FMAN_RX_10G_LIODN(1, 0, 94),
-   SET_FMAN_RX_10G_LIODN(1, 1, 95),
 };
 int fman1_liodn_tbl_sz = ARRAY_SIZE(fman1_liodn_tbl);
 #endif
@@ -97,23 +75,9 @@ struct liodn_id_table sec_liodn_tbl[] = {
 };
 int sec_liodn_tbl_sz = ARRAY_SIZE(sec_liodn_tbl);
 
-#ifdef CONFIG_SYS_DPAA_RMAN
-struct liodn_id_table rman_liodn_tbl[] = {
-   /* Set RMan block 0-3 liodn offset */
-   SET_RMAN_LIODN(0, 678),
-   SET_RMAN_LIODN(1, 679),
-   SET_RMAN_LIODN(2, 680),
-   SET_RMAN_LIODN(3, 681),
-};
-int rman_liodn_tbl_sz = ARRAY_SIZE(rman_liodn_tbl);
-#endif
-
 struct liodn_id_table liodn_bases[] = {
[FSL_HW_PORTAL_SEC]  = SET_LIODN_BASE_2(462, 558),
 #ifdef CONFIG_SYS_DPAA_FMAN
[FSL_HW_PORTAL_FMAN1] = SET_LIODN_BASE_1(973),
 #endif
-#ifdef CONFIG_SYS_DPAA_RMAN
-   [FSL_HW_PORTAL_RMAN] = SET_LIODN_BASE_1(922),
-#endif
 };
-- 
1.7.4.1



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


[U-Boot] [PATCH V2 02/13] ARM: tegra: misc cleanups triggered by Tegra124 review

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

Use a named constant for the PLL lock bit in enable_cpu_clocks().

Construct the complete value of pmc_pwrgate_toggle, rather than doing a
read-modify-write; the register is simple enough and doesn't need to
maintain state between operations.

Signed-off-by: Stephen Warren 
---
v2: New patch, split out from the later Tegra124 changes.
---
 arch/arm/cpu/arm720t/tegra114/cpu.c   | 6 ++
 arch/arm/include/asm/arch-tegra/clk_rst.h | 3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/arm720t/tegra114/cpu.c 
b/arch/arm/cpu/arm720t/tegra114/cpu.c
index 385e1a1c86e0..a5de100140ab 100644
--- a/arch/arm/cpu/arm720t/tegra114/cpu.c
+++ b/arch/arm/cpu/arm720t/tegra114/cpu.c
@@ -68,7 +68,7 @@ static void enable_cpu_clocks(void)
/* Wait for PLL-X to lock */
do {
reg = readl(&clkrst->crc_pll_simple[SIMPLE_PLLX].pll_base);
-   } while ((reg & (1 << 27)) == 0);
+   } while ((reg & PLL_LOCK_MASK) == 0);
 
/* Wait until all clocks are stable */
udelay(PLL_STABILIZATION_DELAY);
@@ -221,9 +221,7 @@ static void power_partition(u32 status, u32 partid)
if (!is_partition_powered(status)) {
/* No, toggle the partition power state (OFF -> ON) */
debug("power_partition, toggling state\n");
-   clrbits_le32(&pmc->pmc_pwrgate_toggle, 0x1F);
-   setbits_le32(&pmc->pmc_pwrgate_toggle, partid);
-   setbits_le32(&pmc->pmc_pwrgate_toggle, START_CP);
+   writel(START_CP | partid, &pmc->pmc_pwrgate_toggle);
 
/* Wait for the power to come up */
while (!is_partition_powered(status))
diff --git a/arch/arm/include/asm/arch-tegra/clk_rst.h 
b/arch/arm/include/asm/arch-tegra/clk_rst.h
index 021cfcc3c602..b9dccd9c189f 100644
--- a/arch/arm/include/asm/arch-tegra/clk_rst.h
+++ b/arch/arm/include/asm/arch-tegra/clk_rst.h
@@ -160,6 +160,9 @@ struct clk_rst_ctlr {
 
 #define PLL_BASE_OVRRIDE_MASK  (1U << 28)
 
+#define PLL_LOCK_SHIFT 27
+#define PLL_LOCK_MASK  (1U << PLL_LOCK_SHIFT)
+
 #define PLL_DIVP_SHIFT 20
 #define PLL_DIVP_MASK  (7U << PLL_DIVP_SHIFT)
 
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 05/13] ARM: tegra: only build __pinmux_nand() when it's needed

2014-01-23 Thread Stephen Warren
From: Tom Warren 

__pinmux_nand() won't compile if PERIPH_ID_NDFLASH isn't defined.
Prevent this from causing build problems on newer SoCs without NAND
support (or without SW support for NAND yet), but preventing
compilation unless the function will actually be used, i.e. when
CONFIG_TEGRA_NAND is defined.

Signed-off-by: Tom Warren 
[swarren, rewrote commit description, moved ifdef around whole function
rather than just body]
Signed-off-by: Stephen Warren 
---
v2:
* Fixed TODO by moving the ifdef around the whole function rather than
  being inside the function body. The call to the function is under the
  same ifdef.
---
 board/nvidia/common/board.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
index 1972527e7d11..aa42c69f904e 100644
--- a/board/nvidia/common/board.c
+++ b/board/nvidia/common/board.c
@@ -78,12 +78,14 @@ void __gpio_early_init_uart(void)
 void gpio_early_init_uart(void)
 __attribute__((weak, alias("__gpio_early_init_uart")));
 
+#if defined(CONFIG_TEGRA_NAND)
 void __pin_mux_nand(void)
 {
funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_DEFAULT);
 }
 
 void pin_mux_nand(void) __attribute__((weak, alias("__pin_mux_nand")));
+#endif
 
 void __pin_mux_display(void)
 {
-- 
1.8.1.5

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


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

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

Tegra124's MMC controller is very similar to earlier SoC generations,
and can be supported by the same driver.

However, there are some non-backwards-compatible HW differences, and
hence a new DT compatible value must be used to describe the HW. This
patch updates the driver to support that new compatible value.

That said, the HW differences are only relevant when enabling certain
high-performance transfer modes. Since the driver is currently very
simple and doesn't enable those modes, we don't actually need to address
any of these HW differences in the code yet, hence the simple nature of
this patch.

Cc: Pantelis Antoniou 
Signed-off-by: Stephen Warren 
---
v2: New patch.

This patch is needed for MMC support on Tegra124 at run-time, but not
strictly required at compile-time. So, it can either go into the MMC
tree and all get merged together in the main U-Boot repo, or the MMC
maintainer can ack it to go through the Tegra tree with the rest of
the changes.
---
 drivers/mmc/tegra_mmc.c | 9 +
 include/fdtdec.h| 1 +
 lib/fdtdec.c| 1 +
 3 files changed, 11 insertions(+)

diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c
index e1817e24f6d4..3d1ce1263c82 100644
--- a/drivers/mmc/tegra_mmc.c
+++ b/drivers/mmc/tegra_mmc.c
@@ -668,6 +668,15 @@ void tegra_mmc_init(void)
const void *blob = gd->fdt_blob;
debug("%s entry\n", __func__);
 
+   /* See if any Tegra124 MMC controllers are present */
+   count = fdtdec_find_aliases_for_id(blob, "sdhci",
+   COMPAT_NVIDIA_TEGRA124_SDMMC, node_list, MAX_HOSTS);
+   debug("%s: count of Tegra124 sdhci nodes is %d\n", __func__, count);
+   if (process_nodes(blob, node_list, count)) {
+   printf("%s: Error processing T30 mmc node(s)!\n", __func__);
+   return;
+   }
+
/* See if any Tegra30 MMC controllers are present */
count = fdtdec_find_aliases_for_id(blob, "sdhci",
COMPAT_NVIDIA_TEGRA30_SDMMC, node_list, MAX_HOSTS);
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 433d6a7c0256..19bab7944817 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -59,6 +59,7 @@ enum fdt_compat_id {
COMPAT_NVIDIA_TEGRA20_NAND, /* Tegra2 NAND controller */
COMPAT_NVIDIA_TEGRA20_PWM,  /* Tegra 2 PWM controller */
COMPAT_NVIDIA_TEGRA20_DC,   /* Tegra 2 Display controller */
+   COMPAT_NVIDIA_TEGRA124_SDMMC,   /* Tegra124 SDMMC controller */
COMPAT_NVIDIA_TEGRA30_SDMMC,/* Tegra30 SDMMC controller */
COMPAT_NVIDIA_TEGRA20_SDMMC,/* Tegra20 SDMMC controller */
COMPAT_NVIDIA_TEGRA20_SFLASH,   /* Tegra 2 SPI flash controller */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 207314fa72fb..1fecab3fbc30 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -32,6 +32,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
COMPAT(NVIDIA_TEGRA20_PWM, "nvidia,tegra20-pwm"),
COMPAT(NVIDIA_TEGRA20_DC, "nvidia,tegra20-dc"),
+   COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
COMPAT(NVIDIA_TEGRA20_SDMMC, "nvidia,tegra20-sdhci"),
COMPAT(NVIDIA_TEGRA20_SFLASH, "nvidia,tegra20-sflash"),
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 04/13] ARM: tegra: remove a conditional for CSITE rate

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

There's already an SoC-specific conditional in cpu.h to determine the
PLLP rate. Define the CSITE clock rate inside the same conditional, so
that we can remove a conditional from clock_enable_coresight(). This
means one less place to update the code for new SoCs.

Signed-off-by: Stephen Warren 
---
v2: New patch, split out from the later Tegra124 changes.
---
 arch/arm/cpu/arm720t/tegra-common/cpu.c | 12 +---
 arch/arm/cpu/arm720t/tegra-common/cpu.h |  8 +---
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/arch/arm/cpu/arm720t/tegra-common/cpu.c 
b/arch/arm/cpu/arm720t/tegra-common/cpu.c
index 322ce10d6fe3..d62bb9e370e0 100644
--- a/arch/arm/cpu/arm720t/tegra-common/cpu.c
+++ b/arch/arm/cpu/arm720t/tegra-common/cpu.c
@@ -315,7 +315,6 @@ void reset_A9_cpu(int reset)
 void clock_enable_coresight(int enable)
 {
u32 rst, src = 2;
-   int soc_type;
 
debug("clock_enable_coresight entry\n");
clock_set_enable(PERIPH_ID_CORESIGHT, enable);
@@ -328,16 +327,7 @@ void clock_enable_coresight(int enable)
 * Clock divider request would setup CSITE clock as 144MHz
 * for PLLP base 216MHz and 204MHz for PLLP base 408MHz
 */
-
-   soc_type = tegra_get_chip();
-   if (soc_type == CHIPID_TEGRA30 || soc_type == CHIPID_TEGRA114)
-   src = CLK_DIVIDER(NVBL_PLLP_KHZ, 204000);
-   else if (soc_type == CHIPID_TEGRA20)
-   src = CLK_DIVIDER(NVBL_PLLP_KHZ, 144000);
-   else
-   printf("%s: Unknown SoC type %X!\n",
-__func__, soc_type);
-
+   src = CLK_DIVIDER(NVBL_PLLP_KHZ, CSITE_KHZ);
clock_ll_set_source_divisor(PERIPH_ID_CSI, 0, src);
 
/* Unlock the CPU CoreSight interfaces */
diff --git a/arch/arm/cpu/arm720t/tegra-common/cpu.h 
b/arch/arm/cpu/arm720t/tegra-common/cpu.h
index 60412c7f87eb..d1520ce2cc88 100644
--- a/arch/arm/cpu/arm720t/tegra-common/cpu.h
+++ b/arch/arm/cpu/arm720t/tegra-common/cpu.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2010-2011
+ * (C) Copyright 2010-2014
  * NVIDIA Corporation 
  *
  * SPDX-License-Identifier:GPL-2.0+
@@ -11,9 +11,11 @@
 #define IO_STABILIZATION_DELAY (1000)
 
 #if defined(CONFIG_TEGRA20)
-#define NVBL_PLLP_KHZ  (216000)
+#define NVBL_PLLP_KHZ  216000
+#define CSITE_KHZ  144000
 #elif defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA114)
-#define NVBL_PLLP_KHZ  (408000)
+#define NVBL_PLLP_KHZ  408000
+#define CSITE_KHZ  204000
 #else
 #error "Unknown Tegra chip!"
 #endif
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 03/13] ARM: tegra: enable PLLX only once it's been fully configured

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

This programming sequence is correct per Jimmy Zhang, and makes sense
too!

Signed-off-by: Stephen Warren 
---
v2: New patch, split out from the later Tegra124 changes.
---
 arch/arm/cpu/arm720t/tegra-common/cpu.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/arm720t/tegra-common/cpu.c 
b/arch/arm/cpu/arm720t/tegra-common/cpu.c
index 03f67b163cc5..322ce10d6fe3 100644
--- a/arch/arm/cpu/arm720t/tegra-common/cpu.c
+++ b/arch/arm/cpu/arm720t/tegra-common/cpu.c
@@ -144,18 +144,23 @@ int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, 
u32 divm,
reg |= (1 << PLL_DCCON_SHIFT);
writel(reg, &pll->pll_misc);
 
-   /* Enable PLLX */
-   reg = readl(&pll->pll_base);
-   reg |= PLL_ENABLE_MASK;
-
/* Disable BYPASS */
+   reg = readl(&pll->pll_base);
reg &= ~PLL_BYPASS_MASK;
writel(reg, &pll->pll_base);
+   debug("pllx_set_rate: base = 0x%08X\n", reg);
 
/* Set lock_enable to PLLX_MISC */
reg = readl(&pll->pll_misc);
reg |= PLL_LOCK_ENABLE_MASK;
writel(reg, &pll->pll_misc);
+   debug("pllx_set_rate: misc = 0x%08X\n", reg);
+
+   /* Enable PLLX last, once it's all configured */
+   reg = readl(&pll->pll_base);
+   reg |= PLL_ENABLE_MASK;
+   writel(reg, &pll->pll_base);
+   debug("pllx_set_rate: base final = 0x%08X\n", reg);
 
return 0;
 }
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 06/13] ARM: tegra: fix a typo in the tegra114.dtsi

2014-01-23 Thread Stephen Warren
From: Stephen Warren 

The reg property for node spi@7000d800 was wrong. Fix it to match the
HW. This change was verified against the Linux kernel.

Signed-off-by: Stephen Warren 
---
 arch/arm/dts/tegra114.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/tegra114.dtsi b/arch/arm/dts/tegra114.dtsi
index 626cc3c982e7..f52fcf14dddc 100644
--- a/arch/arm/dts/tegra114.dtsi
+++ b/arch/arm/dts/tegra114.dtsi
@@ -139,7 +139,7 @@
 
spi@7000d800 {
compatible = "nvidia,tegra114-spi";
-   reg = <0x7000d480 0x200>;
+   reg = <0x7000d800 0x200>;
interrupts = <0 83 0x04>;
nvidia,dma-request-selector = <&apbdma 17>;
#address-cells = <1>;
-- 
1.8.1.5

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


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

2014-01-23 Thread Stephen Warren
From: Tom Warren 

This provides SPL support for Tegra124 boards - AVP early init, plus
CPU (A15) init/jump to main U-Boot.

Signed-off-by: Tom Warren 
Signed-off-by: Stephen Warren 
---
v2:
* Convert to Kconfig-style make Makefiles.
* Update AVP/PLLP clock programming to match Tegra114.
* Extracted changes to PLLX programming order into a separate patch.
* Use PLL_LOCK_MASK constant instead of a hard-coded value.
* No need to read-modify-write pmc_pwrgate_toggle or
  crc_clk_cpu_cmplx_clr.
* s/1x4/Tegra124/
* don't mangle (c) header in cpu.c.
* Remove leading space from debug() messages.
* Fix comment re: CPUPWRGOOD_TIMER
* Various code formatting fixes and redundant bracket and comment
  removal.
---
 arch/arm/cpu/arm720t/tegra-common/cpu.c |  30 +++-
 arch/arm/cpu/arm720t/tegra-common/cpu.h |   4 +-
 arch/arm/cpu/arm720t/tegra124/Makefile  |   8 +
 arch/arm/cpu/arm720t/tegra124/config.mk |   7 +
 arch/arm/cpu/arm720t/tegra124/cpu.c | 265 
 5 files changed, 312 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/arm720t/tegra124/Makefile
 create mode 100644 arch/arm/cpu/arm720t/tegra124/config.mk
 create mode 100644 arch/arm/cpu/arm720t/tegra124/cpu.c

diff --git a/arch/arm/cpu/arm720t/tegra-common/cpu.c 
b/arch/arm/cpu/arm720t/tegra-common/cpu.c
index d62bb9e370e0..b2074157c01a 100644
--- a/arch/arm/cpu/arm720t/tegra-common/cpu.c
+++ b/arch/arm/cpu/arm720t/tegra-common/cpu.c
@@ -112,6 +112,22 @@ struct clk_pll_table 
tegra_pll_x_table[TEGRA_SOC_CNT][CLOCK_OSC_FREQ_COUNT] = {
{ .n = 116, .m = 1, .p = 1 }, /* OSC: 12.0 MHz */
{ .n = 108, .m = 2, .p = 1 }, /* OSC: 26.0 MHz */
},
+
+   /*
+* T124: 700 MHz
+*
+* Register   Field  Bits   Width
+* --
+* PLLX_BASE  p  23:204
+* PLLX_BASE  n  15: 88
+* PLLX_BASE  m   7: 08
+*/
+   {
+   { .n = 108, .m = 1, .p = 1 }, /* OSC: 13.0 MHz */
+   { .n =  73, .m = 1, .p = 1 }, /* OSC: 19.2 MHz */
+   { .n = 116, .m = 1, .p = 1 }, /* OSC: 12.0 MHz */
+   { .n = 108, .m = 2, .p = 1 }, /* OSC: 26.0 MHz */
+   },
 };
 
 int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm,
@@ -128,6 +144,18 @@ int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, 
u32 divm,
 
debug(" pllx_set_rate entry\n");
 
+#if defined(CONFIG_TEGRA124)
+   struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+
+   /* Disable IDDQ */
+   reg = readl(&clkrst->crc_pllx_misc3);
+   reg &= ~PLLX_IDDQ_MASK;
+   writel(reg, &clkrst->crc_pllx_misc3);
+   udelay(2);
+   debug("%s: IDDQ: PLLX IDDQ = 0x%08X\n", __func__,
+ readl(&clkrst->crc_pllx_misc3));
+#endif /* CONFIG_TEGRA124 */
+
/* Set BYPASS, m, n and p to PLLX_BASE */
reg = PLL_BYPASS_MASK | (divm << PLL_DIVM_SHIFT);
reg |= ((divn << PLL_DIVN_SHIFT) | (divp << PLL_DIVP_SHIFT));
@@ -323,7 +351,7 @@ void clock_enable_coresight(int enable)
if (enable) {
/*
 * Put CoreSight on PLLP_OUT0 and divide it down as per
-* PLLP base frequency based on SoC type (T20/T30/T114).
+* PLLP base frequency based on SoC type (T20/T30+).
 * Clock divider request would setup CSITE clock as 144MHz
 * for PLLP base 216MHz and 204MHz for PLLP base 408MHz
 */
diff --git a/arch/arm/cpu/arm720t/tegra-common/cpu.h 
b/arch/arm/cpu/arm720t/tegra-common/cpu.h
index d1520ce2cc88..b4ca44fce18a 100644
--- a/arch/arm/cpu/arm720t/tegra-common/cpu.h
+++ b/arch/arm/cpu/arm720t/tegra-common/cpu.h
@@ -13,7 +13,8 @@
 #if defined(CONFIG_TEGRA20)
 #define NVBL_PLLP_KHZ  216000
 #define CSITE_KHZ  144000
-#elif defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA114)
+#elif defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA114) || \
+   defined(CONFIG_TEGRA124)
 #define NVBL_PLLP_KHZ  408000
 #define CSITE_KHZ  204000
 #else
@@ -70,3 +71,4 @@ int tegra_get_chip(void);
 int tegra_get_sku_info(void);
 int tegra_get_chip_sku(void);
 void adjust_pllp_out_freqs(void);
+void pmic_enable_cpu_vdd(void);
diff --git a/arch/arm/cpu/arm720t/tegra124/Makefile 
b/arch/arm/cpu/arm720t/tegra124/Makefile
new file mode 100644
index ..61abf45d3d29
--- /dev/null
+++ b/arch/arm/cpu/arm720t/tegra124/Makefile
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += cpu.o
diff --git a/arch/arm/cpu/arm720t/tegra124/config.mk 
b/arch/arm/cpu/arm720t/tegra124/config.mk
new file mode 100644
index ..5e10701f0ea8
--- /dev/null
+++ b/arch/arm/cpu/arm720t/tegra124/config.mk
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2010-2013
+# NVIDIA Corporation 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#/
+USE_PRIVATE_LIBGCC = yes
diff --git a/arch/arm/cpu/arm720t/teg

[U-Boot] [PATCH V2 09/13] ARM: tegra: Add CPU (armv7) files for Tegra124

2014-01-23 Thread Stephen Warren
From: Tom Warren 

These files are for code that runs on the CPU (A15) on Tegra124 boards.
At this time, there is no A15-specific code here. The warmboot/LP0 files
aren't included as that code hasn't been ported yet.

Signed-off-by: Tom Warren 
Signed-off-by: Stephen Warren 
---
v2:
* Convert to Kconfig-style make Makefiles.
* s/MASK_BITS_29_28/MASK_BITS_31_28/ to match earlier renaming patch.
* Update AVP/PLLP clock programming to match Tegra114.
* Minor whitespace & comment cleanup.
---
 arch/arm/cpu/armv7/tegra124/Makefile   |   6 +
 arch/arm/cpu/armv7/tegra124/config.mk  |  10 +
 arch/arm/cpu/tegra124-common/Makefile  |  10 +
 arch/arm/cpu/tegra124-common/clock.c   | 826 +
 arch/arm/cpu/tegra124-common/funcmux.c |  69 +++
 arch/arm/cpu/tegra124-common/pinmux.c  | 730 +
 6 files changed, 1651 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/tegra124/Makefile
 create mode 100644 arch/arm/cpu/armv7/tegra124/config.mk
 create mode 100644 arch/arm/cpu/tegra124-common/Makefile
 create mode 100644 arch/arm/cpu/tegra124-common/clock.c
 create mode 100644 arch/arm/cpu/tegra124-common/funcmux.c
 create mode 100644 arch/arm/cpu/tegra124-common/pinmux.c

diff --git a/arch/arm/cpu/armv7/tegra124/Makefile 
b/arch/arm/cpu/armv7/tegra124/Makefile
new file mode 100644
index ..7f127b1ee554
--- /dev/null
+++ b/arch/arm/cpu/armv7/tegra124/Makefile
@@ -0,0 +1,6 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
diff --git a/arch/arm/cpu/armv7/tegra124/config.mk 
b/arch/arm/cpu/armv7/tegra124/config.mk
new file mode 100644
index ..2f1c645c6951
--- /dev/null
+++ b/arch/arm/cpu/armv7/tegra124/config.mk
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2013
+# NVIDIA Corporation 
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+CONFIG_ARCH_DEVICE_TREE := tegra124
diff --git a/arch/arm/cpu/tegra124-common/Makefile 
b/arch/arm/cpu/tegra124-common/Makefile
new file mode 100644
index ..ff77992b330c
--- /dev/null
+++ b/arch/arm/cpu/tegra124-common/Makefile
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += clock.o
+obj-y  += funcmux.o
+obj-y  += pinmux.o
diff --git a/arch/arm/cpu/tegra124-common/clock.c 
b/arch/arm/cpu/tegra124-common/clock.c
new file mode 100644
index ..ad9962422ad2
--- /dev/null
+++ b/arch/arm/cpu/tegra124-common/clock.c
@@ -0,0 +1,826 @@
+/*
+ * (C) Copyright 2013
+ * NVIDIA Corporation 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/* Tegra124 Clock control functions */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Clock types that we can use as a source. The Tegra124 has muxes for the
+ * peripheral clocks, and in most cases there are four options for the clock
+ * source. This gives us a clock 'type' and exploits what commonality exists
+ * in the device.
+ *
+ * Letters are obvious, except for T which means CLK_M, and S which means the
+ * clock derived from 32KHz. Beware that CLK_M (also called OSC in the
+ * datasheet) and PLL_M are different things. The former is the basic
+ * clock supplied to the SOC from an external oscillator. The latter is the
+ * memory clock PLL.
+ *
+ * See definitions in clock_id in the header file.
+ */
+enum clock_type_id {
+   CLOCK_TYPE_AXPT,/* PLL_A, PLL_X, PLL_P, CLK_M */
+   CLOCK_TYPE_MCPA,/* and so on */
+   CLOCK_TYPE_MCPT,
+   CLOCK_TYPE_PCM,
+   CLOCK_TYPE_PCMT,
+   CLOCK_TYPE_PDCT,
+   CLOCK_TYPE_ACPT,
+   CLOCK_TYPE_ASPTE,
+   CLOCK_TYPE_PMDACD2T,
+   CLOCK_TYPE_PCST,
+
+   CLOCK_TYPE_PC2CC3M,
+   CLOCK_TYPE_PC2CC3S_T,
+   CLOCK_TYPE_PC2CC3M_T,
+   CLOCK_TYPE_PC2CC3M_T16, /* PC2CC3M_T, but w/16-bit divisor (I2C) */
+   CLOCK_TYPE_MC2CC3P_A,
+   CLOCK_TYPE_M,
+   CLOCK_TYPE_MCPTM2C2C3,
+   CLOCK_TYPE_PC2CC3T_S,
+   CLOCK_TYPE_AC2CC3P_TS2,
+
+   CLOCK_TYPE_COUNT,
+   CLOCK_TYPE_NONE = -1,   /* invalid clock type */
+};
+
+enum {
+   CLOCK_MAX_MUX   = 8 /* number of source options for each clock */
+};
+
+/*
+ * Clock source mux for each clock type. This just converts our enum into
+ * a list of mux sources for use by the code.
+ *
+ * Note:
+ *  The extra column in each clock source array is used to store the mask
+ *  bits in its register for the source.
+ */
+#define CLK(x) CLOCK_ID_ ## x
+static enum clock_id clock_source[CLOCK_TYPE_COUNT][CLOCK_MAX_MUX+1] = {
+   { CLK(AUDIO),   CLK(XCPU),  CLK(PERIPH),CLK(OSC),
+   CLK(NONE),  CLK(NONE),  CLK(NONE),  CLK(NONE),
+   MASK_BITS_31_30},
+   { CLK(MEMORY),  CLK(CGENERAL),  CLK(PERIPH),CLK(AUDIO),
+   CLK(NONE),  CLK(NONE),  CLK(NONE),  CLK(NONE),
+   MASK_

[U-Boot] [PATCH V2 11/13] ARM: tegra: add DT files for Tegra124 and Venice2

2014-01-23 Thread Stephen Warren
From: Tom Warren 

These are fairly complete, and near-clones of Tegra114 Venice, with an
additional I2C port, and MMC address changes for Tegra124.

Signed-off-by: Tom Warren 
Signed-off-by: Stephen Warren 
---
v2:
* Added aliases for SPI devices so they always have the same ID.
* Gave each node a unit address where required.
* Fixed all compatible values to match the Linux kernel.
* s/status = "disable"/status = "disabled"/
* Removed properties and nodes that ara:
 - Non-standard and don't match DTs in U-Boot for earlier Tegra SoCs.
 - Not used or for features that don't yet work.
 - ChromeOS specific.
---
 arch/arm/dts/tegra124.dtsi| 250 ++
 board/nvidia/dts/tegra124-venice2.dts |  84 
 2 files changed, 334 insertions(+)
 create mode 100644 arch/arm/dts/tegra124.dtsi
 create mode 100644 board/nvidia/dts/tegra124-venice2.dts

diff --git a/arch/arm/dts/tegra124.dtsi b/arch/arm/dts/tegra124.dtsi
new file mode 100644
index ..18a8b24b71f7
--- /dev/null
+++ b/arch/arm/dts/tegra124.dtsi
@@ -0,0 +1,250 @@
+#include "skeleton.dtsi"
+
+/ {
+   compatible = "nvidia,tegra124";
+
+   tegra_car: clock@60006000 {
+   compatible = "nvidia,tegra124-car";
+   reg = <0x60006000 0x1000>;
+   #clock-cells = <1>;
+   };
+
+   apbdma: dma@6002 {
+   compatible = "nvidia,tegra124-apbdma", "nvidia,tegra148-apbdma";
+   reg = <0x6002 0x1400>;
+   interrupts = <0 104 0x04
+ 0 105 0x04
+ 0 106 0x04
+ 0 107 0x04
+ 0 108 0x04
+ 0 109 0x04
+ 0 110 0x04
+ 0 111 0x04
+ 0 112 0x04
+ 0 113 0x04
+ 0 114 0x04
+ 0 115 0x04
+ 0 116 0x04
+ 0 117 0x04
+ 0 118 0x04
+ 0 119 0x04
+ 0 128 0x04
+ 0 129 0x04
+ 0 130 0x04
+ 0 131 0x04
+ 0 132 0x04
+ 0 133 0x04
+ 0 134 0x04
+ 0 135 0x04
+ 0 136 0x04
+ 0 137 0x04
+ 0 138 0x04
+ 0 139 0x04
+ 0 140 0x04
+ 0 141 0x04
+ 0 142 0x04
+ 0 143 0x04>;
+   };
+
+   gpio: gpio@6000d000 {
+   compatible = "nvidia,tegra124-gpio", "nvidia,tegra30-gpio";
+   reg = <0x6000d000 0x1000>;
+   interrupts = <0 32 0x04
+ 0 33 0x04
+ 0 34 0x04
+ 0 35 0x04
+ 0 55 0x04
+ 0 87 0x04
+ 0 89 0x04
+ 0 125 0x04>;
+   #gpio-cells = <2>;
+   gpio-controller;
+   #interrupt-cells = <2>;
+   interrupt-controller;
+   };
+
+   i2c@7000c000 {
+   compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+   reg = <0x7000c000 0x100>;
+   interrupts = <0 38 0x04>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <&tegra_car 12>;
+   status = "disabled";
+   };
+
+   i2c@7000c400 {
+   compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+   reg = <0x7000c400 0x100>;
+   interrupts = <0 84 0x04>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <&tegra_car 54>;
+   status = "disabled";
+   };
+
+   i2c@7000c500 {
+   compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+   reg = <0x7000c500 0x100>;
+   interrupts = <0 92 0x04>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <&tegra_car 67>;
+   status = "disabled";
+   };
+
+   i2c@7000c700 {
+   compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+   reg = <0x7000c700 0x100>;
+   interrupts = <0 120 0x04>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <&tegra_car 103>;
+   status = "disabled";
+   };
+
+   i2c@7000d000 {
+   compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+   reg = <0x7000d000 0x100>;
+   i

[U-Boot] [PATCH V2 12/13] ARM: tegra: add Venice2 (Tegra124) board

2014-01-23 Thread Stephen Warren
From: Tom Warren 

These are the board files for Venice2 (Tegra124), plus the AS3722 PMIC
files. PMIC init will be moved to pmic_common_init later.

This builds/boots on Venice2, SPI/MMC/USB/I2C all work. Audio, display
and WB/LP0 are not supported yet.

Signed-off-by: Tom Warren 
Signed-off-by: Stephen Warren 
---
v2:
* Convert to Kconfig-style make Makefiles.
* Updated default environment to enable bootcmd_pxe.
* Removed most functional diffs (i.e. other than SoC name, valid values,
  etc.) between include/configs/tegra1[12]4-common.h.
* Deleted PMIC programming code that was disabled; it can be added later
  if it turns out to be useful.
* Fixed boards.cfg sort order.
* Removed unused define CONFIG_TEGRA_USE_EMC_DRAM_SIZE.
* Minor comment cleanup.
---
 board/nvidia/venice2/Makefile|   9 +
 board/nvidia/venice2/as3722_init.c   |  91 +++
 board/nvidia/venice2/as3722_init.h   |  38 +++
 board/nvidia/venice2/pinmux-config-venice2.h | 339 +++
 board/nvidia/venice2/venice2.c   |  33 +++
 boards.cfg   |   1 +
 include/configs/tegra124-common.h|  82 +++
 include/configs/venice2.h|  79 +++
 8 files changed, 672 insertions(+)
 create mode 100644 board/nvidia/venice2/Makefile
 create mode 100644 board/nvidia/venice2/as3722_init.c
 create mode 100644 board/nvidia/venice2/as3722_init.h
 create mode 100644 board/nvidia/venice2/pinmux-config-venice2.h
 create mode 100644 board/nvidia/venice2/venice2.c
 create mode 100644 include/configs/tegra124-common.h
 create mode 100644 include/configs/venice2.h

diff --git a/board/nvidia/venice2/Makefile b/board/nvidia/venice2/Makefile
new file mode 100644
index ..5fac5ab1f81f
--- /dev/null
+++ b/board/nvidia/venice2/Makefile
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  += as3722_init.o
+obj-y  += venice2.o
diff --git a/board/nvidia/venice2/as3722_init.c 
b/board/nvidia/venice2/as3722_init.c
new file mode 100644
index ..960fea7ee7e3
--- /dev/null
+++ b/board/nvidia/venice2/as3722_init.c
@@ -0,0 +1,91 @@
+/*
+ * (C) Copyright 2013
+ * NVIDIA Corporation 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include "as3722_init.h"
+
+/* AS3722-PMIC-specific early init code - get CPU rails up, etc */
+
+void tegra_i2c_ll_write_addr(uint addr, uint config)
+{
+   struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+   writel(addr, ®->cmd_addr0);
+   writel(config, ®->cnfg);
+}
+
+void tegra_i2c_ll_write_data(uint data, uint config)
+{
+   struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+   writel(data, ®->cmd_data1);
+   writel(config, ®->cnfg);
+}
+
+void pmic_enable_cpu_vdd(void)
+{
+   debug("%s entry\n", __func__);
+
+   /* Don't need to set up VDD_CORE - already done - by OTP */
+
+   debug("%s: Setting VDD_CPU to 1.0V via AS3722 reg 0/4D\n", __func__);
+   /*
+* Bring up VDD_CPU via the AS3722 PMIC on the PWR I2C bus.
+* First set VDD to 1.0V, then enable the VDD regulator.
+*/
+   tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2);
+   tegra_i2c_ll_write_data(AS3722_SD0VOLTAGE_DATA, I2C_SEND_2_BYTES);
+   /*
+* Don't write SDCONTROL - it's already 0x7F, i.e. all SDs enabled.
+* tegra_i2c_ll_write_data(AS3722_SD0CONTROL_DATA, I2C_SEND_2_BYTES);
+*/
+   udelay(10 * 1000);
+
+   debug("%s: Setting VDD_GPU to 1.0V via AS3722 reg 6/4D\n", __func__);
+   /*
+* Bring up VDD_GPU via the AS3722 PMIC on the PWR I2C bus.
+* First set VDD to 1.0V, then enable the VDD regulator.
+*/
+   tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2);
+   tegra_i2c_ll_write_data(AS3722_SD6VOLTAGE_DATA, I2C_SEND_2_BYTES);
+   /*
+* Don't write SDCONTROL - it's already 0x7F, i.e. all SDs enabled.
+* tegra_i2c_ll_write_data(AS3722_SD6CONTROL_DATA, I2C_SEND_2_BYTES);
+*/
+   udelay(10 * 1000);
+
+   debug("%s: Set VPP_FUSE to 1.2V via AS3722 reg 0x12/4E\n", __func__);
+   /*
+* Bring up VPP_FUSE via the AS3722 PMIC on the PWR I2C bus.
+* First set VDD to 1.2V, then enable the VDD regulator.
+*/
+   tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2);
+   tegra_i2c_ll_write_data(AS3722_LDO2VOLTAGE_DATA, I2C_SEND_2_BYTES);
+   /*
+* Don't write LDCONTROL - it's already 0xFF, i.e. all LDOs enabled.
+* tegra_i2c_ll_write_data(AS3722_LDO2CONTROL_DATA, I2C_SEND_2_BYTES);
+*/
+   udelay(10 * 1000);
+
+   debug("%s: Set VDD_SDMMC to 3.3V via AS3722 reg 0x16/4E\n", __func__);
+   /*
+* Bring up VDD_SDMMC via the AS3722 PMIC on the PWR I2C bus.
+* First set it to bypass 3.3V straight thru, then enable the regulator
+*
+* NOTE: We do this early because doing 

[U-Boot] [PATCH V2 10/13] ARM: tegra: add common (shared) CPU files

2014-01-23 Thread Stephen Warren
From: Tom Warren 

These files are used by both SPL and main U-Boot.

Signed-off-by: Tom Warren 
Signed-off-by: Stephen Warren 
---
v2:
* Fixed incorrect brace placement in tegra_get_chip_sku(), and allow any
  SKU on Tegra124 just like other SoCs.
* Simplified change to config_cache().
---
 arch/arm/cpu/tegra-common/ap.c| 16 
 arch/arm/cpu/tegra-common/board.c | 10 --
 arch/arm/cpu/tegra-common/cache.c | 10 --
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/arch/arm/cpu/tegra-common/ap.c b/arch/arm/cpu/tegra-common/ap.c
index f205be402abe..91d70da65661 100644
--- a/arch/arm/cpu/tegra-common/ap.c
+++ b/arch/arm/cpu/tegra-common/ap.c
@@ -1,5 +1,5 @@
 /*
-* (C) Copyright 2010-2011
+* (C) Copyright 2010-2014
 * NVIDIA Corporation 
 *
  * SPDX-License-Identifier:GPL-2.0+
@@ -27,7 +27,7 @@ int tegra_get_chip(void)
/*
 * This is undocumented, Chip ID is bits 15:8 of the register
 * APB_MISC + 0x804, and has value 0x20 for Tegra20, 0x30 for
-* Tegra30, and 0x35 for T114.
+* Tegra30, 0x35 for T114, and 0x40 for Tegra124.
 */
rev = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >> HIDREV_CHIPID_SHIFT;
debug("%s: CHIPID is 0x%02X\n", __func__, rev);
@@ -84,7 +84,15 @@ int tegra_get_chip_sku(void)
return TEGRA_SOC_T114;
}
break;
+   case CHIPID_TEGRA124:
+   switch (sku_id) {
+   case SKU_ID_T124_ENG:
+   default:
+   return TEGRA_SOC_T124;
+   }
+   break;
}
+
/* unknown chip/sku id */
printf("%s: ERROR: UNKNOWN CHIP/SKU ID COMBO (0x%02X/0x%02X)\n",
__func__, chip_id, sku_id);
@@ -119,8 +127,8 @@ static u32 get_odmdata(void)
 * ODMDATA is stored in the BCT in IRAM by the BootROM.
 * The BCT start and size are stored in the BIT in IRAM.
 * Read the data @ bct_start + (bct_size - 12). This works
-* on T20 and T30 BCTs, which are locked down. If this changes
-* in new chips (T114, etc.), we can revisit this algorithm.
+* on BCTs for currently supported SoCs, which are locked down.
+* If this changes in new chips, we can revisit this algorithm.
 */
 
u32 bct_start, odmdata;
diff --git a/arch/arm/cpu/tegra-common/board.c 
b/arch/arm/cpu/tegra-common/board.c
index d9cbda8a749f..6a6faf4b2760 100644
--- a/arch/arm/cpu/tegra-common/board.c
+++ b/arch/arm/cpu/tegra-common/board.c
@@ -1,5 +1,5 @@
 /*
- *  (C) Copyright 2010,2011
+ *  (C) Copyright 2010-2014
  *  NVIDIA Corporation 
  *
  * SPDX-License-Identifier:GPL-2.0+
@@ -109,12 +109,18 @@ static int uart_configs[] = {
-1,
-1,
-1,
-#else  /* Tegra114 */
+#elif defined(CONFIG_TEGRA114)
-1,
-1,
-1,
FUNCMUX_UART4_GMI,  /* UARTD */
-1,
+#else  /* Tegra124 */
+   FUNCMUX_UART1_KBC,  /* UARTA */
+   -1,
+   -1,
+   FUNCMUX_UART4_GPIO, /* UARTD */
+   -1,
 #endif
 };
 
diff --git a/arch/arm/cpu/tegra-common/cache.c 
b/arch/arm/cpu/tegra-common/cache.c
index 48e9319c7508..94f5bce90ec3 100644
--- a/arch/arm/cpu/tegra-common/cache.c
+++ b/arch/arm/cpu/tegra-common/cache.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -23,8 +23,6 @@
 
 void config_cache(void)
 {
-   struct apb_misc_gp_ctlr *gp =
-   (struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE;
u32 reg = 0;
 
/* enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg */
@@ -33,10 +31,10 @@ void config_cache(void)
"orr r0, r0, #0x41\n"
"mcr p15, 0, r0, c1, c0, 1\n");
 
-   /* Currently, only T114 needs this L2 cache change to boot Linux */
-   reg = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK);
-   if (reg != (CHIPID_TEGRA114 << HIDREV_CHIPID_SHIFT))
+   /* Currently, only Tegra114+ needs this L2 cache change to boot Linux */
+   if (tegra_get_chip() < CHIPID_TEGRA114)
return;
+
/*
 * Systems with an architectural L2 cache must not use the PL310.
 * Config L2CTLR here for a data RAM latency of 3 cycles.
-- 
1.8.1.5

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


[U-Boot] [PATCH V2 13/13] ARM: tegra: fix "bootp" issue for Tegra124 too

2014-01-23 Thread Stephen Warren
From: Jim Lin 

Fix the timeout issue after running "bootp" command in U-Boot console.

TXFIFOTHRES bits of TXFILLTUNING register should be set to 0x10 after a
controller reset and before RUN bit is se, (per technical reference
manual.

Signed-off-by: Jim Lin 
Signed-off-by: Stephen Warren 
---
 include/configs/tegra124-common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/tegra124-common.h 
b/include/configs/tegra124-common.h
index 32d5bc9c950f..0a4541bd20e6 100644
--- a/include/configs/tegra124-common.h
+++ b/include/configs/tegra124-common.h
@@ -78,5 +78,6 @@
 
 /* For USB EHCI controller */
 #define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_EHCI_TXFIFO_THRESH  0x10
 
 #endif /* _TEGRA124_COMMON_H_ */
-- 
1.8.1.5

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


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

2014-01-23 Thread Scott Wood
On Thu, 2014-01-23 at 14:08 +0100, Alexander Graf wrote:
> On 21.01.2014, at 03:25, Scott Wood  wrote:
> 
> > On Sun, 2014-01-19 at 16:19 +0100, Alexander Graf wrote:
> >> For KVM we have a special PV machine type called "ppce500". This machine
> >> is inspired by the MPC8544DS board, but implements a lot less features
> >> than that one.
> >> 
> >> It also provides more PCI slots and is supposed to be enumerated by
> >> device tree only.
> >> 
> >> This patch adds support for the current generation ppce500 machine as
> >> it is implemented today.
> >> 
> >> Signed-off-by: Alexander Graf 
> >> ---
> >> arch/powerpc/cpu/mpc85xx/start.S|7 +
> >> arch/powerpc/include/asm/config_mpc85xx.h   |4 +
> >> board/freescale/qemu-ppce500/Makefile   |   10 ++
> >> board/freescale/qemu-ppce500/qemu-ppce500.c |  260 
> >> +++
> >> board/freescale/qemu-ppce500/tlb.c  |   59 ++
> >> boards.cfg  |1 +
> >> include/configs/qemu-ppce500.h  |  235 
> >> 7 files changed, 576 insertions(+)
> >> create mode 100644 board/freescale/qemu-ppce500/Makefile
> >> create mode 100644 board/freescale/qemu-ppce500/qemu-ppce500.c
> >> create mode 100644 board/freescale/qemu-ppce500/tlb.c
> >> create mode 100644 include/configs/qemu-ppce500.h
> >> 
> >> diff --git a/arch/powerpc/cpu/mpc85xx/start.S 
> >> b/arch/powerpc/cpu/mpc85xx/start.S
> >> index db84d10..ccbcc03 100644
> >> --- a/arch/powerpc/cpu/mpc85xx/start.S
> >> +++ b/arch/powerpc/cpu/mpc85xx/start.S
> >> @@ -80,6 +80,13 @@ _start_e500:
> >>li  r1,MSR_DE
> >>mtmsr   r1
> >> 
> >> +#ifdef CONFIG_QEMU_E500
> >> +  /* Save our ePAPR device tree off before we clobber it */
> >> +  lis r2, CONFIG_QEMU_DT_ADDR@h
> >> +  ori r2, r2, CONFIG_QEMU_DT_ADDR@l
> >> +  stw r3, 0(r2)
> >> +#endif
> > 
> > r2 has a special purpose -- please don't use it for other things, even
> > if it's too early to be a problem and other code is similarly bad.
> 
> Heh, ok. I'll use r4 instead.
> 
> > Instead of saving the DT pointer in some random hardcoded address, how
> > about sticking it in a callee-saved register until you're able to store
> > it in the global data struct?
> 
> I did that at first but that didn't survive relocation. However, I just
> remembered that I had my global variable in bss, so maybe relocation
> doesn't work properly there. Instead I put it in .data now and that
> seems to work.
> 
> It's certainly the nicer solution, I agree.

I don't mean a global variable, but a field in the global data struct
(gd_t).  BSS should not be accessed, and global variables should not be
written, before relocation (although you may get away with the latter
pre-relocation in ramboot cases, you still shouldn't).

> >> +  /*
> >> +   * We already know where the initrd is inside the dtb, so no
> >> +   * need to override it
> >> +   */
> >> +  setenv("ramdisk_addr", "-");
> > 
> > Indentation.
> > 
> > What if the user wants to specify the initrd from within U-Boot?  This
> > should be handled via the default environment, not by overriding the
> > user's choice.
> 
> I'm not sure I see the difference. We have the following default boot script:
> 
> #define CONFIG_BOOTCOMMAND \
>"test -n \"$kernel_addr\" && bootm $kernel_addr $ramdisk_addr 
> $fdt_addr\0"
> 
> which is the only place where we actually use $ramdisk_addr. If a user
> wants to specify the initrd within U-Boot he can do that easily because
> he would specify his own boot command anyway, right?

Oh.  I was confusing it with the existing $ramdiskaddr.  So I'm changing
my objection to the fact that it's confusing. :-)

Likewise $fdt_addr versus $fdtaddr.

> Maybe I should rename kernel_addr to qemu_kernel_addr and drop
> ramdisk_addr completely in favor for a - in the bootm command? Yeah,
> I'll do that :).

OK.

> >> +  ret = fdt_open_into((void*)dt_base, fdt, dt_size);
> >> +  if (ret)
> >> +  panic("Couldn't open fdt");
> >> +
> >> +  memory = fdt_path_offset(fdt, "/memory");
> >> +  prop = fdt_getprop(fdt, memory, "reg", &len);
> >> +
> >> +  if (prop && len >= 16)
> >> +  return *(uint64_t*)(prop+8);
> >> +
> >> +  panic("Couldn't determine RAM size");
> >> +}
> > 
> > Again, there's no need to create a temporary fdt copy every time you
> > want to read from it.
> > 
> > What if memory doesn't start at zero (e.g. for e500v2 VFIO)?
> 
> In that case we're pretty broken regardless of determining the correct memory 
> size. Can u-boot handle that case at all? How would this work?

U-Boot can handle this on other architectures.  Not sure about the PPC
code.
 
> >> +unsigned long
> >> +get_board_sys_clk(ulong dummy)
> >> +{
> >> +  /* The actual clock doesn't matter in a PV machine */
> >> +  return ;
> >> +}
> > 
> > s/doesn't matter/doesn't exist/
> > 
> > Where is this used from?  Can it be skipped for th

Re: [U-Boot] U-boot for 64bit ARMv8

2014-01-23 Thread FengHua



> -Original Messages-
> From: tiger...@viatech.com.cn
> Sent Time: 2014-01-23 14:44:36 (Thursday)
> To: u-boot@lists.denx.de
> Cc: 
> Subject: [U-Boot]  U-boot for 64bit ARMv8
> 
> Hi, experts:
> I found ARMv8/Exceptions.S only created a 8 items vector table.
> 
> But based on ARMv8 Arch Ref Manual, it should create 16 items in a
> vector table:
> Current Exception level with SP_EL0 : 4 items
> Current Exception level with SP_Elx : 4 items
> EL immediately lower than target_EL is using AARCH64 : 4 items
> EL immediately lower than target_EL is using AARCH32 : 4 items
> 
> Are current 8 items enough? Or will patch it in the future?
> 

Currently, u-boot for aarch64 does not provide any run time service.
So, the low level exception entries are not implemented. 

Best wishes,






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


Re: [U-Boot] [PATCH v15 07/10] arm64: core support

2014-01-23 Thread FengHua

Hi Scott,

> -Original Messages-
> From: "Scott Wood" 
> Sent Time: 2014-01-23 08:28:06 (Thursday)
> To: FengHua 
> Cc: "bhupesh.sha...@freescale.com" , 
> "'tr...@ti.com'" , "'u-boot@lists.denx.de'" 
> , rod.dor...@freescale.com
> Subject: Re: [U-Boot] [PATCH v15 07/10] arm64: core support
> 
> On Tue, 2014-01-14 at 09:52 +0800, FengHua wrote:
> > hi bhupesh,
> > 
> > > Hi David,
> > >
> > > In reference to my mail above, I see that the transition to EL2 (from 
> > > EL3) which occurs very early
> > > in start.S needs to be changed on lines of the ARMv7 code, i.e. the EL2 
> > > transition should happen just
> > > before Linux is booted up by the u-boot.
> > > 
> > > The reason for the same is that a no of ARM IPs like GIC, SMMU and 
> > > TZPC/TZASC need to be configured to
> > > allow non-secure accesses from Linux world (which runs in EL1 mode). 
> > > Adding the assembly code for all
> > > such IPs in 'setup_el3' function in start.S, will bloat the start.S and 
> > > also increase the chances of a
> > > bug in the assembly code.
> > > 
> > > Hence, I would like to propose a strategy to shift from EL3 to EL2 to 
> > > some point in u-boot code after the
> > > C Run Time has been initialized (similar to present ARMv7 u-boot code). 
> > > 
> > > If you are ok with the same, I can try to send out some RFC patches 
> > > rebased against your latest v16 code-base.
> > > 
> > > Please let me know.
> > > Regards,
> > > Bhupesh
> > > 
> > Actually, patch v16 did exception level switch in the way as you said. 
> > please review the code.
> > Both master and slaves switch to el2(el1) just before jumping to linux 
> > kernel. BTW,if any good conception please feel free to patch it.
> 
> How would you handle running U-Boot under a secure firmware, or under a
> hypervisor?  Why not take the Linux approach of running most code in
> EL1, with exception handlers pointing at code to handle special
> situations (such as returning to EL2 before OS entry)?
> 
> As for bloating start.S, could leaving EL3 be done in early C code
> rather than in early asm or late C code?  Or, bundle U-Boot with a tiny
> "insecure firmware" that provides the minimum functionality needed with
> similar APIs that would be used with real secure firmware.
> 
> -Scott
> 
 
The u-boot for aarch64 are designed to support running at EL3/EL2/EL1.
The macro 'switch_el' is used to separate different exception level code.
If no secure firmware exist it runs at highest exception level processor
implemented that could be EL3 or EL2 or EL1.
Besides, theoretically it could be loaded by a secure firmware or a hypervisor 
and runs at EL2 or EL1
(This is not tested).

Best Regards,
David






___
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-23 Thread Alexander Graf

On 24.01.2014, at 01:49, Scott Wood  wrote:

> On Thu, 2014-01-23 at 14:08 +0100, Alexander Graf wrote:
>> On 21.01.2014, at 03:25, Scott Wood  wrote:
>> 
>>> On Sun, 2014-01-19 at 16:19 +0100, Alexander Graf wrote:
 For KVM we have a special PV machine type called "ppce500". This machine
 is inspired by the MPC8544DS board, but implements a lot less features
 than that one.
 
 It also provides more PCI slots and is supposed to be enumerated by
 device tree only.
 
 This patch adds support for the current generation ppce500 machine as
 it is implemented today.
 
 Signed-off-by: Alexander Graf 
 ---
 arch/powerpc/cpu/mpc85xx/start.S|7 +
 arch/powerpc/include/asm/config_mpc85xx.h   |4 +
 board/freescale/qemu-ppce500/Makefile   |   10 ++
 board/freescale/qemu-ppce500/qemu-ppce500.c |  260 
 +++
 board/freescale/qemu-ppce500/tlb.c  |   59 ++
 boards.cfg  |1 +
 include/configs/qemu-ppce500.h  |  235 
 7 files changed, 576 insertions(+)
 create mode 100644 board/freescale/qemu-ppce500/Makefile
 create mode 100644 board/freescale/qemu-ppce500/qemu-ppce500.c
 create mode 100644 board/freescale/qemu-ppce500/tlb.c
 create mode 100644 include/configs/qemu-ppce500.h
 
 diff --git a/arch/powerpc/cpu/mpc85xx/start.S 
 b/arch/powerpc/cpu/mpc85xx/start.S
 index db84d10..ccbcc03 100644
 --- a/arch/powerpc/cpu/mpc85xx/start.S
 +++ b/arch/powerpc/cpu/mpc85xx/start.S
 @@ -80,6 +80,13 @@ _start_e500:
li  r1,MSR_DE
mtmsr   r1
 
 +#ifdef CONFIG_QEMU_E500
 +  /* Save our ePAPR device tree off before we clobber it */
 +  lis r2, CONFIG_QEMU_DT_ADDR@h
 +  ori r2, r2, CONFIG_QEMU_DT_ADDR@l
 +  stw r3, 0(r2)
 +#endif
>>> 
>>> r2 has a special purpose -- please don't use it for other things, even
>>> if it's too early to be a problem and other code is similarly bad.
>> 
>> Heh, ok. I'll use r4 instead.
>> 
>>> Instead of saving the DT pointer in some random hardcoded address, how
>>> about sticking it in a callee-saved register until you're able to store
>>> it in the global data struct?
>> 
>> I did that at first but that didn't survive relocation. However, I just
>> remembered that I had my global variable in bss, so maybe relocation
>> doesn't work properly there. Instead I put it in .data now and that
>> seems to work.
>> 
>> It's certainly the nicer solution, I agree.
> 
> I don't mean a global variable, but a field in the global data struct
> (gd_t).  BSS should not be accessed, and global variables should not be
> written, before relocation (although you may get away with the latter
> pre-relocation in ramboot cases, you still shouldn't).

But the global data gets cleared in cpu_init_early_f(). So I'd have to shove it 
to some non-volatile, make sure no other code uses that particular register and 
then move it into gd. And how do I get offsets into the gd structure from asm 
in the first place?

Or are you suggesting I move r3 into r2x, leave it there until after 
cpu_init_early_f(), copy it back to r3 and then call a C helper that puts it 
into gd? Sounds quite excessive for something that works quite well with a 
global variable in .data :).

> 
 +  /*
 +   * We already know where the initrd is inside the dtb, so no
 +   * need to override it
 +   */
 +  setenv("ramdisk_addr", "-");
>>> 
>>> Indentation.
>>> 
>>> What if the user wants to specify the initrd from within U-Boot?  This
>>> should be handled via the default environment, not by overriding the
>>> user's choice.
>> 
>> I'm not sure I see the difference. We have the following default boot script:
>> 
>> #define CONFIG_BOOTCOMMAND \
>>   "test -n \"$kernel_addr\" && bootm $kernel_addr $ramdisk_addr 
>> $fdt_addr\0"
>> 
>> which is the only place where we actually use $ramdisk_addr. If a user
>> wants to specify the initrd within U-Boot he can do that easily because
>> he would specify his own boot command anyway, right?
> 
> Oh.  I was confusing it with the existing $ramdiskaddr.  So I'm changing
> my objection to the fact that it's confusing. :-)
> 
> Likewise $fdt_addr versus $fdtaddr.

Mind to explain what the difference is between $fdtaddr, $fdt_addr (pxe boot?) 
and $fdt_addr_r? Which one should I set?

> 
>> Maybe I should rename kernel_addr to qemu_kernel_addr and drop
>> ramdisk_addr completely in favor for a - in the bootm command? Yeah,
>> I'll do that :).
> 
> OK.
> 
 +  ret = fdt_open_into((void*)dt_base, fdt, dt_size);
 +  if (ret)
 +  panic("Couldn't open fdt");
 +
 +  memory = fdt_path_offset(fdt, "/memory");
 +  prop = fdt_getprop(fdt, memory, "reg", &len);
 +
 +  if (prop && len >= 16)
 +  return *(ui

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

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

Right.

> And how do I get offsets into the gd structure from asm in the first place?

See lib/asm-offsets.c

> Or are you suggesting I move r3 into r2x, leave it there until after
> cpu_init_early_f(), copy it back to r3 and then call a C helper that
> puts it into gd? Sounds quite excessive for something that works quite
> well with a global variable in .data :).

It only works because you are booting directly from RAM, and the
variable you're writing to isn't subject to relocation, and isn't in the
BSS (unlike most uninitialized/zero-initialized data).  It's not good
practice.  What if you later want to simulate NOR flash and boot from
that?

> >> which is the only place where we actually use $ramdisk_addr. If a user
> >> wants to specify the initrd within U-Boot he can do that easily because
> >> he would specify his own boot command anyway, right?
> > 
> > Oh.  I was confusing it with the existing $ramdiskaddr.  So I'm changing
> > my objection to the fact that it's confusing. :-)
> > 
> > Likewise $fdt_addr versus $fdtaddr.
> 
> Mind to explain what the difference is between $fdtaddr, $fdt_addr (pxe 
> boot?) and $fdt_addr_r? Which one should I set?

I don't know what the "_r" is supposed to mean, but the underscore seems
to just be something that varies from board to board.  Our boards use
$fdtaddr and until now I didn't realize other boards do it differently.
 
>  +unsigned long
>  +get_board_sys_clk(ulong dummy)
>  +{
>  +/* The actual clock doesn't matter in a PV machine */
>  +return ;
>  +}
> >>> 
> >>> s/doesn't matter/doesn't exist/
> >>> 
> >>> Where is this used from?  Can it be skipped for this target?  Is the 

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

2014-01-23 Thread mks
Hello,

Im getting a trouble with mtd on my imx27 27 board, I can't write or
erase it on U-Boot-1.3.4, here is the log :

U-Boot> run
update_all   
FEC ETHERNET: Autonegotiation
timeout  
FEC ETHERNET: Link is down -
10/Half   
TFTP from server 192.168.0.2; our IP address is
192.168.0.10   
Filename
'apf27-linux.bin'.
Load address:
0xa000   
Loading: T T T T T T T T T
T   
Retry count exceeded; starting
again   
TFTP from server 192.168.0.2; our IP address is
192.168.0.10   
Filename
'apf27-linux.bin'.
Load address:
0xa000   
Loading:
# 

# 

# 

# 

# 

# 

# 

  
done   
Bytes transferred = 2635464 (2836c8
hex)   
   
NAND erase: device 0 offset 0x10, size
0x50
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   
NAND 512MiB 1,8V 8-bit: MTD Erase failure:
-5  
   

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

2014-01-23 Thread JYOTI DUBEY
while compiling I got an error System not configured - see README. SO how
can I configure it for NItrogen6x board?


On Thu, Jan 23, 2014 at 8:38 PM, Jagan Teki wrote:

> Have some boot flow png's long back with previous version (not the
> current) [1]
> I thought it could be a starter - not equivalently same.
> If possible better take this as a reference and start tagging around the
> source.
>
> [1] http://jagannadhteki.blog.com/2014/01/23/u-boot-functional-flowarm/
>
> thanks!
>
> On Thu, Jan 23, 2014 at 6:10 PM, Mj Embd  wrote:
> > a) step 1 - compile and build the bin / etf
> > b) step 2 - create an asm - objdump -DS
> > c) find the lds file
> > d) locate uboot.map
> >
> > start from __start. (keep an arm manual handy) & begin.
> >
> > :)
> >
> > On 1/23/14, JYOTI DUBEY  wrote:
> >> Can anyone tell how to understand the flow of u-boot source code? I am
> >> working on ARM processor and the board used is Nitrogen6X.
>
> --
> Jagan.
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2014-01-23 Thread Jagan Teki
On Fri, Jan 24, 2014 at 11:44 AM, JYOTI DUBEY  wrote:
> while compiling I got an error System not configured - see README. SO how
> can I configure it for NItrogen6x board?

Please elaborate the steps what you did?

>
>
> On Thu, Jan 23, 2014 at 8:38 PM, Jagan Teki 
> wrote:
>>
>> Have some boot flow png's long back with previous version (not the
>> current) [1]
>> I thought it could be a starter - not equivalently same.
>> If possible better take this as a reference and start tagging around the
>> source.
>>
>> [1] http://jagannadhteki.blog.com/2014/01/23/u-boot-functional-flowarm/
>>
>> thanks!
>>
>> On Thu, Jan 23, 2014 at 6:10 PM, Mj Embd  wrote:
>> > a) step 1 - compile and build the bin / etf
>> > b) step 2 - create an asm - objdump -DS
>> > c) find the lds file
>> > d) locate uboot.map
>> >
>> > start from __start. (keep an arm manual handy) & begin.
>> >
>> > :)
>> >
>> > On 1/23/14, JYOTI DUBEY  wrote:
>> >> Can anyone tell how to understand the flow of u-boot source code? I am
>> >> working on ARM processor and the board used is Nitrogen6X.
>>
>> --
>> Jagan.
>
>



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


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

2014-01-23 Thread ying.zhang
From: Ying Zhang 

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

Signed-off-by: Ying Zhang 
---
 common/env_sf.c| 7 ++-
 include/configs/p1_p2_rdb_pc.h | 6 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

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


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


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

2014-01-23 Thread ying.zhang
From: Ying Zhang 

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

Signed-off-by: Ying Zhang 
---
 include/configs/P1022DS.h  | 6 +++---
 include/configs/p1_p2_rdb_pc.h | 8 
 2 files changed, 7 insertions(+), 7 deletions(-)

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


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


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

2014-01-23 Thread ying.zhang
From: Ying Zhang 

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

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

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

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

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

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

2014-01-23 Thread ying.zhang
From: Ying Zhang 

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

Signed-off-by: Ying Zhang 
---
 include/configs/P1022DS.h  | 12 ++--
 include/configs/p1_p2_rdb_pc.h | 12 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

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


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


  1   2   >