Re: [U-Boot] [PATCH v6 00/25] Fix and extend i.MX HAB layer

2018-02-08 Thread Jagan Teki
On Thu, Feb 8, 2018 at 9:47 PM, Bryan O'Donoghue
 wrote:
>
>>>
>>> I'm observing authentication issue while loading U-Boot proper, U-Boot
>>> proper now have features like SPL DM and SPL FIT etc
>>>
>>> U-Boot SPL 2018.03-rc1-00182-gb81f7c9 (Feb 08 2018 - 17:19:03 +0530)
>>> Trying to boot from MMC1
>>> Expected Linux image is not found. Trying to start U-boot
>>>
>>> Authenticate image from DDR location 0x1780...
>>> bad magic magic=0xb8 length=0x841b version=0x17
>>> bad length magic=0xb8 length=0x841b version=0x17
>>> bad version magic=0xb8 length=0x841b version=0x17
>>> spl: ERROR:  image authentication unsuccessful
>>> ### ERROR ### Please RESET the board ###
>>>
>>> Please let me know where I missed, I'm authenticating SPL and
>>> u-boot-dtb.img now.
>>
>>
>> Can you please check if the generated u-boot-dtb.img contains a IVT
>> table appended in the end of the image?
>>
>> The mx6slevk_spl_defconfig target also generates SPL + u-boot-dtb.img
>> but I have to use the u-boot-ivt.img binary instead. In my case
>> u-boot-dtb.img does not includes a IVT table.
>>
>> Best Regards,
>> Breno Lima
>>
>
> At a guess I'd say it's the fix we did for hab_auth_img - I guess Jagan you
> have an out-of-tree implementation here ?

Basically I'm trying to compare this with implementation before, look
like issue is IVT image signature is missing for when
CONFIG_SPL_LOAD_FIT defined.  It's working without SPL_LOAD_FIT.

>
> If you have a command in your environment that looks like this
>
> hab_auth_img 0x1780 0x1
>
> that should now be
>
> hab_auth_img 0x1780 0x1 0xF400
>
> assuming the CSF footer is aprox 0xC00 bytes padded.
>
> git show c5800b2
>
> arm: imx: hab: Fix authenticate_image input parameters
>
> 1: Adding a new parameter to hab_auth_img
>- addr   : image hex address
>- length : total length of the image
>- offset : offset of IVT from addr
>

I've created u-boot-ivt.image which we did in previous releases[2] and
padded 0x2000 to CSF to align the size of CONFIG_CSF_SIZE

Image Name:   U-Boot 2018.03-rc1-00182-gb81f7c
Created:  Fri Feb  9 11:00:05 2018
Image Type:   ARM U-Boot Firmware with HABv4 IVT (uncompressed)
Data Size:360384 Bytes = 351.94 KiB = 0.34 MiB
Load Address: 1780
Entry Point:  
HAB Blocks:   0x177fffc0   0x   0x00056020

icorem6qdl-rqs> hab_auth_img 0x177fffc0 0x58020 0x56020

Authenticate image from DDR location 0x177fffc0...
bad magic magic=0xd4 length=0x5000 version=0x41
bad length magic=0xd4 length=0x5000 version=0x41

[2] 
https://openedev.amarulasolutions.com/display/ODUBOOT/i.MX6+HABv4#i.MX6HABv4-SignedBoot-Usage
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] block: Migrate SystemACE chip to Kconfig

2018-02-08 Thread Michal Simek
On 8.2.2018 19:51, Tom Rini wrote:
> Migrate the base and sub-options to Kconfig.  Note that we only enable
> this in the base sandbox config now.
> 
> Cc: Alexey Brodkin 
> Cc: Michal Simek 
> Signed-off-by: Tom Rini 
> ---
> Is this driver still used anywhere?  It's fishy that it's only enabled
> in sandbox anymore.

With microblaze big endian this driver can be used but none is testing
it and there is also no interest to keep this driver up and running on
this ancient unsupported configuration.
There is no official systemace axi based IP core even IIRC I have seen
it in past.
It means from my point of view this driver can be removed.

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


[U-Boot] [PATCH] arm/PSCI: support PSCI versions greater than 1.0

2018-02-08 Thread Andre Heider
ATF recently began announcing PSCI v1.1. Since that version is unknown
to u-boot, the PSCI device nodes were not updated.

Switch from the case statement to a greater/less-than comparison so that
v1.1, as well as future versions, get at least the compatible nodes of
known versions.

PSCI v1.1 doesn't seem to have introduced a new corresponding compatible.

Signed-off-by: Andre Heider 
---
 arch/arm/lib/psci-dt.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/arm/lib/psci-dt.c b/arch/arm/lib/psci-dt.c
index 05e0ad6e70..7f228537f6 100644
--- a/arch/arm/lib/psci-dt.c
+++ b/arch/arm/lib/psci-dt.c
@@ -69,22 +69,25 @@ init_psci_node:
 #elif defined(CONFIG_ARMV7_PSCI_1_0) || defined(CONFIG_ARMV8_PSCI)
psci_ver = ARM_PSCI_VER_1_0;
 #endif
-   switch (psci_ver) {
-   case ARM_PSCI_VER_1_0:
+   if (psci_ver >= ARM_PSCI_VER_1_0) {
tmp = fdt_setprop_string(fdt, nodeoff,
"compatible", "arm,psci-1.0");
if (tmp)
return tmp;
-   case ARM_PSCI_VER_0_2:
+   }
+
+   if (psci_ver >= ARM_PSCI_VER_0_2) {
tmp = fdt_appendprop_string(fdt, nodeoff,
"compatible", "arm,psci-0.2");
if (tmp)
return tmp;
-   default:
+   }
+
+#ifndef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
/*
 * The Secure firmware framework isn't able to support PSCI version 0.1.
 */
-#ifndef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
+   if (psci_ver < ARM_PSCI_VER_0_2) {
tmp = fdt_appendprop_string(fdt, nodeoff,
"compatible", "arm,psci");
if (tmp)
@@ -105,9 +108,8 @@ init_psci_node:
ARM_PSCI_FN_MIGRATE);
if (tmp)
return tmp;
-#endif
-   break;
}
+#endif
 
tmp = fdt_setprop_string(fdt, nodeoff, "method", "smc");
if (tmp)
-- 
2.16.1

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


Re: [U-Boot] [U-Boot,v3,1/2] bcm283x: Add pinctrl driver

2018-02-08 Thread Heinrich Schuchardt

On 02/09/2018 05:12 AM, Jonathan Gray wrote:

On Fri, Feb 09, 2018 at 04:43:09AM +0100, Heinrich Schuchardt wrote:

On 02/09/2018 12:55 AM, Jonathan Gray wrote:

On Thu, Feb 08, 2018 at 03:44:32PM +0100, Heinrich Schuchardt wrote:

On 02/08/2018 10:49 AM, Jonathan Gray wrote:

On Thu, Feb 08, 2018 at 08:10:47PM +1100, Jonathan Gray wrote:

On Thu, Feb 08, 2018 at 09:11:20AM +0100, Alexander Graf wrote:




Am 08.02.2018 um 06:49 schrieb Jonathan Gray :

On Mon, Feb 05, 2018 at 11:31:42AM +0100, Mark Kettenis wrote:

Date: Mon, 5 Feb 2018 21:06:59 +1100
From: Jonathan Gray 


booting sd0a:/bsd: open sd0a:/bsd: Device not configured
failed(6). will try /bsd


How do you find out that it's sd0a instead of sd1a?


The loaded image protocol I believe.


Actually the OpenBSD bootloader currently only supports loading the
bsd kernel from the same device as the bootloader.  It will always
call that device sd0.  It invokes the device path protocol on the
loaded image handle and then matches that path to a device that
supports the block io protocol.


Perhaps the problem is elsewhere as U-Boot master also broke
vexpress_ca15_tc2 and mx6cuboxi targets:


Perfect, so can you quickly bisect it now that the bisect doesn???t end at the 
pinctrl driver?


On cubox a bisect points to

commit 64e4db0f119151a1345e1da19d152eda550394e7
Author: Heinrich Schuchardt 
Date:   Fri Jan 19 20:24:47 2018 +0100

  efi_loader: make efi_disk_create_partitions a global symbol
  Up to now we have been using efi_disk_create_partitions() to create
  partitions for block devices that existed before starting an EFI
  application.
  We need to call it for block devices created by EFI
  applications at run time. The EFI application will define the
  handle for the block device and install a device path protocol
  on it. We have to use this device path as stem for the partition
  device paths.
  Signed-off-by: Heinrich Schuchardt 
  Signed-off-by: Alexander Graf 

   include/efi_loader.h  |  4 +++
   lib/efi_loader/efi_disk.c | 84 
+++
   2 files changed, 64 insertions(+), 24 deletions(-)

If I revert this commit a image built from master works.


Actually master doesn't build with just that reverted, seems I had stale
object files.


When bisecting running
'make mrproper && make foo_defconfig && make'
in each round is recommendable.

Do you still assume a problem that requires a change in U-Boot?
Or can we close the topic?

Best regards

Heinrich


There are multiple regressions with U-Boot master compared to 2018.01.


U-Boot master is a moving target. Please, state the commit.


The commit was mentioned three times in the mail but you seem
to have missed that.

again e24bd1e79e223aa89854c0be95a53e2d538144a5





sopine_baseboard (pinebook), reported to me I don't have hardware
rpi_3
mx6cuboxi
vexpress_ca15_tc2


It is unclear what this sentence means.

Do you expect to that a pinebook can boot from a U-Boot that is compiled
with rpi_3_defconfig?

Wouldn't you use a U-Boot image compiled with sopine_baseboard_defconfig for
your pinebook?


Please read the above.  A sopine_baseboard image was used on the pinebook
and not by me.





While qemu_arm64 works.

Bisecting rpi_3 again, removing obj dir between runs and skipping


What do you mean by obj dir?


build directory, dir used with O= on make calls




commits where nothing shows up on serial again gives the same:

commit caf2233b281c03e3e359061a3dfa537d8a25c273
Author: Alexander Graf 
AuthorDate: Tue Jan 23 18:05:21 2018 +0100
Commit: Tom Rini 
CommitDate: Sun Jan 28 12:27:32 2018 -0500

  bcm283x: Add pinctrl driver
  The bcm283x family of SoCs have a GPIO controller that also acts as
  pinctrl controller.
  This patch introduces a new pinctrl driver that can actually properly mux
  devices into their device tree defined pin states and is now the primary
  owner of the gpio device. The previous GPIO driver gets moved into a
  subdevice of the pinctrl driver, bound to the same OF node.
  That way whenever a device asks for pinctrl support, it gets it
  automatically from the pinctrl driver and GPIO support is still available
  in the normal command line phase.
  Signed-off-by: Alexander Graf 

with master as of e24bd1e79e223aa89854c0be95a53e2d538144a5

U-Boot 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:36:18 +1300)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, sdhci@7e30: 1
Loading Environment from FAT... OK
In:serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   Core Release: 2.80a
scanning bus 0 for devices... 4 USB Device(s) found
 scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  0


Re: [U-Boot] [U-Boot,v3,1/2] bcm283x: Add pinctrl driver

2018-02-08 Thread Jonathan Gray
On Fri, Feb 09, 2018 at 04:43:09AM +0100, Heinrich Schuchardt wrote:
> On 02/09/2018 12:55 AM, Jonathan Gray wrote:
> > On Thu, Feb 08, 2018 at 03:44:32PM +0100, Heinrich Schuchardt wrote:
> > > On 02/08/2018 10:49 AM, Jonathan Gray wrote:
> > > > On Thu, Feb 08, 2018 at 08:10:47PM +1100, Jonathan Gray wrote:
> > > > > On Thu, Feb 08, 2018 at 09:11:20AM +0100, Alexander Graf wrote:
> > > > > > 
> > > > > > 
> > > > > > > Am 08.02.2018 um 06:49 schrieb Jonathan Gray :
> > > > > > > 
> > > > > > > On Mon, Feb 05, 2018 at 11:31:42AM +0100, Mark Kettenis wrote:
> > > > > > > > > Date: Mon, 5 Feb 2018 21:06:59 +1100
> > > > > > > > > From: Jonathan Gray 
> > > > > > > > > 
> > > > > > > > > > > booting sd0a:/bsd: open sd0a:/bsd: Device not configured
> > > > > > > > > > > failed(6). will try /bsd
> > > > > > > > > > 
> > > > > > > > > > How do you find out that it's sd0a instead of sd1a?
> > > > > > > > > 
> > > > > > > > > The loaded image protocol I believe.
> > > > > > > > 
> > > > > > > > Actually the OpenBSD bootloader currently only supports loading 
> > > > > > > > the
> > > > > > > > bsd kernel from the same device as the bootloader.  It will 
> > > > > > > > always
> > > > > > > > call that device sd0.  It invokes the device path protocol on 
> > > > > > > > the
> > > > > > > > loaded image handle and then matches that path to a device that
> > > > > > > > supports the block io protocol.
> > > > > > > 
> > > > > > > Perhaps the problem is elsewhere as U-Boot master also broke
> > > > > > > vexpress_ca15_tc2 and mx6cuboxi targets:
> > > > > > 
> > > > > > Perfect, so can you quickly bisect it now that the bisect doesn???t 
> > > > > > end at the pinctrl driver?
> > > > > 
> > > > > On cubox a bisect points to
> > > > > 
> > > > > commit 64e4db0f119151a1345e1da19d152eda550394e7
> > > > > Author: Heinrich Schuchardt 
> > > > > Date:   Fri Jan 19 20:24:47 2018 +0100
> > > > > 
> > > > >  efi_loader: make efi_disk_create_partitions a global symbol
> > > > >  Up to now we have been using efi_disk_create_partitions() to 
> > > > > create
> > > > >  partitions for block devices that existed before starting an EFI
> > > > >  application.
> > > > >  We need to call it for block devices created by EFI
> > > > >  applications at run time. The EFI application will define the
> > > > >  handle for the block device and install a device path protocol
> > > > >  on it. We have to use this device path as stem for the partition
> > > > >  device paths.
> > > > >  Signed-off-by: Heinrich Schuchardt 
> > > > >  Signed-off-by: Alexander Graf 
> > > > > 
> > > > >   include/efi_loader.h  |  4 +++
> > > > >   lib/efi_loader/efi_disk.c | 84 
> > > > > +++
> > > > >   2 files changed, 64 insertions(+), 24 deletions(-)
> > > > > 
> > > > > If I revert this commit a image built from master works.
> > > > 
> > > > Actually master doesn't build with just that reverted, seems I had stale
> > > > object files.
> > > 
> > > When bisecting running
> > > 'make mrproper && make foo_defconfig && make'
> > > in each round is recommendable.
> > > 
> > > Do you still assume a problem that requires a change in U-Boot?
> > > Or can we close the topic?
> > > 
> > > Best regards
> > > 
> > > Heinrich
> > 
> > There are multiple regressions with U-Boot master compared to 2018.01.
> 
> U-Boot master is a moving target. Please, state the commit.

The commit was mentioned three times in the mail but you seem
to have missed that.

again e24bd1e79e223aa89854c0be95a53e2d538144a5

> 
> > 
> > sopine_baseboard (pinebook), reported to me I don't have hardware
> > rpi_3
> > mx6cuboxi
> > vexpress_ca15_tc2
> 
> It is unclear what this sentence means.
> 
> Do you expect to that a pinebook can boot from a U-Boot that is compiled
> with rpi_3_defconfig?
> 
> Wouldn't you use a U-Boot image compiled with sopine_baseboard_defconfig for
> your pinebook?

Please read the above.  A sopine_baseboard image was used on the pinebook
and not by me.

> 
> > 
> > While qemu_arm64 works.
> > 
> > Bisecting rpi_3 again, removing obj dir between runs and skipping
> 
> What do you mean by obj dir?

build directory, dir used with O= on make calls

> 
> > commits where nothing shows up on serial again gives the same:
> > 
> > commit caf2233b281c03e3e359061a3dfa537d8a25c273
> > Author: Alexander Graf 
> > AuthorDate: Tue Jan 23 18:05:21 2018 +0100
> > Commit: Tom Rini 
> > CommitDate: Sun Jan 28 12:27:32 2018 -0500
> > 
> >  bcm283x: Add pinctrl driver
> >  The bcm283x family of SoCs have a GPIO controller that also acts as
> >  pinctrl controller.
> >  This patch introduces a new pinctrl driver that can actually properly 
> > mux
> >  devices into their device tree defined pin states and is now the 
> > primary
> >  owner of 

Re: [U-Boot] [PATCH v3 11/18] efi_loader: make efi_disk_create_partitions a global symbol

2018-02-08 Thread Heinrich Schuchardt

On 02/09/2018 01:15 AM, Jonathan Gray wrote:

On Fri, Jan 19, 2018 at 08:24:47PM +0100, Heinrich Schuchardt wrote:

Up to now we have been using efi_disk_create_partitions() to create
partitions for block devices that existed before starting an EFI
application.

We need to call it for block devices created by EFI
applications at run time. The EFI application will define the
handle for the block device and install a device path protocol
on it. We have to use this device path as stem for the partition
device paths.

Signed-off-by: Heinrich Schuchardt 
---
v3
fix typos in comments
v2
no change


breakage on mx6cuboxi with OpenBSD bootarm.efi, bisects to

commit 64e4db0f119151a1345e1da19d152eda550394e7
Author: Heinrich Schuchardt 
AuthorDate: Fri Jan 19 20:24:47 2018 +0100
Commit: Alexander Graf 
CommitDate: Mon Jan 22 23:09:14 2018 +0100

 efi_loader: make efi_disk_create_partitions a global symbol
 
 Up to now we have been using efi_disk_create_partitions() to create

 partitions for block devices that existed before starting an EFI
 application.
 
 We need to call it for block devices created by EFI

 applications at run time. The EFI application will define the
 handle for the block device and install a device path protocol
 on it. We have to use this device path as stem for the partition
 device paths.
 
 Signed-off-by: Heinrich Schuchardt 

 Signed-off-by: Alexander Graf 

with master as of e24bd1e79e223aa89854c0be95a53e2d538144a5

U-Boot SPL 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:43:18 +1300)
Trying to boot from MMC1


U-Boot 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:43:18 +1300)

CPU:   Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 24C
Reset cause: POR
Board: MX6 Cubox-i
DRAM:  2 GiB
MMC:   FSL_SDHC: 0
Loading Environment from MMC... OK
No panel detected: default to HDMI
Display: HDMI (1024x768)
In:serial
Out:   serial
Err:   serial
Net:   FEC
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
37503 bytes read in 17 ms (2.1 MiB/s)
Found EFI removable media binary efi/boot/bootarm.efi
Scanning disks on usb...
76528 bytes read in 31 ms (2.4 MiB/s)
## Starting EFI application at 1200 ...
BS->LocateHandle() returns -2147483634


-2147483634 == EFI_NOT_FOUND

Without debug output it is impossible to understand what is going wrong. 
Please, insert


#define DEBUG 1

at the top of lib/efi_loader/efi_boottime.c

I assume you are again trying to boot OpenBSD.

Does this image reproduce the error:
https://ftp.eu.openbsd.org/pub/OpenBSD/6.2/armv7/miniroot-cubox-62.fs

Otherwise provide a disk image that can be used for testing.

I only have a Wandboard Quad. But that has the same i.MX6Q processor. So 
once I know which image to use I could run a test.


Best regards

Heinrich


undefined instruction
pc : [<8e560348>]lr : [<8e56444c>]
reloc pc : [<15de4348>]  lr : [<15de844c>]
sp : 8f57af10  ip : 8ffc2474 fp : 8f57af1c
r10: b000  r9 : 8f57bee0 r8 : 000b
r7 : 8ffa1a9d  r6 : 8ffa16ad r5 : 8e56f0d0  r4 : 8e56e88a
r3 : 8e56dac8  r2 : 0001 r1 :   r0 : 
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

(undefined instruction is used to reset as efi reset was not
present in earlier U-Boot versions).



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


Re: [U-Boot] [U-Boot,v3,1/2] bcm283x: Add pinctrl driver

2018-02-08 Thread Heinrich Schuchardt

On 02/09/2018 12:55 AM, Jonathan Gray wrote:

On Thu, Feb 08, 2018 at 03:44:32PM +0100, Heinrich Schuchardt wrote:

On 02/08/2018 10:49 AM, Jonathan Gray wrote:

On Thu, Feb 08, 2018 at 08:10:47PM +1100, Jonathan Gray wrote:

On Thu, Feb 08, 2018 at 09:11:20AM +0100, Alexander Graf wrote:




Am 08.02.2018 um 06:49 schrieb Jonathan Gray :

On Mon, Feb 05, 2018 at 11:31:42AM +0100, Mark Kettenis wrote:

Date: Mon, 5 Feb 2018 21:06:59 +1100
From: Jonathan Gray 


booting sd0a:/bsd: open sd0a:/bsd: Device not configured
failed(6). will try /bsd


How do you find out that it's sd0a instead of sd1a?


The loaded image protocol I believe.


Actually the OpenBSD bootloader currently only supports loading the
bsd kernel from the same device as the bootloader.  It will always
call that device sd0.  It invokes the device path protocol on the
loaded image handle and then matches that path to a device that
supports the block io protocol.


Perhaps the problem is elsewhere as U-Boot master also broke
vexpress_ca15_tc2 and mx6cuboxi targets:


Perfect, so can you quickly bisect it now that the bisect doesn???t end at the 
pinctrl driver?


On cubox a bisect points to

commit 64e4db0f119151a1345e1da19d152eda550394e7
Author: Heinrich Schuchardt 
Date:   Fri Jan 19 20:24:47 2018 +0100

 efi_loader: make efi_disk_create_partitions a global symbol
 
 Up to now we have been using efi_disk_create_partitions() to create

 partitions for block devices that existed before starting an EFI
 application.
 
 We need to call it for block devices created by EFI

 applications at run time. The EFI application will define the
 handle for the block device and install a device path protocol
 on it. We have to use this device path as stem for the partition
 device paths.
 
 Signed-off-by: Heinrich Schuchardt 

 Signed-off-by: Alexander Graf 

  include/efi_loader.h  |  4 +++
  lib/efi_loader/efi_disk.c | 84 
+++
  2 files changed, 64 insertions(+), 24 deletions(-)

If I revert this commit a image built from master works.


Actually master doesn't build with just that reverted, seems I had stale
object files.


When bisecting running
'make mrproper && make foo_defconfig && make'
in each round is recommendable.

Do you still assume a problem that requires a change in U-Boot?
Or can we close the topic?

Best regards

Heinrich


There are multiple regressions with U-Boot master compared to 2018.01.


U-Boot master is a moving target. Please, state the commit.



sopine_baseboard (pinebook), reported to me I don't have hardware
rpi_3
mx6cuboxi
vexpress_ca15_tc2


It is unclear what this sentence means.

Do you expect to that a pinebook can boot from a U-Boot that is compiled 
with rpi_3_defconfig?


Wouldn't you use a U-Boot image compiled with sopine_baseboard_defconfig 
for your pinebook?




While qemu_arm64 works.

Bisecting rpi_3 again, removing obj dir between runs and skipping


What do you mean by obj dir?


commits where nothing shows up on serial again gives the same:

commit caf2233b281c03e3e359061a3dfa537d8a25c273
Author: Alexander Graf 
AuthorDate: Tue Jan 23 18:05:21 2018 +0100
Commit: Tom Rini 
CommitDate: Sun Jan 28 12:27:32 2018 -0500

 bcm283x: Add pinctrl driver
 
 The bcm283x family of SoCs have a GPIO controller that also acts as

 pinctrl controller.
 
 This patch introduces a new pinctrl driver that can actually properly mux

 devices into their device tree defined pin states and is now the primary
 owner of the gpio device. The previous GPIO driver gets moved into a
 subdevice of the pinctrl driver, bound to the same OF node.
 
 That way whenever a device asks for pinctrl support, it gets it

 automatically from the pinctrl driver and GPIO support is still available
 in the normal command line phase.
 
 Signed-off-by: Alexander Graf 


with master as of e24bd1e79e223aa89854c0be95a53e2d538144a5

U-Boot 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:36:18 +1300)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, sdhci@7e30: 1
Loading Environment from FAT... OK
In:serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   Core Release: 2.80a
scanning bus 0 for devices... 4 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  0

Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra
Type: Removable Hard Disk
Capacity: 29327.3 MB = 28.6 GB (60062500 x 512)
... is now current device
Scanning usb 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
82748 bytes read in 89 ms (907.2 KiB/s)
## Starting EFI application at 0100 ...
Scanning disk m...@7e202000.blk...

[U-Boot] [PATCH 2/3] clk: at91: add PLLADIV driver

2018-02-08 Thread Wenyou Yang
As said in the SAMA5D2 datasheet, the PLLA clock must be divided
by 2 by writing the PLLADIV2 bit in PMC_MCKR, if the ratio between
PCK and MCK is 3 (MDIV = 3). This is the purpose of the driver.

Signed-off-by: Wenyou Yang 
---

 drivers/clk/at91/Makefile  |  2 +-
 drivers/clk/at91/clk-plladiv.c | 88 ++
 2 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/at91/clk-plladiv.c

diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 8cac3f9e18..8c197ff949 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -3,7 +3,7 @@
 #
 
 obj-y += pmc.o sckc.o
-obj-y += clk-slow.o clk-main.o clk-plla.o clk-master.o
+obj-y += clk-slow.o clk-main.o clk-plla.o clk-plladiv.o clk-master.o
 obj-y += clk-system.o clk-peripheral.o
 
 obj-$(CONFIG_AT91_UTMI)+= clk-utmi.o
diff --git a/drivers/clk/at91/clk-plladiv.c b/drivers/clk/at91/clk-plladiv.c
new file mode 100644
index 00..0599d2893b
--- /dev/null
+++ b/drivers/clk/at91/clk-plladiv.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018 Microhip / Atmel Corporation
+ *   Wenyou.Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "pmc.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int at91_plladiv_clk_enable(struct clk *clk)
+{
+   return 0;
+}
+
+static ulong at91_plladiv_clk_get_rate(struct clk *clk)
+{
+   struct pmc_platdata *plat = dev_get_platdata(clk->dev);
+   struct at91_pmc *pmc = plat->reg_base;
+   struct clk source;
+   ulong clk_rate;
+   int ret;
+
+   ret = clk_get_by_index(clk->dev, 0, );
+   if (ret)
+   return -EINVAL;
+
+   clk_rate = clk_get_rate();
+   if (readl(>mckr) & AT91_PMC_MCKR_PLLADIV_2)
+   clk_rate /= 2;
+
+   return clk_rate;
+}
+
+static ulong at91_plladiv_clk_set_rate(struct clk *clk, ulong rate)
+{
+   struct pmc_platdata *plat = dev_get_platdata(clk->dev);
+   struct at91_pmc *pmc = plat->reg_base;
+   struct clk source;
+   ulong parent_rate;
+   int ret;
+
+   ret = clk_get_by_index(clk->dev, 0, );
+   if (ret)
+   return -EINVAL;
+
+   parent_rate = clk_get_rate();
+   if ((parent_rate != rate) && ((parent_rate) / 2 != rate))
+   return -EINVAL;
+
+   if (parent_rate != rate) {
+   writel((readl(>mckr) | AT91_PMC_MCKR_PLLADIV_2),
+  >mckr);
+   }
+
+   return 0;
+}
+
+static struct clk_ops at91_plladiv_clk_ops = {
+   .enable = at91_plladiv_clk_enable,
+   .get_rate = at91_plladiv_clk_get_rate,
+   .set_rate = at91_plladiv_clk_set_rate,
+};
+
+static int at91_plladiv_clk_probe(struct udevice *dev)
+{
+   return at91_pmc_core_probe(dev);
+}
+
+static const struct udevice_id at91_plladiv_clk_match[] = {
+   { .compatible = "atmel,at91sam9x5-clk-plldiv" },
+   {}
+};
+
+U_BOOT_DRIVER(at91_plladiv_clk) = {
+   .name = "at91-plladiv-clk",
+   .id = UCLASS_CLK,
+   .of_match = at91_plladiv_clk_match,
+   .probe = at91_plladiv_clk_probe,
+   .platdata_auto_alloc_size = sizeof(struct pmc_platdata),
+   .ops = _plladiv_clk_ops,
+};
-- 
2.16.0.rc1

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


