Re: [U-Boot] [RFC] spl: Remove overwrite of relocated malloc limit

2017-01-11 Thread Lokesh Vutla


On Thursday 12 January 2017 01:49 AM, Andrew F. Davis wrote:
> spl_init on some boards is called after stack and heap relocation, on
> some platforms spl_relocate_stack_gd is called to handle setting the
> limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple
> SPL malloc is enabled during relocation. spl_init should then not
> re-assign the old pre-relocation limit. Remove this.

This will fail for the case if
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN and CONFIG_SYS_SPL_MALLOC_START is
not defined. i.e. if someone jut use CONFIG_SYS_MALLOC_F for both
board_init_f() and board_init_r().

> 
> Also add some debug statements that can help with find similar
> problems.
> 
> Signed-off-by: Andrew F. Davis 
> ---
> I'm not sure what the real fix should be, probably to clean-up
> all this spaghetti code relating to malloc, but for now without
> this patch we are stuck with the pre-relocation heap size and
> boot with simple malloc is not functional on AM335x-EVM and probably
> many other similar boards.
> 
>  common/malloc_simple.c | 6 +-
>  common/spl/spl.c   | 1 -
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/common/malloc_simple.c b/common/malloc_simple.c
> index 0f6bcbcc71..611400265b 100644
> --- a/common/malloc_simple.c
> +++ b/common/malloc_simple.c
> @@ -39,10 +39,14 @@ void *memalign_simple(size_t align, size_t bytes)
>  
>   addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
>   new_ptr = addr + bytes - gd->malloc_base;
> - if (new_ptr > gd->malloc_limit)
> + if (new_ptr > gd->malloc_limit) {
> + debug("space exhausted\n");
>   return NULL;
> + }
> +
>   ptr = map_sysmem(addr, bytes);
>   gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
> + debug("%lx\n", (ulong)ptr);

This can be a separate patch.

>  
>   return ptr;
>  }
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index a76ea3a603..aa75c93fce 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -237,7 +237,6 @@ int spl_init(void)
>  #ifdef CONFIG_MALLOC_F_ADDR
>   gd->malloc_base = CONFIG_MALLOC_F_ADDR;
>  #endif
> - gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;

IMO this should be guarded with !CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
instead of removing it.

Thanks and regards,
Lokesh

>   gd->malloc_ptr = 0;
>  #endif
>   if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 00/11] rockchip: Add gmac Ethernet support

2017-01-11 Thread Sjoerd Simons
On Wed, 2017-01-11 at 22:08 -0700, Simon Glass wrote:
> Hi,
> 
> On 11 January 2017 at 03:46, Romain Perier  om> wrote:
> > > From Romain:
> > 
> > This is a resent of Simon's v4 series. I have changed what was
> > suggested
> > by David Wu about the driver name (rename gmac_rk3288 to
> > gmac_rockchip).
> > I have also tested the whole series on a rock2 square board,
> > updated the
> > configuration files for rock2 board. I have fixed a build failure
> > caused
> > by recent changes in config_distro_defaults (CMD_PXE is no longer
> > enabled,
> > so I enabled DISTRO_DEFAULTS for Rockchip platforms by default). I
> > have also
> > added few Signed-off-by tags.
> 
> I have tested this on a gigabit link and it does not work. I wonder
> if
> the clocks are wrong?
> 
> However it works fine on 100Mbps which is better than what we have,
> so
> I'm going to apply this. Thank you for your work, Romain.

Funny, my initial patchset only worked on gigabit due to a wrong phy
clock on 100mbit/s. Hopefully should be an easy fix in a follow-up
patch. Thanks for merging!

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


Re: [U-Boot] [ANN] U-Boot v2017.01 is released

2017-01-11 Thread Wolfgang Denk
Dear Tom,

In message <20170109173704.GH7532@bill-the-cat> you wrote:
> 
> I've released v2017.01 and it's now live on git and FTP and ACD (along
> with PGP sig file).

Thanks a lot.  nd here is finally also the release statistics (the
full version can be found as usual in the wiki [1]):

[1] http://www.denx.de/wiki/U-Boot/UbootStat_2017_01


Processed 883 csets from 136 developers
24 employers found
A total of 112574 lines added, 72846 removed (delta 39728)

Developers with the most changesets
York Sun   134 (15.2%)
Simon Glass 73 (8.3%)
Jagan Teki  68 (7.7%)
Michal Simek54 (6.1%)
Vladimir Zapolskiy  24 (2.7%)
Peng Fan23 (2.6%)
Stefan Roese20 (2.3%)
Lokesh Vutla20 (2.3%)
Tom Rini19 (2.2%)
Fabien Parent   19 (2.2%)
...

Developers with the most changed lines
Tom Rini  55400 (31.8%)
Michal Simek  55205 (31.7%)
Simon Glass   9330 (5.4%)
Max Krummenacher  5204 (3.0%)
Jagan Teki5024 (2.9%)
Peng Fan  4721 (2.7%)
Masahiro Yamada   3790 (2.2%)
Lokesh Vutla  3616 (2.1%)
York Sun  3139 (1.8%)
...

Developers with the most lines removed
Tom Rini  54919 (75.4%)
Vladimir Zapolskiy 722 (1.0%)
Nathan Rossi   170 (0.2%)
Stefan Brüns   89 (0.1%)
Stefano Babic   80 (0.1%)
Yegor Yefremov  74 (0.1%)
Cyrille Pitchen 61 (0.1%)
Andrew Duda 54 (0.1%)
Sekhar Nori 52 (0.1%)
Jonathan Gray   43 (0.1%)
...

Developers with the most signoffs (total 156)
Michal Simek35 (22.4%)
Alexander Graf  16 (10.3%)
Stefan Roese15 (9.6%)
Lokesh Vutla14 (9.0%)
Tom Rini 8 (5.1%)
Tom Warren   6 (3.8%)
Hongbo Zhang 6 (3.8%)
Prabhakar Kushwaha   5 (3.2%)
Hans de Goede4 (2.6%)
Nishanth Menon   4 (2.6%)
...

Developers with the most reviews (total 393)
Tom Rini   120 (30.5%)
Simon Glass109 (27.7%)
York Sun45 (11.5%)
Jagan Teki  43 (10.9%)
Fabio Estevam   10 (2.5%)
Hans de Goede8 (2.0%)
Bin Meng 8 (2.0%)
Marek Vasut  8 (2.0%)
Stefan Roese 7 (1.8%)
Siva Durga Prasad Paladugu7 (1.8%)
...

Developers with the most test credits (total 34)
Bin Meng11 (32.4%)
Jagan Teki  10 (29.4%)
George McCollister   4 (11.8%)
Hyun Kwon2 (5.9%)
Simon Glass  1 (2.9%)
Paul Burton  1 (2.9%)
Sekhar Nori  1 (2.9%)
Carlos Hernandez 1 (2.9%)
Ravi Babu1 (2.9%)
Dinh Nguyen  1 (2.9%)
Kever Yang   1 (2.9%)

Developers who gave the most tested-by credits (total 34)
Simon Glass 11 (32.4%)
Jagan Teki  10 (29.4%)
Sven Ebenfeld4 (11.8%)
Marek Vasut  1 (2.9%)
Andrew F. Davis  1 (2.9%)
Mugunthan V N1 (2.9%)
Michal Simek 1 (2.9%)
Anurag Kumar Vulisha 1 (2.9%)
Stefan Brüns1 (2.9%)
Yann E. MORIN1 (2.9%)
...

Developers with the most report credits (total 8)
Phani Kiran Kara 2 (25.0%)
Sai Pavan Boddu  2 (25.0%)
Sekhar Nori  1 (12.5%)
Kever Yang   1 (12.5%)
Vignesh R1 (12.5%)
Yan Liu  1 (12.5%)

Developers who gave the most report credits (total 8)
Michal Simek 2 (25.0%)
Kedareswara rao Appana   2 (25.0%)
Jagan Teki   1 (12.5%)
Mugunthan V N1 (12.5%)
Stefan Brüns1 (12.5%)
Jean-Jacques Hiblot  1 (12.5%)

Top changeset contributors by employer
NXP211 (23.9%)
(Unknown)  185 (21.0%)
Texas Instruments   76 (8.6%)
Xilinx  76 (8.6%)
Google, Inc.73 (8.3%)
Amarula Solutions   42 (4.8%)
DENX Software Engineering   36 (4.1%)
Novell  30 (3.4%)
Toradex 27 (3.1%)
Openedev26 (2.9%)
...

Top lines changed by employer
Xilinx56608 (32.5%)
Konsulko Group55400 (31.8%)
(Unknown) 16370 (9.4%)
NXP   11416 (6.6%)
Google, Inc.  9330 (5.4%)
Texas Instruments 5935 (3.4%)
Amarula Solutions 3848 (2.2%)
Socionext Inc.3790 (2.2%)
DENX Software Engineering 2892 (1.7%)
Marvell   2597 (1.5%)
...

Employers with the most signoffs (total 156)
Xilinx  39 (25.0%)
NXP   

Re: [U-Boot] [GIT PULL] Xilinx changes

2017-01-11 Thread Michal Simek
On 12.1.2017 08:13, Masahiro Yamada wrote:
> 2017-01-12 15:42 GMT+09:00 Michal Simek :
>> On 11.1.2017 17:28, Tom Rini wrote:
>>> On Wed, Jan 11, 2017 at 09:59:29AM +0100, Michal Simek wrote:
>>>
 Hi Tom,

 here are changes I have collected. Travis is not reporting any issue.
 I have also started to use signed tags to be clear what to take.
>>>
>>> Ah, signed tags.  How much more work is that on your end?
>>
>> Almost nothing just git tag -s and write some stuff. arm-soc starts to
>> use that long time ago that's why when you setup it once there is not an
>> issue. Maybe good time to consider to move to the same model.
>>
> 
> Interesting.
> 
> Maybe, will we have a key signing party in the next U-Boot mini summit?
> The GPG certificate can be checked only when we have the chain of trust.

Tom probably has my key already from past. Definitely u-boot mini summit
is a good opportunity for this.

> 
> More more difference for pulling a tag commit is that
> git always creates a merge commit
> even if the pull-request is sitting on the top of the upstream tree.

It is up to Tom what flow he wants to use and how that merge commits
will look like.

Thanks,
Michal

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


Re: [U-Boot] [GIT PULL] Xilinx changes

2017-01-11 Thread Masahiro Yamada
2017-01-12 15:42 GMT+09:00 Michal Simek :
> On 11.1.2017 17:28, Tom Rini wrote:
>> On Wed, Jan 11, 2017 at 09:59:29AM +0100, Michal Simek wrote:
>>
>>> Hi Tom,
>>>
>>> here are changes I have collected. Travis is not reporting any issue.
>>> I have also started to use signed tags to be clear what to take.
>>
>> Ah, signed tags.  How much more work is that on your end?
>
> Almost nothing just git tag -s and write some stuff. arm-soc starts to
> use that long time ago that's why when you setup it once there is not an
> issue. Maybe good time to consider to move to the same model.
>

Interesting.

Maybe, will we have a key signing party in the next U-Boot mini summit?
The GPG certificate can be checked only when we have the chain of trust.

More more difference for pulling a tag commit is that
git always creates a merge commit
even if the pull-request is sitting on the top of the upstream tree.


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


Re: [U-Boot] [GIT PULL] Xilinx changes

2017-01-11 Thread Michal Simek
On 11.1.2017 17:28, Tom Rini wrote:
> On Wed, Jan 11, 2017 at 09:59:29AM +0100, Michal Simek wrote:
> 
>> Hi Tom,
>>
>> here are changes I have collected. Travis is not reporting any issue.
>> I have also started to use signed tags to be clear what to take.
> 
> Ah, signed tags.  How much more work is that on your end?

Almost nothing just git tag -s and write some stuff. arm-soc starts to
use that long time ago that's why when you setup it once there is not an
issue. Maybe good time to consider to move to the same model.

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


[U-Boot] [PATCH v2] board/t1024rdb: enable board-level reset when issuing reset command

2017-01-11 Thread Shengzhou Liu
As board-specific reset logic, it needs to issue reset signal
via CPLD when issuing 'reset' command in u-boot, this patch
solves the issue of reset command not working on T1024RDB.

Signed-off-by: Shengzhou Liu 
---
v2: add build condition.

 board/freescale/t102xrdb/t102xrdb.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/board/freescale/t102xrdb/t102xrdb.c 
b/board/freescale/t102xrdb/t102xrdb.c
index 01dbf38..0f453a7 100644
--- a/board/freescale/t102xrdb/t102xrdb.c
+++ b/board/freescale/t102xrdb/t102xrdb.c
@@ -167,6 +167,13 @@ unsigned long get_board_ddr_clk(void)
return CONFIG_DDR_CLK_FREQ;
 }
 
+#ifdef CONFIG_T1024RDB
+void board_reset(void)
+{
+   CPLD_WRITE(reset_ctl1, CPLD_LBMAP_RESET);
+}
+#endif
+
 int misc_init_r(void)
 {
return 0;
-- 
2.1.0.27.g96db324

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


Re: [U-Boot] [PATCH] arm: samsung: goni: use the driver model for max8998

2017-01-11 Thread Jaehoon Chung
Hi Simon,

On 01/12/2017 02:07 PM, Simon Glass wrote:
> Hi Jaehoon,
> 
> On 27 December 2016 at 15:35, Jaehoon Chung  wrote:
>> Hi,
>>
>> On 12/27/2016 11:31 PM, Minkyu Kang wrote:
>>> Hi,
>>>
>>> On 27 December 2016 at 17:33, Jaehoon Chung  wrote:
>>>
 Remove the "ifndef CONFIG_DM_I2C".
 Instead, use the driver model for max8998.

 Signed-off-by: Jaehoon Chung 
 ---
  board/samsung/goni/goni.c | 61 --
 -
  1 file changed, 31 insertions(+), 30 deletions(-)
> 
> This looks good to me. A further step would be to add a regulator
> driver, rather than poking the pmic registers directly. But that could
> come later.

Yes, I will add a regulator driver for Samsung boards.
Before going next step, i'm doing to convert the driver model(I2C, PMIC) for 
all Samsung SoC.

There are some boards what don't use DM. goni/universal_c210/trat..
I have already completed the converting DM for those boards, and next step will 
be the using regulator driver.
(I will send the patches..it needs to apply the previous patches...)

My plan is 

1. Convert DM_PMIC and DM_I2C.
2. Use the regulator driver.
3. Remove the unnecessary legacy drivers

After that, i will consider for UCLASS_CHARGER and UCLASS_MUIC.
(As i checked, it leaves a matter in future work, right?)

Best Regards,
Jaehoon Chung

> 
> Regards,
> Simon
> 
> 
> 

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


Re: [U-Boot] [PATCH v7 08/11] Enable DISTRO_DEFAULTS for Rockchip platforms

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> This enables suitable commands needed for booting general purpose
> Linux distribution. This is required for example if we want to use PXE
> or DHCP as default boot targets, symbols no longer enabled by
> config_distro_defaults.h .
>
> Signed-off-by: Romain Perier 
> ---
>
> Changes in v7:
> - Added this commit to fix build failure introduced by commit 09/11
>
>  Kconfig | 1 +
>  1 file changed, 1 insertion(+)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 10/11] rockchip: Enable ETH address randomization for the rock2

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> This commit enables ethernet MAC address randomization on the rock2. It
> removes the error at startup 'ethernet@ff29 address not set'.
>
> Signed-off-by: Romain Perier 
> ---
>
> Changes in v7:
> - Added this commit to the series
>
>  configs/rock2_defconfig | 1 +
>  1 file changed, 1 insertion(+)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 11/11] rockchip: Drop Ethernet from the TODO

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Sjoerd Simons 
>
> Now that ethernet support works, it can be dropped from the rockchip
> TODO
>
> Signed-off-by: Sjoerd Simons 
> Acked-by: Simon Glass 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3:
> - Add a few new patches
> - Drop the 'net: designware: Add a fix_mac_speed hook' patch
>
>  doc/README.rockchip | 1 -
>  1 file changed, 1 deletion(-)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 09/11] rockchip: Add PXE and DHCP to the default boot targets

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Sjoerd Simons 
>
> Now that at least on the firefly board we have network support, enable
> PXE and DHCP boot targets by default.
>
> Signed-off-by: Sjoerd Simons 
> Acked-by: Simon Glass 
> Acked-by: Joe Hershberger 
> ---
>
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  include/configs/rockchip-common.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 02/11] net: designware: Adjust dw_adjust_link() to return an error

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Simon Glass 
>
> This function can fail, so return the error if there is one.
>
> Signed-off-by: Simon Glass 
> Signed-off-by: Romain Perier 
> Acked-by: Joe Hershberger 
> ---
>
> Changes in v7: None
> Changes in v6:
> - Changed Acked-by to Signed-off-by for Romain
> Changes in v5:
> - Add Acked-by for Romain
> Changes in v4: None
> Changes in v3:
> - Add new patch to adjust dw_adjust_link() to return an error
>
> Changes in v2: None
>
>  drivers/net/designware.c | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 05/11] net: gmac_rockchip: Add Rockchip GMAC driver

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Sjoerd Simons 
>
> Add a new driver for the GMAC ethernet interface present in Rockchip
> RK3288 SOCs. This driver subclasses the generic design-ware driver to
> add the glue needed specifically for Rockchip.
>
> Signed-off-by: Sjoerd Simons 
> Signed-off-by: Simon Glass 
> Signed-off-by: Romain Perier 
> Acked-by: Joe Hershberger 
> ---
>
> Changes in v7: None
> Changes in v6:
> - Changed Acked-by to Signed-off-by for Romain
> Changes in v5:
> - Rename the driver to gmac_rockchip as suggested by David Wu
> - Rewrote commit message (gmac_rk3288 -> gmac_rockchip)
> - Added Acked-by for Romain
>
> Changes in v4: None
> Changes in v3:
> - Add comments for struct gmac_rk3288_platdata
> - Adjust binding to use r/tx-delay instead of r/tx_delay
> - Sort includes
> - Use debug() instead of printf() for error
> - Use function calls instead of fix_mac_speed() hook
> - Use new clk interface
>
>  drivers/net/Kconfig |   7 ++
>  drivers/net/Makefile|   1 +
>  drivers/net/gmac_rockchip.c | 154 
> 
>  3 files changed, 162 insertions(+)
>  create mode 100644 drivers/net/gmac_rockchip.c

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 07/11] rockchip: evb-rk3339: Enable DHCP

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Simon Glass 
>
> This is the only RK3399 device without DHCP. Enable it so that we
> can use a common BOOT_TARGET_DEVICES setting. It is likely useful to be
> able to use USB networking, at least. Full networking can be enabled when
> a suitable platform needs it.
>
> Signed-off-by: Simon Glass 
> ---
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4:
> - Fix commit message to say 'rk3399'
>
> Changes in v3:
> - Add new patch to enable networking on evb-rk3399
>
> Changes in v2: None
>
>  configs/evb-rk3399_defconfig | 3 +++
>  1 file changed, 3 insertions(+)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 06/11] rockchip: Enable networking support on rock2 and firefly

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Sjoerd Simons 
>
> Enable the various configuration option required to get the ethernet
> interface up and running on Radxa Rock2 and Firefly.
>
> Signed-off-by: Sjoerd Simons 
> Signed-off-by: Romain Perier 
> Reviewed-by: Simon Glass 
> Acked-by: Joe Hershberger 
> ---
>
> Changes in v7: None
> Changes in v6:
> - Changed Acked-by to Signed-off-by for Romain
> Changes in v5:
> - Added Acked-by for Romain
> - Replaced CONFIG_GMAC_RK3288 by CONFIG_GMAC_ROCKCHIP
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  configs/firefly-rk3288_defconfig | 4 
>  configs/rock2_defconfig  | 4 
>  2 files changed, 8 insertions(+)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 03/11] net: designware: Split the link init into a separate function

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Simon Glass 
>
> With rockchip we need to make adjustments after the link speed is set but
> before enabling received/transmit. In preparation for this, split these
> two pieces into separate functions.
>
> Signed-off-by: Simon Glass 
> Signed-off-by: Romain Perier 
> Acked-by: Joe Hershberger 
> ---
>
> Changes in v7: None
> Changes in v6:
> - Changed Acked-by to Signed-off-by for Romain
> Changes in v5:
> - Added Acked-by for Romain
> Changes in v4: None
> Changes in v3:
> - Add new patch to split the link init into a separate function
>
> Changes in v2: None
>
>  drivers/net/designware.c | 26 --
>  1 file changed, 24 insertions(+), 2 deletions(-)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 01/11] net: designware: Export various functions/struct to allow subclassing

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Sjoerd Simons 
>
> To allow other DM drivers to subclass the designware driver various
> functions and structures need to be exported. Export these.
>
> Signed-off-by: Sjoerd Simons 
> Signed-off-by: Romain Perier 
> Reviewed-by: Bin Meng 
> Acked-by: Simon Glass 
> Acked-by: Joe Hershberger 
> ---
>
> Changes in v7: NONE
>
> Changes in v6:
> - Acked-by -> Signed-off-by for Romain
>
> Changes in v5:
> - Added Acked-by for Romain
>
>  drivers/net/designware.c | 6 +++---
>  drivers/net/designware.h | 4 
>  2 files changed, 7 insertions(+), 3 deletions(-)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 04/11] net: designware: Export the operation functions

2017-01-11 Thread Simon Glass
On 11 January 2017 at 03:46, Romain Perier  wrote:
> From: Simon Glass 
>
> Export all functions so that drivers can use them, or not, as the need
> arises.
>
> Signed-off-by: Simon Glass 
> Signed-off-by: Romain Perier 
> Acked-by: Joe Hershberger 
> ---
>
> Changes in v7: None
> Changes in v6:
> - Changed Acked-by to Signed-off-by for Romain
> Changes in v5:
> - Add Acked-by for Romain
> Changes in v4: None
> Changes in v3:
> - Add new patch to export the operation functions
>
> Changes in v2: None
>
>  drivers/net/designware.c | 19 +--
>  drivers/net/designware.h |  9 +
>  2 files changed, 18 insertions(+), 10 deletions(-)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 00/11] rockchip: Add gmac Ethernet support

2017-01-11 Thread Simon Glass
Hi,

