Re: [U-Boot] [PATCH 05/11] ARM: tegra: pinctrl: remove duplication

2014-03-20 Thread Stephen Warren
On 03/20/2014 07:25 PM, Simon Glass wrote:
> Hi Stephen,
> 
> On 20 March 2014 12:57, Stephen Warren  wrote:
>>
>> On 03/14/2014 01:37 PM, Simon Glass wrote:
>>> Hi Stephen,
>>>
>>> On 13 March 2014 11:42, Stephen Warren  wrote:
 From: Stephen Warren 

 Much of arch/arm/cpu/tegra*-common/pinmux.c is identical. Remove the
 duplication by creating pinmux-common.c for all the identical code.

 This leaves:
 * arch/arm/include/asm/arch-tegra*/pinmux.h defining only the names of
   the various pins/pin groups, drive groups, and mux functions.
 * arch/arm/cpu/tegra*-common/pinmux.c containing only the lookup table
   stating which pin groups support which mux functions.

 The code in pinmux-common.c is semantically identical to that in the
 various original pinmux.c, but had some consistency and cleanup fixes
 applied during migration.

 diff --git a/arch/arm/cpu/tegra-common/pinmux-common.c 
 b/arch/arm/cpu/tegra-common/pinmux-common.c
>>
 +/* return 1 if a pin_pupd_is in range */
 +#define pmux_pin_pupd_isvalid(pupd) \
 +   (((pupd) >= PMUX_PULL_NORMAL) && ((pupd) <= PMUX_PULL_UP))
 +
 +/* return 1 if a pin_tristate_is in range */
 +#define pmux_pin_tristate_isvalid(tristate) \
 +   (((tristate) >= PMUX_TRI_NORMAL) && ((tristate) <= 
 PMUX_TRI_TRISTATE))
 +
 +#ifdef TEGRA_PMX_HAS_PIN_IO_BIT_ETC
>>>
>>> Do we need this #Ifdef?
>>>
 +/* return 1 if a pin_io_is in range */
 +#define pmux_pin_io_isvalid(io) \
 +   (((io) >= PMUX_PIN_OUTPUT) && ((io) <= PMUX_PIN_INPUT))
>>
>> We certainly need not to compile this code, since e.g. PMUX_PIN_INPUT
>> doesn't exist on Tegra20 due to equivalent #ifdefs in pinmux.h.
>>
>> I do explicitly want to keep the ifdefs in pinmux.h, so that APIs are
>> not prototyped, and values not defined, for features that don't exist on
>> the SoC that U-Boot is being built for. This validates at compile time
>> that code isn't using invalid APIs. While pinmux.h could be split up
>> into a few separate header files to avoid the ifdefs, I think that would
>> make the header situation far more complex than it needs to be.
> 
> Arguably you have created this problem by having #ifdefs in the C file
> - if there was a separate file for each SoC then it would be much
> harder to mess this up.

Well, then you get a link error rather than a compiler error for an
unprototyped function or undefined enum/#define. I think the compile
error is a bit more obvious myself, but granted either would work.

...
>> So in summary, I'd like to keep the ifdefs. I think they're pretty
>> simple and not a maintenance burden. Do you object?
> 
> No. I can't possibly object given that you have completed such a great 
> clean-up.

Great, thanks. I'll post V2 tomorrow.

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


Re: [U-Boot] [RFC PATCH 0/17] Version 0 of Kconfig for U-Boot

2014-03-20 Thread Simon Glass
Hi Masahiro,

On 17 March 2014 01:52, Masahiro Yamada  wrote:
>
> Several weeks have passed since Kbuild series was merged to the
> code base at 2014.01-rc1.
>
> I think now is a good time to start to discuss the next stage.
> Yes, our promised land, Kconfig.

Great! I have a few general comments below and have not reviewed the
code on this version.

>
> Besides Linux Kernel, Kconfig is being used in some projects,
> for example, BusyBox, Buildroot.
>
> But, our situation is a little more complicated.
> We need to generate 3 images at most: main image, SPL and TPL.
> And each of them can have a different set of CONFIGs.
>
> For example, we can describe a board header file like this:
>
>   #if defined(CONFIG_TPL_BUILD)
>   # define CONFIG_FOO   100
>   #elif defined(CONFIG_SPL_BUILD)
>   # define CONFIG_FOO   50
>   #else
>   # define CONFIG_FOO   10
>   # define CONFIG_BAR
>   #endif

I wonder if we should drop this, and require that all have the same
options? That would involve requiring that board config files are not
permitted to use #ifdef CONFIG_SPL or #ifdef CONFIG_TPL.

Does that seem like a bad restriction? The advantage is that we only
need one defconfig for each board. It seems to me that things are
going to get really painful if we have three different configs.

Of course, this doesn't preclude #ifdefs in the Makefiles or actual
source code, but we already have SPL-specific feature options.

I'm not 100% clear on the constraints here.

>
> All defined macros prefixed with CONFIG_ are extracted into
>   - include/autoconf.mk  (for main U-Boot)
>   - include/spl-autoconf.mk  (for SPL)
>   - include/tpl-autoconf.mk  (for TPL)
> for the use in makefiles.
>
> In order to keep this scheme in Kconfig, I had to modify some files.
> But I tried to minimize the modification.
>
>  How does Kconfig in U-Boot work?
>  
>
> For boards without SPL support, it works like Linux Kernel.
> That is, a list of CONFIGs is saved into ".config" file.
> When we run "make", if necessary, "make silentoldconfig" is automatically
> invoked, which creates/updates include/config/auto.conf and
> include/generated/autoconf.h.
>
> For boards supporting SPL, a list of CONFIG macros defined for
> SPL_BUILD is saved into "spl/.config".
> include/config/auto.conf and include/generated/autoconf.h are generated
> under spl/ directory.
>
> CONFIG macros for TPL are also handled in the same way.
>
> To sum up,
>
>   [1] Main U-boot
> - .config (saved CONFIG list)
> - include/config/auto.conf(for use in makefiles)
> - include/generated/autoconf.h(for use in C sources)
> - include/config/*(for if_changed_dep)
>
>   [2] SPL
> - spl/.config  (saved CONFIG list)
> - spl/include/config/auto.conf (for use in makefiles)
> - spl/include/generated/autoconf.h (for use in C sources)
> - spl/include/config/* (for if_changed_dep)
>
>   [3] TPL
> - tpl/.config  (saved CONFIG list)
> - tpl/include/config/auto.conf (for use in makefiles)
> - tpl/include/generated/autoconf.h (for use in C sources)
> - tpl/include/config/* (for if_changed_dep)
>
>  How to configure and build?
>  ---
>
> Prior to this series, we did board configuration like this:
>
>   $ make vexpress_aemv8a_config
>   Configuring for vexpress_aemv8a - Board: vexpress_aemv8a, Options: ARM64
>
> Going forward, we should configure like this:
>
>   $ make vexpress_aemv8a_defconfig
> HOSTCC  scripts/basic/fixdep
> HOSTCC  scripts/kconfig/conf.o
> SHIPPED scripts/kconfig/zconf.tab.c
> SHIPPED scripts/kconfig/zconf.lex.c
> SHIPPED scripts/kconfig/zconf.hash.c
> HOSTCC  scripts/kconfig/zconf.tab.o
> HOSTLD  scripts/kconfig/conf
>   #
>   # configuration written to .config
>   #
>
> Please note we should use suffix "_defconfig" instead of "_config".
>
> And then build the same as before.
>
>   $ make CROSS_COMPILE=
>
> Or you can configure and build in one time:
>
>   $ make CROSS_COMPILE= vexpress_aemv8a_defconfig all
>
>  How to change the setting?
>  --
>
> We can modify configuration as we do in Linux Kernel.
> Of cource "make config" works in U-Boot too.
> But I think most of you prefer GUI interface of "make menuconfig".
> (In Linux Kernel, with thousands of CONFIGs, "make config" is already 
> useless.)
>
> The difference from Linux Kernel is that the configuration is done
> on three levels at most.

One thought for the future - we should also think about dropping
spl/tpl as special cases, and just have a general ability to build
U-Boot multiple times with different options. So we could perhaps have
5 different builds with different prefixes (none,spl,tpl,qpl, etc.)

Another little point - I think there is a mkdir missing somwhere:

 make O=b/snow snow_defconfig
/bin/sh: line 0: cd: b/snow: No such file or direc

Re: [U-Boot] [PATCH 05/11] ARM: tegra: pinctrl: remove duplication

2014-03-20 Thread Simon Glass
Hi Stephen,

On 20 March 2014 12:57, Stephen Warren  wrote:
>
> On 03/14/2014 01:37 PM, Simon Glass wrote:
> > Hi Stephen,
> >
> > On 13 March 2014 11:42, Stephen Warren  wrote:
> >> From: Stephen Warren 
> >>
> >> Much of arch/arm/cpu/tegra*-common/pinmux.c is identical. Remove the
> >> duplication by creating pinmux-common.c for all the identical code.
> >>
> >> This leaves:
> >> * arch/arm/include/asm/arch-tegra*/pinmux.h defining only the names of
> >>   the various pins/pin groups, drive groups, and mux functions.
> >> * arch/arm/cpu/tegra*-common/pinmux.c containing only the lookup table
> >>   stating which pin groups support which mux functions.
> >>
> >> The code in pinmux-common.c is semantically identical to that in the
> >> various original pinmux.c, but had some consistency and cleanup fixes
> >> applied during migration.
> >
> > This patch is very welcome, as You know I was not keen on the
> > duplication going in in the first place.
> >
> >>
> >> I removed the definition of struct pmux_tri_ctlr, since this is different
> >> between SoCs (especially Tegra20 vs all others), and it's much simpler to
> >> deal with this via the new REG/MUX_REG/... defines. spl.c, warmboot.c,
> >> and warmboot_avp.c needed updates due to this, since they previously
> >> hijacked this struct to encode the location of some non-pinmux registers.
> >> Now, that code simply calculates these register addresses directly using
> >> simple and obvious math. I like this method better irrespective of the
> >> pinmux code cleanup anyway.
> >
> > Not as keen as you - U-Boot normally uses structures for access to
> > hardware registers.
>
> I tend to disagree with this approach. All other SW I'm familiar with
> uses simple #defines for offsets. This makes U-Boot rather unfamiliar to
> engineers. All HW documentation uses numerical offsets. SW #defines are
> extremely easy to validate against the HW documentation, whereas with
> structs you have to count out reserved arrays for gaps, put comments in
> that contain the offsets to help you match everything up and validate
> it, etc.
>
> Still ...
>
> >> diff --git a/arch/arm/cpu/arm720t/tegra-common/spl.c 
> >> b/arch/arm/cpu/arm720t/tegra-common/spl.c
> >> index 5171a8f907a1..4097f3b04362 100644
> >> --- a/arch/arm/cpu/arm720t/tegra-common/spl.c
> >> +++ b/arch/arm/cpu/arm720t/tegra-common/spl.c
> >> @@ -19,10 +19,10 @@
> >>
> >>  void spl_board_init(void)
> >>  {
> >> -   struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr 
> >> *)NV_PA_APB_MISC_BASE;
> >> +   u32 *cfg_ctl = (u32 *)(NV_PA_APB_MISC_BASE + 0x24);
> >
> > Open-coded address offset? To me it seems better to have a specific
> > Tegra20 structure (normal U-Boot approach), or failing  that, worst
> > case, a #define for this field. Also you should ask your hardware
> > designers to stop moving things around :-)
>
> Ah, it looks like there's already
> ./arch/arm/include/asm/arch-tegra20/apb_misc.h that defines the
> registers at the start of the apb_misc space that aren't related to
> pinmux. I'll uses this struct since it's already there, and add the one
> missing field.
>
> >> diff --git a/arch/arm/cpu/tegra-common/pinmux-common.c 
> >> b/arch/arm/cpu/tegra-common/pinmux-common.c
>
> >> +/* return 1 if a pin_pupd_is in range */
> >> +#define pmux_pin_pupd_isvalid(pupd) \
> >> +   (((pupd) >= PMUX_PULL_NORMAL) && ((pupd) <= PMUX_PULL_UP))
> >> +
> >> +/* return 1 if a pin_tristate_is in range */
> >> +#define pmux_pin_tristate_isvalid(tristate) \
> >> +   (((tristate) >= PMUX_TRI_NORMAL) && ((tristate) <= 
> >> PMUX_TRI_TRISTATE))
> >> +
> >> +#ifdef TEGRA_PMX_HAS_PIN_IO_BIT_ETC
> >
> > Do we need this #Ifdef?
> >
> >> +/* return 1 if a pin_io_is in range */
> >> +#define pmux_pin_io_isvalid(io) \
> >> +   (((io) >= PMUX_PIN_OUTPUT) && ((io) <= PMUX_PIN_INPUT))
>
> We certainly need not to compile this code, since e.g. PMUX_PIN_INPUT
> doesn't exist on Tegra20 due to equivalent #ifdefs in pinmux.h.
>
> I do explicitly want to keep the ifdefs in pinmux.h, so that APIs are
> not prototyped, and values not defined, for features that don't exist on
> the SoC that U-Boot is being built for. This validates at compile time
> that code isn't using invalid APIs. While pinmux.h could be split up
> into a few separate header files to avoid the ifdefs, I think that would
> make the header situation far more complex than it needs to be.