[U-Boot] [PATCH 3/3] clk: at91: clk-system: add set/get_rate operations

2018-02-08 Thread Wenyou Yang
To support set/get the clock rate, add set/get_rate operations.

Signed-off-by: Wenyou Yang 
---

 drivers/clk/at91/clk-system.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
index 24b271aa18..81fe47a9d7 100644
--- a/drivers/clk/at91/clk-system.c
+++ b/drivers/clk/at91/clk-system.c
@@ -44,6 +44,30 @@ static inline int is_pck(int id)
return (id >= 8) && (id <= 15);
 }
 
+static ulong system_clk_get_rate(struct clk *clk)
+{
+   struct clk clk_dev;
+   int ret;
+
+   ret = clk_get_by_index(clk->dev, 0, _dev);
+   if (ret)
+   return -EINVAL;
+
+   return clk_get_rate(_dev);
+}
+
+static ulong system_clk_set_rate(struct clk *clk, ulong rate)
+{
+   struct clk clk_dev;
+   int ret;
+
+   ret = clk_get_by_index(clk->dev, 0, _dev);
+   if (ret)
+   return -EINVAL;
+
+   return clk_set_rate(_dev, rate);
+}
+
 static int system_clk_enable(struct clk *clk)
 {
struct pmc_platdata *plat = dev_get_platdata(clk->dev);
@@ -73,6 +97,8 @@ static int system_clk_enable(struct clk *clk)
 
 static struct clk_ops system_clk_ops = {
.of_xlate = at91_clk_of_xlate,
+   .get_rate = system_clk_get_rate,
+   .set_rate = system_clk_set_rate,
.enable = system_clk_enable,
 };
 
-- 
2.16.0.rc1

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


[U-Boot] [PATCH 1/3] clk: at91: add USB Host clock driver

2018-02-08 Thread Wenyou Yang
Add USB clock driver to configure the input clock and the divider
in the PMC_USB register to generate a 48MHz and a 12MHz signal to
the USB Host OHCI.

Signed-off-by: Wenyou Yang 
---

 arch/arm/mach-at91/include/mach/at91_pmc.h |   6 ++
 drivers/clk/at91/Kconfig   |   8 ++
 drivers/clk/at91/Makefile  |   1 +
 drivers/clk/at91/clk-usb.c | 146 +
 4 files changed, 161 insertions(+)
 create mode 100644 drivers/clk/at91/clk-usb.c

diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h 
b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 08ad1bf2d0..fbda8d5f63 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -233,9 +233,15 @@ typedef struct at91_pmc {
 #defineAT91_PMC_PDIV_1 (0 << 12)
 #defineAT91_PMC_PDIV_2 (1 << 12)
 
+#define AT91_PMC_USB_USBS_MASK 0x1
+#define AT91_PMC_USB_USBS_OFFSET   0
+#define AT91_PMC_USB_USBS_(x)  (x & 0x1)
 #defineAT91_PMC_USBS_USB_PLLA  (0x0)   /* USB 
Clock Input is PLLA */
 #defineAT91_PMC_USBS_USB_UPLL  (0x1)   /* USB 
Clock Input is UPLL */
 #defineAT91_PMC_USBS_USB_PLLB  (0x1)   /* USB 
Clock Input is PLLB, AT91SAM9N12 only */
+#define AT91_PMC_USB_DIV_MASK  0xf
+#define AT91_PMC_USB_DIV_OFFSET8
+#define AT91_PMC_USB_DIV_(x)   ((x & 0xf) << 8)
 #defineAT91_PMC_USB_DIV_2  (0x1 <<  8) /* USB 
Clock divided by 2 */
 #defineAT91_PMC_USBDIV_8   (0x7 <<  8) /* USB 
Clock divided by 8 */
 #defineAT91_PMC_USBDIV_10  (0x9 <<  8) /* USB 
Clock divided by 10 */
diff --git a/drivers/clk/at91/Kconfig b/drivers/clk/at91/Kconfig
index fd56f200b9..8d482a2752 100644
--- a/drivers/clk/at91/Kconfig
+++ b/drivers/clk/at91/Kconfig
@@ -27,6 +27,14 @@ config AT91_UTMI
  fast crystal oscillator to meet the frequency accuracy
  required by USB.
 
+config AT91_USB_CLK
+   bool "Support USB OHCI Input Clock"
+   depends on CLK_AT91
+   help
+ This option is used to enable the USB Input Clock, from
+ the device tree, configure the USBS bit (PLLA or UTMI PLL)
+ and USBDIV field of the PMC_USB register.
+
 config AT91_H32MX
bool "Support H32MX 32-bit Matrix Clock"
depends on CLK_AT91
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index fbe3cb6581..8cac3f9e18 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -7,5 +7,6 @@ obj-y += clk-slow.o clk-main.o clk-plla.o clk-master.o
 obj-y += clk-system.o clk-peripheral.o
 
 obj-$(CONFIG_AT91_UTMI)+= clk-utmi.o
+obj-$(CONFIG_AT91_USB_CLK) += clk-usb.o
 obj-$(CONFIG_AT91_H32MX)   += clk-h32mx.o
 obj-$(CONFIG_AT91_GENERIC_CLK) += clk-generated.o
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
new file mode 100644
index 00..36622c09dc
--- /dev/null
+++ b/drivers/clk/at91/clk-usb.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2018 Microhip / Atmel Corporation
+ *   Wenyou.Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "pmc.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define AT91_USB_CLK_SOURCE_MAX2
+#define AT91_USB_CLK_MAX_DIV   15
+
+struct at91_usb_clk_priv {
+   u32 num_clksource;
+};
+
+static ulong at91_usb_clk_get_rate(struct clk *clk)
+{
+   struct pmc_platdata *plat = dev_get_platdata(clk->dev);
+   struct at91_pmc *pmc = plat->reg_base;
+   struct clk source;
+   u32 tmp, usbdiv;
+   u8 source_index;
+   int ret;
+
+   tmp = readl(>pcr);
+   source_index = (tmp >> AT91_PMC_USB_USBS_OFFSET) &
+   AT91_PMC_USB_USBS_MASK;
+   usbdiv = (tmp >> AT91_PMC_USB_DIV_OFFSET) & AT91_PMC_USB_DIV_MASK;
+
+   ret = clk_get_by_index(clk->dev, source_index, );
+   if (ret)
+   return 0;
+
+   return clk_get_rate() / (usbdiv + 1);
+}
+
+static ulong at91_usb_clk_set_rate(struct clk *clk, ulong rate)
+{
+   struct pmc_platdata *plat = dev_get_platdata(clk->dev);
+   struct at91_pmc *pmc = plat->reg_base;
+   struct at91_usb_clk_priv *priv = dev_get_priv(clk->dev);
+   struct clk source, best_source;
+   ulong tmp_rate, best_rate = rate, source_rate;
+   int tmp_diff, best_diff = -1;
+   u32 div, best_div = 0;
+   u8 best_source_index = 0;
+   u8 i;
+   u32 tmp;
+   int ret;
+
+   for (i = 0; i < priv->num_clksource; i++) {
+   ret = clk_get_by_index(clk->dev, i, );
+   if (ret)
+   return ret;
+
+   source_rate = clk_get_rate();
+

[U-Boot] [PATCH 0/3] clk: at91: add usb and plladiv drivers

2018-02-08 Thread Wenyou Yang
In order to provide the clocks UHP48MHz and UHP12MHz to the USB
Host OHCI, add the USB clock and PLLADIV clock driver.


Wenyou Yang (3):
  clk: at91: add USB Host clock driver
  clk: at91: add PLLADIV driver
  clk: at91: clk-system: add set/get_rate operations

 arch/arm/mach-at91/include/mach/at91_pmc.h |   6 ++
 drivers/clk/at91/Kconfig   |   8 ++
 drivers/clk/at91/Makefile  |   3 +-
 drivers/clk/at91/clk-plladiv.c |  88 +
 drivers/clk/at91/clk-system.c  |  26 +
 drivers/clk/at91/clk-usb.c | 146 +
 6 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/at91/clk-plladiv.c
 create mode 100644 drivers/clk/at91/clk-usb.c

-- 
2.16.0.rc1

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


[U-Boot] [PATCH v2 2/2] pinctrl-uclass: convert to use live dt

2018-02-08 Thread Kever Yang
Use live dt interface for pinctrl_select_state_full()

Signed-off-by: Kever Yang 
---

Changes in v2: None

 drivers/pinctrl/pinctrl-uclass.c | 20 +---
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 114952a..5abfeba 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -5,13 +5,13 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -63,16 +63,13 @@ static int pinctrl_config_one(struct udevice *config)
  */
 static int pinctrl_select_state_full(struct udevice *dev, const char 
*statename)
 {
-   const void *fdt = gd->fdt_blob;
-   int node = dev_of_offset(dev);
char propname[32]; /* long enough */
const fdt32_t *list;
uint32_t phandle;
-   int config_node;
struct udevice *config;
int state, size, i, ret;
 
-   state = fdt_stringlist_search(fdt, node, "pinctrl-names", statename);
+   state = dev_read_stringlist_search(dev, "pinctrl-names", statename);
if (state < 0) {
char *end;
/*
@@ -85,22 +82,15 @@ static int pinctrl_select_state_full(struct udevice *dev, 
const char *statename)
}
 
snprintf(propname, sizeof(propname), "pinctrl-%d", state);
-   list = fdt_getprop(fdt, node, propname, );
+   list = dev_read_prop(dev, propname, );
if (!list)
return -EINVAL;
 
size /= sizeof(*list);
for (i = 0; i < size; i++) {
phandle = fdt32_to_cpu(*list++);
-
-   config_node = fdt_node_offset_by_phandle(fdt, phandle);
-   if (config_node < 0) {
-   dev_err(dev, "prop %s index %d invalid phandle\n",
-   propname, i);
-   return -EINVAL;
-   }
-   ret = uclass_get_device_by_of_offset(UCLASS_PINCONFIG,
-config_node, );
+   ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
+ );
if (ret)
return ret;
 
-- 
1.9.1

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


[U-Boot] [PATCH v2 1/2] core: add uclass_get_device_by_phandle_id() api

2018-02-08 Thread Kever Yang
Add api for who can not get phandle from a device property.

Signed-off-by: Kever Yang 
---

Changes in v2:
- use uint instead of int for phandle
- address comment from Philipp

 drivers/core/uclass.c | 26 ++
 include/dm/uclass.h   | 16 
 2 files changed, 42 insertions(+)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index f5e4067..274b833 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -443,6 +443,32 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode 
node,
 }
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
+int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id,
+   struct udevice **devp)
+{
+   struct udevice *dev;
+   struct uclass *uc;
+   int ret;
+
+   *devp = NULL;
+   ret = uclass_get(id, );
+   if (ret)
+   return ret;
+
+   list_for_each_entry(dev, >dev_head, uclass_node) {
+   uint phandle;
+
+   phandle = dev_read_phandle(dev);
+
+   if (phandle == phandle_id) {
+   *devp = dev;
+   return uclass_get_device_tail(dev, ret, devp);
+   }
+   }
+
+   return -ENODEV;
+}
+
 int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
 const char *name, struct udevice **devp)
 {
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 1818849..63cb6e9 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -203,6 +203,22 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode 
node,
struct udevice **devp);
 
 /**
+ * uclass_get_device_by_phandle_id() - Get a uclass device by phandle id
+ *
+ * This searches the devices in the uclass for one with the given phandle id.
+ *
+ * The device is probed to activate it ready for use.
+ *
+ * @id: uclass ID to look up
+ * @phandle_id: the phandle id to look up
+ * @devp: Returns pointer to device (there is only one for each node)
+ * @return 0 if OK, -ENODEV if there is no device match the phandle, other
+ * -ve on error
+ */
+int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id,
+   struct udevice **devp);
+
+/**
  * uclass_get_device_by_phandle() - Get a uclass device by phandle
  *
  * This searches the devices in the uclass for one with the given phandle.
-- 
1.9.1

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


Re: [U-Boot] Move most CONFIG_HAVE_BLOCK_DEVICE to Kconfig

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 12:43:56PM -0600, Adam Ford wrote:

> config_fallbacks.h has some logic that sets HAVE_BLOCK_DEVICE
> based on a list of enabled options.  Moving HAVE_BLOCK_DEIVCE to
> Kconfig allows us to drastically shrink the logic in
> config_fallbacks.h
> 
> Signed-off-by: Adam Ford 

Note that this needed a bit of work.  HAVE_BLOCK_DEVICE needed to be
turned into CONFIG_HAVE_BLOCK_DEVICE and then the patch made to ensure
we only select HAVE_BLOCK_DEVICE, not CONFIG_HAVE_BLOCK_DEVICE.  With
all of that, applied to u-boot/master, thanks!

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


Re: [U-Boot] Convert LIB_UUID to Kconfig

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 12:14:28PM -0600, Adam Ford wrote:

> config_fallback.h has some logic that checks a variety of options
> and selects LIB_UUID if it hasn't already been selected.  This
> will all LIB_UUID in Kconfig and select this option for the list
> of options to allow us to remove the logic from fallbacks
> 
> Signed-off-by: Adam Ford 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [PATCH] block: Migrate SystemACE chip to Kconfig

2018-02-08 Thread Tom Rini
On Thu, Feb 08, 2018 at 01:51:54PM -0500, Tom Rini wrote:

> Migrate the base and sub-options to Kconfig.  Note that we only enable
> this in the base sandbox config now.
> 
> Cc: Alexey Brodkin 
> Cc: Michal Simek 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

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


[U-Boot] [PATCH] pwm-backlight: make power-supply as option

2018-02-08 Thread Kever Yang
Some pwm backlight may not need 'power-supply', let's make it as option
in pwm-backlight driver.

Signed-off-by: Kever Yang 
---

 drivers/video/pwm_backlight.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index fbd7bf7..f40e57b 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -32,16 +32,18 @@ static int pwm_backlight_enable(struct udevice *dev)
uint duty_cycle;
int ret;
 
-   plat = dev_get_uclass_platdata(priv->reg);
-   debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__, dev->name,
- priv->reg->name, plat->name);
-   ret = regulator_set_enable(priv->reg, true);
-   if (ret) {
-   debug("%s: Cannot enable regulator for PWM '%s'\n", __func__,
- dev->name);
-   return ret;
+   if (priv->reg) {
+   plat = dev_get_uclass_platdata(priv->reg);
+   debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__,
+ dev->name, priv->reg->name, plat->name);
+   ret = regulator_set_enable(priv->reg, true);
+   if (ret) {
+   debug("%s: Cannot enable regulator for PWM '%s'\n",
+ __func__, dev->name);
+   return ret;
+   }
+   mdelay(120);
}
-   mdelay(120);
 
duty_cycle = priv->period_ns * (priv->default_level - priv->min_level) /
(priv->max_level - priv->min_level + 1);
@@ -68,10 +70,8 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice 
*dev)
debug("%s: start\n", __func__);
ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
   "power-supply", >reg);
-   if (ret) {
+   if (ret)
debug("%s: Cannot get power supply: ret=%d\n", __func__, ret);
-   return ret;
-   }
ret = gpio_request_by_name(dev, "enable-gpios", 0, >enable,
   GPIOD_IS_OUT);
if (ret) {
-- 
1.9.1

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


Re: [U-Boot] TCP & Overrrun

2018-02-08 Thread Duncan Hare
On Thu, 8 Feb 2018 22:15:44 + (UTC)
Duncan Hare  wrote:

>  Duncan Hare
> 
> 714 931 7952
> 
>  
> - Forwarded Message -
>  From: Joe Hershberger 
>  To: Duncan Hare  
> Cc: u-boot ; Joe Hershberger
>  Sent: Thursday, February 8, 2018 11:40 AM
>  Subject: Re: [U-Boot] TCP & Overrrun
>
> Hi Duncan,
> 
> On Wed, Feb 7, 2018 at 8:40 PM, Duncan Hare  wrote:
> > I'm gettin overrun on the raspberry pi.
> >
> > Which ethernet drived does it use?
> 
> You didn't specify which one you are talking about, but here's how to
> find out...
> 
> Assuming rpi3, find the config first...
> 
> configs/rpi_3_defconfig says:
> CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
> arch/arm/dts/bcm2837-rpi-3-b.dts says: #include
> "bcm283x-rpi-smsc9514.dtsi" arch/arm/dts/bcm283x-rpi-smsc9514.dtsi
> says:                ethernet: usbether@1 {
> compatible = "usb424,ec00"; grep -rn ec00 drivers/ says:
> drivers/usb/eth/smsc95xx.c
> 
> Cheers,
> -Joe
> 
> > I need to determine if it
> > uses CONFIG_SYS_RX_ETH_BUFFER" from net.h and the "net_rx_packets"
> > buffer pool defined in net/net.c
> >
> > grep suggests it is not using net_rx_packets.
> >
> > Thanks
> >
> > Duncan Hare
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
___
Joe

Two solutions:

Option 1.

drivers/usb/eth/smsc95xx.c pulls packet in from the device, single rx buffer, 
and runs the packet
rx code in net.c. Assumption is packets are polled for, thus single
rx buffer is acceptable.

net_rx_packets exists, and can be use, if looking for rx packet call
is called frequently though system. 

This would work for all existing drivers.

net.c fills net_rx_packets and calls a routine to process packets, and
and the tcp system system polls via smsc95xx_recv through the interface
structure at places in the code to process fill net_rx_packets as a
packet queue.

A TCP window limits the number of packets in process. 

Option 2.

The driver is changed to set an interrupt and the interrupt
preempts the packet processing, as interrupts do.

But, this requires driver changes to use TCP.

And good hardware documentation. 

   

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


[U-Boot] [PATCH v2 3/7] net: sun8i-emac: add support for new EMAC DT binding

2018-02-08 Thread Andre Przywara
The Ethernet MAC used in newer Allwinner SoCs (H3, A64, H5) got an
upstream Linux driver in v4.15.
This one uses a slightly different binding from the original one used
by the U-Boot driver.
The differences to the old binding are:
- The "syscon" address is held in a separate node, referenced via a
  phandle in the "syscon" property.
- The reference to the PHY is held in a property called "phy-handle",
  not "phy".
- The PHY register is at offset 0x30 in the syscon device, not at 0.
- The internal PHY is activated when the node, which phy-handle points
  to, is a child node of an "allwinner,sun8i-h3-mdio-internal" node.

Teach the U-Boot driver how to find its resources in a "new-style" DT,
so that we can use a Linux kernel compatible DT for U-Boot as well.
This keeps support for the old binding for now, to allow a smooth
transition.

Signed-off-by: Andre Przywara 
---
 drivers/net/sun8i_emac.c | 55 ++--
 1 file changed, 48 insertions(+), 7 deletions(-)

diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index df2b857310..4ba8959239 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -279,7 +279,7 @@ static int sun8i_emac_set_syscon(struct emac_eth_dev *priv)
int ret;
u32 reg;
 
-   reg = readl(priv->sysctl_reg);
+   reg = readl(priv->sysctl_reg + 0x30);
 
if (priv->variant == H3_EMAC) {
ret = sun8i_emac_set_syscon_ephy(priv, );
@@ -310,7 +310,7 @@ static int sun8i_emac_set_syscon(struct emac_eth_dev *priv)
return -EINVAL;
}
 
-   writel(reg, priv->sysctl_reg);
+   writel(reg, priv->sysctl_reg + 0x30);
 
return 0;
 }
@@ -806,17 +806,50 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct 
udevice *dev)
 #endif
 
pdata->iobase = devfdt_get_addr_name(dev, "emac");
+   if (pdata->iobase == FDT_ADDR_T_NONE)
+   pdata->iobase = devfdt_get_addr(dev);
+   if (pdata->iobase == FDT_ADDR_T_NONE) {
+   debug("%s: Cannot find MAC base address\n", __func__);
+   return -EINVAL;
+   }
+
priv->sysctl_reg = devfdt_get_addr_name(dev, "syscon");
+   if (priv->sysctl_reg == FDT_ADDR_T_NONE) {
+   const fdt32_t *reg;
+
+   offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "syscon");
+   if (offset < 0) {
+   debug("%s: cannot find syscon node\n", __func__);
+   return -EINVAL;
+   }
+   reg = fdt_getprop(gd->fdt_blob, offset, "reg", NULL);
+   if (!reg) {
+   debug("%s: cannot find reg property in syscon node\n",
+ __func__);
+   return -EINVAL;
+   }
+   priv->sysctl_reg = fdt_translate_address((void *)gd->fdt_blob,
+offset, reg);
+   } else
+   priv->sysctl_reg -= 0x30;
+   if (priv->sysctl_reg == FDT_ADDR_T_NONE) {
+   debug("%s: Cannot find syscon base address\n", __func__);
+   return -EINVAL;
+   }
 
pdata->phy_interface = -1;
priv->phyaddr = -1;
priv->use_internal_phy = false;
 
-   offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
-  "phy");
-   if (offset > 0)
-   priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg",
-  -1);
+   offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "phy");
+   if (offset < 0)
+   offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
+  "phy-handle");
+   if (offset < 0) {
+   debug("%s: Cannot find PHY address\n", __func__);
+   return -EINVAL;
+   }
+   priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
 
phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
 
@@ -841,6 +874,14 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct 
udevice *dev)
if (fdt_getprop(gd->fdt_blob, node,
"allwinner,use-internal-phy", NULL))
priv->use_internal_phy = true;
+   else {
+   int parent = fdt_parent_offset(gd->fdt_blob, offset);
+
+   if (parent >= 0 &&
+   !fdt_node_check_compatible(gd->fdt_blob, parent,
+   "allwinner,sun8i-h3-mdio-internal"))
+   priv->use_internal_phy = true;
+   }
}
 
priv->interface = pdata->phy_interface;
-- 
2.14.1

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


[U-Boot] [PATCH v2 6/7] arm: dts: sunxi: update H5 to new EMAC binding

2018-02-08 Thread Andre Przywara
The U-Boot driver for the sun8i-emac was using some preliminary DT
binding. Now since Linux got its own driver in v4.15 and our driver
can now cope with both bindings, let's convert the DT nodes used by the
OrangePi PC2 over to the new bindings used by the kernel.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/sun50i-h5-orangepi-pc2.dts 
b/arch/arm/dts/sun50i-h5-orangepi-pc2.dts
index 780d59a096..d1c347d2b8 100644
--- a/arch/arm/dts/sun50i-h5-orangepi-pc2.dts
+++ b/arch/arm/dts/sun50i-h5-orangepi-pc2.dts
@@ -108,10 +108,13 @@
pinctrl-names = "default";
pinctrl-0 = <_rgmii_pins>;
phy-mode = "rgmii";
-   phy = <>;
+   phy-handle = <_rgmii_phy>;
status = "okay";
+};
 
-   phy1: ethernet-phy@1 {
+_mdio {
+   ext_rgmii_phy: ethernet-phy@1 {
+   compatible = "ethernet-phy-ieee802.3-c22";
reg = <1>;
};
 };
-- 
2.14.1

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


[U-Boot] [PATCH v2 5/7] arm: dts: sunxi: update H3 to new EMAC binding

2018-02-08 Thread Andre Przywara
The U-Boot driver for the sun8i-emac was using some preliminary DT
binding. Now since Linux got its own driver in v4.15 and our driver
can now cope with both bindings, let's convert the DT nodes used by the
various H3 boards over to the new bindings used by the kernel.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts  |  6 +--
 arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts |  7 +--
 arch/arm/dts/sun8i-h3-nanopi-neo.dts  |  6 +--
 arch/arm/dts/sun8i-h3-orangepi-2.dts  |  7 +--
 arch/arm/dts/sun8i-h3-orangepi-one.dts|  7 +--
 arch/arm/dts/sun8i-h3-orangepi-pc.dts |  7 +--
 arch/arm/dts/sun8i-h3-orangepi-plus.dts   |  8 +++-
 arch/arm/dts/sun8i-h3-orangepi-plus2e.dts |  9 +++-
 arch/arm/dts/sun8i-h3.dtsi| 69 ---
 9 files changed, 75 insertions(+), 51 deletions(-)

diff --git a/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts 
b/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts
index 20d489cb2a..e0efcb3ba3 100644
--- a/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts
+++ b/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts
@@ -100,14 +100,10 @@
 };
 
  {
-   phy = <>;
+   phy-handle = <_mii_phy>;
phy-mode = "mii";
-   allwinner,use-internal-phy;
allwinner,leds-active-low;
status = "okay";
-   phy1: ethernet-phy@1 {
-   reg = <1>;
-   };
 };
 
  {
diff --git a/arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts 
b/arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts
index 97b993f636..c8fd69f0a4 100644
--- a/arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts
+++ b/arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts
@@ -125,15 +125,10 @@
 };
 
  {
-   phy = <>;
+   phy-handle = <_mii_phy>;
phy-mode = "mii";
-   allwinner,use-internal-phy;
allwinner,leds-active-low;
status = "okay";
-
-   phy1: ethernet-phy@1 {
-   reg = <1>;
-   };
 };
 
  {
diff --git a/arch/arm/dts/sun8i-h3-nanopi-neo.dts 
b/arch/arm/dts/sun8i-h3-nanopi-neo.dts
index 5113059098..78f6c24952 100644
--- a/arch/arm/dts/sun8i-h3-nanopi-neo.dts
+++ b/arch/arm/dts/sun8i-h3-nanopi-neo.dts
@@ -48,12 +48,8 @@
 };
 
  {
-   phy = <>;
+   phy-handle = <_mii_phy>;
phy-mode = "mii";
-   allwinner,use-internal-phy;
allwinner,leds-active-low;
status = "okay";
-   phy1: ethernet-phy@1 {
-   reg = <1>;
-   };
 };
diff --git a/arch/arm/dts/sun8i-h3-orangepi-2.dts 
b/arch/arm/dts/sun8i-h3-orangepi-2.dts
index caa1a6959c..d97fdacb35 100644
--- a/arch/arm/dts/sun8i-h3-orangepi-2.dts
+++ b/arch/arm/dts/sun8i-h3-orangepi-2.dts
@@ -55,6 +55,7 @@
aliases {
serial0 = 
/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
+   ethernet0 = 
ethernet1 = 
};
 
@@ -110,14 +111,10 @@
 };
 
  {
-   phy = <>;
+   phy-handle = <_mii_phy>;
phy-mode = "mii";
-   allwinner,use-internal-phy;
allwinner,leds-active-low;
status = "okay";
-   phy1: ethernet-phy@1 {
-   reg = <1>;
-   };
 };
 
  {
diff --git a/arch/arm/dts/sun8i-h3-orangepi-one.dts 
b/arch/arm/dts/sun8i-h3-orangepi-one.dts
index 8df5c74f04..adab1cbfc9 100644
--- a/arch/arm/dts/sun8i-h3-orangepi-one.dts
+++ b/arch/arm/dts/sun8i-h3-orangepi-one.dts
@@ -53,6 +53,7 @@
compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3";
 
aliases {
+   ethernet0 = 
serial0 = 
};
 
@@ -95,14 +96,10 @@
 };
 
  {
-   phy = <>;
+   phy-handle = <_mii_phy>;
phy-mode = "mii";
-   allwinner,use-internal-phy;
allwinner,leds-active-low;
status = "okay";
-   phy1: ethernet-phy@1 {
-   reg = <1>;
-   };
 };
 
  {
diff --git a/arch/arm/dts/sun8i-h3-orangepi-pc.dts 
b/arch/arm/dts/sun8i-h3-orangepi-pc.dts
index b8340f74e7..afba264ea5 100644
--- a/arch/arm/dts/sun8i-h3-orangepi-pc.dts
+++ b/arch/arm/dts/sun8i-h3-orangepi-pc.dts
@@ -53,6 +53,7 @@
compatible = "xunlong,orangepi-pc", "allwinner,sun8i-h3";
 
aliases {
+   ethernet0 = 
serial0 = 
};
 
@@ -167,12 +168,8 @@
 };
 
  {
-   phy = <>;
+   phy-handle = <_mii_phy>;
phy-mode = "mii";
-   allwinner,use-internal-phy;
allwinner,leds-active-low;
status = "okay";
-   phy1: ethernet-phy@1 {
-   reg = <1>;
-   };
 };
diff --git a/arch/arm/dts/sun8i-h3-orangepi-plus.dts 
b/arch/arm/dts/sun8i-h3-orangepi-plus.dts
index e7079b26bc..136e4414a4 100644
--- a/arch/arm/dts/sun8i-h3-orangepi-plus.dts
+++ b/arch/arm/dts/sun8i-h3-orangepi-plus.dts
@@ -82,7 +82,13 @@
pinctrl-0 = <_rgmii_pins>;
phy-supply = <_gmac_3v3>;
phy-mode = "rgmii";
-   /delete-property/allwinner,use-internal-phy;
+};
+
+_mdio {
+   ext_rgmii_phy: ethernet-phy@1 {
+   compatible = 

[U-Boot] [PATCH v2 7/7] net: sun8i-emac: remove support for old binding

2018-02-08 Thread Andre Przywara
The original DT binding used by U-Boot's sun8i-emac driver was not really
agreed upon, and deviated from the "official" binding now used by the
kernel. Since now all U-Boot users have been converted to the new
binding, we can remove support for the old DT nodes from the driver.

Signed-off-by: Andre Przywara 
---
 drivers/net/sun8i_emac.c | 78 
 1 file changed, 26 insertions(+), 52 deletions(-)

diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index 4ba8959239..fd13b6bf95 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -456,7 +456,7 @@ static int parse_phy_pins(struct udevice *dev)
 {
int offset;
const char *pin_name;
-   int drive, pull, i;
+   int drive, pull = SUN4I_PINCTRL_NO_PULL, i;
 
offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
   "pinctrl-0");
@@ -476,31 +476,20 @@ static int parse_phy_pins(struct udevice *dev)
drive = SUN4I_PINCTRL_30_MA;
else
drive = SUN4I_PINCTRL_40_MA;
-   } else {
-   drive = fdt_getprop_u32_default_node(gd->fdt_blob, offset, 0,
-"allwinner,drive", 4);
}
 
if (fdt_get_property(gd->fdt_blob, offset, "bias-pull-up", NULL))
pull = SUN4I_PINCTRL_PULL_UP;
-   else if (fdt_get_property(gd->fdt_blob, offset, "bias-disable", NULL))
-   pull = SUN4I_PINCTRL_NO_PULL;
else if (fdt_get_property(gd->fdt_blob, offset, "bias-pull-down", NULL))
pull = SUN4I_PINCTRL_PULL_DOWN;
-   else
-   pull = fdt_getprop_u32_default_node(gd->fdt_blob, offset, 0,
-   "allwinner,pull", 0);
+
for (i = 0; ; i++) {
int pin;
 
pin_name = fdt_stringlist_get(gd->fdt_blob, offset,
- "allwinner,pins", i, NULL);
-   if (!pin_name) {
-   pin_name = fdt_stringlist_get(gd->fdt_blob, offset,
- "pins", i, NULL);
-   if (!pin_name)
-   break;
-   }
+ "pins", i, NULL);
+   if (!pin_name)
+   break;
 
pin = sunxi_name_to_gpio(pin_name);
if (pin < 0)
@@ -798,6 +787,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice 
*dev)
struct eth_pdata *pdata = _pdata->eth_pdata;
struct emac_eth_dev *priv = dev_get_priv(dev);
const char *phy_mode;
+   const fdt32_t *reg;
int node = dev_of_offset(dev);
int offset = 0;
 #ifdef CONFIG_DM_GPIO
@@ -805,33 +795,25 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct 
udevice *dev)
int ret = 0;
 #endif
 
-   pdata->iobase = devfdt_get_addr_name(dev, "emac");
-   if (pdata->iobase == FDT_ADDR_T_NONE)
-   pdata->iobase = devfdt_get_addr(dev);
+   pdata->iobase = devfdt_get_addr(dev);
if (pdata->iobase == FDT_ADDR_T_NONE) {
debug("%s: Cannot find MAC base address\n", __func__);
return -EINVAL;
}
 
-   priv->sysctl_reg = devfdt_get_addr_name(dev, "syscon");
-   if (priv->sysctl_reg == FDT_ADDR_T_NONE) {
-   const fdt32_t *reg;
-
-   offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "syscon");
-   if (offset < 0) {
-   debug("%s: cannot find syscon node\n", __func__);
-   return -EINVAL;
-   }
-   reg = fdt_getprop(gd->fdt_blob, offset, "reg", NULL);
-   if (!reg) {
-   debug("%s: cannot find reg property in syscon node\n",
- __func__);
-   return -EINVAL;
-   }
-   priv->sysctl_reg = fdt_translate_address((void *)gd->fdt_blob,
-offset, reg);
-   } else
-   priv->sysctl_reg -= 0x30;
+   offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "syscon");
+   if (offset < 0) {
+   debug("%s: cannot find syscon node\n", __func__);
+   return -EINVAL;
+   }
+   reg = fdt_getprop(gd->fdt_blob, offset, "reg", NULL);
+   if (!reg) {
+   debug("%s: cannot find reg property in syscon node\n",
+ __func__);
+   return -EINVAL;
+   }
+   priv->sysctl_reg = fdt_translate_address((void *)gd->fdt_blob,
+offset, reg);
if (priv->sysctl_reg == FDT_ADDR_T_NONE) {
debug("%s: Cannot find syscon base address\n", __func__);
return -EINVAL;
@@ 

[U-Boot] [PATCH v2 4/7] arm: dts: sunxi: update A64 to new EMAC binding

2018-02-08 Thread Andre Przywara
The U-Boot driver for the sun8i-emac was using some preliminary DT
binding. Now since Linux got its own driver in v4.15 and our driver
can now cope with both bindings, let's convert the DT nodes used for the
Pine64+ board over to the new bindings used by the kernel.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 51 +++--
 1 file changed, 30 insertions(+), 21 deletions(-)

diff --git a/arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi 
b/arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
index 9c61beac01..32a263ce3d 100644
--- a/arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
+++ b/arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
@@ -4,25 +4,38 @@
};
 
soc {
-   emac: ethernet@01c3 {
+   syscon: syscon@1c0 {
+   compatible = "allwinner,sun50i-a64-system-controller",
+"syscon";
+   reg = <0x01c0 0x1000>;
+   };
+
+   emac: ethernet@1c3 {
compatible = "allwinner,sun50i-a64-emac";
-   reg = <0x01c3 0x2000>, <0x01c00030 0x4>;
-   reg-names = "emac", "syscon";
+   syscon = <>;
+   reg = <0x01c3 0x1>;
interrupts = ;
+   interrupt-names = "macirq";
resets = < RST_BUS_EMAC>;
-   reset-names = "ahb";
+   reset-names = "stmmaceth";
clocks = < CLK_BUS_EMAC>;
-   clock-names = "ahb";
+   clock-names = "stmmaceth";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <_pins>;
phy-mode = "rgmii";
-   phy = <>;
+   phy-handle = <_rgmii_phy>;
status = "okay";
 
-   phy1: ethernet-phy@1 {
-   reg = <1>;
+   mdio: mdio {
+   compatible = "snps,dwmac-mdio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   ext_rgmii_phy: ethernet-phy@1 {
+   compatible = 
"ethernet-phy-ieee802.3-c22";
+   reg = <1>;
+   };
};
};
};
@@ -30,21 +43,17 @@
 
  {
rmii_pins: rmii_pins {
-   allwinner,pins = "PD10", "PD11", "PD13", "PD14",
-"PD17", "PD18", "PD19", "PD20",
-"PD22", "PD23";
-   allwinner,function = "emac";
-   allwinner,drive = <3>;
-   allwinner,pull = <0>;
+   pins = "PD10", "PD11", "PD13", "PD14", "PD17",
+  "PD18", "PD19", "PD20", "PD22", "PD23";
+   function = "emac";
+   drive-strength = <40>;
};
 
rgmii_pins: rgmii_pins {
-   allwinner,pins = "PD8", "PD9", "PD10", "PD11",
-"PD12", "PD13", "PD15",
-"PD16", "PD17", "PD18", "PD19",
-"PD20", "PD21", "PD22", "PD23";
-   allwinner,function = "emac";
-   allwinner,drive = <3>;
-   allwinner,pull = <0>;
+   pins = "PD8", "PD9", "PD10", "PD11", "PD12",
+  "PD13", "PD15", "PD16", "PD17", "PD18",
+  "PD19", "PD20", "PD21", "PD22", "PD23";
+   function = "emac";
+   drive-strength = <40>;
};
 };
-- 
2.14.1

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


[U-Boot] [PATCH v2 1/7] sunxi: gpio: add missing compatible strings

2018-02-08 Thread Andre Przywara
The sunxi GPIO driver is missing some compatible strings for recent
SoCs. While most of the sunxi GPIO code seems to not rely on this (and
so works anyway), the sunxi_name_to_gpio() function does and fails at
the moment (for instance when resolving the MMC CD pin name).
Add the compatible strings for the A64, H5 and V3s, which were missing
from the list. This now covers all pinctrl nodes in our own DTs.

Signed-off-by: Andre Przywara 
---
 drivers/gpio/sunxi_gpio.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index 3cf01b6e36..90fd7c1596 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -354,12 +354,16 @@ static const struct udevice_id sunxi_gpio_ids[] = {
ID("allwinner,sun8i-a83t-pinctrl",  a_all),
ID("allwinner,sun8i-h3-pinctrl",a_all),
ID("allwinner,sun8i-r40-pinctrl",   a_all),
+   ID("allwinner,sun8i-v3s-pinctrl",   a_all),
ID("allwinner,sun9i-a80-pinctrl",   a_all),
+   ID("allwinner,sun50i-a64-pinctrl",  a_all),
+   ID("allwinner,sun50i-h5-pinctrl",   a_all),
ID("allwinner,sun6i-a31-r-pinctrl", l_2),
ID("allwinner,sun8i-a23-r-pinctrl", l_1),
ID("allwinner,sun8i-a83t-r-pinctrl",l_1),
ID("allwinner,sun8i-h3-r-pinctrl",  l_1),
ID("allwinner,sun9i-a80-r-pinctrl", l_3),
+   ID("allwinner,sun50i-a64-r-pinctrl",l_1),
{ }
 };
 
-- 
2.14.1

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


[U-Boot] [PATCH v2 2/7] net: sun8i-emac: support new pinctrl DT bindings

2018-02-08 Thread Andre Przywara
The Linux kernel driver for the Allwinner pin controller gained support
for generic properties, which are now also used in the DTs.
The sun8i-emac Ethernet driver for new Allwinner MACs reads the pins from
the DT, but so far only supported the old binding.
Update the parsing routine to cope with both the old and new bindings,
so that the newer DTs can be used with U-Boot and its Ethernet driver.

Signed-off-by: Andre Przywara 
---
 drivers/net/sun8i_emac.c | 52 
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index 3ccc6b0bb6..df2b857310 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_DM_GPIO
 #include 
 #endif
@@ -465,30 +466,55 @@ static int parse_phy_pins(struct udevice *dev)
}
 
drive = fdt_getprop_u32_default_node(gd->fdt_blob, offset, 0,
-"allwinner,drive", 4);
-   pull = fdt_getprop_u32_default_node(gd->fdt_blob, offset, 0,
-   "allwinner,pull", 0);
+"drive-strength", ~0);
+   if (drive != ~0) {
+   if (drive <= 10)
+   drive = SUN4I_PINCTRL_10_MA;
+   else if (drive <= 20)
+   drive = SUN4I_PINCTRL_20_MA;
+   else if (drive <= 30)
+   drive = SUN4I_PINCTRL_30_MA;
+   else
+   drive = SUN4I_PINCTRL_40_MA;
+   } else {
+   drive = fdt_getprop_u32_default_node(gd->fdt_blob, offset, 0,
+"allwinner,drive", 4);
+   }
+
+   if (fdt_get_property(gd->fdt_blob, offset, "bias-pull-up", NULL))
+   pull = SUN4I_PINCTRL_PULL_UP;
+   else if (fdt_get_property(gd->fdt_blob, offset, "bias-disable", NULL))
+   pull = SUN4I_PINCTRL_NO_PULL;
+   else if (fdt_get_property(gd->fdt_blob, offset, "bias-pull-down", NULL))
+   pull = SUN4I_PINCTRL_PULL_DOWN;
+   else
+   pull = fdt_getprop_u32_default_node(gd->fdt_blob, offset, 0,
+   "allwinner,pull", 0);
for (i = 0; ; i++) {
int pin;
 
pin_name = fdt_stringlist_get(gd->fdt_blob, offset,
  "allwinner,pins", i, NULL);
-   if (!pin_name)
-   break;
-   if (pin_name[0] != 'P')
-   continue;
-   pin = (pin_name[1] - 'A') << 5;
-   if (pin >= 26 << 5)
+   if (!pin_name) {
+   pin_name = fdt_stringlist_get(gd->fdt_blob, offset,
+ "pins", i, NULL);
+   if (!pin_name)
+   break;
+   }
+
+   pin = sunxi_name_to_gpio(pin_name);
+   if (pin < 0)
continue;
-   pin += simple_strtol(_name[2], NULL, 10);
 
sunxi_gpio_set_cfgpin(pin, SUN8I_GPD8_GMAC);
-   sunxi_gpio_set_drv(pin, drive);
-   sunxi_gpio_set_pull(pin, pull);
+   if (drive != ~0)
+   sunxi_gpio_set_drv(pin, drive);
+   if (pull != ~0)
+   sunxi_gpio_set_pull(pin, pull);
}
 
if (!i) {
-   printf("WARNING: emac: cannot find allwinner,pins property\n");
+   printf("WARNING: emac: cannot find pins property\n");
return -2;
}
 
-- 
2.14.1

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


[U-Boot] [PATCH v2 0/7] sunxi: sun8i-emac: Update DT bindings

2018-02-08 Thread Andre Przywara
Compared to the last post, this converts U-Boot's DTs over to use the
new binding, so that the final patch can remove support for the old
binding from U-Boot EMAC driver.
The Linux DTs can be synced in later once we solved the size problem.


The existing sun8i-emac driver in U-Boot uses some preliminary bindings,
which matched our own DTs. Now that the Linux kernel got a driver, lets
update our probe code to handle those Linux DTs as well.
The first patch adds the missing compatible strings for the pinctrl drivers,
which is needed for using the sunxi_name_to_gpio() lookup function.
Patch 2/7 updates the pinctrl parser used in the sun8i-emac driver, to cope
with the new, generic Allwinner pinctrl bindings.
Patch 3/7 extends the probe routine in the Ethernet driver to deal
with both the old and the new bindings.
Patches 4, 5 and 6 update U-Boot's DTs for boards using the A64, H3 and H5
SoC, respectively, to actually use the new binding in their EMAC nodes.
This allows the final patch 7/7 to remove the support for the old binding
in the EMAC driver, so we use the proper binding only.
This series allows to copy in the DTs from the latest kernel. Unfortunately
right now updating the DTs for the H5 and A64 breaks the build, as the
resulting binary (which embeds the DT) gets to large and triggers our new
image size check. As the H5 and H3 share most of the DT, we can't just
update the H3 DTs either.
I have patches syncing all 64-bit Allwinner SoCs to the 4.15 DTs ready
anyway, which even build (by disabling raw MMC environment support).
If people are interested, I can post them as well.

Cheers,
Andre.

Changelog v1 .. v2:
01, 02, 03: unchanged
04, 05, 06, 07: added

Andre Przywara (7):
  sunxi: gpio: add missing compatible strings
  net: sun8i-emac: support new pinctrl DT bindings
  net: sun8i-emac: add support for new EMAC DT binding
  arm: dts: sunxi: update A64 to new EMAC binding
  arm: dts: sunxi: update H3 to new EMAC binding
  arm: dts: sunxi: update H5 to new EMAC binding
  net: sun8i-emac: remove support for old binding

 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 51 --
 arch/arm/dts/sun50i-h5-orangepi-pc2.dts |  7 +-
 arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts|  6 +-
 arch/arm/dts/sun8i-h3-libretech-all-h3-cc.dts   |  7 +-
 arch/arm/dts/sun8i-h3-nanopi-neo.dts|  6 +-
 arch/arm/dts/sun8i-h3-orangepi-2.dts|  7 +-
 arch/arm/dts/sun8i-h3-orangepi-one.dts  |  7 +-
 arch/arm/dts/sun8i-h3-orangepi-pc.dts   |  7 +-
 arch/arm/dts/sun8i-h3-orangepi-plus.dts |  8 ++-
 arch/arm/dts/sun8i-h3-orangepi-plus2e.dts   |  9 ++-
 arch/arm/dts/sun8i-h3.dtsi  | 69 ++-
 drivers/gpio/sunxi_gpio.c   |  4 ++
 drivers/net/sun8i_emac.c| 89 ++---
 13 files changed, 179 insertions(+), 98 deletions(-)

-- 
2.14.1

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


Re: [U-Boot] [PATCH v3 11/18] efi_loader: make efi_disk_create_partitions a global symbol

2018-02-08 Thread Jonathan Gray
On Fri, Jan 19, 2018 at 08:24:47PM +0100, Heinrich Schuchardt wrote:
> Up to now we have been using efi_disk_create_partitions() to create
> partitions for block devices that existed before starting an EFI
> application.
> 
> We need to call it for block devices created by EFI
> applications at run time. The EFI application will define the
> handle for the block device and install a device path protocol
> on it. We have to use this device path as stem for the partition
> device paths.
> 
> Signed-off-by: Heinrich Schuchardt 
> ---
> v3
>   fix typos in comments
> v2
>   no change

breakage on mx6cuboxi with OpenBSD bootarm.efi, bisects to

commit 64e4db0f119151a1345e1da19d152eda550394e7
Author: Heinrich Schuchardt 
AuthorDate: Fri Jan 19 20:24:47 2018 +0100
Commit: Alexander Graf 
CommitDate: Mon Jan 22 23:09:14 2018 +0100

efi_loader: make efi_disk_create_partitions a global symbol

Up to now we have been using efi_disk_create_partitions() to create
partitions for block devices that existed before starting an EFI
application.

We need to call it for block devices created by EFI
applications at run time. The EFI application will define the
handle for the block device and install a device path protocol
on it. We have to use this device path as stem for the partition
device paths.

Signed-off-by: Heinrich Schuchardt 
Signed-off-by: Alexander Graf 

with master as of e24bd1e79e223aa89854c0be95a53e2d538144a5

U-Boot SPL 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:43:18 +1300)
Trying to boot from MMC1


U-Boot 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:43:18 +1300)

CPU:   Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 24C
Reset cause: POR
Board: MX6 Cubox-i
DRAM:  2 GiB
MMC:   FSL_SDHC: 0
Loading Environment from MMC... OK
No panel detected: default to HDMI
Display: HDMI (1024x768)
In:serial
Out:   serial
Err:   serial
Net:   FEC
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
37503 bytes read in 17 ms (2.1 MiB/s)
Found EFI removable media binary efi/boot/bootarm.efi
Scanning disks on usb...
76528 bytes read in 31 ms (2.4 MiB/s)
## Starting EFI application at 1200 ...
BS->LocateHandle() returns -2147483634
undefined instruction
pc : [<8e560348>]  lr : [<8e56444c>]
reloc pc : [<15de4348>]lr : [<15de844c>]
sp : 8f57af10  ip : 8ffc2474 fp : 8f57af1c
r10: b000  r9 : 8f57bee0 r8 : 000b
r7 : 8ffa1a9d  r6 : 8ffa16ad r5 : 8e56f0d0  r4 : 8e56e88a
r3 : 8e56dac8  r2 : 0001 r1 :   r0 : 
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

(undefined instruction is used to reset as efi reset was not
present in earlier U-Boot versions).
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 10/26] mmc: refactor SD startup to make it easier to support new modes

2018-02-08 Thread Jonathan Gray
On Thu, Sep 21, 2017 at 04:29:57PM +0200, Jean-Jacques Hiblot wrote:
> The SDcard startup process currently handles only 2 modes. To make it
> easier to add support for more modes, let's make the process more generic
> and use a list of the modes to try.
> The major functional change is that when a mode fails we try the next one.
> Not all modes are tried, only those supported by the card and the host.
> 
> Signed-off-by: Jean-Jacques Hiblot 
> Reviewed-by: Simon Glass 

This change broke mmc with the vexpress_ca15_tc2 target and
qemu-system-arm -M vexpress-a15.

commit d0c221fe7336fc7d9ada57d96f4a8911a3aac041
Author: Jean-Jacques Hiblot 
AuthorDate: Thu Sep 21 16:29:57 2017 +0200
Commit: Jaehoon Chung 
CommitDate: Fri Jan 12 18:11:04 2018 +0900

mmc: refactor SD startup to make it easier to support new modes

The SDcard startup process currently handles only 2 modes. To make it
easier to add support for more modes, let's make the process more generic
and use a list of the modes to try.
The major functional change is that when a mode fails we try the next one.
Not all modes are tried, only those supported by the card and the host.

Signed-off-by: Jean-Jacques Hiblot 
Reviewed-by: Simon Glass 

with a build from master e24bd1e79e223aa89854c0be95a53e2d538144a5

U-Boot 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:31:54 +1300)

DRAM:  1 GiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC:   MMC: 0
*** Warning - bad CRC, using default environment

In:serial
Out:   serial
Err:   serial
Net:   smc911x-0
Hit any key to stop autoboot:  0
=> load mmc 0:1 ${ramdisk_addr} fdt.dtb
unable to select a mode
mmc_init: -524, time 23
unable to select a mode
mmc_init: -524, time 22
** Bad device mmc 0 **
=> load mmc 0:1 ${loadaddr} efi/boot/bootarm.efi
unable to select a mode
mmc_init: -524, time 21
unable to select a mode
mmc_init: -524, time 21
** Bad device mmc 0 **
=> bootefi ${loadaddr} ${ramdisk_addr}
## Starting EFI application at a0008000 ...
WARNING: using memory device/image path, this may confuse some payloads!
Scanning disks on mmc...
unable to select a mode
mmc_init: -524, time 21
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Found 0 disks
WARNING: Invalid device tree, expect boot to fail
efi_load_pe: Invalid DOS Signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,v3,1/2] bcm283x: Add pinctrl driver

2018-02-08 Thread Jonathan Gray
On Thu, Feb 08, 2018 at 03:44:32PM +0100, Heinrich Schuchardt wrote:
> On 02/08/2018 10:49 AM, Jonathan Gray wrote:
> > On Thu, Feb 08, 2018 at 08:10:47PM +1100, Jonathan Gray wrote:
> >> On Thu, Feb 08, 2018 at 09:11:20AM +0100, Alexander Graf wrote:
> >>>
> >>>
>  Am 08.02.2018 um 06:49 schrieb Jonathan Gray :
> 
>  On Mon, Feb 05, 2018 at 11:31:42AM +0100, Mark Kettenis wrote:
> >> Date: Mon, 5 Feb 2018 21:06:59 +1100
> >> From: Jonathan Gray 
> >>
>  booting sd0a:/bsd: open sd0a:/bsd: Device not configured
>  failed(6). will try /bsd
> >>>
> >>> How do you find out that it's sd0a instead of sd1a?
> >>
> >> The loaded image protocol I believe.
> >
> > Actually the OpenBSD bootloader currently only supports loading the
> > bsd kernel from the same device as the bootloader.  It will always
> > call that device sd0.  It invokes the device path protocol on the
> > loaded image handle and then matches that path to a device that
> > supports the block io protocol.
> 
>  Perhaps the problem is elsewhere as U-Boot master also broke
>  vexpress_ca15_tc2 and mx6cuboxi targets:
> >>>
> >>> Perfect, so can you quickly bisect it now that the bisect doesn???t end 
> >>> at the pinctrl driver?
> >>
> >> On cubox a bisect points to
> >>
> >> commit 64e4db0f119151a1345e1da19d152eda550394e7
> >> Author: Heinrich Schuchardt 
> >> Date:   Fri Jan 19 20:24:47 2018 +0100
> >>
> >> efi_loader: make efi_disk_create_partitions a global symbol
> >> 
> >> Up to now we have been using efi_disk_create_partitions() to create
> >> partitions for block devices that existed before starting an EFI
> >> application.
> >> 
> >> We need to call it for block devices created by EFI
> >> applications at run time. The EFI application will define the
> >> handle for the block device and install a device path protocol
> >> on it. We have to use this device path as stem for the partition
> >> device paths.
> >> 
> >> Signed-off-by: Heinrich Schuchardt 
> >> Signed-off-by: Alexander Graf 
> >>
> >>  include/efi_loader.h  |  4 +++
> >>  lib/efi_loader/efi_disk.c | 84 
> >> +++
> >>  2 files changed, 64 insertions(+), 24 deletions(-)
> >>
> >> If I revert this commit a image built from master works.
> > 
> > Actually master doesn't build with just that reverted, seems I had stale
> > object files.
> 
> When bisecting running
> 'make mrproper && make foo_defconfig && make'
> in each round is recommendable.
> 
> Do you still assume a problem that requires a change in U-Boot?
> Or can we close the topic?
> 
> Best regards
> 
> Heinrich

There are multiple regressions with U-Boot master compared to 2018.01.

sopine_baseboard (pinebook), reported to me I don't have hardware
rpi_3
mx6cuboxi
vexpress_ca15_tc2

While qemu_arm64 works.

Bisecting rpi_3 again, removing obj dir between runs and skipping
commits where nothing shows up on serial again gives the same:

commit caf2233b281c03e3e359061a3dfa537d8a25c273
Author: Alexander Graf 
AuthorDate: Tue Jan 23 18:05:21 2018 +0100
Commit: Tom Rini 
CommitDate: Sun Jan 28 12:27:32 2018 -0500

bcm283x: Add pinctrl driver

The bcm283x family of SoCs have a GPIO controller that also acts as
pinctrl controller.

This patch introduces a new pinctrl driver that can actually properly mux
devices into their device tree defined pin states and is now the primary
owner of the gpio device. The previous GPIO driver gets moved into a
subdevice of the pinctrl driver, bound to the same OF node.

That way whenever a device asks for pinctrl support, it gets it
automatically from the pinctrl driver and GPIO support is still available
in the normal command line phase.

Signed-off-by: Alexander Graf 

with master as of e24bd1e79e223aa89854c0be95a53e2d538144a5

U-Boot 2018.03-rc1-00185-g1e19c70639 (Feb 09 2018 - 11:36:18 +1300)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, sdhci@7e30: 1
Loading Environment from FAT... OK
In:serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   Core Release: 2.80a
scanning bus 0 for devices... 4 USB Device(s) found
   scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  0

Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra
Type: Removable Hard Disk
Capacity: 29327.3 MB = 28.6 GB (60062500 x 512)
... is now current device
Scanning usb 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
82748 bytes read in 89 ms (907.2 KiB/s)
## Starting EFI application at 0100 ...
Scanning disk m...@7e202000.blk...
Card did not respond to voltage select!
mmc_init: -95, time 

Re: [U-Boot] [PATCH 2/5] arch-stm32: Move gpio.h for STM32 SoCs in include/asm/

2018-02-08 Thread Vikas Manocha
Hi Patrice,

On 02/08/2018 05:35 AM, Patrice CHOTARD wrote:
> Hi Vikas
> 
> On 02/07/2018 08:28 PM, Vikas Manocha wrote:
>> Hi Patrice,
>>
>> On 02/07/2018 07:50 AM, patrice.chot...@st.com wrote:
>>> From: Patrice Chotard 
>>>
>>> Instead to have 3 identical gpio.h for all STM32 SoCs,
>>> migrate them in one file in include/asm.
>>
>> good move to consolidate these headers.
>> One comment below.
>>
>>>
>>> Signed-off-by: Patrice Chotard 
> 
> [...]
> 
>>> -static inline unsigned stm32_gpio_to_pin(unsigned gpio)
>>> -{
>>> -   return gpio % 16;
>>> -}
>>> +#include 
>>
>> Hmm.. this header seems like dummy header(in all architectures f4/f7/h7) 
>> only to include gpio header here.
>> Also arch/arm/include/asm/ does not seems like good place for soc specific 
>> header files.
> 
> Agree, but omap have put several omap_.h files too.

I see omap files, they might be first ones to use this structure, i am not 
sure. But in any case, it does not look clean today.
How about creating asm/arch-stm32 to put common stuff like this gpio header.

-#include 
+#include 

It can be done with no modification required in SYS_SOC, the point you 
mentioned below.
It does not remove the arch-stm32f7/f7/h7/ gpio headers but avoids include/asm 
cluttering with SOC files.

Cheers,
Vikas

> 
>>
>> how about creating one level like arch/arm/include/asm/arch-stm32/ to 
>> include common gpio.h here. It would fix both of above points.
>> The same location can be used to move other commonalities in future.
> 
> It's possible to create an additionnal level
> arch/arm/include/asm/arch-stm32/  and put specificities to each SoCs into :
> 
> arch/arm/include/asm/arch-stm32/stm32f4
> arch/arm/include/asm/arch-stm32/stm32f7
> arch/arm/include/asm/arch-stm32/stm32h7
> 
> If we focus on stm32f7, this implies to modify the content of 
> CONFIG_SYS_SOC from "stm32f7" to "stm32/stm32f7" in 
> board/st/stm32f746-disco/Kconfig but:
> 
> 1) In any case, we can't include directly files located in 
> arch/arm/include/asm/arch-stm32 because SYS_SOC is used to build include 
> path.
> 
> For example in drivers/gpio/gpio-uclass.c,
> #include  is in fact #include /gpio.h
> 
> so equal to #include  
> 2) Other effect, now in "soc" environment variable, we will obtain 
> "stm32/stm32f7" instead of "stm32f7". This is not a big deal, but we 
> must add some code to extract the soc name from "soc" environment variable.
> 
> Both solution are not perfect.
> 
> Thanks
> 
> Patrice
> 
> 
>>
>> Cheers,
>> Vikas
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] TCP & Overrrun

2018-02-08 Thread dh
On Thu, 8 Feb 2018 22:15:44 + (UTC)
Duncan Hare  wrote:

>  Duncan Hare
> 
> 714 931 7952
> 
>  
> - Forwarded Message -
>  From: Joe Hershberger 
>  To: Duncan Hare  
> Cc: u-boot ; Joe Hershberger
>  Sent: Thursday, February 8, 2018 11:40 AM
>  Subject: Re: [U-Boot] TCP & Overrrun
>
> Hi Duncan,
> 
> On Wed, Feb 7, 2018 at 8:40 PM, Duncan Hare  wrote:
> > I'm gettin overrun on the raspberry pi.
> >
> > Which ethernet drived does it use?  
> 
> You didn't specify which one you are talking about, but here's how to
> find out...
> 
> Assuming rpi3, find the config first...
> 
> configs/rpi_3_defconfig says:
> CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
> arch/arm/dts/bcm2837-rpi-3-b.dts says: #include
> "bcm283x-rpi-smsc9514.dtsi" arch/arm/dts/bcm283x-rpi-smsc9514.dtsi
> says:                ethernet: usbether@1 {
> compatible = "usb424,ec00"; grep -rn ec00 drivers/ says:
> drivers/usb/eth/smsc95xx.c
> 
> Cheers,
> -Joe
> 
> > I need to determine if it
> > uses CONFIG_SYS_RX_ETH_BUFFER" from net.h and the "net_rx_packets"
> > buffer pool defined in net/net.c
> >
> > Thanks
> >
> > Duncan Hare
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot  
> 
Joe

Thanks

It's is more push down stack buffer management than circular. Small
change to fix. No more starting at zero.

I like buffer pools with a size of power of 2. Easy to make circular
with an & of the power of 2-1 on the index.

Duncan

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


Re: [U-Boot] [PATCH 2/2] env: Add back default action of get_char in env_get_char()

2018-02-08 Thread Maxime Ripard
On Thu, Feb 08, 2018 at 10:52:20AM +0100, Simon Goldschmidt wrote:
> On 08.02.2018 09:47, Maxime Ripard wrote:
> > On Wed, Feb 07, 2018 at 02:17:12PM -0800, York Sun wrote:
> > > Commit 8a3a7e2270b3 ("env: Pass additional parameters to the env
> > > lookup function") dropped the default action if driver doesn't have
> > > get_char() defined. This causes failure to get environmental
> > > variables from NOR flash. Add back this default action for now.
> > > 
> > > Signed-off-by: York Sun 
> > > CC: Maxime Ripard 
> > > ---
> > > Limited test on LS1043ARDB.
> > > 
> > >   env/env.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/env/env.c b/env/env.c
> > > index edfb575..210bae2 100644
> > > --- a/env/env.c
> > > +++ b/env/env.c
> > > @@ -159,7 +159,7 @@ int env_get_char(int index)
> > >   int ret;
> > >   if (!drv->get_char)
> > > - continue;
> > > + return *(uchar *)(gd->env_addr + index);
> > Thinking more about this, I think this would break the case where the
> > first environment in your list has no get_char method, but the second
> > might.
> 
> 
> How can we decide which way is wanted? With your patch below, we might end
> up loading chars from a low-prio environment (which is not CRC checked) in
> the early boot stage. Later, we load the environment from another env driver
> with higher priority.

Ah, right.

> That's why I suggested removing the 'get_char' callback from the env drivers
> :-) Early boot stage environment lookups would still work the old way
> reading from 'gd->env_addr + index'.

If that works on York's board, I'm all in.

Maxime

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


[U-Boot] [PATCH v4 3/4] dm: video: use constants to refer to colors

2018-02-08 Thread Heinrich Schuchardt
Use constants to refer to colors.
Adjust initialization of foreground and background color to avoid
setting reserved bits.
Consistently u32 instead of unsigned for color bit mask.

Signed-off-by: Heinrich Schuchardt 
---
v4
Fix a build warning, that was treated as an error in Travis testing
by conditional compling with CONFIG_DM_VIDEO.
v3
Use color constants for initalizing the console.
v2
no change
---
 drivers/video/vidconsole-uclass.c | 55 +++
 drivers/video/video-uclass.c  | 19 +-
 include/video.h   | 11 ++--
 include/video_console.h   | 35 +
 4 files changed, 89 insertions(+), 31 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c 
b/drivers/video/vidconsole-uclass.c
index 8a2a377161f..d32b1017581 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -15,6 +15,15 @@
 #include 
 #include /* Get font data, width and height */
 
+/*
+ * Structure to describe a console color
+ */
+struct vid_rgb {
+   u32 r;
+   u32 g;
+   u32 b;
+};
+
 /* By default we scroll by a single line */
 #ifndef CONFIG_CONSOLE_SCROLL_LINES
 #define CONFIG_CONSOLE_SCROLL_LINES 1
@@ -108,11 +117,7 @@ static void vidconsole_newline(struct udevice *dev)
video_sync(dev->parent);
 }
 
-static const struct {
-   unsigned r;
-   unsigned g;
-   unsigned b;
-} colors[] = {
+static const struct vid_rgb colors[VID_COLOR_COUNT] = {
{ 0x00, 0x00, 0x00 },  /* black */
{ 0xff, 0x00, 0x00 },  /* red */
{ 0x00, 0xff, 0x00 },  /* green */
@@ -123,22 +128,26 @@ static const struct {
{ 0xff, 0xff, 0xff },  /* white */
 };
 
-static void set_color(struct video_priv *priv, unsigned idx, unsigned *c)
+u32 vid_console_color(struct video_priv *priv, unsigned int idx)
 {
switch (priv->bpix) {
case VIDEO_BPP16:
-   *c = ((colors[idx].r >> 3) << 11) |
-((colors[idx].g >> 2) <<  5) |
-((colors[idx].b >> 3) <<  0);
-   break;
+   return ((colors[idx].r >> 3) << 11) |
+  ((colors[idx].g >> 2) <<  5) |
+  ((colors[idx].b >> 3) <<  0);
case VIDEO_BPP32:
-   *c = (colors[idx].r << 16) |
-(colors[idx].g <<  8) |
-(colors[idx].b <<  0);
-   break;
+   return (colors[idx].r << 16) |
+  (colors[idx].g <<  8) |
+  (colors[idx].b <<  0);
default:
-   /* unsupported, leave current color in place */
-   break;
+   /*
+* For unknown bit arrangements just support
+* black and white.
+*/
+   if (idx)
+   return 0xff; /* white */
+   else
+   return 0x00; /* black */
}
 }
 
@@ -270,17 +279,17 @@ static void vidconsole_escape_char(struct udevice *dev, 
char ch)
 
switch (val) {
case 30 ... 37:
-   /* fg color */
-   set_color(vid_priv, val - 30,
- (unsigned *)_priv->colour_fg);
+   /* foreground color */
+   vid_priv->colour_fg = vid_console_color(
+   vid_priv, val - 30);
break;
case 40 ... 47:
-   /* bg color */
-   set_color(vid_priv, val - 40,
- (unsigned *)_priv->colour_bg);
+   /* background color */
+   vid_priv->colour_bg = vid_console_color(
+   vid_priv, val - 40);
break;
default:
-   /* unknown/unsupported */
+   /* ignore unsupported SGR parameter */
break;
}
}
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 9a980ea3a1d..945b20ddfd7 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -114,6 +114,17 @@ void video_clear(struct udevice *dev)
}
 }
 
+void video_set_default_colors(struct video_priv *priv)
+{
+#ifdef CONFIG_SYS_WHITE_ON_BLACK
+   priv->colour_fg = vid_console_color(priv, VID_WHITE);
+   priv->colour_bg = vid_console_color(priv, VID_BLACK);
+#else
+   priv->colour_fg = vid_console_color(priv, VID_BLACK);
+   priv->colour_bg = vid_console_color(priv, VID_WHITE);
+#endif
+}
+
 /* Flush video 

[U-Boot] [PATCH v4 2/4] dm: video: correctly clean background in 16bit mode

2018-02-08 Thread Heinrich Schuchardt
In 16 bit mode we have to copy two bytes per pixels repeatedly and not
four. Otherwise we will see a striped pattern.

Signed-off-by: Heinrich Schuchardt 
Reviewed-by: Simon Glass 
---
v4
no change
v3
no change
v2
no change
---
 drivers/video/video-uclass.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index dcaceed42c4..9a980ea3a1d 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -91,14 +91,26 @@ void video_clear(struct udevice *dev)
 {
struct video_priv *priv = dev_get_uclass_priv(dev);
 
-   if (priv->bpix == VIDEO_BPP32) {
+   switch (priv->bpix) {
+   case VIDEO_BPP16: {
+   u16 *ppix = priv->fb;
+   u16 *end = priv->fb + priv->fb_size;
+
+   while (ppix < end)
+   *ppix++ = priv->colour_bg;
+   break;
+   }
+   case VIDEO_BPP32: {
u32 *ppix = priv->fb;
u32 *end = priv->fb + priv->fb_size;
 
while (ppix < end)
*ppix++ = priv->colour_bg;
-   } else {
+   break;
+   }
+   default:
memset(priv->fb, priv->colour_bg, priv->fb_size);
+   break;
}
 }
 
-- 
2.14.2

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


[U-Boot] [PATCH v4 4/4] dm: video: support increased intensity (bold)

2018-02-08 Thread Heinrich Schuchardt
Support special rendition code 0 - reset attributes.
Support special rendition code 1 - increased intensity (bold).

Signed-off-by: Heinrich Schuchardt 
---
v4
Rename priv->fg to priv->fg_col_idx.
v3
Add color constants.
v2
SGR 0 should reset the colors and the attributes.
---
 drivers/video/vidconsole-uclass.c | 32 ++--
 drivers/video/video-uclass.c  |  5 -
 include/video.h   |  2 ++
 include/video_console.h   | 12 ++--
 test/dm/video.c   |  2 +-
 5 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c 
b/drivers/video/vidconsole-uclass.c
index d32b1017581..6f3988d49ea 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -119,12 +119,20 @@ static void vidconsole_newline(struct udevice *dev)
 
 static const struct vid_rgb colors[VID_COLOR_COUNT] = {
{ 0x00, 0x00, 0x00 },  /* black */
-   { 0xff, 0x00, 0x00 },  /* red */
-   { 0x00, 0xff, 0x00 },  /* green */
+   { 0xc0, 0x00, 0x00 },  /* red */
+   { 0x00, 0xc0, 0x00 },  /* green */
+   { 0xc0, 0x60, 0x00 },  /* brown */
+   { 0x00, 0x00, 0xc0 },  /* blue */
+   { 0xc0, 0x00, 0xc0 },  /* magenta */
+   { 0x00, 0xc0, 0xc0 },  /* cyan */
+   { 0xc0, 0xc0, 0xc0 },  /* light gray */
+   { 0x80, 0x80, 0x80 },  /* gray */
+   { 0xff, 0x00, 0x00 },  /* bright red */
+   { 0x00, 0xff, 0x00 },  /* bright green */
{ 0xff, 0xff, 0x00 },  /* yellow */
-   { 0x00, 0x00, 0xff },  /* blue */
-   { 0xff, 0x00, 0xff },  /* magenta */
-   { 0x00, 0xff, 0xff },  /* cyan */
+   { 0x00, 0x00, 0xff },  /* bright blue */
+   { 0xff, 0x00, 0xff },  /* bright magenta */
+   { 0x00, 0xff, 0xff },  /* bright cyan */
{ 0xff, 0xff, 0xff },  /* white */
 };
 
@@ -278,10 +286,22 @@ static void vidconsole_escape_char(struct udevice *dev, 
char ch)
s++;
 
switch (val) {
+   case 0:
+   /* all attributes off */
+   video_set_default_colors(vid_priv);
+   break;
+   case 1:
+   /* bold */
+   vid_priv->fg_col_idx |= 8;
+   vid_priv->colour_fg = vid_console_color(
+   vid_priv, vid_priv->fg_col_idx);
+   break;
case 30 ... 37:
/* foreground color */
+   vid_priv->fg_col_idx &= ~7;
+   vid_priv->fg_col_idx |= val - 30;
vid_priv->colour_fg = vid_console_color(
-   vid_priv, val - 30);
+   vid_priv, vid_priv->fg_col_idx);
break;
case 40 ... 47:
/* background color */
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 945b20ddfd7..b5bb8e0efde 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -117,9 +117,12 @@ void video_clear(struct udevice *dev)
 void video_set_default_colors(struct video_priv *priv)
 {
 #ifdef CONFIG_SYS_WHITE_ON_BLACK
-   priv->colour_fg = vid_console_color(priv, VID_WHITE);
+   /* White is used when switching to bold, use light gray here */
+   priv->fg_col_idx = VID_LIGHT_GRAY;
+   priv->colour_fg = vid_console_color(priv, VID_LIGHT_GRAY);
priv->colour_bg = vid_console_color(priv, VID_BLACK);
 #else
+   priv->fg_col_idx = VID_BLACK;
priv->colour_fg = vid_console_color(priv, VID_BLACK);
priv->colour_bg = vid_console_color(priv, VID_WHITE);
 #endif
diff --git a/include/video.h b/include/video.h
index 841f3dc56b1..ddc2eeb5a95 100644
--- a/include/video.h
+++ b/include/video.h
@@ -67,6 +67,7 @@ enum video_log2_bpp {
  * @flush_dcache:  true to enable flushing of the data cache after
  * the LCD is updated
  * @cmap:  Colour map for 8-bit-per-pixel displays
+ * @fg_col_idx:Foreground color code (bit 3 = bold, bit 0-2 = color)
  */
 struct video_priv {
/* Things set up by the driver: */
@@ -88,6 +89,7 @@ struct video_priv {
u32 colour_bg;
bool flush_dcache;
ushort *cmap;
+   u8 fg_col_idx;
 };
 
 /* Placeholder - there are no video operations at present */
diff --git a/include/video_console.h b/include/video_console.h
index 656a47295f6..7621a189d2a 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -15,16 +15,24 @@
 #define VID_TO_POS(x)  ((x) * VID_FRAC_DIV)
 
 /*
- * The 8 colors supported by the console
+ * The 16 colors supported by the console
  */
 

[U-Boot] [PATCH v4 0/4] dm: video: Correct color ANSI escape sequence support

2018-02-08 Thread Heinrich Schuchardt
Support special rendition code 0 - reset attributes.
Support special rendition code 1 - increased intensity (bold).
Get RGB sequence in pixels right (swap blue and red).
Do not set reserved bits.
Use u32 instead of unsigned for color bit mask.

qemu-system-i386 -display sdl -vga virtio and
qemu-system-i386 -display sdl -vga cirrus
now display the same colors as
qemu-system-i386 -nographic

Testing is possible via

setenv efi_selftest test output
bootefi selftest
---
v4:
Fix a build warning leading to a Travis error.
Rename a variable.
v3:
Split single patch up into a series
Use constants for colors
v2:
SGR 0 should reset the colors and the attributes.
---

Heinrich Schuchardt (4):
  dm: video: show correct colors in graphical console
  dm: video: correctly clean background in 16bit mode
  dm: video: use constants to refer to colors
  dm: video: support increased intensity (bold)

 drivers/video/vidconsole-uclass.c | 86 ++-
 drivers/video/video-uclass.c  | 38 +
 include/video.h   | 13 +-
 include/video_console.h   | 43 
 test/dm/video.c   |  2 +-
 5 files changed, 142 insertions(+), 40 deletions(-)

-- 
2.14.2

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


[U-Boot] [PATCH v4 1/4] dm: video: show correct colors in graphical console

2018-02-08 Thread Heinrich Schuchardt
Get RGB sequence in pixels right (swap blue and red).
Do not set reserved bits.

qemu-system-i386 -display sdl -vga virtio and
qemu-system-i386 -display sdl -vga cirrus
now display the similar colors (highlighting still missing) as
qemu-system-i386 -nographic

Testing is possible via

setenv efi_selftest test output
bootefi selftest

Signed-off-by: Heinrich Schuchardt 
Reviewed-by: Simon Glass 
---
v4
no change
v3
no change
v2
no change
---
 drivers/video/vidconsole-uclass.c | 13 ++---
 test/dm/video.c   |  2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c 
b/drivers/video/vidconsole-uclass.c
index 5f63c12d6c5..8a2a377161f 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -127,15 +127,14 @@ static void set_color(struct video_priv *priv, unsigned 
idx, unsigned *c)
 {
switch (priv->bpix) {
case VIDEO_BPP16:
-   *c = ((colors[idx].r >> 3) << 0) |
-((colors[idx].g >> 2) << 5) |
-((colors[idx].b >> 3) << 11);
+   *c = ((colors[idx].r >> 3) << 11) |
+((colors[idx].g >> 2) <<  5) |
+((colors[idx].b >> 3) <<  0);
break;
case VIDEO_BPP32:
-   *c = 0xff00 |
-(colors[idx].r << 0) |
-(colors[idx].g << 8) |
-(colors[idx].b << 16);
+   *c = (colors[idx].r << 16) |
+(colors[idx].g <<  8) |
+(colors[idx].b <<  0);
break;
default:
/* unsupported, leave current color in place */
diff --git a/test/dm/video.c b/test/dm/video.c
index 29917d0c2d8..d158f1fcb39 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -186,7 +186,7 @@ static int dm_test_video_ansi(struct unit_test_state *uts)
/* test colors (30-37 fg color, 40-47 bg color) */
vidconsole_put_string(con, ANSI_ESC"[30;41mfoo"); /* black on red */
vidconsole_put_string(con, ANSI_ESC"[33;44mbar"); /* yellow on blue */
-   ut_asserteq(268, compress_frame_buffer(dev));
+   ut_asserteq(267, compress_frame_buffer(dev));
 
return 0;
 }
-- 
2.14.2

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


[U-Boot] [PATCH] video: ivybridge: FIx defined but not used warning

2018-02-08 Thread Tom Rini
The struct ivb_pm_gt2 is defined but never used, only the _17w and _35w
variants.

Cc: Anatolij Gustschin 
Cc: Bin Meng 
Signed-off-by: Tom Rini 
---
The code that uses ivb_pm_gt2_17w/ivb_pm_gt2_35w/ivb_pm_gt2_35w maybe is
supposed to use this instead at one point?  Or maybe it's a bring-up
artifact, I'm not sure.
---
 drivers/video/ivybridge_igd.c | 56 ---
 1 file changed, 56 deletions(-)

diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c
index d8af2e169635..7c00c4021c4a 100644
--- a/drivers/video/ivybridge_igd.c
+++ b/drivers/video/ivybridge_igd.c
@@ -128,62 +128,6 @@ static const struct gt_powermeter ivb_pm_gt1[] = {
{ 0 }
 };
 
-static const struct gt_powermeter ivb_pm_gt2[] = {
-   { 0xa800, 0x1000 },
-   { 0xa804, 0x00033800 },
-   { 0xa808, 0x0902 },
-   { 0xa80c, 0x0c002f00 },
-   { 0xa810, 0x12000400 },
-   { 0xa814, 0x },
-   { 0xa818, 0x00d20800 },
-   { 0xa81c, 0x0002 },
-   { 0xa820, 0x03004b02 },
-   { 0xa824, 0x0600 },
-   { 0xa828, 0x07000773 },
-   { 0xa82c, 0x },
-   { 0xa830, 0x00010032 },
-   { 0xa834, 0x1520040d },
-   { 0xa838, 0x00020105 },
-   { 0xa83c, 0x00083700 },
-   { 0xa840, 0x151d },
-   { 0xa844, 0x },
-   { 0xa848, 0x20001b00 },
-   { 0xa84c, 0x0a10 },
-   { 0xa850, 0x },
-   { 0xa854, 0x0008 },
-   { 0xa858, 0x0008 },
-   { 0xa85c, 0x },
-   { 0xa860, 0x0002 },
-   { 0xa248, 0x221e },
-   { 0xa900, 0x },
-   { 0xa904, 0x3500 },
-   { 0xa908, 0x },
-   { 0xa90c, 0x0c00 },
-   { 0xa910, 0x12000500 },
-   { 0xa914, 0x },
-   { 0xa918, 0x00b2 },
-   { 0xa91c, 0x },
-   { 0xa920, 0x08004b02 },
-   { 0xa924, 0x0200 },
-   { 0xa928, 0x07000820 },
-   { 0xa92c, 0x },
-   { 0xa930, 0x0003 },
-   { 0xa934, 0x050f020d },
-   { 0xa938, 0x00020300 },
-   { 0xa93c, 0x00903900 },
-   { 0xa940, 0x },
-   { 0xa944, 0x },
-   { 0xa948, 0x20001b00 },
-   { 0xa94c, 0x0a10 },
-   { 0xa950, 0x },
-   { 0xa954, 0x0008 },
-   { 0xa960, 0x0011 },
-   { 0xaa3c, 0x3900 },
-   { 0xaa54, 0x0008 },
-   { 0xaa60, 0x0011 },
-   { 0 }
-};
-
 static const struct gt_powermeter ivb_pm_gt2_17w[] = {
{ 0xa800, 0x2000 },
{ 0xa804, 0x000e3800 },
-- 
2.7.4

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


[U-Boot] efi_loader: patches for v2018.03-rc2

2018-02-08 Thread Heinrich Schuchardt
Hello Alex,

could you, please, review the following patches and select them for your
pull request for v2018.03-rc2.

https://github.com/xypron2/u-boot.git, branch v2018.03-rc2
up to commit 55e90f0e97a846113518eab71757740051cd9d4b.

Travis ran without errors:

https://travis-ci.org/xypron2/u-boot/builds/338861562

Best regards

Heinrich

Heinrich Schuchardt (8):
  efi_loader: fix building crt0 on arm
  efi_loader: fix the online help for bootefi bootmgr
  efi_selftest: use correct compiler flags for miniapps
  efi_loader: add missing runtime services stubs
  efi_loader: create stub for CreateEventEx
  efi_driver: return type of efi_driver_init()
  efi_loader: split README.efi into two separate documents
  efi_loader: rewrite README.efi

 MAINTAINERS   |   3 +
 arch/arm/lib/crt0_aarch64_efi.S   |   4 +-
 arch/arm/lib/crt0_arm_efi.S   |   4 +-
 cmd/bootefi.c |   2 +-
 doc/README.efi| 537 +-
 doc/README.u-boot_on_efi  | 259 ++
 include/asm-generic/pe.h  |  21 ++
 include/efi_api.h |  37 ++-
 include/efi_loader.h  |   2 +-
 include/pe.h  |   8 +-
 lib/efi_driver/efi_uclass.c   |   6 +-
 lib/efi_loader/efi_boottime.c |  33 +++
 lib/efi_loader/efi_image_loader.c |   2 +-
 lib/efi_loader/efi_runtime.c  |  29 ++
 lib/efi_selftest/Makefile |   6 +-
 15 files changed, 642 insertions(+), 311 deletions(-)
 create mode 100644 doc/README.u-boot_on_efi
 create mode 100644 include/asm-generic/pe.h

-- 
2.14.2

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


Re: [U-Boot] TCP & Overrrun

2018-02-08 Thread Joe Hershberger
Hi Duncan,

On Wed, Feb 7, 2018 at 8:40 PM, Duncan Hare  wrote:
> I'm gettin overrun on the raspberry pi.
>
> Which ethernet drived does it use?

You didn't specify which one you are talking about, but here's how to
find out...

Assuming rpi3, find the config first...

configs/rpi_3_defconfig says: CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
arch/arm/dts/bcm2837-rpi-3-b.dts says: #include "bcm283x-rpi-smsc9514.dtsi"
arch/arm/dts/bcm283x-rpi-smsc9514.dtsi says: ethernet:
usbether@1 {   compatible = "usb424,ec00";
grep -rn ec00 drivers/ says: drivers/usb/eth/smsc95xx.c

Cheers,
-Joe

> I need to determine if it
> uses CONFIG_SYS_RX_ETH_BUFFER" from net.h and the "net_rx_packets"
> buffer pool defined in net/net.c
>
> grep suggests it is not using net_rx_packets.
>
> Here's a list of a grep of the u-boot source directory
>
> rch/mips/mach-au1x00/au1x00_eth.c
> arch/powerpc/cpu/mpc85xx/ether_fcc.c
> net/net.c
> drivers/usb/gadget/ether.c
> drivers/net/ep93xx_eth.c
> drivers/net/cs8900.c
> drivers/net/ftgmac100.c
> drivers/net/ks8851_mll.c
> drivers/net/dc2114x.c
> drivers/net/dm9000x.c
> drivers/net/xilinx_ll_temac_fifo.c
> drivers/net/ax88180.c
> drivers/net/tsec.c
> drivers/net/mcffec.c
> drivers/net/dnet.c
> drivers/net/ftmac100.c
> drivers/net/xilinx_ll_temac_sdma.c
> drivers/net/sandbox-raw.c
> drivers/net/cpsw.c
> drivers/net/sandbox.c
> drivers/net/smc911x.c
> drivers/net/lan91c96.c
> drivers/net/uli526x.c
> drivers/net/tsi108_eth.c
> drivers/net/mpc8xx_fec.c
> drivers/net/at91_emac.c
> drivers/net/ethoc.c
> drivers/net/fsl_mcdmafec.c
> drivers/net/bcm-sf2-eth.c
> drivers/net/enc28j60.c
> drivers/net/smc9.c
> drivers/net/macb.c
> drivers/net/pic32_eth.c
>
> Thanks
>
> Duncan Hare
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] env: Fix env_load_location

2018-02-08 Thread York Sun
On 02/08/2018 02:05 AM, Simon Goldschmidt wrote:
> On 08.02.2018 09:38, Maxime Ripard wrote:
>> Hi,
>>
>> Thanks for your patch
>>
>> On Wed, Feb 07, 2018 at 02:17:11PM -0800, York Sun wrote:
>>> Commit 7d714a24d725 ("env: Support multiple environments") added
>>> static variable env_load_location. When saving environmental
>>> variables, this variable is presumed to have the value set before.
>>> In case the value was set before relocation and U-Boot runs from a
>>> NOR flash, this variable wasn't writable. This causes failure when
>>> saving the environment. To save this location, global data must be
>>> used instead.
> 
> Out of curiosity: which linker sections are affected of this issue? I 
> assume only initialized data ('.data') is affected as it is left in 
> place. Also, I assume that uninitialized data ('.bss') is not affected 
> (as your linker can place this into ram)?
> If so, this issue could be fixed by changing ENVL_UNKNOWN to zero (which 
> you already do in your patch) and leaving 'env_load_location' 
> uninitialized, in which case it is initialized to zero (== ENVL_UNKNOWN) 
> as defined by the C standard.

Leaving it as ENVL_UNKNOWN doesn't fix the problem. The
env_load_location needs to be valid after relocation. Leaving it as
unknown doesn't let you write env.

> 
> Another possibility to fix this would be to have your linker script put 
> 'data' into ram but initialize it from rom. Something like this:
> 
> .data :
> {
>    
> } >ram AT>rom
> 
> To me, both versions would be better than to add members to struct 
> global_dat.

Not everything in initial RAM is copied to final RAM. After relocation,
we shouldn't be using initial RAM at all. Actually the initial RAM may
be used for other purpose.

> 
>>> Signed-off-by: York Sun 
>>> CC: Maxime Ripard 
>>> ---
>>> Limited test on LS1043ARDB.
>>>
>>>   env/env.c | 8 +++-
>>>   include/asm-generic/global_data.h | 1 +
>>>   include/environment.h | 2 +-
>>>   3 files changed, 5 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/env/env.c b/env/env.c
>>> index 9a89832..edfb575 100644
>>> --- a/env/env.c
>>> +++ b/env/env.c
>>> @@ -62,8 +62,6 @@ static enum env_location env_locations[] = {
>>>   #endif
>>>   };
>>>   
>>> -static enum env_location env_load_location = ENVL_UNKNOWN;
>>> -
>>>   static bool env_has_inited(enum env_location location)
>>>   {
>>> return gd->env_has_init & BIT(location);
>>> @@ -108,11 +106,11 @@ __weak enum env_location env_get_location(enum 
>>> env_operation op, int prio)
>>> if (prio >= ARRAY_SIZE(env_locations))
>>> return ENVL_UNKNOWN;
>>>   
>>> -   env_load_location = env_locations[prio];
>>> -   return env_load_location;
>>> +   gd->env_load_location = env_locations[prio];
>>> +   return gd->env_load_location;
>>>   
>>> case ENVOP_SAVE:
>>> -   return env_load_location;
>>> +   return gd->env_load_location;
>>> }
>>>   
>>> return ENVL_UNKNOWN;
>>> diff --git a/include/asm-generic/global_data.h 
>>> b/include/asm-generic/global_data.h
>>> index fd8cd45..10f1441 100644
>>> --- a/include/asm-generic/global_data.h
>>> +++ b/include/asm-generic/global_data.h
>>> @@ -51,6 +51,7 @@ typedef struct global_data {
>>> unsigned long env_addr; /* Address  of Environment struct */
>>> unsigned long env_valid;/* Environment valid? enum env_valid */
>>> unsigned long env_has_init; /* Bitmask of boolean of struct 
>>> env_location offsets */
>>> +   int env_load_location;
>>>   
>>> unsigned long ram_top;  /* Top address of RAM used by U-Boot */
>>> unsigned long relocaddr;/* Start address of U-Boot in RAM */
>>> diff --git a/include/environment.h b/include/environment.h
>>> index a406050..0f339da 100644
>>> --- a/include/environment.h
>>> +++ b/include/environment.h
>>> @@ -188,6 +188,7 @@ enum env_valid {
>>>   };
>>>   
>>>   enum env_location {
>>> +   ENVL_UNKNOWN,
>>> ENVL_EEPROM,
>>> ENVL_EXT4,
>>> ENVL_FAT,
>>> @@ -202,7 +203,6 @@ enum env_location {
>>> ENVL_NOWHERE,
>>>   
>>> ENVL_COUNT,
>>> -   ENVL_UNKNOWN,
>> Why did you need to change this? This looks a bit odd.
> 
> The global data struct is initialized to zero. I guess this change is 
> meant to ensure 'gd->env_load_location' is initialized to ENV_UNKOWN 
> (see my comments above).

Yes. That was my intention.

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


Re: [U-Boot] [PATCH v3 1/2] i.MX6: nand: add nandbcb update command

2018-02-08 Thread Fabio Estevam
Hi Stefan,

On Wed, Feb 7, 2018 at 3:02 PM,   wrote:

> Thanks for working on that! We carry a similar command since a while
> downstream and I hoped since quite a while to get some time to upstream
> it:
>
> http://git.toradex.com/cgit/u-boot-toradex.git/tree/arch/arm/imx-common/cmd_writebcb_mx7.c?h=2016.11-toradex

Looks like an elegant implementation!

Jagan,

Could you please consider bringing Stefan's work upstream?

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


[U-Boot] [PATCH] block: Migrate SystemACE chip to Kconfig

2018-02-08 Thread Tom Rini
Migrate the base and sub-options to Kconfig.  Note that we only enable
this in the base sandbox config now.

Cc: Alexey Brodkin 
Cc: Michal Simek 
Signed-off-by: Tom Rini 
---
Is this driver still used anywhere?  It's fishy that it's only enabled
in sandbox anymore.
---
 README| 12 
 configs/sandbox_defconfig |  3 +++
 drivers/block/Kconfig | 18 ++
 include/configs/sandbox.h |  4 
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/README b/README
index 2f9034ed5e22..57d985d0f1d4 100644
--- a/README
+++ b/README
@@ -2274,18 +2274,6 @@ The following options need to be configured:
CONFIG_SF_DEFAULT_MODE  (see include/spi.h)
CONFIG_SF_DEFAULT_SPEED in Hz
 
-   CONFIG_SYSTEMACE
-
-   Adding this option adds support for Xilinx SystemACE
-   chips attached via some sort of local bus. The address
-   of the chip must also be defined in the
-   CONFIG_SYS_SYSTEMACE_BASE macro. For example:
-
-   #define CONFIG_SYSTEMACE
-   #define CONFIG_SYS_SYSTEMACE_BASE 0xf000
-
-   When SystemACE support is added, the "ace" device type
-   becomes available to the fat commands, i.e. fatls.
 
 - TFTP Fixed UDP Port:
CONFIG_TFTP_PORT
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 41a2e34235dd..3acf9089cdb4 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -80,6 +80,9 @@ CONFIG_DEVRES=y
 CONFIG_DEBUG_DEVRES=y
 CONFIG_ADC=y
 CONFIG_ADC_SANDBOX=y
+CONFIG_SYSTEMACE=y
+CONFIG_SYS_SYSTEMACE_BASE=0x0
+CONFIG_SYS_SYSTEMACE_WIDTH=16
 CONFIG_CLK=y
 CONFIG_CPU=y
 CONFIG_DM_DEMO=y
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 26760895f99d..e2c80f2075e2 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -38,3 +38,21 @@ config IDE
  This allows access to raw blocks and filesystems on an IDE drive
  from U-Boot. See also CMD_IDE which provides an 'ide' command for
  performing various IDE operations.
+
+config SYSTEMACE
+   bool "Xilinx SystemACE support"
+   help
+ Adding this option adds support for Xilinx SystemACE chips attached
+ via some sort of local bus. The address of the chip must also be
+ defined in the CONFIG_SYS_SYSTEMACE_BASE macro.
+
+ When SystemACE support is added, the "ace" device type becomes
+ available to the fat commands, i.e. fatls.
+
+config SYS_SYSTEMACE_BASE
+   hex "Base address of SystemACE chip"
+   depends on SYSTEMACE
+
+config SYS_SYSTEMACE_WIDTH
+   int "Word size of access to the of SystemACE chip"
+   depends on SYSTEMACE
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index de1c8a2a3855..b0a749caecc2 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -142,10 +142,6 @@
 
 #define CONFIG_SYS_SATA_MAX_DEVICE 2
 
-#define CONFIG_SYSTEMACE
-#define CONFIG_SYS_SYSTEMACE_WIDTH 16
-#define CONFIG_SYS_SYSTEMACE_BASE  0
-
 #define CONFIG_MISC_INIT_F
 
 #endif
-- 
2.7.4

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


Re: [U-Boot] omap4: sdp4430: Enable CONFIG_NET for this platform

2018-02-08 Thread Tom Rini
On Thu, Feb 08, 2018 at 08:58:59AM +0100, Michal Simek wrote:

> Distro default configuration contains also dhcp and pxe setting which
> can't working without enabling CONFIG_NET.
> EFI is not required that's why it is not enabled.
> 
> Signed-off-by: Michal Simek 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] Kconfig: net: phylib: Phylib should depends on NET

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 01:23:52PM +0100, Michal Simek wrote:

> There is no value to enable phylib without networking support.
> 
> Signed-off-by: Michal Simek 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [U-Boot,V3] Convert CONFIG_APBH_DMA et al to Kconfig

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 08:34:45AM -0600, Adam Ford wrote:

> This converts the following to Kconfig:
>CONFIG_APBH_DMA
>CONFIG_APBH_DMA_BURST
>CONFIG_APBH_DMA_BURST8
> 
> Signed-off-by: Adam Ford 
> Reviewed-by: Stefan Agner 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] configs: imx6q_logic: Move CONFIG_MXC_UART to Kconfig

2018-02-08 Thread Tom Rini
On Sun, Feb 04, 2018 at 08:54:13AM -0600, Adam Ford wrote:

> Since CONFIG_MXC_UART is already in Kconfig, move this from
> the header to imx6q_logic_defconfig
> 
> Signed-off-by: Adam Ford 
> Reviewed-by: Stefano Babic 
> 
> diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig
> index ec34047..23eff91 100644

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [U-Boot, v2, 2/4] arm: imx: mx28: Move MX28 selection to Kconfig

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 09:44:35AM +0100, Stefan Agner wrote:

> From: Stefan Agner 
> 
> The motivation for moving MX28 selection to Kconfig is to be able
> to better handle NAND MXS selection through Kconfig.
> 
> This selection method also aligns with the way other i.MX SoCs are
> selected in U-Boot.
> 
> Signed-off-by: Stefan Agner 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [U-Boot, v2] Kconfig: Select networking commands only when NET is enabled

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 01:28:36PM +0100, Michal Simek wrote:

> There is no reason to unconditially select network commands as distro
> defaults without networking enable.
> 
> Signed-off-by: Michal Simek 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [U-Boot, v2, 3/4] spl: use ARCH_MX23/28 to specify SPL_LDSCRIPT

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 09:44:36AM +0100, Stefan Agner wrote:

> From: Stefan Agner 
> 
> Simplify SPL_LDSCRIPT config by using the new arch Kconfig
> configurations ARCH_MX23 and ARCH_MX28.
> 
> Signed-off-by: Stefan Agner 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] Convert CONFIG LIB_HW_RAND to Kconfig

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 10:18:18AM -0600, Adam Ford wrote:

> config_fallbacks.h had some logic to automatically select
> LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
> already selected.  By migrating LIB_HW_RAND to Kconfig, we can
> remove this check from config_fallbacks.h and put it into Kconfig
> 
> Signed-off-by: Adam Ford 
> Reviewed-by: Lukasz Majewski 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] configs: stm32: Enable CONFIG_ENV_VARS_UBOOT_CONFIG

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 10:47:59AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Enable CONFIG_ENV_VARS_UBOOT_CONFIG for all STM32 boards
> It allows to retrieve the SoC name into the "soc" environment
> variable.
> 
> Signed-off-by: Christophe Priouzeau 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] configs: imx6q_logic: Move CONFIG_PHY_SMSC to defconfig

2018-02-08 Thread Tom Rini
On Sun, Feb 04, 2018 at 09:07:01AM -0600, Adam Ford wrote:

> Since CONFIG_PHY_SMSC was already in Kconfig, move this from
> header filet to defconfig
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig
> index 23eff91..92a8561 100644

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [U-Boot,v2,4/4] Convert CONFIG_NAND_MXS to Kconfig

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 09:44:37AM +0100, Stefan Agner wrote:

> From: Stefan Agner 
> 
> This converts CONFIG_NAND_MXS to Kconfig.
> 
> Signed-off-by: Stefan Agner 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [U-Boot, v2, 1/4] arm: imx: mx23: Move MX23 selection to Kconfig

2018-02-08 Thread Tom Rini
On Tue, Feb 06, 2018 at 09:44:34AM +0100, Stefan Agner wrote:

> From: Stefan Agner 
> 
> The motivation for moving MX23 selection to Kconfig is to be able
> to better handle NAND MXS selection through Kconfig.
> 
> This selection method also aligns with the way other i.MX SoCs are
> selected in U-Boot.
> 
> Signed-off-by: Stefan Agner 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] Convert CONFIG_MXC_GPIO to Kconfig

2018-02-08 Thread Tom Rini
On Sun, Feb 04, 2018 at 09:32:43AM -0600, Adam Ford wrote:

> This converts the following to Kconfig:
>CONFIG_MXC_GPIO
> 
> Signed-off-by: Adam Ford 

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [PATCH] am335x_evm: Consolidate eMMC partitions with DFU info

2018-02-08 Thread Tom Rini
On Wed, Feb 07, 2018 at 08:41:32PM +0200, Sam Protsenko wrote:

> From DFU_ALT_INFO_EMMC (include/environment/ti/dfu.h) we can see that
> rootfs will be flashed to second partition on eMMC. But at the moment we
> have only one partition in $partitions environment variable. Let's add
> "bootloader" partition prior to "rootfs", so that DFU works correctly.
> This also fixes eMMC boot, which looks for rootfs on second partition.
> 
> "bootloader" partition start corresponds to "u-boot.img.raw" in DFU
> eMMC info, which is 0x300 sector (384 KiB offset from eMMC start).
> 
> rootfs start address can be also found from DFU eMMC info.
> bootloader-related area is finished at 0x1500 sector (2688 KiB offset
> from eMMC start). This should be the start address for rootfs in
> $partitions environment variable.
> 
> While at it, fix U-Boot environment address to be the same as for
> AM57x EVM, so that it doesn't clash with other partitions.
> 
> So now eMMC layout looks like this:
> 
> ===
> 
> 0   ++
> | MBR/GPT header |   128   -
> 128 ++
> | MLO|   256   -
> 384 ++
> | u-boot.img |   1792  bootloader
> 2176++
> |  hole  |   256   -
> 2432++
> | U-Boot environment |   128   -
> 2560++
> | U-Boot environment |   128   -
> | (redundant)|
> 2688++
> | rootfs |   remaining rootfs
> end ++
> 
> ===
> 
> "hole" area can be used further for storing U-Boot environment (like
> it's done in AM57x EVM config file) or for increasing u-boot.img area
> (in case u-boot.img size increased, e.g. if new dtbs were added).
> 
> This commit conforms with Linux partition table from f6d245b8c56c
> ("arm: am57xx: Fix Linux boot from eMMC") commit, making things in
> uniform way.
> 
> Signed-off-by: Sam Protsenko 

Reviewed-by: Tom Rini 

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


Re: [U-Boot] [RESEND PATCH v3 1/2] drivers/crypto/fsl: assign job-rings to non-TrustZone

2018-02-08 Thread Ruchika Gupta

>-Original Message-
>From: Bryan O'Donoghue [mailto:bryan.odonog...@linaro.org]
>Sent: Friday, January 26, 2018 5:55 PM
>To: u-boot@lists.denx.de; tr...@konsulko.com
>Cc: Peng Fan ; Fabio Estevam ;
>lukas.a...@aisec.fraunhofer.de; Bryan O'Donoghue
>; Alexandru Porosanu
>; Ruchika Gupta ;
>Aneesh Bansal 
>Subject: [RESEND PATCH v3 1/2] drivers/crypto/fsl: assign job-rings to non-
>TrustZone
>
>After enabling TrustZone various parts of the CAAM silicon become inaccessible
>to non TrustZone contexts. The job-ring registers are designed to allow non
>TrustZone contexts like Linux to still submit jobs to CAAM even after TrustZone
>has been enabled.
>
>The default job-ring permissions after the BootROM look like this for job-ring
>zero.
>
>ms=0x8001 ls=0x8001
>
>The MS field is JRaMIDR_MS (job ring MID most significant).
>
>Referring to "Security Reference Manual for i.MX 7Dual and 7Solo Applications
>Processors, Rev. 0, 03/2017" section 8.10.4 we see that JROWN_NS controls
>whether or not a job-ring is accessible from non TrustZone.
>
>Bit 15 (TrustZone) is the logical inverse of bit 3 hence the above value of
>0x8001 shows that JROWN_NS=0 and TrustZone=1.
>
>Clearly then as soon as TrustZone becomes active the job-ring registers are no
>longer accessible from Linux, which is not what we want.
>
>This patch explicitly sets all job-ring registers to JROWN_NS=1 (non
>TrustZone) by default and to the Non-Secure MID 001. Both settings are required
>to successfully assign a job-ring to non-secure mode. If a piece of TrustZone
>firmware requires ownership of job-ring registers it can unset the JROWN_NS bit
>itself.
>
>This patch in conjunction with a modification of the Linux kernel to skip HWRNG
>initialisation makes CAAM usable to Linux with TrustZone enabled.
>
>Signed-off-by: Bryan O'Donoghue 
>Cc: Fabio Estevam 
>Cc: Peng Fan 
>Cc: Alex Porosanu 
>Cc: Ruchika Gupta 
>Cc: Aneesh Bansal 
>Link:
>https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c
>om%2FOP-
>TEE%2Foptee_os%2Fissues%2F1408=02%7C01%7Cruchika.gupta%40nxp.c
>om%7C1fe21d0a12d34d7722c008d564b7cb4d%7C686ea1d3bc2b4c6fa92cd99c5
>c301635%7C0%7C0%7C636525662918265016=Nt5Fu2LYXDq95Rlv7N5Ns
>w45tO%2Fw3nDcbQF%2BOPRP7PI%3D=0
>Link:
>https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftinyurl.c
>om%2Fyam5gv9a=02%7C01%7Cruchika.gupta%40nxp.com%7C1fe21d0a12
>d34d7722c008d564b7cb4d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1
>%7C636525662918265016=BypstfduS%2FVyPaeEQCj1hyx5RRSF690SbLaxZ
>j74KPo%3D=0
>Tested-by: Lukas Auer 

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


Re: [U-Boot] [PATCH] Fix --noheader on fw_printenv

2018-02-08 Thread Alex Kiernan
On Thu, Feb 8, 2018 at 4:40 PM, Stefan Agner  wrote:
> On 08.02.2018 17:17, Alex Kiernan wrote:
>> On Thu, Feb 8, 2018 at 3:37 PM,   wrote:
>>> On 08.02.2018 10:35, Alex Kiernan wrote:
 Using fw_printenv with --noheader fails:

   root@nrr-922:~# fw_printenv --noheader arch
   ## Error: `-n' option requires exactly one argument
>>>
>>> I think it would work with --noheader=arch
>>>
>>
>> It doesn't:
>>
>> root@nrr-922:~# fw_printenv --noheader=arch
>> ## Error: `-n' option requires exactly one argument
>>
>> Probably I should fix the error too as it's misleading.
>>
>
> This comes from getopt_long, so I don't think you can fix it. The getopt
> string in parse_printenv_args actually says argument "n" has no argument
> (no colon), so it actually is surprising that it prints that...
>
> Maybe this is from the getopt_long call in parse_common_args?
>

It's in fw_env.c:

449 int fw_printenv(int argc, char *argv[], int value_only, struct
env_opts *opts)
450 {
451 int i, rc = 0;
452
453 if (value_only && argc != 1) {
454 fprintf(stderr,
455 "## Error: `-n' option requires exactly
one argument\n");
456 return -1;
457 }
458

You pass it one argument, getopt_long consumes it, the call to
getopt_long does nothing with the that argument and then this check
fails because there are no args left. Though you've made me realise it
does of course work if you call it like this!

root@nrr-922:~# fw_printenv --noheader=foo arch
arm

I guess you could rewrite it so it's actually an optarg, not picked
out of argv, but you'd still want to check that there's no more args,
so really not sure you gain very much.

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


Re: [U-Boot] [PATCH] Fix --noheader on fw_printenv

2018-02-08 Thread Stefan Agner
On 08.02.2018 17:17, Alex Kiernan wrote:
> On Thu, Feb 8, 2018 at 3:37 PM,   wrote:
>> On 08.02.2018 10:35, Alex Kiernan wrote:
>>> Using fw_printenv with --noheader fails:
>>>
>>>   root@nrr-922:~# fw_printenv --noheader arch
>>>   ## Error: `-n' option requires exactly one argument
>>
>> I think it would work with --noheader=arch
>>
> 
> It doesn't:
> 
> root@nrr-922:~# fw_printenv --noheader=arch
> ## Error: `-n' option requires exactly one argument
> 
> Probably I should fix the error too as it's misleading.
> 

This comes from getopt_long, so I don't think you can fix it. The getopt
string in parse_printenv_args actually says argument "n" has no argument
(no colon), so it actually is surprising that it prints that...

Maybe this is from the getopt_long call in parse_common_args?

>>>
>>> Whereas -n works:
>>>
>>>   root@nrr-922:~# fw_printenv -n arch
>>>   arm
>>>
>>> The single argument it's expecting isn't taken from getopt parsing,
>>> but instead from the remaining argv arguments.
>>
>> That makes sense. But the commit log text above is kind of unrelated/not
>> relevant, I would just use this two lines as git message.
>>
> 
> Happy to chop it down to the last two lines though as it does include
> the relevant details.

IMHO the error is that struct option long_options ask for an argument
whereas the optstring passed to getopt_long doesn't. The rather erratic
is not really relevant and should not be mentioned.

--
Stefan



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


[U-Boot] [PATCH] ARM: dts: stm32: limit sdio frequency to 14Mhz for stm32f429i-eval

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

This avoids the following errors while reading on mmc:
  Read data bytes CRC error: 0x2
  switch to partitions #0, OK
  mmc0 is current device
  Read data bytes CRC error: 0x82002
  ** Unrecognized filesystem type **

Signed-off-by: Patrice Chotard 
---
 arch/arm/dts/stm32429i-eval.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/stm32429i-eval.dts b/arch/arm/dts/stm32429i-eval.dts
index 362ea4245e5b..4bf53a717d92 100644
--- a/arch/arm/dts/stm32429i-eval.dts
+++ b/arch/arm/dts/stm32429i-eval.dts
@@ -230,6 +230,7 @@
pinctrl-0 = <_pins>;
pinctrl-1 = <_pins_od>;
bus-width = <4>;
+   max-frequency = <1400>;
 };
 
  {
-- 
1.9.1

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


[U-Boot] [PATCH 7/7] clk: clk_stm32f: Add DSI clock support

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

DSI clock is available on STM32F769-disco and
STM32F469-disco board.

Signed-off-by: Yannick Fertre 
Signed-off-by: Patrice Chotard 
---
 drivers/clk/clk_stm32f.c  | 2 +-
 include/dt-bindings/mfd/stm32f7-rcc.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index a683911ebf00..d8eab1a88d7c 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -432,7 +432,7 @@ static ulong stm32_clk_get_rate(struct clk *clk)
return (sysclk >> stm32_get_apb_shift(regs, APB1));
 
/* APB2 CLOCK */
-   case STM32F7_APB2_CLOCK(TIM1) ... STM32F7_APB2_CLOCK(LTDC):
+   case STM32F7_APB2_CLOCK(TIM1) ... STM32F7_APB2_CLOCK(DSI):
switch (clk->id) {
/*
 * particular case for SDMMC1 and SDMMC2 :
diff --git a/include/dt-bindings/mfd/stm32f7-rcc.h 
b/include/dt-bindings/mfd/stm32f7-rcc.h
index 44c091449381..c9087f5f3dac 100644
--- a/include/dt-bindings/mfd/stm32f7-rcc.h
+++ b/include/dt-bindings/mfd/stm32f7-rcc.h
@@ -106,6 +106,7 @@
 #define STM32F7_RCC_APB2_SAI1  22
 #define STM32F7_RCC_APB2_SAI2  23
 #define STM32F7_RCC_APB2_LTDC  26
+#define STM32F7_RCC_APB2_DSI   27
 
 #define STM32F7_APB2_RESET(bit)(STM32F7_RCC_APB2_##bit + (0x24 * 8))
 #define STM32F7_APB2_CLOCK(bit)(STM32F7_RCC_APB2_##bit + 0xA0)
-- 
1.9.1

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


[U-Boot] [PATCH 5/7] clk: clk_stm32f: Configure SAI PLL to generate LTDC pixel clock

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

Configure SAI PLL configuration to generate LTDC pixel clock on
the PLLSAIR output.

PLLSAI is enabled only if CONFIG_VIDEO_STM32 flag is set.

Signed-off-by: Patrice Chotard 
---
 drivers/clk/clk_stm32f.c | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index a687e2acd406..a11d6dc242ba 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -65,13 +65,17 @@
 #define RCC_PLLSAICFGR_PLLSAIR_SHIFT   28
 #define RCC_PLLSAICFGR_PLLSAIP_4   BIT(16)
 #define RCC_PLLSAICFGR_PLLSAIQ_4   BIT(26)
-#define RCC_PLLSAICFGR_PLLSAIR_2   BIT(29)
+#define RCC_PLLSAICFGR_PLLSAIR_3   BIT(29) | BIT(28)
 
 #define RCC_DCKCFGRX_TIMPREBIT(24)
 #define RCC_DCKCFGRX_CK48MSEL  BIT(27)
 #define RCC_DCKCFGRX_SDMMC1SEL BIT(28)
 #define RCC_DCKCFGR2_SDMMC2SEL BIT(29)
 
+#define RCC_DCKCFGR_PLLSAIDIVR_SHIFT16
+#define RCC_DCKCFGR_PLLSAIDIVR_MASKGENMASK(17, 16)
+#define RCC_DCKCFGR_PLLSAIDIVR_2   0
+
 /*
  * RCC AHB1ENR specific definitions
  */
@@ -132,6 +136,8 @@ struct stm32_clk {
unsigned long hse_rate;
 };
 
+static const u8 pllsaidivr_table[] = { 2, 4, 8, 16 };
+
 static int configure_clocks(struct udevice *dev)
 {
struct stm32_clk *priv = dev_get_priv(dev);
@@ -187,11 +193,29 @@ static int configure_clocks(struct udevice *dev)
clrbits_le32(>dckcfgr, RCC_DCKCFGRX_SDMMC1SEL);
}
 
+#ifdef CONFIG_VIDEO_STM32
+   /*
+* Configure the SAI PLL to generate LTDC pixel clock
+*/
+   clrsetbits_le32(>pllsaicfgr, RCC_PLLSAICFGR_PLLSAIR_MASK,
+   RCC_PLLSAICFGR_PLLSAIR_3);
+   clrsetbits_le32(>pllsaicfgr, RCC_PLLSAICFGR_PLLSAIN_MASK,
+   195 << RCC_PLLSAICFGR_PLLSAIN_SHIFT);
+
+   clrsetbits_le32(>dckcfgr, RCC_DCKCFGR_PLLSAIDIVR_MASK,
+   RCC_DCKCFGR_PLLSAIDIVR_2 << 
RCC_DCKCFGR_PLLSAIDIVR_SHIFT);
+#endif
/* Enable the main PLL */
setbits_le32(>cr, RCC_CR_PLLON);
while (!(readl(>cr) & RCC_CR_PLLRDY))
;
 
+#ifdef CONFIG_VIDEO_STM32
+/* Enable the SAI PLL */
+   setbits_le32(>cr, RCC_CR_PLLSAION);
+   while (!(readl(>cr) & RCC_CR_PLLSAIRDY))
+   ;
+#endif
setbits_le32(>apb1enr, RCC_APB1ENR_PWREN);
 
if (priv->info.has_overdrive) {
@@ -361,6 +385,8 @@ static ulong stm32_clk_get_rate(struct clk *clk)
u32 sysclk = 0;
u32 vco;
u32 sdmmcxsel_bit;
+   u32 saidivr;
+   u32 pllsai_rate;
u16 pllm, plln, pllp, pllq;
 
if ((readl(>cfgr) & RCC_CFGR_SWS_MASK) ==
@@ -438,6 +464,15 @@ static ulong stm32_clk_get_rate(struct clk *clk)
case STM32F7_APB2_CLOCK(TIM11):
return stm32_get_timer_rate(priv, sysclk, APB2);
break;
+
+   /* particular case for LTDC clock */
+   case STM32F7_APB2_CLOCK(LTDC):
+   saidivr = readl(>dckcfgr);
+   saidivr = (saidivr & RCC_DCKCFGR_PLLSAIDIVR_MASK)
+ >> RCC_DCKCFGR_PLLSAIDIVR_SHIFT;
+   pllsai_rate = stm32_clk_get_pllsai_rate(priv, PLLSAIR);
+
+   return pllsai_rate / pllsaidivr_table[saidivr];
}
return (sysclk >> stm32_get_apb_shift(regs, APB2));
 
-- 
1.9.1

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


[U-Boot] [PATCH 6/7] clk: clk_stm32f: Add set_rate for LTDC clock

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

Implement set_rate() for LTDC clock only, set_rate for other
clocks will be added if needed. This is needed by future LTDC driver
improvements.

Signed-off-by: Patrice Chotard 
---
 drivers/clk/clk_stm32f.c | 100 +++
 1 file changed, 100 insertions(+)

diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index a11d6dc242ba..a683911ebf00 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -136,6 +136,9 @@ struct stm32_clk {
unsigned long hse_rate;
 };
 
+#ifdef CONFIG_VIDEO_STM32
+static const u8 plldivr_table[] = { 0, 0, 2, 3, 4, 5, 6, 7 };
+#endif
 static const u8 pllsaidivr_table[] = { 2, 4, 8, 16 };
 
 static int configure_clocks(struct udevice *dev)
@@ -484,7 +487,104 @@ static ulong stm32_clk_get_rate(struct clk *clk)
 
 static ulong stm32_set_rate(struct clk *clk, ulong rate)
 {
+#ifdef CONFIG_VIDEO_STM32
+   struct stm32_clk *priv = dev_get_priv(clk->dev);
+   struct stm32_rcc_regs *regs = priv->base;
+   u32 pllsair_rate, pllsai_vco_rate, current_rate;
+   u32 best_div, best_diff, diff;
+   u16 div;
+   u8 best_plldivr, best_pllsaidivr;
+   u8 i, j;
+   bool found = false;
+
+   /* Only set_rate for LTDC clock is implemented */
+   if (clk->id != STM32F7_APB2_CLOCK(LTDC)) {
+   pr_err("set_rate not implemented for clock index %ld\n",
+  clk->id);
+   return 0;
+   }
+
+   if (rate == stm32_clk_get_rate(clk))
+   /* already set to requested rate */
+   return rate;
+
+   /* get the current PLLSAIR output freq */
+   pllsair_rate = stm32_clk_get_pllsai_rate(priv, PLLSAIR);
+   best_div = pllsair_rate / rate;
+
+   /* look into pllsaidivr_table if this divider is available*/
+   for (i = 0 ; i < sizeof(pllsaidivr_table); i++)
+   if (best_div == pllsaidivr_table[i]) {
+   /* set pll_saidivr with found value */
+   clrsetbits_le32(>dckcfgr,
+   RCC_DCKCFGR_PLLSAIDIVR_MASK,
+   pllsaidivr_table[i]);
+   return rate;
+   }
+
+   /*
+* As no pllsaidivr value is suitable to obtain requested freq,
+* test all combination of pllsaidivr * pllsair and find the one
+* which give freq closest to requested rate.
+*/
+
+   pllsai_vco_rate = stm32_clk_get_pllsai_vco_rate(priv);
+   best_diff = ULONG_MAX;
+   best_pllsaidivr = 0;
+   best_plldivr = 0;
+   /*
+* start at index 2 of plldivr_table as divider value at index 0
+* and 1 are 0)
+*/
+   for (i = 2; i < sizeof(plldivr_table); i++) {
+   for (j = 0; j < sizeof(pllsaidivr_table); j++) {
+   div = plldivr_table[i] * pllsaidivr_table[j];
+   current_rate = pllsai_vco_rate / div;
+   /* perfect combination is found ? */
+   if (current_rate == rate) {
+   best_pllsaidivr = j;
+   best_plldivr = i;
+   found = true;
+   break;
+   }
+
+   diff = (current_rate > rate) ?
+  current_rate - rate : rate - current_rate;
+
+   /* found a better combination ? */
+   if (diff < best_diff) {
+   best_diff = diff;
+   best_pllsaidivr = j;
+   best_plldivr = i;
+   }
+   }
+
+   if (found)
+   break;
+   }
+
+   /* Disable the SAI PLL */
+   clrbits_le32(>cr, RCC_CR_PLLSAION);
+
+   /* set pll_saidivr with found value */
+   clrsetbits_le32(>dckcfgr, RCC_DCKCFGR_PLLSAIDIVR_MASK,
+   best_pllsaidivr << RCC_DCKCFGR_PLLSAIDIVR_SHIFT);
+
+   /* set pllsair with found value */
+   clrsetbits_le32(>pllsaicfgr, RCC_PLLSAICFGR_PLLSAIR_MASK,
+   plldivr_table[best_plldivr]
+   << RCC_PLLSAICFGR_PLLSAIR_SHIFT);
+
+   /* Enable the SAI PLL */
+   setbits_le32(>cr, RCC_CR_PLLSAION);
+   while (!(readl(>cr) & RCC_CR_PLLSAIRDY))
+   ;
+
+   div = plldivr_table[best_plldivr] * pllsaidivr_table[best_pllsaidivr];
+   return pllsai_vco_rate / div;
+#else
return 0;
+#endif
 }
 
 static int stm32_clk_enable(struct clk *clk)
-- 
1.9.1

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


[U-Boot] [PATCH 3/7] clk: clk_stm32f: No more need of 48Mhz from PLL_SAI

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

Initially, 48Mhz for SDIO clock was generated from SAI pll for
STM32F469 and STM32F746 SoCs, but this solution was not suitable
for STM32F429 SoCs.

A generic solution is to used the PLL_Q output as 48Mhz clock
for all STM32F SOCs family.

Signed-off-by: Patrice Chotard 
---
 drivers/clk/clk_stm32f.c | 29 -
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index 7d89906379af..e8f6b47acc17 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -128,7 +128,6 @@ static int configure_clocks(struct udevice *dev)
struct stm32_rcc_regs *regs = priv->base;
struct stm32_pwr_regs *pwr = priv->pwr_regs;
struct pll_psc *sys_pll_psc = >info.sys_pll_psc;
-   u32 pllsaicfgr = 0;
 
/* Reset RCC configuration */
setbits_le32(>cr, RCC_CR_HSION);
@@ -160,20 +159,10 @@ static int configure_clocks(struct udevice *dev)
clrsetbits_le32(>pllcfgr, RCC_PLLCFGR_PLLQ_MASK,
sys_pll_psc->pll_q << RCC_PLLCFGR_PLLQ_SHIFT);
 
-   /* Configure the SAI PLL to get a 48 MHz source */
-   pllsaicfgr = RCC_PLLSAICFGR_PLLSAIR_2 | RCC_PLLSAICFGR_PLLSAIQ_4 |
-RCC_PLLSAICFGR_PLLSAIP_4;
-   pllsaicfgr |= 192 << RCC_PLLSAICFGR_PLLSAIN_SHIFT;
-   writel(pllsaicfgr, >pllsaicfgr);
-
-   /* Enable the main PLL */
-   setbits_le32(>cr, RCC_CR_PLLON);
-   while (!(readl(>cr) & RCC_CR_PLLRDY))
-   ;
-
+   /* configure SDMMC clock */
if (priv->info.v2) { /*stm32f7 case */
-   /* select PLLSAI as 48MHz clock source */
-   setbits_le32(>dckcfgr2, RCC_DCKCFGRX_CK48MSEL);
+   /* select PLLQ as 48MHz clock source */
+   clrbits_le32(>dckcfgr2, RCC_DCKCFGRX_CK48MSEL);
 
/* select 48MHz as SDMMC1 clock source */
clrbits_le32(>dckcfgr2, RCC_DCKCFGRX_SDMMC1SEL);
@@ -181,16 +170,16 @@ static int configure_clocks(struct udevice *dev)
/* select 48MHz as SDMMC2 clock source */
clrbits_le32(>dckcfgr2, RCC_DCKCFGR2_SDMMC2SEL);
} else  { /* stm32f4 case */
-   /* select PLLSAI as 48MHz clock source */
-   setbits_le32(>dckcfgr, RCC_DCKCFGRX_CK48MSEL);
+   /* select PLLQ as 48MHz clock source */
+   clrbits_le32(>dckcfgr, RCC_DCKCFGRX_CK48MSEL);
 
/* select 48MHz as SDMMC1 clock source */
clrbits_le32(>dckcfgr, RCC_DCKCFGRX_SDMMC1SEL);
}
 
-   /* Enable the SAI PLL */
-   setbits_le32(>cr, RCC_CR_PLLSAION);
-   while (!(readl(>cr) & RCC_CR_PLLSAIRDY))
+   /* Enable the main PLL */
+   setbits_le32(>cr, RCC_CR_PLLON);
+   while (!(readl(>cr) & RCC_CR_PLLRDY))
;
 
setbits_le32(>apb1enr, RCC_APB1ENR_PWREN);
@@ -218,8 +207,6 @@ static int configure_clocks(struct udevice *dev)
while ((readl(>cfgr) & RCC_CFGR_SWS_MASK) !=
RCC_CFGR_SWS_PLL)
;
-   /* gate the SAI clock, needed for MMC 1&2 clocks */
-   setbits_le32(>apb2enr, RCC_APB2ENR_SAI1EN);
 
 #ifdef CONFIG_ETH_DESIGNWARE
/* gate the SYSCFG clock, needed to set RMII ethernet interface */
-- 
1.9.1

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


[U-Boot] [PATCH 1/7] clk: clk_stm32f: Fix stm32_clk_get_rate()

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

Wrong parameter was passed to stm32_clk_pll48clk_rate().
sysclk (PLL_p output value) was passed instead of VCO value.

Signed-off-by: Patrice Chotard 
---
 drivers/clk/clk_stm32f.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index f1f02995d9c0..41d8b5e5c88a 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -230,7 +230,7 @@ static int configure_clocks(struct udevice *dev)
 }
 
 static unsigned long stm32_clk_pll48clk_rate(struct stm32_clk *priv,
-u32 sysclk)
+u32 vco)
 {
struct stm32_rcc_regs *regs = priv->base;
u16 pllq, pllm, pllsain, pllsaip;
@@ -254,7 +254,7 @@ static unsigned long stm32_clk_pll48clk_rate(struct 
stm32_clk *priv,
return ((priv->hse_rate / pllm) * pllsain) / pllsaip;
}
/* PLL48CLK is selected from PLLQ */
-   return sysclk / pllq;
+   return vco / pllq;
 }
 
 static bool stm32_get_timpre(struct stm32_clk *priv)
@@ -337,6 +337,7 @@ static ulong stm32_clk_get_rate(struct clk *clk)
struct stm32_clk *priv = dev_get_priv(clk->dev);
struct stm32_rcc_regs *regs = priv->base;
u32 sysclk = 0;
+   u32 vco;
u16 pllm, plln, pllp;
 
if ((readl(>cfgr) & RCC_CFGR_SWS_MASK) ==
@@ -346,7 +347,8 @@ static ulong stm32_clk_get_rate(struct clk *clk)
>> RCC_PLLCFGR_PLLN_SHIFT);
pllp = readl(>pllcfgr) & RCC_PLLCFGR_PLLP_MASK)
>> RCC_PLLCFGR_PLLP_SHIFT) + 1) << 1);
-   sysclk = ((priv->hse_rate / pllm) * plln) / pllp;
+   vco = (priv->hse_rate / pllm) * plln;
+   sysclk = vco / pllp;
} else {
return -EINVAL;
}
@@ -388,14 +390,14 @@ static ulong stm32_clk_get_rate(struct clk *clk)
/* System clock is selected as SDMMC1 clock */
return sysclk;
else
-   return stm32_clk_pll48clk_rate(priv, sysclk);
+   return stm32_clk_pll48clk_rate(priv, vco);
break;
case STM32F7_APB2_CLOCK(SDMMC2):
if (readl(>dckcfgr2) & RCC_DCKCFGR2_SDMMC2SEL)
/* System clock is selected as SDMMC2 clock */
return sysclk;
else
-   return stm32_clk_pll48clk_rate(priv, sysclk);
+   return stm32_clk_pll48clk_rate(priv, vco);
break;
 
/* For timer clock, an additionnal prescaler is used*/
-- 
1.9.1

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


[U-Boot] [PATCH 4/7] clk: clk_stm32f: Rework SDMMC stm32_clk_get_rate() part

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

Rework the way SDMMC clock get rate is done in a more
generic way :

_ Add stm32_clk_get_pllsai_rate() which give the PLLSAI
  indicated output rate.

_ Add stm32_clk_get_pllsai_vco_rate() which give the VCO
  internal rate.

Signed-off-by: Patrice Chotard 
---
 drivers/clk/clk_stm32f.c | 105 +--
 1 file changed, 74 insertions(+), 31 deletions(-)

diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index e8f6b47acc17..a687e2acd406 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -57,8 +57,12 @@
 
 #define RCC_PLLSAICFGR_PLLSAIN_MASKGENMASK(14, 6)
 #define RCC_PLLSAICFGR_PLLSAIP_MASKGENMASK(17, 16)
+#define RCC_PLLSAICFGR_PLLSAIQ_MASKGENMASK(27, 24)
+#define RCC_PLLSAICFGR_PLLSAIR_MASKGENMASK(30, 28)
 #define RCC_PLLSAICFGR_PLLSAIN_SHIFT   6
 #define RCC_PLLSAICFGR_PLLSAIP_SHIFT   16
+#define RCC_PLLSAICFGR_PLLSAIQ_SHIFT   24
+#define RCC_PLLSAICFGR_PLLSAIR_SHIFT   28
 #define RCC_PLLSAICFGR_PLLSAIP_4   BIT(16)
 #define RCC_PLLSAICFGR_PLLSAIQ_4   BIT(26)
 #define RCC_PLLSAICFGR_PLLSAIR_2   BIT(29)
@@ -87,6 +91,12 @@
 #define RCC_APB2ENR_SYSCFGEN   BIT(14)
 #define RCC_APB2ENR_SAI1EN BIT(22)
 
+enum pllsai_div {
+   PLLSAIP,
+   PLLSAIQ,
+   PLLSAIR,
+};
+
 static const struct stm32_clk_info stm32f4_clk_info = {
/* 180 MHz */
.sys_pll_psc = {
@@ -216,32 +226,57 @@ static int configure_clocks(struct udevice *dev)
return 0;
 }
 
-static unsigned long stm32_clk_pll48clk_rate(struct stm32_clk *priv,
-u32 vco)
+static bool stm32_clk_get_ck48msel(struct stm32_clk *priv)
 {
struct stm32_rcc_regs *regs = priv->base;
-   u16 pllq, pllm, pllsain, pllsaip;
-   bool pllsai;
-
-   pllq = (readl(>pllcfgr) & RCC_PLLCFGR_PLLQ_MASK)
-  >> RCC_PLLCFGR_PLLQ_SHIFT;
 
if (priv->info.v2) /*stm32f7 case */
-   pllsai = readl(>dckcfgr2) & RCC_DCKCFGRX_CK48MSEL;
+   return readl(>dckcfgr2) & RCC_DCKCFGRX_CK48MSEL;
else
-   pllsai = readl(>dckcfgr) & RCC_DCKCFGRX_CK48MSEL;
 
-   if (pllsai) {
-   /* PLL48CLK is selected from PLLSAI, get PLLSAI value */
-   pllm = (readl(>pllcfgr) & RCC_PLLCFGR_PLLM_MASK);
-   pllsain = ((readl(>pllsaicfgr) & 
RCC_PLLSAICFGR_PLLSAIN_MASK)
-   >> RCC_PLLSAICFGR_PLLSAIN_SHIFT);
-   pllsaip = readl(>pllsaicfgr) & 
RCC_PLLSAICFGR_PLLSAIP_MASK)
-   >> RCC_PLLSAICFGR_PLLSAIP_SHIFT) + 1) << 1);
-   return ((priv->hse_rate / pllm) * pllsain) / pllsaip;
+   return readl(>dckcfgr) & RCC_DCKCFGRX_CK48MSEL;
+}
+
+static unsigned long stm32_clk_get_pllsai_vco_rate(struct stm32_clk *priv)
+{
+   struct stm32_rcc_regs *regs = priv->base;
+   u16 pllm, pllsain;
+
+   pllm = (readl(>pllcfgr) & RCC_PLLCFGR_PLLM_MASK);
+   pllsain = ((readl(>pllsaicfgr) & RCC_PLLSAICFGR_PLLSAIN_MASK)
+ >> RCC_PLLSAICFGR_PLLSAIN_SHIFT);
+
+   return ((priv->hse_rate / pllm) * pllsain);
+}
+
+static unsigned long stm32_clk_get_pllsai_rate(struct stm32_clk *priv,
+  enum pllsai_div output)
+{
+   struct stm32_rcc_regs *regs = priv->base;
+   u16 pll_div_output;
+
+   switch (output) {
+   case PLLSAIP:
+   pll_div_output = readl(>pllsaicfgr)
+ & RCC_PLLSAICFGR_PLLSAIP_MASK)
+ >> RCC_PLLSAICFGR_PLLSAIP_SHIFT) + 1) << 1);
+   break;
+   case PLLSAIQ:
+   pll_div_output = (readl(>pllsaicfgr)
+ & RCC_PLLSAICFGR_PLLSAIQ_MASK)
+ >> RCC_PLLSAICFGR_PLLSAIQ_SHIFT;
+   break;
+   case PLLSAIR:
+   pll_div_output = (readl(>pllsaicfgr)
+ & RCC_PLLSAICFGR_PLLSAIR_MASK)
+ >> RCC_PLLSAICFGR_PLLSAIR_SHIFT;
+   break;
+   default:
+   pr_err("incorrect PLLSAI output %d\n", output);
+   return -EINVAL;
}
-   /* PLL48CLK is selected from PLLQ */
-   return vco / pllq;
+
+   return (stm32_clk_get_pllsai_vco_rate(priv) / pll_div_output);
 }
 
 static bool stm32_get_timpre(struct stm32_clk *priv)