On 11 January 2017 at 03:46, Romain Perier  wrote:
> >From Romain:
> This is a resent of Simon's v4 series. I have changed what was suggested
> by David Wu about the driver name (rename gmac_rk3288 to gmac_rockchip).
> I have also tested the whole series on a rock2 square board, updated the
> configuration files for rock2 board. I have fixed a build failure caused
> by recent changes in config_distro_defaults (CMD_PXE is no longer enabled,
> so I enabled DISTRO_DEFAULTS for Rockchip platforms by default). I have also
> added few Signed-off-by tags.
>
> >From Simon:
> This v3 patch is an update on Sjoerd's original v2 series from Feburary.
> I have dealt with the changes requested at the time, and adjusted the way
> that the speed change is handled.
>
> Tested on firefly-rk3288, rock2.
>
> Original cover letter:
> To add support I've taken a slightly different approach then some of the
> other boards with a designware IP block, by creating a new driver to
> take care of the platfrom glue which subclasses the main designware driver
> instead of adding the compatibility string the designware driver
> directly and doing the SoC specific setup in the board files. This seems
> quite a bit more elegant in a device model based world.
>
> I've only tested this series on a Radxa Rock 2 board, it would be great
> if someone could test this on other boards with the designware IP
> especially for those with the reset GPIO in devicetree (e.g. some of the
> Allwinner boards).
>
> Compared to the first one round the pinctrl related bits were dropped as
> RK3288 now has a full pinctrl driver. Furthermore the started hook in the
> designware driver was renamed to fix_mac_speed in line with what linux
> uses and moved to the dw_link_adjust function.
>
> Changes in v7:
> - Fixed build failure caused by recent changes in config_distro_defaults.h
>   (CMD_PXE is no longer enabled so BOOTENV_DEV_PXE is expanded to
>   BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE). The
>   fix itself consists in enabling DISTRO_DEFAULTS by default for Rockchip
>   platforms.
> - Added a new commit for enabling ETH address randomization on the rock2,
>   otherwise we cannot use ethernet interface and we get an error at
>   bootup.
>
> Changes in v6:
> - Changed Acked-by to Signed-off-by for Romain in commits from
>   [PATCH 01/09] to [PATCH 06/09]
>
> Changes in v5:
> - Changed the name of the driver gmac_rk3288 to gmac_rockchip, as
>   suggested by David Wu. Also I rewrote the commit message
> - Added my Acked-by to commits from [PATCH 01/09] to [PATCH 06/09]
> - Updated configuration files for rock2 and firefly with the new
>   Kconfig symbol
>
> Changes in v4:
> - Fix commit message to say 'rk3399'
>
> Changes in v3:
> - Add a few new patches
> - Add comments for struct gmac_rk3288_platdata
> - Add new patch to adjust dw_adjust_link() to return an error
> - Add new patch to enable networking on evb-rk3399
> - Add new patch to export the operation functions
> - Add new patch to split the link init into a separate function
> - Adjust binding to use r/tx-delay instead of r/tx_delay
> - Drop the 'net: designware: Add a fix_mac_speed hook' patch
> - Sort includes
> - Use debug() instead of printf() for error
> - Use function calls instead of fix_mac_speed() hook
> - Use new clk interface
>
> Changes in v2:
> - Adjust to new hook name
> - Fix various coding style nits
>
> Romain Perier (2):
>   Enable DISTRO_DEFAULTS for Rockchip platforms
>   rockchip: Enable ETH address randomization for the rock2
>
> Simon Glass (4):
>   net: designware: Adjust dw_adjust_link() to return an error
>   net: designware: Split the link init into a separate function
>   net: designware: Export the operation functions
>   rockchip: evb-rk3339: Enable DHCP
>
> Sjoerd Simons (5):
>   net: designware: Export various functions/struct to allow subclassing
>   net: gmac_rockchip: Add Rockchip GMAC driver
>   rockchip: Enable networking support on rock2 and firefly
>   rockchip: Add PXE and DHCP to the default boot targets
>   rockchip: Drop Ethernet from the TODO
>
>  Kconfig   |   1 +
>  configs/evb-rk3399_defconfig  |   3 +
>  configs/firefly-rk3288_defconfig  |   4 +
>  configs/rock2_defconfig   |   5 ++
>  doc/README.rockchip   |   1 -
>  drivers/net/Kconfig   |   7 ++
>  drivers/net/Makefile  |   1 +
>  drivers/net/designware.c  |  57 ++
>  drivers/net/designware.h  |  13 
>  drivers/net/gmac_rockchip.c   | 154 
> ++
>  include/configs/rockchip-common.h |   4 +-
>  11 files changed, 232 insertions(+), 18 deletions(-)
>  create mode 100644 drivers/net/gmac_rockchip.c
>
> --
> 2.9.3
>

I have tested this on a gigabit link and it does not work. I wonder if
the clocks are wrong?

However it works fine on 100Mbps which is better than what we have, so
I'm going to apply this. 

Re: [U-Boot] [PATCH v4] rockchip: rk3288: set isp/vop qos priority level

2017-01-11 Thread Simon Glass
On 28 December 2016 at 19:47, Nickey Yang  wrote:
> Isp-camera preview image will be broken when dual screen display mode.
> This patch set isp/vop qos level higher to solve this problem.
> We have verified this patch on rk3288-miniarm board.
>
> Signed-off-by: Nickey Yang 
> ---
>  arch/arm/include/asm/arch-rockchip/qos_rk3288.h | 20 
>  arch/arm/mach-rockchip/rk3288-board.c   | 20 
>  2 files changed, 40 insertions(+)
>  create mode 100644 arch/arm/include/asm/arch-rockchip/qos_rk3288.h

Applied to u-boot-rockchip, thanks!

(please do include a change log in future)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] rockchip: video: fix mpixelclock in rockchip HDMI

2017-01-11 Thread Simon Glass
On 28 December 2016 at 23:01, Nickey Yang  wrote:
> Correct mpixelclock errors in rockchip_phy_config[] and rockchip_mpll_cfg[].
>
> Signed-off-by: Nickey Yang 
> ---
>  drivers/video/rockchip/rk_hdmi.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v3 1/2] mmc: rockchip_sdhci: add clock init for mmc

2017-01-11 Thread Simon Glass
Hi,

On 27 December 2016 at 20:32, Kever Yang  wrote:
> Init the clock rate to max-frequency from dts with clock driver api.
>
> Signed-off-by: Kever Yang 
> ---
>
> Changes in v3:
> - using dt for max-frequency
> Series-changes: 2
> - using the return value
>
>  drivers/mmc/rockchip_sdhci.c | 19 +--
>  1 file changed, 17 insertions(+), 2 deletions(-)

I know there is ongoing discussion here. But this has been in my queue
for a while so I'd like to apply this and deal with tiny-ups with
follow-on patches.

Applied to u-boot-rockchip, thanks!

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


Re: [U-Boot] [RESEND PATCH v3 2/2] dts: arm64: rk3399: add max-frequency for sdhci

2017-01-11 Thread Simon Glass
On 28 December 2016 at 04:01, Jaehoon Chung  wrote:
> On 12/28/2016 12:32 PM, Kever Yang wrote:
>> Add 'max-frequency' for sdhci node for clock init.
>>
>> Signed-off-by: Kever Yang 
>
> Reviewed-by: Jaehoon Chung 

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 12/18] pinctrl: Add i.MX7ULP pinctrl driver

2017-01-11 Thread Simon Glass
On 26 December 2016 at 00:00, Peng Fan  wrote:
> Add i.MX7ULP pinctrl driver.
> Select CONFIG_PINCTRL_IMX7ULP to use this driver.
>
> Signed-off-by: Peng Fan 
> Cc: Simon Glass 
> Cc: Stefano Babic 
> ---
>  drivers/pinctrl/nxp/Kconfig   | 14 
>  drivers/pinctrl/nxp/Makefile  |  1 +
>  drivers/pinctrl/nxp/pinctrl-imx.c | 10 +
>  drivers/pinctrl/nxp/pinctrl-imx.h |  3 +++
>  drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 41 
> +++
>  5 files changed, 65 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/pinctrl/nxp/pinctrl-imx7ulp.c

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


Re: [U-Boot] [PATCH] rockchip: Fix veyron-minnie's Kconfig description

2017-01-11 Thread Simon Glass
On 20 December 2016 at 01:19, Simon Glass  wrote:
> On 17 December 2016 at 18:40, Martin Michlmayr  wrote:
>> The veyron-minnie Kconfig referred to jerry by mistake.
>>
>> Signed-off-by: Martin Michlmayr 
>> ---
>>  arch/arm/mach-rockchip/rk3288/Kconfig | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-rockchip, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] spl: don't use %#l with CONFIG_USE_TINY_PRINTF

2017-01-11 Thread Simon Glass
On 28 December 2016 at 01:12, Oded Gabbay  wrote:
> In the tiny-printf implementation, there is no support for %# and/or %l. This
> patch checks if CONFIG_USE_TINY_PRINTF is defined and if so, prints a
> different debug statement which doesn't use %#l
>
> Signed-off-by: Oded Gabbay 
> Cc: Simon Glass 
> ---
>  common/spl/spl.c | 5 +
>  1 file changed, 5 insertions(+)

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


Re: [U-Boot] [PATCH] arm64: rk3399: update rockchip_get_cru API

2017-01-11 Thread Simon Glass
On 28 December 2016 at 02:48, Kever Yang  wrote:
> rk3399 has two clock-controller: cru and pmucru, update the
> rockchip_get_crui() API, and rockchip_get_clk() do not used for
> other module.
>
> Signed-off-by: Kever Yang 
> ---
>
>  arch/arm/mach-rockchip/rk3399/clk_rk3399.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

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


Re: [U-Boot] [PATCH] armv8: release slave cores from CPU_RELEASE_ADDR

2017-01-11 Thread Simon Glass
+Tom

On 28 December 2016 at 04:38, Oded Gabbay  wrote:
> When using ARMv8 with ARMV8_SPIN_TABLE=y, we want the slave cores to
> wait on spin_table_cpu_release_addr, until the Linux kernel will "wake" them
> by writing to that location. The address of spin_table_cpu_release_addr is
> transferred to the kernel using the device tree that is updated by
> spin_table_update_dt().
>
> However, if we also use SPL, then the slave cores are stuck at
> CPU_RELEASE_ADDR instead and as a result, never wake up.
>
> This patch releases the slave cores by writing spl_image->entry_point to
> CPU_RELEASE_ADDR location before the end of the SPL code
> (at jump_to_image_no_args()).
>
> That way, the slave cores will start to execute the u-boot and will get to
> the spin-table code and wait on the correct address
> (spin_table_cpu_release_addr).
>
> Signed-off-by: Oded Gabbay 
> Cc: Simon Glass 
> ---
>  common/spl/spl.c | 8 
>  1 file changed, 8 insertions(+)

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


Re: [U-Boot] [U-Boot,v6,11/13] sunxi: Use binman for sunxi boards

2017-01-11 Thread Simon Glass
Hi Emmanuel,

On 28 December 2016 at 03:57, Emmanuel Vadot  wrote:
> On Wed, 28 Dec 2016 11:30:10 +0100
> Emmanuel Vadot  wrote:
>
>>
>>  Hello Simon,
>>
>> On Fri, 23 Dec 2016 01:39:06 -0700
>> Simon Glass  wrote:
>>
>> > On 18 December 2016 at 19:48, Tom Rini  wrote:
>> > > On Fri, Nov 25, 2016 at 08:16:01PM -0700, Simon Glass wrote:
>> > >
>> > >> Move sunxi boards to use binman. This involves adding the image 
>> > >> definition
>> > >> to the device tree and using it in the Makefile.
>> > >>
>> > >> Signed-off-by: Simon Glass 
>> > >
>> > > Reviewed-by: Tom Rini 
>> > >
>> > > --
>> > > Tom
>> >
>> > Applied to u-boot-dm and now in mainline.
>>
>>  Shouldn't all the config for sunxi board defines
>> CONFIG_SPL_OF_PLATDATA=y now so libfdt.so will be built ?
>>
>
>  Sorry, I meant the python module.

Well for now an easier solution is to build sandbox_spl once. My plan
is to upstream the Python bindings to libfdt, but it's slow going.
There should be no major consequence to not having the module. It is
just fractionally slower.

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


Re: [U-Boot] [PATCH] spl: don't use %.*s with CONFIG_USE_TINY_PRINTF

2017-01-11 Thread Simon Glass
On 28 December 2016 at 00:36, Oded Gabbay  wrote:
> In the tiny-printf implementation, there is no support for %.*s. This patch
> checks if CONFIG_USE_TINY_PRINTF is defined and if so, prints a different
> debug statement which doesn't use %.*s
>
> Signed-off-by: Oded Gabbay 
> Cc: Simon Glass 
> ---
>  common/spl/spl.c | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass 

I did consider whether we should have some #defines for this (one
which expands to either "*" or "" and one which drops the (int)
parameter when USE_TINY_PRINTF is enabled), but it might be a bit
clumsy.

I think what you have is the simplest solution for now.

