Re: [U-Boot] [PATCH v2 18/18] spi: mpc8xxx: Convert to DM

2018-04-25 Thread Mario Six
Hi Jagan,

On Thu, Apr 26, 2018 at 7:49 AM, Jagan Teki  wrote:
> On Thu, Apr 26, 2018 at 11:13 AM, Mario Six  wrote:
>> Hi Jagan,
>>
>> On Thu, Apr 26, 2018 at 7:34 AM, Jagan Teki  wrote:
>>> On Thu, Apr 19, 2018 at 6:06 PM, Mario Six  wrote:
 Support DM in the MPC8xxx SPI driver, and remove the legacy SPI
 interface.

 Signed-off-by: Mario Six 
 ---
  drivers/spi/mpc8xxx_spi.c | 144 
 ++
  1 file changed, 107 insertions(+), 37 deletions(-)
 ---

 Changes v1 -> v2:
 * Removed legacy layer
 * Sorted includes
 * Now return -ETIMEDOUT on timeout during transfer

 ---

 diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
 index 4aa5db8821..9c9dd67ec2 100644
 --- a/drivers/spi/mpc8xxx_spi.c
 +++ b/drivers/spi/mpc8xxx_spi.c
 @@ -6,10 +6,12 @@
   */

  #include 
 -
 +#include 
 +#include 
  #include 
  #include 
  #include 
 +#include 
>>>
>>> [snip]
>>>
 +};
 +
 +static const struct udevice_id mpc8xxx_spi_ids[] = {
 +   { .compatible = "fsl,spi" },
>>>
>>> Look like new binding right? don't we have suitable binding for this
>>> driver? or what is the equivalent driver for this in Linux?
>>>
>>
>> I took that compatible string from the Linux kernel, actually. See for 
>> example
>>
>> https://raw.githubusercontent.com/torvalds/linux/master/arch/powerpc/boot/dts/mpc8379_mds.dts
>>
>> There are more specific ones, like "fsl,mpc8610-spi", but "fsl,spi" is
>> the most generic.
>
> So this driver is same as drivers/spi/spi-fsl-spi.c from Linux, is it?
>

Yes, with reduced functionality, of course, but compatible to the same devices.

Best regards,
Mario
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 00/18] spi: mpc8xxx: DM conversion

2018-04-25 Thread Mario Six
Hi Jagan,

On Thu, Apr 26, 2018 at 7:30 AM, Jagan Teki  wrote:
> On Thu, Apr 19, 2018 at 6:06 PM, Mario Six  wrote:
>> This is v2 of a patch series that adds support for DM to the MPC8XXX SPI
>> driver, cleans up the driver code, fixes a few minor problems.
>>
>> Some TODOs are left over for later, such as proper SPI speed setting,
>> and support for SPI mode setting. These would be enhancements to the
>> original functionality, and can come later.
>>
>> The legacy functionality is removed in this version, so old boards in
>> the tree might end up with broken SPI functionality.
>>
>> Mario Six (18):
>>   spi: mpc8xxx: Use short type names
>>   spi: mpc8xxx: Fix comments
>>   spi: mpc8xxx: Rename camel-case variables
>>   spi: mpc8xxx: Fix space after cast
>>   spi: mpc8xxx: Fix function names in strings
>>   spi: mpc8xxx: Replace defines with enums
>>   spi: mpc8xxx: Use IO accessors
>>   spi: mpc8xxx: Simplify if
>>   spi: mpc8xxx: Get rid of is_read
>>   spi: mpc8xxx: Simplify logic a bit
>>   spi: mpc8xxx: Reduce scope of loop variables
>>   spi: mpc8xxx: Make code more readable
>>   spi: mpc8xxx: Rename variable
>>   spi: mpc8xxx: Document LEN setting better
>>   spi: mpc8xxx: Re-order transfer setup
>>   spi: mpc8xxx: Fix if check
>>   spi: mpc8xxx: Use get_timer
>>   spi: mpc8xxx: Convert to DM
>
> Boards with
> - configs/MPC8349EMDS_defconfig
> - configs/ids8313_defconfig
>
> are using this driver, so Kim, Heiko please convert enable DM_SPI for the 
> same.
>
> Use below tree for respective changes and update on top of this.
> http://git.denx.de/?p=u-boot-spi.git;a=shortlog;h=refs/heads/next
>

I have a few series in the making that will enable DM on the MPC83xx platform
(I'm doing a respin on the first right now). If there is still interests in the
boards, I could push it to the MPC83xx repository (but mind that the work
required per board is quite extensive).

Also, MPC8349EMDS is de facto abandoned, and I don't have access to the
hardware, so I can't really maintain it.

> Jagan.
>

Best regards,
Mario
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 18/18] spi: mpc8xxx: Convert to DM

2018-04-25 Thread Jagan Teki
On Thu, Apr 26, 2018 at 11:13 AM, Mario Six  wrote:
> Hi Jagan,
>
> On Thu, Apr 26, 2018 at 7:34 AM, Jagan Teki  wrote:
>> On Thu, Apr 19, 2018 at 6:06 PM, Mario Six  wrote:
>>> Support DM in the MPC8xxx SPI driver, and remove the legacy SPI
>>> interface.
>>>
>>> Signed-off-by: Mario Six 
>>> ---
>>>  drivers/spi/mpc8xxx_spi.c | 144 
>>> ++
>>>  1 file changed, 107 insertions(+), 37 deletions(-)
>>> ---
>>>
>>> Changes v1 -> v2:
>>> * Removed legacy layer
>>> * Sorted includes
>>> * Now return -ETIMEDOUT on timeout during transfer
>>>
>>> ---
>>>
>>> diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
>>> index 4aa5db8821..9c9dd67ec2 100644
>>> --- a/drivers/spi/mpc8xxx_spi.c
>>> +++ b/drivers/spi/mpc8xxx_spi.c
>>> @@ -6,10 +6,12 @@
>>>   */
>>>
>>>  #include 
>>> -
>>> +#include 
>>> +#include 
>>>  #include 
>>>  #include 
>>>  #include 
>>> +#include 
>>
>> [snip]
>>
>>> +};
>>> +
>>> +static const struct udevice_id mpc8xxx_spi_ids[] = {
>>> +   { .compatible = "fsl,spi" },
>>
>> Look like new binding right? don't we have suitable binding for this
>> driver? or what is the equivalent driver for this in Linux?
>>
>
> I took that compatible string from the Linux kernel, actually. See for example
>
> https://raw.githubusercontent.com/torvalds/linux/master/arch/powerpc/boot/dts/mpc8379_mds.dts
>
> There are more specific ones, like "fsl,mpc8610-spi", but "fsl,spi" is
> the most generic.

So this driver is same as drivers/spi/spi-fsl-spi.c from Linux, is it?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 18/18] spi: mpc8xxx: Convert to DM

2018-04-25 Thread Mario Six
Hi Jagan,

On Thu, Apr 26, 2018 at 7:34 AM, Jagan Teki  wrote:
> On Thu, Apr 19, 2018 at 6:06 PM, Mario Six  wrote:
>> Support DM in the MPC8xxx SPI driver, and remove the legacy SPI
>> interface.
>>
>> Signed-off-by: Mario Six 
>> ---
>>  drivers/spi/mpc8xxx_spi.c | 144 
>> ++
>>  1 file changed, 107 insertions(+), 37 deletions(-)
>> ---
>>
>> Changes v1 -> v2:
>> * Removed legacy layer
>> * Sorted includes
>> * Now return -ETIMEDOUT on timeout during transfer
>>
>> ---
>>
>> diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
>> index 4aa5db8821..9c9dd67ec2 100644
>> --- a/drivers/spi/mpc8xxx_spi.c
>> +++ b/drivers/spi/mpc8xxx_spi.c
>> @@ -6,10 +6,12 @@
>>   */
>>
>>  #include 
>> -
>> +#include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>
> [snip]
>
>> +};
>> +
>> +static const struct udevice_id mpc8xxx_spi_ids[] = {
>> +   { .compatible = "fsl,spi" },
>
> Look like new binding right? don't we have suitable binding for this
> driver? or what is the equivalent driver for this in Linux?
>

I took that compatible string from the Linux kernel, actually. See for example

https://raw.githubusercontent.com/torvalds/linux/master/arch/powerpc/boot/dts/mpc8379_mds.dts

There are more specific ones, like "fsl,mpc8610-spi", but "fsl,spi" is
the most generic.

> Jagan.
>

Best regards,

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


Re: [U-Boot] [PATCH v2 18/18] spi: mpc8xxx: Convert to DM

2018-04-25 Thread Jagan Teki
On Thu, Apr 19, 2018 at 6:06 PM, Mario Six  wrote:
> Support DM in the MPC8xxx SPI driver, and remove the legacy SPI
> interface.
>
> Signed-off-by: Mario Six 
> ---
>  drivers/spi/mpc8xxx_spi.c | 144 
> ++
>  1 file changed, 107 insertions(+), 37 deletions(-)
> ---
>
> Changes v1 -> v2:
> * Removed legacy layer
> * Sorted includes
> * Now return -ETIMEDOUT on timeout during transfer
>
> ---
>
> diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
> index 4aa5db8821..9c9dd67ec2 100644
> --- a/drivers/spi/mpc8xxx_spi.c
> +++ b/drivers/spi/mpc8xxx_spi.c
> @@ -6,10 +6,12 @@
>   */
>
>  #include 
> -
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 

[snip]

> +};
> +
> +static const struct udevice_id mpc8xxx_spi_ids[] = {
> +   { .compatible = "fsl,spi" },

Look like new binding right? don't we have suitable binding for this
driver? or what is the equivalent driver for this in Linux?

Jagan.
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 00/18] spi: mpc8xxx: DM conversion

2018-04-25 Thread Jagan Teki
On Thu, Apr 19, 2018 at 6:06 PM, Mario Six  wrote:
> This is v2 of a patch series that adds support for DM to the MPC8XXX SPI
> driver, cleans up the driver code, fixes a few minor problems.
>
> Some TODOs are left over for later, such as proper SPI speed setting,
> and support for SPI mode setting. These would be enhancements to the
> original functionality, and can come later.
>
> The legacy functionality is removed in this version, so old boards in
> the tree might end up with broken SPI functionality.
>
> Mario Six (18):
>   spi: mpc8xxx: Use short type names
>   spi: mpc8xxx: Fix comments
>   spi: mpc8xxx: Rename camel-case variables
>   spi: mpc8xxx: Fix space after cast
>   spi: mpc8xxx: Fix function names in strings
>   spi: mpc8xxx: Replace defines with enums
>   spi: mpc8xxx: Use IO accessors
>   spi: mpc8xxx: Simplify if
>   spi: mpc8xxx: Get rid of is_read
>   spi: mpc8xxx: Simplify logic a bit
>   spi: mpc8xxx: Reduce scope of loop variables
>   spi: mpc8xxx: Make code more readable
>   spi: mpc8xxx: Rename variable
>   spi: mpc8xxx: Document LEN setting better
>   spi: mpc8xxx: Re-order transfer setup
>   spi: mpc8xxx: Fix if check
>   spi: mpc8xxx: Use get_timer
>   spi: mpc8xxx: Convert to DM

Boards with
- configs/MPC8349EMDS_defconfig
- configs/ids8313_defconfig

are using this driver, so Kim, Heiko please convert enable DM_SPI for the same.

Use below tree for respective changes and update on top of this.
http://git.denx.de/?p=u-boot-spi.git;a=shortlog;h=refs/heads/next

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


Re: [U-Boot] Issues with Rockchips make_fit_atf.py on master

2018-04-25 Thread Kever Yang
Hi Peter,


On 04/25/2018 05:44 PM, Peter Robinson wrote:
> Hi Kever,
>
> There's a problem with generating the FIT image for rockchips on
> recent 2018.05 RCs, errors below, I suspect due to changes in dtc.

Thanks for reporting this, but I don't know why I can't reproduce the issue,
the U-Boot has include dtc code now and we should have the same dtc.

The issue is clear and we can reference commit to fix.
https://github.com/RobertCNelson/dtc/commit/c9d9121683b35281239305e15adddfff2b462cf9
https://lkml.org/lkml/2016/4/1/46

But I can't test it because I can't reproduce it :(
Could you help to test after I send a fix patch for it?

Thanks,
- Kever
>
> Peter
>
> /builddir/build/BUILD/u-boot-2018.05-rc2/"arch/arm/mach-rockchip/make_fit_atf.py"
> \
> arch/arm/dts/rk3399-firefly.dtb > u-boot.its
>   ./tools/mkimage  -f u-boot.its -E u-boot.itb >/dev/null  && cat /dev/null
> u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/uboot@1
> has a unit name, but no reg property
> u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/atf@1 has
> a unit name, but no reg property
> u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/atf@2 has
> a unit name, but no reg property
> u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/atf@3 has
> a unit name, but no reg property
> u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/fdt@1 has
> a unit name, but no reg property
> u-boot.itb.tmp: Warning (unit_address_vs_reg): Node
> /configurations/config@1 has a unit name, but no reg property
> make[1]: Leaving directory
> '/builddir/build/BUILD/u-boot-2018.05-rc2/builds/firefly-rk3399'
>


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


Re: [U-Boot] [PATCH v6 1/2] x86: Add TSC-specific timer functions

2018-04-25 Thread Bin Meng
Hi Ivan,

On Tue, Apr 24, 2018 at 4:41 PM, Bin Meng  wrote:
> Hi Ivan,
>
> On Tue, Apr 24, 2018 at 7:56 AM, Ivan Gorinov  wrote:
>> Hi Bin,
>>
>> On Mon, Apr 23, 2018 at 01:38:05AM -0600, Bin Meng wrote:
>>> > Coreboot timestamp functions and Quark memory reference code use
>>> > get_tbclk() to get TSC frequency. This will not work if another
>>> > early timer is selected.
>>>
>>> Thanks for working on this. But get_tbclk() is one API provided by the
>>> timer library. The get_tbclk_mhz() is something that is implemented by
>>> the TSC timer driver, so can we get rid of the get_tbclk_mhz() and use
>>> the get_tbclk() instead in coreboot/timestamp.c and quark/mrc_util.c?
>>
>> The Coreboot timestamp code and Quark MRC specifically use rdtsc().
>> We can replace it with timer_early_get_count() or provide a function
>> to get the TSC frequency even when another early timer is selected.
>>
>
> Good catch. Yes, we should fix coreboot timestamp code and Quark MRC
> codes to not explicitly call rdtsc.
>

Further checking the coreboot timestamp codes, I think we may have to
leave the coreboot timestamp codes as it is now.

We have the codes blow:
void timestamp_add_now(enum timestamp_id id)
{
timestamp_add(id, rdtsc());
}

We cannot replace rdtsc() with timer_early_get_count(), because this
timestamp_add_now() is called both before and after DM initialization.
If the HPET is selected as the early timer and TSC is selected as the
normal timer, the timestamp numbers are meaningless to compare against
each other.

> Another driver that explicitly calls rdtsc() is hw_watchdog_reset() in
> watchdog/tangier_wdt.c driver. We need fix that too.
>

Simon, another issue is the bootstage support. So far the
timer_get_boot_us() is not implemented by DM timer APIs.
timer_get_boot_us() is implemented per timer driver if
CONFIG_SYS_TIMER_COUNTER is not defined. Note CONFIG_SYS_TIMER_COUNTER
is non-DM stuff. That means the bootstage support is bounded by a
specific timer driver, instead of a generic library. To me this
overall timer support is somehow fragmentary.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] config: evb-rk3399: enable make uboot.itb

2018-04-25 Thread Kever Yang
Hi Peter,


On 04/25/2018 05:50 PM, Peter Robinson wrote:
> Similar to firefly 3399 enable the ability to create a FIT image
> with combined arm-trusted-firmware.
>
> Signed-off-by: Peter Robinson 

Looks good to me.
Reviewed-by: Kever Yang 

Thanks,
- Kever
> ---
>  configs/evb-rk3399_defconfig | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
> index b36f232dcb..67ba0ce015 100644
> --- a/configs/evb-rk3399_defconfig
> +++ b/configs/evb-rk3399_defconfig
> @@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
>  CONFIG_DEBUG_UART=y
>  CONFIG_FIT=y
>  CONFIG_SPL_LOAD_FIT=y
> +CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py"
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_DISPLAY_BOARDINFO_LATE=y
>  CONFIG_SPL_STACK_R=y
> @@ -25,6 +26,8 @@ CONFIG_CMD_TIME=y
>  CONFIG_SPL_OF_CONTROL=y
>  CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names 
> interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
>  CONFIG_SPL_OF_PLATDATA=y
> +CONFIG_SPL_ATF=y
> +CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_REGMAP=y


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


Re: [U-Boot] [RFC PATCH v1 0/5] Add fastboot UDP support

2018-04-25 Thread Kever Yang
Hi Jocelyn and Alex,


    It's great to see you are getting this feature from google code to be
mainline code.

    My opinion is that we should have the same fastboot cmd handling
in both UDP and USB in a common file, but not have separate code in
net/fastboot.c and drivers/usb/gadget/f_fastboot.c, could you try to merge
these two in one?

Thanks,
- Kever

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


Re: [U-Boot] [PATCH 0/8] Initial integration of AVB2.0

2018-04-25 Thread Kever Yang
Hi Igor,

    It's great to see the patch set to support AVB2.0, the upstream
libavb(from aosp) combine the AVB with A/B which I think should be
two separate feature, are you going to split them?

    BTW, do you have plan to update boot_android cmd to support avb?
the command is too weak for use now.
And any plan to add opptee_client/smcc to talk to OPTEE/ATF?

Thanks,
- Kever
On 04/25/2018 09:17 PM, Igor Opaniuk wrote:
> This series of patches introduces support of Android Verified Boot 2.0,
> which provides integrity checking of Android partitions on MMC.
>
> It integrates libavb/libavb_ab into the U-boot, provides implementation of
> AvbOps, subset of `avb` commands to run verification chain (and for debugging
> purposes), and it enables AVB2.0 verification on AM57xx HS SoC by default. 
>
> Currently, there is still no support for verification of A/B boot slots 
> and no rollback protection (for storing rollback indexes 
> there are plans to use eMMC RPMB)
>
> Libavb/libavb_ab will be deviated from AOSP upstream in the future,
> that's why minimal amount of changes were introduced into the lib sources, 
> so checkpatch may fail.
>
> For additional details check [1] AVB 2.0 README and doc/README.avb2, which
> is a part of this patchset.
>
> [1] https://android.googlesource.com/platform/external/avb/+/master/README.md
>
> Igor Opaniuk (8):
>   avb2.0: add Android Verified Boot 2.0 libraries
>   avb2.0: integrate avb 2.0 into the build system
>   avb2.0: implement AVB ops
>   cmd: avb2.0: avb command for performing verification
>   avb2.0: add boot states and dm-verity support
>   am57xx_hs: avb2.0: add support of AVB 2.0
>   test/py: avb2.0: add tests for avb commands
>   doc: avb2.0: add README about AVB2.0 integration
>
>  cmd/Kconfig  |   15 +
>  cmd/Makefile |3 +
>  cmd/avb.c|  366 
>  common/Makefile  |2 +
>  common/avb_verify.c  |  748 
>  configs/am57xx_hs_evm_defconfig  |3 +
>  doc/README.avb2  |  100 +++
>  include/avb/avb_ab_flow.h|  235 ++
>  include/avb/avb_ab_ops.h |   61 ++
>  include/avb/avb_chain_partition_descriptor.h |   54 ++
>  include/avb/avb_crypto.h |  147 
>  include/avb/avb_descriptor.h |  113 +++
>  include/avb/avb_footer.h |   68 ++
>  include/avb/avb_hash_descriptor.h|   55 ++
>  include/avb/avb_hashtree_descriptor.h|   65 ++
>  include/avb/avb_kernel_cmdline_descriptor.h  |   63 ++
>  include/avb/avb_ops.h|  196 +
>  include/avb/avb_property_descriptor.h|   89 ++
>  include/avb/avb_rsa.h|   55 ++
>  include/avb/avb_sha.h|   72 ++
>  include/avb/avb_slot_verify.h|  239 ++
>  include/avb/avb_sysdeps.h|   97 +++
>  include/avb/avb_util.h   |  259 ++
>  include/avb/avb_vbmeta_image.h   |  272 ++
>  include/avb/avb_version.h|   45 +
>  include/avb/libavb.h |   32 +
>  include/avb/libavb_ab.h  |   22 +
>  include/avb_verify.h |   97 +++
>  include/configs/am57xx_evm.h |   11 +
>  include/environment/ti/boot.h|   15 +
>  lib/Kconfig  |   20 +
>  lib/Makefile |2 +
>  lib/libavb/Makefile  |   15 +
>  lib/libavb/avb_chain_partition_descriptor.c  |   46 +
>  lib/libavb/avb_crypto.c  |  355 
>  lib/libavb/avb_descriptor.c  |  142 
>  lib/libavb/avb_footer.c  |   36 +
>  lib/libavb/avb_hash_descriptor.c |   43 +
>  lib/libavb/avb_hashtree_descriptor.c |   51 ++
>  lib/libavb/avb_kernel_cmdline_descriptor.c   |   40 +
>  lib/libavb/avb_property_descriptor.c |  167 
>  lib/libavb/avb_rsa.c |  277 ++
>  lib/libavb/avb_sha256.c  |  364 
>  lib/libavb/avb_sha512.c  |  362 
>  lib/libavb/avb_slot_verify.c | 1169 
> ++
>  lib/libavb/avb_sysdeps_posix.c   |   57 ++
>  lib/libavb/avb_util.c|  385 +
>  lib/libavb/avb_vbmeta_image.c|  290 +++
>  lib/libavb/avb_version.c |   16 +
>  lib/libavb_ab/Makefile   |9 +
>  lib/libavb_ab/avb_ab_flow.c  |  502 +++
>  test/py/tests/test_avb.py|  111 +++
>  52 files changed, 8058 insertions(+)
>  create mode 100644 cmd/avb.c
>  create mode 100644 common/avb_verify.c
>  create 

Re: [U-Boot] [U-Boot,2/3] rockchip: rk3188: add timer3 node