@@ -325,7 +360,8 @@ static ulong stm32_clk_get_rate(struct clk *clk)
struct stm32_rcc_regs *regs = priv->base;
u32 sysclk = 0;
u32 vco;
-   u16 pllm, plln, pllp;
+   u32 sdmmcxsel_bit;
+   u16 pllm, plln, pllp, pllq;
 
if ((readl(>cfgr) & RCC_CFGR_SWS_MASK) ==
RCC_CFGR_SWS_PLL) {
@@ -334,6 +370,8 @@ static ulong stm32_clk_get_rate(struct clk *clk)
>> RCC_PLLCFGR_PLLN_SHIFT);

[U-Boot] [PATCH 2/7] clk: clk_stm32f: Fix RCC_PLLSAICFGR mask defines

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

Use the correct name for RCC_PLLSAICFGR_PLLSAIx_MASK masks.

Signed-off-by: Patrice Chotard 
---
 drivers/clk/clk_stm32f.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index 41d8b5e5c88a..7d89906379af 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -55,8 +55,8 @@
 #define RCC_CFGR_PPRE1_SHIFT   10
 #define RCC_CFGR_PPRE2_SHIFT   13
 
-#define RCC_PLLCFGR_PLLSAIN_MASK   GENMASK(14, 6)
-#define RCC_PLLCFGR_PLLSAIP_MASK   GENMASK(17, 16)
+#define RCC_PLLSAICFGR_PLLSAIN_MASKGENMASK(14, 6)
+#define RCC_PLLSAICFGR_PLLSAIP_MASKGENMASK(17, 16)
 #define RCC_PLLSAICFGR_PLLSAIN_SHIFT   6
 #define RCC_PLLSAICFGR_PLLSAIP_SHIFT   16
 #define RCC_PLLSAICFGR_PLLSAIP_4   BIT(16)