Arguably you have created this problem by having #ifdefs in the C file
- if there was a separate file for each SoC then it would be much
harder to mess this up.

>
>
> I don't see anything wrong with having the same ifdefs in pinmux.c; it's
> a very consistent structure. It also means that all the conditional
> logic is in code, all implemented consistently via C pre-processor,
> rather than some being in the header file and some in the Makefiles, and
> hence I think it's easier to keep the two in sync, since they work
> identically.
>
> So in summary, I'd like to keep the ifdefs

[U-Boot] [PATCH 3/6] move wandboard over to use the generic distro configuation and environment

2014-03-20 Thread Dennis Gilmore
port wandboard to use the generic distro configuation.
remove duplicated config options, clean up the environment, include new
environment.

Signed-off-by: Dennis Gilmore 
---
 include/configs/wandboard.h | 92 +++--
 1 file changed, 14 insertions(+), 78 deletions(-)

diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
index 6c74c72..386fe78 100644
--- a/include/configs/wandboard.h
+++ b/include/configs/wandboard.h
@@ -49,8 +49,6 @@
 #define CONFIG_CMD_BMODE
 #define CONFIG_CMD_SETEXPR
 
-#define CONFIG_BOOTDELAY   5
-
 #define CONFIG_SYS_MEMTEST_START   0x1000
 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M)
 #define CONFIG_LOADADDR0x1200
@@ -66,15 +64,8 @@
 #define CONFIG_CMD_MMC
 #define CONFIG_GENERIC_MMC
 #define CONFIG_BOUNCE_BUFFER
-#define CONFIG_CMD_EXT2
-#define CONFIG_CMD_FAT
-#define CONFIG_DOS_PARTITION
 
 /* Ethernet Configuration */
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_NET
 #define CONFIG_FEC_MXC
 #define CONFIG_MII
 #define IMX_FEC_BASE   ENET_BASE_ADDR
@@ -100,6 +91,11 @@
 #define CONFIG_IPUV3_CLK 26000
 #define CONFIG_IMX_HDMI
 
+#ifndef CONFIG_SPL_BUILD
+#include 
+#include 
+#endif
+
 #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
 #define CONFIG_DEFAULT_FDT_FILE"imx6dl-wandboard.dtb"
 #elif defined(CONFIG_MX6Q)
@@ -111,11 +107,14 @@
"image=zImage\0" \
"console=ttymxc0\0" \
"splashpos=m,m\0" \
-   "fdt_high=0x\0" \
-   "initrd_high=0x\0" \
-   "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
-   "fdt_addr=0x1800\0" \
+   "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+   "fdt_addr_r=0x1800\0" \
"boot_fdt=try\0" \
+   "pxefile_addr_r=0x17f0\0" \
+   "scriptaddr=0x17e0\0" \
+   "kernel_addr_r=0x1100\0" \
+   "ramdisk_addr_r=0x1810\0" \
+   "bootm_size=0x2000\0" \
"ip_dyn=yes\0" \
"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
"mmcpart=1\0" \
@@ -134,70 +133,12 @@
"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
"fi; "  \
"fi\0" \
-   "mmcargs=setenv bootargs console=${console},${baudrate} " \
-   "root=${mmcroot}\0" \
-   "loadbootscript=" \
-   "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-   "bootscript=echo Running bootscript from mmc ...; " \
-   "source\0" \
-   "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
-   "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
-   "mmcboot=echo Booting from mmc ...; " \
-   "run mmcargs; " \
-   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-   "if run loadfdt; then " \
-   "bootz ${loadaddr} - ${fdt_addr}; " \
-   "else " \
-   "if test ${boot_fdt} = try; then " \
-   "bootz; " \
-   "else " \
-   "echo WARN: Cannot load the DT; " \
-   "fi; " \
-   "fi; " \
-   "else " \
-   "bootz; " \
-   "fi;\0" \
-   "netargs=setenv bootargs console=${console},${baudrate} " \
-   "root=/dev/nfs " \
-   "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-   "netboot=echo Booting from net ...; " \
-   "run netargs; " \
-   "if test ${ip_dyn} = yes; then " \
-   "setenv get_cmd dhcp; " \
-   "else " \
-   "setenv get_cmd tftp; " \
-   "fi; " \
-   "${get_cmd} ${image}; " \
-   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-   "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
-   "bootz ${loadaddr} - ${fdt_addr}; " \
-   "else " \
-   "if test ${boot_fdt} = try; then " \
-   "bootz; " \
-   "else " \
-   "echo WARN: Cannot load the DT; " \
-   "fi; " \
-   "fi; " \
-   "else " \
-   "bootz; " \
-   "fi;\0"
+   BOOTCMDS_COMMON
 
 #define CONFIG_BOOTCOMMAND \
-  "mmc dev ${mmcdev}; if mmc rescan; then " \
-  "if run loadbootscript; then " \
-  "run bootscript; " \
-  "else " \
-  "if run loadimage; then " \
-  "run mmcboot; " \
- 

[U-Boot] [PATCH 4/6] move beagleboard over to use the generic distro configuation and environment

2014-03-20 Thread Dennis Gilmore
port beagleboard to use the generic distro configuation.
remove duplicated config options, clean up the environment, include new
environment.

Signed-off-by: Dennis Gilmore 
---
 include/configs/am335x_evm.h  | 62 +--
 include/configs/ti_armv7_common.h | 32 ++--
 2 files changed, 23 insertions(+), 71 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 11088b3..1dd4486 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -50,9 +50,9 @@
"nandrootfstype=ubifs rootwait=1\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
-   "nand read ${fdtaddr} u-boot-spl-os; " \
-   "nand read ${loadaddr} kernel; " \
-   "bootz ${loadaddr} - ${fdtaddr}\0"
+   "nand read ${fdt_addr_r} u-boot-spl-os; " \
+   "nand read ${kernel_addr_r} kernel; " \
+   "bootz ${kernel_addr_r} - ${fdt_addr_r}\0"
 #else
 #define NANDARGS ""
 #endif
@@ -100,60 +100,28 @@
"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
"ip=dhcp\0" \
"bootenv=uEnv.txt\0" \
-   "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
+   "loadbootenv=load mmc ${mmcdev} ${kernel_addr_r} ${bootenv}\0" \
"importbootenv=echo Importing environment from mmc ...; " \
-   "env import -t $loadaddr $filesize\0" \
+   "env import -t $kernel_addr_r $filesize\0" \
"ramargs=setenv bootargs console=${console} " \
"${optargs} " \
"root=${ramroot} " \
"rootfstype=${ramrootfstype}\0" \
-   "loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
-   "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-   "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
-   "mmcloados=run mmcargs; " \
-   "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-   "if run loadfdt; then " \
-   "bootz ${loadaddr} - ${fdtaddr}; " \
-   "else " \
-   "if test ${boot_fdt} = try; then " \
-   "bootz; " \
-   "else " \
-   "echo WARN: Cannot load the DT; " \
-   "fi; " \
-   "fi; " \
-   "else " \
-   "bootz; " \
-   "fi;\0" \
-   "mmcboot=mmc dev ${mmcdev}; " \
-   "if mmc rescan; then " \
-   "echo SD/MMC found on device ${mmcdev};" \
-   "if run loadbootenv; then " \
-   "echo Loaded environment from ${bootenv};" \
-   "run importbootenv;" \
-   "fi;" \
-   "if test -n $uenvcmd; then " \
-   "echo Running uenvcmd ...;" \
-   "run uenvcmd;" \
-   "fi;" \
-   "if run loadimage; then " \
-   "run mmcloados;" \
-   "fi;" \
-   "fi;\0" \
"spiboot=echo Booting from spi ...; " \
"run spiargs; " \
"sf probe ${spibusno}:0; " \
-   "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
-   "bootz ${loadaddr}\0" \
+   "sf read ${kernel_addr_r} ${spisrcaddr} ${spiimgsize}; " \
+   "bootz ${kernel_addr_r}\0" \
"netboot=echo Booting from network ...; " \
"setenv autoload no; " \
"dhcp; " \
-   "tftp ${loadaddr} ${bootfile}; " \
-   "tftp ${fdtaddr} ${fdtfile}; " \
+   "tftp ${kernel_addr_r} ${bootfile}; " \
+   "tftp ${fdt_addr_r} ${fdtfile}; " \
"run netargs; " \
-   "bootz ${loadaddr} - ${fdtaddr}\0" \
+   "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
"ramboot=echo Booting from ramdisk ...; " \
"run ramargs; " \
-   "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
+   "bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}\0" \
"findfdt="\
"if test $board_name = A335BONE; then " \
"setenv fdtfile am335x-bone.dtb; fi; " \
@@ -166,15 +134,13 @@
"if test $fdtfile = undefined; then " \
"echo WARNING: Could not determine device tree to use; 
fi; \0" \
NANDARGS \
-   DFUARGS
+   DFUARGS \
+   BOOTCMDS_COMMON
 #endif
 
 #define CONFIG_BOOTCOMMAND \