2018-04-25 Thread Kever Yang
Hi Philipp,

On 04/25/2018 06:17 PM, Dr. Philipp Tomsich wrote:
> Kever,
>
>> On 25 Apr 2018, at 12:04, Philipp Tomsich 
>>  wrote:
>>
>>> Add dts node for timer3.
>>> Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer"
>>> with OF_PLATDATA enable, so we override its compatible to
>>> "rockchip,rk3368-timer".
>>>
>>> Signed-off-by: Kever Yang 
>>> ---
>>>
>>> arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++
>>> arch/arm/dts/rk3188.dtsi  | 6 ++
>>> 2 files changed, 12 insertions(+)
>>>
>> Acked-by: Philipp Tomsich 
> This looks like a work-around that we’ll have to revert eventually.
> I would instead extend the driver to recognise the ‘rockchip,rk3188-timer’
> and ‘rockchip,rk3288-timer’ as well.
>
> Please confirm that both these .compatible strings should also be handled
> by the same driver and I’ll make the change when applying this series.

Do you mean you want patch like this? I do not like add lots
#ifdef/#elif like this.
+++ b/drivers/timer/rockchip_timer.c
@@ -17,7 +17,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 struct rockchip_timer_plat {
+#ifdef CONFIG_ROCKCHIP_RK3368
    struct dtd_rockchip_rk3368_timer dtd;
+#elif CONFIG_ROCKCHIP_RK3188
+   struct dtd_rockchip_rk3188_timer dtd;
+#endif
 };
 #endif
 
@@ -153,6 +157,7 @@ static const struct timer_ops rockchip_timer_ops = {
 
 static const struct udevice_id rockchip_timer_ids[] = {
    { .compatible = "rockchip,rk3368-timer" },
+   { .compatible = "rockchip,rk3188-timer" },
    {}
 };


Thanks,
- Kever
>
> Thanks,
> Philipp.


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


Re: [U-Boot] [RFC] spl: dw_mmc_socfpga: udevice structure is NULL in SPL

2018-04-25 Thread Ley Foon Tan
On Thu, Apr 26, 2018 at 10:24 AM, Dinh Nguyen  wrote:
> Hi,
>
> I am trying to add support for the sdmmc driver to use the reset manager
> driver in SPL. But I'm noticing that the udevice struct dev that passed
> into socfpga_dwmmc_probe() is NULL, thus, I can't use the
> reset_get_by_() functions to get the reset information because it needs
> the dev structure is NULL.
>
> Not sure if I'm missing a config option or something?
>
> Thanks,
> Dinh


I think you need add " u-boot,dm-pre-reloc;" into reset manager and DW
MMC device tree nodes.

Regards
Ley Foon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC] spl: dw_mmc_socfpga: udevice structure is NULL in SPL

2018-04-25 Thread Dinh Nguyen
Hi,

I am trying to add support for the sdmmc driver to use the reset manager
driver in SPL. But I'm noticing that the udevice struct dev that passed
into socfpga_dwmmc_probe() is NULL, thus, I can't use the
reset_get_by_() functions to get the reset information because it needs
the dev structure is NULL.

Not sure if I'm missing a config option or something?

Thanks,
Dinh
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: host: dwc3: fix phys init

2018-04-25 Thread Bin Meng
On Wed, Apr 25, 2018 at 5:39 PM, Neil Armstrong  wrote:
> When no PHYs are declared in the dwc3 node, the phy init fails.
> This patch checks if the "phys" property is presend and reports
> the error returned by dev_count_phandle_with_args().
>
> This patchs also fixes the styles issues added in last commit.
>
> This patch should fix the DWC3 support on the UniPhier SoC family.
>
> Fixes: 7c839ea70c49 ("usb: host: dwc3: Add support for multiple PHYs")
> Reported-by: Masahiro Yamada 
> Signed-off-by: Neil Armstrong 
> ---
>  drivers/usb/host/xhci-dwc3.c | 23 +--
>  1 file changed, 13 insertions(+), 10 deletions(-)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCHv1 4/7] board: ge: bx50v3: detect the monitor type by reading VPD earlier

2018-04-25 Thread Sebastian Reichel
From: Nandor Han 

Move the VPD reading earlier in order to establish the monitor
type as soon as possible.

The configuration of the specific environment variables needs to be
done later after the environment is configured.

Signed-off-by: Nandor Han 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c | 36 +---
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 3c8689682141..c988043a137f 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -34,6 +34,11 @@
 #include "../../../drivers/net/e1000.h"
 DECLARE_GLOBAL_DATA_PTR;
 
+struct vpd_cache;
+
+static int confidx = 3;  /* Default to b850v3. */
+static struct vpd_cache vpd;
+
 #ifndef CONFIG_SYS_I2C_EEPROM_ADDR
 # define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
 # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
@@ -620,7 +625,6 @@ static void process_vpd(struct vpd_cache *vpd)
 
 static int read_vpd(uint eeprom_bus)
 {
-   struct vpd_cache vpd;
int res;
int size = 1024;
uint8_t *data;
@@ -640,7 +644,6 @@ static int read_vpd(uint eeprom_bus)
if (res == 0) {
memset(, 0, sizeof(vpd));
vpd_reader(size, data, , vpd_callback);
-   process_vpd();
}
 
free(data);
@@ -690,8 +693,31 @@ int board_early_init_f(void)
return 0;
 }
 
+static void set_confidx(const struct vpd_cache* vpd)
+{
+   switch (vpd->product_id) {
+   case VPD_PRODUCT_B450:
+   confidx = 1;
+   break;
+   case VPD_PRODUCT_B650:
+   confidx = 2;
+   break;
+   case VPD_PRODUCT_B850:
+   confidx = 3;
+   break;
+   }
+}
+
 int board_init(void)
 {
+   setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info1);
+   setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info2);
+   setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info3);
+
+   read_vpd(CONFIG_SYS_I2C_EEPROM_BUS);
+
+   set_confidx();
+
gpio_direction_output(SUS_S3_OUT, 1);
gpio_direction_output(WIFI_EN, 1);
 #if defined(CONFIG_VIDEO_IPUV3)
@@ -706,10 +732,6 @@ int board_init(void)
 #ifdef CONFIG_MXC_SPI
setup_spi();
 #endif
-   setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info1);
-   setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info2);
-   setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info3);
-
return 0;
 }
 