@@ -247,9 +247,9 @@ static unsigned long stm32_clk_pll48clk_rate(struct 
stm32_clk *priv,
if (pllsai) {
/* PLL48CLK is selected from PLLSAI, get PLLSAI value */
pllm = (readl(>pllcfgr) & RCC_PLLCFGR_PLLM_MASK);
-   pllsain = ((readl(>pllsaicfgr) & RCC_PLLCFGR_PLLSAIN_MASK)
+   pllsain = ((readl(>pllsaicfgr) & 
RCC_PLLSAICFGR_PLLSAIN_MASK)
>> RCC_PLLSAICFGR_PLLSAIN_SHIFT);
-   pllsaip = readl(>pllsaicfgr) & 
RCC_PLLCFGR_PLLSAIP_MASK)
+   pllsaip = readl(>pllsaicfgr) & 
RCC_PLLSAICFGR_PLLSAIP_MASK)
>> RCC_PLLSAICFGR_PLLSAIP_SHIFT) + 1) << 1);
return ((priv->hse_rate / pllm) * pllsain) / pllsaip;
}
-- 
1.9.1

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


[U-Boot] [PATCH 0/7] clk: clk_stm32f: update and fixes

2018-02-08 Thread patrice.chotard
From: Patrice Chotard 

This series :
  _ Fixes one issue stm32_clk_get_rate()
  _ Update the SDMMC clock generation across all STM32F SoCs
  _ Adds LTDC clock generation from PLLSAI
  _ Adds set_rate() for LTDC clock
  _ Adds DSI clock support