"run findfdt; " \
-   "run mmcboot;" \
-   "setenv mmcdev 1; " \
-   "setenv bootpart 1:2; " \
-   "run mmcboot;" \
+   "for target in ${boot_targets}; do 

[U-Boot] [PATCH 2/6] add header with a generic set of boot commands defined.

2014-03-20 Thread Dennis Gilmore
As the next step in a generic config we are introducing a set of generic boot
paramaters. Depending on the hardwares configuration, booting from supported
hardware will be enabled, mmc, usb, sata, scsi, ide, pxe and dhcp.

There is nothing to stop this being extended to support nand and any other
type of storage that comes along. An ideal future enhancement will be to
allow the user to dynamically reorder the boot devices, and allow one off
boots. for example simply be able to pxe boot to reinstall

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

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
new file mode 100644
index 000..0fe94be
--- /dev/null
+++ b/include/config_distro_bootcmd.h
@@ -0,0 +1,208 @@
+/*
+ * (C) Copyright 2014
+ * NVIDIA Corporation 
+ *  
+ * Copyright 2014 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H
+#define _CONFIG_CMD_DISTRO_BOOTCMD_H
+
+
+#ifdef CONFIG_CMD_MMC
+#define BOOTCMDS_MMC \
+   "mmc_boot=" \
+   "setenv devtype mmc; " \
+   "if mmc dev ${devnum}; then " \
+   "run scan_boot; " \
+   "fi\0" \
+   "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
+   "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
+#define BOOT_TARGETS_MMC "mmc1 mmc0"
+#else
+#define BOOTCMDS_MMC ""
+#define BOOT_TARGETS_MMC ""
+#endif
+
+#ifdef CONFIG_CMD_USB
+#define BOOTCMD_INIT_USB "run usb_init; "
+#define BOOTCMDS_USB \
+   "usb_init=" \
+   "if ${usb_need_init}; then " \
+   "set usb_need_init false; " \
+   "usb start 0; " \
+   "fi\0" \
+   \
+   "usb_boot=" \
+   "setenv devtype usb; " \
+   BOOTCMD_INIT_USB \
+   "if usb dev ${devnum}; then " \
+   "run scan_boot; " \
+   "fi\0" \
+   \
+   "bootcmd_usb0=setenv devnum 0; run usb_boot;\0" \
+   "bootcmd_usb1=setenv devnum 1; run usb_boot;\0"
+#define BOOT_TARGETS_USB "usb0 usb1"
+#else
+#define BOOTCMD_INIT_USB ""
+#define BOOTCMDS_USB ""
+#define BOOT_TARGETS_USB ""
+#endif
+
+#ifdef CONFIG_CMD_SATA
+#define BOOTCMDS_SATA \
+   "sata_boot=" \
+   "setenv devtype sata; " \
+   "if sata dev ${devnum}; then " \
+   "run scan_boot; " \
+   "fi\0" \
+   \
+   "bootcmd_sata0=setenv devnum 0; run sata_boot;\0" \
+   "bootcmd_sata1=setenv devnum 1; run sata_boot;\0"
+#define BOOT_TARGETS_SATA "sata0 sata1"
+#else
+#define BOOTCMDS_SATA ""
+#define BOOT_TARGETS_SATA ""
+#endif
+
+#ifdef CONFIG_CMD_SCSI
+#define BOOTCMDS_SCSI \
+"scsi_boot=" \
+"setenv devtype scsi; " \
+"if scsi dev ${devnum}; then " \
+"run scan_boot; " \
+"fi\0" \
+\
+"bootcmd_scsi0=setenv devnum 0; run scsi_boot;\0" \
+"bootcmd_scsi1=setenv devnum 1; run scsi_boot;\0"
+#define BOOT_TARGETS_SCSI "scsi0 scsi1"
+#else
+#define BOOTCMDS_SCSI ""
+#define BOOT_TARGETS_SCSI ""
+#endif
+
+#ifdef CONFIG_CMD_IDE
+#define BOOTCMDS_IDE \
+"ide_boot=" \
+"setenv devtype ide; " \
+"if ide dev ${devnum}; then " \
+"run scan_boot; " \
+"fi\0" \
+\
+"bootcmd_ide0=setenv devnum 0; run ide_boot;\0" \
+"bootcmd_ide1=setenv devnum 1; run ide_boot;\0"
+#define BOOT_TARGETS_IDE "ide0 ide1"
+#else
+#define BOOTCMDS_IDE ""
+#define BOOT_TARGETS_IDE ""
+#endif
+
+#ifdef CONFIG_CMD_DHCP
+#define BOOTCMDS_DHCP \
+   "bootcmd_dhcp=" \
+   BOOTCMD_INIT_USB \
+   "if dhcp ${scriptaddr} boot.scr.uimg; then "\
+   "source ${scriptaddr}; " \
+   "fi\0"
+#define BOOT_TARGETS_DHCP "dhcp"
+#else
+#define BOOTCMDS_DHCP ""
+#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" \
+   \
+   "do_envimport="   \
+   "load ${devtype} ${devnum}:${rootpart} ${loadaddr} "  \
+   "${environment}\0"\
+   "env import -t ${loadaddr} $filesize\0"   \
+   \
+   "envimport="  \
+   "for environment in ${boot_envs}; do "

[U-Boot] [PATCH 6/6] pxe: additionaly check for fdt_file env variable

2014-03-20 Thread Dennis Gilmore
some boards have used fdt_file while others have used fdtfile to
define the name of the fdt file. If we do notget a fdtfile environment
variable, additionally check for fdt_file.

Signed-off-by: Dennis Gilmore 
---
 common/cmd_pxe.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 3483328..c58e471 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -712,6 +712,13 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label 
*label)
char *f1, *f2, *f3, *f4, *slash;
 
f1 = getenv("fdtfile");
+   /*
+* some boards have used fdt_file as the environment 
variable for
+* defining the device tree file so lets check for 
fdt_file also.
+*/
+   if (!f1) {
+   f1 = getenv("fdt_file");
+   }
if (f1) {
f2 = "";
f3 = "";
-- 
1.9.0

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


[U-Boot] [PATCH 5/6] move pandaboard over to use the generic distro configuation and environment

2014-03-20 Thread Dennis Gilmore
port pandaboard to use the generic distro configuation.
remove duplicated config options, clean up the environment, include new
environment.

Signed-off-by: Dennis Gilmore 
---
 include/configs/omap4_panda.h |  2 --
 include/configs/ti_omap4_common.h | 37 +++--
 2 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h
index 7378acd..1b81a24 100644
--- a/include/configs/omap4_panda.h
+++ b/include/configs/omap4_panda.h
@@ -33,8 +33,6 @@
 
 #define CONFIG_UBOOT_ENABLE_PADS_ALL
 
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_DHCP
 
 #include 
 #define CONFIG_CMD_NET
diff --git a/include/configs/ti_omap4_common.h 
b/include/configs/ti_omap4_common.h
index 387f570..f9baa50 100644
--- a/include/configs/ti_omap4_common.h
+++ b/include/configs/ti_omap4_common.h
@@ -86,6 +86,7 @@
 /*
  * Environment setup
  */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_EXTRA_ENV_SETTINGS \
DEFAULT_LINUX_BOOT_ENV \
"console=ttyO2,115200n8\0" \
@@ -102,16 +103,16 @@
"vram=${vram} " \
"root=${mmcroot} " \
"rootfstype=${mmcrootfstype}\0" \
-   "loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
+   "loadbootscript=load mmc ${mmcdev} ${kernel_addr_r} boot.scr\0" \
"bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
-   "source ${loadaddr}\0" \
-   "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
+   "source ${kernel_addr_r}\0" \
+   "loadbootenv=load mmc ${mmcdev} ${kernel_addr_r} uEnv.txt\0" \
"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
-   "env import -t ${loadaddr} ${filesize}\0" \
-   "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+   "env import -t ${kernel_addr_r} ${filesize}\0" \
+   "loadimage=load mmc ${bootpart} ${kernel_addr_r} 
${bootdir}/${bootfile}\0" \
"mmcboot=echo Booting from mmc${mmcdev} ...; " \
"run mmcargs; " \
-   "bootz ${loadaddr} - ${fdtaddr}\0" \
+   "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
"findfdt="\
"if test $board_name = sdp4430; then " \
"setenv fdtfile omap4-sdp.dtb; fi; " \
@@ -123,29 +124,13 @@
"setenv fdtfile omap4-panda-es.dtb; fi;" \
"if test $fdtfile = undefined; then " \
"echo WARNING: Could not determine device tree to use; 
fi; \0" \
-   "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+   "loadfdt=load mmc ${bootpart} ${fdt_addr_r} ${bootdir}/${fdtfile}\0" \
+   BOOTCMDS_COMMON
+#endif
 
 #define CONFIG_BOOTCOMMAND \
"run findfdt; " \
-   "mmc dev ${mmcdev}; if mmc rescan; then " \
-   "echo SD/MMC found on device ${mmcdev};" \
-   "if run loadbootscript; then " \
-   "run bootscript; " \
-   "else " \
-   "if run loadbootenv; then " \
-   "run importbootenv; " \
-   "fi;" \
-   "if test -n ${uenvcmd}; then " \
-   "echo Running uenvcmd ...;" \
-   "run uenvcmd;" \
-   "fi;" \
-   "fi;" \
-   "if run loadimage; then " \
-   "run loadfdt;" \
-   "run mmcboot; " \
-   "fi; " \
-   "fi"
-
+   "for target in ${boot_targets}; do run bootcmd_${target}; done "
 /*
  * Defines for SPL
  * It is known that this will break HS devices. Since the current size of
-- 
1.9.0

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


[U-Boot] [PATCH 1/6] add README.distro file

2014-03-20 Thread Dennis Gilmore
Add documentation on how to setup a system to use the generic distro
configs and boot commands. This spells out what is needed to make a
system conformant, but does not limit the board to only the defaults.

Signed-off-by: Dennis Gilmore 
---
 doc/README.distro | 76 +++
 1 file changed, 76 insertions(+)
 create mode 100644 doc/README.distro

diff --git a/doc/README.distro b/doc/README.distro
new file mode 100644
index 000..435c578
--- /dev/null
+++ b/doc/README.distro
@@ -0,0 +1,76 @@
+/*
+ * (C) Copyright 2014 Red Hat Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+Generic distro configuration
+
+
+configuring
+---
+To configure a board to run the generic distro setup and enable generic distros
+to easily support your board.
+
+you will need to include a pair of headers to enable the boot environment and
+configuration options needed. It is best to only include when not doing an
+SPL build.
+
+#ifndef CONFIG_SPL_BUILD
+#include 
+#include 
+#endif
+
+There is some memory addresses you will need to define in
+CONFIG_EXTRA_ENV_SETTINGS
+fdt_addr:
+Optional, If specified a dtb to boot the system must be available at the given
+address.
+
+fdt_addr_r:
+Mandatory, This is the location where the sysboot/pxeboot with load the dtb to,
+using the fdtdir/devicetreedir or fdt/devicetree options in the pxe/extlinux
+config file. The location can be anywhere in ram it just needs to not overlap
+with anything, allowing 1 megabyte seems to be a safe option.
+
+ramdisk_addr_r:
+Mandatory, This is the location where the sysboot/pxeboot with load the
+initramfs to, using the initrd option in the pxe/extlinux config file, the
+location of the initramfs does not matter, there needs to be enough room to be
+able to store any image. Making the image the last item stored should allow for
+any initramfs to fit and not overwrite anything else.
+
+kernel_addr_r:
+Mandatory, This is the location where the sysboot/pxeboot with load the kernel
+to,using the kernel option in the pxe/extlinux config file, the location of the
+kernel needs to 
+
+pxe_addr_r:
+Mandatory, used by the PXE code to hold the pxelinux config file. The location
+can be anywhere in ram it just needs to not overlap with anything, allowing 1 
+megabyte seems to be a safe option.
+
+scriptaddr:
+Mandatory, used to load boot.scr to The location can be anywhere in ram it just
+needs to not overlap with anything, allowing 1 megabyte seems to be a safe
+option.
+
+suggested mapping:
+For suggestions on memory locations for arm systems  you must follow the
+guidelines specified in Documentation/arm/Booting in the Linux kernel tree.
+For other architectures you must follow the guidelines for the architecture.
+
+make sure you also include BOOTCMDS_COMMON in CONFIG_EXTRA_ENV_SETTINGS
+
+You should not set initrd_high and fdt_high to 0x as the user should
+not need to edit the memory locations having the initramfs and dtb being
+relocatable is best to ensure the system will boot in all situations. 
+
+booting your system
+---
+in the most simplest form CONFIG_BOOTCOMMAND just needs one line
+
+"for target in ${boot_targets}; do run bootcmd_${target}; done "
+
+you can run any setup before going through the targets for example run a
+command to set "fdtfile" variable for the dtb for your board.
-- 
1.9.0

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


[U-Boot] [PATCH 0/6] unified boot environment

2014-03-20 Thread Dennis Gilmore
Hi All,

The attached patches build on the work for generic distro config, as well as
Stephen Warrens implementation for tegra. They depend on Toms Patches to move
ti to using DEFAULT_LINUX_BOOT_ENV on TI systems.

There is a README file to describe how to convert a system. I have added a
header to be included that will allow all boards to boot in the same way and
I have ported over three boards to use it.

Dennis


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


Re: [U-Boot] [PATCH v3 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND CONFIG_LIB_HW_RAND

2014-03-20 Thread Michael Walle
Am Donnerstag, 20. März 2014, 18:36:17 schrieb Przemyslaw Marczak:
> Dear all,
> 
> On 03/20/2014 06:23 PM, Przemyslaw Marczak wrote:
> > New configs:
> > - CONFIG_LIB_RAND- to enable implementation of rand library in
> > lib/rand.c - CONFIG_LIB_HW_RAND - to enable hardware based
> > implementations of lib rand
> > 
> > Other changes:
> > - add CONFIG_LIB_RAND to boards configs which needs rand()
> > - put only one rand.o dependency in lib/Makefile
> > 
> > CONFIG_LIB_HW_RAND should be defined for drivers which implements rand
> > library (declared in include/common.h):
> > - void srand(unsigned int seed)
> > - unsigned int rand(void)
> > - unsigned int rand_r(unsigned int *seedp)
> > 
> > Signed-off-by: Przemyslaw Marczak 
> > Cc: Michael Walle 
> > Cc: Tom Rini 
> > Cc: Masahiro Yamada 
> 
> Please look at third version of changes for introduce hardware random
> number generator support for exynos.
> I hope that I didn't omit any of yours comments.
> 
> Thank you

Hi,

seems fine to me (i didn't look at the drivers). 

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


Re: [U-Boot] [PATCH v1 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-03-20 Thread Ian Campbell
On Mon, 2014-03-17 at 15:33 -0400, Tom Rini wrote:
> > So, I'm confused about what to do here ;-)
> 
> And I've not made things clearer with a mis-recollection of things.  I
> don't know why I keep saying "bootm_low" when I mean "bootm_size" like
> I've done in later patches (and thankfully, when poking people on G+).

Ah, making that substitution makes things make a lot more sense!

> There's three ways to say "Please ensure that the FDT and if passed initrd
> do not relocate above a certain location".
> 1) In the environment, set bootm_size to kernel lowmem.  This means that
> boot_start_lmb restricts the pool used by both fdt and initrd to that
> value at the top.
> 2) In the environment, set fdt_high (and if using initrd, initrd_high)
> to the top of lowmem.  This means that we'll make sure they don't get
> relocated above that value.
> 3) In the environment set initrd_high to top of lowmem and set
> bootm_mapsize to lowmem.

Looking at http://patchwork.ozlabs.org/patch/329210/ it seems that you
went for #1 on TI stuff -- so I am going to follow suite.

> In all of the above, lowmem can be replaced with any valid size that's
> also smaller than lowmem, such as 256MB.

256MB sounds like a good value to be starting with.

>   Another option, in the
> environment, is to set initrd_high and fdt_high to 0x and then
> relocation is disabled.  I would _not_ recommend this in the general
> case as one of the points of relocation is to ensure we don't get
> overwritten by the kernel BSS.

Sure.

Thanks,
Ian.

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


Re: [U-Boot] [PATCH 05/11] ARM: tegra: pinctrl: remove duplication

2014-03-20 Thread Stephen Warren
On 03/14/2014 01:37 PM, Simon Glass wrote:
> Hi Stephen,
> 
> On 13 March 2014 11:42, Stephen Warren  wrote:
>> From: Stephen Warren 
>>
>> Much of arch/arm/cpu/tegra*-common/pinmux.c is identical. Remove the
>> duplication by creating pinmux-common.c for all the identical code.
>>
>> This leaves:
>> * arch/arm/include/asm/arch-tegra*/pinmux.h defining only the names of
>>   the various pins/pin groups, drive groups, and mux functions.
>> * arch/arm/cpu/tegra*-common/pinmux.c containing only the lookup table
>>   stating which pin groups support which mux functions.
>>
>> The code in pinmux-common.c is semantically identical to that in the
>> various original pinmux.c, but had some consistency and cleanup fixes
>> applied during migration.
> 
> This patch is very welcome, as You know I was not keen on the
> duplication going in in the first place.
> 
>>
>> I removed the definition of struct pmux_tri_ctlr, since this is different
>> between SoCs (especially Tegra20 vs all others), and it's much simpler to
>> deal with this via the new REG/MUX_REG/... defines. spl.c, warmboot.c,
>> and warmboot_avp.c needed updates due to this, since they previously
>> hijacked this struct to encode the location of some non-pinmux registers.
>> Now, that code simply calculates these register addresses directly using
>> simple and obvious math. I like this method better irrespective of the
>> pinmux code cleanup anyway.
> 
> Not as keen as you - U-Boot normally uses structures for access to
> hardware registers.

I tend to disagree with this approach. All other SW I'm familiar with
uses simple #defines for offsets. This makes U-Boot rather unfamiliar to
engineers. All HW documentation uses numerical offsets. SW #defines are
extremely easy to validate against the HW documentation, whereas with
structs you have to count out reserved arrays for gaps, put comments in
that contain the offsets to help you match everything up and validate
it, etc.

Still ...

>> diff --git a/arch/arm/cpu/arm720t/tegra-common/spl.c 
>> b/arch/arm/cpu/arm720t/tegra-common/spl.c
>> index 5171a8f907a1..4097f3b04362 100644
>> --- a/arch/arm/cpu/arm720t/tegra-common/spl.c
>> +++ b/arch/arm/cpu/arm720t/tegra-common/spl.c
>> @@ -19,10 +19,10 @@
>>
>>  void spl_board_init(void)
>>  {
>> -   struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr 
>> *)NV_PA_APB_MISC_BASE;
>> +   u32 *cfg_ctl = (u32 *)(NV_PA_APB_MISC_BASE + 0x24);
> 
> Open-coded address offset? To me it seems better to have a specific
> Tegra20 structure (normal U-Boot approach), or failing  that, worst
> case, a #define for this field. Also you should ask your hardware
> designers to stop moving things around :-)