@@ -775,7 +797,7 @@ void pmic_init(void)
 
 int board_late_init(void)
 {
-   read_vpd(CONFIG_SYS_I2C_EEPROM_BUS);
+   process_vpd();
 
 #ifdef CONFIG_CMD_BMODE
add_board_boot_modes(board_boot_modes);
-- 
2.17.0

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


[U-Boot] [PATCHv1 5/7] board: ge: bx50v3: use VPD instead of compile-time checks

2018-04-25 Thread Sebastian Reichel
From: Ian Ray 

B{46}50v3s have an internal LCD that needs to be configured,
in comparison with B850v3 which has only external displays.

Use VPD instead of `CONFIG_TARGET_GE_B{4,6,8}50V3' compile-time
checks to correct initialize video based on the monitor type.

Signed-off-by: Ian Ray 
Signed-off-by: Nandor Han 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index c988043a137f..b969d6255808 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -367,13 +367,14 @@ int board_cfb_skip(void)
return 0;
 }
 
-static int detect_lcd(struct display_info_t const *dev)
+static int is_b850v3(void)
 {
-   if (IS_ENABLED(CONFIG_TARGET_GE_B450V3) ||
-   IS_ENABLED(CONFIG_TARGET_GE_B650V3))
-   return 1;
+   return confidx == 3;
+}
 
-   return 0;
+static int detect_lcd(struct display_info_t const *dev)
+{
+   return !is_b850v3();
 }
 
 struct display_info_t const displays[] = {{
@@ -683,7 +684,7 @@ int board_early_init_f(void)
setup_iomux_uart();
 
 #if defined(CONFIG_VIDEO_IPUV3)
-   if (IS_ENABLED(CONFIG_TARGET_GE_B850V3))
+   if (is_b850v3())
/* Set LDB clock to Video PLL */
select_ldb_di_clock_source(MXC_PLL5_CLK);
else
@@ -721,7 +722,7 @@ int board_init(void)
gpio_direction_output(SUS_S3_OUT, 1);
gpio_direction_output(WIFI_EN, 1);
 #if defined(CONFIG_VIDEO_IPUV3)
-   if (IS_ENABLED(CONFIG_TARGET_GE_B850V3))
+   if (is_b850v3())
setup_display_b850v3();
else
setup_display_bx50v3();
-- 
2.17.0

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


[U-Boot] [PATCHv1 6/7] board: ge: bx50v3: configure video arguments using VPD

2018-04-25 Thread Sebastian Reichel
From: Ian Ray 

Configure video arguments at run-time instead of at compile-time.

Signed-off-by: Ian Ray 
Signed-off-by: Nandor Han 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c| 3 +++
 include/configs/ge_bx50v3.h | 5 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index b969d6255808..33f7ee6e3be5 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -804,6 +804,9 @@ int board_late_init(void)
add_board_boot_modes(board_boot_modes);
 #endif
 
+   if (is_b850v3())
+   env_set("videoargs", "video=DP-1:1024x768@60 
video=HDMI-A-1:1024x768@60");
+
/* board specific pmic init */
pmic_init();
 
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 44c92f9d480b..ac54485080ef 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -15,7 +15,6 @@
 #include 
 #include 
 
-#define BX50V3_BOOTARGS_EXTRA
 #if defined(CONFIG_TARGET_GE_B450V3)
 #define CONFIG_BOARD_NAME  "General Electric B450v3"
 #elif defined(CONFIG_TARGET_GE_B650V3)
@@ -23,8 +22,6 @@
 #elif defined(CONFIG_TARGET_GE_B850V3)
 #define CONFIG_BOARD_NAME  "General Electric B850v3"
 #undef BX50V3_BOOTARGS_EXTRA
-#define BX50V3_BOOTARGS_EXTRA  "video=DP-1:1024x768@60 " \
-   "video=HDMI-A-1:1024x768@60 "
 #else
 #define CONFIG_BOARD_NAME  "General Electric BA16 Generic"
 #endif
@@ -114,7 +111,7 @@
"ro rootwait cma=128M " \
"bootcause=${bootcause} " \
"${quiet} console=${console} ${rtc_status} " \
-   BX50V3_BOOTARGS_EXTRA "\0" \
+   "${videoargs}" "\0" \
"doquiet=" \
"if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
"then setenv quiet; fi\0" \
-- 
2.17.0

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


[U-Boot] [PATCHv1 7/7] board: ge: bx50v3: remove redundant targets

2018-04-25 Thread Sebastian Reichel
From: Ian Ray 

This replaces TARGET_GE_B{4,6,8}50V3 with common TARGET_GE_BX50V3.
The boards are identified automatically at runtime.

Signed-off-by: Ian Ray 
Signed-off-by: Nandor Han 
Signed-off-by: Sebastian Reichel 
---
 arch/arm/mach-imx/mx6/Kconfig | 14 +-
 board/ge/bx50v3/Kconfig   |  2 +-
 configs/ge_b650v3_defconfig   | 43 ---
 configs/ge_b850v3_defconfig   | 43 ---
 ...e_b450v3_defconfig => ge_bx50v3_defconfig} |  3 +-
 include/configs/ge_bx50v3.h   | 11 +
 6 files changed, 5 insertions(+), 111 deletions(-)
 delete mode 100644 configs/ge_b650v3_defconfig
 delete mode 100644 configs/ge_b850v3_defconfig
 rename configs/{ge_b450v3_defconfig => ge_bx50v3_defconfig} (93%)

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index aa6f5facbf8b..aeab9fe7fc5f 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -163,18 +163,8 @@ config TARGET_EMBESTMX6BOARDS
bool "embestmx6boards"
select BOARD_LATE_INIT
 
-config TARGET_GE_B450V3
-   bool "General Electric B450v3"
-   select BOARD_LATE_INIT
-   select MX6Q
-
-config TARGET_GE_B650V3
-   bool "General Electric B650v3"
-   select BOARD_LATE_INIT
-   select MX6Q
-
-config TARGET_GE_B850V3
-   bool "General Electric B850v3"
+config TARGET_GE_BX50V3
+   bool "General Electric Bx50v3"
select BOARD_LATE_INIT
select MX6Q
 
diff --git a/board/ge/bx50v3/Kconfig b/board/ge/bx50v3/Kconfig
index d50dece18ee8..993b0559302b 100644
--- a/board/ge/bx50v3/Kconfig
+++ b/board/ge/bx50v3/Kconfig
@@ -1,4 +1,4 @@
-if TARGET_GE_B450V3 || TARGET_GE_B650V3 || TARGET_GE_B850V3
+if TARGET_GE_BX50V3
 
 config IMX_CONFIG
default "board/ge/bx50v3/bx50v3.cfg"
diff --git a/configs/ge_b650v3_defconfig b/configs/ge_b650v3_defconfig
deleted file mode 100644
index e40364a14c56..
--- a/configs/ge_b650v3_defconfig
+++ /dev/null
@@ -1,43 +0,0 @@
-CONFIG_ARM=y
-CONFIG_ARCH_MX6=y
-CONFIG_SYS_TEXT_BASE=0x1780
-CONFIG_TARGET_GE_B650V3=y
-# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
-CONFIG_FIT=y
-CONFIG_BOOTDELAY=1
-CONFIG_SYS_CONSOLE_IS_IN_ENV=y
-CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
-CONFIG_SUPPORT_RAW_INITRD=y
-CONFIG_DEFAULT_FDT_FILE="imx6q-b650v3.dtb"
-CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_LAST_STAGE_INIT=y
-CONFIG_HUSH_PARSER=y
-CONFIG_CMD_BOOTZ=y
-# CONFIG_CMD_FLASH is not set
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
-CONFIG_CMD_PCI=y
-CONFIG_CMD_SF=y
-# CONFIG_CMD_NFS is not set
-CONFIG_CMD_CACHE=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FS_GENERIC=y
-CONFIG_DOS_PARTITION=y
-CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_BOOTCOUNT_LIMIT=y
-CONFIG_BOOTCOUNT_EXT=y
-CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5"
-CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
-CONFIG_FSL_ESDHC=y
-CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_NETDEVICES=y
-CONFIG_E1000=y
-CONFIG_CMD_E1000=y
-CONFIG_MXC_SPI=y
-CONFIG_OF_LIBFDT=y
-# CONFIG_EFI_LOADER is not set
-CONFIG_SPI_FLASH_WINBOND=y
diff --git a/configs/ge_b850v3_defconfig b/configs/ge_b850v3_defconfig
deleted file mode 100644
index f1e2f7ce388e..
--- a/configs/ge_b850v3_defconfig
+++ /dev/null
@@ -1,43 +0,0 @@
-CONFIG_ARM=y
-CONFIG_ARCH_MX6=y
-CONFIG_SYS_TEXT_BASE=0x1780
-CONFIG_TARGET_GE_B850V3=y
-# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
-CONFIG_FIT=y
-CONFIG_BOOTDELAY=1
-CONFIG_SYS_CONSOLE_IS_IN_ENV=y
-CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
-CONFIG_SUPPORT_RAW_INITRD=y
-CONFIG_DEFAULT_FDT_FILE="imx6q-b850v3.dtb"
-CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_LAST_STAGE_INIT=y
-CONFIG_HUSH_PARSER=y
-CONFIG_CMD_BOOTZ=y
-# CONFIG_CMD_FLASH is not set
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
-CONFIG_CMD_PCI=y
-CONFIG_CMD_SF=y
-# CONFIG_CMD_NFS is not set
-CONFIG_CMD_CACHE=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FS_GENERIC=y
-CONFIG_DOS_PARTITION=y
-CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_BOOTCOUNT_LIMIT=y
-CONFIG_BOOTCOUNT_EXT=y
-CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5"
-CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000
-CONFIG_FSL_ESDHC=y
-CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_NETDEVICES=y
-CONFIG_E1000=y
-CONFIG_CMD_E1000=y
-CONFIG_MXC_SPI=y
-CONFIG_OF_LIBFDT=y
-# CONFIG_EFI_LOADER is not set
-CONFIG_SPI_FLASH_WINBOND=y
diff --git a/configs/ge_b450v3_defconfig b/configs/ge_bx50v3_defconfig
similarity index 93%
rename from configs/ge_b450v3_defconfig
rename to configs/ge_bx50v3_defconfig
index 22c096acebe5..eebcddb4b76d 100644
--- a/configs/ge_b450v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -1,14 +1,13 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x1780
-CONFIG_TARGET_GE_B450V3=y
+CONFIG_TARGET_GE_BX50V3=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_FIT=y
 CONFIG_BOOTDELAY=1
 

[U-Boot] [PATCH] power: pmic: Let PFUZE3000 see all 256 registers

2018-04-25 Thread Trent Piepho
The PFUZE3000 uses registers addresses up to 0xff.

The DM pfuze100 driver supports both pfuze100 and pfuze3000.  Allow it
to use the device type to return the correct number of registers.

Also rename the too generic PMIC_NUM_OF_REGS enumeration value for
pfuze3000 to match the other "PFUZE3000_" prefixed enumerations and the
pfuze100 enumeration value PFUZE100_NUM_OF_REGS.

Cc: Peng Fan 
Cc: Jaehoon Chung 
Cc: Stefano Babic 
Cc: Fabio Estevam 
Signed-off-by: Trent Piepho 
---
 drivers/power/pmic/pfuze100.c   | 3 ++-
 drivers/power/pmic/pmic_pfuze3000.c | 2 +-
 include/power/pfuze3000_pmic.h  | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/pmic/pfuze100.c b/drivers/power/pmic/pfuze100.c
index a06cbc07d4..f85ad25981 100644
--- a/drivers/power/pmic/pfuze100.c
+++ b/drivers/power/pmic/pfuze100.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -26,7 +27,7 @@ static const struct pmic_child_info pmic_children_info[] = {
 
 static int pfuze100_reg_count(struct udevice *dev)
 {
-   return PFUZE100_NUM_OF_REGS;
+   return dev->driver_data == PFUZE3000 ? PFUZE3000_NUM_OF_REGS : 
PFUZE100_NUM_OF_REGS;
 }
 
 static int pfuze100_write(struct udevice *dev, uint reg, const uint8_t *buff,
diff --git a/drivers/power/pmic/pmic_pfuze3000.c 
b/drivers/power/pmic/pmic_pfuze3000.c
index ac807a801f..d0f358f808 100644
--- a/drivers/power/pmic/pmic_pfuze3000.c
+++ b/drivers/power/pmic/pmic_pfuze3000.c
@@ -23,7 +23,7 @@ int power_pfuze3000_init(unsigned char bus)
 
p->name = name;
p->interface = PMIC_I2C;
-   p->number_of_regs = PMIC_NUM_OF_REGS;
+   p->number_of_regs = PFUZE3000_NUM_OF_REGS;
p->hw.i2c.addr = CONFIG_POWER_PFUZE3000_I2C_ADDR;
p->hw.i2c.tx_num = 1;
p->bus = bus;
diff --git a/include/power/pfuze3000_pmic.h b/include/power/pfuze3000_pmic.h
index 7d66ba48d4..94946e9594 100644
--- a/include/power/pfuze3000_pmic.h
+++ b/include/power/pfuze3000_pmic.h
@@ -70,7 +70,7 @@ enum {
PFUZE3000_VLDO3CTL  = 0x70,
PFUZE3000_VLD4CTL   = 0x71,
 
-   PMIC_NUM_OF_REGS= 0x7F,
+   PFUZE3000_NUM_OF_REGS   = 0x100,
 };
 
 int power_pfuze3000_init(unsigned char bus);
-- 
2.14.3

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


[U-Boot] [PATCHv1 3/7] board: ge: bx50v3: fix display support for b{46}50v3

2018-04-25 Thread Sebastian Reichel
From: Ian Ray 

Enable Video PLL to fix non-working display support for Bx50v3
internal displays.

Signed-off-by: Ian Ray 
Signed-off-by: Nandor Han 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 5e84f2e630e3..3c8689682141 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -493,6 +493,8 @@ static void setup_display_bx50v3(void)
struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
 
+   enable_videopll();
+
/* When a reset/reboot is performed the display power needs to be turned
 * off for atleast 500ms. The boot time is ~300ms, we need to wait for
 * an additional 200ms here. Unfortunately we use external PMIC for
-- 
2.17.0

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


[U-Boot] [PATCHv1 2/7] board: ge: bx50v3: unify two switch statements

2018-04-25 Thread Sebastian Reichel
From: Nandor Han 

Simplify process_vpd() by unifying the switch statements handling
product specific configurations.

Signed-off-by: Nandor Han 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 72a2e3304bac..5e84f2e630e3 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -594,23 +594,16 @@ static void process_vpd(struct vpd_cache *vpd)
switch (vpd->product_id) {
case VPD_PRODUCT_B450:
env_set("confidx", "1");
+   i210_index = 0;
+   fec_index = 1;
break;
case VPD_PRODUCT_B650:
env_set("confidx", "2");
-   break;
-   case VPD_PRODUCT_B850:
-   env_set("confidx", "3");
-   break;
-   }
-
-   switch (vpd->product_id) {
-   case VPD_PRODUCT_B450:
-   /* fall thru */
-   case VPD_PRODUCT_B650:
i210_index = 0;
fec_index = 1;
break;
case VPD_PRODUCT_B850:
+   env_set("confidx", "3");
i210_index = 1;
fec_index = 2;
break;
-- 
2.17.0

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


[U-Boot] [PATCHv1 1/7] board: ge: bx50v3: rename detect_baseboard function

2018-04-25 Thread Sebastian Reichel
From: Ian Ray 

The detect_baseboard() function actually determines whether there is an
internal LCD panel or not.  Rename for clarity.

Signed-off-by: Ian Ray 
Signed-off-by: Nandor Han 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 46321ae666f1..72a2e3304bac 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -362,7 +362,7 @@ int board_cfb_skip(void)
return 0;
 }
 
-static int detect_baseboard(struct display_info_t const *dev)
+static int detect_lcd(struct display_info_t const *dev)
 {
if (IS_ENABLED(CONFIG_TARGET_GE_B450V3) ||
IS_ENABLED(CONFIG_TARGET_GE_B650V3))
@@ -375,7 +375,7 @@ struct display_info_t const displays[] = {{
.bus= -1,
.addr   = -1,
.pixfmt = IPU_PIX_FMT_RGB24,
-   .detect = detect_baseboard,
+   .detect = detect_lcd,
.enable = NULL,
.mode   = {
.name   = "G121X1-L03",
-- 
2.17.0

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


[U-Boot] [PATCHv1 0/7] Merge B850v3, B650v3 and B450v3 targets

2018-04-25 Thread Sebastian Reichel
Hi,

This merges B{468}50v3 into a BX50V3 target, that works for all
three machines. The different boards are detected at runtime.

-- Sebastian

Ian Ray (5):
  board: ge: bx50v3: rename detect_baseboard function
  board: ge: bx50v3: fix display support for b{46}50v3
  board: ge: bx50v3: use VPD instead of compile-time checks
  board: ge: bx50v3: configure video arguments using VPD
  board: ge: bx50v3: remove redundant targets

Nandor Han (2):
  board: ge: bx50v3: unify two switch statements
  board: ge: bx50v3: detect the monitor type by reading VPD earlier

 arch/arm/mach-imx/mx6/Kconfig | 14 +---
 board/ge/bx50v3/Kconfig   |  2 +-
 board/ge/bx50v3/bx50v3.c  | 71 ---
 configs/ge_b650v3_defconfig   | 43 ---
 configs/ge_b850v3_defconfig   | 43 ---
 ...e_b450v3_defconfig => ge_bx50v3_defconfig} |  3 +-
 include/configs/ge_bx50v3.h   | 16 +
 7 files changed, 52 insertions(+), 140 deletions(-)
 delete mode 100644 configs/ge_b650v3_defconfig
 delete mode 100644 configs/ge_b850v3_defconfig
 rename configs/{ge_b450v3_defconfig => ge_bx50v3_defconfig} (93%)

-- 
2.17.0

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


Re: [U-Boot] [PATCH v10 3/3] Adding wget

2018-04-25 Thread Duncan Hare


   From: Simon Glass 
 To: Duncan Hare  
Cc: Wolfgang Denk ; U-Boot Mailing List ; 
Joe Hershberger 
 Sent: Wednesday, April 25, 2018 4:44 PM
 Subject: Re: [PATCH v10 3/3] Adding wget
   
Hi Duncan,

On 25 April 2018 at 08:33, Duncan Hare  wrote:

>> From: Simon Glass 
>> To: Duncan Hare 
>> Cc: U-Boot Mailing List ; Joe Hershberger
>> 
>> Sent: Tuesday, April 24, 2018 10:01 PM
>> Subject: Re: [PATCH v10 3/3] Adding wget
>>
>> Hi Duncan,
>>
>>> On 22 April 2018 at 21:22, Duncan Hare  wrote:
>>>
The server can be tested with the wget command which
 can be installed on linux.
 I doubt that loop-back like this will produce the scrambling of packet
 order
 which is a feature of push down stacks for packet queues
 in the internet.

 Hence my comment in a different thread about buffering on the pi. Few of
 the
 socs appear to use net_pkt_buf  buffers for net traffic.

 If there are too many transmission errors the sending tcp drops the
 connection. My solution to this is to halve the size of
 CONFIG_SYS_RX_ETH_BUFFER until transmission works.

>>> >
 Possibly CONFIG_SYS_RX_ETH_BUFFER could come under Kconfig.
>>>
>>>Just to be clear, I was wondering about having an automated test. Manual
 tests are not very useful since people won't do them. See 'make tests' for
 all the test that we >currently >run. I'm pretty sure you could standard up
 a little server, run your wget, then shut it down, all within a pytest 
 test.
>>
>>
Regards,
Simon
>>
>> Hi Wolfgang. Simon
>>
>> Can we put a test 4 Mbyte kernel on the u-boot website for an automated test
>> for other users of TCP & Wget in u-boot?
>>
>> Then I can produce a standard u-boot script for testing.

>How about the test just creates a little (4KB) file. We don't want the
>tests to access a real network, if possible, just use localhost.

>Regards,
>Simon
4k is 4 packets. I believe most kernels are larger. 
I was think of a static server set up with a known dns name.
Thta's what I've got. 

Do the test setup once.



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


Re: [U-Boot] [PATCH v10 3/3] Adding wget

2018-04-25 Thread Simon Glass
Hi Duncan,

On 25 April 2018 at 08:33, Duncan Hare  wrote:
>
>
> 
> From: Simon Glass 
> To: Duncan Hare 
> Cc: U-Boot Mailing List ; Joe Hershberger
> 
> Sent: Tuesday, April 24, 2018 10:01 PM
> Subject: Re: [PATCH v10 3/3] Adding wget
>
> Hi Duncan,
>
> On 22 April 2018 at 21:22, Duncan Hare  wrote:
>>
>>>The server can be tested with the wget command which
>>> can be installed on linux.
>>> I doubt that loop-back like this will produce the scrambling of packet
>>> order
>>> which is a feature of push down stacks for packet queues
>>> in the internet.
>>>
>>> Hence my comment in a different thread about buffering on the pi. Few of
>>> the
>>> socs appear to use net_pkt_buf  buffers for net traffic.
>>>
>>> If there are too many transmission errors the sending tcp drops the
>>> connection. My solution to this is to halve the size of
>>> CONFIG_SYS_RX_ETH_BUFFER until transmission works.
>>>
>  >
>>> Possibly CONFIG_SYS_RX_ETH_BUFFER could come under Kconfig.
>>
>>>Just to be clear, I was wondering about having an automated test. Manual
>>> tests are not very useful since people won't do them. See 'make tests' for
>>> all the test that we >currently >run. I'm pretty sure you could standard up
>>> a little server, run your wget, then shut it down, all within a pytest test.
>
>
>>>Regards,
>>>Simon
>
> Hi Wolfgang. Simon
>
> Can we put a test 4 Mbyte kernel on the u-boot website for an automated test
> for other users of TCP & Wget in u-boot?
>
> Then I can produce a standard u-boot script for testing.

How about the test just creates a little (4KB) file. We don't want the
tests to access a real network, if possible, just use localhost.

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


Re: [U-Boot] How to modify devicetree blob inside fit image via the u-boot shell using the fdt command

2018-04-25 Thread Davis Roman
Hi Fabio,

I'm curious if you know how to modify a devicetree contained within a fit
image.

It sounds reasonable that I should be able to do this with the fdt command
while in the u-boot shell.

Currently I use 'fdt addr " then I use 'fdt print' and I
see the contents of the FIT its file. This isn't what I want unfortunately.

I'd like to be able to drill in a little further and modify a property in
my device tree.

Any ideas?

Thank you,

Davis

On Tue, Apr 24, 2018 at 4:23 PM, Davis Roman 
wrote:

> Hello
>
> How can I make an on the fly modification to a particular devicetree
> (contained inside a fitimage blob ) via the u-boot shell using the fdt
> command?
>
> The fdt command allows for modifications in ram so I figure this should be
> possible.
>
> Thank you,
>
> Davis
>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] u-boot.dtb is not generated when enabling verified boot

2018-04-25 Thread Davis Roman
Hi Fabio,

I really appreciate your response.

I've decided to try to move over to u-boot 2017.07.

I saw a bootlin talk(https://bit.ly/2HxxxfK) where they seem to indicate
that they had experienced issues with verified boot prior to this version,

So I guess I'll just bite the bullet and hope for the best.

Thank you for your time.

Davis


On Wed, Apr 25, 2018 at 11:53 AM, Fabio Estevam  wrote:

> Hi Davis,
>
> On Tue, Apr 24, 2018 at 10:19 PM, Davis Roman 
> wrote:
> > Hi Fabio,
> >
> > Thank you so much for responding. It's good to know that I'm not alone in
> > the world. :)
> >
> > Unfortunately, I'm stuck with 2016.03 for the moment.
>
> Ops, not good.
>
> > So I'm still having issues with getting verified boot to work. After
> > compiling and installing the new u-boot image on my board I noticed that
> it
> > bricked my board.
> >
> > After lots of trail and error, I tracked it down to CONFIG_OF_CONTROL.
> When
> > enabled, u-boot refuses to boot. ( no output is shown on the serial debug
> > interface)
> >
> > Since I'm using CONFIG_OF_SEPERATE, I suspect u-boot tries to read my
> > attached dtb blob however it's probably wrong.
> >
> > So my dts file looks like this:
> >
> > /dts-v1/;
> >
> > / {
> > model = "dummy";
> > compatible = "dummy";
> >
> > reset@0 {
> > compatible = "dummy";
> > };
> > };
>
> I suppose you are able to boot your board with u-boot.imx and now you
> are trying to convert it to device tree.
>
> I have never used verified boot and I don't know if verified boot
> requires device tree. I would think it is not a requirement, but will
> let others comment.
>
> If you really need to use device tree, then you need to use a real
> device tree file that describes your hardware.
>
> > Secondly, I'm doing:
> >
> > $ cat u-boot.imx my-blob.dtb > u-boot.imx.final
>
> Maybe you can take a look at this nice tutorial from Jagan:
> https://openedev.amarulasolutions.com/display/
> ODUBOOT/Boot+Linux+on+Engicam+i.MX6
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] arm: dra76: fastboot: extend cpu type for getvar command

2018-04-25 Thread Bajjuri, Praneeth

Only one patch in the series.

Wrong subject [PATCH 1/3]


On 4/25/2018 3:56 PM, Praneeth Bajjuri wrote:

'commit dda0bd674481 ("arm: dra762: Add support for device package 
identification")'
introduces ABZ and ACD package identification.

This patch is to extend usage of "fastboot getvar cpu" for
DRA76x ABZ and ACD devices.

Helps in fixing the boot warning.

Warning: fastboot.cpu: unknown CPU rev: 123863298
on
CPU  : DRA762-GP ES1.0 ABZ package
Model: TI AM5748 IDK
Board: AM574x IDK REV 1.0A

Signed-off-by: Praneeth Bajjuri 
---
  arch/arm/mach-omap2/utils.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 1d39625..391055e 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -30,6 +30,8 @@ static void omap_set_fastboot_cpu(void)
  
  	switch (cpu_rev) {

case DRA762_ES1_0:
+   case DRA762_ABZ_ES1_0:
+   case DRA762_ACD_ES1_0:
cpu = "DRA762";
break;
case DRA752_ES1_0:


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


[U-Boot] [PATCH 0/2] Boot android with FIT image

2018-04-25 Thread Praneeth Bajjuri
Enable the FDT library overlay support for all TI SOC family
and while at it
Enable android over emmc by default thru FIT image


Praneeth Bajjuri (2):
  configs: TI: Enable FIT Library overlay support
  env: ti: android: boot with FIT Image

 include/environment/ti/boot.h | 3 ++-
 lib/Kconfig   | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
1.9.1

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


[U-Boot] [PATCH 1/2] configs: TI: Enable FIT Library overlay support

2018-04-25 Thread Praneeth Bajjuri
Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri 
Suggested-by: Andrew F.Davis 
---
 lib/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/Kconfig b/lib/Kconfig
index 436b90f..6d5306a 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -252,6 +252,7 @@ config OF_LIBFDT
 
 config OF_LIBFDT_OVERLAY
bool "Enable the FDT library overlay support"
+   default y if ARCH_OMAP2PLUS || ARCH_KEYSTONE
help
  This enables the FDT library (libfdt) overlay support.
 
-- 
1.9.1

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


[U-Boot] [PATCH 2/2] env: ti: android: boot with FIT Image

2018-04-25 Thread Praneeth Bajjuri
Boot android over emmc by default thru FIT image

Signed-off-by: Praneeth Bajjuri 
Suggested-by: Andrew F.Davis 
---
 include/environment/ti/boot.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h
index 24b7783..a1767b4 100644
--- a/include/environment/ti/boot.h
+++ b/include/environment/ti/boot.h
@@ -37,6 +37,7 @@
"run mmcboot;\0" \
"emmc_android_boot=" \
"echo Trying to boot Android from eMMC ...; " \
+   "run update_to_fit; " \
"setenv eval_bootargs setenv bootargs $bootargs; " \
"run eval_bootargs; " \
"setenv mmcdev 1; " \
@@ -49,7 +50,7 @@
"part size mmc ${mmcdev} boot boot_size; " \
"mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; " \
"mmc read ${loadaddr} ${boot_start} ${boot_size}; " \
-   "bootm $loadaddr $loadaddr $fdtaddr;\0"
+   "bootm ${loadaddr}#${fdtfile};\0 "
 
 #ifdef CONFIG_OMAP54XX
 
-- 
1.9.1

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


[U-Boot] [PATCH 1/3] arm: dra76: fastboot: extend cpu type for getvar command

2018-04-25 Thread Praneeth Bajjuri
'commit dda0bd674481 ("arm: dra762: Add support for device package 
identification")'
introduces ABZ and ACD package identification.

This patch is to extend usage of "fastboot getvar cpu" for
DRA76x ABZ and ACD devices.

Helps in fixing the boot warning.

Warning: fastboot.cpu: unknown CPU rev: 123863298
on
CPU  : DRA762-GP ES1.0 ABZ package
Model: TI AM5748 IDK
Board: AM574x IDK REV 1.0A

Signed-off-by: Praneeth Bajjuri 
---
 arch/arm/mach-omap2/utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 1d39625..391055e 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -30,6 +30,8 @@ static void omap_set_fastboot_cpu(void)
 
switch (cpu_rev) {
case DRA762_ES1_0:
+   case DRA762_ABZ_ES1_0:
+   case DRA762_ACD_ES1_0:
cpu = "DRA762";
break;
case DRA752_ES1_0:
-- 
1.9.1

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


Re: [U-Boot] [PATCH 2/3] sunxi: sun8i: Add Allwinner V40 support

2018-04-25 Thread Jagan Teki
On Wed, Apr 25, 2018 at 10:54 PM, Maxime Ripard
 wrote:
> On Wed, Apr 25, 2018 at 03:20:14PM +0530, Jagan Teki wrote:
>> Allwinner V40 (sun8i) SoC features a Quad-Core Cortex-A7 ARM CPU,
>> and a Mali400 MP2 GPU from ARM. It is the automotive version of R40.
>>
>> This patch add support for V40 by reusing R40 configurations.
>>
>> MACH_SUN8I_R40_V40 is the common config option for both.
>>
>> Also fixed checkpatch warnings while making these changes.
>>
>> Signed-off-by: Jagan Teki 
>
> Is there any difference between the R40 and V40?

As of now I didn't see any diff.

>
> If not, then there's no point in doing this. We already support the R8
> and R16 that are exactly the same SoCs than the A13 and A33,
> respectively, without having to rewrite the whole thing.

What about cpu_info we can simply notify R40 for V40 SOC?

>
> And if there's some minor differences, you can just add a V40 option
> that selects the R40. In both cases, the diff is not necessary.

This I've tried and fired with Kbuild recursive definition issue.

-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] sunxi: sun8i: Add Allwinner V40 support

2018-04-25 Thread Maxime Ripard
On Wed, Apr 25, 2018 at 03:20:14PM +0530, Jagan Teki wrote:
> Allwinner V40 (sun8i) SoC features a Quad-Core Cortex-A7 ARM CPU,
> and a Mali400 MP2 GPU from ARM. It is the automotive version of R40.
> 
> This patch add support for V40 by reusing R40 configurations.
> 
> MACH_SUN8I_R40_V40 is the common config option for both.
> 
> Also fixed checkpatch warnings while making these changes.
> 
> Signed-off-by: Jagan Teki 

Is there any difference between the R40 and V40?

If not, then there's no point in doing this. We already support the R8
and R16 that are exactly the same SoCs than the A13 and A33,
respectively, without having to rewrite the whole thing.

And if there's some minor differences, you can just add a V40 option
that selects the R40. In both cases, the diff is not necessary.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] u-boot.dtb is not generated when enabling verified boot

2018-04-25 Thread Fabio Estevam
Hi Davis,

On Tue, Apr 24, 2018 at 10:19 PM, Davis Roman  wrote:
> Hi Fabio,
>
> Thank you so much for responding. It's good to know that I'm not alone in
> the world. :)
>
> Unfortunately, I'm stuck with 2016.03 for the moment.

Ops, not good.

> So I'm still having issues with getting verified boot to work. After
> compiling and installing the new u-boot image on my board I noticed that it
> bricked my board.
>
> After lots of trail and error, I tracked it down to CONFIG_OF_CONTROL. When
> enabled, u-boot refuses to boot. ( no output is shown on the serial debug
> interface)
>
> Since I'm using CONFIG_OF_SEPERATE, I suspect u-boot tries to read my
> attached dtb blob however it's probably wrong.
>
> So my dts file looks like this:
>
> /dts-v1/;
>
> / {
> model = "dummy";
> compatible = "dummy";
>
> reset@0 {
> compatible = "dummy";
> };
> };

I suppose you are able to boot your board with u-boot.imx and now you
are trying to convert it to device tree.

I have never used verified boot and I don't know if verified boot
requires device tree. I would think it is not a requirement, but will
let others comment.

If you really need to use device tree, then you need to use a real
device tree file that describes your hardware.

> Secondly, I'm doing:
>
> $ cat u-boot.imx my-blob.dtb > u-boot.imx.final

Maybe you can take a look at this nice tutorial from Jagan:
https://openedev.amarulasolutions.com/display/ODUBOOT/Boot+Linux+on+Engicam+i.MX6
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v1 0/5] Add fastboot UDP support

2018-04-25 Thread Lukasz Majewski
On Wed, 25 Apr 2018 13:50:50 +0100
Alex Kiernan  wrote:

> On Wed, Apr 25, 2018 at 8:53 AM, Alex Kiernan
>  wrote:
> > On Tue, Apr 24, 2018 at 6:10 PM, Jocelyn Bohr 
> > wrote:  
> >> Thanks so much for porting this, Alex!
> >>  
> 
> ...
> 
> >>
> >> You can select both network and USB fastboot to be enabled with
> >> the Kconfig, but at runtime you have to select to wait on either
> >> USB or network by running
> >> "fastboot udp" or "fastboot usb ". When the Android
> >> bootloader
> >> gets the command to reboot back to fastboot, it will read the
> >> "fastbootcmd" env
> >> variable and run that as a command
> >> (common/android_bootloader.c:151). 
> >
> > Thanks for that (especially the detail on android_bootloader which
> > I'd not read through). The bit that concerns me is in
> > timed_send_info:
> >
> >   +/**
> >   + * Send an INFO packet during long commands based on timer. If
> >   + * CONFIG_UDP_FUNCTION_FASTBOOT is defined, an INFO packet is
> > sent
> >   + * if the time is 30 seconds after start. Else, noop.
> >   + *
> >   + * TODO: Handle the situation where both UDP and USB fastboot are
> >   + *   enabled.
> >   + *
> >   + * @param start:  Time since last INFO packet was sent.
> >   + * @param msg:String describing the reason for waiting
> >   + */
> >   +void timed_send_info(ulong *start, const char *msg);
> >
> > The code in timed_send_info is guarded with an ifdef, rather than
> > based on the transport that's been selected at runtime. Do we need
> > to make timed_send_info work based on the runtime state, rather
> > than the compile time, or can we drop the ifdef guard and remove
> > the TODO? I guess I'm assuming the former, but with no way to test
> > USB I don't want head off down the wrong road!
> >  
> 
> Having started digging through how we'd merge the two code paths, it's
> clear if you had UDP and USB both enabled at compile time and then try
> and run the USB path it'll try and do UDP things in timed_send_info,
> which can't be good!
> 

I think that we can assume operation of only one medium in a time - i.e.

when you issue fastboot usb then no UDP support (and opposite).


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de


pgprr61J8cEhD.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v10 3/3] Adding wget

2018-04-25 Thread Duncan Hare


 From: Simon Glass 
 To: Duncan Hare  
Cc: U-Boot Mailing List ; Joe Hershberger 

 Sent: Tuesday, April 24, 2018 10:01 PM
 Subject: Re: [PATCH v10 3/3] Adding wget
   
Hi Duncan,

On 22 April 2018 at 21:22, Duncan Hare  wrote:
>
>>The server can be tested with the wget command which
>> can be installed on linux.
>> I doubt that loop-back like this will produce the scrambling of packet order
>> which is a feature of push down stacks for packet queues
>> in the internet.
>>
>> Hence my comment in a different thread about buffering on the pi. Few of the
>> socs appear to use net_pkt_buf  buffers for net traffic.
>>
>> If there are too many transmission errors the sending tcp drops the
>> connection. My solution to this is to halve the size of
>> CONFIG_SYS_RX_ETH_BUFFER until transmission works.
>>
 > 
>> Possibly CONFIG_SYS_RX_ETH_BUFFER could come under Kconfig.
>
>>Just to be clear, I was wondering about having an automated test. Manual 
>>tests are not very useful since people won't do them. See 'make tests' for 
>>all the test that we >currently >run. I'm pretty sure you could standard up a 
>>little server, run your wget, then shut it down, all within a pytest test.

>>Regards,
>>Simon

Hi Wolfgang. Simon
Can we put a test 4 Mbyte kernel on the u-boot website for an automated test 
for other users of TCP & Wget in u-boot?
Then I can produce a standard u-boot script for testing.
RegardsDuncan Hare
   
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/7] arm: Introduce v7R support

2018-04-25 Thread Michal Simek
On 25.4.2018 11:14, Lokesh Vutla wrote:
> The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded,
> real-time systems. It implements the ARMv7-R architecture, and includes
> Thumb-2 technology for optimum code density and processing throughput.
> 
> Except for MPU(Memory Protection Unit) and few CP15 registers, most of the
> features are compatible with v7 architecture. This series adds minimal
> support for v7-R architecture by reusing the v7 support. Also adding
> support for MPU.
> 
> Changes since RFC:
> - Renamed CPUV7 as CPU_V7A
> - Renamed MMU as SYS_ARM_MMU
> - Added SYS_ARM_CACHE_CP15
> 
> travis-ci build report: 
> https://travis-ci.org/lokeshvutla/u-boot/builds/370904667
> 
> Lokesh Vutla (6):
>   arm: v7: Update VBAR only if available
>   arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A
>   arm: v7: Kconfig: Add entry for MMU
>   arm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15
>   arm: v7R: Add support for MPU
>   arm: v7R: Add support for enabling caches
> 
> Michal Simek (1):
>   arm: v7R: Add initial support
> 
>  arch/arm/Kconfig  |  95 ---
>  arch/arm/Makefile |   8 +-
>  arch/arm/cpu/armv7/Kconfig|   4 +-
>  arch/arm/cpu/armv7/Makefile   |   2 +
>  arch/arm/cpu/armv7/mpu_v7r.c  | 120 ++
>  arch/arm/cpu/armv7/start.S|   4 +
>  arch/arm/cpu/armv7m/Makefile  |   3 +-
>  arch/arm/cpu/armv7m/mpu.c |  41 +-
>  arch/arm/include/asm/armv7m_mpu.h |  69 +
>  arch/arm/include/asm/system.h |   4 +-
>  arch/arm/lib/Makefile |   6 +-
>  arch/arm/lib/cache-cp15.c |  16 +++-
>  arch/arm/mach-at91/Kconfig|  12 +--
>  arch/arm/mach-at91/Makefile   |   2 +-
>  arch/arm/mach-at91/config.mk  |   2 +-
>  arch/arm/mach-bcm283x/Kconfig |   4 +-
>  arch/arm/mach-exynos/Kconfig  |   4 +-
>  arch/arm/mach-exynos/Makefile |   2 +-
>  arch/arm/mach-exynos/soc.c|   2 +-
>  arch/arm/mach-mvebu/Kconfig   |   2 +-
>  arch/arm/mach-qemu/Kconfig|   2 +-
>  arch/arm/mach-rmobile/Kconfig |   2 +-
>  arch/arm/mach-rockchip/Kconfig|  12 +--
>  arch/arm/mach-stm32mp/Kconfig |   2 +-
>  arch/arm/mach-sunxi/Kconfig   |  22 +++---
>  arch/arm/mach-tegra/Kconfig   |   2 +-
>  arch/arm/mach-uniphier/Kconfig|   2 +-
>  arch/arm/mach-uniphier/Makefile   |   2 +-
>  cmd/Kconfig   |   2 +-
>  drivers/serial/arm_dcc.c  |   2 +-
>  30 files changed, 330 insertions(+), 122 deletions(-)
>  create mode 100644 arch/arm/cpu/armv7/mpu_v7r.c
> 

For the whole series:

Tested-by: Michal Simek 

I will send zynqmp r5 support on the top of this.

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


[U-Boot] [PATCH 7/8] test/py: avb2.0: add tests for avb commands

2018-04-25 Thread Igor Opaniuk
1. Run AVB 2.0 full verification chain, avb verify
2. Check if 'avb get_uuid' works, compare results with
'part list mmc 1' output
3. Test `avb read` commands, which reads N bytes from a partition
identified by a name

Signed-off-by: Igor Opaniuk 
---
 test/py/tests/test_avb.py | 111 ++
 1 file changed, 111 insertions(+)
 create mode 100644 test/py/tests/test_avb.py

diff --git a/test/py/tests/test_avb.py b/test/py/tests/test_avb.py
new file mode 100644
index 000..770bdde
--- /dev/null
+++ b/test/py/tests/test_avb.py
@@ -0,0 +1,111 @@
+# Copyright (c) 2018, Linaro Limited
+#
+# SPDX-License-Identifier:  GPL-2.0+
+#
+# Android Verified Boot 2.0 Test
+
+"""
+This tests Android Verified Boot 2.0 support in U-boot:
+
+For additional details about how to build proper vbmeta partition
+check doc/README.avb2
+
+For configuration verification:
+- Corrupt boot partition and check for failure
+- Corrupt vbmeta partition and check for failure
+"""
+
+import pytest
+import u_boot_utils as util
+
+# defauld mmc id
+mmc_dev = 1
+temp_addr = 0x9000
+temp_addr2 = 0x90002000
+
+def test_avb_verify(u_boot_console):
+"""Run AVB 2.0 boot verification chain with avb subset of commands
+"""
+
+success_str = "Verification passed successfully"
+
+response = u_boot_console.run_command('avb init %s' %str(mmc_dev))
+assert response == ''
+response = u_boot_console.run_command('avb verify')
+assert response.find(success_str)
+
+
+def test_avb_mmc_uuid(u_boot_console):
+"""Check if 'avb get_uuid' works, compare results with
+'part list mmc 1' output
+"""
+
+response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
+assert response == ''
+
+response = u_boot_console.run_command('mmc rescan; mmc dev %s' %
+  str(mmc_dev))
+assert response.find('is current device')
+
+part_lines = u_boot_console.run_command('mmc part').splitlines()
+part_list = {}
+cur_partname = ""
+
+for line in part_lines:
+if "\"" in line:
+start_pt = line.find("\"")
+end_pt = line.find("\"", start_pt + 1)
+cur_partname = line[start_pt + 1: end_pt]
+
+if "guid:" in line:
+guid_to_check = line.split("guid:\t")
+part_list[cur_partname] = guid_to_check[1]
+
+# lets check all guids with avb get_guid
+for part, guid in part_list.iteritems():
+avb_guid_resp = u_boot_console.run_command('avb get_uuid %s' % part)
+assert guid == avb_guid_resp.split("UUID: ")[1]
+
+
+def test_avb_read_rb(u_boot_console):
+"""Test reading rollback indexes
+"""
+
+response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
+assert response == ''
+
+response = u_boot_console.run_command('avb read_rb 1')
+
+
+def test_avb_is_unlocked(u_boot_console):
+"""Test if device is in the unlocked state
+"""
+
+response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
+assert response == ''
+
+response = u_boot_console.run_command('avb is_unlocked')
+
+
+def test_avb_mmc_read(u_boot_console):
+"""Test mmc read operation
+"""
+
+response = u_boot_console.run_command('mmc rescan; mmc dev %s 0' %
+  str(mmc_dev))
+assert response.find('is current device')
+
+response = u_boot_console.run_command('mmc read 0x%x 0x100 0x1' % 
temp_addr)
+assert response.find('read: OK')
+
+response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
+assert response == ''
+
+response = u_boot_console.run_command('avb read_part xloader 0 100 0x%x' %
+   temp_addr2)
+assert response.find('Read 512 bytes')
+
+# Now lets compare two buffers
+response = u_boot_console.run_command('cmp 0x%x 0x%x 40' %
+  (temp_addr, temp_addr2))
+assert response.find('64 word')
-- 
2.7.4

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


[U-Boot] [PATCH 4/8] cmd: avb2.0: avb command for performing verification

2018-04-25 Thread Igor Opaniuk
Enable a "avb" command to execute Android Verified
Boot 2.0 operations. It includes such subcommands:
  avb init - initialize avb2 subsystem
  avb read_rb - read rollback index
  avb write_rb - write rollback index
  avb is_unlocked - check device lock state
  avb get_uuid - read and print uuid of a partition
  avb read_part - read data from partition
  avb read_part_hex - read data from partition and output to stdout
  avb write_part - write data to partition
  avb verify - run full verification chain

Signed-off-by: Igor Opaniuk 
---
 cmd/Kconfig  |  15 +++
 cmd/Makefile |   3 +
 cmd/avb.c| 351 +++
 3 files changed, 369 insertions(+)
 create mode 100644 cmd/avb.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index bc1d2f3..96695ff 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1675,6 +1675,21 @@ config CMD_TRACE
  for analsys (e.g. using bootchart). See doc/README.trace for full
  details.
 
+config CMD_AVB
+   bool "avb - Android Verified Boot 2.0 operations"
+   depends on LIBAVB_AB
+   help
+ Enables a "avb" command to perform verification of partitions using
+ Android Verified Boot 2.0 functionality. It includes such subcommands:
+   avb init - initialize avb2 subsystem
+   avb read_rb - read rollback index
+   avb write_rb - write rollback index
+   avb is_unlocked - check device lock state
+   avb get_uuid - read and print uuid of a partition
+   avb read_part - read data from partition
+   avb read_part_hex - read data from partition and output to stdout
+   avb write_part - write data to partition
+   avb verify - run full verification chain
 endmenu
 
 config CMD_UBI
diff --git a/cmd/Makefile b/cmd/Makefile
index c4269ac..bbf6c2a 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -151,6 +151,9 @@ obj-$(CONFIG_CMD_REGULATOR) += regulator.o
 
 obj-$(CONFIG_CMD_BLOB) += blob.o
 
+# Android Verified Boot 2.0
+obj-$(CONFIG_CMD_AVB) += avb.o
+
 obj-$(CONFIG_X86) += x86/
 endif # !CONFIG_SPL_BUILD
 
diff --git a/cmd/avb.c b/cmd/avb.c
new file mode 100644
index 000..d040906
--- /dev/null
+++ b/cmd/avb.c
@@ -0,0 +1,351 @@
+
+/*
+ * (C) Copyright 2018, Linaro Limited
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AVB_BOOTARGS   "avb_bootargs"
+static struct AvbOps *avb_ops;
+
+static const char * const requested_partitions[] = {"boot",
+"system",
+"vendor",
+NULL};
+
+int do_avb_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   unsigned long mmc_dev;
+
+   if (argc != 2)
+   return CMD_RET_USAGE;
+
+   mmc_dev = simple_strtoul(argv[1], NULL, 16);
+
+   if (avb_ops)
+   avb_ops_free(avb_ops);
+
+   avb_ops = avb_ops_alloc(mmc_dev);
+   if (avb_ops)
+   return CMD_RET_SUCCESS;
+
+   return CMD_RET_FAILURE;
+}
+
+int do_avb_read_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   const char *part;
+   s64 offset;
+   size_t bytes, bytes_read = 0;
+   void *buffer;
+
+   if (!avb_ops) {
+   printf("AVB 2.0 is not initialized, please run 'avb init'\n");
+   return CMD_RET_USAGE;
+   }
+
+   if (argc != 5)
+   return CMD_RET_USAGE;
+
+   part = argv[1];
+   offset = simple_strtoul(argv[2], NULL, 16);
+   bytes = simple_strtoul(argv[3], NULL, 16);
+   buffer = (void *)simple_strtoul(argv[4], NULL, 16);
+
+   if (avb_ops->read_from_partition(avb_ops, part, offset, bytes,
+buffer, _read) ==
+AVB_IO_RESULT_OK) {
+   printf("Read %zu bytes\n", bytes_read);
+   return CMD_RET_SUCCESS;
+   }
+
+   return CMD_RET_FAILURE;
+}
+
+int do_avb_read_part_hex(cmd_tbl_t *cmdtp, int flag, int argc,
+char *const argv[])
+{
+   const char *part;
+   s64 offset;
+   size_t bytes, bytes_read = 0;
+   char *buffer;
+
+   if (!avb_ops) {
+   printf("AVB 2.0 is not initialized, please run 'avb init'\n");
+   return CMD_RET_USAGE;
+   }
+
+   if (argc != 4)
+   return CMD_RET_USAGE;
+
+   part = argv[1];
+   offset = simple_strtoul(argv[2], NULL, 16);
+   bytes = simple_strtoul(argv[3], NULL, 16);
+
+   buffer = malloc(bytes);
+   if (!buffer) {
+   printf("Failed to tlb_allocate buffer for data\n");
+   return CMD_RET_FAILURE;
+   }
+   memset(buffer, 0, bytes);
+
+   if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, buffer,
+_read) == AVB_IO_RESULT_OK) {

[U-Boot] [PATCH 8/8] doc: avb2.0: add README about AVB2.0 integration

2018-04-25 Thread Igor Opaniuk
Contains:
1. Overview of Android Verified Boot 2.0
2. Description of avb subset of commands
3. Examples of errors when boot/vendor/system/vbmeta partitions
are tampered
4. Examples of enabling AVB2.0 on your setup

Signed-off-by: Igor Opaniuk 
---
 doc/README.avb2 | 100 
 1 file changed, 100 insertions(+)
 create mode 100644 doc/README.avb2

diff --git a/doc/README.avb2 b/doc/README.avb2
new file mode 100644
index 000..40db7c5
--- /dev/null
+++ b/doc/README.avb2
@@ -0,0 +1,100 @@
+Android Verified Boot 2.0
+
+This file contains information about the current support of Android Verified
+Boot 2.0 in U-boot
+
+1. OVERVIEW
+-
+Verified Boot establishes a chain of trust from the bootloader to system images
+* Provides integrity checking for:
+  - Android Boot image: Linux kernel + ramdisk. RAW hashing of the whole
+partition is done and the hash is compared with the one stored in
+the VBMeta image
+  - system/vendor partitions: verifying root hash of dm-verity hashtrees.
+* Provides capabilities for rollback protection.
+
+Integrity of the bootloader (U-boot BLOB and environment) is out of scope.
+
+For additional details check:
+https://android.googlesource.com/platform/external/avb/+/master/README.md
+
+
+2. AVB 2.0 U-BOOT SHELL COMMANDS
+---
+Provides CLI interface to invoke AVB 2.0 verification + misc. commands for
+different testing purposes:
+
+avb init  - initialize avb 2.0 for 
+avb verify - run verification process using hash data from vbmeta structure
+avb read_rb  - read rollback index at location 
+avb write_rb   - write rollback index  to 
+avb is_unlocked - returns unlock status of the device
+avb get_uuid  - read and print uuid of partition 
+avb read_part - read  bytes from
+partition  to buffer 
+avb write_part - write  bytes to
+ by  using data from 
+
+
+3. PARTITIONS TAMPERING (EXAMPLE)
+---
+Boot or system/vendor (dm-verity metadata section) is tampered:
+=> avb init 1
+=> avb verify
+avb_slot_verify.c:175: ERROR: boot: Hash of data does not match digest in
+descriptor.
+Slot verification result: ERROR_IO
+
+Vbmeta partition is tampered:
+=> avb init 1
+=> avb verify
+avb_vbmeta_image.c:206: ERROR: Hash does not match!
+avb_slot_verify.c:388: ERROR: vbmeta: Error verifying vbmeta image:
+HASH_MISMATCH
+Slot verification result: ERROR_IO
+
+
+4. ENABLE ON YOUR BOARD
+---
+The following options must be enabled:
+CONFIG_LIBAVB=y
+CONFIG_LIBAVB_AB=y
+CONFIG_CMD_AVB=y
+
+
+Then add `avb verify` invocation to your android boot sequence of commands,
+e.g.:
+
+=> avb_verify=avb init $mmcdev; avb verify;
+=> if run avb_verify; then   \
+echo AVB verification OK. Continue boot; \
+set bootargs $bootargs $avb_bootargs;\
+   else  \
+echo AVB verification failed;\
+exit;\
+   fi;   \
+
+=> emmc_android_boot=   \
+   echo Trying to boot Android from eMMC ...;   \
+   ...  \
+   run avb_verify;  \
+   mmc read ${fdtaddr} ${fdt_start} ${fdt_size};\
+   mmc read ${loadaddr} ${boot_start} ${boot_size}; \
+   bootm $loadaddr $loadaddr $fdtaddr;  \
+
+
+To switch on automatic generation of vbmeta partition in AOSP build, add these
+lines to device configuration mk file:
+
+BOARD_AVB_ENABLE := true
+BOARD_AVB_ALGORITHM := SHA512_RSA4096
+BOARD_BOOTIMAGE_PARTITION_SIZE := 
+
+After flashing U-boot don't forget to update environment and write new
+partition table:
+=> env default -f -a
+=> setenv partitions $partitions_android
+=> env save
+=> fas 1
+
+$ fastboot oem format
-- 
2.7.4

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


[U-Boot] [PATCH 2/8] avb2.0: integrate avb 2.0 into the build system

2018-04-25 Thread Igor Opaniuk
Integrate libavb/libavb_ab into the build system. Introduce CONFIG_LIBAVB
and CONFIG_LIBAVB_AVB options for enabling build.

Signed-off-by: Igor Opaniuk 
---
 lib/Kconfig| 20 
 lib/Makefile   |  2 ++
 lib/libavb/Makefile| 15 +++
 lib/libavb_ab/Makefile |  9 +
 4 files changed, 46 insertions(+)
 create mode 100644 lib/libavb/Makefile
 create mode 100644 lib/libavb_ab/Makefile

diff --git a/lib/Kconfig b/lib/Kconfig
index 436b90f..0429e17 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -142,6 +142,26 @@ config TPM
 
 endmenu
 
+menu "Android Verified Boot"
+
+config LIBAVB
+   bool "Android Verified Boot 2.0 support"
+   depends on ANDROID_BOOT_IMAGE
+   help
+ This enables support of Android Verified Boot 2.0 which can be used
+ to assure the end user of the integrity of the software running on a
+ device. Introduces such features as boot chain of trust, rollback
+ protection etc.
+
+config LIBAVB_AB
+   bool "Android Verified Boot 2.0 A/B slot support"
+   depends on LIBAVB
+   help
+ This enables support of Android Verified Boot for A/B slots, that
+ are used in seamless system updates.
+
+endmenu
+
 menu "Hashing Support"
 
 config SHA1
diff --git a/lib/Makefile b/lib/Makefile
index 35da570..934f8a7 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -55,6 +55,8 @@ obj-$(CONFIG_$(SPL_)ZLIB) += zlib/
 obj-$(CONFIG_$(SPL_)GZIP) += gunzip.o
 obj-$(CONFIG_$(SPL_)LZO) += lzo/
 
+obj-$(CONFIG_LIBAVB) += libavb/
+obj-$(CONFIG_LIBAVB_AB) += libavb_ab/
 
 obj-$(CONFIG_$(SPL_TPL_)SAVEENV) += qsort.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += libfdt/
diff --git a/lib/libavb/Makefile b/lib/libavb/Makefile
new file mode 100644
index 000..0a06a26
--- /dev/null
+++ b/lib/libavb/Makefile
@@ -0,0 +1,15 @@
+#
+# (C) Copyright 2017 Linaro Limited
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-$(CONFIG_LIBAVB) += avb_chain_partition_descriptor.o avb_crypto.o
+obj-$(CONFIG_LIBAVB) += avb_footer.o avb_hashtree_descriptor.o
+obj-$(CONFIG_LIBAVB) += avb_property_descriptor.o avb_sha256.o
+obj-$(CONFIG_LIBAVB) += avb_slot_verify.o avb_util.o avb_version.o
+obj-$(CONFIG_LIBAVB) += avb_descriptor.o avb_hash_descriptor.o
+obj-$(CONFIG_LIBAVB) += avb_kernel_cmdline_descriptor.o avb_rsa.o avb_sha512.o
+obj-$(CONFIG_LIBAVB) += avb_sysdeps_posix.o avb_vbmeta_image.o
+
+ccflags-y = -DAVB_COMPILATION
diff --git a/lib/libavb_ab/Makefile b/lib/libavb_ab/Makefile
new file mode 100644
index 000..f4bd72e
--- /dev/null
+++ b/lib/libavb_ab/Makefile
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2017 Linaro Limited
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-$(CONFIG_LIBAVB_AB) += avb_ab_flow.o
+
+ccflags-y = -DAVB_COMPILATION
-- 
2.7.4

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


[U-Boot] [PATCH 0/8] Initial integration of AVB2.0

2018-04-25 Thread Igor Opaniuk
This series of patches introduces support of Android Verified Boot 2.0,
which provides integrity checking of Android partitions on MMC.

It integrates libavb/libavb_ab into the U-boot, provides implementation of
AvbOps, subset of `avb` commands to run verification chain (and for debugging
purposes), and it enables AVB2.0 verification on AM57xx HS SoC by default. 

Currently, there is still no support for verification of A/B boot slots 
and no rollback protection (for storing rollback indexes 
there are plans to use eMMC RPMB)

Libavb/libavb_ab will be deviated from AOSP upstream in the future,
that's why minimal amount of changes were introduced into the lib sources, 
so checkpatch may fail.

For additional details check [1] AVB 2.0 README and doc/README.avb2, which
is a part of this patchset.

[1] https://android.googlesource.com/platform/external/avb/+/master/README.md

Igor Opaniuk (8):
  avb2.0: add Android Verified Boot 2.0 libraries
  avb2.0: integrate avb 2.0 into the build system
  avb2.0: implement AVB ops
  cmd: avb2.0: avb command for performing verification
  avb2.0: add boot states and dm-verity support
  am57xx_hs: avb2.0: add support of AVB 2.0
  test/py: avb2.0: add tests for avb commands
  doc: avb2.0: add README about AVB2.0 integration

 cmd/Kconfig  |   15 +
 cmd/Makefile |3 +
 cmd/avb.c|  366 
 common/Makefile  |2 +
 common/avb_verify.c  |  748 
 configs/am57xx_hs_evm_defconfig  |3 +
 doc/README.avb2  |  100 +++
 include/avb/avb_ab_flow.h|  235 ++
 include/avb/avb_ab_ops.h |   61 ++
 include/avb/avb_chain_partition_descriptor.h |   54 ++
 include/avb/avb_crypto.h |  147 
 include/avb/avb_descriptor.h |  113 +++
 include/avb/avb_footer.h |   68 ++
 include/avb/avb_hash_descriptor.h|   55 ++
 include/avb/avb_hashtree_descriptor.h|   65 ++
 include/avb/avb_kernel_cmdline_descriptor.h  |   63 ++
 include/avb/avb_ops.h|  196 +
 include/avb/avb_property_descriptor.h|   89 ++
 include/avb/avb_rsa.h|   55 ++
 include/avb/avb_sha.h|   72 ++
 include/avb/avb_slot_verify.h|  239 ++
 include/avb/avb_sysdeps.h|   97 +++
 include/avb/avb_util.h   |  259 ++
 include/avb/avb_vbmeta_image.h   |  272 ++
 include/avb/avb_version.h|   45 +
 include/avb/libavb.h |   32 +
 include/avb/libavb_ab.h  |   22 +
 include/avb_verify.h |   97 +++
 include/configs/am57xx_evm.h |   11 +
 include/environment/ti/boot.h|   15 +
 lib/Kconfig  |   20 +
 lib/Makefile |2 +
 lib/libavb/Makefile  |   15 +
 lib/libavb/avb_chain_partition_descriptor.c  |   46 +
 lib/libavb/avb_crypto.c  |  355 
 lib/libavb/avb_descriptor.c  |  142 
 lib/libavb/avb_footer.c  |   36 +
 lib/libavb/avb_hash_descriptor.c |   43 +
 lib/libavb/avb_hashtree_descriptor.c |   51 ++
 lib/libavb/avb_kernel_cmdline_descriptor.c   |   40 +
 lib/libavb/avb_property_descriptor.c |  167 
 lib/libavb/avb_rsa.c |  277 ++
 lib/libavb/avb_sha256.c  |  364 
 lib/libavb/avb_sha512.c  |  362 
 lib/libavb/avb_slot_verify.c | 1169 ++
 lib/libavb/avb_sysdeps_posix.c   |   57 ++
 lib/libavb/avb_util.c|  385 +
 lib/libavb/avb_vbmeta_image.c|  290 +++
 lib/libavb/avb_version.c |   16 +
 lib/libavb_ab/Makefile   |9 +
 lib/libavb_ab/avb_ab_flow.c  |  502 +++
 test/py/tests/test_avb.py|  111 +++
 52 files changed, 8058 insertions(+)
 create mode 100644 cmd/avb.c
 create mode 100644 common/avb_verify.c
 create mode 100644 doc/README.avb2
 create mode 100644 include/avb/avb_ab_flow.h
 create mode 100644 include/avb/avb_ab_ops.h
 create mode 100644 include/avb/avb_chain_partition_descriptor.h
 create mode 100644 include/avb/avb_crypto.h
 create mode 100644 include/avb/avb_descriptor.h
 create mode 100644 include/avb/avb_footer.h
 create mode 100644 include/avb/avb_hash_descriptor.h
 create mode 100644 include/avb/avb_hashtree_descriptor.h
 create mode 100644 include/avb/avb_kernel_cmdline_descriptor.h
 create mode 100644 include/avb/avb_ops.h
 create mode 100644 

[U-Boot] [PATCH 3/8] avb2.0: implement AVB ops

2018-04-25 Thread Igor Opaniuk
Implement AVB ops on top of existing mmc subsystem API. Currently there
is a full implementation of such operations, defined by [1]
AVB2.0 specification:

.read_from_partition() - reads N bytes from a partition identified by
a name.
.write_to_partition() - Writes N bytes to a partition identified by a name.
.validate_vbmeta_public_key() - checks if the given public ‘vbmeta’
partition is trusted.
.get_unique_guid_for_partition() - Gets the GUID for a partition identified
by a string name.

As [1] specification recommends to use tamper-evident storage for storing
rollback indexes and device state (LOCKED/UNLOCKED),
currently are only stubs instead of full implementation for these ops:
.read_rollback_index() - Gets the rollback index for a given index location
.write_rollback_index() - Sets the rollback index to a given location
.read_is_device_unlocked() - Gets where the device is unlocked

[1] https://android.googlesource.com/platform/external/avb/+/master/README.md

Signed-off-by: Igor Opaniuk 
---
 common/Makefile  |   2 +
 common/avb_verify.c  | 614 +++
 include/avb_verify.h |  80 +++
 3 files changed, 696 insertions(+)
 create mode 100644 common/avb_verify.c
 create mode 100644 include/avb_verify.h

diff --git a/common/Makefile b/common/Makefile
index 7011dad..7ae7ee1 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -136,3 +136,5 @@ obj-$(CONFIG_$(SPL_)LOG) += log.o
 obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
 obj-y += s_record.o
 obj-y += xyzModem.o
+
+obj-$(CONFIG_LIBAVB_AB) += avb_verify.o
diff --git a/common/avb_verify.c b/common/avb_verify.c
new file mode 100644
index 000..b3d1229
--- /dev/null
+++ b/common/avb_verify.c
@@ -0,0 +1,614 @@
+/*
+ * (C) Copyright 2018, Linaro Limited
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+const unsigned char avb_root_pub[1032] = {
+   0x0, 0x0, 0x10, 0x0, 0x55, 0xd9, 0x4, 0xad, 0xd8, 0x4,
+   0xaf, 0xe3, 0xd3, 0x84, 0x6c, 0x7e, 0xd, 0x89, 0x3d, 0xc2,
+   0x8c, 0xd3, 0x12, 0x55, 0xe9, 0x62, 0xc9, 0xf1, 0xf, 0x5e,
+   0xcc, 0x16, 0x72, 0xab, 0x44, 0x7c, 0x2c, 0x65, 0x4a, 0x94,
+   0xb5, 0x16, 0x2b, 0x0, 0xbb, 0x6, 0xef, 0x13, 0x7, 0x53,
+   0x4c, 0xf9, 0x64, 0xb9, 0x28, 0x7a, 0x1b, 0x84, 0x98, 0x88,
+   0xd8, 0x67, 0xa4, 0x23, 0xf9, 0xa7, 0x4b, 0xdc, 0x4a, 0xf,
+   0xf7, 0x3a, 0x18, 0xae, 0x54, 0xa8, 0x15, 0xfe, 0xb0, 0xad,
+   0xac, 0x35, 0xda, 0x3b, 0xad, 0x27, 0xbc, 0xaf, 0xe8, 0xd3,
+   0x2f, 0x37, 0x34, 0xd6, 0x51, 0x2b, 0x6c, 0x5a, 0x27, 0xd7,
+   0x96, 0x6, 0xaf, 0x6b, 0xb8, 0x80, 0xca, 0xfa, 0x30, 0xb4,
+   0xb1, 0x85, 0xb3, 0x4d, 0xaa, 0xaa, 0xc3, 0x16, 0x34, 0x1a,
+   0xb8, 0xe7, 0xc7, 0xfa, 0xf9, 0x9, 0x77, 0xab, 0x97, 0x93,
+   0xeb, 0x44, 0xae, 0xcf, 0x20, 0xbc, 0xf0, 0x80, 0x11, 0xdb,
+   0x23, 0xc, 0x47, 0x71, 0xb9, 0x6d, 0xd6, 0x7b, 0x60, 0x47,
+   0x87, 0x16, 0x56, 0x93, 0xb7, 0xc2, 0x2a, 0x9a, 0xb0, 0x4c,
+   0x1, 0xc, 0x30, 0xd8, 0x93, 0x87, 0xf0, 0xed, 0x6e, 0x8b,
+   0xbe, 0x30, 0x5b, 0xf6, 0xa6, 0xaf, 0xdd, 0x80, 0x7c, 0x45,
+   0x5e, 0x8f, 0x91, 0x93, 0x5e, 0x44, 0xfe, 0xb8, 0x82, 0x7,
+   0xee, 0x79, 0xca, 0xbf, 0x31, 0x73, 0x62, 0x58, 0xe3, 0xcd,
+   0xc4, 0xbc, 0xc2, 0x11, 0x1d, 0xa1, 0x4a, 0xbf, 0xfe, 0x27,
+   0x7d, 0xa1, 0xf6, 0x35, 0xa3, 0x5e, 0xca, 0xdc, 0x57, 0x2f,
+   0x3e, 0xf0, 0xc9, 0x5d, 0x86, 0x6a, 0xf8, 0xaf, 0x66, 0xa7,
+   0xed, 0xcd, 0xb8, 0xed, 0xa1, 0x5f, 0xba, 0x9b, 0x85, 0x1a,
+   0xd5, 0x9, 0xae, 0x94, 0x4e, 0x3b, 0xcf, 0xcb, 0x5c, 0xc9,
+   0x79, 0x80, 0xf7, 0xcc, 0xa6, 0x4a, 0xa8, 0x6a, 0xd8, 0xd3,
+   0x31, 0x11, 0xf9, 0xf6, 0x2, 0x63, 0x2a, 0x1a, 0x2d, 0xd1,
+   0x1a, 0x66, 0x1b, 0x16, 0x41, 0xbd, 0xbd, 0xf7, 0x4d, 0xc0,
+   0x4a, 0xe5, 0x27, 0x49, 0x5f, 0x7f, 0x58, 0xe3, 0x27, 0x2d,
+   0xe5, 0xc9, 0x66, 0xe, 0x52, 0x38, 0x16, 0x38, 0xfb, 0x16,
+   0xeb, 0x53, 0x3f, 0xe6, 0xfd, 0xe9, 0xa2, 0x5e, 0x25, 0x59,
+   0xd8, 0x79, 0x45, 0xff, 0x3, 0x4c, 0x26, 0xa2, 0x0, 0x5a,
+   0x8e, 0xc2, 0x51, 0xa1, 0x15, 0xf9, 0x7b, 0xf4, 0x5c, 0x81,
+   0x9b, 0x18, 0x47, 0x35, 0xd8, 0x2d, 0x5, 0xe9, 0xad, 0xf,
+   0x35, 0x74, 0x15, 0xa3, 0x8e, 0x8b, 0xcc, 0x27, 0xda, 0x7c,
+   0x5d, 0xe4, 0xfa, 0x4, 0xd3, 0x5, 0xb, 0xba, 0x3a, 0xb2,
+   0x49, 0x45, 0x2f, 0x47, 0xc7, 0xd, 0x41, 0x3f, 0x97, 0x80,
+   0x4d, 0x3f, 0xc1, 0xb5, 0xbb, 0x70, 0x5f, 0xa7, 0x37, 0xaf,
+   0x48, 0x22, 0x12, 0x45, 0x2e, 0xf5, 0xf, 0x87, 0x92, 0xe2,
+   0x84, 0x1, 0xf9, 0x12, 0xf, 0x14, 0x15, 0x24, 0xce, 0x89,
+   0x99, 0xee, 0xb9, 0xc4, 0x17, 0x70, 0x70, 0x15, 0xea, 0xbe,
+   0xc6, 0x6c, 0x1f, 0x62, 0xb3, 0xf4, 0x2d, 0x16, 0x87, 0xfb,
+   0x56, 0x1e, 0x45, 0xab, 0xae, 0x32, 0xe4, 0x5e, 0x91, 0xed,
+   0x53, 0x66, 0x5e, 0xbd, 0xed, 0xad, 0xe6, 0x12, 0x39, 0xd,
+   0x83, 0xc9, 0xe8, 0x6b, 0x6c, 0x2d, 0xa5, 0xee, 0xc4, 0x5a,
+   

[U-Boot] [PATCH 6/8] am57xx_hs: avb2.0: add support of AVB 2.0

2018-04-25 Thread Igor Opaniuk
1. Add vbmeta partition info to android partition layout for am57xx SoC
2. Add support of AVB 2.0 (including avb subset of commands) for am57xx HS

Signed-off-by: Igor Opaniuk 
---
 configs/am57xx_hs_evm_defconfig |  3 +++
 include/configs/am57xx_evm.h| 11 +++
 include/environment/ti/boot.h   | 15 +++
 3 files changed, 29 insertions(+)

diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig
index ca9742f..226537a 100644
--- a/configs/am57xx_hs_evm_defconfig
+++ b/configs/am57xx_hs_evm_defconfig
@@ -81,3 +81,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0451
 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
+# CONFIG_LIBAVB is not set
+# CONFIG_LIBAVB_AB is not set
+# CONFIG_CMD_AVB is not set
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index d1f73f7..020eec1 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -38,6 +38,16 @@
 
 #define CONFIG_SYS_OMAP_ABE_SYSCK
 
+#define str(a) #a
+#define VBMETA_PART_SIZE   (64 * 1024)
+
+#if defined(CONFIG_LIBAVB)
+#define VBMETA_PART \
+   "name=vbmeta,size=" str(VBMETA_PART_SIZE) ",uuid=${uuid_gpt_vbmeta};"
+#else
+#define VBMETA_PART""
+#endif
+
 /* Define the default GPT table for eMMC */
 #define PARTS_DEFAULT \
/* Linux partitions */ \
@@ -61,6 +71,7 @@
"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
"name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \
"name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \
+   VBMETA_PART \
"name=userdata,size=-,uuid=${uuid_gpt_userdata}"
 
 #define DFUARGS \
diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h
index 24b7783..a8336ae 100644
--- a/include/environment/ti/boot.h
+++ b/include/environment/ti/boot.h
@@ -18,6 +18,19 @@
 #define PARTS_DEFAULT
 #endif
 
+#if defined(CONFIG_CMD_AVB)
+#define AVB_VERIFY_CHECK "if run avb_verify; then " \
+   "echo AVB verification OK.;" \
+   "set bootargs $bootargs $avb_bootargs;" \
+   "else " \
+   "echo AVB verification failed.;" \
+   "exit; fi;"
+#define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify;\0"
+#else
+#define AVB_VERIFY_CHECK ""
+#define AVB_VERIFY_CMD ""
+#endif
+
 #define DEFAULT_COMMON_BOOT_TI_ARGS \
"console=" CONSOLEDEV ",115200n8\0" \
"fdtfile=undefined\0" \
@@ -26,6 +39,7 @@
"bootfile=zImage\0" \
"usbtty=cdc_acm\0" \
"vram=16M\0" \
+   AVB_VERIFY_CMD \
"partitions=" PARTS_DEFAULT "\0" \
"optargs=\0" \
"dofastboot=0\0" \
@@ -43,6 +57,7 @@
"setenv machid fe6; " \
"mmc dev $mmcdev; " \
"mmc rescan; " \
+   AVB_VERIFY_CHECK \
"part start mmc ${mmcdev} environment fdt_start; " \
"part size mmc ${mmcdev} environment fdt_size; " \
"part start mmc ${mmcdev} boot boot_start; " \
-- 
2.7.4

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


[U-Boot] [PATCH 5/8] avb2.0: add boot states and dm-verity support

2018-04-25 Thread Igor Opaniuk
1. Add initial support of boot states mode (red, green, yellow)
2. Add functions for enforcing dm-verity configurations

Signed-off-by: Igor Opaniuk 
---
 cmd/avb.c|  17 ++-
 common/avb_verify.c  | 140 +--
 include/avb_verify.h |  19 ++-
 3 files changed, 171 insertions(+), 5 deletions(-)

diff --git a/cmd/avb.c b/cmd/avb.c
index d040906..2c15b47 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -218,6 +218,8 @@ int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
 {
AvbSlotVerifyResult slot_result;
AvbSlotVerifyData *out_data;
+   char *cmdline;
+   char *extra_args;
 
bool unlocked = false;
int res = CMD_RET_FAILURE;
@@ -243,10 +245,23 @@ int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
  "", unlocked, _data);
switch (slot_result) {
case AVB_SLOT_VERIFY_RESULT_OK:
+   /* Until we don't have support of changing unlock states, we
+* assume that we are by default in locked state.
+* So in this case we can boot only when verification is
+* successful; we also supply in cmdline GREEN boot state
+*/
printf("Verification passed successfully\n");
 
/* export additional bootargs to AVB_BOOTARGS env var */
-   env_set(AVB_BOOTARGS, out_data->cmdline);
+
+   extra_args = avb_set_state(avb_ops, AVB_GREEN);
+   if (extra_args)
+   cmdline = append_cmd_line(out_data->cmdline,
+ extra_args);
+   else
+   cmdline = out_data->cmdline;
+
+   env_set(AVB_BOOTARGS, cmdline);
 
res = CMD_RET_SUCCESS;
break;
diff --git a/common/avb_verify.c b/common/avb_verify.c
index b3d1229..df5e407 100644
--- a/common/avb_verify.c
+++ b/common/avb_verify.c
@@ -119,6 +119,140 @@ const unsigned char avb_root_pub[1032] = {
 
 /**
  * 
+ * Boot states support (GREEN, YELLOW, ORANGE, RED) and dm_verity
+ * 
+ */
+char *avb_set_state(AvbOps *ops, enum avb_boot_state boot_state)
+{
+   struct AvbOpsData *data;
+   char *cmdline = NULL;
+
+   if (!ops)
+   return NULL;
+
+   data = (struct AvbOpsData *)ops->user_data;
+   if (!data)
+   return NULL;
+
+   data->boot_state = boot_state;
+   switch (boot_state) {
+   case AVB_GREEN:
+   cmdline = "androidboot.verifiedbootstate=green";
+   break;
+   case AVB_YELLOW:
+   cmdline = "androidboot.verifiedbootstate=yellow";
+   break;
+   case AVB_ORANGE:
+   cmdline = "androidboot.verifiedbootstate=orange";
+   case AVB_RED:
+   break;
+   }
+
+   return cmdline;
+}
+
+char *append_cmd_line(char *cmdline_orig, char *cmdline_new)
+{
+   char *cmd_line;
+
+   if (!cmdline_new)
+   return cmdline_orig;
+
+   if (cmdline_orig)
+   cmd_line = cmdline_orig;
+   else
+   cmd_line = " ";
+
+   cmd_line = avb_strdupv(cmd_line, " ", cmdline_new, NULL);
+
+   return cmd_line;
+}
+
+static int avb_find_dm_args(char **args, char *str)
+{
+   int i = 0;
+
+   if (!str)
+   return -1;
+
+   do {
+   if ((!args[i]) || (i >= AVB_MAX_ARGS))
+   return -1;
+
+   if (strstr(args[i], str))
+   return i;
+
+   i++;
+   } while (1);
+}
+
+static char *avb_set_enforce_option(const char *cmdline, const char *option)
+{
+   char *cmdarg[AVB_MAX_ARGS];
+   char *newargs = NULL;
+   int i = 0;
+   int total_args;
+
+   memset(cmdarg, 0, sizeof(cmdarg));
+   cmdarg[i++] = strtok((char *)cmdline, " ");
+
+   do {
+   cmdarg[i] = strtok(NULL, " ");
+   if (!cmdarg[i])
+   break;
+
+   if (++i >= AVB_MAX_ARGS) {
+   printf("%s: Can't handle more then %d args\n",
+  __func__, i);
+   return NULL;
+   }
+   } while (true);
+
+   total_args = i;
+   i = avb_find_dm_args([0], VERITY_TABLE_OPT_LOGGING);
+   if (i >= 0) {
+   cmdarg[i] = (char *)option;
+   } else {
+   i = avb_find_dm_args([0], VERITY_TABLE_OPT_RESTART);
+   if (i < 0) {
+   printf("%s: No verity options found\n", __func__);
+   return NULL;
+   }
+
+   cmdarg[i] = (char *)option;
+   }
+
+   for (i = 0; i <= total_args; i++)
+   newargs = 

Re: [U-Boot] [PATCH 5/7] arm: v7R: Add initial support

2018-04-25 Thread Tom Rini
On Wed, Apr 25, 2018 at 02:44:37PM +0530, Lokesh Vutla wrote:

> From: Michal Simek 
> 
> The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded,
> real-time systems. It implements the ARMv7-R architecture, and includes
> Thumb-2 technology for optimum code density and processing throughput.
> 
> Except for MPU(Memory Protection Unit) and few CP15 registers, most of the
> features are compatible with v7 architecture. So,reuse the same armv7
> folder and introduce a new config CPU_V7R in order to differentiate
> from v7 based platforms.
> 
> Signed-off-by: Michal Simek 
> Signed-off-by: Lokesh Vutla 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 7/7] arm: v7R: Add support for enabling caches

2018-04-25 Thread Tom Rini
On Wed, Apr 25, 2018 at 02:44:39PM +0530, Lokesh Vutla wrote:

> Cache maintenance procedure is same for v7A and v7R
> processors. So re-use cache-cp15.c file except for
> mmu parts.
[snip]
> diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
> index b09c631636..051f2789be 100644
> --- a/arch/arm/lib/cache-cp15.c
> +++ b/arch/arm/lib/cache-cp15.c
> @@ -9,11 +9,15 @@
>  #include 
>  #include 
>  #include 
> +#ifdef CONFIG_SYS_ARM_MPU
> +#include 
> +#endif

Do we need to guard this include?

-- 
Tom


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


Re: [U-Boot] [PATCH 2/7] arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A

2018-04-25 Thread Tom Rini
On Wed, Apr 25, 2018 at 02:44:34PM +0530, Lokesh Vutla wrote:

> Currently CPU_V7 kconfig symbol supports only ARMv7A architectures under
> armv7 folder. This led to a misconception of creating separate folders
> for armv7m and armv7r. There is no reason to create separate folder for
> other armv7 based architectures when it can co-exist with few Kconfig
> symbols.
> 
> As a first step towards a common folder, rename CPU_V7 as CPUV7A. Later
> separate Kconfig symbols can be added for CPU_V7R and CPU_V7M and
> can co exist in the same folder.
> 
> Suggested-by: Alexander Graf 
> Signed-off-by: Lokesh Vutla 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 6/7] arm: v7R: Add support for MPU

2018-04-25 Thread Tom Rini
On Wed, Apr 25, 2018 at 02:44:38PM +0530, Lokesh Vutla wrote:

> The Memory Protection Unit(MPU) allows to partition memory into regions
> and set individual protection attributes for each region. In absence
> of MPU a default map[1] will take effect. Add support for configuring
> MPU on Cortex-R, by reusing the existing support for Cortex-M processor.
> 
> [1] 
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0460d/I1002400.html
> 
> Signed-off-by: Lokesh Vutla 
> ---
>  arch/arm/Kconfig  |  12 
>  arch/arm/cpu/armv7/Makefile   |   2 +
>  arch/arm/cpu/armv7/mpu_v7r.c  | 109 ++
>  arch/arm/cpu/armv7m/Makefile  |   3 +-
>  arch/arm/cpu/armv7m/mpu.c |  41 +--
>  arch/arm/include/asm/armv7m_mpu.h |  69 +++

We should rename armv7m_mpu.h to armv7_mpu.h here I think, since we
share it between v7m and v7r.  Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 4/7] arm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15

2018-04-25 Thread Tom Rini
On Wed, Apr 25, 2018 at 02:44:36PM +0530, Lokesh Vutla wrote:

> Certain ARM architectures like ARMv7-A, ARMv7-R has support for
> enabling caches using CP15 registers. To have a common support
> for all these architectures, introduce a Kconfig symbol
> SYS_ARM_CACHE_CP15 that selects cache-cp15.c
> 
> Signed-off-by: Lokesh Vutla 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH 3/7] arm: v7: Kconfig: Add entry for MMU

2018-04-25 Thread Tom Rini
On Wed, Apr 25, 2018 at 02:44:35PM +0530, Lokesh Vutla wrote:

> Add a Kconfig entry for MMU and imply for all platforms using
> cache-cp15.c containing MMU setup. Using imply instead of select so that
> MMU can be disabled by defconfigs when not needed.
> 
> Signed-off-by: Lokesh Vutla 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] NDS32 toolchain?

2018-04-25 Thread Tom Rini
On Wed, Apr 25, 2018 at 03:27:11AM +, r...@andestech.com wrote:
> 
> 
> > -Original Message-
> > From: Tom Rini [mailto:tr...@konsulko.com]
> > Sent: Tuesday, April 24, 2018 8:14 PM
> > To: Rick Jian-Zhi Chen(陳建志)
> > Cc: u-boot@lists.denx.de; Greentime Ying-Han Hu(胡英漢);
> > rickche...@gmail.com
> > Subject: Re: NDS32 toolchain?
> >
> > On Tue, Apr 24, 2018 at 03:10:02AM +, r...@andestech.com wrote:
> > >
> > >
> > > > -Original Message-
> > > > From: Tom Rini [mailto:tr...@konsulko.com]
> > > > Sent: Tuesday, April 24, 2018 4:17 AM
> > > > To: u-boot@lists.denx.de; Rick Jian-Zhi Chen(陳建志)
> > > > Subject: NDS32 toolchain?
> > > >
> > > > Hey,
> > > >
> > > > So I'm looking over my setups again at what we do and do not have
> > > > build testing and run-time testing, and I see that for nds32 I just 
> > > > cannot find a
> > good toolchain.
> > > > If I try for example
> > > > https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64
> > > > /7.3.0/x86_ 64-gcc-7.3.0-nolibc-nds32-elf.tar.xz
> > > > it first fails on the -G0 flag that we have set in and then it
> > > > complains about a lack of position independent code support.  Is the
> > > > kernel.org toolchain perhaps configured incorrectly?
> > > >
> > >
> > > Hi Tom
> > >
> > > You may try the following paths:
> > >
> > > 1.
> > > github version
> > > https://github.com/andestech/build_script.git
> > > https://github.com/greentime/prebuilt-nds32-toolchain/releases
> >
> > This binary gets a lot farther:
> >   CC  drivers/mtd/cfi_flash.o
> > drivers/mtd/cfi_flash.c: In function 'write_buff':
> > drivers/mtd/cfi_flash.c:1435:1: internal compiler error: in 
> > change_address_1, at
> > emit-rtl.c:2126  }  ^
> > 0x81fecd6 change_address_1
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/
> > emit-rtl.c:2126
> > 0x81ff26d adjust_address_1(rtx_def*, machine_mode, long long, int, int, int,
> > long long)
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/
> > emit-rtl.c:2264
> > 0x8762488 nds32_spilt_doubleword(rtx_def**, bool)
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/c
> > onfig/nds32/nds32-md-auxiliary.c:3238
> > 0x886be2f gen_split_7(rtx_insn*, rtx_def**)
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/c
> > onfig/nds32/nds32-doubleword.md:209
> > 0x81fdf74 try_split(rtx_def*, rtx_insn*, int)
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/
> > emit-rtl.c:3658
> > 0x8450a37 split_insn
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/r
> > ecog.c:2865
> > 0x8450d0e split_all_insns()
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/r
> > ecog.c:2955
> > 0x8450d6a rest_of_handle_split_before_sched2
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/r
> > ecog.c:3995
> > 0x8450d6a execute
> >
> > /NOBACKUP/sqa2/greentime/contrib/travis/build_script/src_pkg/gcc-6.3.0/gcc/r
> > ecog.c:4034
> > Please submit a full bug report,
> > with preprocessed source if appropriate.
> > Please include the complete backtrace with any bug report.
> > See  for instructions.
> > /home/trini/work/u-boot/u-boot/scripts/Makefile.build:280: recipe for target
> > 'drivers/mtd/cfi_flash.o' failed
> > make[2]: *** [drivers/mtd/cfi_flash.o] Error 1
> > /home/trini/work/u-boot/u-boot/Makefile:1355: recipe for target 
> > 'drivers/mtd'
> > failed
> > make[1]: *** [drivers/mtd] Error 2
> > make[1]: Leaving directory '/tmp/adp-ag101p'
> > Makefile:150: recipe for target 'sub-make' failed
> > make: *** [sub-make] Error 2
> >
> Hi Tom
> 
> Very Sorry about the build failure.
> I shall verify it before sending to you.
> 
> Our teammates are trying to fix this problem.
> I will offer you a refine one ASAP.

Thanks, I appreciate it!

> > > 2.
> > > Arnd Bergmann built
> > > https://lkml.org/lkml/2018/4/17/395
> > > www.kernel.org/pub/tools/crosstool/files/bin/x86_64/6.4.0/x86_64-gcc-6
> > > .4.0-nolibc-nds32le-linux.tar.xz
> >
> > Oddly, his 6.4.0 gets farther along than his 7.3.0 ones, but still doesn't 
> > work as I
> > get things like this:
> >   AS  arch/nds32/cpu/n1213/start.o
> > arch/nds32/cpu/n1213/start.S: Assembler messages:
> > arch/nds32/cpu/n1213/start.S:256:
> > Error: Incorrect syntax, sethi $ta,hi20(_start@GOTOFF).
> > arch/nds32/cpu/n1213/start.S:256:
> > Error: Incorrect syntax, ori $ta,$ta,lo12(_start@GOTOFF).
> > arch/nds32/cpu/n1213/start.S:256:
> > Warning: relax hint unrecognized instruction: line 254.
> >
> > and it just keeps going from there.  You may want to drop him an email about
> > how he's configuring for nds32le.  Last time I talked with him, he wasn't
> > planning to re-spin the 7.3.x ones, but he might do gcc-8 once it's ready.
> >
> > > > Related, is there a QEMU target for nds32 that we could leverage so
> > > > 

Re: [U-Boot] [PATCH v4] arm64: Add SMC and HVC commands

2018-04-25 Thread Michalis Pappas

On 04/13/2018 10:40 AM, Michalis Pappas wrote:

This patch adds smc and hvc commands, that allow issuing Secure Monitor
Calls and Hypervisor Calls conforming to the ARM SMC Calling Convention.

Add Kconfig items to allow each command can be individually enabled.

Signed-off-by: Michalis Pappas 
---

Changes for v2:
   - Update help message with additional information on usefulness
   - Remove default=n from Kconfig

Changes for v3:
   - Replace dependency on ARM64 with ARM_SMCCC in Kconfig

Changes for v4:
   - Add list of changes

  cmd/Kconfig  | 14 ++
  cmd/Makefile |  2 ++
  cmd/smccc.c  | 72 
  3 files changed, 88 insertions(+)
  create mode 100644 cmd/smccc.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 136836d146..2176b98ccb 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1348,6 +1348,20 @@ config CMD_HASH
  saved to memory or to an environment variable. It is also possible
  to verify a hash against data in memory.

+config CMD_HVC
+   bool "Support the 'hvc' command"
+   depends on ARM_SMCCC
+   help
+ Allows issuing Hypervisor Calls (HVCs). Mostly useful for
+ development and testing.
+
+config CMD_SMC
+   bool "Support the 'smc' command"
+   depends on ARM_SMCCC
+   help
+ Allows issuing Secure Monitor Calls (SMCs). Mostly useful for
+ development and testing.
+
  config HASH_VERIFY
bool "hash -v"
depends on CMD_HASH
diff --git a/cmd/Makefile b/cmd/Makefile
index 9a358e4801..5656a1a40a 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_CMD_FS_GENERIC) += fs.o
  obj-$(CONFIG_CMD_FUSE) += fuse.o
  obj-$(CONFIG_CMD_GETTIME) += gettime.o
  obj-$(CONFIG_CMD_GPIO) += gpio.o
+obj-$(CONFIG_CMD_HVC) += smccc.o
  obj-$(CONFIG_CMD_I2C) += i2c.o
  obj-$(CONFIG_CMD_IOTRACE) += iotrace.o
  obj-$(CONFIG_CMD_HASH) += hash.o
@@ -113,6 +114,7 @@ obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
  obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
  obj-$(CONFIG_CMD_SPI) += spi.o
  obj-$(CONFIG_CMD_STRINGS) += strings.o
+obj-$(CONFIG_CMD_SMC) += smccc.o
  obj-$(CONFIG_CMD_TERMINAL) += terminal.o
  obj-$(CONFIG_CMD_TIME) += time.o
  obj-$(CONFIG_CMD_TRACE) += trace.o
diff --git a/cmd/smccc.c b/cmd/smccc.c
new file mode 100644
index 00..2fa7c23999
--- /dev/null
+++ b/cmd/smccc.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2018
+ * Michalis Pappas 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int do_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   struct arm_smccc_res res;
+
+   unsigned long fid;
+
+   unsigned long a1;
+   unsigned long a2;
+   unsigned long a3;
+   unsigned long a4;
+   unsigned long a5;
+   unsigned long a6;
+   unsigned long a7;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   fid = simple_strtoul(argv[1], NULL, 16);
+
+   a1 = argc > 2 ? simple_strtoul(argv[2], NULL, 16) : 0;
+   a2 = argc > 3 ? simple_strtoul(argv[3], NULL, 16) : 0;
+   a3 = argc > 4 ? simple_strtoul(argv[4], NULL, 16) : 0;
+   a4 = argc > 5 ? simple_strtoul(argv[5], NULL, 16) : 0;
+   a5 = argc > 6 ? simple_strtoul(argv[6], NULL, 16) : 0;
+   a6 = argc > 7 ? simple_strtoul(argv[7], NULL, 16) : 0;
+   a7 = argc > 8 ? simple_strtoul(argv[8], NULL, 16) : 0;
+
+   if (!strcmp(argv[0], "smc"))
+   arm_smccc_smc(fid, a1, a2, a3, a4, a5, a6, a7, );
+   else
+   arm_smccc_hvc(fid, a1, a2, a3, a4, a5, a6, a7, );
+
+   printf("Res:  %ld %ld %ld %ld\n", res.a0, res.a1, res.a2, res.a3);
+
+   return 0;
+}
+
+#ifdef CONFIG_CMD_SMC
+U_BOOT_CMD(
+   smc,8,  2,  do_call,
+   "Issue a Secure Monitor Call",
+   " [arg1 ... arg6] [id]\n"
+   "  - fid Function ID\n"
+   "  - arg SMC arguments, passed to X1-X6 (default to zero)\n"
+   "  - id  Secure OS ID / Session ID, passed to W7 (defaults to zero)\n"
+);
+#endif
+
+#ifdef CONFIG_CMD_HVC
+U_BOOT_CMD(
+   hvc,8,  2,  do_call,
+   "Issue a Hypervisor Call",
+   " [arg1...arg7] [id]\n"
+   "  - fid Function ID\n"
+   "  - arg HVC arguments, passed to X1-X6 (default to zero)\n"
+   "  - id  Session ID, passed to W7 (defaults to zero)\n"
+);
+#endif
+
--
2.17.0



Hi,

all review comments have been satsified, happy to merge this one?

Thanks,

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


Re: [U-Boot] [RFC PATCH v1 0/5] Add fastboot UDP support

2018-04-25 Thread Alex Kiernan
On Wed, Apr 25, 2018 at 8:53 AM, Alex Kiernan  wrote:
> On Tue, Apr 24, 2018 at 6:10 PM, Jocelyn Bohr  wrote:
>> Thanks so much for porting this, Alex!
>>

...

>>
>> You can select both network and USB fastboot to be enabled with the Kconfig,
>> but at runtime you have to select to wait on either USB or network by
>> running
>> "fastboot udp" or "fastboot usb ". When the Android
>> bootloader
>> gets the command to reboot back to fastboot, it will read the "fastbootcmd"
>> env
>> variable and run that as a command (common/android_bootloader.c:151).
>>
>
> Thanks for that (especially the detail on android_bootloader which I'd
> not read through). The bit that concerns me is in timed_send_info:
>
>   +/**
>   + * Send an INFO packet during long commands based on timer. If
>   + * CONFIG_UDP_FUNCTION_FASTBOOT is defined, an INFO packet is sent
>   + * if the time is 30 seconds after start. Else, noop.
>   + *
>   + * TODO: Handle the situation where both UDP and USB fastboot are
>   + *   enabled.
>   + *
>   + * @param start:  Time since last INFO packet was sent.
>   + * @param msg:String describing the reason for waiting
>   + */
>   +void timed_send_info(ulong *start, const char *msg);
>
> The code in timed_send_info is guarded with an ifdef, rather than
> based on the transport that's been selected at runtime. Do we need to
> make timed_send_info work based on the runtime state, rather than the
> compile time, or can we drop the ifdef guard and remove the TODO? I
> guess I'm assuming the former, but with no way to test USB I don't
> want head off down the wrong road!
>

Having started digging through how we'd merge the two code paths, it's
clear if you had UDP and USB both enabled at compile time and then try
and run the USB path it'll try and do UDP things in timed_send_info,
which can't be good!

-- 
Alex Kiernan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RFC PATCH 2/2] arm64: zynqmp: Try to create bootcm_mmcX at run time

2018-04-25 Thread Michal Simek
Just an attept to create boot commands for mmcs above 2 which is not
generated.

Signed-off-by: Michal Simek 
---

Probably some ifdefs around are missing.
---
 board/xilinx/zynqmp/zynqmp.c| 28 
 include/configs/xilinx_zynqmp.h |  7 ---
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 96ea0f578d30..37fa8f4f4d3f 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -451,6 +451,32 @@ void reset_cpu(ulong addr)
 {
 }
 
+static int create_mmc_boot_commands(void)
+{
+/* Size of strings below + one terminating char \0 + 3 possitions for seq */
+#define MAX_COMMAND_LEN15
+#define MAX_BODY_LEN   32
+
+   int ret;
+   struct uclass *uc;
+   struct udevice *dev;
+   char body[MAX_BODY_LEN];
+   char command[MAX_COMMAND_LEN];
+
+   ret = uclass_get(UCLASS_MMC, );
+   if (ret)
+   return ret;
+
+   uclass_foreach_dev(dev, uc) {
+   snprintf(body, MAX_BODY_LEN, "setenv devnum %x; run mmc_boot",
+dev->seq);
+   snprintf(command, MAX_COMMAND_LEN, "bootcmd_mmc%x", dev->seq);
+   env_set(command, body);
+   }
+
+   return 0;
+}
+
 int board_late_init(void)
 {
u32 reg = 0;
@@ -546,6 +572,8 @@ int board_late_init(void)
debug("Bootseq len: %x\n", bootseq_len);
}
 
+   create_mmc_boot_commands();
+
/*
 * One terminating char + one byte for space between mode
 * and default boot_targets
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index c8a0dbb7e3b5..a2590998429e 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -155,12 +155,6 @@
"scriptaddr=0x0200\0" \
"ramdisk_addr_r=0x0210\0" \
 
-#if defined(CONFIG_MMC_SDHCI_ZYNQ)
-# define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
-#else
-# define BOOT_TARGET_DEVICES_MMC(func)
-#endif
-
 #if defined(CONFIG_SATA_CEVA)
 # define BOOT_TARGET_DEVICES_SCSI(func)func(SCSI, scsi, 0)
 #else
@@ -186,7 +180,6 @@
 #endif
 
 #define BOOT_TARGET_DEVICES(func) \
-   BOOT_TARGET_DEVICES_MMC(func) \
BOOT_TARGET_DEVICES_USB(func) \
BOOT_TARGET_DEVICES_SCSI(func) \
BOOT_TARGET_DEVICES_PXE(func) \
-- 
2.17.0

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


[U-Boot] [RFC PATCH 1/2] arm64: zynqmp: Setup the first boot_target at run time

2018-04-25 Thread Michal Simek
Detect mmc alias at run time for setting up proper boot_targets sequence.
The first target has to correspond with boot mode.

The purpose of this patch is to get rid of CONFIG_ZYNQ_SDHCI0/1
parameters in full U-Boot.
Unfortunately this patch can't remove it because there is missing
mmc implementation for SPL_DM_SEQ_ALIAS.

Also xilinx_zynqmp.h only setup boot commands for mmc0 and mmc1.
It means using aliases with higher number won't work. But switching
between mmc0 and mmc1 should work properly.

Signed-off-by: Michal Simek 
---

Not sure how exactly to tune BOOT_TARGET_DEVICES_MMC to have functions
for different aliases ID. I can simply setup devnum based on dev->seq
and also generate the whole bootcmd_mmc0

bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_mmc1=setenv devnum 1; run mmc_boot

The second patch is doing that.
But still if you setup alias to higher number mmc core is not mmc dev
command is not able to work with it.
---
 board/xilinx/zynqmp/zynqmp.c | 45 
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index f7fe1fdfff7b..96ea0f578d30 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -454,6 +455,9 @@ int board_late_init(void)
 {
u32 reg = 0;
u8 bootmode;
+   struct udevice *dev;
+   int bootseq = -1;
+   int bootseq_len = 0;
int env_targets_len = 0;
const char *mode;
char *new_targets;
@@ -499,7 +503,15 @@ int board_late_init(void)
break;
case SD_MODE:
puts("SD_MODE\n");
-   mode = "mmc0";
+   if (uclass_get_device_by_name(UCLASS_MMC,
+ "sdhci@ff16", )) {
+   puts("Boot from SD0 but without SD0 enabled!\n");
+   return -1;
+   }
+   debug("mmc0 device found at %p, seq %d\n", dev, dev->seq);
+
+   mode = "mmc";
+   bootseq = dev->seq;
env_set("modeboot", "sdboot");
break;
case SD1_LSHFT_MODE:
@@ -507,12 +519,15 @@ int board_late_init(void)
/* fall through */
case SD_MODE1:
puts("SD_MODE1\n");
-#if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
-   mode = "mmc1";
-   env_set("sdbootdev", "1");
-#else
-   mode = "mmc0";
-#endif
+   if (uclass_get_device_by_name(UCLASS_MMC,
+ "sdhci@ff17", )) {
+   puts("Boot from SD1 but without SD1 enabled!\n");
+   return -1;
+   }
+   debug("mmc1 device found at %p, seq %d\n", dev, dev->seq);
+
+   mode = "mmc";
+   bootseq = dev->seq;
env_set("modeboot", "sdboot");
break;
case NAND_MODE:
@@ -526,6 +541,11 @@ int board_late_init(void)
break;
}
 
+   if (bootseq >= 0) {
+   bootseq_len = snprintf(NULL, 0, "%i", bootseq);
+   debug("Bootseq len: %x\n", bootseq_len);
+   }
+
/*
 * One terminating char + one byte for space between mode
 * and default boot_targets
@@ -534,10 +554,15 @@ int board_late_init(void)
if (env_targets)
env_targets_len = strlen(env_targets);
 
-   new_targets = calloc(1, strlen(mode) + env_targets_len + 2);
+   new_targets = calloc(1, strlen(mode) + env_targets_len + 2 +
+bootseq_len);
 
-   sprintf(new_targets, "%s %s", mode,
-   env_targets ? env_targets : "");
+   if (bootseq >= 0)
+   sprintf(new_targets, "%s%x %s", mode, bootseq,
+   env_targets ? env_targets : "");
+   else
+   sprintf(new_targets, "%s %s", mode,
+   env_targets ? env_targets : "");
 
env_set("boot_targets", new_targets);
 
-- 
2.17.0

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


[U-Boot] [PATCH] arm64: zynqmp: Simplify boot_target variable composition

2018-04-25 Thread Michal Simek
Call calloc for space allocation only at one location and include if/else
to sprintf. This will simplify run time device adding based on id aliases.

Signed-off-by: Michal Simek 
---

 board/xilinx/zynqmp/zynqmp.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 6d09a4c73139..f7fe1fdfff7b 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -454,6 +454,7 @@ int board_late_init(void)
 {
u32 reg = 0;
u8 bootmode;
+   int env_targets_len = 0;
const char *mode;
char *new_targets;
char *env_targets;
@@ -530,14 +531,13 @@ int board_late_init(void)
 * and default boot_targets
 */
env_targets = env_get("boot_targets");
-   if (env_targets) {
-   new_targets = calloc(1, strlen(mode) +
-strlen(env_targets) + 2);
-   sprintf(new_targets, "%s %s", mode, env_targets);
-   } else {
-   new_targets = calloc(1, strlen(mode) + 2);
-   sprintf(new_targets, "%s", mode);
-   }
+   if (env_targets)
+   env_targets_len = strlen(env_targets);
+
+   new_targets = calloc(1, strlen(mode) + env_targets_len + 2);
+
+   sprintf(new_targets, "%s %s", mode,
+   env_targets ? env_targets : "");
 
env_set("boot_targets", new_targets);
 
-- 
2.17.0

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


[U-Boot] [Question] How to create a file in a directory

2018-04-25 Thread Masahiro Yamada
Hi.


I was trying to write a file to FAT file system
by U-Boot command.

I tried 'fatwrite' and 'save'.


I cannot create a file in a sub-directory.



> fatwrite mmc  0:1  8100  boot/a  10

created a file 'boot/a' in the root directory.

But I want a file 'a' in the directory path '/boot/'.



The directory looks like follows:


=> ls  mmc 0:1
boot/
   16   boot/a
   16   boot//a

2 file(s), 1 dir(s)


=> ls mmc 0:1  boot
./
../
extlinux/
  7674090   Image.gz
  5177610   rootfs.cpio.uboot
15002   uniphier-ld20-global.dtb

3 file(s), 3 dir(s)



I wrote kernel, rootfs, etc. into the '/boot' directory
by mounting the device from Linux.

But, the U-Boot command cannot do likewise
because U-boot recognizes '/' as a part of a file name.

Is there a solution, or am I missing something?


Thanks.



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


Re: [U-Boot] rockchip: clk: rk3288: add clk_enable function and support USB HOST0/HSIC

2018-04-25 Thread Philipp Tomsich
> The generic ehci-driver (ehci-generic.c) will try to enable the clocks
> listed in the DTSI. If this fails (e.g. due to clk_enable not being
> implemented in a driver and -ENOSYS being returned by the clk-uclass),
> the driver will bail our and print an error message.
> 
> This implements a minimal clk_enable for the RK3288 and supports the
> clocks mandatory for the EHCI controllers; as these are enabled by
> default we simply return success.
> 
> Signed-off-by: Wadim Egorov 
> Acked-by: Philipp Tomsich 
> ---
>  drivers/clk/rockchip/clk_rk3288.c | 13 +
>  1 file changed, 13 insertions(+)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: rk322x: update MACRO for back-to-brom

2018-04-25 Thread Philipp Tomsich
> The MACRO has been update after:
> ee14d29 rockchip: back-to-bootrom: split BACK_TO_BOOTROM for TPL/SPL
> We need to update the C code for it.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk322x-board-spl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: rk322x: update TPL_TEXT_BASE

2018-04-25 Thread Philipp Tomsich
> The boot0 hook including the 4-byte TAG which is at the beginning
> of the TEXT_BASE, now we can use a aligned TEXT BASE.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk322x_common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 1/2] rockchip: enable SYS_NS16550 for all SoCs by default

2018-04-25 Thread Philipp Tomsich
> All rockchip SoCs can use ns16550 driver, enable it for all
> and set SYS_NS16550_MEM32 for all SoCs.
> 
> Version-changes: 2
> - use imply instead of select
> 
> Signed-off-by: Kever Yang 
> ---
> 
> Changes in v2: None
> 
>  arch/arm/Kconfig  | 1 +
>  arch/arm/mach-rockchip/Kconfig| 1 -
>  include/configs/rk3036_common.h   | 3 ---
>  include/configs/rk3128_common.h   | 2 --
>  include/configs/rk3188_common.h   | 2 --
>  include/configs/rk322x_common.h   | 1 -
>  include/configs/rk3288_common.h   | 2 --
>  include/configs/rk3328_common.h   | 2 --
>  include/configs/rk3368_common.h   | 2 --
>  include/configs/rk3399_common.h   | 2 --
>  include/configs/rockchip-common.h | 2 ++
>  include/configs/rv1108_common.h   | 3 ---
>  12 files changed, 3 insertions(+), 20 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 2/2] rockchip: defconfig: remove CONFIG_SYS_NS16550

2018-04-25 Thread Philipp Tomsich
> We have enable NS16550 in Kconfig, do not need enable at defconfig
> 
> Signed-off-by: Kever Yang 
> ---
> 
> Changes in v2:
> - check and add some missing board
> 
>  configs/chromebit_mickey_defconfig  | 1 -
>  configs/chromebook_jerry_defconfig  | 1 -
>  configs/chromebook_minnie_defconfig | 1 -
>  configs/evb-rk3128_defconfig| 1 -
>  configs/evb-rk3229_defconfig| 1 -
>  configs/evb-rk3288_defconfig| 1 -
>  configs/evb-rk3328_defconfig| 1 -
>  configs/evb-rk3399_defconfig| 1 -
>  configs/fennec-rk3288_defconfig | 1 -
>  configs/firefly-rk3288_defconfig| 1 -
>  configs/firefly-rk3399_defconfig| 1 -
>  configs/miqi-rk3288_defconfig   | 1 -
>  configs/phycore-rk3288_defconfig| 1 -
>  configs/popmetal-rk3288_defconfig   | 1 -
>  configs/puma-rk3399_defconfig   | 1 -
>  configs/rock2_defconfig | 1 -
>  configs/rock_defconfig  | 1 -
>  configs/tinker-rk3288_defconfig | 1 -
>  configs/vyasa-rk3288_defconfig  | 1 -
>  19 files changed, 19 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Weird listing/behaviour of serverip in uboot

2018-04-25 Thread Ajay Garg
Hi All.

When we stop auto-booting and printenv, a serverip is listed.
However, when trying to ftp a kernel-image, it shows serverip is not set.

#
=> printenv
baudrate=115200
bootcmd=run load_img; run load_dtb; booti 0x4808 - 0x4800
bootdelay=3
ethact=ravb
ethaddr=2E:09:0A:01:A0:6D
fdt_high=0x
fileaddr=7a00
filesize=f0d200
initrd_high=0x
ipaddr=192.168.0.2
load_dtb=tftpboot 0x4800 hidden
load_img=tftpboot 0x4808 Image
load_ker=ext4load mmc 0:1 0x4808 /boot/Image
loadimg=tdtbftpboot 04800 hidden
serverip=192.168.56.1
stderr=serial
stdin=serial
stdout=serial
ver=U-Boot 2015.04 (Mar 28 2018 - 16:00:07)

Environment size: 587/131068 bytes
=> setenv bootargs
=>  tftp 0x7a00 Image
ravb:0 is connected to ravb.  Reconnecting to ravb
ravb Waiting for PHY auto negotiation to complete. done
ravb: 1000Base/Full
*** ERROR: `serverip' not set
#




If I then indeed set a serverip, two copies of serverip are listed .. !!

#
=> setenv serverip 192.168.0.1
=> saveenv
Saving Environment to MMC...
Writing to MMC(1)... done
=> printenv
baudrate=115200
bootcmd=run load_img; run load_dtb; booti 0x4808 - 0x4800
bootdelay=3
ethact=ravb
ethaddr=2E:09:0A:01:A0:6D
fdt_high=0x
fileaddr=7a00
filesize=f0d200
initrd_high=0x
ipaddr=192.168.0.2
load_dtb=tftpboot 0x4800 hidden
load_img=tftpboot 0x4808 Image
load_ker=ext4load mmc 0:1 0x4808 /boot/Image
loadimg=tdtbftpboot 04800 hidden
serverip=192.168.56.1
serverip=192.168.0.1
stderr=serial
stdin=serial
stdout=serial
ver=U-Boot 2015.04 (Mar 28 2018 - 16:00:07)

Environment size: 610/131068 bytes
#


In summary, whatever I do, I am unable to clear the entry
serverip=192.168.56.1 (already tried editenv, still did not work).

Anybody else faced a similar issue? Or there is no option but to go
the build-uboot -> flash -> debug route?
(Wanting to avoid it, as currently the uboot has been shipped with the
device directly, so don't want to change too many things).


Thanks and Regards,
Ajay
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 1/2] rockchip: enable SYS_NS16550 for all SoCs by default

2018-04-25 Thread Philipp Tomsich
> All rockchip SoCs can use ns16550 driver, enable it for all
> and set SYS_NS16550_MEM32 for all SoCs.
> 
> Version-changes: 2
> - use imply instead of select
> 
> Signed-off-by: Kever Yang 
> ---
> 
> Changes in v2: None
> 
>  arch/arm/Kconfig  | 1 +
>  arch/arm/mach-rockchip/Kconfig| 1 -
>  include/configs/rk3036_common.h   | 3 ---
>  include/configs/rk3128_common.h   | 2 --
>  include/configs/rk3188_common.h   | 2 --
>  include/configs/rk322x_common.h   | 1 -
>  include/configs/rk3288_common.h   | 2 --
>  include/configs/rk3328_common.h   | 2 --
>  include/configs/rk3368_common.h   | 2 --
>  include/configs/rk3399_common.h   | 2 --
>  include/configs/rockchip-common.h | 2 ++
>  include/configs/rv1108_common.h   | 3 ---
>  12 files changed, 3 insertions(+), 20 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Revert "rockchip: firefly: Add "usb start" to auto-start USB device"

2018-04-25 Thread Philipp Tomsich
> This reverts commit a1903c18db13e740e6bedb8955b3272dce5104e1.
> 
> It's really bad idea to add "usb start" in preboot, it will spend
> a lot of time to scan usb bus, and most of people do not need this
> feature.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/firefly-rk3288.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 2/2] rockchip: defconfig: remove CONFIG_SYS_NS16550