Patrice Chotard (7):
  clk: clk_stm32f: Fix stm32_clk_get_rate()
  clk: clk_stm32f: Fix RCC_PLLSAICFGR mask defines
  clk: clk_stm32f: No more need of 48Mhz from PLL_SAI
  clk: clk_stm32f: Rework SDMMC stm32_clk_get_rate() part
  clk: clk_stm32f: Configure SAI PLL to generate LTDC pixel clock
  clk: clk_stm32f: Add set_rate for LTDC clock
  clk: clk_stm32f: Add DSI clock support

 drivers/clk/clk_stm32f.c  | 279 +++---
 include/dt-bindings/mfd/stm32f7-rcc.h |   1 +
 2 files changed, 224 insertions(+), 56 deletions(-)

-- 
1.9.1

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


Re: [U-Boot] [PATCH v6 00/25] Fix and extend i.MX HAB layer

2018-02-08 Thread Bryan O'Donoghue




I'm observing authentication issue while loading U-Boot proper, U-Boot
proper now have features like SPL DM and SPL FIT etc

U-Boot SPL 2018.03-rc1-00182-gb81f7c9 (Feb 08 2018 - 17:19:03 +0530)
Trying to boot from MMC1
Expected Linux image is not found. Trying to start U-boot

Authenticate image from DDR location 0x1780...
bad magic magic=0xb8 length=0x841b version=0x17
bad length magic=0xb8 length=0x841b version=0x17
bad version magic=0xb8 length=0x841b version=0x17
spl: ERROR:  image authentication unsuccessful
### ERROR ### Please RESET the board ###

Please let me know where I missed, I'm authenticating SPL and
u-boot-dtb.img now.


Can you please check if the generated u-boot-dtb.img contains a IVT
table appended in the end of the image?

The mx6slevk_spl_defconfig target also generates SPL + u-boot-dtb.img
but I have to use the u-boot-ivt.img binary instead. In my case
u-boot-dtb.img does not includes a IVT table.

Best Regards,
Breno Lima



At a guess I'd say it's the fix we did for hab_auth_img - I guess Jagan 
you have an out-of-tree implementation here ?


If you have a command in your environment that looks like this

hab_auth_img 0x1780 0x1

that should now be

hab_auth_img 0x1780 0x1 0xF400

assuming the CSF footer is aprox 0xC00 bytes padded.

git show c5800b2

arm: imx: hab: Fix authenticate_image input parameters

1: Adding a new parameter to hab_auth_img
   - addr   : image hex address
   - length : total length of the image
   - offset : offset of IVT from addr

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


Re: [U-Boot] [PATCH] Fix --noheader on fw_printenv

2018-02-08 Thread Alex Kiernan
On Thu, Feb 8, 2018 at 3:37 PM,   wrote:
> On 08.02.2018 10:35, Alex Kiernan wrote:
>> Using fw_printenv with --noheader fails:
>>
>>   root@nrr-922:~# fw_printenv --noheader arch
>>   ## Error: `-n' option requires exactly one argument
>
> I think it would work with --noheader=arch
>

It doesn't:

root@nrr-922:~# fw_printenv --noheader=arch
## Error: `-n' option requires exactly one argument

Probably I should fix the error too as it's misleading.

>>
>> Whereas -n works:
>>
>>   root@nrr-922:~# fw_printenv -n arch
>>   arm
>>
>> The single argument it's expecting isn't taken from getopt parsing,
>> but instead from the remaining argv arguments.
>
> That makes sense. But the commit log text above is kind of unrelated/not
> relevant, I would just use this two lines as git message.
>

Happy to chop it down to the last two lines though as it does include
the relevant details.

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


Re: [U-Boot] [PATCH] Fix --noheader on fw_printenv

2018-02-08 Thread stefan
On 08.02.2018 10:35, Alex Kiernan wrote:
> Using fw_printenv with --noheader fails:
> 
>   root@nrr-922:~# fw_printenv --noheader arch
>   ## Error: `-n' option requires exactly one argument

I think it would work with --noheader=arch

> 
> Whereas -n works:
> 
>   root@nrr-922:~# fw_printenv -n arch
>   arm
> 
> The single argument it's expecting isn't taken from getopt parsing,
> but instead from the remaining argv arguments.

That makes sense. But the commit log text above is kind of unrelated/not
relevant, I would just use this two lines as git message.

--
Stefan

> 
> Signed-off-by: Alex Kiernan 
> ---
> 
>  tools/env/fw_env_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
> index 6fdf41c..d93a915 100644
> --- a/tools/env/fw_env_main.c
> +++ b/tools/env/fw_env_main.c
> @@ -46,7 +46,7 @@ static struct option long_options[] = {
>   {"config", required_argument, NULL, 'c'},
>   {"help", no_argument, NULL, 'h'},
>   {"script", required_argument, NULL, 's'},
> - {"noheader", required_argument, NULL, 'n'},
> + {"noheader", no_argument, NULL, 'n'},
>   {"lock", required_argument, NULL, 'l'},
>   {"version", no_argument, NULL, 'v'},
>   {NULL, 0, NULL, 0}
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v6 00/25] Fix and extend i.MX HAB layer

2018-02-08 Thread Breno Matheus Lima
Hi Jagan,

2018-02-08 10:43 GMT-02:00 Jagan Teki :
> On Fri, Jan 12, 2018 at 6:09 PM, Bryan O'Donoghue
>  wrote:
>> v6:
>> - Added patch 21/25 return zero on open (unlocked) board when
>>   calling authenticate_image() - Breno
>>
>> - Added Tested-by: Breno Matheus Lima 
>>   as indicated for remainder 24/25 patches
>>
>> - Added Reviewed-by: Fabio Estevam 
>>   as indicated for remainder 24/25 patches
>>
>> v5:
>> - Drop dcache disable across HAB call.
>>   We can't replicate this error on the current codebase and the available
>>   images. We'll have to wait for the error to crop up again before pushing
>>   that patch any further.
>>
>> v4:
>> - No change mixed extra patches @ v3 unnoticed with previous
>>   git-send
>>
>> v3:
>> - Only call into ROM if headers are verified. - Bryan
>>
>> - Print HAB event log if and only if a call was made to HAB
>>   and a meaningful status code has been obtained. - Breno
>>
>> v2:
>> - Fix compilation warnings and errors in SPL highlighted by
>>   Breno Matheus Lima
>>
>> - Add CC: Breno Matheus Lima  to all patches
>>
>> v1:
>> This patchset updates the i.MX HAB layer in u-boot to fix a list of
>> identified issues and then to add and extend existing functionality.
>>
>> The first block of patches 0001-0006 deal with fixing existing code,
>>
>> - Fixes indentation
>> - Fixes the treatment of input parameters to hab_auth_image.
>>
>> The second block of patches 0007-0013 are about tidying up the HAB code
>>
>> - Remove reliance on hard-coding to specific offsets
>> - IVT header drives locating CSF
>> - Continue to support existing boards
>>
>> Patches 0014 onwards extend out the HAB functionality.
>>
>> - hab_rvt_check_target is a recommended check in the NXP documents to
>>   perform prior to hab_rvt_authenticate_image
>> - hab_rvt_failsafe is a useful function to set the board into BootROM
>>   USB recovery mode.
>>
>>
>>
>> Bryan O'Donoghue (25):
>>   arm: imx: hab: Make authenticate_image return int
>>   arm: imx: hab: Fix authenticate_image result code
>>   arm: imx: hab: Optimise flow of authenticate_image on is_enabled fail
>>   arm: imx: hab: Optimise flow of authenticate_image on hab_entry fail
>>   arm: imx: hab: Move IVT_SIZE to hab.h
>>   arm: imx: hab: Move CSF_PAD_SIZE to hab.h
>>   arm: imx: hab: Fix authenticate_image input parameters
>>   arm: imx: hab: Add IVT header definitions
>>   arm: imx: hab: Add IVT header verification
>>   arm: imx: hab: Verify IVT self matches calculated address
>>   arm: imx: hab: Only call ROM once headers are verified
>>   arm: imx: hab: Print CSF based on IVT descriptor
>>   arm: imx: hab: Print additional IVT elements during debug
>>   arm: imx: hab: Define rvt_check_target()
>>   arm: imx: hab: Implement hab_rvt_check_target
>>   arm: imx: hab: Add a hab_rvt_check_target to image auth
>>   arm: imx: hab: Print HAB event log only after calling ROM
>>   arm: imx: hab: Make internal functions and data static
>>   arm: imx: hab: Prefix authenticate_image with imx_hab
>>   arm: imx: hab: Rename is_hab_enabled imx_hab_is_enabled
>>   arm: imx: hab: Make authenticate_image() return zero on open boards
>>   arm: imx: hab: Make imx_hab_is_enabled global
>>   arm: imx: hab: Define rvt_failsafe()
>>   arm: imx: hab: Implement hab_rvt_failsafe
>>   arm: imx: hab: Add hab_failsafe console command
>>
>>  arch/arm/include/asm/mach-imx/hab.h |  46 +++-
>>  arch/arm/mach-imx/hab.c | 461 
>> +---
>>  arch/arm/mach-imx/spl.c |  38 ++-
>>  3 files changed, 354 insertions(+), 191 deletions(-)
>
> I tried Secure boot before[1] with SPL and U-Boot proper and work well.
>
> I'm observing authentication issue while loading U-Boot proper, U-Boot
> proper now have features like SPL DM and SPL FIT etc
>
> U-Boot SPL 2018.03-rc1-00182-gb81f7c9 (Feb 08 2018 - 17:19:03 +0530)
> Trying to boot from MMC1
> Expected Linux image is not found. Trying to start U-boot
>
> Authenticate image from DDR location 0x1780...
> bad magic magic=0xb8 length=0x841b version=0x17
> bad length magic=0xb8 length=0x841b version=0x17
> bad version magic=0xb8 length=0x841b version=0x17
> spl: ERROR:  image authentication unsuccessful
> ### ERROR ### Please RESET the board ###
>
> Please let me know where I missed, I'm authenticating SPL and
> u-boot-dtb.img now.

Can you please check if the generated u-boot-dtb.img contains a IVT
table appended in the end of the image?

The mx6slevk_spl_defconfig target also generates SPL + u-boot-dtb.img
but I have to use the u-boot-ivt.img binary instead. In my case
u-boot-dtb.img does not includes a IVT table.

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


Re: [U-Boot] [U-Boot,v3,1/2] bcm283x: Add pinctrl driver

2018-02-08 Thread Heinrich Schuchardt
On 02/08/2018 10:49 AM, Jonathan Gray wrote:
> On Thu, Feb 08, 2018 at 08:10:47PM +1100, Jonathan Gray wrote:
>> On Thu, Feb 08, 2018 at 09:11:20AM +0100, Alexander Graf wrote:
>>>
>>>
 Am 08.02.2018 um 06:49 schrieb Jonathan Gray :

 On Mon, Feb 05, 2018 at 11:31:42AM +0100, Mark Kettenis wrote:
>> Date: Mon, 5 Feb 2018 21:06:59 +1100
>> From: Jonathan Gray 
>>
 booting sd0a:/bsd: open sd0a:/bsd: Device not configured
 failed(6). will try /bsd
>>>
>>> How do you find out that it's sd0a instead of sd1a?
>>
>> The loaded image protocol I believe.
>
> Actually the OpenBSD bootloader currently only supports loading the
> bsd kernel from the same device as the bootloader.  It will always
> call that device sd0.  It invokes the device path protocol on the
> loaded image handle and then matches that path to a device that
> supports the block io protocol.

 Perhaps the problem is elsewhere as U-Boot master also broke
 vexpress_ca15_tc2 and mx6cuboxi targets:
>>>
>>> Perfect, so can you quickly bisect it now that the bisect doesn???t end at 
>>> the pinctrl driver?
>>
>> On cubox a bisect points to
>>
>> commit 64e4db0f119151a1345e1da19d152eda550394e7
>> Author: Heinrich Schuchardt 
>> Date:   Fri Jan 19 20:24:47 2018 +0100
>>
>> efi_loader: make efi_disk_create_partitions a global symbol
>> 
>> Up to now we have been using efi_disk_create_partitions() to create
>> partitions for block devices that existed before starting an EFI
>> application.
>> 
>> We need to call it for block devices created by EFI
>> applications at run time. The EFI application will define the
>> handle for the block device and install a device path protocol
>> on it. We have to use this device path as stem for the partition
>> device paths.
>> 
>> Signed-off-by: Heinrich Schuchardt 
>> Signed-off-by: Alexander Graf 
>>
>>  include/efi_loader.h  |  4 +++
>>  lib/efi_loader/efi_disk.c | 84 
>> +++
>>  2 files changed, 64 insertions(+), 24 deletions(-)
>>
>> If I revert this commit a image built from master works.
> 
> Actually master doesn't build with just that reverted, seems I had stale
> object files.

When bisecting running
'make mrproper && make foo_defconfig && make'
in each round is recommendable.

Do you still assume a problem that requires a change in U-Boot?
Or can we close the topic?

Best regards

Heinrich


> 
> rpi3 with the commit just before boots
> 
> 98d48bdf415e318a11f9f9a44dff2b70aef3fb10
> efi_loader: provide a function to create a partition node
> 
> U-Boot 2018.01-00408-gb7b3517a7f (Feb 08 2018 - 22:35:55 +1300)
> 
> DRAM:  948 MiB
> RPI 3 Model B (0xa02082)
> MMC:   sdhci@7e30: 0
> In:serial
> Out:   vidconsole
> Err:   vidconsole
> Net:   No ethernet found.
> starting USB...
> USB0: Core Release: 2.80a
> scanning bus 0 for devices... 4 USB Device(s) found
>scanning usb for storage devices... 1 Storage Device(s) found
> Hit any key to stop autoboot:  0
> 
> Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra
>   Type: Removable Hard Disk
>   Capacity: 29327.3 MB = 28.6 GB (60062500 x 512)
> ... is now current device
> Scanning usb 0:1...
> Found EFI removable media binary efi/boot/bootaa64.efi
> unhandled parent class: usb_mass_storage.lun0 (13)
> 82748 bytes read in 89 ms (907.2 KiB/s)
> ## Starting EFI application at 0100 ...
> Scanning disk sd...@7e30.blk...
> unhandled parent class: sd...@7e30.blk (13)
> unhandled parent class: sd...@7e30.blk (13)
> unhandled parent class: sd...@7e30.blk (13)
> Scanning disk usb_mass_storage.lun0...
> unhandled parent class: usb_mass_storage.lun0 (13)
> unhandled parent class: usb_mass_storage.lun0 (13)
> unhandled parent class: usb_mass_storage.lun0 (13)
> Found 6 disks
>>> OpenBSD/arm64 BOOTAA64 0.11
> boot>
> booting sd0a:/bsd: 
> 3917796+579072+585220+806860-[280094+96+459168+244083]=0x8442a8
> 

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


Re: [U-Boot] [PATCH v6 00/25] Fix and extend i.MX HAB layer

2018-02-08 Thread Bryan O'Donoghue



On 08/02/18 12:43, Jagan Teki wrote:

On Fri, Jan 12, 2018 at 6:09 PM, Bryan O'Donoghue
 wrote:

v6:
- Added patch 21/25 return zero on open (unlocked) board when
   calling authenticate_image() - Breno

- Added Tested-by: Breno Matheus Lima 
   as indicated for remainder 24/25 patches

- Added Reviewed-by: Fabio Estevam 
   as indicated for remainder 24/25 patches

v5:
- Drop dcache disable across HAB call.
   We can't replicate this error on the current codebase and the available
   images. We'll have to wait for the error to crop up again before pushing
   that patch any further.

v4:
- No change mixed extra patches @ v3 unnoticed with previous
   git-send

v3:
- Only call into ROM if headers are verified. - Bryan

- Print HAB event log if and only if a call was made to HAB
   and a meaningful status code has been obtained. - Breno

v2:
- Fix compilation warnings and errors in SPL highlighted by
   Breno Matheus Lima

- Add CC: Breno Matheus Lima  to all patches

v1:
This patchset updates the i.MX HAB layer in u-boot to fix a list of
identified issues and then to add and extend existing functionality.

The first block of patches 0001-0006 deal with fixing existing code,

- Fixes indentation
- Fixes the treatment of input parameters to hab_auth_image.

The second block of patches 0007-0013 are about tidying up the HAB code

- Remove reliance on hard-coding to specific offsets
- IVT header drives locating CSF
- Continue to support existing boards

Patches 0014 onwards extend out the HAB functionality.

- hab_rvt_check_target is a recommended check in the NXP documents to
   perform prior to hab_rvt_authenticate_image
- hab_rvt_failsafe is a useful function to set the board into BootROM
   USB recovery mode.



Bryan O'Donoghue (25):
   arm: imx: hab: Make authenticate_image return int
   arm: imx: hab: Fix authenticate_image result code
   arm: imx: hab: Optimise flow of authenticate_image on is_enabled fail
   arm: imx: hab: Optimise flow of authenticate_image on hab_entry fail
   arm: imx: hab: Move IVT_SIZE to hab.h
   arm: imx: hab: Move CSF_PAD_SIZE to hab.h
   arm: imx: hab: Fix authenticate_image input parameters
   arm: imx: hab: Add IVT header definitions
   arm: imx: hab: Add IVT header verification
   arm: imx: hab: Verify IVT self matches calculated address
   arm: imx: hab: Only call ROM once headers are verified
   arm: imx: hab: Print CSF based on IVT descriptor
   arm: imx: hab: Print additional IVT elements during debug
   arm: imx: hab: Define rvt_check_target()
   arm: imx: hab: Implement hab_rvt_check_target
   arm: imx: hab: Add a hab_rvt_check_target to image auth
   arm: imx: hab: Print HAB event log only after calling ROM
   arm: imx: hab: Make internal functions and data static
   arm: imx: hab: Prefix authenticate_image with imx_hab
   arm: imx: hab: Rename is_hab_enabled imx_hab_is_enabled
   arm: imx: hab: Make authenticate_image() return zero on open boards
   arm: imx: hab: Make imx_hab_is_enabled global
   arm: imx: hab: Define rvt_failsafe()
   arm: imx: hab: Implement hab_rvt_failsafe
   arm: imx: hab: Add hab_failsafe console command

  arch/arm/include/asm/mach-imx/hab.h |  46 +++-
  arch/arm/mach-imx/hab.c | 461 +---
  arch/arm/mach-imx/spl.c |  38 ++-
  3 files changed, 354 insertions(+), 191 deletions(-)


I tried Secure boot before[1] with SPL and U-Boot proper and work well.

I'm observing authentication issue while loading U-Boot proper, U-Boot
proper now have features like SPL DM and SPL FIT etc

U-Boot SPL 2018.03-rc1-00182-gb81f7c9 (Feb 08 2018 - 17:19:03 +0530)
Trying to boot from MMC1
Expected Linux image is not found. Trying to start U-boot

Authenticate image from DDR location 0x1780...
bad magic magic=0xb8 length=0x841b version=0x17
bad length magic=0xb8 length=0x841b version=0x17
bad version magic=0xb8 length=0x841b version=0x17
spl: ERROR:  image authentication unsuccessful
### ERROR ### Please RESET the board ###

Please let me know where I missed, I'm authenticating SPL and
u-boot-dtb.img now.


Can you send

1. The load address of the binary
2. The command you are using for authenticate image ?

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


Re: [U-Boot] [PATCH] env: mmc/fat/ext4: make sure that the MMC sub-system is initialized before using it

2018-02-08 Thread Faiz Abbas
Hi Wolfgang,

On Wednesday 07 February 2018 02:22 PM, Wolfgang Denk wrote:
> Dear Faiz Abbas,
> 
> In message <1517564875-10237-1-git-send-email-faiz_ab...@ti.com> you wrote:
>> When booting from a non-MMC device, the MMC sub-system may not be
>> initialized when the environment is first accessed.
>> We need to make sure that the MMC sub-system is ready in even a non-MMC
>> boot case.
>>
>> Therefore, initialize mmc during .init() of environment.
> 
> Do I understand correctly that you will always initialize the MMC
> sub-system if it is a candidate for reading the environment, even
> when the environment is read from elsewhere?

I didn't realize that U-boot was supporting multiple environment
candidates now. Will try to find another place to initialize mmc.


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


[U-Boot] [PATCH] core: add ofnode_get_by_phandle() api

2018-02-08 Thread Kever Yang
We need to get ofnode from a phandle, add interface to support
both live dt and fdt.

Signed-off-by: Kever Yang 
---

 drivers/core/ofnode.c | 13 +
 include/dm/ofnode.h   |  8 
 2 files changed, 21 insertions(+)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 0fc8bd4..59c8ff3 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -177,6 +177,19 @@ const char *ofnode_get_name(ofnode node)
return fdt_get_name(gd->fdt_blob, ofnode_to_offset(node), NULL);
 }
 
+ofnode ofnode_get_by_phandle(uint phandle)
+{
+   ofnode node;
+
+   if (of_live_active())
+   node = np_to_ofnode(of_find_node_by_phandle(phandle));
+   else
+   node.of_offset = fdt_node_offset_by_phandle(gd->fdt_blob,
+   phandle);
+
+   return node;
+}
+
 int ofnode_read_size(ofnode node, const char *propname)
 {
int len;
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 8b9932a..b1681e2 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -310,6 +310,14 @@ ofnode ofnode_next_subnode(ofnode node);
 const char *ofnode_get_name(ofnode node);
 
 /**
+ * ofnode_get_by_phandle() - get ofnode from phandle
+ *
+ * @phandle:   phandle to look up
+ * @return ofnode reference to the phandle
+ */
+ofnode ofnode_get_by_phandle(uint phandle);
+
+/**
  * ofnode_read_size() - read the size of a property
  *
  * @node: node to check
-- 
1.9.1

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


Re: [U-Boot] [PATCH 2/5] arch-stm32: Move gpio.h for STM32 SoCs in include/asm/

2018-02-08 Thread Patrice CHOTARD
Hi Vikas

On 02/07/2018 08:28 PM, Vikas Manocha wrote:
> Hi Patrice,
> 
> On 02/07/2018 07:50 AM, patrice.chot...@st.com wrote:
>> From: Patrice Chotard 
>>
>> Instead to have 3 identical gpio.h for all STM32 SoCs,
>> migrate them in one file in include/asm.
> 
> good move to consolidate these headers.
> One comment below.
> 
>>
>> Signed-off-by: Patrice Chotard 

[...]

>> -static inline unsigned stm32_gpio_to_pin(unsigned gpio)
>> -{
>> -return gpio % 16;
>> -}
>> +#include 
> 
> Hmm.. this header seems like dummy header(in all architectures f4/f7/h7) only 
> to include gpio header here.
> Also arch/arm/include/asm/ does not seems like good place for soc specific 
> header files.

Agree, but omap have put several omap_.h files too.

> 
> how about creating one level like arch/arm/include/asm/arch-stm32/ to include 
> common gpio.h here. It would fix both of above points.
> The same location can be used to move other commonalities in future.

It's possible to create an additionnal level
arch/arm/include/asm/arch-stm32/  and put specificities to each SoCs into :

arch/arm/include/asm/arch-stm32/stm32f4
arch/arm/include/asm/arch-stm32/stm32f7
arch/arm/include/asm/arch-stm32/stm32h7

If we focus on stm32f7, this implies to modify the content of 
CONFIG_SYS_SOC from "stm32f7" to "stm32/stm32f7" in 
board/st/stm32f746-disco/Kconfig but:

1) In any case, we can't include directly files located in 
arch/arm/include/asm/arch-stm32 because SYS_SOC is used to build include 
path.

For example in drivers/gpio/gpio-uclass.c,
#include  is in fact #include /gpio.h

so equal to #include  
> Cheers,
> Vikas
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESENT PATCH 1/2] core: add uclass_get_device_by_phandle_id() api

2018-02-08 Thread Dr. Philipp Tomsich

> On 8 Feb 2018, at 14:13, Kever Yang  wrote:
> 
> Add api for who can not get phandle from a device property.
> 
> Signed-off-by: Kever Yang 

Reviewed-by: Philipp Tomsich 

See below for comments.

> ---
> 
> drivers/core/uclass.c | 28 
> include/dm/uclass.h   | 16 
> 2 files changed, 44 insertions(+)
> 
> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
> index f5e4067..dd7a89c 100644
> --- a/drivers/core/uclass.c
> +++ b/drivers/core/uclass.c
> @@ -443,6 +443,34 @@ int uclass_get_device_by_ofnode(enum uclass_id id, 
> ofnode node,
> }
> 
> #if CONFIG_IS_ENABLED(OF_CONTROL)
> +int uclass_get_device_by_phandle_id(enum uclass_id id, int phandle_id,
> + struct udevice **devp)
> +{
> + struct udevice *dev;
> + struct uclass *uc;
> + int ret;
> +
> + *devp = NULL;
> + ret = uclass_get(id, );
> + if (ret)
> + return ret;
> +
> + ret = -ENODEV;
> + list_for_each_entry(dev, >dev_head, uclass_node) {
> + uint phandle;
> +
> + phandle = dev_read_phandle(dev);
> +
> + if (phandle == phandle_id) {
> + *devp = dev;
> + ret = 0;
> + break;

I would prefer if you directly called into the tail here…
…and didn’t set "ret = -ENODEV” above and returned the -ENODEV directly from 
below.

In other words, you could have
return uclass_get_device_tail(dev, 0, devp);
here.

> + }
> + }
> +
> + return uclass_get_device_tail(dev, ret, devp);
> +}
> +
> int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
>const char *name, struct udevice **devp)
> {
> diff --git a/include/dm/uclass.h b/include/dm/uclass.h
> index 1818849..f6fe785 100644
> --- a/include/dm/uclass.h
> +++ b/include/dm/uclass.h
> @@ -203,6 +203,22 @@ int uclass_get_device_by_ofnode(enum uclass_id id, 
> ofnode node,
>   struct udevice **devp);
> 
> /**
> + * uclass_get_device_by_phandle_id() - Get a uclass device by phandle id
> + *
> + * This searches the devices in the uclass for one with the given phandle id.
> + *
> + * The device is probed to activate it ready for use.
> + *
> + * @id: uclass ID to look up
> + * @phandle_id: the phandle id to look up
> + * @devp: Returns pointer to device (there is only one for each node)
> + * @return 0 if OK, -ENODEV if there is no device match the phandle, other
> + *   -ve on error
> + */
> +int uclass_get_device_by_phandle_id(enum uclass_id id, int phandle_id,
> + struct udevice **devp);
> +
> +/**
>  * uclass_get_device_by_phandle() - Get a uclass device by phandle
>  *
>  * This searches the devices in the uclass for one with the given phandle.
> -- 
> 1.9.1
> 

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


Re: [U-Boot] [PATCH] rockchip: pwm: convert to use live dt

2018-02-08 Thread Dr. Philipp Tomsich

> On 8 Feb 2018, at 14:15, Kever Yang  wrote:
> 
> use live dt api to get base addr
> 
> Signed-off-by: Kever Yang 

Acked-by: Philipp Tomsich 
Reviewed-by: Philipp Tomsich 

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


[U-Boot] [PATCH] rockchip: pwm: convert to use live dt

2018-02-08 Thread Kever Yang
use live dt api to get base addr

Signed-off-by: Kever Yang 
---

 drivers/pwm/rk_pwm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c
index 2364c2d..7d3e11d 100644
--- a/drivers/pwm/rk_pwm.c
+++ b/drivers/pwm/rk_pwm.c
@@ -76,7 +76,7 @@ static int rk_pwm_ofdata_to_platdata(struct udevice *dev)
 {
struct rk_pwm_priv *priv = dev_get_priv(dev);
 
-   priv->regs = (struct rk3288_pwm *)devfdt_get_addr(dev);
+   priv->regs = (struct rk3288_pwm *)dev_read_addr(dev);
 
return 0;
 }
-- 
1.9.1

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


[U-Boot] [RESENT PATCH 2/2] pinctrl-uclass: convert to use live dt

2018-02-08 Thread Kever Yang
Use live dt interface for pinctrl_select_state_full()

Signed-off-by: Kever Yang 
---

 drivers/pinctrl/pinctrl-uclass.c | 20 +---
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 114952a..5abfeba 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -5,13 +5,13 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -63,16 +63,13 @@ static int pinctrl_config_one(struct udevice *config)
  */
 static int pinctrl_select_state_full(struct udevice *dev, const char 
*statename)
 {
-   const void *fdt = gd->fdt_blob;
-   int node = dev_of_offset(dev);
char propname[32]; /* long enough */
const fdt32_t *list;
uint32_t phandle;
-   int config_node;
struct udevice *config;
int state, size, i, ret;
 
-   state = fdt_stringlist_search(fdt, node, "pinctrl-names", statename);
+   state = dev_read_stringlist_search(dev, "pinctrl-names", statename);
if (state < 0) {
char *end;
/*
@@ -85,22 +82,15 @@ static int pinctrl_select_state_full(struct udevice *dev, 
const char *statename)
}
 
snprintf(propname, sizeof(propname), "pinctrl-%d", state);
-   list = fdt_getprop(fdt, node, propname, );
+   list = dev_read_prop(dev, propname, );
if (!list)
return -EINVAL;
 
size /= sizeof(*list);
for (i = 0; i < size; i++) {
phandle = fdt32_to_cpu(*list++);
-
-   config_node = fdt_node_offset_by_phandle(fdt, phandle);
-   if (config_node < 0) {
-   dev_err(dev, "prop %s index %d invalid phandle\n",
-   propname, i);
-   return -EINVAL;
-   }
-   ret = uclass_get_device_by_of_offset(UCLASS_PINCONFIG,
-config_node, );
+   ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
+ );
if (ret)
return ret;
 
-- 
1.9.1

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


[U-Boot] [RESENT PATCH 1/2] core: add uclass_get_device_by_phandle_id() api

2018-02-08 Thread Kever Yang
Add api for who can not get phandle from a device property.

Signed-off-by: Kever Yang 
---

 drivers/core/uclass.c | 28 
 include/dm/uclass.h   | 16 
 2 files changed, 44 insertions(+)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index f5e4067..dd7a89c 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -443,6 +443,34 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode 
node,
 }
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
+int uclass_get_device_by_phandle_id(enum uclass_id id, int phandle_id,
+   struct udevice **devp)
+{
+   struct udevice *dev;
+   struct uclass *uc;
+   int ret;
+
+   *devp = NULL;
+   ret = uclass_get(id, );
+   if (ret)
+   return ret;
+
+   ret = -ENODEV;
+   list_for_each_entry(dev, >dev_head, uclass_node) {
+   uint phandle;
+
+   phandle = dev_read_phandle(dev);
+
+   if (phandle == phandle_id) {
+   *devp = dev;
+   ret = 0;
+   break;
+   }
+   }
+
+   return uclass_get_device_tail(dev, ret, devp);
+}
+
 int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
 const char *name, struct udevice **devp)
 {
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 1818849..f6fe785 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -203,6 +203,22 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode 
node,
struct udevice **devp);
 
 /**
+ * uclass_get_device_by_phandle_id() - Get a uclass device by phandle id
+ *
+ * This searches the devices in the uclass for one with the given phandle id.
+ *
+ * The device is probed to activate it ready for use.
+ *
+ * @id: uclass ID to look up
+ * @phandle_id: the phandle id to look up
+ * @devp: Returns pointer to device (there is only one for each node)
+ * @return 0 if OK, -ENODEV if there is no device match the phandle, other
+ * -ve on error
+ */
+int uclass_get_device_by_phandle_id(enum uclass_id id, int phandle_id,
+   struct udevice **devp);
+
+/**
  * uclass_get_device_by_phandle() - Get a uclass device by phandle
  *
  * This searches the devices in the uclass for one with the given phandle.
-- 
1.9.1

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


[U-Boot] [PATCH 2/2] pinctrl-uclass: convert to use live dt

2018-02-08 Thread Kever Yang
Use live dt interface for pinctrl_select_state_full()

Signed-off-by: Kever Yang 
---

 drivers/pinctrl/pinctrl-uclass.c | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 114952a..5498ae0 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -5,13 +5,13 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -63,16 +63,14 @@ static int pinctrl_config_one(struct udevice *config)
  */
 static int pinctrl_select_state_full(struct udevice *dev, const char 
*statename)
 {
-   const void *fdt = gd->fdt_blob;
-   int node = dev_of_offset(dev);
char propname[32]; /* long enough */
const fdt32_t *list;
uint32_t phandle;
-   int config_node;
+   struct device_node *config_node;
struct udevice *config;
int state, size, i, ret;
 
-   state = fdt_stringlist_search(fdt, node, "pinctrl-names", statename);
+   state = dev_read_stringlist_search(dev, "pinctrl-names", statename);
if (state < 0) {
char *end;
/*
@@ -85,22 +83,15 @@ static int pinctrl_select_state_full(struct udevice *dev, 
const char *statename)
}
 
snprintf(propname, sizeof(propname), "pinctrl-%d", state);
-   list = fdt_getprop(fdt, node, propname, );
+   list = dev_read_prop(dev, propname, );
if (!list)
return -EINVAL;
 
size /= sizeof(*list);
for (i = 0; i < size; i++) {
phandle = fdt32_to_cpu(*list++);
-
-   config_node = fdt_node_offset_by_phandle(fdt, phandle);
-   if (config_node < 0) {
-   dev_err(dev, "prop %s index %d invalid phandle\n",
-   propname, i);
-   return -EINVAL;
-   }
-   ret = uclass_get_device_by_of_offset(UCLASS_PINCONFIG,
-config_node, );
+   ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
+ );
if (ret)
return ret;
 
-- 
1.9.1

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


[U-Boot] [PATCH 1/2] core: add uclass_get_device_by_phandle_id() api

2018-02-08 Thread Kever Yang
Add api for who can not get phandle from a device property.

Signed-off-by: Kever Yang 
---

 drivers/core/uclass.c | 28 
 include/dm/uclass.h   | 16 
 2 files changed, 44 insertions(+)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index f5e4067..dd7a89c 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -443,6 +443,34 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode 
node,
 }
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
+int uclass_get_device_by_phandle_id(enum uclass_id id, int phandle_id,
+   struct udevice **devp)
+{
+   struct udevice *dev;
+   struct uclass *uc;
+   int ret;
+
+   *devp = NULL;
+   ret = uclass_get(id, );
+   if (ret)
+   return ret;
+
+   ret = -ENODEV;
+   list_for_each_entry(dev, >dev_head, uclass_node) {
+   uint phandle;
+
+   phandle = dev_read_phandle(dev);
+
+   if (phandle == phandle_id) {
+   *devp = dev;
+   ret = 0;
+   break;
+   }
+   }
+
+   return uclass_get_device_tail(dev, ret, devp);
+}
+
 int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
 const char *name, struct udevice **devp)
 {
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 1818849..f3befe4 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -203,6 +203,22 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode 
node,
struct udevice **devp);
 
 /**
+ * uclass_get_device_by_phandle_id() - Get a uclass device by phandle id
+ *
+ * This searches the devices in the uclass for one with the given phandle id.
+ *
+ * The device is probed to activate it ready for use.
+ *
+ * @id: uclass ID to look up
+ * @phandle_id: the phandle id to look up
+ * @devp: Returns pointer to device (there is only one for each node)
+ * @return 0 if OK, -ENODEV if there is no device match the phandle, other
+ * -ve on error
+ */
+int uclass_get_device_by_phandle_id(enum uclass_id id, int phandle_id,
+   struct udevice **devp)
+
+/**
  * uclass_get_device_by_phandle() - Get a uclass device by phandle
  *
  * This searches the devices in the uclass for one with the given phandle.
-- 
1.9.1

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


Re: [U-Boot] [PATCH v6 00/25] Fix and extend i.MX HAB layer

2018-02-08 Thread Jagan Teki
On Fri, Jan 12, 2018 at 6:09 PM, Bryan O'Donoghue
 wrote:
> v6:
> - Added patch 21/25 return zero on open (unlocked) board when
>   calling authenticate_image() - Breno
>
> - Added Tested-by: Breno Matheus Lima 
>   as indicated for remainder 24/25 patches
>
> - Added Reviewed-by: Fabio Estevam 
>   as indicated for remainder 24/25 patches
>
> v5:
> - Drop dcache disable across HAB call.
>   We can't replicate this error on the current codebase and the available
>   images. We'll have to wait for the error to crop up again before pushing
>   that patch any further.
>
> v4:
> - No change mixed extra patches @ v3 unnoticed with previous
>   git-send
>
> v3:
> - Only call into ROM if headers are verified. - Bryan
>
> - Print HAB event log if and only if a call was made to HAB
>   and a meaningful status code has been obtained. - Breno
>
> v2:
> - Fix compilation warnings and errors in SPL highlighted by
>   Breno Matheus Lima
>
> - Add CC: Breno Matheus Lima  to all patches
>
> v1:
> This patchset updates the i.MX HAB layer in u-boot to fix a list of
> identified issues and then to add and extend existing functionality.
>
> The first block of patches 0001-0006 deal with fixing existing code,
>
> - Fixes indentation
> - Fixes the treatment of input parameters to hab_auth_image.
>
> The second block of patches 0007-0013 are about tidying up the HAB code
>
> - Remove reliance on hard-coding to specific offsets
> - IVT header drives locating CSF
> - Continue to support existing boards
>
> Patches 0014 onwards extend out the HAB functionality.
>
> - hab_rvt_check_target is a recommended check in the NXP documents to
>   perform prior to hab_rvt_authenticate_image
> - hab_rvt_failsafe is a useful function to set the board into BootROM
>   USB recovery mode.
>
>
>
> Bryan O'Donoghue (25):
>   arm: imx: hab: Make authenticate_image return int
>   arm: imx: hab: Fix authenticate_image result code
>   arm: imx: hab: Optimise flow of authenticate_image on is_enabled fail
>   arm: imx: hab: Optimise flow of authenticate_image on hab_entry fail
>   arm: imx: hab: Move IVT_SIZE to hab.h
>   arm: imx: hab: Move CSF_PAD_SIZE to hab.h
>   arm: imx: hab: Fix authenticate_image input parameters
>   arm: imx: hab: Add IVT header definitions
>   arm: imx: hab: Add IVT header verification
>   arm: imx: hab: Verify IVT self matches calculated address
>   arm: imx: hab: Only call ROM once headers are verified
>   arm: imx: hab: Print CSF based on IVT descriptor
>   arm: imx: hab: Print additional IVT elements during debug
>   arm: imx: hab: Define rvt_check_target()
>   arm: imx: hab: Implement hab_rvt_check_target
>   arm: imx: hab: Add a hab_rvt_check_target to image auth
>   arm: imx: hab: Print HAB event log only after calling ROM
>   arm: imx: hab: Make internal functions and data static
>   arm: imx: hab: Prefix authenticate_image with imx_hab
>   arm: imx: hab: Rename is_hab_enabled imx_hab_is_enabled
>   arm: imx: hab: Make authenticate_image() return zero on open boards
>   arm: imx: hab: Make imx_hab_is_enabled global
>   arm: imx: hab: Define rvt_failsafe()
>   arm: imx: hab: Implement hab_rvt_failsafe
>   arm: imx: hab: Add hab_failsafe console command
>
>  arch/arm/include/asm/mach-imx/hab.h |  46 +++-
>  arch/arm/mach-imx/hab.c | 461 
> +---
>  arch/arm/mach-imx/spl.c |  38 ++-
>  3 files changed, 354 insertions(+), 191 deletions(-)

I tried Secure boot before[1] with SPL and U-Boot proper and work well.

I'm observing authentication issue while loading U-Boot proper, U-Boot
proper now have features like SPL DM and SPL FIT etc

U-Boot SPL 2018.03-rc1-00182-gb81f7c9 (Feb 08 2018 - 17:19:03 +0530)
Trying to boot from MMC1
Expected Linux image is not found. Trying to start U-boot

Authenticate image from DDR location 0x1780...
bad magic magic=0xb8 length=0x841b version=0x17
bad length magic=0xb8 length=0x841b version=0x17
bad version magic=0xb8 length=0x841b version=0x17
spl: ERROR:  image authentication unsuccessful
### ERROR ### Please RESET the board ###

Please let me know where I missed, I'm authenticating SPL and
u-boot-dtb.img now.

[1] https://openedev.amarulasolutions.com/display/ODUBOOT/SPL+HABv4
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function

2018-02-08 Thread Tom Rini
On Sat, Feb 03, 2018 at 08:29:52AM +0100, Lukasz Majewski wrote:

> The goal of this patch is to clean up the code related to choosing SPL
> MMC boot mode.
> 
> The spl_boot_mode() now is called only in spl_mmc_load_image() function,
> which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.
> 
> To achieve the goal, all per mach/arch implementations eligible for
> unification has been replaced with one __weak implementation.
> 
> Signed-off-by: Lukasz Majewski 
> Reviewed-by: Marek Vasut 
> Reviewed-by: Stefano Babic 
> Acked-by: Michal Simek  (For ZynqMP)
> Reviewed-by: Fabio Estevam 

Applied to u-boot/master, 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] [U-Boot, 1/2] ARM: k2g: Add pinmux data for QSPI on K2G ICE

2018-02-08 Thread Tom Rini
On Wed, Jan 31, 2018 at 09:08:26PM +0530, Vignesh R wrote:

> Add pinmux for QSPI pins on K2G ICE board.
> 
> Signed-off-by: Vignesh R 

Applied to u-boot/master, 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] [U-Boot, 2/2] ARM: omap3: evm: Remove CONFIG_SYS_NS16550_REG_SIZE undefine

2018-02-08 Thread Tom Rini
On Sun, Feb 04, 2018 at 07:04:50PM -0600, Derald D. Woods wrote:

> This commit removes an attempt to workaround a previous compilation
> warning that is is now fixed in "include/configs/ti_omap3_common.h".
> 
> Signed-off-by: Derald D. Woods 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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] doc: watchdog: Remove Blackfin related documentation entry

2018-02-08 Thread Tom Rini
On Mon, Feb 05, 2018 at 11:42:57PM +0100, Lukasz Majewski wrote:

> This commit cleans up the README.watchdog by removing the reminescent of
> ADI's Blackfin architecture removed some time ago.
> 
> Signed-off-by: Lukasz Majewski 

Applied to u-boot/master, 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] [U-Boot, 1/2] ARM: omap3: ti_omap3_common: Fix CONFIG_SYS_NS16550_REG_SIZE compiler warning

2018-02-08 Thread Tom Rini
On Sun, Feb 04, 2018 at 07:04:49PM -0600, Derald D. Woods wrote:

> This commit fixes the following compiler warnings when DM_SERIAL is
> enabled.
> 

Applied to u-boot/master, 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] [U-Boot, 2/2] ARM: dts: keystone-k2g-ice: Add support for QSPI

2018-02-08 Thread Tom Rini
On Wed, Jan 31, 2018 at 09:08:27PM +0530, Vignesh R wrote:

> K2G ICE has a s25fl256s1 QSPI NOR flash connected to QSPI at CS0. Add DT
> entries for the same.
> 
> Signed-off-by: Vignesh R 

Applied to u-boot/master, 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] part: Allocate only one legacy_mbr buffer

2018-02-08 Thread Tom Rini
On Mon, Jan 29, 2018 at 10:58:24PM +0300, Alexey Brodkin wrote:

> Commit ff98cb90514d ("part: extract MBR signature from partitions")
> blindly switched allocated by ALLOC_CACHE_ALIGN_BUFFER buffer type from
> "unsigned char" to "legacy_mbr" which caused allocation of size =
> (typeof(legacy_mbr) * dev_desc->blksize) instead of just space enough
> for "legacy_mbr" structure.
> 
> Signed-off-by: Alexey Brodkin 
> Cc: Rob Clark 
> Cc: Peter Jones 
> Cc: Alexander Graf 
> Cc: Tom Rini 

Applied to u-boot/master, 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] [U-Boot,2/2] move booti_setup to arch/arm/lig/image.c

2018-02-08 Thread Tom Rini
On Sat, Jan 27, 2018 at 04:59:09PM +1100, Bin Chen wrote:

> Follow bootz's pattern by moving the booti_setup to arch/arm/lib.
> This allows to use booti_setup in other paths, e.g booting
> an Android image containing Image format.
> 
> Note that kernel relocation is move out of booti_setup and it is the
> caller's responsibility to do it and allows them do it differently. say,
> cmd/booti.c just do a manually, while in the bootm path, we can use
> bootm_load_os(with some changes).
> 
> v2:
> - fix review comments for indentation
> - fix the comment for booti_setup
> - rebase to lastest u-boot
> - improve the commit comment
> 
> Signed-off-by: Bin Chen 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, 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] [U-Boot, 1/1] atcspi200: avoid possible NULL dereference

2018-02-08 Thread Tom Rini
On Wed, Jan 31, 2018 at 01:05:54AM +0100, Heinrich Schuchardt wrote:

> Check if ns before and not after dereferencing it.
> 
> Indicated by cppcheck.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, 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] [U-Boot,1/2] parse the second area of android image

2018-02-08 Thread Tom Rini
On Sat, Jan 27, 2018 at 04:59:08PM +1100, Bin Chen wrote:

> The second area of android image was intended to put a 2nd stage
> bootloader but in practice were rarely used (in my knowledge).
> 
> An proposal was made to the AOSP to (re)use the second area as the dtb[1],
> This patch itself doesn't depend on that proposal being accepted but it won't
> be that helpful as well if that proposal won't be accepted. But don't do
> any harm as well.
> 
> [1] https://android-review.googlesource.com/#/c/417447/
> Signed-off-by: Bin Chen 
> Reviewed-by: Tom Rini 
> Reviewed-by: Kever Yang 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] UART

2018-02-08 Thread Mariano Coromac
Hello, I'm using a sama5d27 SoC and I've already port at91bootloader but
now I'm having trouble with u-boot. When u-boot.bin finishes loading
SD/MMC: Done to load image
But then it says
 No serial driver found
resetting
In my device tree I already defined my usart using FLEXCOM1.
How do I redirect the debug uart into these usart?
Or do you think this has to do with my device tree?
atmel_usart.o does gets generated and the target is defined on the
makefiles.
Thank you, sorry if this has been asked before.
PD: I'm not using any commercial board, is a custom one.
-- 
Mariano Coromac 
I of Electronics Engineer
mcoro...@stsa.info
+502 41544712
www.gps.gt 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/2] i.MX6: nand: add nandbcb update command

2018-02-08 Thread Shyam Saini
> Writing/updating boot image in nand device is not
> straight forward in i.MX6 platform and it requires
> boot control block(BCB) to be configured.
>
> It becomes difficult to use uboot 'nand' command to
> write BCB since it requires platform specific attributes
> need to be taken care of.
>
> It is even difficult to use existing msx-nand.c driver by
> incorporating BCB attributes like mxs_dma_desc does
> because it requires change in mtd and nand command.
>
> So, cmd_nandbcb implemented in arch/arm/mach-imx
>
> BCB contains two data structures, Firmware Configuration Block(FCB)
> and Discovered Bad Block Table(DBBT). FCB has nand timings,
> DBBT search area, page address of primary and secondary firmware.
>
> On summary, nandbcb update will
> - erase the entire partition
> - create BCB by creating 4 FCB/BDDT block followed by
>   2 FW blocks based on partition size and erasesize.
> - fill FCB/DBBT structures
> - write FW/SPL in FW0 and FW1(same image in two times)
> - write FCB/DBBT in first 4 blocks
>
> for nand boot, up on reset bootrom look for FCB structure in
> first block's if FCB found the nand timings are loaded for
> further reads. once FCB read done, DTTB will load and
> finally primary or secondary firmware will load which is boot image.
>
> See Section 4 from doc/README.imx6 for more usage information.
>
> Signed-off-by: Jagan Teki 
> Signed-off-by: Sergey Kubushyn 
> ---
> Changes for v3:
> - Fixed multi-line comments
> - Better error handling for failed allocations
> Changes for v2:
> - Fixed commit message notes
> - Updated proper commit message
> - Update doc/README.imx6 with NAND boot details
> - Fixed long length variable names.
> - Fixed Gigantic variable name.
> - NULL checks for kzalloc
> - Move Kconfig option in separate patch
> - Fixed checkpatch warninigs
>
>  arch/arm/include/asm/mach-imx/imx-nandbcb.h | 111 
>  arch/arm/include/asm/mach-imx/mxs-nand.h|  15 ++
>  arch/arm/mach-imx/Makefile  |   1 +
>  arch/arm/mach-imx/cmd_nandbcb.c | 379 
> 
>  doc/README.imx6 |  77 ++
>  drivers/mtd/nand/mxs_nand.c |   8 +-
>  6 files changed, 587 insertions(+), 4 deletions(-)
>  create mode 100644 arch/arm/include/asm/mach-imx/imx-nandbcb.h
>  create mode 100644 arch/arm/include/asm/mach-imx/mxs-nand.h
>  create mode 100644 arch/arm/mach-imx/cmd_nandbcb.c
>
> diff --git a/arch/arm/include/asm/mach-imx/imx-nandbcb.h 
> b/arch/arm/include/asm/mach-imx/imx-nandbcb.h
> new file mode 100644
> index 000..759b588
> --- /dev/null
> +++ b/arch/arm/include/asm/mach-imx/imx-nandbcb.h
> @@ -0,0 +1,111 @@
> +/*
> + * Copyright (C) 2017 Jagan Teki 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#ifndef _IMX_NAND_BCB_H_
> +#define _IMX_NAND_BCB_H_
> +
> +#define FCB_FINGERPRINT0x20424346  /* 'FCB' */
> +#define FCB_VERSION_1  0x0100
> +
> +#define DBBT_FINGERPRINT2  0x54424244  /* 'DBBT' */
> +#define DBBT_VERSION_1 0x0100
> +
> +struct dbbt_block {
> +   u32 checksum;   /* reserved on i.MX6 */
> +   u32 fingerprint;
> +   u32 version;
> +   u32 numberbb;   /* reserved on i.MX6 */
> +   u32 dbbtnumofpages;
> +};
> +
> +struct fcb_block {
> +   u32 checksum;   /* First fingerprint in first byte */
> +   u32 fingerprint;/* 2nd fingerprint at byte 4 */
> +   u32 version;/* 3rd fingerprint at byte 8 */
> +   u8 datasetup;
> +   u8 datahold;
> +   u8 addresssetup;
> +   u8 dsample_time;
> +
> +   /* These are for application use only and not for ROM. */
> +   u8 nandtiming;
> +   u8 rea;
> +   u8 rloh;
> +   u8 rhoh;
> +   u32 pagesize;   /* 2048 for 2K pages, 4096 for 4K pages */
> +   u32 oob_pagesize;   /* 2112 for 2K pages, 4314 for 4K pages */
> +   u32 sectors;/* Number of 2K sections per block */
> +   u32 nr_nand;/* Total Number of NANDs - not used by ROM */
> +   u32 nr_die; /* Number of separate chips in this NAND */
> +   u32 celltype;   /* MLC or SLC */
> +   u32 ecc_type;   /* Type of ECC, can be one of BCH-0-20 */
> +   u32 ecc_nr; /* Number of bytes for Block0 - BCH */
> +
> +   /* Block size in bytes for all blocks other than Block0 - BCH */
> +   u32 ecc_size;
> +   u32 ecc_level;  /* Ecc level for Block 0 - BCH */
> +   u32 meta_size;  /* Metadata size - BCH */
> +   /* Number of blocks per page for ROM use - BCH */
> +   u32 nr_blocks;
> +   u32 ecc_type_sdk;   /* Type of ECC, can be one of BCH-0-20 */
> +   u32 ecc_nr_sdk; /* Number of bytes for Block0 - BCH */
> +   /* Block size in bytes for all blocks other than Block0 - BCH */
> +   u32 ecc_size_sdk;
> +   u32 

Re: [U-Boot] [PATCH v3 2/2] arm: i.MX: Add CMD_NANDBCB Kconfig entry

2018-02-08 Thread Shyam Saini
> Add Kconfig entry for CMD_NANDBCB, and default y on i.MX6
> platform with NAND_MXS defined.
>
> Signed-off-by: Jagan Teki 
> ---
> Changes for v3:
> - Fixed Typo 'seprate'
> Changes for v2:
> - New patch
>
>  arch/arm/mach-imx/Kconfig | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index 3aec89d..1b9c275 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -71,6 +71,17 @@ config CMD_HDMIDETECT
>   This enables the 'hdmidet' command which detects if an HDMI monitor
>   is connected.
>
> +config CMD_NANDBCB
> +   bool "i.MX6 NAND Boot Control Block(BCB) command"
> +   depends on NAND && CMD_MTDPARTS
> +   default y if ARCH_MX6 && NAND_MXS
> +   help
> + Unlike normal 'nand write/erase' commands, this command update
> + Boot Control Block(BCB) for i.MX6 platform NAND IP's.
> +
> + This is similar to kobs-ng, which is used in Linux as separate
> + rootfs package.
> +
>  config NXP_BOARD_REVISION
> bool "Read NXP board revision from fuses"
> depends on ARCH_MX6 || ARCH_MX7

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


Re: [U-Boot] [PATCH v4 2/2] Enable test case with A20-OLinuXino-Lime2

2018-02-08 Thread Stefan Mavrodiev

On 02/08/2018 09:03 AM, Jagan Teki wrote:

On Thu, Feb 8, 2018 at 11:54 AM, Stefan Mavrodiev
 wrote:

On 02/07/2018 07:19 PM, Maxime Ripard wrote:

On Wed, Feb 07, 2018 at 12:55:54PM +0530, Jagan Teki wrote:

+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_b>, <_cs0_pins_b>;
+   status = "okay";
+
+   flash: w25q128@0 {

Was it sync from Linux?

No, this isn't in the linux dts.

But we have to, please send it to Linux first.

We've already commented this issue. In the v2 [1], I've explained that
this
won't go mainline, since it's optional feature. Rather it will be
managed
with overlays.

Thought this was already in ML, and ready to merge. So this never go
to Linux tree since it's optional? then add u-boot.dtsi for this
atleast since we always sync dts from Linux.

This is an optional feature on that board. We should be making it as
easy as possible to enable it, but a defconfig is a *default*
configuration, and if the board doesn't have it by default, it
shouldn't be enabled in the defconfig.

Maxime


Sorry, but I'm really confused. In the first patch Jagan said to make
separate patch
"just to test" the driver. Then I've made patch "just to test", and it's
turn out it wasn't not OK,
because it should be compatible with linux, u-boot and etc. What's the point
since it's just for testing...?

Sorry again, but can someone explain to me, that to do?
I'm not trying to pick on you guys. Just want to do the right thing.

I think we're in out-of-sync for some reason.

Here is my suggestion:
Since it is "optional feature however similar boards of this type
could not have it"?

How about separate defconfig file?
A20-OLinuXino-Lime2-spinor_defconfig and have same dts file with

/* Disable SPI NOR by default: it optional on A20-OLinuXino-Lime2 boards */
status = "disabled";

But the dts should accept by Linux as well.


Already tried this [1] and got rejected.

[1] https://patchwork.kernel.org/patch/10076721/

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


  1   2   >