Ah, it looks like there's already
./arch/arm/include/asm/arch-tegra20/apb_misc.h that defines the
registers at the start of the apb_misc space that aren't related to
pinmux. I'll uses this struct since it's already there, and add the one
missing field.

>> diff --git a/arch/arm/cpu/tegra-common/pinmux-common.c 
>> b/arch/arm/cpu/tegra-common/pinmux-common.c

>> +/* return 1 if a pin_pupd_is in range */
>> +#define pmux_pin_pupd_isvalid(pupd) \
>> +   (((pupd) >= PMUX_PULL_NORMAL) && ((pupd) <= PMUX_PULL_UP))
>> +
>> +/* return 1 if a pin_tristate_is in range */
>> +#define pmux_pin_tristate_isvalid(tristate) \
>> +   (((tristate) >= PMUX_TRI_NORMAL) && ((tristate) <= 
>> PMUX_TRI_TRISTATE))
>> +
>> +#ifdef TEGRA_PMX_HAS_PIN_IO_BIT_ETC
> 
> Do we need this #Ifdef?
>
>> +/* return 1 if a pin_io_is in range */
>> +#define pmux_pin_io_isvalid(io) \
>> +   (((io) >= PMUX_PIN_OUTPUT) && ((io) <= PMUX_PIN_INPUT))