2018-04-25 Thread Philipp Tomsich
> We have enable NS16550 in Kconfig, do not need enable at defconfig
> 
> Signed-off-by: Kever Yang 
> ---
> 
> Changes in v2:
> - check and add some missing board
> 
>  configs/chromebit_mickey_defconfig  | 1 -
>  configs/chromebook_jerry_defconfig  | 1 -
>  configs/chromebook_minnie_defconfig | 1 -
>  configs/evb-rk3128_defconfig| 1 -
>  configs/evb-rk3229_defconfig| 1 -
>  configs/evb-rk3288_defconfig| 1 -
>  configs/evb-rk3328_defconfig| 1 -
>  configs/evb-rk3399_defconfig| 1 -
>  configs/fennec-rk3288_defconfig | 1 -
>  configs/firefly-rk3288_defconfig| 1 -
>  configs/firefly-rk3399_defconfig| 1 -
>  configs/miqi-rk3288_defconfig   | 1 -
>  configs/phycore-rk3288_defconfig| 1 -
>  configs/popmetal-rk3288_defconfig   | 1 -
>  configs/puma-rk3399_defconfig   | 1 -
>  configs/rock2_defconfig | 1 -
>  configs/rock_defconfig  | 1 -
>  configs/tinker-rk3288_defconfig | 1 -
>  configs/vyasa-rk3288_defconfig  | 1 -
>  19 files changed, 19 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: rk322x: update MACRO for back-to-brom