>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index f7df834..7c4744d 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -115,9 +115,14 @@ int spl_parse_image_header(struct spl_image_info 
> *spl_image,
> }
> spl_image->os = image_get_os(header);
> spl_image->name = image_get_name(header);
> +#ifdef CONFIG_USE_TINY_PRINTF
> +   debug("spl: payload image: %s load addr: 0x%x size: %d\n",
> +   spl_image->name, spl_image->load_addr, 
> spl_image->size);
> +#else
> debug("spl: payload image: %.*s load addr: 0x%x size: %d\n",
> (int)sizeof(spl_image->name), spl_image->name,
> spl_image->load_addr, spl_image->size);
> +#endif
> } else {
>  #ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE
> /*
> --
> 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: samsung: goni: use the driver model for max8998

2017-01-11 Thread Simon Glass
Hi Jaehoon,

On 27 December 2016 at 15:35, Jaehoon Chung  wrote:
> Hi,
>
> On 12/27/2016 11:31 PM, Minkyu Kang wrote:
>> Hi,
>>
>> On 27 December 2016 at 17:33, Jaehoon Chung  wrote:
>>
>>> Remove the "ifndef CONFIG_DM_I2C".
>>> Instead, use the driver model for max8998.
>>>
>>> Signed-off-by: Jaehoon Chung 
>>> ---
>>>  board/samsung/goni/goni.c | 61 --
>>> -
>>>  1 file changed, 31 insertions(+), 30 deletions(-)

This looks good to me. A further step would be to add a regulator
driver, rather than poking the pmic registers directly. But that could
come later.

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


Re: [U-Boot] [PATCH v2 4/5] time: import time_after, time_before and friends from Linux

2017-01-11 Thread Simon Glass
On 27 December 2016 at 08:36, Masahiro Yamada
 wrote:
> It is not safe to compare timer values directly.
>
> On 32-bit systems, for example, timer_get_us() wraps around every
> 72 min. (2 ^ 32 / 100 =~ 4295 sec =~ 72 min).  Depending on
> the get_ticks() implementation, it may wrap more frequently.
> The 72 min might be possible on the use of U-Boot.
>
> Let's borrow time_after, time_before, and friends to solve the
> wrap-around problem.
>
> These macros were copied from include/linux/jiffies.h of Linux 4.9.
>
> Signed-off-by: Masahiro Yamada 
> ---
>
> Changes in v2: None
>
>  include/time.h | 41 +
>  1 file changed, 41 insertions(+)

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


Re: [U-Boot] [PATCH V2 12/20] pinctrl: Add i.MX7ULP pinctrl driver

2017-01-11 Thread Simon Glass
On 27 December 2016 at 03:04, Peng Fan  wrote:
> Add i.MX7ULP pinctrl driver.
> Select CONFIG_PINCTRL_IMX7ULP to use this driver.
>
> Signed-off-by: Peng Fan 
> Cc: Simon Glass 
> Cc: Stefano Babic 
> ---
>
> V2:
>  None
>
>  drivers/pinctrl/nxp/Kconfig   | 14 
>  drivers/pinctrl/nxp/Makefile  |  1 +
>  drivers/pinctrl/nxp/pinctrl-imx.c | 10 +
>  drivers/pinctrl/nxp/pinctrl-imx.h |  3 +++
>  drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 41 
> +++
>  5 files changed, 65 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/pinctrl/nxp/pinctrl-imx7ulp.c

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


Re: [U-Boot] [PATCH] cmd: sata: fix init command return value

2017-01-11 Thread Simon Glass
On 11 January 2017 at 08:51, Gary Bisson
 wrote:
>
> Since commit aa6ab905b2, sata_initialize returns -1 if init_sata or
> scan_sata fails. But this return value becomes the do_sata return
> value which is equivalent to CMD_RET_USAGE.
>
> In case one issues 'sata init' and that the hardware fails to
> initialize, there's no need to display the command usage. Instead
> the command shoud just return the CMD_RET_FAILURE value.
>
> Fixes: aa6ab905b2 (sata: fix sata command can not being executed bug)
>
> Signed-off-by: Gary Bisson 
> ---
>  cmd/sata.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)


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


Re: [U-Boot] Accessing nested device tree nodes via phandle

2017-01-11 Thread Simon Glass
Hi Vlad,

On 20 December 2016 at 08:53, Vlad Zakharov
 wrote:
> Hi everybody,
>
> I am working on reorganization of device trees for ARC boards in U-Boot in 
> order to create a common device tree blob for
> both Linux and U-Boot.
>
> And I've struggled with a kind of problem and need some help.
>
> On AXS10x motherboard clocks for various peripherals are managed by one 
> hardware block, so clock nodes in Linux device
> tree are grouped into one "clocks" node like this:
> -->8
> clocks {
> i2cclk: i2cclk {
> compatible = "fixed-clock";
> clock-frequency = <5000>;
> #clock-cells = <0>;
> };
>  ...
>  ...
>  ...
> uartclk: uartclk {
> compatible = "fixed-clock";
> clock-frequency = <>;
> #clock-cells = <0>;
> };
> };
> -->8
> And then some of them a referenced via phandle from other nodes, e.g. 
>  is referenced from uart node.
>
> When I try to create such hierarchy in U-Boot I find that uart driver is not 
> able to get clock via phandle and
> corresponding uart doesn't work.
>
> As I understand that is because children clocks nodes, i.e. "uartclk" in my 
> case, never got bound as it's parent node
> "clocks" never got bound too.
> So when I add "compatible" and "u-boot,dm-pre-reloc" properties to "clocks" 
> parent node everything works fine, e.g.:
> -->8
> clocks {
> compatible = "simple-bus";
> u-boot,dm-pre-reloc;
> uartclk: uartclk {
> compatible = "fixed-clock";
>
>clock-frequency = <>;
> #clock-cells = <0>;
> };
>  ...
>  ...
>  ...
> };
> -->8
>
> Please correct me if I wrongly interpret such behavior.
>
> I wonder if it the only approach to implement Linux-like hierarchy for ARC? 
> Or I am mistaken and in fact can use pure
> Linux device tree without adding properties, described above?

Yes you have it right. I'm not sure what linux is doing here - does it
look for a node called 'clocks'? To my mind, U-Boot is the more
correct.

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


Re: [U-Boot] [PATCH v2] api: Use hashtable function for API_env_enum

2017-01-11 Thread Simon Glass
On 26 December 2016 at 10:57, Emmanuel Vadot  wrote:
> The current code can loop undefinitly as it doesn't parse
> correctly the env data.
> Since the env is an hashtable, use the hashtable function for
> the API_ENV_ENUM api call.
>
> Signed-off-by: Emmanuel Vadot 
> ---
> Changes in v2:
>  * Explain why the change is needed.
>
>  api/api.c | 60 +++-
>  1 file changed, 31 insertions(+), 29 deletions(-)

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


Re: [U-Boot] [PATCH] serial, ns16550: bugfix: ns16550 fifo not enabled

2017-01-11 Thread Heiko Schocher

Hi Marek,

Am 11.01.2017 um 16:11 schrieb Marek Vasut:

On 01/10/2017 05:40 PM, Tom Rini wrote:

On Tue, Jan 10, 2017 at 08:08:51AM +0100, Heiko Schocher wrote:

commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor"
breaks u-boot commandline working with long commands
sending to the board.

Since the above patch, you have to setup the fcr register.

For board/archs which enable OF_PLATDATA, the new field
fcr in struct ns16550_platdata is not filled with a
default value ...

This leads in not setting up the uarts fifo, which ends
in problems, when you send long commands to u-boots
commandline.

Detected this issue with automated tbot tests on am335x
based shc board.

The error does not popup, if you type commands. You need
to copy a long command to u-boots commandshell
(or send a long command with tbot)

Possible boards/plattforms with problems:
./arch/arm/cpu/arm926ejs/lpc32xx/devices.c
./arch/arm/mach-tegra/board.c
./board/isee/igep00x0/igep00x0.c
./board/overo/overo.c
./board/quipos/cairo/cairo.c
./board/logicpd/omap3som/omap3logic.c
./board/logicpd/zoom1/zoom1.c
./board/timll/devkit8000/devkit8000.c
./board/lg/sniper/sniper.c
./board/ti/beagle/beagle.c
./drivers/serial/serial_rockchip.c

This patch fixes only:
./arch/arm/mach-omap2/am33xx/board.c

Signed-off-by: Heiko Schocher 


Good find!  I didn't catch this in my setups as nothing in test.py is
currently long enough to trigger this apparently (I have both an am335x
evm and a beagleboard in my setup).  By inspection, the right fix for
all platforms would be to put the old default value in as this is what
was missed in the original patch from Marek.


It was probably missed because this patch pre-dates the OF_PLATDATA
addition and was stuck in the ML for too long.


No problem, I prepare a fix. But it shows how important would be,
that we have as much as possible boards in a real life test setup...
(and of course, as much as possible testcases)

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] serial, ns16550: bugfix: ns16550 fifo not enabled

2017-01-11 Thread Heiko Schocher

Hello Adam,

Am 11.01.2017 um 15:44 schrieb Adam Ford:

On Tue, Jan 10, 2017 at 1:08 AM, Heiko Schocher  wrote:

commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor"
breaks u-boot commandline working with long commands
sending to the board.

Since the above patch, you have to setup the fcr register.

For board/archs which enable OF_PLATDATA, the new field
fcr in struct ns16550_platdata is not filled with a
default value ...

This leads in not setting up the uarts fifo, which ends
in problems, when you send long commands to u-boots
commandline.

Detected this issue with automated tbot tests on am335x
based shc board.

The error does not popup, if you type commands. You need
to copy a long command to u-boots commandshell
(or send a long command with tbot)

Possible boards/plattforms with problems:
./arch/arm/cpu/arm926ejs/lpc32xx/devices.c
./arch/arm/mach-tegra/board.c
./board/isee/igep00x0/igep00x0.c
./board/overo/overo.c
./board/quipos/cairo/cairo.c
./board/logicpd/omap3som/omap3logic.c
./board/logicpd/zoom1/zoom1.c
./board/timll/devkit8000/devkit8000.c
./board/lg/sniper/sniper.c
./board/ti/beagle/beagle.c
./drivers/serial/serial_rockchip.c

This patch fixes only:
./arch/arm/mach-omap2/am33xx/board.c

Signed-off-by: Heiko Schocher 


The omap3logic is also affected.  It also appears as if you hold a
character down while booting, it may hang the system. I applied a
similar patch to omap3logic.c and it went away.


Thanks for testing!


Thanks for catching that!


Thanks goes to tbot [1] and weekly automated u-boot tests with
tbot integrated into buildbot [2]

(I also automated "git bisect" to find the, which commit breaks
 a board ... if interested in a demo video, see[5])

bye,
Heiko
[1] https://github.com/hsdenx/tbot
[2] http://xeidos.ddns.net/buildbot/tgrid
[3] tbot result webpage
http://xeidos.ddns.net/tests/test_db_auslesen.php
[4] tbot dokumentation
http://www.tbot.tools/main.html
[5] tbot demo on youtube
https://youtu.be/zfjpj3DLsx4
Its uncutted, so very long, but in the video comment I added
timemarkers, where the interesting parts are ...
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/7] ARM: sunxi: remove bare default for CONFIG_MMC

2017-01-11 Thread Masahiro Yamada
Hi Maxime,


2017-01-12 6:48 GMT+09:00 Maxime Ripard :
> On Tue, Jan 10, 2017 at 07:57:22PM +0900, Masahiro Yamada wrote:
>> 2017-01-10 17:04 GMT+09:00 Maxime Ripard :
>> > Hi,
>> >
>> > On Tue, Jan 10, 2017 at 01:32:08PM +0900, Masahiro Yamada wrote:
>> >> The bare default entry is wrong. Just remove it since the (real)
>> >> entry in drivers/mmc/Kconfig has "default ARM || PPC || SANDBOX".
>> >>
>> >> Signed-off-by: Masahiro Yamada 
>> >> Reviewed-by: Marek Vasut 
>> >> ---
>> >>
>> >> Changes in v2: None
>> >>
>> >>  board/sunxi/Kconfig | 4 
>> >>  1 file changed, 4 deletions(-)
>> >>
>> >> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
>> >> index e1d4ab1..11eb82a 100644
>> >> --- a/board/sunxi/Kconfig
>> >> +++ b/board/sunxi/Kconfig
>> >> @@ -291,10 +291,6 @@ config OLD_SUNXI_KERNEL_COMPAT
>> >>   Set this to enable various workarounds for old kernels, this 
>> >> results in
>> >>   sub-optimal settings for newer kernels, only enable if needed.
>> >>
>> >> -config MMC
>> >> - depends on !UART0_PORT_F
>> >> - default y if ARCH_SUNXI
>> >> -
>> >
>> > The default might be useless, but the additional depends on is really
>> > not.
>>
>> This is wrong anyway.
>
> The original code might have been wrong, but you just introduced a
> regression.
>
>> If you want to disable MMC, the following seems better.
>>
>> config MMC_SUNXI
>>   depends on ARCH_SUNXI && !UART0_PORT_F
>
> That looks great. Can you send a patch for it or add it to that serie?


OK.

Please check this:
http://patchwork.ozlabs.org/patch/714139/


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


[U-Boot] [PATCH] mmc: sunxi: revive depends on UART0_PORT_F

2017-01-11 Thread Masahiro Yamada
Commit f401e907fcbc ("ARM: sunxi: remove bare default for
CONFIG_MMC") dropped "depends on UART0_PORT_F", but it is still
needed.  Revive it as a prerequisite of CONFIG_MMC_SUNXI.

Signed-off-by: Masahiro Yamada 
---

 drivers/mmc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 0aef132..9ed8da3 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -299,7 +299,7 @@ config MMC_SDHCI_TEGRA
 
 config MMC_SUNXI
bool "Allwinner sunxi SD/MMC Host Controller support"
-   depends on ARCH_SUNXI
+   depends on ARCH_SUNXI && !UART0_PORT_F
default y
help
  This selects support for the SD/MMC Host Controller on
-- 
2.7.4

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


Re: [U-Boot] [PATCH V2 20/20] imx: mx7ulp_evk: enable mmc/regulator support

2017-01-11 Thread Peng Fan
+Stefano

On Thu, Jan 12, 2017 at 10:23:03AM +0800, Peng Fan wrote:
>On Tue, Jan 03, 2017 at 05:05:02PM +0800, Peng Fan wrote:
>>Hi Stefano,
>>
>>On Tue, Dec 27, 2016 at 12:07:40PM +, Peng Fan wrote:
 > +   "boot_fdt=try\0" \
 
 On this platform we will always boot from dt, so we can remove this 
 variable...
>>>
>>>
>>>Fix in v3.
>>
>>I do not see more comments on the patch set.
>>Can I post a follow up patch to fix this, but not send out a whole V3 patch 
>>set?
>
>Ping..
>
>Thanks,
>Peng.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 20/20] imx: mx7ulp_evk: enable mmc/regulator support

2017-01-11 Thread Peng Fan
On Tue, Jan 03, 2017 at 05:05:02PM +0800, Peng Fan wrote:
>Hi Stefano,
>
>On Tue, Dec 27, 2016 at 12:07:40PM +, Peng Fan wrote:
>>> > +   "boot_fdt=try\0" \
>>> 
>>> On this platform we will always boot from dt, so we can remove this 
>>> variable...
>>
>>
>>Fix in v3.
>
>I do not see more comments on the patch set.
>Can I post a follow up patch to fix this, but not send out a whole V3 patch 
>set?

Ping..

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


Re: [U-Boot] [v3, 1/3] mmc: fsl_esdhc: move 'status' property fixup into a weak function

2017-01-11 Thread Y.B. Lu
Hi York,

Any comments on this patchset?
Thanks a lot.


Best regards,
Yangbo Lu

> -Original Message-
> From: Yangbo Lu [mailto:yangbo...@nxp.com]
> Sent: Thursday, December 08, 2016 11:42 AM
> To: u-boot@lists.denx.de
> Cc: york sun; Y.B. Lu
> Subject: [v3, 1/3] mmc: fsl_esdhc: move 'status' property fixup into a
> weak function
> 
> Move fdt fixup of 'status' property into a weak function. This allows
> board to define 'status' fdt fixup by themselves.
> 
> Signed-off-by: Yangbo Lu 
> ---
> Changes for v2:
>   - None
> Changes for v3:
>   - None
> ---
>  drivers/mmc/fsl_esdhc.c | 21 ++---
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index
> 9796d39..68de04e 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -908,17 +908,26 @@ void mmc_adapter_card_type_ident(void)  #endif
> 
>  #ifdef CONFIG_OF_LIBFDT
> -void fdt_fixup_esdhc(void *blob, bd_t *bd)
> +__weak int esdhc_status_fixup(void *blob, const char *compat)
>  {
> - const char *compat = "fsl,esdhc";
> -
>  #ifdef CONFIG_FSL_ESDHC_PIN_MUX
>   if (!hwconfig("esdhc")) {
>   do_fixup_by_compat(blob, compat, "status", "disabled",
> - 8 + 1, 1);
> - return;
> + sizeof("disabled"), 1);
> + return 1;
>   }
>  #endif
> + do_fixup_by_compat(blob, compat, "status", "okay",
> +sizeof("okay"), 1);
> + return 0;
> +}
> +
> +void fdt_fixup_esdhc(void *blob, bd_t *bd) {
> + const char *compat = "fsl,esdhc";
> +
> + if (esdhc_status_fixup(blob, compat))
> + return;
> 
>  #ifdef CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK
>   do_fixup_by_compat_u32(blob, compat, "peripheral-frequency", @@ -
> 931,8 +940,6 @@ void fdt_fixup_esdhc(void *blob, bd_t *bd)
>   do_fixup_by_compat_u32(blob, compat, "adapter-type",
>  (u32)(gd->arch.sdhc_adapter), 1);  #endif
> - do_fixup_by_compat(blob, compat, "status", "okay",
> -4 + 1, 1);
>  }
>  #endif
> 
> --
> 2.1.0.27.g96db324

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


Re: [U-Boot] [PATCH 1/4] mmc: fsl_esdhc: make GPIO support optional

2017-01-11 Thread Y.B. Lu
Hi York,

Could you help to merge this patchset if there is no any changes needed?
Thanks :)

Best regards,
Yangbo Lu

> -Original Message-
> From: Jaehoon Chung [mailto:jh80.ch...@samsung.com]
> Sent: Thursday, January 05, 2017 8:33 AM
> To: york sun; Y.B. Lu
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH 1/4] mmc: fsl_esdhc: make GPIO support optional
> 
> Hi,
> 
> On 01/05/2017 04:52 AM, york sun wrote:
> > On 12/06/2016 08:08 PM, Yangbo Lu wrote:
> >> There would be compiling error as below when enable driver model for
> esdhc.
> >> undefined reference to `dm_gpio_get_value'
> >> undefined reference to `gpio_request_by_name_nodev'
> >> This patch is to make GPIO support optional with CONFIG_DM_GPIO.
> >> Because all boards of QorIQ platform don't need it and they just
> >> check register for CD/WP status, only some boards of i.MX platform
> require this.
> >>
> >> Signed-off-by: Yangbo Lu 
> >> ---
> >>  drivers/mmc/fsl_esdhc.c | 10 --
> >>  1 file changed, 8 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index
> >> 9796d39..da3a151 100644
> >> --- a/drivers/mmc/fsl_esdhc.c
> >> +++ b/drivers/mmc/fsl_esdhc.c
> >> @@ -104,8 +104,10 @@ struct fsl_esdhc_priv {
> >>struct udevice *dev;
> >>int non_removable;
> >>int wp_enable;
> >> +#ifdef CONFIG_DM_GPIO
> >>struct gpio_desc cd_gpio;
> >>struct gpio_desc wp_gpio;
> >> +#endif
> >>  };
> >>
> >>  /* Return the XFERTYP flags for a given command and data packet */
> >> @@ -687,10 +689,11 @@ static int esdhc_getcd(struct mmc *mmc)  #ifdef
> >> CONFIG_DM_MMC
> >>if (priv->non_removable)
> >>return 1;
> >> -
> >> +#ifdef CONFIG_DM_GPIO
> >>if (dm_gpio_is_valid(>cd_gpio))
> >>return dm_gpio_get_value(>cd_gpio);
> >>  #endif
> >> +#endif
> >>
> >>while (!(esdhc_read32(>prsstat) & PRSSTAT_CINS) && --timeout)
> >>udelay(1000);
> >> @@ -967,17 +970,20 @@ static int fsl_esdhc_probe(struct udevice *dev)
> >>priv->non_removable = 1;
> >> } else {
> >>priv->non_removable = 0;
> >> +#ifdef CONFIG_DM_GPIO
> >>gpio_request_by_name_nodev(fdt, node, "cd-gpios", 0,
> >>   >cd_gpio, GPIOD_IS_IN);
> >> +#endif
> >>}
> >>
> >>priv->wp_enable = 1;
> >>
> >> +#ifdef CONFIG_DM_GPIO
> >>ret = gpio_request_by_name_nodev(fdt, node, "wp-gpios", 0,
> >> >wp_gpio, GPIOD_IS_IN);
> >>if (ret)
> >>priv->wp_enable = 0;
> >> -
> >> +#endif
> >>/*
> >> * TODO:
> >> * Because lack of clk driver, if SDHC clk is not enabled,
> >>
> >
> > Jaehoon,
> >
> > This set looks OK to me. Please review and comment. I can merge it
> > with your ack.
> 
> Sorry for late. I missed this patch. It looks good to me.
> 
> Acked-by: Jaehoon Chung 
> 
> Best Regards,
> Jaehoon Chung
> 
> >
> > Yangbo,
> >
> > For MMC or SD patches, please CC Jaehoon.
> >
> > York
> >
> >
> >

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


[U-Boot] [PATCH v3 0/4] arm: aspeed: Basic support for Aspeed AST2500 part and eval board

2017-01-11 Thread Maxim Sloyko
This series adds minimal support for AST2500 part and eval board,
enough to boot EVB into prompt. It contains WDT, Timer, Sysreset,
Clock (very basic) and SDRAM MC drivers, all written from scratch,
using AST2500 datasheet. Aspeed's SDK was used only for reference.
Given very limited documentation provided by Aspeed, some parts of SDRAM
init sequence were basically rewritten to do the same thing that is done
in Aspeed SDK, without real understanding of what is going on.

The file layout closely follows the example of rk3288 chip and firefly-rk3288
board.

Changes in v3:
- Added SYS_TEXT_BASE as Kconfig option
- Removed CONFIG_SYS_TEXT_BASE in favor of Kconfig option
- In aspeed-common.h changed some options from define CONFIG_FOO 1 to
  define CONFIG_FOO
- In evb_ast2500.h fixed some options to define CONFIG_FOO instead of
  define CONFIG_FOO 1

Changes in v2:
- Moved number of WDTs to a Kconfig option

Changes in v1:
- Merged together the patches related to aspeed common drivers and
  configuration
- Fixed timer driver name (was sandbox_timer)
- Removed yet nonexistent files from mach-aspeed/Makefile
- Merge together all patches related to ast2500 specific drivers
- Add Copyright statement to all c/h files
- Use DT include from Linux Kernel, Add U-Boot specific modifications in
  ast2500-u-boot.dtsi
- Merge together all patches related to ast2500 boards common
  functions/configs
- Add copyright statement to ast2500-board.c
- Merge together patches related to ast2500 eval board configuration
- Add Copyright statement to evb_ast2500.c
- Use ast2500-u-boot.dtsi instead of ast2500.dtsi, which is now Linux
  Kernel DT Include

Maxim Sloyko (4):
  aspeed: Add drivers common to all Aspeed SoCs
  aspeed: Add basic ast2500 specific drivers and configuration
  aspeed: Board init functions and common configs for ast2500 based
boards
  aspeed: Support for ast2500 Eval Board

 arch/arm/Kconfig |   7 +
 arch/arm/Makefile|   1 +
 arch/arm/dts/Makefile|   2 +
 arch/arm/dts/ast2500-evb.dts |  23 ++
 arch/arm/dts/ast2500-u-boot.dtsi |  53 +++
 arch/arm/dts/ast2500.dtsi| 174 +
 arch/arm/include/asm/arch-aspeed/scu_ast2500.h   | 113 ++
 arch/arm/include/asm/arch-aspeed/sdram_ast2500.h | 138 +++
 arch/arm/include/asm/arch-aspeed/timer.h |  54 +++
 arch/arm/include/asm/arch-aspeed/wdt.h   |  89 +
 arch/arm/mach-aspeed/Kconfig |  27 ++
 arch/arm/mach-aspeed/Makefile|   8 +
 arch/arm/mach-aspeed/ast2500-board.c |  78 
 arch/arm/mach-aspeed/ast2500/Kconfig |  13 +
 arch/arm/mach-aspeed/ast2500/Makefile|   1 +
 arch/arm/mach-aspeed/ast2500/clk_ast2500.c   |  30 ++
 arch/arm/mach-aspeed/ast2500/sdram_ast2500.c | 443 +++
 arch/arm/mach-aspeed/ast_wdt.c   |  37 ++
 board/aspeed/evb_ast2500/Kconfig |  12 +
 board/aspeed/evb_ast2500/Makefile|   1 +
 board/aspeed/evb_ast2500/evb_ast2500.c   |   6 +
 configs/evb-ast2500_defconfig|  21 ++
 drivers/clk/Makefile |   2 +
 drivers/clk/aspeed/Makefile  |   7 +
 drivers/clk/aspeed/clk_ast2500.c | 255 +
 drivers/sysreset/Makefile|   1 +
 drivers/sysreset/sysreset_ast.c  |  55 +++
 drivers/timer/Kconfig|   7 +
 drivers/timer/Makefile   |   1 +
 drivers/timer/ast_timer.c|  96 +
 include/configs/aspeed-common.h  |  82 +
 include/configs/evb_ast2500.h|  30 ++
 include/dt-bindings/clock/ast2500-scu.h  |  29 ++
 33 files changed, 1896 insertions(+)
 create mode 100644 arch/arm/dts/ast2500-evb.dts
 create mode 100644 arch/arm/dts/ast2500-u-boot.dtsi
 create mode 100644 arch/arm/dts/ast2500.dtsi
 create mode 100644 arch/arm/include/asm/arch-aspeed/scu_ast2500.h
 create mode 100644 arch/arm/include/asm/arch-aspeed/sdram_ast2500.h
 create mode 100644 arch/arm/include/asm/arch-aspeed/timer.h
 create mode 100644 arch/arm/include/asm/arch-aspeed/wdt.h
 create mode 100644 arch/arm/mach-aspeed/Kconfig
 create mode 100644 arch/arm/mach-aspeed/Makefile
 create mode 100644 arch/arm/mach-aspeed/ast2500-board.c
 create mode 100644 arch/arm/mach-aspeed/ast2500/Kconfig
 create mode 100644 arch/arm/mach-aspeed/ast2500/Makefile
 create mode 100644 arch/arm/mach-aspeed/ast2500/clk_ast2500.c
 create mode 100644 arch/arm/mach-aspeed/ast2500/sdram_ast2500.c
 create mode 100644 arch/arm/mach-aspeed/ast_wdt.c
 create mode 100644 board/aspeed/evb_ast2500/Kconfig
 create mode 100644 board/aspeed/evb_ast2500/Makefile
 create mode 100644 board/aspeed/evb_ast2500/evb_ast2500.c
 create mode 100644 

Re: [U-Boot] [PATCH v2 3/4] aspeed: Board init functions and common configs for ast2500 based boards

2017-01-11 Thread Maxim Sloyko
On Tue, Jan 10, 2017 at 7:20 PM, Tom Rini  wrote:
> On Mon, Jan 09, 2017 at 05:50:39PM -0800, Maxim Sloyko wrote:
>
> [snip]
>> +#define CONFIG_CMDLINE_EDITING   1
>
> In general, we just do '#define CONFIG_FOO'.

Fixed several defines in aspeed-common.h and evb_ast2500.h

>
>> +#define CONFIG_SYS_TEXT_BASE 0x
>
> This one at least is in Kconfig now.  Please check for anything else
> that has also been migrated, thanks!

This seems to be the only one. Checked by grepping all Kconfigs for
all options in aspeed-common.h, basically by running

for v in $(cat include/configs/aspeed-common.h | awk '/^#define
CONFIG/ { print gensub("CONFIG_", "", 1, $2) }'); do find . -name
Kconfig -exec grep -Hn $v {} \; ; done

The fix still ended up being spread around three patches from this
series, so I'm copying Revewed-by to only one of those that was left
untouched.


>
> --
> Tom



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


Re: [U-Boot] [PATCH v2 7/7] ARM: sunxi: remove bare default for CONFIG_MMC

2017-01-11 Thread Maxime Ripard
On Tue, Jan 10, 2017 at 07:57:22PM +0900, Masahiro Yamada wrote:
> 2017-01-10 17:04 GMT+09:00 Maxime Ripard :
> > Hi,
> >
> > On Tue, Jan 10, 2017 at 01:32:08PM +0900, Masahiro Yamada wrote:
> >> The bare default entry is wrong. Just remove it since the (real)
> >> entry in drivers/mmc/Kconfig has "default ARM || PPC || SANDBOX".
> >>
> >> Signed-off-by: Masahiro Yamada 
> >> Reviewed-by: Marek Vasut 
> >> ---
> >>
> >> Changes in v2: None
> >>
> >>  board/sunxi/Kconfig | 4 
> >>  1 file changed, 4 deletions(-)
> >>
> >> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> >> index e1d4ab1..11eb82a 100644
> >> --- a/board/sunxi/Kconfig
> >> +++ b/board/sunxi/Kconfig
> >> @@ -291,10 +291,6 @@ config OLD_SUNXI_KERNEL_COMPAT
> >>   Set this to enable various workarounds for old kernels, this results 
> >> in
> >>   sub-optimal settings for newer kernels, only enable if needed.
> >>
> >> -config MMC
> >> - depends on !UART0_PORT_F
> >> - default y if ARCH_SUNXI
> >> -
> >
> > The default might be useless, but the additional depends on is really
> > not.
> 
> This is wrong anyway.

The original code might have been wrong, but you just introduced a
regression.

> If you want to disable MMC, the following seems better.
> 
> config MMC_SUNXI
>   depends on ARCH_SUNXI && !UART0_PORT_F

That looks great. Can you send a patch for it or add it to that serie?

> BTW,  UART0_PORT_F seems SUNXI specific.
> If this symbol is useful, I'd like to recommend to rename it to
> ARCH_SUNXI_UART0_PORT_F or something.

That would work for me too.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


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


[U-Boot] [RFC Patch V2] drivers: mmc: omap_hsmmc: Fix IO Buffer on OMAP36XX

2017-01-11 Thread Adam Ford
On the OMAP36xx (and 37xx) the CONTROL_WKUP_CTRL register has
a field (bit 6) named GPIO_IO_PWRDNZ.  If 0, the IO buffers which
are related to the MMC are disabled. After the PBIAS is configured,
this bit should be set high to enable the MMC port.

V2:  Make this feature a config option and add it to the MMC section
 of the Kconfig.  This allows the precompiler to only include it
 in a small handfull of OMAP36XX and 37XX boards using MMC1.

V1:  Original submission

Signed-off-by: Adam Ford 

diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig
index ac1a6a3..bd5f1a8 100644
--- a/configs/omap3_logic_defconfig
+++ b/configs/omap3_logic_defconfig
@@ -15,6 +15,7 @@ CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
+CONFIG_MMC_OMAP36XX_PINS=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_I2C=y
 # CONFIG_CMD_FPGA is not set
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index c3462ab..d6fcf7f 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -204,6 +204,17 @@ config MMC_SDHCI_SPEAR
 
  If unsure, say N.
 
+config MMC_OMAP36XX_PINS
+   bool "Enable MMC1 on OMAP36XX/37XX"
+   depends on OMAP34XX
+   help
+ This enables extended-drain in the MMC/SD/SDIO1I/O and 
+ GPIO-associated I/O cells (gpio_126, gpio_127, and gpio_129)
+ specific to the OMAP36XX/37XX using MMC1
+
+ If you have a controller with this interface, say Y here.
+
+ If unsure, say N.
 endif
 
 endmenu
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 0a1ee40..a4720e1 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -38,6 +38,7 @@
 #include 
 #endif
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -115,6 +116,13 @@ static unsigned char mmc_board_init(struct mmc *mmc)
PBIASSPEEDCTRL0 | PBIASLITEPWRDNZ0,
_base->pbias_lite);
 
+#ifdef CONFIG_MMC_OMAP36XX_PINS
+   if (get_cpu_family() == CPU_OMAP36XX)
+   writel(readl(OMAP34XX_CTRL_WKUP_CTRL) |
+   OMAP34XX_CTRL_WKUP_CTRL_GPIO_IO_PWRDNZ,
+   OMAP34XX_CTRL_WKUP_CTRL);
+#endif
+
writel(readl(_base->devconf0) | MMCSDIO1ADPCLKISEL,
_base->devconf0);
 
-- 
2.7.4

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


[U-Boot] [RFC] spl: Remove overwrite of relocated malloc limit

2017-01-11 Thread Andrew F. Davis
spl_init on some boards is called after stack and heap relocation, on
some platforms spl_relocate_stack_gd is called to handle setting the
limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple
SPL malloc is enabled during relocation. spl_init should then not
re-assign the old pre-relocation limit. Remove this.

Also add some debug statements that can help with find similar
problems.

Signed-off-by: Andrew F. Davis 
---
I'm not sure what the real fix should be, probably to clean-up
all this spaghetti code relating to malloc, but for now without
this patch we are stuck with the pre-relocation heap size and
boot with simple malloc is not functional on AM335x-EVM and probably
many other similar boards.

 common/malloc_simple.c | 6 +-
 common/spl/spl.c   | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index 0f6bcbcc71..611400265b 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -39,10 +39,14 @@ void *memalign_simple(size_t align, size_t bytes)
 
addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
new_ptr = addr + bytes - gd->malloc_base;
-   if (new_ptr > gd->malloc_limit)
+   if (new_ptr > gd->malloc_limit) {
+   debug("space exhausted\n");
return NULL;
+   }
+
ptr = map_sysmem(addr, bytes);
gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
+   debug("%lx\n", (ulong)ptr);
 
return ptr;
 }
diff --git a/common/spl/spl.c b/common/spl/spl.c
index a76ea3a603..aa75c93fce 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -237,7 +237,6 @@ int spl_init(void)
 #ifdef CONFIG_MALLOC_F_ADDR
gd->malloc_base = CONFIG_MALLOC_F_ADDR;
 #endif
-   gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
gd->malloc_ptr = 0;
 #endif
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
-- 
2.11.0

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


Re: [U-Boot] [PATCH v2 1/4] sunxi: add basic V3s support

2017-01-11 Thread Icenowy Zheng


11.01.2017, 03:25, "Maxime Ripard" :
> Hi,
>
> On Tue, Jan 10, 2017 at 05:18:22PM +0800, Icenowy Zheng wrote:
>>  Basic U-Boot support is now present for V3s.
>>
>>  Some memory addresses are changed specially for V3s, as the original
>>  address map cannot fit into a so small DRAM.
>>
>>  As the DRAM controller code needs a big refactor, the SPL support is
>>  disabled in this version.
>>
>>  Signed-off-by: Icenowy Zheng 
>>  ---
>>   arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
>>   arch/arm/mach-sunxi/board.c | 9 ++--
>>   arch/arm/mach-sunxi/cpu_info.c | 2 ++
>>   board/sunxi/Kconfig | 12 --
>>   include/configs/sun8i.h | 2 ++
>>   include/configs/sunxi-common.h | 42 +++---
>>   6 files changed, 61 insertions(+), 7 deletions(-)
>>
>>  diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h 
>> b/arch/arm/include/asm/arch-sunxi/gpio.h
>>  index 85a4ec3b0e..24f85206c8 100644
>>  --- a/arch/arm/include/asm/arch-sunxi/gpio.h
>>  +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
>>  @@ -161,6 +161,7 @@ enum sunxi_gpio_number {
>>   #define SUN8I_GPB_UART2 2
>>   #define SUN8I_A33_GPB_UART0 3
>>   #define SUN8I_A83T_GPB_UART0 2
>>  +#define SUN8I_V3S_GPB_UART0 3
>>   #define SUN50I_GPB_UART0 4
>>
>>   #define SUNXI_GPC_NAND 2
>>  diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
>>  index aa11493748..3b28478e2d 100644
>>  --- a/arch/arm/mach-sunxi/board.c
>>  +++ b/arch/arm/mach-sunxi/board.c
>>  @@ -110,6 +110,10 @@ static int gpio_init(void)
>>   sunxi_gpio_set_cfgpin(SUNXI_GPB(9), SUN8I_A83T_GPB_UART0);
>>   sunxi_gpio_set_cfgpin(SUNXI_GPB(10), SUN8I_A83T_GPB_UART0);
>>   sunxi_gpio_set_pull(SUNXI_GPB(10), SUNXI_GPIO_PULL_UP);
>>  +#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN8I_V3S)
>>  + sunxi_gpio_set_cfgpin(SUNXI_GPB(8), SUN8I_V3S_GPB_UART0);
>>  + sunxi_gpio_set_cfgpin(SUNXI_GPB(9), SUN8I_V3S_GPB_UART0);
>>  + sunxi_gpio_set_pull(SUNXI_GPB(9), SUNXI_GPIO_PULL_UP);
>>   #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN9I)
>>   sunxi_gpio_set_cfgpin(SUNXI_GPH(12), SUN9I_GPH_UART0);
>>   sunxi_gpio_set_cfgpin(SUNXI_GPH(13), SUN9I_GPH_UART0);
>>  @@ -180,10 +184,11 @@ void s_init(void)
>>   /* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */
>>   #endif
>>
>>  -#if defined CONFIG_MACH_SUN6I || \
>>  +#if (defined CONFIG_MACH_SUN6I || \
>>   defined CONFIG_MACH_SUN7I || \
>>   defined CONFIG_MACH_SUN8I || \
>>  - defined CONFIG_MACH_SUN9I
>>  + defined CONFIG_MACH_SUN9I) && \
>>  + !defined CONFIG_MACH_SUN8I_V3S
>>   /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg 
>> */
>>   asm volatile(
>>   "mrc p15, 0, r0, c1, c0, 1\n"
>>  diff --git a/arch/arm/mach-sunxi/cpu_info.c b/arch/arm/mach-sunxi/cpu_info.c
>>  index f1f6fd5ba4..15f1e0e45a 100644
>>  --- a/arch/arm/mach-sunxi/cpu_info.c
>>  +++ b/arch/arm/mach-sunxi/cpu_info.c
>>  @@ -87,6 +87,8 @@ int print_cpuinfo(void)
>>   printf("CPU: Allwinner A83T (SUN8I %04x)\n", sunxi_get_sram_id());
>>   #elif defined CONFIG_MACH_SUN8I_H3
>>   printf("CPU: Allwinner H3 (SUN8I %04x)\n", sunxi_get_sram_id());
>>  +#elif defined CONFIG_MACH_SUN8I_V3S
>>  + printf("CPU: Allwinner V3s (SUN8I %04x)\n", sunxi_get_sram_id());
>>   #elif defined CONFIG_MACH_SUN9I
>>   puts("CPU: Allwinner A80 (SUN9I)\n");
>>   #elif defined CONFIG_MACH_SUN50I
>>  diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
>>  index e1d4ab148f..1eb23c3a4c 100644
>>  --- a/board/sunxi/Kconfig
>>  +++ b/board/sunxi/Kconfig
>>  @@ -115,6 +115,14 @@ config MACH_SUN8I_H3
>>   select SUPPORT_SPL
>>   select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
>>
>>  +config MACH_SUN8I_V3S
>>  + bool "sun8i (Allwinner V3s)"
>>  + select CPU_V7
>>  + select CPU_V7_HAS_NONSEC
>>  + select CPU_V7_HAS_VIRT
>>  + select SUNXI_GEN_SUN6I
>>  + select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
>>  +
>>   config MACH_SUN9I
>>   bool "sun9i (Allwinner A80)"
>>   select CPU_V7
>>  @@ -131,7 +139,7 @@ endchoice
>>   # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
>>   config MACH_SUN8I
>>   bool
>>  - default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3 || 
>> MACH_SUN8I_A83T
>>  + default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3 || 
>> MACH_SUN8I_A83T || MACH_SUN8I_V3S
>
> This needs some wrapping
>
>>   config DRAM_TYPE
>>   int "sunxi dram type"
>>  @@ -462,7 +470,7 @@ config AXP_GPIO
>>
>>   config VIDEO
>>   bool "Enable graphical uboot console on HDMI, LCD or VGA"
>>  - depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && 
>> !MACH_SUN50I
>>  + depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN8I_V3S && 
>> !MACH_SUN9I && !MACH_SUN50I
>
> Ditto.
>
>>   default y
>>   ---help---
>>   Say Y here 

Re: [U-Boot] [PATCH v3] disk: convert to Kconfig

2017-01-11 Thread Patrick DELAUNAY
 
> 
> First, thanks for doing all of this, I think it's just about ready to apply 
> so:
> 
> Reviewed-by: Tom Rini 
> 
> But that said, I'm going to re-run the sync as there's still a few places 
> where
> we enable $X in the defconfig file as it wasn't setting DISTRO_DEFAULTS
> before, but is now (am335x* and making EFI_PARTITIONS default y if
> TEGRA).  But I'll fix that up in-place so you don't have to re-submit the 
> giant
> thing.  Thanks!
> 
> --
> Tom

Hi Tom

I see that your patch is now merged and integrated in v2017.01 
(https://patchwork.ozlabs.org/patch/700546/),
do you need some re-submit of my giant patch for the next merge windows ?
or you can handle it my simple merge ?

Regards

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


Re: [U-Boot] [PATCH v3] disk: convert to Kconfig

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 07:10:53PM +, Patrick DELAUNAY wrote:
>  
> > 
> > First, thanks for doing all of this, I think it's just about ready to apply 
> > so:
> > 
> > Reviewed-by: Tom Rini 
> > 
> > But that said, I'm going to re-run the sync as there's still a few places 
> > where
> > we enable $X in the defconfig file as it wasn't setting DISTRO_DEFAULTS
> > before, but is now (am335x* and making EFI_PARTITIONS default y if
> > TEGRA).  But I'll fix that up in-place so you don't have to re-submit the 
> > giant
> > thing.  Thanks!
> > 
> > --
> > Tom
> 
> Hi Tom
> 
> I see that your patch is now merged and integrated in v2017.01 
> (https://patchwork.ozlabs.org/patch/700546/),
> do you need some re-submit of my giant patch for the next merge windows ?
> or you can handle it my simple merge ?

So, I took some attempts at merging this.  The problem is that as the
changes exist today it's not size-neutral which means that some of the
changes aren't quite right.  Do you have the time to look at making sure
it's size neutral?  Thanks!

-- 
Tom


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


[U-Boot] [PATCH] drivers: net: fsl-mc: Fixup MAC addresses in DPC

2017-01-11 Thread Bogdan Purcareata
Fixup port_mac_address property in MC DPC with values from the u-boot
environment. Since u-boot already reads the environment MAC addresses
when probing the PHYs, use these values.

The u-boot environment MAC addresses take precedence over any eventual
ones defined in the DPC, except for the case where they are randomly
assigned (no u-boot env value declared for port).

The patch assumes the "/board_info/ports/" node is present in the DPC.

Signed-off-by: Bogdan Purcareata 
---
 drivers/net/fsl-mc/mc.c | 103 +++-
 1 file changed, 101 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 2a2d3e5..cca579a 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -197,10 +198,81 @@ static int calculate_mc_private_ram_params(u64 
mc_private_ram_start_addr,
return 0;
 }
 
+static int mc_fixup_dpc_mac_addr(void *blob, int noff, int dpmac_id,
+   struct eth_device *eth_dev)
+{
+   int nodeoffset, err = 0;
+   char mac_name[10];
+   const char link_type_mode[] = "FIXED_LINK";
+   unsigned char env_enetaddr[6];
+
+   sprintf(mac_name, "mac@%d", dpmac_id);
+
+   /* node not found - create it */
+   nodeoffset = fdt_subnode_offset(blob, noff, (const char *) mac_name);
+   if (nodeoffset < 0) {
+   err = fdt_increase_size(blob, 200);
+   if (err) {
+   printf("fdt_increase_size: err=%s\n",
+   fdt_strerror(err));
+   return err;
+   }
+
+   nodeoffset = fdt_add_subnode(blob, noff, mac_name);
+
+   /* add default property of fixed link */
+   err = fdt_appendprop_string(blob, nodeoffset,
+   "link_type", link_type_mode);
+   if (err) {
+   printf("fdt_appendprop_string: err=%s\n",
+   fdt_strerror(err));
+   return err;
+   }
+   }
+
+   /* port_mac_address property present in DPC */
+   if (fdt_get_property(blob, nodeoffset, "port_mac_address", NULL)) {
+   /* MAC addr randomly assigned - leave the one in DPC */
+   eth_getenv_enetaddr_by_index("eth", eth_dev->index,
+   env_enetaddr);
+   if (is_zero_ethaddr(env_enetaddr))
+   return err;
+
+   /* replace DPC MAC address with u-boot env one */
+   err = fdt_setprop(blob, nodeoffset, "port_mac_address",
+   eth_dev->enetaddr, 6);
+   if (err) {
+   printf("fdt_setprop mac: err=%s\n", fdt_strerror(err));
+   return err;
+   }
+
+   return 0;
+   }
+
+   /* append port_mac_address property to mac node in DPC */
+   err = fdt_increase_size(blob, 80);
+   if (err) {
+   printf("fdt_increase_size: err=%s\n", fdt_strerror(err));
+   return err;
+   }
+
+   err = fdt_appendprop(blob, nodeoffset,
+"port_mac_address", eth_dev->enetaddr, 6);
+   if (err) {
+   printf("fdt_appendprop: err=%s\n", fdt_strerror(err));
+   return err;
+   }
+
+   return err;
+}
+
 static int mc_fixup_dpc(u64 dpc_addr)
 {
void *blob = (void *)dpc_addr;
-   int nodeoffset;
+   int nodeoffset, err = 0;
+   char ethname[10];
+   struct eth_device *eth_dev;
+   int i;
 
/* delete any existing ICID pools */
nodeoffset = fdt_path_offset(blob, "/resources/icid_pools");
@@ -222,9 +294,36 @@ static int mc_fixup_dpc(u64 dpc_addr)
 FSL_DPAA2_STREAM_ID_END -
 FSL_DPAA2_STREAM_ID_START + 1, 1);
 
+   /* fixup MAC addresses for dpmac ports */
+   nodeoffset = fdt_path_offset(blob, "/board_info/ports");
+   if (nodeoffset < 0)
+   goto out;
+
+   for (i = WRIOP1_DPMAC1; i < NUM_WRIOP_PORTS; i++) {
+   /* port not enabled */
+   if ((wriop_is_enabled_dpmac(i) != 1) ||
+   (wriop_get_phy_address(i) == -1))
+   continue;
+
+   sprintf(ethname, "DPMAC%d@%s", i,
+   phy_interface_strings[wriop_get_enet_if(i)]);
+
+   eth_dev = eth_get_dev_by_name(ethname);
+   if (eth_dev == NULL)
+   continue;
+
+   err = mc_fixup_dpc_mac_addr(blob, nodeoffset, i, eth_dev);
+   if (err) {
+   printf("mc_fixup_dpc_mac_addr failed: err=%s\n",
+   fdt_strerror(err));
+   goto out;
+   }
+   }
+
+out:

[U-Boot] [PATCH] MAINTAINERS: Add maintainer for TI security related files

2017-01-11 Thread Andrew F. Davis
Changes involving High-Security boards should be CC'd for additional
assessment of the security implications.

Signed-off-by: Andrew F. Davis 
---
Recently some fastboot additions have been made that may effect security
on our HS boards by letting some boot methods work around our chain-of-
trust. It would be nice to get a CC for changes that directly effect
these HS boards so I have a chance to check for this kind of thing.

 MAINTAINERS | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 793ff49f68..1ea7ae013a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -434,6 +434,17 @@ S: Maintained
 F: drivers/spmi/
 F: include/spmi/
 
+TI SYSTEM SECURITY
+M: Andrew F. Davis 
+S: Supported
+F: arch/arm/mach-omap2/omap5/sec_entry_cpu1.S
+F: arch/arm/mach-omap2/omap5/sec-fxns.c
+F: arch/arm/mach-omap2/sec-common.c
+F: arch/arm/mach-omap2/config_secure.mk
+F: configs/am43xx_hs_evm_defconfig
+F: configs/am57xx_hs_evm_defconfig
+F: configs/dra7xx_hs_evm_defconfig
+
 TQ GROUP
 #M:Martin Krause 
 S: Orphaned (Since 2016-02)
-- 
2.11.0

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


Re: [U-Boot] [PATCH] cmd: sata: fix init command return value

2017-01-11 Thread Eric Nelson
On 01/11/2017 08:51 AM, Gary Bisson wrote:
> Since commit aa6ab905b2, sata_initialize returns -1 if init_sata or
> scan_sata fails. But this return value becomes the do_sata return
> value which is equivalent to CMD_RET_USAGE.
> 
> In case one issues 'sata init' and that the hardware fails to
> initialize, there's no need to display the command usage. Instead
> the command shoud just return the CMD_RET_FAILURE value.

s/shoud/should/

> 
> Fixes: aa6ab905b2 (sata: fix sata command can not being executed bug)
> 
> Signed-off-by: Gary Bisson 
> ---
>  cmd/sata.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/cmd/sata.c b/cmd/sata.c
> index f56622acc2..4c53022ff6 100644
> --- a/cmd/sata.c
> +++ b/cmd/sata.c
> @@ -28,14 +28,15 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>   if (sata_curr_device != -1)
>   sata_stop();
>  
> - return sata_initialize();
> + return (sata_initialize() < 0) ?
> + CMD_RET_FAILURE : CMD_RET_SUCCESS;
>   }
>  
>   /* If the user has not yet run `sata init`, do it now */
>   if (sata_curr_device == -1) {
>   rc = sata_initialize();
>   if (rc == -1)
> - return rc;
> + return CMD_RET_FAILURE;
>   sata_curr_device = rc;
>   }
>  
> 
Otherwise,

Reviewed-by: Eric Nelson 

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


Re: [U-Boot] [PATCH 2/2] spl: Remove inline ifdef check for EXT and FAT support

2017-01-11 Thread Tom Rini
On Fri, Jan 06, 2017 at 01:35:45PM -0600, Andrew F. Davis wrote:

> These files are only included for build by the make system
> when CONFIG_SPL_{EXT,FAT}_SUPPORT is enabled, remove the unneed
> checks for these in the source files.
> 
> Signed-off-by: Andrew F. Davis 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 1/2] spl: Move check for SPL_LIBCOMMON support to header

2017-01-11 Thread Tom Rini
On Fri, Jan 06, 2017 at 01:35:44PM -0600, Andrew F. Davis wrote:

> Print statements in SPL depend on lib/common support, so many such
> statements are ifdef'd, move the check to the common.h header and
> remove these inline checks.
> 
> Signed-off-by: Andrew F. Davis 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH] SPL: Adjust more debug prints for ulong entry_point

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 10:47:16AM -0500, Tom Rini wrote:

> With entry_point now being an unsigned long we need to adapt the last
> two debug prints to use %lX not %X.
> 
> Fixes: 11e1479b9e67 ("SPL: make struct spl_image 64-bit safe")
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH] ti_armv7_common: env: Use FIT image configs by default

2017-01-11 Thread Andrew F. Davis
This allows us to specify a FIT configuration that will automatically
use the correct images from the FIT blob.

Signed-off-by: Andrew F. Davis 
---
 include/configs/ti_armv7_common.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/configs/ti_armv7_common.h 
b/include/configs/ti_armv7_common.h
index dbe494a6e3..6a94cd7bb4 100644
--- a/include/configs/ti_armv7_common.h
+++ b/include/configs/ti_armv7_common.h
@@ -124,8 +124,7 @@
"fit_bootfile=fitImage.itb\0" \
"update_to_fit=setenv loadaddr ${fit_loadaddr}; setenv bootfile 
${fit_bootfile}\0" \
"args_fit=setenv bootargs console=${console} \0" \
-   "loadfit=run args_fit; bootm ${loadaddr}:kernel@1 " \
-   "${loadaddr}:ramdisk@1 ${loadaddr}:${fdtfile};\0" \
+   "loadfit=run args_fit; bootm ${loadaddr}#${fdtfile};\0" \
 
 /*
  * DDR information.  If the CONFIG_NR_DRAM_BANKS is not defined,
-- 
2.11.0

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


Re: [U-Boot] [GIT PULL] Xilinx changes

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 09:59:29AM +0100, Michal Simek wrote:

> Hi Tom,
> 
> here are changes I have collected. Travis is not reporting any issue.
> I have also started to use signed tags to be clear what to take.

Ah, signed tags.  How much more work is that on your end?

> Thanks,
> Michal
> 
> 
> The following changes since commit a705ebc81b7f91bbd0ef7c634284208342901149:
> 
>   Prepare v2017.01 (2017-01-09 11:57:05 -0500)
> 
> are available in the git repository at:
> 
>   git://www.denx.de/git/u-boot-microblaze.git tags/xilinx-for-v2017.03
> 
> for you to fetch changes up to 7364dfe7bfca8632bfe02de5c333a64472812ebe:
> 
>   ARM64: zynqmp: Move CONFIG_AHCI from board file (2017-01-11 07:00:38
> +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] power_i2c.c: Fix unused variable warning

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 09:17:31AM -0500, Tom Rini wrote:

> The variable ret was added but never set as we did not make calls to
> other functions that we needed to check the return value on.
> 
> Fixes: 505cf4750ae5 ("power: change from meaningless value to error number")
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [GIT PULL] Please pull u-boot-mmc master

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 09:39:48PM +0900, Jaehoon Chung wrote:

> Dear Tom,
> 
> I fixed the buildman error, and pushed them by force.
> - checked the mips, arm and the other things with buildman.
> - And rebased on latest u-boot/master
> 
> Sorry for not checking in more detail
> 
> Could you pull these patches on your master branch?
> 
> The following changes since commit 04770e6e917b0f766a9496e3f37bcdf2ebb1beb4:
> 
>   Merge git://git.denx.de/u-boot-dm (2017-01-10 08:19:33 -0500)
> 
> are available in the git repository at:
> 
>   http://git.denx.de/u-boot-mmc.git master
> 
> for you to fetch changes up to f401e907fcbc94adff1a8e8097c8f0a5b0aee580:
> 
>   ARM: sunxi: remove bare default for CONFIG_MMC (2017-01-11 19:40:15 +0900)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 4/4] cmd: mem: Use memcpy for 'cp' command

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 01:49:55PM -0200, Fabio Estevam wrote:
> Hi Tom,
> 
> On Mon, Dec 19, 2016 at 8:09 PM, Tom Rini  wrote:
> > On Thu, Dec 15, 2016 at 04:00:13PM -0200, Fabio Estevam wrote:
> >
> >> Simplify the 'cp' command implementation by using the memcpy() function,
> >> which brings the additional benefit of performance gain for those who have
> >> CONFIG_USE_ARCH_MEMCPY selected.
> >>
> >> Tested on a mx6qsabreauto board where a 5x gain in performance is seen
> >> when reading 10MB from the parallel NOR memory.
> >>
> >> Signed-off-by: Fabio Estevam 
> >> ---
> >> Changes since v1:
> >> - Always use memcpy()
> >
> > I feel like this is correct.  I also feel like it's too close to release
> > to do this, so I'll be applying this shortly after release, thanks!
> 
> Is it a good time to apply this one now?

Yes, yes it would, thanks for the reminder.  I'm kicking off a round of
testing in travis-ci now along with another pre-req of finally, really,
making arch/arm/lib/mem{set,cpy}.S be used by default in most cases.

-- 
Tom


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


[U-Boot] [PATCH] arm: omap-common: add secure ROM signature verify index for AM33xx

2017-01-11 Thread Andrew F. Davis
On AM33xx devices the secure ROM uses a different call index for
signature verification, the function and arguments are the same.

Signed-off-by: Andrew F. Davis 
---
 arch/arm/mach-omap2/sec-common.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-omap2/sec-common.c b/arch/arm/mach-omap2/sec-common.c
index 246a2393da..c5a000ac3a 100644
--- a/arch/arm/mach-omap2/sec-common.c
+++ b/arch/arm/mach-omap2/sec-common.c
@@ -21,7 +21,11 @@
 #include 
 
 /* Index for signature verify ROM API */
+#ifdef CONFIG_AM33XX
+#define API_HAL_KM_VERIFYCERTIFICATESIGNATURE_INDEX(0x000C)
+#else
 #define API_HAL_KM_VERIFYCERTIFICATESIGNATURE_INDEX(0x000E)
+#endif
 
 static uint32_t secure_rom_call_args[5] __aligned(ARCH_DMA_MINALIGN);
 
-- 
2.11.0

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


[U-Boot] [PATCH] cmd: sata: fix init command return value

2017-01-11 Thread Gary Bisson
Since commit aa6ab905b2, sata_initialize returns -1 if init_sata or
scan_sata fails. But this return value becomes the do_sata return
value which is equivalent to CMD_RET_USAGE.

In case one issues 'sata init' and that the hardware fails to
initialize, there's no need to display the command usage. Instead
the command shoud just return the CMD_RET_FAILURE value.

Fixes: aa6ab905b2 (sata: fix sata command can not being executed bug)

Signed-off-by: Gary Bisson 
---
 cmd/sata.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmd/sata.c b/cmd/sata.c
index f56622acc2..4c53022ff6 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -28,14 +28,15 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
if (sata_curr_device != -1)
sata_stop();
 
-   return sata_initialize();
+   return (sata_initialize() < 0) ?
+   CMD_RET_FAILURE : CMD_RET_SUCCESS;
}
 
/* If the user has not yet run `sata init`, do it now */
if (sata_curr_device == -1) {
rc = sata_initialize();
if (rc == -1)
-   return rc;
+   return CMD_RET_FAILURE;
sata_curr_device = rc;
}
 
-- 
2.11.0

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


Re: [U-Boot] [PATCH v2 4/4] cmd: mem: Use memcpy for 'cp' command

2017-01-11 Thread Fabio Estevam
Hi Tom,

On Mon, Dec 19, 2016 at 8:09 PM, Tom Rini  wrote:
> On Thu, Dec 15, 2016 at 04:00:13PM -0200, Fabio Estevam wrote:
>
>> Simplify the 'cp' command implementation by using the memcpy() function,
>> which brings the additional benefit of performance gain for those who have
>> CONFIG_USE_ARCH_MEMCPY selected.
>>
>> Tested on a mx6qsabreauto board where a 5x gain in performance is seen
>> when reading 10MB from the parallel NOR memory.
>>
>> Signed-off-by: Fabio Estevam 
>> ---
>> Changes since v1:
>> - Always use memcpy()
>
> I feel like this is correct.  I also feel like it's too close to release
> to do this, so I'll be applying this shortly after release, thanks!

Is it a good time to apply this one now?

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


[U-Boot] [PATCH] SPL: Adjust more debug prints for ulong entry_point

2017-01-11 Thread Tom Rini
With entry_point now being an unsigned long we need to adapt the last
two debug prints to use %lX not %X.

Fixes: 11e1479b9e67 ("SPL: make struct spl_image 64-bit safe")
Signed-off-by: Tom Rini 
---
 arch/arm/imx-common/spl.c   | 2 +-
 board/freescale/common/fsl_chain_of_trust.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index c86b6f83b85c..60c4adf23751 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -101,7 +101,7 @@ __weak void __noreturn jump_to_image_no_args(struct 
spl_image_info *spl_image)
image_entry_noargs_t image_entry =
(image_entry_noargs_t)(unsigned long)spl_image->entry_point;
 
-   debug("image entry point: 0x%X\n", spl_image->entry_point);
+   debug("image entry point: 0x%lX\n", spl_image->entry_point);
 
/* HAB looks for the CSF at the end of the authenticated data therefore,
 * we need to subtract the size of the CSF from the actual filesize */
diff --git a/board/freescale/common/fsl_chain_of_trust.c 
b/board/freescale/common/fsl_chain_of_trust.c
index dea231b866fe..438e7819576f 100644
--- a/board/freescale/common/fsl_chain_of_trust.c
+++ b/board/freescale/common/fsl_chain_of_trust.c
@@ -151,7 +151,7 @@ void __noreturn jump_to_image_no_args(struct spl_image_info 
*spl_image)
 * may return back in case of non-fatal failures.
 */
 
-   debug("image entry point: 0x%X\n", spl_image->entry_point);
+   debug("image entry point: 0x%lX\n", spl_image->entry_point);
image_entry();
 }
 #endif /* ifdef CONFIG_SPL_FRAMEWORK */
-- 
1.9.1

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


[U-Boot] [PATCH v2 14/18] tools: kwbimage: Factor out add_binary_header_v1

2017-01-11 Thread Mario Six
In preparation of adding the creation of secure headers, we factor the
add_binary_header_v1 function out of the image_create_v1 function.

Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 tools/kwbimage.c | 146 ++-
 1 file changed, 79 insertions(+), 67 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 87587f8..6cd4c34 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -369,6 +369,7 @@ static size_t image_headersz_v1(int *hasext)
fprintf(stderr, "Increase CONFIG_SYS_U_BOOT_OFFS!\n");
return 0;
}
+
headersz = CONFIG_SYS_U_BOOT_OFFS;
 #endif

@@ -379,10 +380,85 @@ static size_t image_headersz_v1(int *hasext)
return ALIGN_SUP(headersz, 4096);
 }

+int add_binary_header_v1(uint8_t *cur)
+{
+   struct image_cfg_element *binarye;
+   struct opt_hdr_v1 *hdr = (struct opt_hdr_v1 *)cur;
+   uint32_t *args;
+   size_t binhdrsz;
+   struct stat s;
+   int argi;
+   FILE *bin;
+   int ret;
+
+   binarye = image_find_option(IMAGE_CFG_BINARY);
+
+   if (!binarye)
+   return 0;
+
+   hdr->headertype = OPT_HDR_V1_BINARY_TYPE;
+
+   bin = fopen(binarye->binary.file, "r");
+   if (!bin) {
+   fprintf(stderr, "Cannot open binary file %s\n",
+   binarye->binary.file);
+   return -1;
+   }
+
+   fstat(fileno(bin), );
+
+   binhdrsz = sizeof(struct opt_hdr_v1) +
+   (binarye->binary.nargs + 2) * sizeof(uint32_t) +
+   s.st_size;
+
+   /*
+* The size includes the binary image size, rounded
+* up to a 4-byte boundary. Plus 4 bytes for the
+* next-header byte and 3-byte alignment at the end.
+*/
+   binhdrsz = ALIGN_SUP(binhdrsz, 4) + 4;
+   hdr->headersz_lsb = cpu_to_le16(binhdrsz & 0x);
+   hdr->headersz_msb = (binhdrsz & 0x) >> 16;
+
+   cur += sizeof(struct opt_hdr_v1);
+
+   args = (uint32_t *)cur;
+   *args = cpu_to_le32(binarye->binary.nargs);
+   args++;
+   for (argi = 0; argi < binarye->binary.nargs; argi++)
+   args[argi] = cpu_to_le32(binarye->binary.args[argi]);
+
+   cur += (binarye->binary.nargs + 1) * sizeof(uint32_t);
+
+   ret = fread(cur, s.st_size, 1, bin);
+   if (ret != 1) {
+   fprintf(stderr,
+   "Could not read binary image %s\n",
+   binarye->binary.file);
+   return -1;
+   }
+
+   fclose(bin);
+
+   cur += ALIGN_SUP(s.st_size, 4);
+
+   /*
+* For now, we don't support more than one binary
+* header, and no other header types are
+* supported. So, the binary header is necessarily the
+* last one
+*/
+   *((uint32_t *)cur) = 0x;
+
+   cur += sizeof(uint32_t);
+
+   return 0;
+}
+
 static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
 int payloadsz)
 {
-   struct image_cfg_element *e, *binarye;
+   struct image_cfg_element *e;
struct main_hdr_v1 *main_hdr;
size_t headersz;
uint8_t *image, *cur;
@@ -434,72 +510,8 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
if (e)
main_hdr->flags = e->debug ? 0x1 : 0;

-   binarye = image_find_option(IMAGE_CFG_BINARY);
-   if (binarye) {
-   struct opt_hdr_v1 *hdr = (struct opt_hdr_v1 *)cur;
-   uint32_t *args;
-   size_t binhdrsz;
-   struct stat s;
-   int argi;
-   FILE *bin;
-   int ret;
-
-   hdr->headertype = OPT_HDR_V1_BINARY_TYPE;
-
-   bin = fopen(binarye->binary.file, "r");
-   if (!bin) {
-   fprintf(stderr, "Cannot open binary file %s\n",
-   binarye->binary.file);
-   return NULL;
-   }
-
-   fstat(fileno(bin), );
-
-   binhdrsz = sizeof(struct opt_hdr_v1) +
-   (binarye->binary.nargs + 2) * sizeof(uint32_t) +
-   s.st_size;
-
-   /*
-* The size includes the binary image size, rounded
-* up to a 4-byte boundary. Plus 4 bytes for the
-* next-header byte and 3-byte alignment at the end.
-*/
-   binhdrsz = ALIGN_SUP(binhdrsz, 4) + 4;
-   hdr->headersz_lsb = cpu_to_le16(binhdrsz & 0x);
-   hdr->headersz_msb = (binhdrsz & 0x) >> 16;
-
-   cur += sizeof(struct opt_hdr_v1);
-
-   args = (uint32_t *)cur;
-   *args = cpu_to_le32(binarye->binary.nargs);
-   args++;
-   for (argi = 0; argi < binarye->binary.nargs; argi++)
-   

Re: [U-Boot] [PATCH] serial, ns16550: bugfix: ns16550 fifo not enabled

2017-01-11 Thread Marek Vasut
On 01/10/2017 05:40 PM, Tom Rini wrote:
> On Tue, Jan 10, 2017 at 08:08:51AM +0100, Heiko Schocher wrote:
>> commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor"
>> breaks u-boot commandline working with long commands
>> sending to the board.
>>
>> Since the above patch, you have to setup the fcr register.
>>
>> For board/archs which enable OF_PLATDATA, the new field
>> fcr in struct ns16550_platdata is not filled with a
>> default value ...
>>
>> This leads in not setting up the uarts fifo, which ends
>> in problems, when you send long commands to u-boots
>> commandline.
>>
>> Detected this issue with automated tbot tests on am335x
>> based shc board.
>>
>> The error does not popup, if you type commands. You need
>> to copy a long command to u-boots commandshell
>> (or send a long command with tbot)
>>
>> Possible boards/plattforms with problems:
>> ./arch/arm/cpu/arm926ejs/lpc32xx/devices.c
>> ./arch/arm/mach-tegra/board.c
>> ./board/isee/igep00x0/igep00x0.c
>> ./board/overo/overo.c
>> ./board/quipos/cairo/cairo.c
>> ./board/logicpd/omap3som/omap3logic.c
>> ./board/logicpd/zoom1/zoom1.c
>> ./board/timll/devkit8000/devkit8000.c
>> ./board/lg/sniper/sniper.c
>> ./board/ti/beagle/beagle.c
>> ./drivers/serial/serial_rockchip.c
>>
>> This patch fixes only:
>> ./arch/arm/mach-omap2/am33xx/board.c
>>
>> Signed-off-by: Heiko Schocher 
> 
> Good find!  I didn't catch this in my setups as nothing in test.py is
> currently long enough to trigger this apparently (I have both an am335x
> evm and a beagleboard in my setup).  By inspection, the right fix for
> all platforms would be to put the old default value in as this is what
> was missed in the original patch from Marek.
> 
It was probably missed because this patch pre-dates the OF_PLATDATA
addition and was stuck in the ML for too long.

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


Re: [U-Boot] [PATCH 2/4] omap3_igep00x0: Rework MACH_TYPE and status LED logic slightly

2017-01-11 Thread Enric Balletbo Serra
2017-01-11 16:05 GMT+01:00 Tom Rini :
> On Wed, Jan 11, 2017 at 03:59:17PM +0100, Enric Balletbo Serra wrote:
>> 2017-01-10 23:22 GMT+01:00 Tom Rini :
>> > The MACH_TYPE for IGEP0032 was never officially used and has been
>> > removed from upstream, so we must not use it.  In order to remove this
>> > we need to rework the status LED logic.
>> >
>> > Cc: Enric Balletbo i Serra 
>> > Signed-off-by: Tom Rini 
>> > ---
>> >  configs/igep0032_defconfig   | 1 -
>> >  include/configs/omap3_igep00x0.h | 5 ++---
>> >  2 files changed, 2 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/configs/igep0032_defconfig b/configs/igep0032_defconfig
>> > index dad8dfaf0c22..cd48e45171cb 100644
>> > --- a/configs/igep0032_defconfig
>> > +++ b/configs/igep0032_defconfig
>> > @@ -3,7 +3,6 @@ CONFIG_OMAP34XX=y
>> >  # CONFIG_SPL_EXT_SUPPORT is not set
>> >  CONFIG_TARGET_OMAP3_IGEP00X0=y
>> >  CONFIG_DISTRO_DEFAULTS=y
>> > -CONFIG_SYS_EXTRA_OPTIONS="MACH_TYPE=MACH_TYPE_IGEP0032"
>> >  CONFIG_BOOTDELAY=3
>> >  CONFIG_SYS_CONSOLE_IS_IN_ENV=y
>> >  CONFIG_SYS_CONSOLE_INFO_QUIET=y
>> > diff --git a/include/configs/omap3_igep00x0.h 
>> > b/include/configs/omap3_igep00x0.h
>> > index 30d3aa897f1b..e6d7db0da692 100644
>> > --- a/include/configs/omap3_igep00x0.h
>> > +++ b/include/configs/omap3_igep00x0.h
>> > @@ -28,7 +28,8 @@
>> >  #define CONFIG_REVISION_TAG1
>> >
>> >  /* Status LED available for IGEP0020 and IGEP0030 but not IGEP0032 */
>> > -#if (CONFIG_MACH_TYPE != MACH_TYPE_IGEP0032)
>> > +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020) || \
>> > +  (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)
>> >  #define CONFIG_STATUS_LED
>> >  #define CONFIG_BOARD_SPECIFIC_LED
>> >  #define CONFIG_GPIO_LED
>> > @@ -36,8 +37,6 @@
>> >  #define RED_LED_GPIO 27
>> >  #elif (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)
>> >  #define RED_LED_GPIO 16
>> > -#else
>> > -#error "status LED not defined for this 
>> > machine."drivers/iio/common/cros_ec_sensors/Makefile
>> >  #endif
>> >  #define RED_LED_DEV0
>> >  #define STATUS_LED_BIT RED_LED_GPIO
>> > --
>> > 1.9.1
>> >
>>
>> cc: Eduard and Pau
>>
>> I think that there are few boards in the field, an seems that anyone
>> take care to upstream the dts files to the kernel. Currently I don't
>> have this board so I can't support it, so from my side
>>
>> Acked-by: Enric Balletbo i Serra 
>
> Note that all the above patch does is remove ATAGS-based support as the
> MACH_TYPE for the 0032 was reserved, but never used and thus the name
> was removed.  DT based support is unchanged.
>
> --
> Tom

Yes, I saw it, thus my ack ... I just wondering if this board is
really used and if we should completely remove it or not. Sorry for
not having better explained
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 17/18] arm: mvebu: Add gdsys ControlCenter-Compact board

2017-01-11 Thread Mario Six
From: Dirk Eibach 

The gdsys ControlCenter Digital board is based on a Marvell Armada 38x
SOC.

It boots from SPI-Flash but can be configured to boot from SD-card for
factory programming and testing.

On board peripherals include:
- 2 x GbE
- Xilinx Kintex-7 FPGA connected via PCIe
- mSATA
- USB3 host
- Atmel TPM

Signed-off-by: Dirk Eibach 
Signed-off-by: Mario Six 
---
Changes in v2:

* Renamed DTS and board name to include armada-38x
* Renamed 38x directory to a38x
* Removed leftover dummy test Kconfig variable from board/gdsys/38x/Kconfig
* Removed unneeded check for build target in board/gdsys/38x/Makefile
* Removed duplicated board/gdsys/38x/README
* Switched MIIPHY to new GPIO API
* Removed checkboard function
* Fixed multi-line comment in board/gdsys/controlcenterdc.c
* Switched to usage of ARRAY_SIZE in board/gdsys/controlcenterdc.c
* Factored out hydra.{c,h} and ihs_phys.{c,h} from
  board/gdsys/controlcenterdc.c and removed ifdefs
* Removed unaddressed TODO from HRE
---
 arch/arm/Kconfig|   1 +
 arch/arm/dts/Makefile   |   3 +-
 arch/arm/dts/armada-38x-controlcenterdc.dts | 643 
 arch/arm/mach-mvebu/Kconfig |   4 +
 board/gdsys/a38x/.gitignore |   1 +
 board/gdsys/a38x/Kconfig|  36 ++
 board/gdsys/a38x/MAINTAINERS|   7 +
 board/gdsys/a38x/Makefile   |  44 ++
 board/gdsys/a38x/controlcenterdc.c  | 273 
 board/gdsys/a38x/dt_helpers.c   |  25 ++
 board/gdsys/a38x/dt_helpers.h   |  14 +
 board/gdsys/a38x/hre.c  | 516 ++
 board/gdsys/a38x/hre.h  |  38 ++
 board/gdsys/a38x/hydra.c| 138 ++
 board/gdsys/a38x/hydra.h|  14 +
 board/gdsys/a38x/ihs_phys.c | 349 +++
 board/gdsys/a38x/ihs_phys.h |   2 +
 board/gdsys/a38x/keyprogram.c   | 158 +++
 board/gdsys/a38x/keyprogram.h   |  14 +
 board/gdsys/a38x/kwbimage.cfg.in|  12 +
 board/gdsys/a38x/spl.c  |  21 +
 configs/controlcenterdc_defconfig   |  57 +++
 include/configs/controlcenterdc.h   | 235 ++
 23 files changed, 2604 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/armada-38x-controlcenterdc.dts
 create mode 100644 board/gdsys/a38x/.gitignore
 create mode 100644 board/gdsys/a38x/Kconfig
 create mode 100644 board/gdsys/a38x/MAINTAINERS
 create mode 100644 board/gdsys/a38x/Makefile
 create mode 100644 board/gdsys/a38x/controlcenterdc.c
 create mode 100644 board/gdsys/a38x/dt_helpers.c
 create mode 100644 board/gdsys/a38x/dt_helpers.h
 create mode 100644 board/gdsys/a38x/hre.c
 create mode 100644 board/gdsys/a38x/hre.h
 create mode 100644 board/gdsys/a38x/hydra.c
 create mode 100644 board/gdsys/a38x/hydra.h
 create mode 100644 board/gdsys/a38x/ihs_phys.c
 create mode 100644 board/gdsys/a38x/ihs_phys.h
 create mode 100644 board/gdsys/a38x/keyprogram.c
 create mode 100644 board/gdsys/a38x/keyprogram.h
 create mode 100644 board/gdsys/a38x/kwbimage.cfg.in
 create mode 100644 board/gdsys/a38x/spl.c
 create mode 100644 configs/controlcenterdc_defconfig
 create mode 100644 include/configs/controlcenterdc.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0ed36cd..3ddc4c2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1028,6 +1028,7 @@ source "board/freescale/mx53loco/Kconfig"
 source "board/freescale/mx53smd/Kconfig"
 source "board/freescale/s32v234evb/Kconfig"
 source "board/freescale/vf610twr/Kconfig"
+source "board/gdsys/a38x/Kconfig"
 source "board/gumstix/pepper/Kconfig"
 source "board/h2200/Kconfig"
 source "board/hisilicon/hikey/Kconfig"
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3ee608b..75632d8 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -79,7 +79,8 @@ dtb-$(CONFIG_ARCH_MVEBU) +=   \
armada-xp-gp.dtb\
armada-xp-maxbcm.dtb\
armada-xp-synology-ds414.dtb\
-   armada-xp-theadorable.dtb
+   armada-xp-theadorable.dtb   \
+   armada-38x-controlcenterdc.dtb

 dtb-$(CONFIG_ARCH_UNIPHIER) += \
uniphier-ld11-ref.dtb \
diff --git a/arch/arm/dts/armada-38x-controlcenterdc.dts 
b/arch/arm/dts/armada-38x-controlcenterdc.dts
new file mode 100644
index 000..36f65c3
--- /dev/null
+++ b/arch/arm/dts/armada-38x-controlcenterdc.dts
@@ -0,0 +1,643 @@
+/*
+ * Device Tree file for the Guntermann & Drunck ControlCenter-Compact board
+ *
+ * Copyright (C) 2016 Mario Six 
+ *
+ * based on the Device Tree file for Marvell Armada 388 evaluation board
+ * (DB-88F6820), which is
+ *
+ * Copyright (C) 2014 Marvell
+ *
+ * Thomas Petazzoni 

Re: [U-Boot] [PATCH 2/4] omap3_igep00x0: Rework MACH_TYPE and status LED logic slightly

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 03:59:17PM +0100, Enric Balletbo Serra wrote:
> 2017-01-10 23:22 GMT+01:00 Tom Rini :
> > The MACH_TYPE for IGEP0032 was never officially used and has been
> > removed from upstream, so we must not use it.  In order to remove this
> > we need to rework the status LED logic.
> >
> > Cc: Enric Balletbo i Serra 
> > Signed-off-by: Tom Rini 
> > ---
> >  configs/igep0032_defconfig   | 1 -
> >  include/configs/omap3_igep00x0.h | 5 ++---
> >  2 files changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/configs/igep0032_defconfig b/configs/igep0032_defconfig
> > index dad8dfaf0c22..cd48e45171cb 100644
> > --- a/configs/igep0032_defconfig
> > +++ b/configs/igep0032_defconfig
> > @@ -3,7 +3,6 @@ CONFIG_OMAP34XX=y
> >  # CONFIG_SPL_EXT_SUPPORT is not set
> >  CONFIG_TARGET_OMAP3_IGEP00X0=y
> >  CONFIG_DISTRO_DEFAULTS=y
> > -CONFIG_SYS_EXTRA_OPTIONS="MACH_TYPE=MACH_TYPE_IGEP0032"
> >  CONFIG_BOOTDELAY=3
> >  CONFIG_SYS_CONSOLE_IS_IN_ENV=y
> >  CONFIG_SYS_CONSOLE_INFO_QUIET=y
> > diff --git a/include/configs/omap3_igep00x0.h 
> > b/include/configs/omap3_igep00x0.h
> > index 30d3aa897f1b..e6d7db0da692 100644
> > --- a/include/configs/omap3_igep00x0.h
> > +++ b/include/configs/omap3_igep00x0.h
> > @@ -28,7 +28,8 @@
> >  #define CONFIG_REVISION_TAG1
> >
> >  /* Status LED available for IGEP0020 and IGEP0030 but not IGEP0032 */
> > -#if (CONFIG_MACH_TYPE != MACH_TYPE_IGEP0032)
> > +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020) || \
> > +  (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)
> >  #define CONFIG_STATUS_LED
> >  #define CONFIG_BOARD_SPECIFIC_LED
> >  #define CONFIG_GPIO_LED
> > @@ -36,8 +37,6 @@
> >  #define RED_LED_GPIO 27
> >  #elif (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)
> >  #define RED_LED_GPIO 16
> > -#else
> > -#error "status LED not defined for this machine."
> >  #endif
> >  #define RED_LED_DEV0
> >  #define STATUS_LED_BIT RED_LED_GPIO
> > --
> > 1.9.1
> >
> 
> cc: Eduard and Pau
> 
> I think that there are few boards in the field, an seems that anyone
> take care to upstream the dts files to the kernel. Currently I don't
> have this board so I can't support it, so from my side
> 
> Acked-by: Enric Balletbo i Serra 

Note that all the above patch does is remove ATAGS-based support as the
MACH_TYPE for the 0032 was reserved, but never used and thus the name
was removed.  DT based support is unchanged.

-- 
Tom


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


[U-Boot] [PATCH v2 03/18] mvebu: Add board_pex_config()

2017-01-11 Thread Mario Six
Allow boards to do some initialization when PCIe comes up.

Signed-off-by: Dirk Eibach 
Signed-off-by: Mario Six 
---
Changes in v2:

* Switched usage of __attribute(...) to __weak to simplify weak function
  declaration
---
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 8 
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c 
b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
index 98c447c..9e5b647 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
+++ b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
@@ -13,6 +13,11 @@
 #include "ctrl_pex.h"
 #include "sys_env_lib.h"

+__weak void board_pex_config(void)
+{
+   /* nothing in this weak default implementation */
+}
+
 int hws_pex_config(const struct serdes_map *serdes_map, u8 count)
 {
u32 pex_idx, tmp, next_busno, first_busno, temp_pex_reg,
@@ -77,6 +82,9 @@ int hws_pex_config(const struct serdes_map *serdes_map, u8 
count)

/* Support gen1/gen2 */
DEBUG_INIT_FULL_S("Support gen1/gen2\n");
+
+   board_pex_config();
+
next_busno = 0;
mdelay(150);

diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h 
b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
index 5f7e2c7..ca8a4d2 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
+++ b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
@@ -83,4 +83,6 @@ int pex_local_bus_num_set(u32 pex_if, u32 bus_num);
 int pex_local_dev_num_set(u32 pex_if, u32 dev_num);
 u32 pex_config_read(u32 pex_if, u32 bus, u32 dev, u32 func, u32 reg_off);

+void board_pex_config(void);
+
 #endif
--
2.9.0

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


[U-Boot] [PATCH v2 16/18] arm: mvebu: Implement secure boot

2017-01-11 Thread Mario Six
The patch implements secure booting for the mvebu architecture.

This includes:
- The addition of secure headers and all needed signatures and keys in
  mkimage
- Commands capable of writing the board's efuses to both write the
  needed cryptographic data and enable the secure booting mechanism
- The creation of convenience text files containing the necessary
  commands to write the efuses

The KAK and CSK keys are expected to reside in the files kwb_kak.key and
kwb_csk.key (OpenSSL 2048 bit private keys) in the top-level directory.

Signed-off-by: Reinhard Pfau 
Signed-off-by: Mario Six 
---
Changes in v2:

* Added help text for MVEBU_EFUSE
* Removed superfluous defined(CONFIG_MVEBU_EFUSE) from
  arch/arm/mach-mvebu/Makefile
* Rewrote disable_efuse_program to use clrbits_le32
* Remove superfluous blank lines from arch/arm/mach-mvebu/include/mach/efuse.h
---
 Makefile |   3 +-
 arch/arm/mach-mvebu/Kconfig  |  35 ++
 arch/arm/mach-mvebu/Makefile |   1 +
 arch/arm/mach-mvebu/efuse.c  | 264 +++
 arch/arm/mach-mvebu/include/mach/cpu.h   |   2 +
 arch/arm/mach-mvebu/include/mach/efuse.h |  69 +++
 doc/README.armada-secureboot | 373 
 tools/Makefile   |   6 +-
 tools/kwbimage.c | 744 ++-
 tools/kwbimage.h |  37 ++
 10 files changed, 1526 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/mach-mvebu/efuse.c
 create mode 100644 arch/arm/mach-mvebu/include/mach/efuse.h
 create mode 100644 doc/README.armada-secureboot

diff --git a/Makefile b/Makefile
index adc333f..6bd2158 100644
--- a/Makefile
+++ b/Makefile
@@ -957,7 +957,8 @@ MKIMAGEFLAGS_u-boot.kwb = -n 
$(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)

 MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
-   -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
+   -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
+   $(if $(KEYDIR),-k $(KEYDIR))

 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 40476dc..c9609fb 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -1,5 +1,9 @@
 if ARCH_MVEBU

+config HAVE_MVEBU_EFUSE
+   bool
+   default n
+
 config ARMADA_32BIT
bool
select CPU_V7
@@ -21,6 +25,7 @@ config ARMADA_375
 config ARMADA_38X
bool
select ARMADA_32BIT
+   select HAVE_MVEBU_EFUSE

 config ARMADA_XP
bool
@@ -142,4 +147,34 @@ config SYS_VENDOR
 config SYS_SOC
default "mvebu"

+config MVEBU_EFUSE
+   bool "Enable eFuse support"
+   default n
+   depends on HAVE_MVEBU_EFUSE
+   help
+ Enable support for reading and writing eFuses on mvebu SoCs.
+
+config MVEBU_EFUSE_FAKE
+   bool "Fake eFuse access (dry run)"
+   default n
+   depends on MVEBU_EFUSE
+   help
+ This enables a "dry run" mode where eFuses are not really programmed.
+ Instead the eFuse accesses are emulated by writing to and reading
+ from a memory block.
+ This is can be used for testing prog scripts.
+
+config SECURED_MODE_IMAGE
+   bool "Build image for trusted boot"
+   default false
+   depends on 88F6820
+   help
+ Build an image that employs the ARMADA SoC's trusted boot framework
+ for securely booting images.
+
+config SECURED_MODE_CSK_INDEX
+   int "Index of active CSK"
+   default 0
+   depends on SECURED_MODE_IMAGE
+
 endif
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 65e90c4..d4210af 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -27,6 +27,7 @@ ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_ARMADA_375) += ../../../drivers/ddr/marvell/axp/xor.o
 obj-$(CONFIG_ARMADA_38X) += ../../../drivers/ddr/marvell/a38x/xor.o
 obj-$(CONFIG_ARMADA_XP) += ../../../drivers/ddr/marvell/axp/xor.o
+obj-$(CONFIG_MVEBU_EFUSE) += efuse.o
 endif # CONFIG_SPL_BUILD
 obj-y  += gpio.o
 obj-y  += mbus.o
diff --git a/arch/arm/mach-mvebu/efuse.c b/arch/arm/mach-mvebu/efuse.c
new file mode 100644
index 000..67fcadc
--- /dev/null
+++ b/arch/arm/mach-mvebu/efuse.c
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2015-2016 Reinhard Pfau 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#if defined(CONFIG_MVEBU_EFUSE_FAKE)
+#define DRY_RUN
+#else
+#undef DRY_RUN
+#endif
+
+#define MBUS_EFUSE_BASE 0xF600
+#define MBUS_EFUSE_SIZE BIT(20)
+
+#define MVEBU_EFUSE_CONTROL 

[U-Boot] [PATCH v2 12/18] tools: kwbimage: Reduce scope of variables

2017-01-11 Thread Mario Six
This patch reduces the scope of some variables.

Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 tools/kwbimage.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index edc5d34..4fd9389 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -230,7 +230,6 @@ static void *image_create_v0(size_t *imagesz, struct 
image_tool_params *params,
struct image_cfg_element *e;
size_t headersz;
struct main_hdr_v0 *main_hdr;
-   struct ext_hdr_v0 *ext_hdr;
uint8_t *image;
int has_ext = 0;

@@ -282,6 +281,7 @@ static void *image_create_v0(size_t *imagesz, struct 
image_tool_params *params,

/* Generate the ext header */
if (has_ext) {
+   struct ext_hdr_v0 *ext_hdr;
int cfgi, datai;

ext_hdr = (struct ext_hdr_v0 *)
@@ -313,7 +313,6 @@ static size_t image_headersz_v1(struct image_tool_params 
*params,
 {
struct image_cfg_element *binarye;
size_t headersz;
-   int ret;

/*
 * Calculate the size of the header and the size of the
@@ -333,6 +332,7 @@ static size_t image_headersz_v1(struct image_tool_params 
*params,

binarye = image_find_option(IMAGE_CFG_BINARY);
if (binarye) {
+   int ret;
struct stat s;

ret = stat(binarye->binary.file, );
@@ -388,7 +388,6 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
size_t headersz;
uint8_t *image, *cur;
int hasext = 0;
-   int ret;

/*
 * Calculate the size of the header and the size of the
@@ -444,6 +443,7 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
struct stat s;
int argi;
FILE *bin;
+   int ret;

hdr->headertype = OPT_HDR_V1_BINARY_TYPE;

@@ -818,7 +818,6 @@ static int kwbimage_verify_header(unsigned char *ptr, int 
image_size,
  struct image_tool_params *params)
 {
struct main_hdr_v0 *main_hdr;
-   struct ext_hdr_v0 *ext_hdr;
uint8_t checksum;

main_hdr = (struct main_hdr_v0 *)ptr;
@@ -830,6 +829,8 @@ static int kwbimage_verify_header(unsigned char *ptr, int 
image_size,

/* Only version 0 extended header has checksum */
if (image_version((void *)ptr) == 0) {
+   struct ext_hdr_v0 *ext_hdr;
+
ext_hdr = (struct ext_hdr_v0 *)
(ptr + sizeof(struct main_hdr_v0));
checksum = image_checksum8(ext_hdr,
--
2.9.0

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


[U-Boot] [PATCH v2 18/18] controlcenterdc: Make secure boot available

2017-01-11 Thread Mario Six
Make secure booting available for the controlcenterdc
board (disabled by default).

Signed-off-by: Reinhard Pfau 
Signed-off-by: Mario Six 
---
Changes in v2:

* Moved definition and interpretation of SECURED_MODE_IMAGE and
  SECURED_MODE_CSK_INDEX to previous patch
---
 board/gdsys/a38x/kwbimage.cfg.in | 28 
 1 file changed, 28 insertions(+)

diff --git a/board/gdsys/a38x/kwbimage.cfg.in b/board/gdsys/a38x/kwbimage.cfg.in
index 72e67d7..ebb3d32 100644
--- a/board/gdsys/a38x/kwbimage.cfg.in
+++ b/board/gdsys/a38x/kwbimage.cfg.in
@@ -1,5 +1,6 @@
 #
 # Copyright (C) 2014 Stefan Roese 
+# Copyright (C) 2015-2016 Reinhard Pfau 
 #

 # Armada 38x uses version 1 image format
@@ -10,3 +11,30 @@ VERSION  1

 # Binary Header (bin_hdr) with DDR3 training code
 BINARY spl/u-boot-spl.bin 005b 0068
+
+# Name of KAK
+KAKkwb_kak
+
+# Name of (active) CSK
+CSKkwb_csk
+
+# BoxID
+BOX_ID 0x1
+
+# FlashID
+FLASH_ID 0x1
+
+# JTAG delay
+JTAG_DELAY 5
+
+# active CSK index
+#@CSK_INDEX
+
+# whether to encode box ID and flash ID into image
+#SEC_SPECIALIZED_IMG
+
+# secured mode boot device
+#@SEC_BOOT_DEV
+
+# secured mode: dump fuse commands
+#@SEC_FUSE_DUMP
--
2.9.0

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


[U-Boot] [PATCH v2 11/18] tools: kwbimage: Fix arithmetic with void pointers

2017-01-11 Thread Mario Six
Arithmetic with void pointers, e.g. a - b where both a and b are void
pointers, is undefined in the C standard. Since we are operating with
byte data here, we switch the void pointers to uint8_t pointers, and add
the necessary casts.

Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 tools/kwbimage.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 0e7c96a..edc5d34 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -231,7 +231,7 @@ static void *image_create_v0(size_t *imagesz, struct 
image_tool_params *params,
size_t headersz;
struct main_hdr_v0 *main_hdr;
struct ext_hdr_v0 *ext_hdr;
-   void *image;
+   uint8_t *image;
int has_ext = 0;

/*
@@ -258,7 +258,7 @@ static void *image_create_v0(size_t *imagesz, struct 
image_tool_params *params,

memset(image, 0, headersz);

-   main_hdr = image;
+   main_hdr = (struct main_hdr_v0 *)image;

/* Fill in the main header */
main_hdr->blocksize =
@@ -284,7 +284,8 @@ static void *image_create_v0(size_t *imagesz, struct 
image_tool_params *params,
if (has_ext) {
int cfgi, datai;

-   ext_hdr = image + sizeof(struct main_hdr_v0);
+   ext_hdr = (struct ext_hdr_v0 *)
+   (image + sizeof(struct main_hdr_v0));
ext_hdr->offset = cpu_to_le32(0x40);

for (cfgi = 0, datai = 0; cfgi < cfgn; cfgi++) {
@@ -385,7 +386,7 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
struct image_cfg_element *e, *binarye;
struct main_hdr_v1 *main_hdr;
size_t headersz;
-   void *image, *cur;
+   uint8_t *image, *cur;
int hasext = 0;
int ret;

@@ -405,8 +406,8 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,

memset(image, 0, headersz);

-   cur = main_hdr = image;
-   cur += sizeof(struct main_hdr_v1);
+   main_hdr = (struct main_hdr_v1 *)image;
+   cur = image + sizeof(struct main_hdr_v1);

/* Fill the main header */
main_hdr->blocksize=
@@ -437,7 +438,7 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,

binarye = image_find_option(IMAGE_CFG_BINARY);
if (binarye) {
-   struct opt_hdr_v1 *hdr = cur;
+   struct opt_hdr_v1 *hdr = (struct opt_hdr_v1 *)cur;
uint32_t *args;
size_t binhdrsz;
struct stat s;
@@ -470,7 +471,7 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,

cur += sizeof(struct opt_hdr_v1);

-   args = cur;
+   args = (uint32_t *)cur;
*args = cpu_to_le32(binarye->binary.nargs);
args++;
for (argi = 0; argi < binarye->binary.nargs; argi++)
@@ -820,7 +821,7 @@ static int kwbimage_verify_header(unsigned char *ptr, int 
image_size,
struct ext_hdr_v0 *ext_hdr;
uint8_t checksum;

-   main_hdr = (void *)ptr;
+   main_hdr = (struct main_hdr_v0 *)ptr;
checksum = image_checksum8(ptr,
   sizeof(struct main_hdr_v0)
   - sizeof(uint8_t));
@@ -829,7 +830,8 @@ static int kwbimage_verify_header(unsigned char *ptr, int 
image_size,

/* Only version 0 extended header has checksum */
if (image_version((void *)ptr) == 0) {
-   ext_hdr = (void *)ptr + sizeof(struct main_hdr_v0);
+   ext_hdr = (struct ext_hdr_v0 *)
+   (ptr + sizeof(struct main_hdr_v0));
checksum = image_checksum8(ext_hdr,
   sizeof(struct ext_hdr_v0)
   - sizeof(uint8_t));
--
2.9.0

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


[U-Boot] [PATCH v2 15/18] tools: kwbimage: Refactor line parsing and fix error

2017-01-11 Thread Mario Six
The function image_create_config_parse_oneline is pretty complex, and
since more parameters will be added to support secure booting, we
refactor the function to make it more readable.

Also, when a line contained just a keyword without any parameters,
strtok_r returned NULL, which was then indiscriminately fed into atoi,
causing a segfault. To correct this, we add a NULL check before feeding
the extracted token to atoi, and print an error message in case the
token is NULL.

Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 tools/kwbimage.c | 177 +--
 1 file changed, 106 insertions(+), 71 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 6cd4c34..9aa9c74 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -55,22 +55,43 @@ struct nand_ecc_mode nand_ecc_modes[] = {
 #define BINARY_MAX_ARGS 8

 /* In-memory representation of a line of the configuration file */
+
+enum image_cfg_type {
+   IMAGE_CFG_VERSION = 0x1,
+   IMAGE_CFG_BOOT_FROM,
+   IMAGE_CFG_DEST_ADDR,
+   IMAGE_CFG_EXEC_ADDR,
+   IMAGE_CFG_NAND_BLKSZ,
+   IMAGE_CFG_NAND_BADBLK_LOCATION,
+   IMAGE_CFG_NAND_ECC_MODE,
+   IMAGE_CFG_NAND_PAGESZ,
+   IMAGE_CFG_BINARY,
+   IMAGE_CFG_PAYLOAD,
+   IMAGE_CFG_DATA,
+   IMAGE_CFG_BAUDRATE,
+   IMAGE_CFG_DEBUG,
+
+   IMAGE_CFG_COUNT
+} type;
+
+static const char * const id_strs[] = {
+   [IMAGE_CFG_VERSION] = "VERSION",
+   [IMAGE_CFG_BOOT_FROM] = "BOOT_FROM",
+   [IMAGE_CFG_DEST_ADDR] = "DEST_ADDR",
+   [IMAGE_CFG_EXEC_ADDR] = "EXEC_ADDR",
+   [IMAGE_CFG_NAND_BLKSZ] = "NAND_BLKSZ",
+   [IMAGE_CFG_NAND_BADBLK_LOCATION] = "NAND_BADBLK_LOCATION",
+   [IMAGE_CFG_NAND_ECC_MODE] = "NAND_ECC_MODE",
+   [IMAGE_CFG_NAND_PAGESZ] = "NAND_PAGE_SIZE",
+   [IMAGE_CFG_BINARY] = "BINARY",
+   [IMAGE_CFG_PAYLOAD] = "PAYLOAD",
+   [IMAGE_CFG_DATA] = "DATA",
+   [IMAGE_CFG_BAUDRATE] = "BAUDRATE",
+   [IMAGE_CFG_DEBUG] = "DEBUG",
+};
+
 struct image_cfg_element {
-   enum {
-   IMAGE_CFG_VERSION = 0x1,
-   IMAGE_CFG_BOOT_FROM,
-   IMAGE_CFG_DEST_ADDR,
-   IMAGE_CFG_EXEC_ADDR,
-   IMAGE_CFG_NAND_BLKSZ,
-   IMAGE_CFG_NAND_BADBLK_LOCATION,
-   IMAGE_CFG_NAND_ECC_MODE,
-   IMAGE_CFG_NAND_PAGESZ,
-   IMAGE_CFG_BINARY,
-   IMAGE_CFG_PAYLOAD,
-   IMAGE_CFG_DATA,
-   IMAGE_CFG_BAUDRATE,
-   IMAGE_CFG_DEBUG,
-   } type;
+   enum image_cfg_type type;
union {
unsigned int version;
unsigned int bootfrom;
@@ -520,78 +541,94 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
return image;
 }

+int recognize_keyword(char *keyword)
+{
+   int kw_id;
+
+   for (kw_id = 1; kw_id < IMAGE_CFG_COUNT; ++kw_id)
+   if (!strcmp(keyword, id_strs[kw_id]))
+   return kw_id;
+
+   return 0;
+}
+
 static int image_create_config_parse_oneline(char *line,
 struct image_cfg_element *el)
 {
-   char *keyword, *saveptr;
-   char deliminiters[] = " \t";
+   char *keyword, *saveptr, *value1, *value2;
+   char delimiters[] = " \t";
+   int keyword_id, ret, argi;
+   char *unknown_msg = "Ignoring unknown line '%s'\n";

-   keyword = strtok_r(line, deliminiters, );
-   if (!strcmp(keyword, "VERSION")) {
-   char *value = strtok_r(NULL, deliminiters, );
+   keyword = strtok_r(line, delimiters, );
+   keyword_id = recognize_keyword(keyword);

-   el->type = IMAGE_CFG_VERSION;
-   el->version = atoi(value);
-   } else if (!strcmp(keyword, "BOOT_FROM")) {
-   char *value = strtok_r(NULL, deliminiters, );
-   int ret = image_boot_mode_id(value);
+   if (!keyword_id) {
+   fprintf(stderr, unknown_msg, line);
+   return 0;
+   }
+
+   el->type = keyword_id;
+
+   value1 = strtok_r(NULL, delimiters, );
+
+   if (!value1) {
+   fprintf(stderr, "Parameter missing in line '%s'\n", line);
+   return -1;
+   }
+
+   switch (keyword_id) {
+   case IMAGE_CFG_VERSION:
+   el->version = atoi(value1);
+   break;
+   case IMAGE_CFG_BOOT_FROM:
+   ret = image_boot_mode_id(value1);

if (ret < 0) {
-   fprintf(stderr,
-   "Invalid boot media '%s'\n", value);
+   fprintf(stderr, "Invalid boot media '%s'\n", value1);
return -1;
}
-   el->type = IMAGE_CFG_BOOT_FROM;
el->bootfrom = ret;
-   } else if (!strcmp(keyword, "NAND_BLKSZ")) {
-   char *value = strtok_r(NULL, 

[U-Boot] [PATCH v2 05/18] dm: Add callback to modify the device tree

2017-01-11 Thread Mario Six
Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six 
---
Changes in v2:

* Switched from usage of globally writeable global data pointer to a locally
  writeable pointer passed to board_fix_fdt
* Added comments for board_fix_fdt in include/common.h
* Added documentation for pre-relocation device tree manipulation
---
 common/board_f.c   |  10 
 doc/driver-model/fdt-fixup.txt | 132 +
 dts/Kconfig|  10 
 include/common.h   |   1 +
 4 files changed, 153 insertions(+)
 create mode 100644 doc/driver-model/fdt-fixup.txt

diff --git a/common/board_f.c b/common/board_f.c
index cc8aee7..e877bf9 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -767,6 +767,13 @@ static int setup_reloc(void)
return 0;
 }

+#ifdef CONFIG_OF_BOARD_FIXUP
+static int fix_fdt(void)
+{
+   return board_fix_fdt((void *)gd->fdt_blob);
+}
+#endif
+
 /* ARM calls relocate_code from its crt0.S */
 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)

@@ -1037,6 +1044,9 @@ static init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_SYS_EXTBDINFO
setup_board_extra,
 #endif
+#ifdef CONFIG_OF_BOARD_FIXUP
+   fix_fdt,
+#endif
INIT_FUNC_WATCHDOG_RESET
reloc_fdt,
setup_reloc,
diff --git a/doc/driver-model/fdt-fixup.txt b/doc/driver-model/fdt-fixup.txt
new file mode 100644
index 000..70344bd
--- /dev/null
+++ b/doc/driver-model/fdt-fixup.txt
@@ -0,0 +1,132 @@
+Pre-relocation device tree manipulation
+===
+
+Contents:
+
+1. Purpose
+2. Implementation
+3. Example
+4. Work to be done
+
+1. Purpose
+--
+
+In certain markets, it is beneficial for manufacturers of embedded devices to
+offer certain ranges of products, where the functionality of the devices within
+one series either don't differ greatly from another, or can be thought of as
+"extensions" of each other, where one device only differs from another in the
+addition of a small number of features (e.g. an additional output connector).
+
+To realize this in hardware, one method is to have a motherboard, and several
+possible daughter boards that can be attached to this mother board. Different
+daughter boards then either offer the slightly different functionality, or the
+addition of the daughter board to the device realizes the "extension" of
+functionality to the device described previously.
+
+For the software, we obviously want to reuse components for all these
+variations of the device. This means that the software somehow needs to cope
+with the situation that certain ICs may or may not be present on any given
+system, depending on which daughter boards are connected to the motherboard.
+
+In the Linux kernel, one possible solution to this problem is to employ the
+device tree overlay mechanism: There exists one "base" device tree, which
+features only the components guaranteed to exist in all varieties of the
+device. At the start of the kernel, the presence and type of the daughter
+boards is then detected, and the corresponding device tree overlays are applied
+to support the components on the daughter boards.
+
+Note that the components present on every variety of the board must, of course,
+provide a way to find out if and which daughter boards are installed for this
+mechanism to work.
+
+In the U-Boot boot loader, support for device tree overlays has recently been
+integrated, and is used on some boards to alter the device tree that is later
+passed to Linux. But since U-Boot's driver model, which is device tree-based as
+well, is being used in more and more drivers, the same problem of altering the
+device tree starts cropping up in U-Boot itself as well.
+
+An additional problem with the device tree in U-Boot is that it is read-only,
+and the current mechanisms don't allow easy manipulation of the device tree
+after the driver model has been initialized. While migrating to a live device
+tree (at least after the relocation) would greatly simplify the solution of
+this problem, it is a non-negligible task to implement it, an a interim

[U-Boot] [PATCH v2 09/18] tools: kwbimage: Fix dest addr

2017-01-11 Thread Mario Six
To enable secure boot, we need to jump back into the BootROM to continue
the SoC's boot process instead of letting the SPL load and run the main
U-Boot image.

But, since the u-boot-spl.img (including the 64 byte header) is loaded
by the SoC as the main image, we need to compensate for the header
length to get a correct entry point.

Thus, we subtract the header size from the destination address, so that
the execution address points at the actual entry point of the image.

The current boards ignore both parameters anyway, so this change shouldn't
concern them.

Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 tools/kwbimage.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 69844d9..e04d319 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -410,7 +410,8 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
cpu_to_le32(payloadsz - headersz + sizeof(uint32_t));
main_hdr->headersz_lsb = cpu_to_le16(headersz & 0x);
main_hdr->headersz_msb = (headersz & 0x) >> 16;
-   main_hdr->destaddr = cpu_to_le32(params->addr);
+   main_hdr->destaddr = cpu_to_le32(params->addr)
+- sizeof(image_header_t);
main_hdr->execaddr = cpu_to_le32(params->ep);
main_hdr->srcaddr  = cpu_to_le32(headersz);
main_hdr->ext  = hasext;
--
2.9.0

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


[U-Boot] [PATCH v2 10/18] tools: kwbimage: Fix style violations

2017-01-11 Thread Mario Six
Fix some style violations:

- nine instances of missing blank lines after declarations
- one overly long line
- one split string (which also rewords an error message more concisely)
- two superfluous else

Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 tools/kwbimage.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index e04d319..0e7c96a 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -103,6 +103,7 @@ struct image_cfg_element {
 static const char *image_boot_mode_name(unsigned int id)
 {
int i;
+
for (i = 0; boot_modes[i].name; i++)
if (boot_modes[i].id == id)
return boot_modes[i].name;
@@ -112,6 +113,7 @@ static const char *image_boot_mode_name(unsigned int id)
 int image_boot_mode_id(const char *boot_mode_name)
 {
int i;
+
for (i = 0; boot_modes[i].name; i++)
if (!strcmp(boot_modes[i].name, boot_mode_name))
return boot_modes[i].id;
@@ -122,6 +124,7 @@ int image_boot_mode_id(const char *boot_mode_name)
 int image_nand_ecc_mode_id(const char *nand_ecc_mode_name)
 {
int i;
+
for (i = 0; nand_ecc_modes[i].name; i++)
if (!strcmp(nand_ecc_modes[i].name, nand_ecc_mode_name))
return nand_ecc_modes[i].id;
@@ -359,14 +362,14 @@ static size_t image_headersz_v1(struct image_tool_params 
*params,

 #if defined(CONFIG_SYS_U_BOOT_OFFS)
if (headersz > CONFIG_SYS_U_BOOT_OFFS) {
-   fprintf(stderr, "Error: Image header (incl. SPL image) too 
big!\n");
+   fprintf(stderr,
+   "Error: Image header (incl. SPL image) too big!\n");
fprintf(stderr, "header=0x%x CONFIG_SYS_U_BOOT_OFFS=0x%x!\n",
(int)headersz, CONFIG_SYS_U_BOOT_OFFS);
fprintf(stderr, "Increase CONFIG_SYS_U_BOOT_OFFS!\n");
return 0;
-   } else {
-   headersz = CONFIG_SYS_U_BOOT_OFFS;
}
+   headersz = CONFIG_SYS_U_BOOT_OFFS;
 #endif

/*
@@ -514,11 +517,13 @@ static int image_create_config_parse_oneline(char *line,
keyword = strtok_r(line, deliminiters, );
if (!strcmp(keyword, "VERSION")) {
char *value = strtok_r(NULL, deliminiters, );
+
el->type = IMAGE_CFG_VERSION;
el->version = atoi(value);
} else if (!strcmp(keyword, "BOOT_FROM")) {
char *value = strtok_r(NULL, deliminiters, );
int ret = image_boot_mode_id(value);
+
if (ret < 0) {
fprintf(stderr,
"Invalid boot media '%s'\n", value);
@@ -528,16 +533,19 @@ static int image_create_config_parse_oneline(char *line,
el->bootfrom = ret;
} else if (!strcmp(keyword, "NAND_BLKSZ")) {
char *value = strtok_r(NULL, deliminiters, );
+
el->type = IMAGE_CFG_NAND_BLKSZ;
el->nandblksz = strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "NAND_BADBLK_LOCATION")) {
char *value = strtok_r(NULL, deliminiters, );
+
el->type = IMAGE_CFG_NAND_BADBLK_LOCATION;
el->nandbadblklocation =
strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "NAND_ECC_MODE")) {
char *value = strtok_r(NULL, deliminiters, );
int ret = image_nand_ecc_mode_id(value);
+
if (ret < 0) {
fprintf(stderr,
"Invalid NAND ECC mode '%s'\n", value);
@@ -547,6 +555,7 @@ static int image_create_config_parse_oneline(char *line,
el->nandeccmode = ret;
} else if (!strcmp(keyword, "NAND_PAGE_SIZE")) {
char *value = strtok_r(NULL, deliminiters, );
+
el->type = IMAGE_CFG_NAND_PAGESZ;
el->nandpagesz = strtoul(value, NULL, 16);
} else if (!strcmp(keyword, "BINARY")) {
@@ -800,8 +809,8 @@ static int kwbimage_check_image_types(uint8_t type)
 {
if (type == IH_TYPE_KWBIMAGE)
return EXIT_SUCCESS;
-   else
-   return EXIT_FAILURE;
+
+   return EXIT_FAILURE;
 }

 static int kwbimage_verify_header(unsigned char *ptr, int image_size,
@@ -874,9 +883,9 @@ static int kwbimage_generate(struct image_tool_params 
*params,
 static int kwbimage_check_params(struct image_tool_params *params)
 {
if (!strlen(params->imagename)) {
-   fprintf(stderr, "Error:%s - Configuration file not specified, "
-   "it is needed for kwbimage generation\n",
-   params->cmdname);
+   char *msg = "Configuration file for kwbimage creation omitted";
+
+   fprintf(stderr, "Error:%s - %s\n", params->cmdname, msg);
return 

[U-Boot] [PATCH v2 06/18] lib: tpm: Add command to flush resources

2017-01-11 Thread Mario Six
This patch adds a function to the TPM library, which allows U-Boot to
flush resources, e.g. keys, from the TPM.

Signed-off-by: Mario Six 
---
Changes in v2:

* Added U-Boot command for resource flushing ("tpm flush"), and made the
  command and the library function deactivate-able via config
---
 board/gdsys/p1022/controlcenterd-id.c |  9 -
 cmd/tpm.c | 70 +++
 drivers/tpm/Kconfig   |  6 +++
 include/tpm.h | 45 ++
 lib/tpm.c | 29 +++
 5 files changed, 150 insertions(+), 9 deletions(-)

diff --git a/board/gdsys/p1022/controlcenterd-id.c 
b/board/gdsys/p1022/controlcenterd-id.c
index 2c6c698..1648f13 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -43,15 +43,6 @@
 #define CCDM_AUTO_FIRST_STAGE
 #endif

-/* enums from TCG specs */
-enum {
-   /* capability areas */
-   TPM_CAP_NV_INDEX= 0x0011,
-   TPM_CAP_HANDLE  = 0x0014,
-   /* resource types */
-   TPM_RT_KEY  = 0x0001,
-};
-
 /* CCDM specific contants */
 enum {
/* NV indices */
diff --git a/cmd/tpm.c b/cmd/tpm.c
index 312503f..625fc43 100644
--- a/cmd/tpm.c
+++ b/cmd/tpm.c
@@ -646,6 +646,64 @@ TPM_COMMAND_NO_ARG(tpm_end_oiap)

 #endif /* CONFIG_TPM_AUTH_SESSIONS */

+#ifdef CONFIG_TPM_FLUSH_RESOURCES
+static int do_tpm_flush(cmd_tbl_t *cmdtp, int flag, int argc,
+   char * const argv[])
+{
+   int type = 0;
+
+   if (argc != 2)
+   return CMD_RET_USAGE;
+
+   if (strcasecmp(argv[1], "key"))
+   type = TPM_RT_KEY;
+   else if (strcasecmp(argv[1], "auth"))
+   type = TPM_RT_AUTH;
+   else if (strcasecmp(argv[1], "hash"))
+   type = TPM_RT_HASH;
+   else if (strcasecmp(argv[1], "trans"))
+   type = TPM_RT_TRANS;
+   else if (strcasecmp(argv[1], "context"))
+   type = TPM_RT_CONTEXT;
+   else if (strcasecmp(argv[1], "counter"))
+   type = TPM_RT_COUNTER;
+   else if (strcasecmp(argv[1], "delegate"))
+   type = TPM_RT_DELEGATE;
+   else if (strcasecmp(argv[1], "daa_tpm"))
+   type = TPM_RT_DAA_TPM;
+   else if (strcasecmp(argv[1], "daa_v0"))
+   type = TPM_RT_DAA_V0;
+   else if (strcasecmp(argv[1], "daa_v1"))
+   type = TPM_RT_DAA_V1;
+
+   if (strcasecmp(argv[2], "all")) {
+   uint16_t res_count;
+   uint8_t buf[288];
+   uint8_t *ptr;
+   int err;
+   uint i;
+
+   /* fetch list of already loaded resources in the TPM */
+   err = tpm_get_capability(TPM_CAP_HANDLE, type, buf,
+sizeof(buf));
+   if (err)
+   return -1;
+   res_count = get_unaligned_be16(buf);
+   ptr = buf + 2;
+   for (i = 0; i < res_count; ++i, ptr += 4)
+   tpm_flush_specific(get_unaligned_be32(ptr), type);
+   } else {
+   uint32_t handle = simple_strtoul(argv[2], NULL, 0);
+
+   if (!handle)
+   return -1;
+   tpm_flush_specific(cpu_to_be32(handle), type);
+   }
+
+   return 0;
+}
+#endif /* CONFIG_TPM_FLUSH_RESOURCES */
+
 #define MAKE_TPM_CMD_ENTRY(cmd) \
U_BOOT_CMD_MKENT(cmd, 0, 1, do_tpm_ ## cmd, "", "")

@@ -701,6 +759,10 @@ static cmd_tbl_t tpm_commands[] = {
U_BOOT_CMD_MKENT(get_pub_key_oiap, 0, 1,
 do_tpm_get_pub_key_oiap, "", ""),
 #endif /* CONFIG_TPM_AUTH_SESSIONS */
+#ifdef CONFIG_TPM_FLUSH_RESOURCES
+   U_BOOT_CMD_MKENT(flush, 0, 1,
+do_tpm_flush, "", ""),
+#endif /* CONFIG_TPM_FLUSH_RESOURCES */
 };

 static int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -750,6 +812,14 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm,
 "  get_capability cap_area sub_cap addr count\n"
 "- Read  bytes of TPM capability indexed by  and\n"
 "   to memory address .\n"
+#ifdef CONFIG_TPM_FLUSH_RESOURCES
+"Resource management functions\n"
+"  flush resource_type id\n"
+"- flushes a resource of type  (may be one of key, auth,\n"
+"  hash, trans, context, counter, delegate, daa_tpm, daa_v0, daa_v1),\n"
+"  and id  from the TPM. Use an  of \"all\" to flush all\n"
+"  resources of that type.\n"
+#endif /* CONFIG_TPM_FLUSH_RESOURCES */
 #ifdef CONFIG_TPM_AUTH_SESSIONS
 "Storage functions\n"
 "  loadkey2_oiap parent_handle key_addr key_len usage_auth\n"
diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig
index 7ab34ce..3490ee0 100644
--- a/drivers/tpm/Kconfig
+++ b/drivers/tpm/Kconfig
@@ -82,4 +82,10 @@ config TPM_ST33ZP24_SPI
  to the device using the standard TPM Interface Specification (TIS)
  

[U-Boot] [PATCH v2 08/18] gpio: Add gpio_request_simple function

2017-01-11 Thread Mario Six
For board initialization, usage of GPIOs is sometimes needed, e.g. to
initialize certain devices such as FPGAs. But since there currently is no
device associated to the board itself, initialization routines have to
cumbersomely get GPIOs via gpio_request_by_name_nodev.

This patch adds a convenience function aimed at such scenarios, which wraps the
gpio_request_by_name_nodev and some error checking. The GPIO is identified via
its compatible string in the device tree.

Signed-off-by: Mario Six 
---
Changes in v2:

New in v2
---
 drivers/gpio/gpio-uclass.c | 17 +
 include/asm-generic/gpio.h | 22 ++
 2 files changed, 39 insertions(+)

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 4559739..197d987 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -751,6 +751,23 @@ int gpio_request_list_by_name(struct udevice *dev, const 
char *list_name,
   flags);
 }

+bool gpio_request_simple(char *name, struct gpio_desc *gpio)
+{
+   int node = fdt_node_offset_by_compatible(gd->fdt_blob, 0, name);
+   int ret;
+
+   if (node < 0)
+   return false;
+
+   ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, gpio,
+0);
+
+   if (ret < 0)
+   return false;
+
+   return dm_gpio_is_valid(gpio);
+}
+
 int gpio_get_list_count(struct udevice *dev, const char *list_name)
 {
int ret;
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 4aa0004..5c3e599 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -457,6 +457,28 @@ int gpio_request_list_by_name(struct udevice *dev, const 
char *list_name,
  int flags);

 /**
+ * gpio_request_simple() - Simple wrapper function to request GPIO via
+ * fdt compatible name
+ *
+ * Convenience method to get useable GPIO description information from a device
+ * tree declaration such as:
+ *
+ *   fpga_ready_gpio {
+ *   compatible = "generic,fpga-ready-gpio";
+ *   gpios = < 27 0>;
+ *   };
+ *
+ * This is convenient for setting and reading GPIOs from board files (where no
+ * associated device is in play).
+ *
+ * @name: The fdt compatible string of the GPIO in question
+ * @gpio: Return the GPIO description information of the GPIO in question
+ *
+ * @return true if the operation succeeded, false if not
+ */
+bool gpio_request_simple(char *name, struct gpio_desc *gpio);
+
+/**
  * dm_gpio_request() - manually request a GPIO
  *
  * Note: This function should only be used for testing / debugging. Instead.
--
2.9.0

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


[U-Boot] [PATCH v2 01/18] pci: mvebu: Fix Armada 38x support

2017-01-11 Thread Mario Six
From: Dirk Eibach 

Armada 38x has four PCI ports, not three.

The optimization in pci_init_board() seems to assume that every port has
three lanes. This is obviously wrong, and breaks support for Armada 38x.

Signed-off-by: Dirk Eibach 
Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 arch/arm/mach-mvebu/include/mach/soc.h |  1 +
 drivers/pci/pci_mvebu.c| 25 +
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-mvebu/include/mach/soc.h 
b/arch/arm/mach-mvebu/include/mach/soc.h
index 0f69f33..0900e40 100644
--- a/arch/arm/mach-mvebu/include/mach/soc.h
+++ b/arch/arm/mach-mvebu/include/mach/soc.h
@@ -67,6 +67,7 @@
 #define MVEBU_REG_PCIE_BASE(MVEBU_REGISTER(0x4))
 #define MVEBU_AXP_USB_BASE  (MVEBU_REGISTER(0x5))
 #define MVEBU_USB20_BASE   (MVEBU_REGISTER(0x58000))
+#define MVEBU_REG_PCIE0_BASE   (MVEBU_REGISTER(0x8))
 #define MVEBU_AXP_SATA_BASE(MVEBU_REGISTER(0xa))
 #define MVEBU_SATA0_BASE   (MVEBU_REGISTER(0xa8000))
 #define MVEBU_NAND_BASE(MVEBU_REGISTER(0xd))
diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
index 0f44970..da0aa29 100644
--- a/drivers/pci/pci_mvebu.c
+++ b/drivers/pci/pci_mvebu.c
@@ -91,25 +91,26 @@ static void __iomem *mvebu_pcie_membase = (void __iomem 
*)MBUS_PCI_MEM_BASE;
 #if defined(CONFIG_ARMADA_38X)
 #define PCIE_BASE(if)  \
((if) == 0 ?\
-MVEBU_REG_PCIE_BASE + 0x4 :\
-MVEBU_REG_PCIE_BASE + 0x4000 * (if))
+MVEBU_REG_PCIE0_BASE : \
+(MVEBU_REG_PCIE_BASE + 0x4000 * (if - 1)))

 /*
  * On A38x MV6820 these PEX ports are supported:
  *  0 - Port 0.0
- *  1 - Port 0.1
- *  2 - Port 0.2
+ *  1 - Port 1.0
+ *  2 - Port 2.0
+ *  3 - Port 3.0
  */
-#define MAX_PEX 3
+#define MAX_PEX 4
 static struct mvebu_pcie pcie_bus[MAX_PEX];

 static void mvebu_get_port_lane(struct mvebu_pcie *pcie, int pex_idx,
int *mem_target, int *mem_attr)
 {
-   u8 port[] = { 0, 1, 2 };
-   u8 lane[] = { 0, 0, 0 };
-   u8 target[] = { 8, 4, 4 };
-   u8 attr[] = { 0xe8, 0xe8, 0xd8 };
+   u8 port[] = { 0, 1, 2, 3 };
+   u8 lane[] = { 0, 0, 0, 0 };
+   u8 target[] = { 8, 4, 4, 4 };
+   u8 attr[] = { 0xe8, 0xe8, 0xd8, 0xb8 };

pcie->port = port[pex_idx];
pcie->lane = lane[pex_idx];
@@ -351,9 +352,9 @@ void pci_init_board(void)
mvebu_get_port_lane(pcie, i, _target, _attr);

/* Don't read at all from pci registers if port power is down */
-   if (pcie->lane == 0 && SELECT(soc_ctrl, pcie->port) == 0) {
-   i += 3;
-   debug("%s: skipping port %d\n", __func__, pcie->port);
+   if (SELECT(soc_ctrl, pcie->port) == 0) {
+   if (pcie->lane == 0)
+   debug("%s: skipping port %d\n", __func__, 
pcie->port);
continue;
}

--
2.9.0

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


[U-Boot] [PATCH v2 02/18] net: phy: Support Marvell 88E1680

2017-01-11 Thread Mario Six
From: Dirk Eibach 

Add support for Marvell 88E1680 Integrated Octal
10/100/1000 Mbps Energy Efficient Ethernet Transceiver.

Signed-off-by: Dirk Eibach 
Signed-off-by: Mario Six 
---
Changes in v2:

* Switched to usage of pre-defined constant names where possible
* Added error handling for genphy_config_aneg call
---
 drivers/net/phy/marvell.c | 54 +++
 1 file changed, 54 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 4eeb0f6..c3058a4 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -480,6 +480,49 @@ static int m88e1310_config(struct phy_device *phydev)
return genphy_config_aneg(phydev);
 }

+static int m88e1680_config(struct phy_device *phydev)
+{
+   /*
+* As per Marvell Release Notes - Alaska V 88E1680 Rev A2
+* Errata Section 4.1
+*/
+   u16 reg;
+   int res;
+
+   /* Matrix LED mode (not neede if single LED mode is used */
+   phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x0004);
+   reg = phy_read(phydev, MDIO_DEVAD_NONE, 27);
+   reg |= (1 << 5);
+   phy_write(phydev, MDIO_DEVAD_NONE, 27, reg);
+
+   /* QSGMII TX amplitude change */
+   phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x00fd);
+   phy_write(phydev, MDIO_DEVAD_NONE,  8, 0x0b53);
+   phy_write(phydev, MDIO_DEVAD_NONE,  7, 0x200d);
+   phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x);
+
+   /* EEE initialization */
+   phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x00ff);
+   phy_write(phydev, MDIO_DEVAD_NONE, 17, 0xb030);
+   phy_write(phydev, MDIO_DEVAD_NONE, 16, 0x215c);
+   phy_write(phydev, MDIO_DEVAD_NONE, 22, 0x00fc);
+   phy_write(phydev, MDIO_DEVAD_NONE, 24, 0x888c);
+   phy_write(phydev, MDIO_DEVAD_NONE, 25, 0x888c);
+   phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x);
+   phy_write(phydev, MDIO_DEVAD_NONE,  0, 0x9140);
+
+   res = genphy_config_aneg(phydev);
+   if (res < 0)
+   return res;
+
+   /* soft reset */
+   reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
+   reg |= BMCR_RESET;
+   phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, reg);
+
+   return 0;
+}
+
 static struct phy_driver M88E1011S_driver = {
.name = "Marvell 88E1011S",
.uid = 0x1410c60,
@@ -580,6 +623,16 @@ static struct phy_driver M88E1310_driver = {
.shutdown = _shutdown,
 };

+static struct phy_driver M88E1680_driver = {
+   .name = "Marvell 88E1680",
+   .uid = 0x1410ed0,
+   .mask = 0xff0,
+   .features = PHY_GBIT_FEATURES,
+   .config = _config,
+   .startup = _startup,
+   .shutdown = _shutdown,
+};
+
 int phy_marvell_init(void)
 {
phy_register(_driver);
@@ -592,6 +645,7 @@ int phy_marvell_init(void)
phy_register(_driver);
phy_register(_driver);
phy_register(_driver);
+   phy_register(_driver);

return 0;
 }
--
2.9.0

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


[U-Boot] [PATCH v2 04/18] arm: mvebu: spl.c: Remove useless gd declaration

2017-01-11 Thread Mario Six
From: Reinhard Pfau 

ddaa905 ("arm: mvebu: Add DM (driver model) support") removed the
assignment of the gd pointer, but kept the (now superfluous) declaration
of the gd pointer.

Remove this declaration.

Signed-off-by: Reinhard Pfau 
---
Changes in v2:

None
---
 arch/arm/mach-mvebu/spl.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index e1c9cdb..3cf02a5 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -13,8 +13,6 @@
 #include 
 #include 

-DECLARE_GLOBAL_DATA_PTR;
-
 static u32 get_boot_device(void)
 {
u32 val;
--
2.9.0

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


[U-Boot] [PATCH v2 00/18] arm: mvebu: Add gdsys ControlCenter-Compact board

2017-01-11 Thread Mario Six
This patch series adds support for the Guntermann & Drunck
ControlCenter-Compact board.

To this extent, some bugs in the mvebu PCI driver are fixed, a GPIO driver is
added, support for the Marvell 88E1680 is added, the TPM library is extended,
the kwbimage generation is streamlined, a board function for manipulating the
device tree is added, and secure boot for the mvebu architecture is
implemented.

Dirk Eibach (3):
  pci: mvebu: Fix Armada 38x support
  net: phy: Support Marvell 88E1680
  arm: mvebu: Add gdsys ControlCenter-Compact board

Mario Six (14):
  mvebu: Add board_pex_config()
  dm: Add callback to modify the device tree
  lib: tpm: Add command to flush resources
  core: device: Add dev_get_by_ofname function
  gpio: Add gpio_request_simple function
  tools: kwbimage: Fix dest addr
  tools: kwbimage: Fix style violations
  tools: kwbimage: Fix arithmetic with void pointers
  tools: kwbimage: Reduce scope of variables
  tools: kwbimage: Remove unused parameter
  tools: kwbimage: Factor out add_binary_header_v1
  tools: kwbimage: Refactor line parsing and fix error
  arm: mvebu: Implement secure boot
  controlcenterdc: Make secure boot available

Reinhard Pfau (1):
  arm: mvebu: spl.c: Remove useless gd declaration

 Makefile|3 +-
 arch/arm/Kconfig|1 +
 arch/arm/dts/Makefile   |3 +-
 arch/arm/dts/armada-38x-controlcenterdc.dts |  643 
 arch/arm/mach-mvebu/Kconfig |   39 +
 arch/arm/mach-mvebu/Makefile|1 +
 arch/arm/mach-mvebu/efuse.c |  264 +++
 arch/arm/mach-mvebu/include/mach/cpu.h  |2 +
 arch/arm/mach-mvebu/include/mach/efuse.h|   69 ++
 arch/arm/mach-mvebu/include/mach/soc.h  |1 +
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c  |8 +
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h  |2 +
 arch/arm/mach-mvebu/spl.c   |2 -
 board/gdsys/a38x/.gitignore |1 +
 board/gdsys/a38x/Kconfig|   36 +
 board/gdsys/a38x/MAINTAINERS|7 +
 board/gdsys/a38x/Makefile   |   44 ++
 board/gdsys/a38x/controlcenterdc.c  |  273 +++
 board/gdsys/a38x/dt_helpers.c   |   25 +
 board/gdsys/a38x/dt_helpers.h   |   14 +
 board/gdsys/a38x/hre.c  |  516 +
 board/gdsys/a38x/hre.h  |   38 +
 board/gdsys/a38x/hydra.c|  138 
 board/gdsys/a38x/hydra.h|   14 +
 board/gdsys/a38x/ihs_phys.c |  349 +
 board/gdsys/a38x/ihs_phys.h |2 +
 board/gdsys/a38x/keyprogram.c   |  158 
 board/gdsys/a38x/keyprogram.h   |   14 +
 board/gdsys/a38x/kwbimage.cfg.in|   40 +
 board/gdsys/a38x/spl.c  |   21 +
 board/gdsys/p1022/controlcenterd-id.c   |9 -
 cmd/tpm.c   |   70 ++
 common/board_f.c|   10 +
 configs/controlcenterdc_defconfig   |   57 ++
 doc/README.armada-secureboot|  373 +
 doc/driver-model/fdt-fixup.txt  |  132 
 drivers/core/device.c   |7 +
 drivers/gpio/gpio-uclass.c  |   17 +
 drivers/net/phy/marvell.c   |   54 ++
 drivers/pci/pci_mvebu.c |   25 +-
 drivers/tpm/Kconfig |6 +
 dts/Kconfig |   10 +
 include/asm-generic/gpio.h  |   22 +
 include/common.h|1 +
 include/configs/controlcenterdc.h   |  235 ++
 include/dm/device.h |8 +
 include/tpm.h   |   45 ++
 lib/tpm.c   |   29 +
 tools/Makefile  |6 +-
 tools/kwbimage.c|  +++
 tools/kwbimage.h|   37 +
 51 files changed, 4806 insertions(+), 186 deletions(-)
 create mode 100644 arch/arm/dts/armada-38x-controlcenterdc.dts
 create mode 100644 arch/arm/mach-mvebu/efuse.c
 create mode 100644 arch/arm/mach-mvebu/include/mach/efuse.h
 create mode 100644 board/gdsys/a38x/.gitignore
 create mode 100644 board/gdsys/a38x/Kconfig
 create mode 100644 board/gdsys/a38x/MAINTAINERS
 create mode 100644 board/gdsys/a38x/Makefile
 create mode 100644 board/gdsys/a38x/controlcenterdc.c
 create mode 100644 board/gdsys/a38x/dt_helpers.c
 create mode 100644 board/gdsys/a38x/dt_helpers.h
 create mode 100644 board/gdsys/a38x/hre.c
 create mode 100644 board/gdsys/a38x/hre.h
 create mode 100644 board/gdsys/a38x/hydra.c
 create mode 100644 board/gdsys/a38x/hydra.h
 create mode 100644 board/gdsys/a38x/ihs_phys.c
 create mode 100644 board/gdsys/a38x/ihs_phys.h
 create mode 100644 board/gdsys/a38x/keyprogram.c

[U-Boot] [PATCH v2 13/18] tools: kwbimage: Remove unused parameter

2017-01-11 Thread Mario Six
The parameter 'params' of the image_headersz_v1 function is never used
by the function.

Hence, remove it.

Signed-off-by: Mario Six 
---
Changes in v2:

None
---
 tools/kwbimage.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 4fd9389..87587f8 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -308,8 +308,7 @@ static void *image_create_v0(size_t *imagesz, struct 
image_tool_params *params,
return image;
 }

-static size_t image_headersz_v1(struct image_tool_params *params,
-   int *hasext)
+static size_t image_headersz_v1(int *hasext)
 {
struct image_cfg_element *binarye;
size_t headersz;
@@ -393,7 +392,7 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
 * Calculate the size of the header and the size of the
 * payload
 */
-   headersz = image_headersz_v1(params, );
+   headersz = image_headersz_v1();
if (headersz == 0)
return NULL;

@@ -855,7 +854,7 @@ static int kwbimage_generate(struct image_tool_params 
*params,
alloc_len = sizeof(struct main_hdr_v0) +
sizeof(struct ext_hdr_v0);
} else {
-   alloc_len = image_headersz_v1(params, NULL);
+   alloc_len = image_headersz_v1(NULL);
}

hdr = malloc(alloc_len);
--
2.9.0

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


[U-Boot] [PATCH v2 07/18] core: device: Add dev_get_by_ofname function

2017-01-11 Thread Mario Six
On boards that use DM, it is sometimes convenient and quicker to get a device
via its device tree path, since the devices used in the board initialization
routines are usually known beforehand.

This patch adds such a convenience function.

Signed-off-by: Mario Six 
---
Changes in v2:

New in v2
---
 drivers/core/device.c | 7 +++
 include/dm/device.h   | 8 
 2 files changed, 15 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index ed553d7..39d30b3 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -627,6 +627,13 @@ const char *dev_get_uclass_name(struct udevice *dev)
return dev->uclass->uc_drv->name;
 }

+void dev_get_by_ofname(char *ofname, struct udevice *dev)
+{
+   int offset = fdt_path_offset(gd->fdt_blob, ofname);
+
+   device_get_global_by_of_offset(offset, );
+}
+
 fdt_addr_t dev_get_addr_index(struct udevice *dev, int index)
 {
 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/include/dm/device.h b/include/dm/device.h
index 9948bd4..402482c 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -340,6 +340,14 @@ enum uclass_id device_get_uclass_id(struct udevice *dev);
 const char *dev_get_uclass_name(struct udevice *dev);

 /**
+ * dev_get_by_ofname() - find a device via its device tree path
+ *
+ * @ofname: Device tree path to use ("/path1/path2/...")
+ * @dev:The found device or NULL
+ */
+void dev_get_by_ofname(char *ofname, struct udevice *dev);
+
+/**
  * device_get_child() - Get the child of a device by index
  *
  * Returns the numbered child, 0 being the first. This does not use
--
2.9.0

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


Re: [U-Boot] [PATCH 2/4] omap3_igep00x0: Rework MACH_TYPE and status LED logic slightly

2017-01-11 Thread Enric Balletbo Serra
2017-01-10 23:22 GMT+01:00 Tom Rini :
> The MACH_TYPE for IGEP0032 was never officially used and has been
> removed from upstream, so we must not use it.  In order to remove this
> we need to rework the status LED logic.
>
> Cc: Enric Balletbo i Serra 
> Signed-off-by: Tom Rini 
> ---
>  configs/igep0032_defconfig   | 1 -
>  include/configs/omap3_igep00x0.h | 5 ++---
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/configs/igep0032_defconfig b/configs/igep0032_defconfig
> index dad8dfaf0c22..cd48e45171cb 100644
> --- a/configs/igep0032_defconfig
> +++ b/configs/igep0032_defconfig
> @@ -3,7 +3,6 @@ CONFIG_OMAP34XX=y
>  # CONFIG_SPL_EXT_SUPPORT is not set
>  CONFIG_TARGET_OMAP3_IGEP00X0=y
>  CONFIG_DISTRO_DEFAULTS=y
> -CONFIG_SYS_EXTRA_OPTIONS="MACH_TYPE=MACH_TYPE_IGEP0032"
>  CONFIG_BOOTDELAY=3
>  CONFIG_SYS_CONSOLE_IS_IN_ENV=y
>  CONFIG_SYS_CONSOLE_INFO_QUIET=y
> diff --git a/include/configs/omap3_igep00x0.h 
> b/include/configs/omap3_igep00x0.h
> index 30d3aa897f1b..e6d7db0da692 100644
> --- a/include/configs/omap3_igep00x0.h
> +++ b/include/configs/omap3_igep00x0.h
> @@ -28,7 +28,8 @@
>  #define CONFIG_REVISION_TAG1
>
>  /* Status LED available for IGEP0020 and IGEP0030 but not IGEP0032 */
> -#if (CONFIG_MACH_TYPE != MACH_TYPE_IGEP0032)
> +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020) || \
> +  (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)
>  #define CONFIG_STATUS_LED
>  #define CONFIG_BOARD_SPECIFIC_LED
>  #define CONFIG_GPIO_LED
> @@ -36,8 +37,6 @@
>  #define RED_LED_GPIO 27
>  #elif (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)
>  #define RED_LED_GPIO 16
> -#else
> -#error "status LED not defined for this machine."
>  #endif
>  #define RED_LED_DEV0
>  #define STATUS_LED_BIT RED_LED_GPIO
> --
> 1.9.1
>

cc: Eduard and Pau

I think that there are few boards in the field, an seems that anyone
take care to upstream the dts files to the kernel. Currently I don't
have this board so I can't support it, so from my side

Acked-by: Enric Balletbo i Serra 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] serial, ns16550: bugfix: ns16550 fifo not enabled

2017-01-11 Thread Adam Ford
On Tue, Jan 10, 2017 at 1:08 AM, Heiko Schocher  wrote:
> commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor"
> breaks u-boot commandline working with long commands
> sending to the board.
>
> Since the above patch, you have to setup the fcr register.
>
> For board/archs which enable OF_PLATDATA, the new field
> fcr in struct ns16550_platdata is not filled with a
> default value ...
>
> This leads in not setting up the uarts fifo, which ends
> in problems, when you send long commands to u-boots
> commandline.
>
> Detected this issue with automated tbot tests on am335x
> based shc board.
>
> The error does not popup, if you type commands. You need
> to copy a long command to u-boots commandshell
> (or send a long command with tbot)
>
> Possible boards/plattforms with problems:
> ./arch/arm/cpu/arm926ejs/lpc32xx/devices.c
> ./arch/arm/mach-tegra/board.c
> ./board/isee/igep00x0/igep00x0.c
> ./board/overo/overo.c
> ./board/quipos/cairo/cairo.c
> ./board/logicpd/omap3som/omap3logic.c
> ./board/logicpd/zoom1/zoom1.c
> ./board/timll/devkit8000/devkit8000.c
> ./board/lg/sniper/sniper.c
> ./board/ti/beagle/beagle.c
> ./drivers/serial/serial_rockchip.c
>
> This patch fixes only:
> ./arch/arm/mach-omap2/am33xx/board.c
>
> Signed-off-by: Heiko Schocher 

The omap3logic is also affected.  It also appears as if you hold a
character down while booting, it may hang the system. I applied a
similar patch to omap3logic.c and it went away.

Thanks for catching that!

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


Re: [U-Boot] [RFC Patch] drivers: mmc: omap_hsmmc: Fix IO Buffer on OMAP36XX

2017-01-11 Thread Adam Ford
On Tue, Jan 10, 2017 at 5:14 PM, Tom Rini  wrote:
> On Mon, Jan 09, 2017 at 12:12:09PM -0600, aford...@gmail.com wrote:
>
>> From: Adam Ford 
>>
>> On the OMAP36xx (and 37xx) the CONTROL_WKUP_CTRL register has
>> a field (bit 6) named GPIO_IO_PWRDNZ.  If 0, the IO buffers which
>> are related to the MMC are disabled. After the PBIAS is configured,
>> this bit should be set high to enable the MMC port.
>>
>> Signed-off-by: Adam Ford 
>>
>> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
>> index 0a1ee40..069fd5a 100644
>> --- a/drivers/mmc/omap_hsmmc.c
>> +++ b/drivers/mmc/omap_hsmmc.c
>> @@ -38,6 +38,7 @@
>>  #include 
>>  #endif
>>  #include 
>> +#include 
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> @@ -115,6 +116,11 @@ static unsigned char mmc_board_init(struct mmc *mmc)
>>   PBIASSPEEDCTRL0 | PBIASLITEPWRDNZ0,
>>   _base->pbias_lite);
>>
#ifdef OMAP36_MMC1_PINS
>> + if (get_cpu_family() == CPU_OMAP36XX)
>> + writel(readl(OMAP34XX_CTRL_WKUP_CTRL) |
>> + OMAP34XX_CTRL_WKUP_CTRL_GPIO_IO_PWRDNZ,
>> + OMAP34XX_CTRL_WKUP_CTRL);
>> +
#endif

>>   writel(readl(_base->devconf0) | MMCSDIO1ADPCLKISEL,
>>   _base->devconf0);
>
> I think I'd like to see this with a build-time check to avoid bloating
> all of the other families.  Thanks!

Since it's only on the OMAP36xx and 37xx (that I am aware) and it's
specific for a couple pins on the MMC1 bus using GPIO_126, 127, and
129.  If we encapsulated the update into and #ifdef, would that
satisfy you?

I added my proposed change above.  I would also add the define into
the omap3_logic_defconfig file.  Any other OMAP36/37 boards could add
it in.

Does that work for you?  If so, I'll submit an updated patch

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


[U-Boot] [PATCH] power_i2c.c: Fix unused variable warning

2017-01-11 Thread Tom Rini
The variable ret was added but never set as we did not make calls to
other functions that we needed to check the return value on.

Fixes: 505cf4750ae5 ("power: change from meaningless value to error number")
Signed-off-by: Tom Rini 
---
 drivers/power/power_i2c.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/power/power_i2c.c b/drivers/power/power_i2c.c
index dd22ece53cd2..8a8ea10e33ef 100644
--- a/drivers/power/power_i2c.c
+++ b/drivers/power/power_i2c.c
@@ -19,7 +19,6 @@
 int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
 {
unsigned char buf[4] = { 0 };
-   int ret;
 
if (check_reg(p, reg))
return -EINVAL;
-- 
1.9.1

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


Re: [U-Boot] [PATCH] serial, ns16550: bugfix: ns16550 fifo not enabled

2017-01-11 Thread Tom Rini
On Wed, Jan 11, 2017 at 06:38:22AM +0100, Heiko Schocher wrote:
> Hello Tom,
> 
> Am 10.01.2017 um 17:40 schrieb Tom Rini:
> >On Tue, Jan 10, 2017 at 08:08:51AM +0100, Heiko Schocher wrote:
> >>commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor"
> >>breaks u-boot commandline working with long commands
> >>sending to the board.
> >>
> >>Since the above patch, you have to setup the fcr register.
> >>
> >>For board/archs which enable OF_PLATDATA, the new field
> >>fcr in struct ns16550_platdata is not filled with a
> >>default value ...
> >>
> >>This leads in not setting up the uarts fifo, which ends
> >>in problems, when you send long commands to u-boots
> >>commandline.
> >>
> >>Detected this issue with automated tbot tests on am335x
> >>based shc board.
> >>
> >>The error does not popup, if you type commands. You need
> >>to copy a long command to u-boots commandshell
> >>(or send a long command with tbot)
> >>
> >>Possible boards/plattforms with problems:
> >>./arch/arm/cpu/arm926ejs/lpc32xx/devices.c
> >>./arch/arm/mach-tegra/board.c
> >>./board/isee/igep00x0/igep00x0.c
> >>./board/overo/overo.c
> >>./board/quipos/cairo/cairo.c
> >>./board/logicpd/omap3som/omap3logic.c
> >>./board/logicpd/zoom1/zoom1.c
> >>./board/timll/devkit8000/devkit8000.c
> >>./board/lg/sniper/sniper.c
> >>./board/ti/beagle/beagle.c
> >>./drivers/serial/serial_rockchip.c
> >>
> >>This patch fixes only:
> >>./arch/arm/mach-omap2/am33xx/board.c
> >>
> >>Signed-off-by: Heiko Schocher 
> >
> >Good find!  I didn't catch this in my setups as nothing in test.py is
> >currently long enough to trigger this apparently (I have both an am335x
> >evm and a beagleboard in my setup).  By inspection, the right fix for
> >all platforms would be to put the old default value in as this is what
> >was missed in the original patch from Marek.
> 
> The problems are boards/archs, which create "struct ns16550_platdata"
> on their own ... I added the original value for fcr in
> ./arch/arm/mach-omap2/am33xx/board.c
> 
> Do you mean, I should grep for all this places and
> fix them in my patch (without having the chance to test it) ?
> 
> Ok, seems a valid solution ... I try to do this today.

Yes, you've got it.  Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 1/4] omap3_logic: Rework MACH_TYPE and fdtfile logic

2017-01-11 Thread Adam Ford
On Tue, Jan 10, 2017 at 4:22 PM, Tom Rini  wrote:
> The MACH_TYPE values for the omap37xx based platforms are no longer
> officially valid, so we must not set and pass them.  In order to not
> reference them but still be able to set the default fdtfile based on the
> board detection logic we need to combine the two steps into one.

Look good.

>
Acked-by: Adam Ford 
> Cc: Adam Ford 
> Signed-off-by: Tom Rini 
> ---
>  board/logicpd/omap3som/omap3logic.c | 54 
> ++---
>  1 file changed, 20 insertions(+), 34 deletions(-)
>
> diff --git a/board/logicpd/omap3som/omap3logic.c 
> b/board/logicpd/omap3som/omap3logic.c
> index de6a06021c2c..21b3fdcf49cf 100644
> --- a/board/logicpd/omap3som/omap3logic.c
> +++ b/board/logicpd/omap3som/omap3logic.c
> @@ -60,25 +60,28 @@ U_BOOT_DEVICE(omap3logic_uart) = {
>  static struct board_id {
> char *name;
> int machine_id;
> +   char *fdtfile;
>  } boards[2][2] = {
> {
> {
> .name   = "OMAP35xx SOM LV",
> .machine_id = MACH_TYPE_OMAP3530_LV_SOM,
> +   .fdtfile= "logicpd-som-lv-35xx-devkit.dtb",
> },
> {
> .name   = "OMAP35xx Torpedo",
> .machine_id = MACH_TYPE_OMAP3_TORPEDO,
> +   .fdtfile= "logicpd-torpedo-35xx-devkit.dtb",
> },
> },
> {
> {
> .name   = "DM37xx SOM LV",
> -   .machine_id = MACH_TYPE_DM3730_SOM_LV,
> +   .fdtfile= "logicpd-som-lv-37xx-devkit.dtb",
> },
> {
> .name   = "DM37xx Torpedo",
> -   .machine_id = MACH_TYPE_DM3730_TORPEDO,
> +   .fdtfile= "logicpd-torpedo-37xx-devkit.dtb",
> },
> },
>  };
> @@ -165,14 +168,20 @@ int misc_init_r(void)
>   */
>  int board_init(void)
>  {
> -   struct board_id *board;
> -   unsigned int val;
> -
> gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
>
> /* boot param addr */
> gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
>
> +   return 0;
> +}
> +
> +#ifdef CONFIG_BOARD_LATE_INIT
> +int board_late_init(void)
> +{
> +   struct board_id *board;
> +   unsigned int val;
> +
> /*
>  * To identify between a SOM LV and Torpedo module,
>  * a pulldown resistor is on hsusb0_data5 for the SOM LV module.
> @@ -207,39 +216,16 @@ int board_init(void)
> printf("Board: %s\n", board->name);
>
> /* Set the machine_id passed to Linux */
> -   gd->bd->bi_arch_number = board->machine_id;
> +   if (board->machine_id)
> +   gd->bd->bi_arch_number = board->machine_id;
> +
> +   /* If the user has not set fdtimage, set the default */
> +   if (!getenv("fdtimage"))
> +   setenv("fdtimage", board->fdtfile);
> }
>
> /* restore hsusb0_data5 pin as hsusb0_data5 */
> MUX_VAL(CP(HSUSB0_DATA5),   (IEN  | PTD | DIS | M0));
> -
> -   return 0;
> -}
> -
> -#ifdef CONFIG_BOARD_LATE_INIT
> -int board_late_init(void)
> -{
> -   /* If we do not have an fdtimage, let's autodetect it*/
> -   if (getenv("fdtimage"))
> -   return 0;
> -
> -   switch (gd->bd->bi_arch_number) {
> -   case MACH_TYPE_DM3730_TORPEDO:
> -   setenv("fdtimage", "logicpd-torpedo-37xx-devkit.dtb");
> -   break;
> -   case MACH_TYPE_DM3730_SOM_LV:
> -   setenv("fdtimage", "logicpd-som-lv-37xx-devkit.dtb");
> -   break;
> -   case MACH_TYPE_OMAP3_TORPEDO:
> -   setenv("fdtimage", "logicpd-torpedo-35xx-devkit.dtb");
> -   break;
> -   case MACH_TYPE_OMAP3530_LV_SOM:
> -   setenv("fdtimage", "logicpd-som-lv-35xx-devkit.dtb");
> -   break;
> -   default:
> -   /* unknown machine type */
> -   break;
> -   }
> return 0;
>  }
>  #endif
> --
> 1.9.1
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Allwinner A33 MIPI DSI Support.

2017-01-11 Thread far5893

I have a new  fresh Q8 A33  tablet but different from previous two it
have native MIPI DSI interface, there is working in progress to support MIPI 
DSI interface in
u-boot ?

lcd_fex

[lcd0_para]
lcd_used = 1
lcd_driver_name = "tm1280X800"
lcd_if = 4
lcd_x = 800
lcd_y = 1280
lcd_width = 120
lcd_height = 160
lcd_dclk_freq = 78
lcd_pwm_used = 1
lcd_pwm_ch = 0
lcd_pwm_freq = 5
lcd_pwm_pol = 1
lcd_hbp = 96
lcd_ht = 961
lcd_hspw = 48
lcd_vbp = 12
lcd_vt = 1322
lcd_vspw = 4
lcd_dsi_if = 0
lcd_dsi_lane = 4
lcd_dsi_format = 0
lcd_dsi_te = 0
lcd_lvds_if = 0
lcd_lvds_colordepth = 0
lcd_lvds_mode = 0
lcd_frm = 1
lcd_hv_clk_phase = 0
lcd_hv_sync_polarity = 0
lcd_gamma_en = 0
lcd_bright_curve_en = 0
lcd_cmap_en = 0
deu_mode = 0
lcdgamma4iep = 22
smart_color = 90
lcd_bl_en = port:PH06<1><0><1>
lcd_power = port:power2<1><0><1>
lcd_power_1 = "axp22_eldo1"
lcd_gpio_0 = port:PH07<1><0><1>



Thank
silviop

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


[U-Boot] [PATCH] board/t1024rdb: enable board-level reset when issuing reset command

2017-01-11 Thread Shengzhou Liu
As board-specific reset logic, it needs to issue reset signal
via CPLD when issuing 'reset' command in u-boot, this patch
solves the issue of reset command not working on T1024RDB.

Signed-off-by: Shengzhou Liu 
---
 board/freescale/t102xrdb/t102xrdb.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/board/freescale/t102xrdb/t102xrdb.c 
b/board/freescale/t102xrdb/t102xrdb.c
index 01dbf38..6de877a 100644
--- a/board/freescale/t102xrdb/t102xrdb.c
+++ b/board/freescale/t102xrdb/t102xrdb.c
@@ -167,6 +167,11 @@ unsigned long get_board_ddr_clk(void)
return CONFIG_DDR_CLK_FREQ;
 }
 
+void board_reset(void)
+{
+   CPLD_WRITE(reset_ctl1, CPLD_LBMAP_RESET);
+}
+
 int misc_init_r(void)
 {
return 0;
-- 
2.1.0.27.g96db324

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


[U-Boot] [PATCH v7 11/11] rockchip: Drop Ethernet from the TODO

2017-01-11 Thread Romain Perier
From: Sjoerd Simons 

Now that ethernet support works, it can be dropped from the rockchip
TODO

Signed-off-by: Sjoerd Simons 
Acked-by: Simon Glass 
Acked-by: Joe Hershberger 
Signed-off-by: Simon Glass 
---

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Add a few new patches
- Drop the 'net: designware: Add a fix_mac_speed hook' patch

 doc/README.rockchip | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/README.rockchip b/doc/README.rockchip
index 06ec80e..43cafc7 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -219,7 +219,6 @@ Immediate priorities are:
 - USB host
 - USB device
 - Run CPU at full speed (code exists but we only see ~60 DMIPS maximum)
-- Ethernet
 - NAND flash
 - Support for other Rockchip parts
 - Boot U-Boot proper over USB OTG (at present only SPL works)
-- 
2.9.3

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


[U-Boot] [PATCH v7 04/11] net: designware: Export the operation functions

2017-01-11 Thread Romain Perier
From: Simon Glass 

Export all functions so that drivers can use them, or not, as the need
arises.

Signed-off-by: Simon Glass 
Signed-off-by: Romain Perier 
Acked-by: Joe Hershberger 
---

Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain
Changes in v5:
- Add Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add new patch to export the operation functions

Changes in v2: None

 drivers/net/designware.c | 19 +--
 drivers/net/designware.h |  9 +
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 0c596a7..f242fc6 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -271,7 +271,7 @@ static void _dw_eth_halt(struct dw_eth_dev *priv)
phy_shutdown(priv->phydev);
 }
 
-static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)
+int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)
 {
struct eth_mac_regs *mac_p = priv->mac_regs_p;
struct eth_dma_regs *dma_p = priv->dma_regs_p;
@@ -330,7 +330,7 @@ static int _dw_eth_init(struct dw_eth_dev *priv, u8 
*enetaddr)
return 0;
 }
 
-static int designware_eth_enable(struct dw_eth_dev *priv)
+int designware_eth_enable(struct dw_eth_dev *priv)
 {
struct eth_mac_regs *mac_p = priv->mac_regs_p;
 
@@ -493,7 +493,7 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
 {
int ret;
 
-   ret = _dw_eth_init(dev->priv, dev->enetaddr);
+   ret = designware_eth_init(dev->priv, dev->enetaddr);
if (!ret)
ret = designware_eth_enable(dev->priv);
 
@@ -591,7 +591,7 @@ static int designware_eth_start(struct udevice *dev)
struct dw_eth_dev *priv = dev_get_priv(dev);
int ret;
 
-   ret = _dw_eth_init(priv, pdata->enetaddr);
+   ret = designware_eth_init(priv, pdata->enetaddr);
if (ret)
return ret;
ret = designware_eth_enable(priv);
@@ -601,36 +601,35 @@ static int designware_eth_start(struct udevice *dev)
return 0;
 }
 
-static int designware_eth_send(struct udevice *dev, void *packet, int length)
+int designware_eth_send(struct udevice *dev, void *packet, int length)
 {
struct dw_eth_dev *priv = dev_get_priv(dev);
 
return _dw_eth_send(priv, packet, length);
 }
 
-static int designware_eth_recv(struct udevice *dev, int flags, uchar **packetp)
+int designware_eth_recv(struct udevice *dev, int flags, uchar **packetp)
 {
struct dw_eth_dev *priv = dev_get_priv(dev);
 
return _dw_eth_recv(priv, packetp);
 }
 
-static int designware_eth_free_pkt(struct udevice *dev, uchar *packet,
-  int length)
+int designware_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
 {
struct dw_eth_dev *priv = dev_get_priv(dev);
 
return _dw_free_pkt(priv);
 }
 
-static void designware_eth_stop(struct udevice *dev)
+void designware_eth_stop(struct udevice *dev)
 {
struct dw_eth_dev *priv = dev_get_priv(dev);
 
return _dw_eth_halt(priv);
 }
 
-static int designware_eth_write_hwaddr(struct udevice *dev)
+int designware_eth_write_hwaddr(struct udevice *dev)
 {
struct eth_pdata *pdata = dev_get_platdata(dev);
struct dw_eth_dev *priv = dev_get_priv(dev);
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index 087ebef..7992d0e 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -253,6 +253,15 @@ struct dw_eth_pdata {
struct eth_pdata eth_pdata;
u32 reset_delays[3];
 };
+
+int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr);
+int designware_eth_enable(struct dw_eth_dev *priv);
+int designware_eth_send(struct udevice *dev, void *packet, int length);
+int designware_eth_recv(struct udevice *dev, int flags, uchar **packetp);
+int designware_eth_free_pkt(struct udevice *dev, uchar *packet,
+  int length);
+void designware_eth_stop(struct udevice *dev);
+int designware_eth_write_hwaddr(struct udevice *dev);
 #endif
 
 #endif
-- 
2.9.3

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


  1   2   >