We certainly need not to compile this code, since e.g. PMUX_PIN_INPUT
doesn't exist on Tegra20 due to equivalent #ifdefs in pinmux.h.

I do explicitly want to keep the ifdefs in pinmux.h, so that APIs are
not prototyped, and values not defined, for features that don't exist on
the SoC that U-Boot is being built for. This validates at compile time
that code isn't using invalid APIs. While pinmux.h could be split up
into a few separate header files to avoid the ifdefs, I think that would
make the header situation far more complex than it needs to be.

I don't see anything wrong with having the same ifdefs in pinmux.c; it's
a very consistent structure. It also means that all the conditional
logic is in code, all implemented consistently via C pre-processor,
rather than some being in the header file and some in the Makefiles, and
hence I think it's easier to keep the two in sync, since they work
identically.

So in summary, I'd like to keep the ifdefs. I think they're pretty
simple and not a maintenance burden. Do you object?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/11] ARM: tegra: pinmux naming consistency fixes

2014-03-20 Thread Stephen Warren
On 03/14/2014 02:15 PM, Simon Glass wrote:
> Hi Stephen,
> 
> On 13 March 2014 11:42, Stephen Warren  wrote:
>> From: Stephen Warren 
>>
>> Clean up the naming of pinmux-related objects:
>> * Refer to drive groups rather than pad groups to match the Linux kernel.
>> * Ensure all pinmux API types are prefixed with pmux_, values (defines)
>>   are prefixed with PMUX_, and functions prefixed with pinmux_.
>> * Modify a few type names to make their content clearer.
>> * Minimal changes to SoC-specific .h/.c files are made so the code still
>>   compiles. A separate per-SoC change will be made immediately following,
>>   in order to keep individual patch size down.
>>
>> Signed-off-by: Stephen Warren 
> 
> Acked-by: Simon Glass 
> 
> A few comments below.