2018-04-25 Thread Philipp Tomsich
> The MACRO has been update after:
> ee14d29 rockchip: back-to-bootrom: split BACK_TO_BOOTROM for TPL/SPL
> We need to update the C code for it.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/rk322x-board-spl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] rockchip: rk322x: update TPL_TEXT_BASE

2018-04-25 Thread Philipp Tomsich
> The boot0 hook including the 4-byte TAG which is at the beginning
> of the TEXT_BASE, now we can use a aligned TEXT BASE.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/rk322x_common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Revert "rockchip: firefly: Add "usb start" to auto-start USB device"

2018-04-25 Thread Philipp Tomsich
> This reverts commit a1903c18db13e740e6bedb8955b3272dce5104e1.
> 
> It's really bad idea to add "usb start" in preboot, it will spend
> a lot of time to scan usb bus, and most of people do not need this
> feature.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  include/configs/firefly-rk3288.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] distro: select CMD_ENV_EXISTS

2018-04-25 Thread Masahiro Yamada
'env exists' is used for scripting in include/config_distro_bootcmd.h
This command is available only when CONFIG_CMD_ENV_EXISTS is enabled.

Signed-off-by: Masahiro Yamada 
---

 Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Kconfig b/Kconfig
index 3bf95c1..0c5d6f4 100644
--- a/Kconfig
+++ b/Kconfig
@@ -74,6 +74,7 @@ config DISTRO_DEFAULTS
select CMD_DHCP if CMD_NET
select CMD_PING if CMD_NET
select CMD_PXE if NET
+   select CMD_ENV_EXISTS
select CMD_EXT2
select CMD_EXT4
select CMD_FAT
-- 
2.7.4

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


Re: [U-Boot] [U-Boot,2/3] rockchip: rk3188: add timer3 node

2018-04-25 Thread Dr. Philipp Tomsich
Kever,

> On 25 Apr 2018, at 12:04, Philipp Tomsich 
>  wrote:
> 
>> Add dts node for timer3.
>> Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer"
>> with OF_PLATDATA enable, so we override its compatible to
>> "rockchip,rk3368-timer".
>> 
>> Signed-off-by: Kever Yang 
>> ---
>> 
>> arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++
>> arch/arm/dts/rk3188.dtsi  | 6 ++
>> 2 files changed, 12 insertions(+)
>> 
> 
> Acked-by: Philipp Tomsich 

This looks like a work-around that we’ll have to revert eventually.
I would instead extend the driver to recognise the ‘rockchip,rk3188-timer’
and ‘rockchip,rk3288-timer’ as well.

Please confirm that both these .compatible strings should also be handled
by the same driver and I’ll make the change when applying this series.

Thanks,
Philipp.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 3/3] rockchip: rk3188: use DM timer instead of rk_timer

2018-04-25 Thread Philipp Tomsich
> Disable rk_timer as SYS timer and use DM timer instead,
> so that we can get a better timer framework, the rk_timer
> is going to be clean after we conver to use DM timer or
> ARM arch/generic timer.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/Makefile   | 2 ++
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 2 --
>  configs/rock_defconfig| 3 +++
>  include/configs/rk3188_common.h   | 5 -
>  4 files changed, 5 insertions(+), 7 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 1/3] rockchip: rk3036: add ofdata_to_platdata() method for driver

2018-04-25 Thread Philipp Tomsich
> Parse of data in dedicated api instead of in probe().
> 
> The clk_set_rate() may be called before the clk driver is probed,
> after core support set default clock.
> This patch fix system abort issue since:
> f4fcba5 clk: implement clk_set_defaults()
> 
> Signed-off-by: Kever Yang 
> ---
> 
> Changes in v2:
> - address commentS from Simon
> 
>  drivers/clk/rockchip/clk_rk3036.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 2/2] config: evb-rk3399: enable make uboot.itb

2018-04-25 Thread Philipp Tomsich
> Similar to firefly 3399 enable the ability to create a FIT image
> with combined arm-trusted-firmware.
> 
> Signed-off-by: Peter Robinson 
> ---
>  configs/evb-rk3399_defconfig | 3 +++
>  1 file changed, 3 insertions(+)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,1/1] rockchip: rk3288: provide ${fdtfile}

2018-04-25 Thread Philipp Tomsich
> All rk3288 default configs define CONFIG_DEFAULT_DEVICE_TREE.
> So we can use it to define ${fdtfile} in rk3288_common.h.
> 
> This variable is needed by the distro boot command.
> 
> Signed-off-by: Heinrich Schuchardt 
> ---
>  include/configs/rk3288_common.h | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 3/3] rockchip: rk3188: use DM timer instead of rk_timer

2018-04-25 Thread Philipp Tomsich
> Disable rk_timer as SYS timer and use DM timer instead,
> so that we can get a better timer framework, the rk_timer
> is going to be clean after we conver to use DM timer or
> ARM arch/generic timer.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/mach-rockchip/Makefile   | 2 ++
>  arch/arm/mach-rockchip/rk3188-board-spl.c | 2 --
>  configs/rock_defconfig| 3 +++
>  include/configs/rk3188_common.h   | 5 -
>  4 files changed, 5 insertions(+), 7 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/2] arm: rockchip: make_fit_atf: remove unneeded imports

2018-04-25 Thread Philipp Tomsich
> From: Patrick Uiterwijk 
> 
> These imports are entirely unused in the entire script.
> 
> Signed-off-by: Patrick Uiterwijk 
> Signed-off-by: Peter Robinson 
> ---
>  arch/arm/mach-rockchip/make_fit_atf.py | 2 --
>  1 file changed, 2 deletions(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/2] arm: rockchip: make_fit_atf: remove unneeded imports

2018-04-25 Thread Philipp Tomsich
> From: Patrick Uiterwijk 
> 
> These imports are entirely unused in the entire script.
> 
> Signed-off-by: Patrick Uiterwijk 
> Signed-off-by: Peter Robinson 
> ---
>  arch/arm/mach-rockchip/make_fit_atf.py | 2 --
>  1 file changed, 2 deletions(-)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,2/3] rockchip: rk3188: add timer3 node

2018-04-25 Thread Philipp Tomsich
> Add dts node for timer3.
> Because of the rockchip timer can only KNOWN "dtd_rockchip_rk3368_timer"
> with OF_PLATDATA enable, so we override its compatible to
> "rockchip,rk3368-timer".
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 6 ++
>  arch/arm/dts/rk3188.dtsi  | 6 ++
>  2 files changed, 12 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/3] rockchip: rk3188: add -u-boot.dtsi for rock-rk3188

2018-04-25 Thread Philipp Tomsich
> We should a -u-boot.dtsi for those config need by U-Boot only,
> and other part sync with kernel.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 18 ++
>  arch/arm/dts/rk3188-radxarock.dts |  6 +-
>  arch/arm/dts/rk3188.dtsi  |  2 --
>  3 files changed, 19 insertions(+), 7 deletions(-)
>  create mode 100644 arch/arm/dts/rk3188-radxarock-u-boot.dtsi
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v1] rockchip: defconfig: puma-rk3399: enable RTC

2018-04-25 Thread Philipp Tomsich
> commit: 52280315a4 ("rtc: rewrite isl1208 to support DM") enables us to
> use the on-module RTC emulation with the rk3399 device model i2c driver.
> 
> Signed-off-by: Klaus Goger 
> ---
> 
>  configs/puma-rk3399_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 

Reviewed-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2, 1/3] rockchip: rk3036: add ofdata_to_platdata() method for driver

2018-04-25 Thread Philipp Tomsich
> Parse of data in dedicated api instead of in probe().
> 
> The clk_set_rate() may be called before the clk driver is probed,
> after core support set default clock.
> This patch fix system abort issue since:
> f4fcba5 clk: implement clk_set_defaults()
> 
> Signed-off-by: Kever Yang 
> ---
> 
> Changes in v2:
> - address commentS from Simon
> 
>  drivers/clk/rockchip/clk_rk3036.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 2/2] config: evb-rk3399: enable make uboot.itb

2018-04-25 Thread Philipp Tomsich
> Similar to firefly 3399 enable the ability to create a FIT image
> with combined arm-trusted-firmware.
> 
> Signed-off-by: Peter Robinson 
> ---
>  configs/evb-rk3399_defconfig | 3 +++
>  1 file changed, 3 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,1/1] rockchip: rk3288: provide ${fdtfile}

2018-04-25 Thread Philipp Tomsich
> All rk3288 default configs define CONFIG_DEFAULT_DEVICE_TREE.
> So we can use it to define ${fdtfile} in rk3288_common.h.
> 
> This variable is needed by the distro boot command.
> 
> Signed-off-by: Heinrich Schuchardt 
> ---
>  include/configs/rk3288_common.h | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/3] rockchip: rk3188: add -u-boot.dtsi for rock-rk3188

2018-04-25 Thread Philipp Tomsich
> We should a -u-boot.dtsi for those config need by U-Boot only,
> and other part sync with kernel.
> 
> Signed-off-by: Kever Yang 
> ---
> 
>  arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 18 ++
>  arch/arm/dts/rk3188-radxarock.dts |  6 +-
>  arch/arm/dts/rk3188.dtsi  |  2 --
>  3 files changed, 19 insertions(+), 7 deletions(-)
>  create mode 100644 arch/arm/dts/rk3188-radxarock-u-boot.dtsi
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v1] rockchip: defconfig: puma-rk3399: enable RTC

2018-04-25 Thread Philipp Tomsich
> commit: 52280315a4 ("rtc: rewrite isl1208 to support DM") enables us to
> use the on-module RTC emulation with the rk3399 device model i2c driver.
> 
> Signed-off-by: Klaus Goger 
> ---
> 
>  configs/puma-rk3399_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: host: dwc3: fix phys init

2018-04-25 Thread Masahiro Yamada
2018-04-25 18:39 GMT+09:00 Neil Armstrong :
> When no PHYs are declared in the dwc3 node, the phy init fails.
> This patch checks if the "phys" property is presend and reports
> the error returned by dev_count_phandle_with_args().
>
> This patchs also fixes the styles issues added in last commit.
>
> This patch should fix the DWC3 support on the UniPhier SoC family.
>
> Fixes: 7c839ea70c49 ("usb: host: dwc3: Add support for multiple PHYs")
> Reported-by: Masahiro Yamada 
> Signed-off-by: Neil Armstrong 
> ---
>  drivers/usb/host/xhci-dwc3.c | 23 +--
>  1 file changed, 13 insertions(+), 10 deletions(-)


Tested-by: Masahiro Yamada 





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


Re: [U-Boot] DWC3 USB driver regression

2018-04-25 Thread Neil Armstrong
Hi,

On 25/04/2018 11:09, Masahiro Yamada wrote:
> Hi Neil.
> 
> 
> 2018-04-25 17:37 GMT+09:00 Neil Armstrong :
>> Hi,
>>
>> On 25/04/2018 06:21, Masahiro Yamada wrote:
>>> Hi.
>>>
>>>
>>> I found DWC3 usb driver on UniPhier SoC family
>>> not working.
>>>
>>>
>>> I did git-bisect, and the first bad commit is
>>>
>>>
>>> 7c839ea70c4991e8d4c322e074359ac5e155d59d is the first bad commit
>>> commit 7c839ea70c4991e8d4c322e074359ac5e155d59d
>>> Author: Neil Armstrong 
>>> Date:   Wed Apr 11 17:08:01 2018 +0200
>>>
>>> usb: host: dwc3: Add support for multiple PHYs
>>>
>>> DWC3 Ips can have more than 1 PHY for USB2 and 1 PHY for USB3, add 
>>> support
>>> for a generic number of PHYs and adapt the code to handle a generic
>>> number of PHYs.
>>>
>>> Signed-off-by: Neil Armstrong 
>>>
>>>
>>>
>>>
>>> If I revert this commit, I can get the USB on my board working.
>>>
>>> Any insight about the cause of the problem?
>>>
>>>

[...]

> 
> 
> Yeah, it fixed the problem.
> 
> In my case, the "phy" property is missing in the DWC3 node,
> so dev_count_phandle_with_args() returns a negative error code.
> 
> Thanks.


I sent a "usb: host: dwc3: fix phys init" patch, can you test it and report the 
test result for Marek ?

Thanks for testing,
Neil

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


[U-Boot] [PATCH 3/3] board: sunxi: sun8i-v4: Add Bananapi M2 Berry support

2018-04-25 Thread Jagan Teki
Banana Pi BPI-M2 Berry is a quad-core mini single board computer
built with Allwinner V40 SoC. It features
- Quad Core ARM Cortex A7 CPU V40
- 1GB of RAM .
- microSD/SATA port..
- onboard WiFi and BT
- 4 USB A 2.0 ports
- 1 USB OTG port
- 1 HDMI port
- 1 audio jack
- DC power port

Signed-off-by: Jagan Teki 
---
 arch/arm/dts/Makefile|   2 +
 arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts | 132 +++
 board/sunxi/MAINTAINERS  |   5 +
 configs/bananapi_m2_berry_defconfig  |  14 +++
 4 files changed, 153 insertions(+)
 create mode 100644 arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts
 create mode 100644 configs/bananapi_m2_berry_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index ac7667b1e8..de6103602c 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -369,6 +369,8 @@ dtb-$(CONFIG_MACH_SUN8I_R40) += \
sun8i-r40-bananapi-m2-ultra.dtb
 dtb-$(CONFIG_MACH_SUN8I_V3S) += \
sun8i-v3s-licheepi-zero.dtb
+dtb-$(CONFIG_MACH_SUN8I_V40) += \
+   sun8i-v40-bananapi-m2-berry.dtb
 dtb-$(CONFIG_MACH_SUN50I_H5) += \
sun50i-h5-nanopi-neo2.dtb \
sun50i-h5-nanopi-neo-plus2.dtb \
diff --git a/arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts 
b/arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts
new file mode 100644
index 00..193d9b29ec
--- /dev/null
+++ b/arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2017 Icenowy Zheng 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-r40.dtsi"
+
+#include 
+
+/ {
+   model = "Banana Pi M2 Berry";
+   compatible = "sinovoip,bpi-m2-berry", "allwinner,sun8i-r40";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   status = "okay";
+
+   axp22x: pmic@68 {
+   compatible = "x-powers,axp221";
+   reg = <0x34>;
+   interrupt-parent = <_intc>;
+   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+#include "axp22x.dtsi"
+
+_aldo3 {
+   regulator-always-on;
+   regulator-min-microvolt = <270>;
+   regulator-max-microvolt = <330>;
+   regulator-name = "avcc";
+};
+
+_dcdc1 {
+   regulator-always-on;
+   regulator-min-microvolt = <300>;
+   regulator-max-microvolt = <300>;
+   regulator-name = "vcc-3v0";
+};
+
+_dcdc2 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <130>;
+   regulator-name = "vdd-cpu";
+};
+
+_dcdc3 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <130>;
+   regulator-name = "vdd-sys";
+};
+
+_dcdc5 {
+   regulator-always-on;
+   regulator-min-microvolt = <150>;
+   regulator-max-microvolt = <150>;
+   regulator-name = "vcc-dram";
+};
+
+_dldo1 {
+   regulator-min-microvolt 

[U-Boot] [PATCH 1/3] ARM: dts: sun8i: Sync r40 dtsi from Linux

2018-04-25 Thread Jagan Teki
Sync sun8i-r40.dtsi changes from Linux with

Merge: a406778618d0 088345fc3553
Author: Stephen Rothwell 
Date:   Tue Apr 24 14:15:02 2018 +1000

Merge branch 'akpm/master'

Signed-off-by: Jagan Teki 
---
 arch/arm/dts/sun8i-r40.dtsi   |  43 +++
 include/dt-bindings/clock/sun8i-r40-ccu.h | 187 ++
 include/dt-bindings/reset/sun8i-r40-ccu.h | 130 +
 3 files changed, 360 insertions(+)
 create mode 100644 include/dt-bindings/clock/sun8i-r40-ccu.h
 create mode 100644 include/dt-bindings/reset/sun8i-r40-ccu.h

diff --git a/arch/arm/dts/sun8i-r40.dtsi b/arch/arm/dts/sun8i-r40.dtsi
index 48ec2e855a..0aa76a2f10 100644
--- a/arch/arm/dts/sun8i-r40.dtsi
+++ b/arch/arm/dts/sun8i-r40.dtsi
@@ -43,6 +43,8 @@
  */
 
 #include 
+#include 
+#include 
 
 / {
#address-cells = <1>;
@@ -114,6 +116,39 @@
#size-cells = <1>;
ranges;
 
+   nmi_intc: interrupt-controller@1c00030 {
+   compatible = "allwinner,sun7i-a20-sc-nmi";
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   reg = <0x01c00030 0x0c>;
+   interrupts = ;
+   };
+
+   mmc0: mmc@1c0f000 {
+   compatible = "allwinner,sun8i-r40-mmc",
+"allwinner,sun50i-a64-mmc";
+   reg = <0x01c0f000 0x1000>;
+   clocks = < CLK_BUS_MMC0>, < CLK_MMC0>;
+   clock-names = "ahb", "mmc";
+   resets = < RST_BUS_MMC0>;
+   reset-names = "ahb";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+   interrupts = ;
+   status = "disabled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+
+   ccu: clock@1c2 {
+   compatible = "allwinner,sun8i-r40-ccu";
+   reg = <0x01c2 0x400>;
+   clocks = <>, <>;
+   clock-names = "hosc", "losc";
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+   };
+
pio: pinctrl@1c20800 {
compatible = "allwinner,sun8i-r40-pinctrl";
reg = <0x01c20800 0x400>;
@@ -132,6 +167,14 @@
bias-pull-up;
};
 
+   mmc0_pins: mmc0-pins {
+   pins = "PF0", "PF1", "PF2",
+  "PF3", "PF4", "PF5";
+   function = "mmc0";
+   drive-strength = <30>;
+   bias-pull-up;
+   };
+
uart0_pb_pins: uart0_pb_pins {
pins = "PB22", "PB23";
function = "uart0";
diff --git a/include/dt-bindings/clock/sun8i-r40-ccu.h 
b/include/dt-bindings/clock/sun8i-r40-ccu.h
new file mode 100644
index 00..4fa5f69fc2
--- /dev/null
+++ b/include/dt-bindings/clock/sun8i-r40-ccu.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2017 Icenowy Zheng 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 

[U-Boot] [PATCH 2/3] sunxi: sun8i: Add Allwinner V40 support

2018-04-25 Thread Jagan Teki
Allwinner V40 (sun8i) SoC features a Quad-Core Cortex-A7 ARM CPU,
and a Mali400 MP2 GPU from ARM. It is the automotive version of R40.

This patch add support for V40 by reusing R40 configurations.

MACH_SUN8I_R40_V40 is the common config option for both.

Also fixed checkpatch warnings while making these changes.

Signed-off-by: Jagan Teki 
---
 arch/arm/cpu/armv7/sunxi/psci.c   | 10 
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h |  4 +--
 arch/arm/include/asm/arch-sunxi/cpu_sun4i.h   |  6 ++---
 arch/arm/include/asm/arch-sunxi/timer.h   |  2 +-
 arch/arm/include/asm/arch-sunxi/watchdog.h|  6 ++---
 arch/arm/mach-sunxi/Kconfig   | 36 ---
 arch/arm/mach-sunxi/board.c   | 11 
 arch/arm/mach-sunxi/clock_sun6i.c |  9 +++
 arch/arm/mach-sunxi/cpu_info.c|  2 ++
 arch/arm/mach-sunxi/dram_sunxi_dw.c   |  6 ++---
 arch/arm/mach-sunxi/pmic_bus.c|  8 +++---
 board/sunxi/board.c   | 26 ---
 drivers/power/Kconfig | 18 +++---
 13 files changed, 74 insertions(+), 70 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/psci.c b/arch/arm/cpu/armv7/sunxi/psci.c
index 18da9cb864..39195b6313 100644
--- a/arch/arm/cpu/armv7/sunxi/psci.c
+++ b/arch/arm/cpu/armv7/sunxi/psci.c
@@ -80,7 +80,7 @@ static void __secure clamp_release(u32 __maybe_unused *clamp)
 {
 #if defined(CONFIG_MACH_SUN6I) || defined(CONFIG_MACH_SUN7I) || \
defined(CONFIG_MACH_SUN8I_H3) || \
-   defined(CONFIG_MACH_SUN8I_R40)
+   defined(CONFIG_MACH_SUN8I_R40_V40)
u32 tmp = 0x1ff;
do {
tmp >>= 1;
@@ -95,7 +95,7 @@ static void __secure clamp_set(u32 __maybe_unused *clamp)
 {
 #if defined(CONFIG_MACH_SUN6I) || defined(CONFIG_MACH_SUN7I) || \
defined(CONFIG_MACH_SUN8I_H3) || \
-   defined(CONFIG_MACH_SUN8I_R40)
+   defined(CONFIG_MACH_SUN8I_R40_V40)
writel(0xff, clamp);
 #endif
 }
@@ -118,7 +118,7 @@ static void __secure sunxi_power_switch(u32 *clamp, u32 
*pwroff, bool on,
}
 }
 
-#ifdef CONFIG_MACH_SUN8I_R40
+#ifdef CONFIG_MACH_SUN8I_R40_V40
 /* secondary core entry address is programmed differently on R40 */
 static void __secure sunxi_set_entry_address(void *entry)
 {
@@ -145,7 +145,7 @@ static void __secure sunxi_cpu_set_power(int 
__always_unused cpu, bool on)
sunxi_power_switch(>cpu1_pwr_clamp, >cpu1_pwroff,
   on, 0);
 }
-#elif defined CONFIG_MACH_SUN8I_R40
+#elif defined CONFIG_MACH_SUN8I_R40_V40
 static void __secure sunxi_cpu_set_power(int cpu, bool on)
 {
struct sunxi_cpucfg_reg *cpucfg =
@@ -155,7 +155,7 @@ static void __secure sunxi_cpu_set_power(int cpu, bool on)
   (void *)cpucfg + SUN8I_R40_PWROFF,
   on, 0);
 }
-#else /* ! CONFIG_MACH_SUN7I && ! CONFIG_MACH_SUN8I_R40 */
+#else /* ! CONFIG_MACH_SUN7I && ! CONFIG_MACH_SUN8I_R40_V40 */
 static void __secure sunxi_cpu_set_power(int cpu, bool on)
 {
struct sunxi_prcm_reg *prcm =
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h 
b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
index d35aa479f7..c4d8c58716 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
@@ -285,7 +285,7 @@ struct sunxi_ccm_reg {
 #define AHB_GATE_OFFSET_USB_EHCI1  27
 #define AHB_GATE_OFFSET_USB_EHCI0  26
 #endif
-#ifndef CONFIG_MACH_SUN8I_R40
+#ifndef CONFIG_MACH_SUN8I_R40_V40
 #define AHB_GATE_OFFSET_USB0   24
 #else
 #define AHB_GATE_OFFSET_USB0   25
@@ -439,7 +439,7 @@ struct sunxi_ccm_reg {
 #define CCM_PLL11_PATTERN  0xf586
 
 /* ahb_reset0 offsets */
-#ifdef CONFIG_MACH_SUN8I_R40
+#ifdef CONFIG_MACH_SUN8I_R40_V40
 #define AHB_RESET_OFFSET_SATA  24
 #endif
 #define AHB_RESET_OFFSET_GMAC  17
diff --git a/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h 
b/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h
index 2419062d45..89300064e1 100644
--- a/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h
+++ b/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h
@@ -114,7 +114,7 @@ defined(CONFIG_MACH_SUN50I)
 #define SUNXI_TP_BASE  0x01c25000
 #define SUNXI_PMU_BASE 0x01c25400
 
-#if defined CONFIG_MACH_SUN7I || defined CONFIG_MACH_SUN8I_R40
+#if defined CONFIG_MACH_SUN7I || defined CONFIG_MACH_SUN8I_R40_V40
 #define SUNXI_CPUCFG_BASE  0x01c25c00
 #endif
 
@@ -186,8 +186,8 @@ defined(CONFIG_MACH_SUN50I)
 #define SUNXI_PRCM_BASE0x01f01400
 
 #if defined CONFIG_SUNXI_GEN_SUN6I && \
-!defined CONFIG_MACH_SUN8I_A83T && \
-!defined CONFIG_MACH_SUN8I_R40
+   !defined CONFIG_MACH_SUN8I_A83T && \
+   !defined CONFIG_MACH_SUN8I_R40_V40
 #define SUNXI_CPUCFG_BASE  0x01f01c00
 #endif
 
diff --git a/arch/arm/include/asm/arch-sunxi/timer.h 

[U-Boot] [PATCH 2/2] config: evb-rk3399: enable make uboot.itb

2018-04-25 Thread Peter Robinson
Similar to firefly 3399 enable the ability to create a FIT image
with combined arm-trusted-firmware.

Signed-off-by: Peter Robinson 
---
 configs/evb-rk3399_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index b36f232dcb..67ba0ce015 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
 CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
@@ -25,6 +26,8 @@ CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names 
interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_SPL_OF_PLATDATA=y
+CONFIG_SPL_ATF=y
+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
-- 
2.17.0

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


[U-Boot] [PATCH 1/2] arm: rockchip: make_fit_atf: remove unneeded imports

2018-04-25 Thread Peter Robinson
From: Patrick Uiterwijk 

These imports are entirely unused in the entire script.

Signed-off-by: Patrick Uiterwijk 
Signed-off-by: Peter Robinson 
---
 arch/arm/mach-rockchip/make_fit_atf.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/make_fit_atf.py 
b/arch/arm/mach-rockchip/make_fit_atf.py
index 7c6dd57678..9a404d1d32 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -13,8 +13,6 @@ import getopt
 
 # pip install pyelftools
 from elftools.elf.elffile import ELFFile
-from elftools.elf.sections import SymbolTableSection
-from elftools.elf.segments import Segment, InterpSegment, NoteSegment
 
 ELF_SEG_P_TYPE='p_type'
 ELF_SEG_P_PADDR='p_paddr'
-- 
2.17.0

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


[U-Boot] [PATCH v2] distro: use imply to enable DISTRO_DEFAULTS as SoC default

2018-04-25 Thread Masahiro Yamada
The default of DISTRO_DEFAULTS is messy.  Using the 'imply' keyword
is equivalent and cleaner.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Update doc/README.distro

 Kconfig   | 5 -
 arch/arm/Kconfig  | 4 
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 1 +
 doc/README.distro | 3 +--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Kconfig b/Kconfig
index 6957097..3bf95c1 100644
--- a/Kconfig
+++ b/Kconfig
@@ -68,11 +68,6 @@ config CC_COVERAGE
 
 config DISTRO_DEFAULTS
bool "Select defaults suitable for booting general purpose Linux 
distributions"
-   default y if ARCH_SUNXI || TEGRA
-   default y if ARCH_LS2080A
-   default y if ARCH_MESON
-   default y if ARCH_ROCKCHIP
-   default n
imply USE_BOOTCOMMAND
select CMD_BOOTZ if ARM && !ARM64
select CMD_BOOTI if ARM64
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7212fc5..4848954 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -581,6 +581,7 @@ config ARCH_OMAP2PLUS
 
 config ARCH_MESON
bool "Amlogic Meson"
+   imply DISTRO_DEFAULTS
help
  Support for the Meson SoC family developed by Amlogic Inc.,
  targeted at media players and tablet computers. We currently
@@ -720,6 +721,7 @@ config ARCH_SUNXI
select USB_KEYBOARD if DISTRO_DEFAULTS
select USE_TINY_PRINTF
imply CMD_GPT
+   imply DISTRO_DEFAULTS
imply FAT_WRITE
imply OF_LIBFDT_OVERLAY
imply PRE_CONSOLE_BUFFER
@@ -780,6 +782,7 @@ config ARCH_ZYNQMP
 
 config TEGRA
bool "NVIDIA Tegra"
+   imply DISTRO_DEFAULTS
imply FAT_WRITE
 
 config TARGET_VEXPRESS64_AEMV8A
@@ -1178,6 +1181,7 @@ config ARCH_ROCKCHIP
select DM_REGULATOR
select ENABLE_ARM_SOC_BOOT0_HOOK
imply CMD_FASTBOOT
+   imply DISTRO_DEFAULTS
imply FASTBOOT
imply FAT_WRITE
imply USB_FUNCTION_FASTBOOT
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index c4a96d4..7edc06d 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -167,6 +167,7 @@ config ARCH_LS2080A
select SYS_I2C_MXC_I2C2
select SYS_I2C_MXC_I2C3
select SYS_I2C_MXC_I2C4
+   imply DISTRO_DEFAULTS
imply PANIC_HANG
 
 config FSL_LSCH2
diff --git a/doc/README.distro b/doc/README.distro
index 2af5590..522deb3 100644
--- a/doc/README.distro
+++ b/doc/README.distro
@@ -165,8 +165,7 @@ Enabling the distro options
 In your board's defconfig, enable the DISTRO_DEFAULTS option by adding
 a line with "CONFIG_DISTRO_DEFAULTS=y". If you want to enable this
 from Kconfig itself, for e.g. all boards using a specific SoC then
-add a "default y if ARCH_FOO" to the DISTRO_DEFAULTS section of
-the Kconfig file in the root of the u-boot sources.
+add a "imply DISTRO_DEFAULTS" to your SoC CONFIG option.
 
 In your board configuration file, include the following:
 
-- 
2.7.4

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


[U-Boot] Issues with Rockchips make_fit_atf.py on master

2018-04-25 Thread Peter Robinson
Hi Kever,

There's a problem with generating the FIT image for rockchips on
recent 2018.05 RCs, errors below, I suspect due to changes in dtc.

Peter

/builddir/build/BUILD/u-boot-2018.05-rc2/"arch/arm/mach-rockchip/make_fit_atf.py"
\
arch/arm/dts/rk3399-firefly.dtb > u-boot.its
  ./tools/mkimage  -f u-boot.its -E u-boot.itb >/dev/null  && cat /dev/null
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/uboot@1
has a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/atf@1 has
a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/atf@2 has
a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/atf@3 has
a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/fdt@1 has
a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node
/configurations/config@1 has a unit name, but no reg property
make[1]: Leaving directory
'/builddir/build/BUILD/u-boot-2018.05-rc2/builds/firefly-rk3399'
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] usb: host: dwc3: fix phys init

2018-04-25 Thread Neil Armstrong
When no PHYs are declared in the dwc3 node, the phy init fails.
This patch checks if the "phys" property is presend and reports
the error returned by dev_count_phandle_with_args().

This patchs also fixes the styles issues added in last commit.

This patch should fix the DWC3 support on the UniPhier SoC family.

Fixes: 7c839ea70c49 ("usb: host: dwc3: Add support for multiple PHYs")
Reported-by: Masahiro Yamada 
Signed-off-by: Neil Armstrong 
---
 drivers/usb/host/xhci-dwc3.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index c100735..adfa4a7 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -113,16 +113,21 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val)
 }
 
 #ifdef CONFIG_DM_USB
-static int xhci_dwc3_setup_phy(struct udevice *dev, int count)
+static int xhci_dwc3_setup_phy(struct udevice *dev)
 {
struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
-   int i, ret;
+   int i, ret, count;
 
-   if (!count)
+   /* Return if no phy declared */
+   if (!dev_read_prop(dev, "phys", NULL))
return 0;
 
+   count = dev_count_phandle_with_args(dev, "phys", "#phy-cells");
+   if (count <= 0)
+   return count;
+
plat->usb_phys = devm_kcalloc(dev, count, sizeof(struct phy),
-   GFP_KERNEL);
+ GFP_KERNEL);
if (!plat->usb_phys)
return -ENOMEM;
 
@@ -136,7 +141,7 @@ static int xhci_dwc3_setup_phy(struct udevice *dev, int 
count)
 
++plat->num_phys;
}
-   
+
for (i = 0; i < plat->num_phys; i++) {
ret = generic_phy_init(>usb_phys[i]);
if (ret) {
@@ -145,7 +150,7 @@ static int xhci_dwc3_setup_phy(struct udevice *dev, int 
count)
goto phys_init_err;
}
}
-   
+
for (i = 0; i < plat->num_phys; i++) {
ret = generic_phy_power_on(>usb_phys[i]);
if (ret) {
@@ -157,7 +162,6 @@ static int xhci_dwc3_setup_phy(struct udevice *dev, int 
count)
 
return 0;
 
-
 phys_poweron_err:
for (; i >= 0; i--)
generic_phy_power_off(>usb_phys[i]);
@@ -187,7 +191,7 @@ static int xhci_dwc3_shutdown_phy(struct udevice *dev)
ret |= generic_phy_exit(>usb_phys[i]);
if (ret) {
pr_err("Can't shutdown USB PHY%d for %s\n",
-   i, dev->name);
+  i, dev->name);
}
}
 
@@ -206,8 +210,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
hcor = (struct xhci_hcor *)((uintptr_t)hccr +
HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
 
-   ret = xhci_dwc3_setup_phy(dev, dev_count_phandle_with_args(
-   dev, "phys", "#phy-cells"));
+   ret = xhci_dwc3_setup_phy(dev);
if (ret)
return ret;
 
-- 
2.7.4

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


[U-Boot] [PATCH] defconfig: at91-sama5d2_ptc_ek: remove unused SYS_EXTRA_OPTIONS

2018-04-25 Thread Eugen Hristev
From: Ludovic Desroches 

Remove SYS_USE_NANDFLASH, SYS_USE_MMC as they are deprecated and
unused.
The board configurations already use CONFIG_SD_BOOT and
CONFIG_NAND_BOOT respectively.

Signed-off-by: Ludovic Desroches 
[eugen.hris...@microchip.com: rework on latest u-boot]
Signed-off-by: Eugen Hristev 
---
 configs/sama5d2_ptc_ek_mmc_defconfig   | 2 +-
 configs/sama5d2_ptc_ek_nandflash_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/sama5d2_ptc_ek_mmc_defconfig 
b/configs/sama5d2_ptc_ek_mmc_defconfig
index 4f427ca..3214ffe 100644
--- a/configs/sama5d2_ptc_ek_mmc_defconfig
+++ b/configs/sama5d2_ptc_ek_mmc_defconfig
@@ -7,7 +7,7 @@ CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_ptc_ek"
 CONFIG_DEBUG_UART=y
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
 CONFIG_FIT=y
-CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_MMC"
+CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2"
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=3
 CONFIG_CONSOLE_MUX=y
diff --git a/configs/sama5d2_ptc_ek_nandflash_defconfig 
b/configs/sama5d2_ptc_ek_nandflash_defconfig
index a768112..ea72fc0 100644
--- a/configs/sama5d2_ptc_ek_nandflash_defconfig
+++ b/configs/sama5d2_ptc_ek_nandflash_defconfig
@@ -7,7 +7,7 @@ CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_ptc_ek"
 CONFIG_DEBUG_UART=y
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
 CONFIG_FIT=y
-CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_NANDFLASH"
+CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2"
 CONFIG_NAND_BOOT=y
 CONFIG_BOOTDELAY=3
 CONFIG_CONSOLE_MUX=y
-- 
2.7.4

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


  1   2   >