>> diff --git a/arch/arm/cpu/tegra114-common/pinmux.c 
>> b/arch/arm/cpu/tegra114-common/pinmux.c
>> index af8b7ca5fc79..efe5163084c1 100644
>> --- a/arch/arm/cpu/tegra114-common/pinmux.c
>> +++ b/arch/arm/cpu/tegra114-common/pinmux.c
>> @@ -41,7 +41,7 @@
>>  #define PIN_RESERVED \
>> PIN(NONE, NONE, INVALID, INVALID, INVALID, INVALID, NONE)
>>
>> -const struct tegra_pingroup_desc tegra114_pingroups[PINGRP_COUNT] = {
>> +const struct pmux_pingrp_desc tegra114_pingroups[PMUX_PINGRP_COUNT] = {
> 
> Can some of these be static?

Yes. I'll actually fix this in patch 5, since that patch is what introduced:

const struct tegra_pingroup_desc *tegra_soc_pingroups \
= tegra114_pingroups;

... which is what allows this table to be static.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND CONFIG_LIB_HW_RAND

2014-03-20 Thread Przemyslaw Marczak

Dear all,

On 03/20/2014 06:23 PM, Przemyslaw Marczak wrote:

New configs:
- CONFIG_LIB_RAND- to enable implementation of rand library in lib/rand.c
- CONFIG_LIB_HW_RAND - to enable hardware based implementations of lib rand

Other changes:
- add CONFIG_LIB_RAND to boards configs which needs rand()
- put only one rand.o dependency in lib/Makefile

CONFIG_LIB_HW_RAND should be defined for drivers which implements rand library
(declared in include/common.h):
- void srand(unsigned int seed)
- unsigned int rand(void)
- unsigned int rand_r(unsigned int *seedp)

Signed-off-by: Przemyslaw Marczak 
Cc: Michael Walle 
Cc: Tom Rini 
Cc: Masahiro Yamada 



Please look at third version of changes for introduce hardware random 
number generator support for exynos.

I hope that I didn't omit any of yours comments.

Thank you
--
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] [PATCH v3 2/4] cpu: exynos4: add ace sha base address

2014-03-20 Thread Przemyslaw Marczak
Signed-off-by: Przemyslaw Marczak 
Cc: Minkyu Kang 

---
Changes v3:
- new commit - after separate changes from next commit

 arch/arm/include/asm/arch-exynos/cpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
b/arch/arm/include/asm/arch-exynos/cpu.h
index bccce63..bd3300a 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -44,11 +44,11 @@
 #define EXYNOS4_MODEM_BASE 0x13A0
 #define EXYNOS4_USBPHY_CONTROL 0x10020704
 #define EXYNOS4_I2S_BASE   0xE210
+#define EXYNOS4_ACE_SFR_BASE   0x1083
 
 #define EXYNOS4_GPIO_PART4_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4_DP_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4_SPI_ISP_BASE   DEVICE_NOT_AVAILABLE
-#define EXYNOS4_ACE_SFR_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DMC_PHY_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_AUDIOSS_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_USB_HOST_XHCI_BASE DEVICE_NOT_AVAILABLE
@@ -80,6 +80,7 @@
 #define EXYNOS4X12_UART_BASE   0x1380
 #define EXYNOS4X12_I2C_BASE0x1386
 #define EXYNOS4X12_PWMTIMER_BASE   0x139D
+#define EXYNOS4X12_ACE_SFR_BASE0x1083
 
 #define EXYNOS4X12_ADC_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_DP_BASE DEVICE_NOT_AVAILABLE
@@ -87,7 +88,6 @@
 #define EXYNOS4X12_I2S_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_SPI_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_SPI_ISP_BASEDEVICE_NOT_AVAILABLE
-#define EXYNOS4X12_ACE_SFR_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_DMC_PHY_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_AUDIOSS_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_USB_HOST_XHCI_BASE  DEVICE_NOT_AVAILABLE
-- 
1.9.0

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


[U-Boot] [PATCH v3 3/4] drivers: crypto: ace_sha: add implementation of hardware based lib rand

2014-03-20 Thread Przemyslaw Marczak
This patch adds implementation of rand library based on hardware random
number generator of security subsystem in Exynos SOC.

This library includes:
- srand()  - used for seed hardware block
- rand()   - returns random number
- rand_r() - the same as above with given seed

which depends on CONFIG_EXYNOS_ACE_SHA and CONFIG_LIB_HW_RAND.

Change-Id: Ie0b44a7fcc375dd733329b04183559f376a4e25c
Signed-off-by: Przemyslaw Marczak 
cc: Akshay Saraswat 
cc: ARUN MANKUZHI 
cc: Minkyu Kang 

---
Changes v2:
- none

Changes v3:
- add implementation of rand library to ace_sha
- add proper ifdef for ace_sha SHA functions
- move cpu refer change to new commit

 drivers/crypto/ace_sha.c | 76 +++-
 drivers/crypto/ace_sha.h |  8 +++--
 2 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/ace_sha.c b/drivers/crypto/ace_sha.c
index acbafde..51fb92c 100644
--- a/drivers/crypto/ace_sha.c
+++ b/drivers/crypto/ace_sha.c
@@ -5,10 +5,12 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 #include 
+#include "ace_sha.h"
+
+#ifdef CONFIG_SHA_HW_ACCEL
 #include 
 #include 
 #include 
-#include "ace_sha.h"
 
 /* SHA1 value for the message of zero length */
 static const unsigned char sha1_digest_emptymsg[SHA1_SUM_LEN] = {
@@ -111,3 +113,75 @@ void hw_sha1(const unsigned char *pbuf, unsigned int 
buf_len,
if (ace_sha_hash_digest(pbuf, buf_len, pout, ACE_SHA_TYPE_SHA1))
debug("ACE was not setup properly or it is faulty\n");
 }
+#endif /* CONFIG_SHA_HW_ACCEL */
+
+#ifdef CONFIG_LIB_HW_RAND
+static unsigned int seed_done;
+
+void srand(unsigned int seed)
+{
+   struct exynos_ace_sfr *reg =
+   (struct exynos_ace_sfr *)samsung_get_base_ace_sfr();
+   int i;
+
+   /* Seed data */
+   for (i = 0; i < ACE_HASH_PRNG_REG_NUM; i++)
+   writel(seed << i, ®->hash_seed[i]);
+
+   /* Wait for seed setup done */
+   while (1) {
+   status = readl(®->hash_status);
+   if ((status & ACE_HASH_SEEDSETTING_MASK) ||
+   (status & ACE_HASH_PRNGERROR_MASK))
+   break;
+   }
+
+   seed_done = 1;
+}
+
+unsigned int rand(void)
+{
+   struct exynos_ace_sfr *reg =
+   (struct exynos_ace_sfr *)samsung_get_base_ace_sfr();
+   int status, i;
+   unsigned int seed;
+   unsigned int *seed_ptr;
+   unsigned int ret = 0;
+
+   if (!seed_done)
+   srand(seed);
+
+   /* Start PRNG */
+   writel(ACE_HASH_ENGSEL_PRNG | ACE_HASH_STARTBIT_ON, ®->hash_control);
+
+   /* Wait for PRNG done */
+   while (1) {
+   status = readl(®->hash_status);
+   if (status & ACE_HASH_PRNGDONE_MASK)
+   break;
+   if (status & ACE_HASH_PRNGERROR_MASK) {
+   seed_done = 0;
+   return 0;
+   }
+   }
+
+   /* Clear Done IRQ */
+   writel(ACE_HASH_PRNGDONE_MASK, ®->hash_status);
+
+   /* Read a PRNG result */
+   for (i = 0; i < ACE_HASH_PRNG_REG_NUM; i++)
+   ret += readl(®->hash_prng[i]);
+
+   seed_done = 0;
+   return ret;
+}
+
+unsigned int rand_r(unsigned int *seedp)
+{
+   seed_done = 0;
+
+   srand(*seedp);
+
+   return rand();
+}
+#endif /* CONFIG_LIB_HW_RAND */
diff --git a/drivers/crypto/ace_sha.h b/drivers/crypto/ace_sha.h
index a426d52..f1097f7 100644
--- a/drivers/crypto/ace_sha.h
+++ b/drivers/crypto/ace_sha.h
@@ -72,9 +72,10 @@ struct exynos_ace_sfr {
unsigned char   res12[0x30];
unsigned inthash_result[8];
unsigned char   res13[0x20];
-   unsigned inthash_seed[8];
-   unsigned inthash_prng[8];
-   unsigned char   res14[0x180];
+   unsigned inthash_seed[5];
+   unsigned char   res14[12];
+   unsigned inthash_prng[5];
+   unsigned char   res15[0x18c];
 
unsigned intpka_sfr[5]; /* base + 0x700 */
 };
@@ -291,6 +292,7 @@ struct exynos_ace_sfr {
 #define ACE_HASH_PRNGERROR_MASK(1 << 7)
 #define ACE_HASH_PRNGERROR_OFF (0 << 7)
 #define ACE_HASH_PRNGERROR_ON  (1 << 7)
+#define ACE_HASH_PRNG_REG_NUM  5
 
 #define ACE_SHA_TYPE_SHA1  1
 #define ACE_SHA_TYPE_SHA2562
-- 
1.9.0

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


[U-Boot] [PATCH v3 4/4] trats/trats2: enable exynos ace sha subsystem and hardware based lib rand

2014-03-20 Thread Przemyslaw Marczak
This allows to use exynos random number generator.

Signed-off-by: Przemyslaw Marczak 
Acked-by: Lukasz Majewski 
cc: Piotr Wilczek 
cc: Minkyu Kang 

---
Changes v2:
- none

Changes v3:
- change config name CONFIG_RAND_HW_ACCEL to CONFIG_HW_RAND

 include/configs/trats.h  | 4 
 include/configs/trats2.h | 4 
 2 files changed, 8 insertions(+)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 7cea259..5cf0a4d 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -313,6 +313,10 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Security subsystem - enable hw_rand() */
+#define CONFIG_EXYNOS_ACE_SHA
+#define CONFIG_HW_RAND
+
 /* Common misc for Samsung */
 #define CONFIG_MISC_COMMON
 
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 6d389df..7182357 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -324,6 +324,10 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_USB_GADGET_VBUS_DRAW2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Security subsystem - enable hw_rand() */
+#define CONFIG_EXYNOS_ACE_SHA
+#define CONFIG_HW_RAND
+
 /* Common misc for Samsung */
 #define CONFIG_MISC_COMMON
 
-- 
1.9.0

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


[U-Boot] [PATCH v3 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND CONFIG_LIB_HW_RAND

2014-03-20 Thread Przemyslaw Marczak
New configs:
- CONFIG_LIB_RAND- to enable implementation of rand library in lib/rand.c
- CONFIG_LIB_HW_RAND - to enable hardware based implementations of lib rand

Other changes:
- add CONFIG_LIB_RAND to boards configs which needs rand()
- put only one rand.o dependency in lib/Makefile

CONFIG_LIB_HW_RAND should be defined for drivers which implements rand library
(declared in include/common.h):
- void srand(unsigned int seed)
- unsigned int rand(void)
- unsigned int rand_r(unsigned int *seedp)

Signed-off-by: Przemyslaw Marczak 
Cc: Michael Walle 
Cc: Tom Rini 
Cc: Masahiro Yamada 

---
Changes v3:
- new commit

 include/common.h  | 4 +---
 include/configs/MERGERBOX.h   | 1 +
 include/configs/MVBC_P.h  | 1 +
 include/configs/MVBLM7.h  | 1 +
 include/configs/MVSMR.h   | 1 +
 include/configs/a3m071.h  | 1 +
 include/configs/bfin_adi_common.h | 1 +
 include/configs/lsxl.h| 1 +
 include/configs/sacsng.h  | 1 +
 lib/Makefile  | 4 +---
 10 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/common.h b/include/common.h
index 090fcde..fcf4318 100644
--- a/include/common.h
+++ b/include/common.h
@@ -829,9 +829,7 @@ char *  strmhz(char *buf, unsigned long hz);
 #include 
 
 /* lib/rand.c */
-#if defined(CONFIG_RANDOM_MACADDR) || \
-   defined(CONFIG_BOOTP_RANDOM_DELAY) || \
-   defined(CONFIG_CMD_LINK_LOCAL)
+#if defined(CONFIG_LIB_RAND) || defined(CONFIG_LIB_HW_RAND)
 #define RAND_MAX -1U
 void srand(unsigned int seed);
 unsigned int rand(void);
diff --git a/include/configs/MERGERBOX.h b/include/configs/MERGERBOX.h
index 930699b..19ea316 100644
--- a/include/configs/MERGERBOX.h
+++ b/include/configs/MERGERBOX.h
@@ -312,6 +312,7 @@
 #define CONFIG_BOOTP_NTPSERVER
 #define CONFIG_BOOTP_RANDOM_DELAY
 #define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_LIB_RAND
 
 /*
  * Command line configuration.
diff --git a/include/configs/MVBC_P.h b/include/configs/MVBC_P.h
index 99e4e90..036396c 100644
--- a/include/configs/MVBC_P.h
+++ b/include/configs/MVBC_P.h
@@ -104,6 +104,7 @@
 #define CONFIG_BOOTP_NTPSERVER
 #define CONFIG_BOOTP_RANDOM_DELAY
 #define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_LIB_RAND
 
 /*
  * Autoboot
diff --git a/include/configs/MVBLM7.h b/include/configs/MVBLM7.h
index 30af691..27c2fa0 100644
--- a/include/configs/MVBLM7.h
+++ b/include/configs/MVBLM7.h
@@ -227,6 +227,7 @@
 #define CONFIG_BOOTP_NTPSERVER
 #define CONFIG_BOOTP_RANDOM_DELAY
 #define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_LIB_RAND
 
 /* USB */
 #define CONFIG_SYS_USB_HOST
diff --git a/include/configs/MVSMR.h b/include/configs/MVSMR.h
index bb565b6..ad15506 100644
--- a/include/configs/MVSMR.h
+++ b/include/configs/MVSMR.h
@@ -92,6 +92,7 @@
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_BOOTP_SUBNETMASK
 #define CONFIG_BOOTP_VENDOREX
+#define CONFIG_LIB_RAND
 
 /*
  * Autoboot
diff --git a/include/configs/a3m071.h b/include/configs/a3m071.h
index 1e65cd1..205adfd 100644
--- a/include/configs/a3m071.h
+++ b/include/configs/a3m071.h
@@ -58,6 +58,7 @@
 #define CONFIG_BOOTP_SERVERIP
 #define CONFIG_NET_RETRY_COUNT 3
 #define CONFIG_CMD_LINK_LOCAL
+#define CONFIG_LIB_RAND
 #define CONFIG_NETCONSOLE
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define CONFIG_CMD_PING
diff --git a/include/configs/bfin_adi_common.h 
b/include/configs/bfin_adi_common.h
index 08ccce0..ea9acf6 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -17,6 +17,7 @@
 #  define CONFIG_BOOTP_DNS
 #  define CONFIG_BOOTP_NTPSERVER
 #  define CONFIG_BOOTP_RANDOM_DELAY
+#  define CONFIG_LIB_RAND
 #  define CONFIG_KEEP_SERVERADDR
 #  define CONFIG_CMD_DNS
 #  define CONFIG_CMD_PING
diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h
index 2ae8a27..96a889f 100644
--- a/include/configs/lsxl.h
+++ b/include/configs/lsxl.h
@@ -37,6 +37,7 @@
 #define CONFIG_SHOW_BOOT_PROGRESS
 
 #define CONFIG_RANDOM_MACADDR
+#define CONFIG_LIB_RAND
 #define CONFIG_KIRKWOOD_GPIO
 #define CONFIG_OF_LIBFDT
 
diff --git a/include/configs/sacsng.h b/include/configs/sacsng.h
index 0a694fb..b5064ab 100644
--- a/include/configs/sacsng.h
+++ b/include/configs/sacsng.h
@@ -457,6 +457,7 @@
 #endif /* CONFIG_BOOT_ROOT_NFS */
 
 #define CONFIG_BOOTP_RANDOM_DELAY   /* Randomize the BOOTP retry delay */
+#define CONFIG_LIB_RAND
 
 /*
  * BOOTP options
diff --git a/lib/Makefile b/lib/Makefile
index 8814ff9..ae80865 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -62,8 +62,6 @@ obj-y += time.o
 obj-$(CONFIG_TRACE) += trace.o
 obj-$(CONFIG_BOOTP_PXE) += uuid.o
 obj-y += vsprintf.o
-obj-$(CONFIG_RANDOM_MACADDR) += rand.o
-obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o
-obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o
+obj-$(CONFIG_LIB_RAND) += rand.o
 
 subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
-- 
1.9.0

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


[U-Boot] [PATCH] kbuild/makefile: allow building host tools separately

2014-03-20 Thread Alexey Brodkin
Sometimes it is required to build only host U-Boot tools without building
U-Boot itself for either board.

For example:
 * In "buildroot" "uboot-tools" could be built for host just to have an ability
   to create uImage.
 * Linux distributions ship "mkimage" utility as a separate substance.

This patch allows building host U-Boot tools separately from U-Boot itself and
what is more important user only needs to have host compiler (gcc).

To build host tools just execute:
=
make tools HOST_TOOLS_ONLY=yes
=

Without this patch to generate tools user needs:
 1. Configure any existing board with "make XXX_config"
 2. Execute tools building but still cross-compiler will be invoked and if
there's no proper cross-compiler in PATH compilation will fail.

Signed-off-by: Alexey Brodkin 

Cc: Masahiro Yamada 
Cc: Tom Rini 
Cc: Simon Glass 
---
 Kbuild   | 5 +
 Makefile | 7 +++
 2 files changed, 12 insertions(+)

diff --git a/Kbuild b/Kbuild
index 1d89761..b5e348d 100644
--- a/Kbuild
+++ b/Kbuild
@@ -4,6 +4,9 @@
 # 1) Generate generic-asm-offsets.h
 # 2) Generate asm-offsets.h
 
+# Don't execute target below if building host tools only
+ifneq ($(HOST_TOOLS_ONLY),yes)
+
 #
 # 1) Generate generic-asm-offsets.h
 
@@ -85,3 +88,5 @@ $(CPUDIR)/$(SOC)/asm-offsets.s: 
$(CPUDIR)/$(SOC)/asm-offsets.c FORCE
 
 $(obj)/$(offsets-file): $(CPUDIR)/$(SOC)/asm-offsets.s
$(call cmd,offsets)
+
+endif
diff --git a/Makefile b/Makefile
index b795338..2fb8ea1 100644
--- a/Makefile
+++ b/Makefile
@@ -481,9 +481,12 @@ ifeq ($(dot-config),1)
 # load other configuration
 include $(srctree)/config.mk
 
+# Don't check for config.mk presence if building host tools only
+ifneq ($(HOST_TOOLS_ONLY),yes)
 ifeq ($(wildcard include/config.mk),)
 $(error "System not configured - see README")
 endif
+endif
 
 # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
 # that (or fail if absent).  Otherwise, search for a linker script in a
@@ -994,10 +997,14 @@ ifeq ($(CONFIG_SYS_GENERIC_BOARD),y)
@/bin/false
 endif
 endif
+
+# Don't check for ldscript presence if building host tools only
+ifneq ($(HOST_TOOLS_ONLY),yes)
 ifeq ($(wildcard $(LDSCRIPT)),)
@echo >&2 "  Could not find linker script."
@/bin/false
 endif
+endif
 
 archprepare: prepare1 scripts_basic
 
-- 
1.8.5.3

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


Re: [U-Boot] iMX6 IPU display interface definition

2014-03-20 Thread Eric Bénard
Hi Andreas,

Le Thu, 20 Mar 2014 16:13:53 +,
Andreas Geisreiter  a écrit :
> Thanks for your help. In the header files which you mentioned I found the 
> following:
> 
> V-Sync: Active high or low = FB_SYNC_VERT_HIGH_ACT
> H-Sync: Active high or low = FB_SYNC_HOR_HIGH_ACT
> Output enable: Active high or low = FB_SYNC_OE_LOW_ACT
> Data lines: inverted or not = FB_SYNC_DATA_INVERT
> Pixel Clock: Data is driven on falling or rising edge
> 
> But now I'm missing the define for switching pixel clock between rising and 
> falling edge. Do you know how I can switch pixel clock activity?
> 
check in drivers/video/mxc_ipuv3_fb.c : 
if (!(fbi->var.sync & FB_SYNC_CLK_LAT_FALL))
sig_cfg.clk_pol = 1;

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


Re: [U-Boot] iMX6 IPU display interface definition

2014-03-20 Thread Andreas Geisreiter
Hi Eric,

Thanks for your help. In the header files which you mentioned I found the 
following:

V-Sync: Active high or low = FB_SYNC_VERT_HIGH_ACT
H-Sync: Active high or low = FB_SYNC_HOR_HIGH_ACT
Output enable: Active high or low = FB_SYNC_OE_LOW_ACT
Data lines: inverted or not = FB_SYNC_DATA_INVERT
Pixel Clock: Data is driven on falling or rising edge

But now I'm missing the define for switching pixel clock between rising and 
falling edge. Do you know how I can switch pixel clock activity?

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


Re: [U-Boot] [PATCH 3/3] am43xx_evm: Update the ramdisk args, we pass things in just fine via DT

2014-03-20 Thread Dennis Gilmore
On Tue, 11 Mar 2014 15:42:03 -0400
Tom Rini  wrote:

> Signed-off-by: Tom Rini 
> ---
>  include/configs/am43xx_evm.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/configs/am43xx_evm.h
> b/include/configs/am43xx_evm.h index 2c5..2d9825b 100644
> --- a/include/configs/am43xx_evm.h
> +++ b/include/configs/am43xx_evm.h
> @@ -128,7 +128,7 @@
>   "usbroot=/dev/sda2 rw\0" \
>   "usbrootfstype=ext4 rootwait\0" \
>   "usbdev=0\0" \
> - "ramroot=/dev/ram0 rw ramdisk_size=65536
> initrd=${rdaddr},64M\0" \
> + "ramroot=/dev/ram0 rw\0" \
>   "ramrootfstype=ext2\0" \
>   "mmcargs=setenv bootargs console=${console} " \
>   "${optargs} " \

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


Re: [U-Boot] [PATCH 2/3] am335x_evm: Update the ramdisk args, we pass things in just fine via DT

2014-03-20 Thread Dennis Gilmore
On Tue, 11 Mar 2014 15:42:02 -0400
Tom Rini  wrote:

> Signed-off-by: Tom Rini 
> ---
>  include/configs/am335x_evm.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/configs/am335x_evm.h
> b/include/configs/am335x_evm.h index 6bd8aec..11088b3 100644
> --- a/include/configs/am335x_evm.h
> +++ b/include/configs/am335x_evm.h
> @@ -79,7 +79,7 @@
>   "nfsopts=nolock\0" \
>   "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}"
> \ "::off\0" \
> - "ramroot=/dev/ram0 rw ramdisk_size=65536
> initrd=${rdaddr},64M\0" \
> + "ramroot=/dev/ram0 rw\0" \
>   "ramrootfstype=ext2\0" \
>   "mmcargs=setenv bootargs console=${console} " \
>   "${optargs} " \


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


Re: [U-Boot] [PATCH 1/3] TI: Add, use a DEFAULT_LINUX_BOOT_ENV environment string

2014-03-20 Thread Dennis Gilmore
On Tue, 11 Mar 2014 15:42:01 -0400
Tom Rini  wrote:

> To deal with a reoccurring problem properly we need to specify
> addresses for the Linux kernel, Flatted Device Tree and ramdisk that
> obey the constraints within the kernel's Documentation/arm/Booting
> file but also make sure that we relocate things within a valid
> address range.
> 
> It is possible with these addresses to also set fdt_high and
> initrd_high to the value of 0x.  We don't do this by default
> to allow for the most likely success of people using custom addresses
> however.
> 
> Signed-off-by: Tom Rini 

Tested-by: Dennis Gilmore 
Reviewed-By: Dennis Gilmore 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] iMX6 IPU display interface definition

2014-03-20 Thread Eric Nelson

Hi Andreas,

On 03/20/2014 01:41 AM, Andreas Geisreiter wrote:

Hi,

we are working at the moment with i.MX6DL. I tried to setup new
display support (RGB interface) in Bootloader U-Boot. There is a
structure available, where I can define all the display timings:
.mode   = {
.name   = "wvga-rgb",
.refresh= 57,
.xres   = 800,
.yres   = 480,
.pixclock   = 33260,
.left_margin= 42,
.right_margin   = 86,
.upper_margin   = 10,
.lower_margin   = 33,
.hsync_len  = 128,
.vsync_len  = 2,
.sync   = 0,
.vmode  = FB_VMODE_NONINTERLACED

But there I miss the edge definition of the pixel clock and data
enable.

>

The sync field is used to describe these characteristics,
and some of the flags are listed in drivers/video/mxcfb.h (FB_SYNC*)
and others in drivers/video/videomodes.h (FB_SYNC_VERT_HIGH_ACT).

Regards,


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


Re: [U-Boot] [RFC PATCH 04/17] kconfig: add defconfig files for all boards

2014-03-20 Thread Daniel Schwierzeck
2014-03-20 1:11 GMT+01:00 Masahiro Yamada :
>
> Basicly I think it's a good idea, but I am afraid there are some
> problems.
>
> [1]
> First, in this case, how can we select the target board?
>
> Like this?
>
> choice
> prompt "Board select"
> default BOARD_SANDBOX
>
> config BOARD_VEXPRESS_AEMV8A
> bool "vexpress_aemv8a board"
>
> config BOARD_ARCANGEL4
> bool "arcangel4 board"
>
> [ Snip: a thousand of boards ]
>
> endchoice
>
> If we run "make config", a bunch of board choices
> would be displayed and be gone away quickly.
> For "make menuconfig", it would be hard to select the board
> you are aiming at.
>
>
> Maybe we should choose it in the top-down order?
> Like this?

I think only the top-down approach makes sense

>
> [2]
> CONFIG_CPU_
> CONFIG_SOC_
> CONFIG_VENDOR_
> CONFIG_BOARD_
> are systematic prefixes and easy to understand.
>
> But there are already some macros bound to
> specific CPUs, SoCs.
>
> For example,
> CONFIG_SOC_TEGRA30 would be the same as
> existing CONFIG_TEGRA30.
>
> We will have to merge macros with the same meaning.

in the first step we could do something like this:

config TEGRA30
bool

config SOC_TEGRA30
bool
select TEGRA30

>
> [3]
> How to select board directoy by using boolean macros.
>
> If we try to emulate arch/arm/Makefile of Linux,
>
> board-$(CONFIG_BOARD_VEXPRESS_AEMV8A)   := vexpress_aemv8a
> board-$(CONFIG_BOARD_AXS101) := axs101
> board-$(CONFIG_BOARD_ARCANGEL4)   := arcangel4
>
> Like this?
>

how about this:

Makefile:
...
lib-y += boards/
...

board/Makefile:
obj-$(CONFIG_BOARD_A3000) += a3000/
...
obj-$(CONFIG_VENDOR_NVIDIA) += nvidia/
...

board/nvidia/Makefile:
obj-y += common/
obj-$(CONFIG_BOARD_BEAVER) += beaver/
obj-$(CONFIG_BOARD_CARDHU) += cardhu/
...

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


[U-Boot] [PATCH] sun5i: Add A13-OLinuXinoM support

2014-03-20 Thread Tom Rini
Tested-by: Matt Porter 
Signed-off-by: Tom Rini 
---
 board/sunxi/Makefile |1 +
 board/sunxi/dram_a13_oli_micro.c |   32 
 boards.cfg   |1 +
 3 files changed, 34 insertions(+)
 create mode 100644 board/sunxi/dram_a13_oli_micro.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index 8e284d4..a49e28e 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -11,4 +11,5 @@
 obj-y  += board.o
 obj-$(CONFIG_A10_OLINUXINO_L)  += dram_a10_olinuxino_l.o
 obj-$(CONFIG_A10S_OLINUXINO_M) += dram_a10s_olinuxino_m.o
+obj-$(CONFIG_A13_OLINUXINOM)   += dram_a13_oli_micro.o
 obj-$(CONFIG_CUBIETRUCK)   += dram_cubietruck.o
diff --git a/board/sunxi/dram_a13_oli_micro.c b/board/sunxi/dram_a13_oli_micro.c
new file mode 100644
index 000..8154ea2
--- /dev/null
+++ b/board/sunxi/dram_a13_oli_micro.c
@@ -0,0 +1,32 @@
+/* this file is generated, don't edit it yourself */
+
+#include 
+#include 
+
+static struct dram_para dram_para = {
+   .clock = 408,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 16,
+   .bus_width = 16,
+   .cas = 9,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 256,
+   .tpr0 = 0x42d899b7,
+   .tpr1 = 0xa090,
+   .tpr2 = 0x22a00,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0x10,
+   .emr3 = 0,
+
+};
+
+unsigned long sunxi_dram_init(void)
+{
+   return dramc_init(&dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 28f6fbc..b695a10 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -355,6 +355,7 @@ Active  arm armv7  s5pc1xx samsung  
   smdkc100
 Active  arm armv7  socfpga altera  socfpga 
socfpga_cyclone5 -  

   -
 Active  arm armv7  sunxi   -   sunxi   
A10-OLinuXino-Lime   
sun4i:A10_OLINUXINO_L,AXP209_POWER,SUNXI_EMAC,SPL   
  -
 Active  arm armv7  sunxi   -   sunxi   
A10s-OLinuXino-M 
sun5i:A10S_OLINUXINO_M,AXP152_POWER,SUNXI_EMAC,SPL  
  -
+Active  arm armv7  sunxi   -   sunxi   
A13-OLinuXinoM   
sun5i:A13_OLINUXINOM,SPL,NO_AXP,STATUSLED=201,CONS_INDEX=2  
  -
 Active  arm armv7  sunxi   -   sunxi   
Cubietruck   
sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL 
  -
 Active  arm armv7  sunxi   -   sunxi   
Cubietruck_FEL   
sun7i:CUBIETRUCK,AXP209_POWER,FAST_MBUS,SPL_FEL 
  -
 Active  arm armv7  u8500   st-ericsson snowball
snowball -  

   Mathieu Poirier 
-- 
1.7.9.5

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


Re: [U-Boot] [PATCH] 4xx: cleanup ethernet phy initialization on PMC440 boards

2014-03-20 Thread Stefan Roese

Hi Matthias,

On 19.03.2014 21:30, Matthias Fuchs wrote:

This patch moves phy initialization for VSC8601 ethernet
phys that are used on early board revisions into a separate
setup function.


Thanks for working on this. Some additional comments though.


Signed-off-by: Matthias Fuchs 
---
  board/esd/pmc440/pmc440.c |   45 ++---
  1 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/board/esd/pmc440/pmc440.c b/board/esd/pmc440/pmc440.c
index 7aee8e4..3165486 100644
--- a/board/esd/pmc440/pmc440.c
+++ b/board/esd/pmc440/pmc440.c
@@ -643,6 +643,23 @@ int is_pci_host(struct pci_controller *hose)
  #endif /* defined(CONFIG_PCI) */

  #ifdef CONFIG_RESET_PHY_R
+int pmc440_setup_vsc8601(char *devname, int phy_addr,
+unsigned short behavior, unsigned short method)


static int pmc440_...


+{
+   /* adjust LED behavior */
+   if (miiphy_write(devname, phy_addr, 0x1f, 0x0001) != 0) {
+   printf("Phy%d: register write access failed\n", phy_addr);
+   return -1;
+   }
+
+   miiphy_write(devname, phy_addr, 0x11, 0x0010);
+   miiphy_write(devname, phy_addr, 0x11, behavior);
+   miiphy_write(devname, phy_addr, 0x10, method);
+   miiphy_write(devname, phy_addr, 0x1f, 0x);
+
+   return 0;
+}


Look much nicer with less indentation. :)


  int pmc440_setup_ksz9031(char *devname, int phy_addr)


And now I notice that this should also be:

static int pmc440_...

A new patch-set would be best to handle this. Or a new patch with both 
changes squashed together would be fine as well. Whatever you prefer.


Thanks,
Stefan

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


Re: [U-Boot] [patch] replace mkimage.c write() calls with full_write()

2014-03-20 Thread Wolfgang Denk
Dear Andrew,

In message <20140320034408.ga20...@canndrew.org> you wrote:
> 
> This patch adds a function to mkimage.c called full_write() which calls 
> write()
> in a loop until all the data has been written or write errors.
> 
> I was getting an error with mkimage running out of space on the device it was
> writing to, but instead of printing a useful error message it was printing:

I think your patch itself it OK, but please see [1] for proper coding
style and other patch submission requirements, like adding a commit
message and a sSigne-off-by: line.  also make sure to run your patch
through checkpatch.pl before submission - as is I get this:

ERROR: open brace '{' following function declarations go on the next line
#114: FILE: tools/mkimage.c:32:
+static ssize_t full_write(int fd, const void *buf, size_t count) {

ERROR: space required before the open parenthesis '('
#116: FILE: tools/mkimage.c:34:
+   for(;;) {

ERROR: space required before the open parenthesis '('
#119: FILE: tools/mkimage.c:37:
+   if(written < 0)

ERROR: space required before the open parenthesis '('
#123: FILE: tools/mkimage.c:41:
+   if(remaining <= 0)

WARNING: line over 80 characters
#147: FILE: tools/mkimage.c:430:
+   bytes_written = full_write(ifd, (char *)&size, 
sizeof(size));

ERROR: Missing Signed-off-by: line(s)

total: 5 errors, 1 warnings, 70 lines checked


Thanks.


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


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
"The number  of  Unix  installations  has  grown  to  10,  with  more
expected."- The Unix Programmer's Manual, 2nd Edition, June, 1972
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 1/6] part_efi: move uuid<->string conversion functions into lib/uuid.c

2014-03-20 Thread Przemyslaw Marczak

Hello,

On 03/19/2014 08:19 PM, Wolfgang Denk wrote:

Dear Przemyslaw Marczak,

In message <1395251911-26540-1-git-send-email-p.marc...@samsung.com> you wrote:

Changes:
- move uuid<->string conversion functions into lib/uuid.c so they can be
   used by code outside part_efi.c.
- rename uuid_string() to uuid_bin_to_str() for consistency with existing
   uuid_str_to_bin()
- add an error return code to uuid_str_to_bin()

Update existing code to the new library functions.


Please make sure to run your patches through checkpatch.  Here I get
this:

WARNING: line over 80 characters
#331: FILE: lib/uuid.c:41:
+ * GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique 
numbers.

Please fix.

Best regards,

Wolfgang Denk


Sorry for this. I will fix it in next patchset.
Are other changes acceptable?

Thank you,
--
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] iMX6 IPU display interface definition

2014-03-20 Thread Andreas Geisreiter
Hi,

we are working at the moment with i.MX6DL. I tried to setup new display support 
(RGB interface) in Bootloader U-Boot. There is a structure available, where I 
can define all the display timings:
.mode   = {
.name   = "wvga-rgb",
.refresh= 57,
.xres   = 800,
.yres   = 480,
.pixclock   = 33260,
.left_margin= 42,
.right_margin   = 86,
.upper_margin   = 10,
.lower_margin   = 33,
.hsync_len  = 128,
.vsync_len  = 2,
.sync   = 0,
.vmode  = FB_VMODE_NONINTERLACED

But there I miss the edge definition of the pixel clock and data enable. I also 
searched in the user manual about the i.MX6 IPU register where I can set the 
active high or low information but I can't find it.
So can anybody tell me in which registers I can set the following information's:
V-Sync: Active high or low
H-Sync: Active high or low
Pixel Clock: Data is driven on falling or rising edge
Output enable: Active high or low
Data lines: inverted or not

If anybody can tell me how I can do this in U-Boot it would also help. H-Sync 
and V-Sync activity I can control with the defines FB_SYNC_HOR_HIGH_ACT and 
FB_SYNC_VERT_HIGH_ACT but the other controls (pixel clock rising or falling 
edge, data enable active high or low, Data lines inverted or not) I'm missing.

Best regards,

Andreas Geisreiter
Product Manager DHCOM

DH electronics GmbH | Am Anger 8 | 83346 Bergen | Germany
HRB Traunstein 9602 | Ust Id Nr.: DE174205805
Geschäftsführung | Dipl.-Ing.(FH) Stefan Daxenberger | Dipl.-Ing.(FH) Helmut 
Henschke
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [patch] replace mkimage.c write() calls with full_write()

2014-03-20 Thread Andrew Cann
This patch adds a function to mkimage.c called full_write() which calls write()
in a loop until all the data has been written or write errors.

I was getting an error with mkimage running out of space on the device it was
writing to, but instead of printing a useful error message it was printing:

mkimage: Write error on /tmp/flash.img: Success

Which is kinda confusing. It was printing this because write() was writing as
many bytes as it could and then returning success. It needs to be called a
second time to set errno. Also write(fd, data, count) isn't guranteed to write
the full count bytes in one go anyway, so it needs to be called in a loop (that
or use fwrite instead).


diff --git a/tools/mkimage.c b/tools/mkimage.c
index 123d0c7..bb32ea8 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -29,6 +29,20 @@ struct image_tool_params params = {
 	.imagename2 = "",
 };
 
+static ssize_t full_write(int fd, const void *buf, size_t count) {
+	ssize_t remaining = (ssize_t)count;
+	for(;;) {
+		ssize_t written;
+		written = write(fd, buf, remaining);
+		if(written < 0)
+			return written;
+		remaining -= written;
+		buf += written;
+		if(remaining <= 0)
+			return count - remaining;;
+	};
+};
+
 /*
  * mkimage_register -
  *
@@ -382,8 +396,8 @@ NXTARG:		;
 	else
 		memset(tparams->hdr, 0, tparams->header_size);
 
-	if (write(ifd, tparams->hdr, tparams->header_size)
-	!= tparams->header_size) {
+	int bytes_written = full_write(ifd, tparams->hdr, tparams->header_size);
+	if (bytes_written != tparams->header_size) {
 		fprintf (stderr, "%s: Write error on %s: %s\n",
 			params.cmdname, params.imagefile, strerror(errno));
 		exit (EXIT_FAILURE);
@@ -413,10 +427,12 @@ NXTARG:		;
 	size = 0;
 }
 
-if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) {
+bytes_written = full_write(ifd, (char *)&size, sizeof(size));
+if (bytes_written != sizeof(size)) {
 	fprintf (stderr, "%s: Write error on %s: %s\n",
 		 params.cmdname, params.imagefile,
 		 strerror(errno));
+
 	exit (EXIT_FAILURE);
 }
 
@@ -588,7 +604,8 @@ copy_file (int ifd, const char *datafile, int pad)
 	}
 
 	size = sbuf.st_size - offset;
-	if (write(ifd, ptr + offset, size) != size) {
+	int bytes_written = full_write(ifd, ptr + offset, size);
+	if (bytes_written != size) {
 		fprintf (stderr, "%s: Write error on %s: %s\n",
 			params.cmdname, params.imagefile, strerror(errno));
 		exit (EXIT_FAILURE);
@@ -597,14 +614,16 @@ copy_file (int ifd, const char *datafile, int pad)
 	tail = size % 4;
 	if ((pad == 1) && (tail != 0)) {
 
-		if (write(ifd, (char *)&zero, 4-tail) != 4-tail) {
+		bytes_written = full_write(ifd, (char *)&zero, 4-tail);
+		if (bytes_written != 4-tail) {
 			fprintf (stderr, "%s: Write error on %s: %s\n",
 params.cmdname, params.imagefile,
 strerror(errno));
 			exit (EXIT_FAILURE);
 		}
 	} else if (pad > 1) {
-		if (write(ifd, (char *)&zeros, pad) != pad) {
+		bytes_written = full_write(ifd, (char *)&zeros, pad);
+		if (bytes_written != pad) {
 			fprintf(stderr, "%s: Write error on %s: %s\n",
 params.cmdname, params.imagefile,
 strerror(errno));
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot