Re: [U-Boot] [PATCH 4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()

2017-07-13 Thread Masahiro Yamada
Hi Simon,


2017-07-07 12:57 GMT+09:00 Simon Glass :
> Hi Masahiro,
>
> On 5 July 2017 at 22:49, Simon Glass  wrote:
>> On 22 June 2017 at 01:54, Masahiro Yamada  
>> wrote:
>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>> its return type.
>>>
>>> Signed-off-by: Masahiro Yamada 
>>> ---
>>>
>>>  drivers/core/read.c| 3 ++-
>>>  drivers/input/key_matrix.c | 4 ++--
>>>  include/dm/read.h  | 9 +
>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>
>> Acked-by: Simon Glass 
>
> Actually I take that back. I'd like all functions in read.h to start
> with dev_read...().
>

Do you want me to fix the return type?



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


[U-Boot] [PATCH v2] usb: fix usb_stor_read/write on DM

2017-07-13 Thread Masahiro Yamada
Prior to DM, we could not enable different types of USB controllers
at the same time.  DM was supposed to loosen the limitation.  It is
true that we can compile drivers, but they do not work.

For example, if EHCI is enabled, xHCI fails as follows:

  => usb read 8200 0 2000

  USB read: device 0 block # 0, count 8192 ... WARN halted endpoint, queueing 
URB anyway.
  Unexpected XHCI event TRB, skipping... (3fb54010 0001 1300 01008401)
  BUG: failure at drivers/usb/host/xhci-ring.c:489/abort_td()!
  BUG!
  ### ERROR ### Please RESET the board ###

The cause of the error seems the following code:

  #ifdef CONFIG_USB_EHCI_HCD
  /*
   * The U-Boot EHCI driver can handle any transfer length as long as there is
   * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands 
are
   * limited to 65535 blocks.
   */
  #define USB_MAX_XFER_BLK  65535
  #else
  #define USB_MAX_XFER_BLK  20
  #endif

To fix the problem, choose the chunk size at run-time for CONFIG_BLK.

Signed-off-by: Masahiro Yamada 
---

Changes in v2:
  - Run-time detection of host if

 common/usb_storage.c| 30 --
 drivers/usb/host/ehci-hcd.c |  1 +
 drivers/usb/host/ohci-hcd.c |  1 +
 drivers/usb/host/xhci.c |  1 +
 include/usb.h   |  9 +
 5 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/common/usb_storage.c b/common/usb_storage.c
index df0b05730879..d17b12639cad 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1109,7 +1109,7 @@ static unsigned long usb_stor_read(struct blk_desc 
*block_dev, lbaint_t blknr,
   lbaint_t blkcnt, void *buffer)
 #endif
 {
-   lbaint_t start, blks;
+   lbaint_t start, blks, max_xfer_blk;
uintptr_t buf_addr;
unsigned short smallblks;
struct usb_device *udev;
@@ -1118,6 +1118,7 @@ static unsigned long usb_stor_read(struct blk_desc 
*block_dev, lbaint_t blknr,
struct scsi_cmd *srb = _ccb;
 #ifdef CONFIG_BLK
struct blk_desc *block_dev;
+   struct usb_bus_priv *bus_priv;
 #endif
 
if (blkcnt == 0)
@@ -1127,6 +1128,9 @@ static unsigned long usb_stor_read(struct blk_desc 
*block_dev, lbaint_t blknr,
block_dev = dev_get_uclass_platdata(dev);
udev = dev_get_parent_priv(dev_get_parent(dev));
debug("\nusb_read: udev %d\n", block_dev->devnum);
+
+   bus_priv = 
dev_get_uclass_priv(dev_get_parent(dev_get_parent(dev_get_parent(dev;
+   max_xfer_blk = bus_priv->host_if == USB_HOST_EHCI ? 65535 : 20;
 #else
debug("\nusb_read: udev %d\n", block_dev->devnum);
udev = usb_dev_desc[block_dev->devnum].priv;
@@ -1134,6 +1138,7 @@ static unsigned long usb_stor_read(struct blk_desc 
*block_dev, lbaint_t blknr,
debug("%s: No device\n", __func__);
return 0;
}
+   max_xfer_blk = USB_MAX_XFER_BLK;
 #endif
ss = (struct us_data *)udev->privptr;
 
@@ -1150,12 +1155,12 @@ static unsigned long usb_stor_read(struct blk_desc 
*block_dev, lbaint_t blknr,
/* XXX need some comment here */
retry = 2;
srb->pdata = (unsigned char *)buf_addr;
-   if (blks > USB_MAX_XFER_BLK)
-   smallblks = USB_MAX_XFER_BLK;
+   if (blks > max_xfer_blk)
+   smallblks = max_xfer_blk;
else
smallblks = (unsigned short) blks;
 retry_it:
-   if (smallblks == USB_MAX_XFER_BLK)
+   if (smallblks == max_xfer_blk)
usb_show_progress();
srb->datalen = block_dev->blksz * smallblks;
srb->pdata = (unsigned char *)buf_addr;
@@ -1178,7 +1183,7 @@ retry_it:
  start, smallblks, buf_addr);
 
usb_disable_asynch(0); /* asynch transfer allowed */
-   if (blkcnt >= USB_MAX_XFER_BLK)
+   if (blkcnt >= max_xfer_blk)
debug("\n");
return blkcnt;
 }
@@ -1191,7 +1196,7 @@ static unsigned long usb_stor_write(struct blk_desc 
*block_dev, lbaint_t blknr,
lbaint_t blkcnt, const void *buffer)
 #endif
 {
-   lbaint_t start, blks;
+   lbaint_t start, blks, max_xfer_blk;
uintptr_t buf_addr;
unsigned short smallblks;
struct usb_device *udev;
@@ -1200,6 +1205,7 @@ static unsigned long usb_stor_write(struct blk_desc 
*block_dev, lbaint_t blknr,
struct scsi_cmd *srb = _ccb;
 #ifdef CONFIG_BLK
struct blk_desc *block_dev;
+   struct usb_bus_priv *bus_priv;
 #endif
 
if (blkcnt == 0)
@@ -1210,6 +1216,9 @@ static unsigned long usb_stor_write(struct blk_desc 
*block_dev, lbaint_t blknr,
block_dev = dev_get_uclass_platdata(dev);
udev = dev_get_parent_priv(dev_get_parent(dev));
debug("\nusb_read: udev %d\n", block_dev->devnum);
+
+   bus_priv = 

Re: [U-Boot] [PATCH 2/2] [rfc] support booting arm64 android image

2017-07-13 Thread Bin Chen
On 14 July 2017 at 00:55, Rob Herring  wrote:

> On Thu, Jul 13, 2017 at 2:33 AM, Bin Chen  wrote:
> > Hi Tom,
> >
> > Thanks for the review.
> >
> > On 13 July 2017 at 04:25, Tom Rini  wrote:
> >>
> >> On Tue, Jul 11, 2017 at 03:56:04PM +1000, Bin Chen wrote:
> >>
> >> > It's my understanding that we are supposed to use booti, instead of
> >> > bootm,
> >> > for arm64 image. But booti lacks of android image support. Bootm has
> >> > the andriod image support but lack of the arm64 image handling.
> >> >
> >> > So, what is suppose the right way of booting an android arm64 image?
> >> > or, should we create a separate command?
> >> >
> >> > This patch is an invitation for that discussion.
> >> >
> >> > It *hacked* the booti command and it aslo assume the dtb is in the
> >> > second area
> >> > of android boot image. It also has other belives like u-boot should be
> >> > in control of where to put the kernnel/ramdisk/dtb images so it
> ignores
> >> > the value specified in the android images.
> >> >
> >> > Signed-off-by: Bin Chen 
> >>
> >> So, booti is very much for the "Image" format described in the Linux
> >> kernel in Documentation/arm64/booting.txt.  One can (and people have)
> >> used bootm on aarch64 for "uImage" style kernels and FIT kernels, and I
> >> would see being able to boot an aarch64 Android image with bootm as the
> >> way to go forward.
> >
> >
> > Are you suggesting that we should use bootm path, instead of booti?
> >
> > I have two questions regarding this:
> >
> > 1. currently arm64 kernel don't have a uImage kernel target. And I'm not
> > sure
> >  if adding that will be something that is wanted and/or sensible.
>
> Sure it does. You just run mkimage with the Image and create one. I
> suppose you mean that step is not integrated into the kernel build.
>

Yes, that's what I mean.


> That is not wanted. As Daniel pointed out, a uImage is platform
> specific is the first reason. Also, putting every bootloader's custom
> format into the kernel build doesn't really scale.
>

Thanks for the clarification.

>
> > 2. bootm path doesn't have the logic that is currently in the booti,
> such as
> > the
> > kernel relocation.
> >
> > Also, one other question raised during internal discussion was why the
> booti
> > was created in the first place, if we could have had that implemented in
> the
> > bootm path.
>
> I think for simplicity. The bootm logic and command line options are
> already complicated enough.


I can appreciate that :)


> Of course with that logic, we should have
> made Android images a separate command too (some pre-mainline versions
> of Android boot support did do a boota command). Though, IIRC I think
> you can boot an Android boot image containing a uImage for the kernel
>

I tried but didn't succeed on that (using bootm with uImage created from a
arm64 Image ).
I didn't dig deeper and changed the route to trying the booti path instead.

But there are a few things I observed on the bootm path:

-  load address:
   uImage specified the load address that isn't quite right for arch64 (as
Daniel pointed out)
   (and in general, bootm path don't arm64 boot requirement correctly as
booti did)
-  dtb handling :
   for arm64 , dtb must be provided; while arm32 kernel can handle
concatenated dtb.
   And since android image don't have a place to put the dtb, so it seems
not possible to get that implemented generically. I don't know how the
boota command is implemented to pass the dtb information.




> (not something I'd recommend).
>
> Rob
>



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


Re: [U-Boot] [PATCH 2/2] [rfc] support booting arm64 android image

2017-07-13 Thread Bin Chen
On 14 July 2017 at 00:06, Daniel Thompson 
wrote:

> On 13/07/17 08:33, Bin Chen wrote:
>
>> Hi Tom,
>>
>> Thanks for the review.
>>
>> On 13 July 2017 at 04:25, Tom Rini  tr...@konsulko.com>> wrote:
>>
>> On Tue, Jul 11, 2017 at 03:56:04PM +1000, Bin Chen wrote:
>>
>> > It's my understanding that we are supposed to use booti, instead of
>> bootm,
>> > for arm64 image. But booti lacks of android image support. Bootm has
>> > the andriod image support but lack of the arm64 image handling.
>> >
>> > So, what is suppose the right way of booting an android arm64 image?
>> > or, should we create a separate command?
>> >
>> > This patch is an invitation for that discussion.
>> >
>> > It *hacked* the booti command and it aslo assume the dtb is in the
>> second area
>> > of android boot image. It also has other belives like u-boot should
>> be
>> > in control of where to put the kernnel/ramdisk/dtb images so it
>> ignores
>> > the value specified in the android images.
>> >
>> > Signed-off-by: Bin Chen  bin.c...@linaro.org>>
>>
>> So, booti is very much for the "Image" format described in the Linux
>> kernel in Documentation/arm64/booting.txt.  One can (and people have)
>> used bootm on aarch64 for "uImage" style kernels and FIT kernels, and
>> I
>> would see being able to boot an aarch64 Android image with bootm as
>> the
>> way to go forward.
>>
>> Are you suggesting that we should use bootm path, instead of booti?
>>
>> I have two questions regarding this:
>>
>> 1. currently arm64 kernel don't have a uImage kernel target. And I'm not
>> sure
>>   if adding that will be something that is wanted and/or sensible.
>>
>
> All arm64 kernels are multi-platform (even if for some minimized builds
> only drivers for one platform are actually enabled). That means a uImage
> kernel target is problematic because the kernel build system does not know
> its eventual physical load address. On arm64 that is entirely delegated to
> the bootloader.
>
> That doesn't mean uImage can never be used; just that the kernel build
> system has no business authoring one.


Yes, that's exactly what I mean, and why I'm tentative adding a uImage
target for arm64.
Actually I did add that target and found the issue you described.


>
>
>
>> 2. bootm path doesn't have the logic that is currently in the booti, such
>> as the
>> kernel relocation.
>>
>> Also, one other question raised during internal discussion was why the
>> booti
>> was created in the first place, if we could have had that implemented in
>> the
>> bootm path.
>>
>>
>> The analogy would be that we use bootm for Android
>> on arm not bootz.  Thanks!
>>
>> --
>> Tom
>>
>>
>>
>>
>> --
>> Regards,
>> Bin
>>
>
>


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


Re: [U-Boot] Cubox-i broken

2017-07-13 Thread Fabio Estevam
Hi Stefano,

On Wed, Jul 12, 2017 at 6:00 AM, Stefano Babic  wrote:
> Hi Peter,
>
> your :
>
> commit ff1815632563a826cfe49fc9496a36d00febb6e3
> Author: Peter Robinson 
> Date:   Sat Jul 1 18:44:03 2017 +0100
>
> mx6cuboxi: Add support for sata
>
>
> breaks (indirectly) mx6cuboxi. It is associated with changes in
> config_distro_bootcmd.h, my first guess is for :

I have sent a fix for this issue, thanks.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] efi_loader: implement ProtocolsPerHandle

2017-07-13 Thread Heinrich Schuchardt
Boot service ProtocolsPerHandle is implemented in
efi_protocols_per_handle.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 46 ++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index d2b5768ec0..c868b935b2 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -749,9 +749,53 @@ static efi_status_t EFIAPI efi_protocols_per_handle(void 
*handle,
efi_guid_t ***protocol_buffer,
unsigned long *protocol_buffer_count)
 {
+   unsigned long buffer_size;
+   struct efi_object *efiobj;
+   unsigned long i, j;
+   struct list_head *lhandle;
+   efi_status_t r;
+
EFI_ENTRY("%p, %p, %p", handle, protocol_buffer,
  protocol_buffer_count);
-   return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+
+   if (!handle || !protocol_buffer || !protocol_buffer_count)
+   return EFI_EXIT(EFI_INVALID_PARAMETER);
+
+   *protocol_buffer = NULL;
+   *protocol_buffer_count = 0;
+   list_for_each(lhandle, _obj_list) {
+   efiobj = list_entry(lhandle, struct efi_object, link);
+
+   if (efiobj->handle != handle)
+   continue;
+
+   /* Count protocols */
+   for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {
+   if (efiobj->protocols[i].guid)
+   ++*protocol_buffer_count;
+   }
+   /* Copy guids */
+   if (*protocol_buffer_count) {
+   buffer_size = sizeof(efi_guid_t *) *
+   *protocol_buffer_count;
+   r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES,
+ buffer_size,
+ (void **)protocol_buffer);
+   if (r != EFI_SUCCESS)
+   return EFI_EXIT(r);
+   j = 0;
+   for (i = 0; i < ARRAY_SIZE(efiobj->protocols); ++i) {
+   if (efiobj->protocols[i].guid) {
+   (*protocol_buffer)[j] = (void *)
+   efiobj->protocols[i].guid;
+   ++j;
+   }
+   }
+   }
+   break;
+   }
+
+   return EFI_EXIT(EFI_SUCCESS);
 }
 
 static efi_status_t EFIAPI efi_locate_handle_buffer(
-- 
2.11.0

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


Re: [U-Boot] [PATCH 2/2] [rfc] support booting arm64 android image

2017-07-13 Thread Rob Herring
On Thu, Jul 13, 2017 at 2:33 AM, Bin Chen  wrote:
> Hi Tom,
>
> Thanks for the review.
>
> On 13 July 2017 at 04:25, Tom Rini  wrote:
>>
>> On Tue, Jul 11, 2017 at 03:56:04PM +1000, Bin Chen wrote:
>>
>> > It's my understanding that we are supposed to use booti, instead of
>> > bootm,
>> > for arm64 image. But booti lacks of android image support. Bootm has
>> > the andriod image support but lack of the arm64 image handling.
>> >
>> > So, what is suppose the right way of booting an android arm64 image?
>> > or, should we create a separate command?
>> >
>> > This patch is an invitation for that discussion.
>> >
>> > It *hacked* the booti command and it aslo assume the dtb is in the
>> > second area
>> > of android boot image. It also has other belives like u-boot should be
>> > in control of where to put the kernnel/ramdisk/dtb images so it ignores
>> > the value specified in the android images.
>> >
>> > Signed-off-by: Bin Chen 
>>
>> So, booti is very much for the "Image" format described in the Linux
>> kernel in Documentation/arm64/booting.txt.  One can (and people have)
>> used bootm on aarch64 for "uImage" style kernels and FIT kernels, and I
>> would see being able to boot an aarch64 Android image with bootm as the
>> way to go forward.
>
>
> Are you suggesting that we should use bootm path, instead of booti?
>
> I have two questions regarding this:
>
> 1. currently arm64 kernel don't have a uImage kernel target. And I'm not
> sure
>  if adding that will be something that is wanted and/or sensible.

Sure it does. You just run mkimage with the Image and create one. I
suppose you mean that step is not integrated into the kernel build.
That is not wanted. As Daniel pointed out, a uImage is platform
specific is the first reason. Also, putting every bootloader's custom
format into the kernel build doesn't really scale.

> 2. bootm path doesn't have the logic that is currently in the booti, such as
> the
> kernel relocation.
>
> Also, one other question raised during internal discussion was why the booti
> was created in the first place, if we could have had that implemented in the
> bootm path.

I think for simplicity. The bootm logic and command line options are
already complicated enough. Of course with that logic, we should have
made Android images a separate command too (some pre-mainline versions
of Android boot support did do a boota command). Though, IIRC I think
you can boot an Android boot image containing a uImage for the kernel
(not something I'd recommend).

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


[U-Boot] [PATCH] tools/fw_env: use fsync to ensure that data is physically stored

2017-07-13 Thread Vincent Prince
Hi all,

We had the same issue on our custom board, and this patch fixed it.

We use fw_setenv for updating our BSP, and before the patch, 100 boards
over 170 didn't work,
and after, 170/170 did get the update.

This patches worked well for us,
Thanks Michael
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] mkimage

2017-07-13 Thread Bittner, Jeff
New to U-Boot.  It came installed with the BSP on a vendor MPC board to boot 
vxWorks.  I have a requirement to use a checksum when downloading the vxWorks 
ELF image.  Our development environ is Windows 7, using cross-compiler for 
target MPC.  I have the source for U-Boot and see that mkimage is in the tools 
subdirectory, but I can't build all of U-boot for Windows (or even using the 
Wind River cross compiler tools).  Does denx have a compiled mkimage.exe for 
Windows?  Is there a way to build it by itself (without building all of U-boot) 
for Windows?  I'm currently using mkimage.exe from CompuLab, but the company 
wants it from a more standard source, or preferably to build it ourselves.  
Thanks.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] mx6sabreauto: Make Ethernet functional again

2017-07-13 Thread Diego Dorta
2017-07-12 18:31 GMT-03:00 Fabio Estevam :
> From: Fabio Estevam 
>
> Since commit ce412b79e7255770 ("drivers: net: phy: atheros: add separate
> config for AR8031") Ethernet does not work on mx6sabreauto.
>
> This commit correctly assigns ar8031_config() as the configuration
> function for AR8031 in the same way as done in the Linux kernel.
>
> However, on mx6sabreauto design we need some additional configurations,
> such as enabling the 125 MHz AR8031 output and setting the TX clock
> delay that need to be done in the board file.
>
> This is the equivalent fix from commit 4b6035da482c ("mx6sabresd: Make
> Ethernet functional again").
>
> Reported-by: Miquel RAYNAL 
> Signed-off-by: Fabio Estevam 

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


Re: [U-Boot] [PATCH] mx6sabreauto: Make Ethernet functional again

2017-07-13 Thread Diego Dorta
2017-07-12 18:31 GMT-03:00 Fabio Estevam :
> From: Fabio Estevam 
>
> Since commit ce412b79e7255770 ("drivers: net: phy: atheros: add separate
> config for AR8031") Ethernet does not work on mx6sabreauto.
>
> This commit correctly assigns ar8031_config() as the configuration
> function for AR8031 in the same way as done in the Linux kernel.
>
> However, on mx6sabreauto design we need some additional configurations,
> such as enabling the 125 MHz AR8031 output and setting the TX clock
> delay that need to be done in the board file.
>
> This is the equivalent fix from commit 4b6035da482c ("mx6sabresd: Make
> Ethernet functional again").
>
> Reported-by: Miquel RAYNAL 
> Signed-off-by: Fabio Estevam 

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


Re: [U-Boot] [PATCH] mx6sabreauto: Make Ethernet functional again

2017-07-13 Thread Diego Dorta
2017-07-12 18:31 GMT-03:00 Fabio Estevam :
> From: Fabio Estevam 
>
> Since commit ce412b79e7255770 ("drivers: net: phy: atheros: add separate
> config for AR8031") Ethernet does not work on mx6sabreauto.
>
> This commit correctly assigns ar8031_config() as the configuration
> function for AR8031 in the same way as done in the Linux kernel.
>
> However, on mx6sabreauto design we need some additional configurations,
> such as enabling the 125 MHz AR8031 output and setting the TX clock
> delay that need to be done in the board file.
>
> This is the equivalent fix from commit 4b6035da482c ("mx6sabresd: Make
> Ethernet functional again").
>
> Reported-by: Miquel RAYNAL 
> Signed-off-by: Fabio Estevam 

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


[U-Boot] [PATCH v2 4/5] efi_loader: debug info in efi_convert_device_path_to_text

2017-07-13 Thread Heinrich Schuchardt
The debug information provided by efi_convert_device_path_to_text
is insufficient. The type and the subtype are needed to find
out why the function did not support a conversion.

Signed-off-by: Heinrich Schuchardt 
---
v2
debug statement has to be after parameter check
to avoid NULL dereference
---
 lib/efi_loader/efi_device_path_to_text.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/efi_loader/efi_device_path_to_text.c 
b/lib/efi_loader/efi_device_path_to_text.c
index a5ea63300b..56de328286 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -41,6 +41,9 @@ uint16_t *efi_convert_device_path_to_text(
return NULL;
}
 
+   debug("EFI: type %d, subtype %d\n",
+ device_path->type, device_path->sub_type);
+
switch (device_path->type) {
case DEVICE_PATH_TYPE_MESSAGING_DEVICE:
switch (device_path->sub_type) {
-- 
2.11.0

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


[U-Boot] [PATCH v2 0/5] efi_convert_device_path_to_text

2017-07-13 Thread Heinrich Schuchardt
The patch series provides the DevicePathToText function for MAC
addresses and some error corrections.

The 1st patch removes duplicate constants that we already have 
defined in efi_api.h.

The 2nd patch implements the DevicePathToText function for MAC
addresses.

The 3rd patch adds a missing parameter check.

The 4th patch supplies additional debug output.

The 5th patch moves the declarations to the beginning of the
function efi_convert_device_path_to_text.

Signed-off-by: Heinrich Schuchardt 

---
v2
Switch patch 3 and 4.
Put debug statement after parameter check.
Add patch 5.
---

Heinrich Schuchardt (5):
  efi_loader: do not duplicate constants for device path
  efi_loader: DevicePathToText for MAC address
  efi_loader: parameter check efi_convert_device_path_to_text
  efi_loader: debug info in efi_convert_device_path_to_text
  efi_loader: DevicePathToText put declarations first

 lib/efi_loader/efi_device_path_to_text.c | 44 +++-
 1 file changed, 38 insertions(+), 6 deletions(-)

-- 
2.11.0

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


[U-Boot] [PATCH v2 1/5] efi_loader: do not duplicate constants for device path

2017-07-13 Thread Heinrich Schuchardt
We should not duplicate existing constants used by the
device path protocol.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 lib/efi_loader/efi_device_path_to_text.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/efi_loader/efi_device_path_to_text.c 
b/lib/efi_loader/efi_device_path_to_text.c
index a7a513047f..3a92247f30 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -9,9 +9,6 @@
 #include 
 #include 
 
-#define MEDIA_DEVICE_PATH 4
-#define FILE_PATH_MEDIA_DEVICE_PATH 4
-
 const efi_guid_t efi_guid_device_path_to_text_protocol =
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
 
@@ -38,9 +35,9 @@ uint16_t *efi_convert_device_path_to_text(
uint16_t *buffer = NULL;
 
switch (device_path->type) {
-   case MEDIA_DEVICE_PATH:
+   case DEVICE_PATH_TYPE_MEDIA_DEVICE:
switch (device_path->sub_type) {
-   case FILE_PATH_MEDIA_DEVICE_PATH:
+   case DEVICE_PATH_SUB_TYPE_FILE_PATH:
buffer_size = device_path->length - 4;
r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES,
  buffer_size, (void **) );
-- 
2.11.0

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


[U-Boot] [PATCH v2 5/5] efi_loader: DevicePathToText put declarations first

2017-07-13 Thread Heinrich Schuchardt
Variables should be declared before the first executable statement.

Signed-off-by: Heinrich Schuchardt 
---
v2
new patch
---
 lib/efi_loader/efi_device_path_to_text.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_device_path_to_text.c 
b/lib/efi_loader/efi_device_path_to_text.c
index 56de328286..621bc4f528 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -30,12 +30,12 @@ uint16_t *efi_convert_device_path_to_text(
bool display_only,
bool allow_shortcuts)
 {
-   EFI_ENTRY("%p, %d, %d", device_path, display_only, allow_shortcuts);
-
unsigned long buffer_size;
efi_status_t r;
uint16_t *buffer = NULL;
 
+   EFI_ENTRY("%p, %d, %d", device_path, display_only, allow_shortcuts);
+
if (!device_path) {
EFI_EXIT(EFI_INVALID_PARAMETER);
return NULL;
-- 
2.11.0

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


[U-Boot] [PATCH v2 3/5] efi_loader: parameter check efi_convert_device_path_to_text

2017-07-13 Thread Heinrich Schuchardt
Do not dereference NULL.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 lib/efi_loader/efi_device_path_to_text.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/efi_loader/efi_device_path_to_text.c 
b/lib/efi_loader/efi_device_path_to_text.c
index c6ac5e52f3..a5ea63300b 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -36,6 +36,11 @@ uint16_t *efi_convert_device_path_to_text(
efi_status_t r;
uint16_t *buffer = NULL;
 
+   if (!device_path) {
+   EFI_EXIT(EFI_INVALID_PARAMETER);
+   return NULL;
+   }
+
switch (device_path->type) {
case DEVICE_PATH_TYPE_MESSAGING_DEVICE:
switch (device_path->sub_type) {
-- 
2.11.0

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


[U-Boot] [PATCH v2 2/5] efi_loader: DevicePathToText for MAC address

2017-07-13 Thread Heinrich Schuchardt
Implement DevicePathToText MAC address device path.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 lib/efi_loader/efi_device_path_to_text.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/lib/efi_loader/efi_device_path_to_text.c 
b/lib/efi_loader/efi_device_path_to_text.c
index 3a92247f30..c6ac5e52f3 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -9,6 +9,8 @@
 #include 
 #include 
 
+#define MAC_OUTPUT_LEN 22
+
 const efi_guid_t efi_guid_device_path_to_text_protocol =
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
 
@@ -35,6 +37,31 @@ uint16_t *efi_convert_device_path_to_text(
uint16_t *buffer = NULL;
 
switch (device_path->type) {
+   case DEVICE_PATH_TYPE_MESSAGING_DEVICE:
+   switch (device_path->sub_type) {
+   case DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR: {
+   struct efi_device_path_mac_addr *dp =
+   (struct efi_device_path_mac_addr *)device_path;
+   int i;
+
+   if (dp->if_type != 0 && dp->if_type != 1)
+   break;
+   r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES,
+ 2 * MAC_OUTPUT_LEN,
+ (void **));
+   if (r != EFI_SUCCESS)
+   break;
+   sprintf((char *)buffer,
+   "MAC(%02x%02x%02x%02x%02x%02x,0x%1x)",
+   dp->mac.addr[0], dp->mac.addr[1],
+   dp->mac.addr[2], dp->mac.addr[3],
+   dp->mac.addr[4], dp->mac.addr[5],
+   dp->if_type);
+   for (i = MAC_OUTPUT_LEN - 1; i >= 0; --i)
+   buffer[i] = ((uint8_t *)buffer)[i];
+   break;
+   }
+   }
case DEVICE_PATH_TYPE_MEDIA_DEVICE:
switch (device_path->sub_type) {
case DEVICE_PATH_SUB_TYPE_FILE_PATH:
-- 
2.11.0

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


[U-Boot] [PATCH 4/4] efi_loader: parameter check efi_convert_device_path_to_text

2017-07-13 Thread Heinrich Schuchardt
Do not dereference NULL.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_device_path_to_text.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/efi_loader/efi_device_path_to_text.c 
b/lib/efi_loader/efi_device_path_to_text.c
index 746b34a377..81a6a91e66 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -39,6 +39,11 @@ uint16_t *efi_convert_device_path_to_text(
efi_status_t r;
uint16_t *buffer = NULL;
 
+   if (!device_path) {
+   EFI_EXIT(EFI_INVALID_PARAMETER);
+   return NULL;
+   }
+
switch (device_path->type) {
case DEVICE_PATH_TYPE_MESSAGING_DEVICE:
switch (device_path->sub_type) {
-- 
2.11.0

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


[U-Boot] [PATCH 0/4] efi_convert_device_path_to_text

2017-07-13 Thread Heinrich Schuchardt
The patch series provides the DevicePathToText function for MAC
addresses and some error corrections.

The 1st patch removes duplicate constants that we already have 
defined in efi_api.h.

The 2nd patch implements the DevicePathToText function for MAC
addresses.

The 3rd patch supplies additional debug output.

The 4th patch adds a missing parameter check.

Signed-off-by: Heinrich Schuchardt 

Heinrich Schuchardt (4):
  efi_loader: do not duplicate constants for device path
  efi_loader: DevicePathToText for MAC address
  efi_loader: debug info in efi_convert_device_path_to_text
  efi_loader: parameter check efi_convert_device_path_to_text

 lib/efi_loader/efi_device_path_to_text.c | 40 
 1 file changed, 36 insertions(+), 4 deletions(-)

-- 
2.11.0

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


[U-Boot] [PATCH 3/4] efi_loader: debug info in efi_convert_device_path_to_text

2017-07-13 Thread Heinrich Schuchardt
The debug information provided by efi_convert_device_path_to_text
is insufficient. The type and the subtype are needed to find
out why the function did not support a conversion.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_device_path_to_text.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/efi_loader/efi_device_path_to_text.c 
b/lib/efi_loader/efi_device_path_to_text.c
index c6ac5e52f3..746b34a377 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -32,6 +32,9 @@ uint16_t *efi_convert_device_path_to_text(
 {
EFI_ENTRY("%p, %d, %d", device_path, display_only, allow_shortcuts);
 
+   debug("EFI: type %d, subtype %d\n",
+ device_path->type, device_path->sub_type);
+
unsigned long buffer_size;
efi_status_t r;
uint16_t *buffer = NULL;
-- 
2.11.0

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


Re: [U-Boot] [PATCH] tools: buildman: prevent trying to use the working directory as build dorectory

2017-07-13 Thread Simon Glass
On 5 July 2017 at 01:34, Lothar Waßmann  wrote:
> When the U-Boot base directory happens to have the same name as the
> branch that buildman is directed to use via the '-b' option and no
> output directory is specified with '-o', buildman happily starts
> removing the whole U-Boot sources eventually only stopped with the
> error message:
> OSError: [Errno 20] Not a directory: '..//boards.cfg
>
> Add a check to the builderthread.Mkdir function to verify that the
> path it tries to create does not match the current working
> directory.
>
> Signed-off-by: Lothar Waßmann 
> ---
>  tools/buildman/builderthread.py | 4 
>  1 file changed, 4 insertions(+)

That's nasty, thanks for the fix.

But this is being done inside each thread so I'm not sure how this
will be reported, or whether buildman will stop correctly.

Can the check happen before the build even starts, perhaps? E,g, in builder.py?

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


Re: [U-Boot] [PATCH] dm: core: don't fail to iterate if first one fails to probe

2017-07-13 Thread Simon Glass
Hi Rob,

On 21 June 2017 at 04:52, Rob Clark  wrote:
> On Wed, Jun 21, 2017 at 6:23 AM, Peter Robinson  wrote:
>> On Tue, Jun 20, 2017 at 10:49 PM, Rob Clark  wrote:
>>> efi_disk_register() would try to iterate all the blk devices.  But if
>>> the first one in the list failed to probe, uclass_first_device() would
>>> return NULL and no attempt would be made to register the remaining
>>> devices.  Also uclass_next_device() needs the same fix.
>>
>> This looks related/similar to the "efi_loader: disk: iterate only over
>> valid block devices" patch [1]
>>
>
> hmm, I don't see uclass_first_device_check() which I guess must be
> part of another in-flight patch?  I don't mind too much *how* we fix
> it, as long as it works.  (Although it seems more sensible to just
> make uclass_first_device()/etc dtrt rather than introducing another
> function that actually works properly.. but that is only my $0.02)

That patch is now in mainline. It was delayed for a release as I did
not get any reviews and so wasn't sure if it was needed.

I believe the common case is wanting to stop on error, since it means
something is wrong. The case of continuing onto another device when
the first one fails is unusual. We should always check return codes
and return errors when something is wrong.

I believe this case is happening because the device is removable and
therefore returns an error. Is that right? If so then we should return
a single error, such as -ENOMEDIUM so that the caller can ignore that
error, or consider it OK.

In general, though, errors should not be ignored.

Regards,
Simon

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


Re: [U-Boot] [PATCH v2 02/15] dm: mmc: Allow disabling driver model in SPL

2017-07-13 Thread Simon Glass
Hi Jean-Jacques,

On 6 July 2017 at 08:55, Jean-Jacques Hiblot  wrote:
> Hi Simon,
>
>
>
> On 04/07/2017 21:31, Simon Glass wrote:
>>
>> At present if U-Boot proper uses driver model for MMC, then SPL has to
>> also. While this is desirable, it places a significant barrier to moving
>> to driver model in some cases. For example, with a space-constrained SPL
>> it may be necessary to enable CONFIG_SPL_OF_PLATDATA which involves
>> adjusting some drivers.
>>
>> Add new SPL versions of the options for DM_MMC, DM_MMC_OPS and BLK. By
>> default these follow their non-SPL versions, but this can be changed by
>> boards which need it.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>> Changes in v2: None
>>
>>   common/spl/spl_mmc.c  |  4 ++--
>>   drivers/block/Kconfig | 12 
>>   drivers/block/Makefile|  4 ++--
>>   drivers/mmc/Kconfig   | 21 +
>>   drivers/mmc/Makefile  |  4 ++--
>>   drivers/mmc/mmc-uclass.c  |  6 +++---
>>   drivers/mmc/mmc.c | 28 ++--
>>   drivers/mmc/mmc_legacy.c  |  2 +-
>>   drivers/mmc/mmc_private.h |  6 +++---
>>   drivers/mmc/omap_hsmmc.c  | 20 ++--
>>   drivers/scsi/scsi.c   |  2 +-
>>   include/blk.h |  4 ++--
>>   include/mmc.h | 12 ++--
>>   13 files changed, 79 insertions(+), 46 deletions(-)
>>
>> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
>> index 18c1b59b22..953e484e27 100644
>> --- a/common/spl/spl_mmc.c
>> +++ b/common/spl/spl_mmc.c
>> @@ -115,7 +115,7 @@ int spl_mmc_get_device_index(u32 boot_device)
>> static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
>>   {
>> -#ifdef CONFIG_DM_MMC
>> +#if CONFIG_IS_ENABLED(DM_MMC)
>> struct udevice *dev;
>>   #endif
>> int err, mmc_dev;
>> @@ -132,7 +132,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32
>> boot_device)
>> return err;
>> }
>>   -#ifdef CONFIG_DM_MMC
>> +#if CONFIG_IS_ENABLED(DM_MMC)
>> err = uclass_get_device(UCLASS_MMC, mmc_dev, );
>> if (!err)
>> *mmcp = mmc_get_mmc_dev(dev);
>> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
>> index ca7692d8a5..26760895f9 100644
>> --- a/drivers/block/Kconfig
>> +++ b/drivers/block/Kconfig
>> @@ -10,6 +10,18 @@ config BLK
>>   be partitioned into several areas, called 'partitions' in
>> U-Boot.
>>   A filesystem can be placed in each partition.
>>   +config SPL_BLK
>> +   bool "Support block devices in SPL"
>> +   depends on SPL_DM && BLK
>> +   default y
>> +   help
>> + Enable support for block devices, such as SCSI, MMC and USB
>> + flash sticks. These provide a block-level interface which
>> permits
>> + reading, writing and (in some cases) erasing blocks. Block
>> + devices often have a partition table which allows the device to
>> + be partitioned into several areas, called 'partitions' in
>> U-Boot.
>> + A filesystem can be placed in each partition.
>> +
>
>
>>   config BLOCK_CACHE
>> bool "Use block device cache"
>> default n
>> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
>> index a5e7307c97..dea2c15c14 100644
>> --- a/drivers/block/Makefile
>> +++ b/drivers/block/Makefile
>> @@ -5,9 +5,9 @@
>>   # SPDX-License-Identifier:GPL-2.0+
>>   #
>>   -obj-$(CONFIG_BLK) += blk-uclass.o
>> +obj-$(CONFIG_$(SPL_)BLK) += blk-uclass.o
>>   -ifndef CONFIG_BLK
>> +ifndef CONFIG_$(SPL_)BLK
>>   obj-y += blk_legacy.o
>>   endif
>>   diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
>> index 82b8d75686..51a87cdd77 100644
>> --- a/drivers/mmc/Kconfig
>> +++ b/drivers/mmc/Kconfig
>> @@ -30,6 +30,27 @@ config DM_MMC_OPS
>>   option will be removed as soon as all DM_MMC drivers use it, as
>> it
>>   will the only supported behaviour.
>>   +config SPL_DM_MMC
>> +   bool "Enable MMC controllers using Driver Model in SPL"
>> +   depends on SPL_DM && DM_MMC
>> +   default y
>> +   help
>> + This enables the MultiMediaCard (MMC) uclass which supports MMC
>> and
>> + Secure Digital I/O (SDIO) cards. Both removable (SD, micro-SD,
>> etc.)
>> + and non-removable (e.g. eMMC chip) devices are supported. These
>> + appear as block devices in U-Boot and can support filesystems
>> such
>> + as EXT4 and FAT.
>> +
>> +config SPL_DM_MMC_OPS
>> +   bool "Support MMC controller operations using Driver Model in SPL"
>> +   depends on SPL_DM && DM_MMC_OPS
>> +   default y
>> +   help
>> + Driver model provides a means of supporting device operations.
>> This
>> + option moves MMC operations under the control of driver model.
>> The
>> + option will be removed as soon as all DM_MMC drivers use it, as
>> it
>> + will the only supported behaviour.
>> +
>>   if MMC
>> config SPL_MMC_TINY
>> diff 

Re: [U-Boot] [PATCH 1/1] efi_loader: disk: iterate only over valid block devices

2017-07-13 Thread Simon Glass
Hi,

On 13 July 2017 at 10:42, Heinrich Schuchardt  wrote:
> On 07/03/2017 06:07 PM, Alexander Graf wrote:
>> On 07/03/2017 05:34 PM, Simon Glass wrote:
>>> Hi Alex,
>>>
>>> On 3 July 2017 at 06:37, Alexander Graf  wrote:
 On 06/20/2017 09:39 PM, Andreas Färber wrote:
> Am 20.06.2017 um 21:10 schrieb Heinrich Schuchardt:
>> The efi_loader currently stops iterating over the available
>> block devices stopping at the first device that fails.
>> This may imply that no block device is found.
>>
>> With the patch efi_loader only iterates over valid devices.
>>
>> It is based on patch
>> 06d592bf52f6 (dm: core: Add uclass_first/next_device_check())
>> which is currently in u-boot-dm.git.
>>
>> For testing I used an odroid-c2 with a dts including
>> _emmc_a {
>>  status = "okay";
>> };
>> This device does not exist on the board and cannot be initialized.
>>
>> Without the patch:
>>
>> => bootefi hello
>> ## Starting EFI application at 0100 ...
>> WARNING: Invalid device tree, expect boot to fail
>> mmc_init: -95, time 1806
>> Found 0 disks
>> Hello, world!
>> ## Application terminated, r = 0
>>
>> With the patch:
>>
>> => bootefi hello
>> ## Starting EFI application at 0100 ...
>> WARNING: Invalid device tree, expect boot to fail
>> mmc_init: -95, time 1806
>> Scanning disk m...@7.blk...
>> Scanning disk m...@72000.blk...
>> Card did not respond to voltage select!
>> mmc_init: -95, time 9
>> Scanning disk m...@74000.blk...
>> Found 3 disks
>> Hello, world!
>> ## Application terminated, r = 0
>>
>> Signed-off-by: Heinrich Schuchardt 
>> ---
>>lib/efi_loader/efi_disk.c | 4 ++--
>>1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
>> index 39e602a868..4e8e7d0ad6 100644
>> --- a/lib/efi_loader/efi_disk.c
>> +++ b/lib/efi_loader/efi_disk.c
>> @@ -289,9 +289,9 @@ int efi_disk_register(void)
>>#ifdef CONFIG_BLK
>>  struct udevice *dev;
>>- for (uclass_first_device(UCLASS_BLK, );
>> +   for (uclass_first_device_check(UCLASS_BLK, );
>>   dev;
>> -uclass_next_device()) {
>> +uclass_next_device_check()) {
>>  struct blk_desc *desc = dev_get_uclass_platdata(dev);
>>  const char *if_typename = dev->driver->name;
>>
> Thanks, looks good.
>
> Reviewed-by: Andreas Färber 
>
> This will be needed for the NanoPi K2 when importing the SDIO-enabled
> Linux .dts.

 Simon, this patch requires your patches to be in tree first. What's your
 plan to move forward here?
>>> It is applied to u-boot-dm/master but was too late for this release,
>>> which should be in a week.
>>
>> Awesome :). Please CC me on the pull request then, so that I see when I
>> can merge things into mine and apply it there.

I didn't think to cc you, but it is now in mainline.

>>
>>
>> Alex
>>
>>
>
> Hello Alex,
>
> in your efi-next tree you now have the prerequisite patch.
>
> Please, pull
> https://patchwork.ozlabs.org/patch/778454/
>
> Best regards
>
> Heinrich

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


Re: [U-Boot] [PATCH 1/1] efi_loader: disk: iterate only over valid block devices

2017-07-13 Thread Heinrich Schuchardt
On 07/03/2017 06:07 PM, Alexander Graf wrote:
> On 07/03/2017 05:34 PM, Simon Glass wrote:
>> Hi Alex,
>>
>> On 3 July 2017 at 06:37, Alexander Graf  wrote:
>>> On 06/20/2017 09:39 PM, Andreas Färber wrote:
 Am 20.06.2017 um 21:10 schrieb Heinrich Schuchardt:
> The efi_loader currently stops iterating over the available
> block devices stopping at the first device that fails.
> This may imply that no block device is found.
>
> With the patch efi_loader only iterates over valid devices.
>
> It is based on patch
> 06d592bf52f6 (dm: core: Add uclass_first/next_device_check())
> which is currently in u-boot-dm.git.
>
> For testing I used an odroid-c2 with a dts including
> _emmc_a {
>  status = "okay";
> };
> This device does not exist on the board and cannot be initialized.
>
> Without the patch:
>
> => bootefi hello
> ## Starting EFI application at 0100 ...
> WARNING: Invalid device tree, expect boot to fail
> mmc_init: -95, time 1806
> Found 0 disks
> Hello, world!
> ## Application terminated, r = 0
>
> With the patch:
>
> => bootefi hello
> ## Starting EFI application at 0100 ...
> WARNING: Invalid device tree, expect boot to fail
> mmc_init: -95, time 1806
> Scanning disk m...@7.blk...
> Scanning disk m...@72000.blk...
> Card did not respond to voltage select!
> mmc_init: -95, time 9
> Scanning disk m...@74000.blk...
> Found 3 disks
> Hello, world!
> ## Application terminated, r = 0
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>lib/efi_loader/efi_disk.c | 4 ++--
>1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 39e602a868..4e8e7d0ad6 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -289,9 +289,9 @@ int efi_disk_register(void)
>#ifdef CONFIG_BLK
>  struct udevice *dev;
>- for (uclass_first_device(UCLASS_BLK, );
> +   for (uclass_first_device_check(UCLASS_BLK, );
>   dev;
> -uclass_next_device()) {
> +uclass_next_device_check()) {
>  struct blk_desc *desc = dev_get_uclass_platdata(dev);
>  const char *if_typename = dev->driver->name;
>
 Thanks, looks good.

 Reviewed-by: Andreas Färber 

 This will be needed for the NanoPi K2 when importing the SDIO-enabled
 Linux .dts.
>>>
>>> Simon, this patch requires your patches to be in tree first. What's your
>>> plan to move forward here?
>> It is applied to u-boot-dm/master but was too late for this release,
>> which should be in a week.
> 
> Awesome :). Please CC me on the pull request then, so that I see when I
> can merge things into mine and apply it there.
> 
> 
> Alex
> 
> 

Hello Alex,

in your efi-next tree you now have the prerequisite patch.

Please, pull
https://patchwork.ozlabs.org/patch/778454/

Best regards

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


Re: [U-Boot] [EXT] Re: [v2] arm64: mvebu: use single defconfig for Armada8K development boards

2017-07-13 Thread Igal Liberman
Hi Stefan, 
Thank you.

I plan to create a minimal default device-tree as we discussed before.
I'll send it when it'll be ready.

Regards,
Igal


> -Original Message-
> From: Stefan Roese [mailto:s...@denx.de]
> Sent: Wednesday, July 12, 2017 08:54
> To: Igal Liberman; u-boot@lists.denx.de
> Cc: Kostya Porotchkin; Nadav Haklai; Neta Zur Hershkovits
> Subject: [EXT] Re: [v2] arm64: mvebu: use single defconfig for Armada8K
> development boards
> 
> External Email
> 
> --
> Hi Igal,
> 
> On 13.06.2017 09:35, ig...@marvell.com wrote:
> > From: Igal Liberman 
> >
> > Currently, Marvell Armada8k development board use 3 different
> > defconfigs:
> >  mvebu_db-88f7040-nand_defconfig
> >  mvebu_db-88f7040_defconfig
> >  mvebu_db-88f8040_defconfig
> > Having 3 different defconfigs makes maintenance difficult.
> >
> > This patch removes the defconfigs mentioned above and introduce a new
> > defconfig which represents the Armada8k family.
> >
> > NOTE:
> > In order not to break automatic tools compilation, a default
> > device-tree is set in the defconfig (armada-8040-db).
> > However, when compiling u-boot, the user MUST explicitly export the
> > DEVICE_TREE for the requested board because using A80x0 device-tree on
> > A70x0 might break the device.
> >
> > For more information, refer to "doc/README.marvell" (intoduced in this
> > patch).
> >
> > Change-Id: I98515b6306498358f3722ecf7ac4c87f236ebbd8
> > Signed-off-by: Igal Liberman 
> 
> Applied to u-boot-marvell/master.
> 
> Thanks,
> Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH BUGFIX] net: fec_mxc: adjust prototype of fec_get_miibus() for DM_ETH

2017-07-13 Thread Stefano Babic
On 13/07/2017 07:57, Lothar Waßmann wrote:
> commit 306dd7dabd64 ("net: fec_mxc: fix PHY initialization bug with 
> CONFIG_DM_ETH")
> has broken the build of the fec_mxc driver with CONFIG_DM_ETH
> enabled because it changed the parameters passed to *fec_get_miibus()
> without changing the functions prototype.
> 
> This patch fixes up the prototype of fec_get_miibus() for the DM_ETH case.
> 
> Signed-off-by: Lothar Waßmann 
> ---
>  drivers/net/fec_mxc.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 4ad4ddc..e42d54b 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -985,9 +985,18 @@ static void fec_free_descs(struct fec_priv *fec)
>   free(fec->tbd_base);
>  }
>  
> +#ifdef CONFIG_DM_ETH
> +struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
> +#else
>  struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
> +#endif

Is it enough ? fec_get_miibus prototype is in include/netdev.h.

>  {
> +#ifdef CONFIG_DM_ETH
> + struct fec_priv *priv = dev_get_priv(dev);
> + struct ethernet_regs *eth = priv->eth;
> +#else
>   struct ethernet_regs *eth = (struct ethernet_regs *)base_addr;
> +#endif
>   struct mii_dev *bus;
>   int ret;
>  
> 

Best regards,
Stefano

-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Ethernet not functional on i.MX6DL Sabre Auto

2017-07-13 Thread Stefano Babic
On 13/07/2017 16:07, Fabio Estevam wrote:
> Hi Miquel,
> 
> On Thu, Jul 13, 2017 at 3:34 AM, Miquel RAYNAL
>  wrote:
> 
>> Thank you for the very quick answer, I was not able to test the patch
>> yesterday but now I can confirm it works and Ethernet is functional
>> again on mx6sabreauto design.
> 
> Thanks for testing!
> 
>> The patch you sent does only apply on imx tree though (the path
>> contains mx6sabreauto instead of mx6qsabreauto).
> 
> On the latest u-boot-imx tree the mx6sabreauto have been converted to
> SPL, so the same SPL + u-boot.img can boot mx6q/mx6dl/mx6qp sabreauto
> boards.
> 
> That's the reason we have renamed it from mx6qsabreauto to the more
> generic mx6sabreauto naming.

Right - thanks for fix and testing. I have already merged it into
u-boot-imx, thanks !

Best regards,
Stefano


-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Ethernet not functional on i.MX6DL Sabre Auto

2017-07-13 Thread Fabio Estevam
Hi Miquel,

On Thu, Jul 13, 2017 at 3:34 AM, Miquel RAYNAL
 wrote:

> Thank you for the very quick answer, I was not able to test the patch
> yesterday but now I can confirm it works and Ethernet is functional
> again on mx6sabreauto design.

Thanks for testing!

> The patch you sent does only apply on imx tree though (the path
> contains mx6sabreauto instead of mx6qsabreauto).

On the latest u-boot-imx tree the mx6sabreauto have been converted to
SPL, so the same SPL + u-boot.img can boot mx6q/mx6dl/mx6qp sabreauto
boards.

That's the reason we have renamed it from mx6qsabreauto to the more
generic mx6sabreauto naming.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] [rfc] support booting arm64 android image

2017-07-13 Thread Daniel Thompson

On 13/07/17 08:33, Bin Chen wrote:

Hi Tom,

Thanks for the review.

On 13 July 2017 at 04:25, Tom Rini > wrote:


On Tue, Jul 11, 2017 at 03:56:04PM +1000, Bin Chen wrote:

> It's my understanding that we are supposed to use booti, instead of bootm,
> for arm64 image. But booti lacks of android image support. Bootm has
> the andriod image support but lack of the arm64 image handling.
>
> So, what is suppose the right way of booting an android arm64 image?
> or, should we create a separate command?
>
> This patch is an invitation for that discussion.
>
> It *hacked* the booti command and it aslo assume the dtb is in the second 
area
> of android boot image. It also has other belives like u-boot should be
> in control of where to put the kernnel/ramdisk/dtb images so it ignores
> the value specified in the android images.
>
> Signed-off-by: Bin Chen >

So, booti is very much for the "Image" format described in the Linux
kernel in Documentation/arm64/booting.txt.  One can (and people have)
used bootm on aarch64 for "uImage" style kernels and FIT kernels, and I
would see being able to boot an aarch64 Android image with bootm as the
way to go forward. 



Are you suggesting that we should use bootm path, instead of booti?

I have two questions regarding this:

1. currently arm64 kernel don't have a uImage kernel target. And I'm not 
sure

  if adding that will be something that is wanted and/or sensible.


All arm64 kernels are multi-platform (even if for some minimized builds 
only drivers for one platform are actually enabled). That means a uImage 
kernel target is problematic because the kernel build system does not 
know its eventual physical load address. On arm64 that is entirely 
delegated to the bootloader.


That doesn't mean uImage can never be used; just that the kernel build 
system has no business authoring one.





2. bootm path doesn't have the logic that is currently in the booti, 
such as the

kernel relocation.

Also, one other question raised during internal discussion was why the 
booti
was created in the first place, if we could have had that implemented in 
the

bootm path.


The analogy would be that we use bootm for Android
on arm not bootz.  Thanks!

--
Tom




--
Regards,
Bin


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


Re: [U-Boot] [PATCH 2/3] configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

2017-07-13 Thread Jean-Jacques Hiblot



On 13/07/2017 15:45, Lokesh Vutla wrote:


On 7/13/2017 5:15 AM, Tom Rini wrote:

On Thu, Jul 13, 2017 at 12:18:43AM +0530, Lokesh Vutla wrote:


On 7/12/2017 11:01 PM, Tom Rini wrote:

On Wed, Jul 12, 2017 at 07:16:27PM +0530, Lokesh Vutla wrote:


+ Andrew

On 7/12/2017 3:25 PM, Jean-Jacques Hiblot wrote:

This regulator is used for voltage switching on MMC1 IO lines.

Can you enable on HS platforms as well.

Is this a SoC thing (which includes a strongly encouraged to use in
designs) or a board choice (you really can expect to find custom boards
that wouldn't want this) ?  I'm asking because it sounds like perhaps we
should be imply'ing somewhere instead so that HS and EVM and custom
boards are in sync.  Thanks!

Regulators are a board choice. Yes, that makes sense. These can be
implied for TARGET_DRA7XX_EVM.

And that's really true?  I ask since I recall there's some SoCs where
it's a lot more theoretical than practical to have a PMIC other than the

Well, it is still possible to use a different PMIC and I guess it is
better to stick it that way.
PBIAS is not board specific, it's in the SOC. I should probably make the 
hsmmc select it automatically when using DM_MMC and DM_REGULATOR.



one the EVM uses.  But, yes, board level imply is the way to go then.
The rule of thumb should be that if it's not really optional, the board
or SoC should imply it if there's a reason to not have it, or select it
if it's required.


Jean,
Can you repost the patch as Tom suggested?

Thanks and regards,
Lokesh




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


[U-Boot] [RFC PATCH] common: board_f: Make reserve_mmu a weak function

2017-07-13 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Michal Simek 
---

 common/board_f.c | 2 +-
 include/common.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/board_f.c b/common/board_f.c
index 2cdd12a503ae..09f0fbfb6c96 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -340,7 +340,7 @@ static int reserve_round_4k(void)
 }
 
 #ifdef CONFIG_ARM
-static int reserve_mmu(void)
+__weak int reserve_mmu(void)
 {
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
/* reserve TLB table */
diff --git a/include/common.h b/include/common.h
index 1a98512ab618..ce4c92015928 100644
--- a/include/common.h
+++ b/include/common.h
@@ -286,6 +286,7 @@ void board_show_dram(phys_size_t size);
  */
 int arch_fixup_fdt(void *blob);
 
+int reserve_mmu(void);
 /* common/flash.c */
 void flash_perror (int);
 
-- 
1.9.1

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


[U-Boot] [PATCH 6/6] ram: stm32: add stm32h7 support

2017-07-13 Thread patrice.chotard
From: Patrice Chotard 

STM32F7 and H7 shared the same SDRAM control block.
On STM32H7 few control bits has been added.
The current driver need some minor adaptation as FMC block
enable/disable for H7.

Signed-off-by: Patrice Chotard 
Acked-by: Vikas MANOCHA 
---
 drivers/ram/stm32_sdram.c | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 5e7539c..e27c6a8 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -54,6 +54,10 @@ struct stm32_fmc_regs {
u32 sdsr;   /* SDRAM Status register */
 };
 
+/* NOR/PSRAM Control register BCR1 */
+#define FMC_BCR1_FMCEN 31  /* FMC controller Enable, only availabe
+  for H7*/
+
 /* Control register SDCR */
 #define FMC_SDCR_RPIPE_SHIFT   13  /* RPIPE bit shift */
 #define FMC_SDCR_RBURST_SHIFT  12  /* RBURST bit shift */
@@ -123,6 +127,11 @@ enum stm32_fmc_bank {
MAX_SDRAM_BANK,
 };
 
+enum stm32_fmc_family {
+   STM32F7_FMC,
+   STM32H7_FMC,
+};
+
 struct bank_params {
struct stm32_sdram_control *sdram_control;
struct stm32_sdram_timing *sdram_timing;
@@ -134,6 +143,7 @@ struct stm32_sdram_params {
struct stm32_fmc_regs *base;
u8 no_sdram_banks;
struct bank_params bank_params[MAX_SDRAM_BANK];
+   enum stm32_fmc_family family;
 };
 
 #define SDRAM_MODE_BL_SHIFT0
@@ -151,6 +161,10 @@ int stm32_sdram_init(struct udevice *dev)
u32 ref_count;
u8 i;
 
+   /* disable the FMC controller */
+   if (params->family == STM32H7_FMC)
+   generic_clear_bit(FMC_BCR1_FMCEN, (unsigned long *)>bcr1);
+
for (i = 0; i < params->no_sdram_banks; i++) {
control = params->bank_params[i].sdram_control;
timing = params->bank_params[i].sdram_timing;
@@ -193,6 +207,7 @@ int stm32_sdram_init(struct udevice *dev)
| timing->txsr << FMC_SDTR_TXSR_SHIFT
| timing->tmrd << FMC_SDTR_TMRD_SHIFT,
>sdtr2);
+
if (target_bank == SDRAM_BANK1)
ctb = FMC_SDCMR_BANK_1;
else
@@ -225,6 +240,10 @@ int stm32_sdram_init(struct udevice *dev)
writel(ref_count << 1, >sdrtr);
}
 
+   /* enable the FMC controller */
+   if (params->family == STM32H7_FMC)
+   generic_set_bit(FMC_BCR1_FMCEN, (unsigned long *)>bcr1);
+
return 0;
 }
 
@@ -305,6 +324,7 @@ static int stm32_fmc_probe(struct udevice *dev)
return -EINVAL;
 
params->base = (struct stm32_fmc_regs *)addr;
+   params->family = dev_get_driver_data(dev);
 
 #ifdef CONFIG_CLK
struct clk clk;
@@ -337,7 +357,8 @@ static struct ram_ops stm32_fmc_ops = {
 };
 
 static const struct udevice_id stm32_fmc_ids[] = {
-   { .compatible = "st,stm32-fmc" },
+   { .compatible = "st,stm32-fmc", .data = STM32F7_FMC },
+   { .compatible = "st,stm32h7-fmc", .data = STM32H7_FMC },
{ }
 };
 
-- 
1.9.1

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


[U-Boot] [PATCH 5/6] ARM: DTS: stm32: remove useless mr-nbanks property

2017-07-13 Thread patrice.chotard
From: Patrice Chotard 

FMC driver is now able to discover the bank number by
parsing bank subnodes.

Signed-off-by: Patrice Chotard 
---
 arch/arm/dts/stm32f746-disco.dts | 1 -
 arch/arm/dts/stm32f769-disco.dts | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/arm/dts/stm32f746-disco.dts b/arch/arm/dts/stm32f746-disco.dts
index 2c7fa79..c92c2e2 100644
--- a/arch/arm/dts/stm32f746-disco.dts
+++ b/arch/arm/dts/stm32f746-disco.dts
@@ -195,7 +195,6 @@
pinctrl-names = "default";
status = "okay";
 
-   mr-nbanks = <1>;
/* Memory configuration from sdram datasheet MT48LC_4M32_B2B5-6A */
bank1: bank@0 {
   st,sdram-control = /bits/ 8 ;
/* Memory configuration from sdram datasheet MT48LC_4M32_B2B5-6A */
bank1: bank@0 {
   st,sdram-control = /bits/ 8 https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/6] ram: stm32: replace fdtdec_get by ofnode calls

2017-07-13 Thread patrice.chotard
From: Patrice Chotard 

Replace all fdtdec_get..() calls by ofnode_read...() or dev_read..().
This will allow drivers to support a live device tree.

Signed-off-by: Patrice Chotard 
---
 drivers/ram/stm32_sdram.c | 83 +++
 1 file changed, 47 insertions(+), 36 deletions(-)

diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 6e2c6c7..460e697 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -120,8 +120,8 @@ struct stm32_sdram_timing {
 struct stm32_sdram_params {
struct stm32_fmc_regs *base;
u8 no_sdram_banks;
-   struct stm32_sdram_control sdram_control;
-   struct stm32_sdram_timing sdram_timing;
+   struct stm32_sdram_control *sdram_control;
+   struct stm32_sdram_timing *sdram_timing;
u32 sdram_ref_count;
 };
 
@@ -133,24 +133,26 @@ int stm32_sdram_init(struct udevice *dev)
 {
struct stm32_sdram_params *params = dev_get_platdata(dev);
struct stm32_fmc_regs *regs = params->base;
-
-   writel(params->sdram_control.sdclk << FMC_SDCR_SDCLK_SHIFT
-   | params->sdram_control.cas_latency << FMC_SDCR_CAS_SHIFT
-   | params->sdram_control.no_banks << FMC_SDCR_NB_SHIFT
-   | params->sdram_control.memory_width << FMC_SDCR_MWID_SHIFT
-   | params->sdram_control.no_rows << FMC_SDCR_NR_SHIFT
-   | params->sdram_control.no_columns << FMC_SDCR_NC_SHIFT
-   | params->sdram_control.rd_pipe_delay << FMC_SDCR_RPIPE_SHIFT
-   | params->sdram_control.rd_burst << FMC_SDCR_RBURST_SHIFT,
+   struct stm32_sdram_control *control = params->sdram_control;
+   struct stm32_sdram_timing *timing = params->sdram_timing;
+
+   writel(control->sdclk << FMC_SDCR_SDCLK_SHIFT
+   | control->cas_latency << FMC_SDCR_CAS_SHIFT
+   | control->no_banks << FMC_SDCR_NB_SHIFT
+   | control->memory_width << FMC_SDCR_MWID_SHIFT
+   | control->no_rows << FMC_SDCR_NR_SHIFT
+   | control->no_columns << FMC_SDCR_NC_SHIFT
+   | control->rd_pipe_delay << FMC_SDCR_RPIPE_SHIFT
+   | control->rd_burst << FMC_SDCR_RBURST_SHIFT,
>sdcr1);
 
-   writel(params->sdram_timing.trcd << FMC_SDTR_TRCD_SHIFT
-   | params->sdram_timing.trp << FMC_SDTR_TRP_SHIFT
-   | params->sdram_timing.twr << FMC_SDTR_TWR_SHIFT
-   | params->sdram_timing.trc << FMC_SDTR_TRC_SHIFT
-   | params->sdram_timing.tras << FMC_SDTR_TRAS_SHIFT
-   | params->sdram_timing.txsr << FMC_SDTR_TXSR_SHIFT
-   | params->sdram_timing.tmrd << FMC_SDTR_TMRD_SHIFT,
+   writel(timing->trcd << FMC_SDTR_TRCD_SHIFT
+   | timing->trp << FMC_SDTR_TRP_SHIFT
+   | timing->twr << FMC_SDTR_TWR_SHIFT
+   | timing->trc << FMC_SDTR_TRC_SHIFT
+   | timing->tras << FMC_SDTR_TRAS_SHIFT
+   | timing->txsr << FMC_SDTR_TXSR_SHIFT
+   | timing->tmrd << FMC_SDTR_TMRD_SHIFT,
>sdtr1);
 
writel(FMC_SDCMR_BANK_1 | FMC_SDCMR_MODE_START_CLOCK,
@@ -169,7 +171,7 @@ int stm32_sdram_init(struct udevice *dev)
FMC_BUSY_WAIT(regs);
 
writel(FMC_SDCMR_BANK_1 | (SDRAM_MODE_BL << SDRAM_MODE_BL_SHIFT
-  | params->sdram_control.cas_latency << SDRAM_MODE_CAS_SHIFT)
+  | control->cas_latency << SDRAM_MODE_CAS_SHIFT)
   << FMC_SDCMR_MODE_REGISTER_SHIFT | FMC_SDCMR_MODE_WRITE_MODE,
   >sdcmr);
udelay(100);
@@ -187,27 +189,36 @@ int stm32_sdram_init(struct udevice *dev)
 
 static int stm32_fmc_ofdata_to_platdata(struct udevice *dev)
 {
-   int ret;
-   int node = dev_of_offset(dev);
-   const void *blob = gd->fdt_blob;
+   ofnode bank_node;
struct stm32_sdram_params *params = dev_get_platdata(dev);
 
-   params->no_sdram_banks = fdtdec_get_uint(blob, node, "mr-nbanks", 1);
+   params->no_sdram_banks = dev_read_u32_default(dev, "mr-nbanks", 1);
debug("%s, no of banks = %d\n", __func__, params->no_sdram_banks);
 
-   fdt_for_each_subnode(node, blob, node) {
-   ret = fdtdec_get_byte_array(blob, node, "st,sdram-control",
-   (u8 *)>sdram_control,
-   sizeof(params->sdram_control));
-   if (ret)
-   return ret;
-   ret = fdtdec_get_byte_array(blob, node, "st,sdram-timing",
-   (u8 *)>sdram_timing,
-   sizeof(params->sdram_timing));
-   if (ret)
-   return ret;
-
-   params->sdram_ref_count = fdtdec_get_int(blob, node,
+   dev_for_each_subnode(bank_node, dev) {
+   params->sdram_control = (struct 

[U-Boot] [PATCH 4/6] ram: stm32: add second SDRAM bank management

2017-07-13 Thread patrice.chotard
From: Patrice Chotard 

FMC is able to manage 2 SDRAM banks, but the current driver
implementation is only able to manage the first SDRAM bank.

Even if only bank2 is used, some bank1 registers must be
configured.

Signed-off-by: Patrice Chotard 
---
 doc/device-tree-bindings/ram/st,stm32-fmc.txt |  19 ++-
 drivers/ram/stm32_sdram.c | 215 +-
 2 files changed, 155 insertions(+), 79 deletions(-)

diff --git a/doc/device-tree-bindings/ram/st,stm32-fmc.txt 
b/doc/device-tree-bindings/ram/st,stm32-fmc.txt
index 3d1392c..99f76d5 100644
--- a/doc/device-tree-bindings/ram/st,stm32-fmc.txt
+++ b/doc/device-tree-bindings/ram/st,stm32-fmc.txt
@@ -40,12 +40,19 @@ Example:
pinctrl-names = "default";
status = "okay";
 
-   mr-nbanks = <1>;
/* sdram memory configuration from sdram datasheet */
-   bank1: bank@0 {
-  st,sdram-control = /bits/ 8 ;
-  st,sdram-timing = /bits/ 8 ;
-   };
-}
+   };
+
+   /* sdram memory configuration from sdram datasheet */
+   bank2: bank@1 {
+  st,sdram-control = /bits/ 8 ;
+  st,sdram-timing = /bits/ 8 ;
+   };
+   }
diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 460e697..5e7539c 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -117,12 +117,23 @@ struct stm32_sdram_timing {
u8 twr;
u8 trcd;
 };
-struct stm32_sdram_params {
-   struct stm32_fmc_regs *base;
-   u8 no_sdram_banks;
+enum stm32_fmc_bank {
+   SDRAM_BANK1,
+   SDRAM_BANK2,
+   MAX_SDRAM_BANK,
+};
+
+struct bank_params {
struct stm32_sdram_control *sdram_control;
struct stm32_sdram_timing *sdram_timing;
u32 sdram_ref_count;
+   enum stm32_fmc_bank target_bank;
+};
+
+struct stm32_sdram_params {
+   struct stm32_fmc_regs *base;
+   u8 no_sdram_banks;
+   struct bank_params bank_params[MAX_SDRAM_BANK];
 };
 
 #define SDRAM_MODE_BL_SHIFT0
@@ -132,96 +143,154 @@ struct stm32_sdram_params {
 int stm32_sdram_init(struct udevice *dev)
 {
struct stm32_sdram_params *params = dev_get_platdata(dev);
+   struct stm32_sdram_control *control;
+   struct stm32_sdram_timing *timing;
struct stm32_fmc_regs *regs = params->base;
-   struct stm32_sdram_control *control = params->sdram_control;
-   struct stm32_sdram_timing *timing = params->sdram_timing;
-
-   writel(control->sdclk << FMC_SDCR_SDCLK_SHIFT
-   | control->cas_latency << FMC_SDCR_CAS_SHIFT
-   | control->no_banks << FMC_SDCR_NB_SHIFT
-   | control->memory_width << FMC_SDCR_MWID_SHIFT
-   | control->no_rows << FMC_SDCR_NR_SHIFT
-   | control->no_columns << FMC_SDCR_NC_SHIFT
-   | control->rd_pipe_delay << FMC_SDCR_RPIPE_SHIFT
-   | control->rd_burst << FMC_SDCR_RBURST_SHIFT,
-   >sdcr1);
-
-   writel(timing->trcd << FMC_SDTR_TRCD_SHIFT
-   | timing->trp << FMC_SDTR_TRP_SHIFT
-   | timing->twr << FMC_SDTR_TWR_SHIFT
-   | timing->trc << FMC_SDTR_TRC_SHIFT
-   | timing->tras << FMC_SDTR_TRAS_SHIFT
-   | timing->txsr << FMC_SDTR_TXSR_SHIFT
-   | timing->tmrd << FMC_SDTR_TMRD_SHIFT,
-   >sdtr1);
-
-   writel(FMC_SDCMR_BANK_1 | FMC_SDCMR_MODE_START_CLOCK,
-  >sdcmr);
-   udelay(200);/* 200 us delay, page 10, "Power-Up" */
-   FMC_BUSY_WAIT(regs);
-
-   writel(FMC_SDCMR_BANK_1 | FMC_SDCMR_MODE_PRECHARGE,
-  >sdcmr);
-   udelay(100);
-   FMC_BUSY_WAIT(regs);
-
-   writel((FMC_SDCMR_BANK_1 | FMC_SDCMR_MODE_AUTOREFRESH
-   | 7 << FMC_SDCMR_NRFS_SHIFT), >sdcmr);
-   udelay(100);
-   FMC_BUSY_WAIT(regs);
-
-   writel(FMC_SDCMR_BANK_1 | (SDRAM_MODE_BL << SDRAM_MODE_BL_SHIFT
-  | control->cas_latency << SDRAM_MODE_CAS_SHIFT)
-  << FMC_SDCMR_MODE_REGISTER_SHIFT | FMC_SDCMR_MODE_WRITE_MODE,
-  >sdcmr);
-   udelay(100);
-   FMC_BUSY_WAIT(regs);
-
-   writel(FMC_SDCMR_BANK_1 | FMC_SDCMR_MODE_NORMAL,
-  >sdcmr);
-   FMC_BUSY_WAIT(regs);
-
-   /* Refresh timer */
-   writel((params->sdram_ref_count) << 1, >sdrtr);
+   enum stm32_fmc_bank target_bank;
+   u32 ctb; /* SDCMR register: Command Target Bank */
+   u32 ref_count;
+   u8 i;
+
+   for (i = 0; i < params->no_sdram_banks; i++) {
+   control = params->bank_params[i].sdram_control;
+   timing = params->bank_params[i].sdram_timing;
+   target_bank = params->bank_params[i].target_bank;
+   ref_count = params->bank_params[i].sdram_ref_count;
+
+   writel(control->sdclk << FMC_SDCR_SDCLK_SHIFT
+   

[U-Boot] [PATCH 2/6] ram: stm32: get base address from DT

2017-07-13 Thread patrice.chotard
From: Patrice Chotard 

Retrieve RAM base address from DT instead of using STM32_SDRAM_FMC

For STM32F7, FMC block base address is 0xA000, but SDRAM
registers are located at offset 0x140 inside FMC block.
Update the stm32_fmc_regs fields with all FMC registers
to map SDRAM registers at the right address.

These additionals registers will be used later.

Signed-off-by: Patrice Chotard 
Reviewed-by: Vikas Manocha 
---
 drivers/ram/stm32_sdram.c | 92 ---
 1 file changed, 64 insertions(+), 28 deletions(-)

diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 4146b9d..6e2c6c7 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -10,25 +10,50 @@
 #include 
 #include 
 #include 
-#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
 struct stm32_fmc_regs {
-   u32 sdcr1;  /* Control register 1 */
-   u32 sdcr2;  /* Control register 2 */
-   u32 sdtr1;  /* Timing register 1 */
-   u32 sdtr2;  /* Timing register 2 */
-   u32 sdcmr;  /* Mode register */
-   u32 sdrtr;  /* Refresh timing register */
-   u32 sdsr;   /* Status register */
+   /* 0x0 */
+   u32 bcr1;   /* NOR/PSRAM Chip select control register 1 */
+   u32 btr1;   /* SRAM/NOR-Flash Chip select timing register 1 */
+   u32 bcr2;   /* NOR/PSRAM Chip select Control register 2 */
+   u32 btr2;   /* SRAM/NOR-Flash Chip select timing register 2 */
+   u32 bcr3;   /* NOR/PSRAMChip select Control register 3 */
+   u32 btr3;   /* SRAM/NOR-Flash Chip select timing register 3 */
+   u32 bcr4;   /* NOR/PSRAM Chip select Control register 4 */
+   u32 btr4;   /* SRAM/NOR-Flash Chip select timing register 4 */
+   u32 reserved1[24];
+
+   /* 0x80 */
+   u32 pcr;/* NAND Flash control register */
+   u32 sr; /* FIFO status and interrupt register */
+   u32 pmem;   /* Common memory space timing register */
+   u32 patt;   /* Attribute memory space timing registers  */
+   u32 reserved2[1];
+   u32 eccr;   /* ECC result registers */
+   u32 reserved3[27];
+
+   /* 0x104 */
+   u32 bwtr1;  /* SRAM/NOR-Flash write timing register 1 */
+   u32 reserved4[1];
+   u32 bwtr2;  /* SRAM/NOR-Flash write timing register 2 */
+   u32 reserved5[1];
+   u32 bwtr3;  /* SRAM/NOR-Flash write timing register 3 */
+   u32 reserved6[1];
+   u32 bwtr4;  /* SRAM/NOR-Flash write timing register 4 */
+   u32 reserved7[8];
+
+   /* 0x140 */
+   u32 sdcr1;  /* SDRAM Control register 1 */
+   u32 sdcr2;  /* SDRAM Control register 2 */
+   u32 sdtr1;  /* SDRAM Timing register 1 */
+   u32 sdtr2;  /* SDRAM Timing register 2 */
+   u32 sdcmr;  /* SDRAM Mode register */
+   u32 sdrtr;  /* SDRAM Refresh timing register */
+   u32 sdsr;   /* SDRAM Status register */
 };
 
-/*
- * FMC registers base
- */
-#define STM32_SDRAM_FMC((struct stm32_fmc_regs 
*)SDRAM_FMC_BASE)
-
 /* Control register SDCR */
 #define FMC_SDCR_RPIPE_SHIFT   13  /* RPIPE bit shift */
 #define FMC_SDCR_RBURST_SHIFT  12  /* RBURST bit shift */
@@ -66,9 +91,9 @@ struct stm32_fmc_regs {
 
 #define FMC_SDSR_BUSY  BIT(5)
 
-#define FMC_BUSY_WAIT()do { \
+#define FMC_BUSY_WAIT(regs)do { \
__asm__ __volatile__ ("dsb" : : : "memory"); \
-   while (STM32_SDRAM_FMC->sdsr & FMC_SDSR_BUSY) \
+   while (regs->sdsr & FMC_SDSR_BUSY) \
; \
} while (0)
 
@@ -93,6 +118,7 @@ struct stm32_sdram_timing {
u8 trcd;
 };
 struct stm32_sdram_params {
+   struct stm32_fmc_regs *base;
u8 no_sdram_banks;
struct stm32_sdram_control sdram_control;
struct stm32_sdram_timing sdram_timing;
@@ -106,6 +132,7 @@ struct stm32_sdram_params {
 int stm32_sdram_init(struct udevice *dev)
 {
struct stm32_sdram_params *params = dev_get_platdata(dev);
+   struct stm32_fmc_regs *regs = params->base;
 
writel(params->sdram_control.sdclk << FMC_SDCR_SDCLK_SHIFT
| params->sdram_control.cas_latency << FMC_SDCR_CAS_SHIFT
@@ -115,7 +142,7 @@ int stm32_sdram_init(struct udevice *dev)
| params->sdram_control.no_columns << FMC_SDCR_NC_SHIFT
| params->sdram_control.rd_pipe_delay << FMC_SDCR_RPIPE_SHIFT
| params->sdram_control.rd_burst << FMC_SDCR_RBURST_SHIFT,
-   _SDRAM_FMC->sdcr1);
+   >sdcr1);
 
writel(params->sdram_timing.trcd << FMC_SDTR_TRCD_SHIFT
| params->sdram_timing.trp << FMC_SDTR_TRP_SHIFT
@@ -124,36 +151,36 @@ int stm32_sdram_init(struct udevice *dev)
| params->sdram_timing.tras << FMC_SDTR_TRAS_SHIFT
| 

[U-Boot] [PATCH 0/6] Extend stm32 SDRAM driver

2017-07-13 Thread patrice.chotard
From: Patrice Chotard 

This series aims to add some improvements to existing ram 
driver decicated to stm32 SoCs :
_ some code clean up
_ full DT support, now the FMC base is retrieved through DT
_ update DT API by using ofnode_read...() or dev_read..() instead
  of fdtdec_get..() to support livetree
_ add second SDRAM bank support needed for STM32H7-Discovery board 
  which uses the second SDRAM bank
_ add stm32 H7 support

Patrice Chotard (6):
  ram: stm32: migrate fmc defines in driver file
  ram: stm32: get base address from DT
  ram: stm32: replace fdtdec_get by ofnode calls
  ram: stm32: add second SDRAM bank management
  ARM: DTS: stm32: remove useless mr-nbanks property
  ram: stm32: add stm32h7 support

 arch/arm/dts/stm32f746-disco.dts  |   1 -
 arch/arm/dts/stm32f769-disco.dts  |   1 -
 arch/arm/include/asm/arch-stm32f7/fmc.h   |  74 --
 board/st/stm32f746-disco/stm32f746-disco.c|   1 -
 doc/device-tree-bindings/ram/st,stm32-fmc.txt |  19 +-
 drivers/ram/stm32_sdram.c | 336 --
 6 files changed, 278 insertions(+), 154 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-stm32f7/fmc.h

-- 
1.9.1

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


[U-Boot] [PATCH 1/6] ram: stm32: migrate fmc defines in driver file

2017-07-13 Thread patrice.chotard
From: Patrice Chotard 

Migrate all FMC defines from arch/arm/include/asm/arch-stm32f7/fmc.h
to drivers/ram/stm32_sdram.c

This will avoid to add an additionnal arch-stm32xx/fmc.h file when
a new stm32 family soc will be introduced.

Signed-off-by: Patrice Chotard 
Reviewed-by: Vikas Manocha 
---
 arch/arm/include/asm/arch-stm32f7/fmc.h| 74 --
 board/st/stm32f746-disco/stm32f746-disco.c |  1 -
 drivers/ram/stm32_sdram.c  | 59 +++-
 3 files changed, 58 insertions(+), 76 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-stm32f7/fmc.h

diff --git a/arch/arm/include/asm/arch-stm32f7/fmc.h 
b/arch/arm/include/asm/arch-stm32f7/fmc.h
deleted file mode 100644
index 4741e5a..000
--- a/arch/arm/include/asm/arch-stm32f7/fmc.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * (C) Copyright 2013
- * Pavel Boldin, Emcraft Systems, pabol...@emcraft.com
- *
- * (C) Copyright 2015
- * Kamil Lulko, 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#ifndef _MACH_FMC_H_
-#define _MACH_FMC_H_
-
-struct stm32_fmc_regs {
-   u32 sdcr1;  /* Control register 1 */
-   u32 sdcr2;  /* Control register 2 */
-   u32 sdtr1;  /* Timing register 1 */
-   u32 sdtr2;  /* Timing register 2 */
-   u32 sdcmr;  /* Mode register */
-   u32 sdrtr;  /* Refresh timing register */
-   u32 sdsr;   /* Status register */
-};
-
-/*
- * FMC registers base
- */
-#define STM32_SDRAM_FMC((struct stm32_fmc_regs 
*)SDRAM_FMC_BASE)
-
-/* Control register SDCR */
-#define FMC_SDCR_RPIPE_SHIFT   13  /* RPIPE bit shift */
-#define FMC_SDCR_RBURST_SHIFT  12  /* RBURST bit shift */
-#define FMC_SDCR_SDCLK_SHIFT   10  /* SDRAM clock divisor shift */
-#define FMC_SDCR_WP_SHIFT  9   /* Write protection shift */
-#define FMC_SDCR_CAS_SHIFT 7   /* CAS latency shift */
-#define FMC_SDCR_NB_SHIFT  6   /* Number of banks shift */
-#define FMC_SDCR_MWID_SHIFT4   /* Memory width shift */
-#define FMC_SDCR_NR_SHIFT  2   /* Number of row address bits shift */
-#define FMC_SDCR_NC_SHIFT  0   /* Number of col address bits shift */
-
-/* Timings register SDTR */
-#define FMC_SDTR_TMRD_SHIFT0   /* Load mode register to active */
-#define FMC_SDTR_TXSR_SHIFT4   /* Exit self-refresh time */
-#define FMC_SDTR_TRAS_SHIFT8   /* Self-refresh time */
-#define FMC_SDTR_TRC_SHIFT 12  /* Row cycle delay */
-#define FMC_SDTR_TWR_SHIFT 16  /* Recovery delay */
-#define FMC_SDTR_TRP_SHIFT 20  /* Row precharge delay */
-#define FMC_SDTR_TRCD_SHIFT24  /* Row-to-column delay */
-
-
-#define FMC_SDCMR_NRFS_SHIFT   5
-
-#define FMC_SDCMR_MODE_NORMAL  0
-#define FMC_SDCMR_MODE_START_CLOCK 1
-#define FMC_SDCMR_MODE_PRECHARGE   2
-#define FMC_SDCMR_MODE_AUTOREFRESH 3
-#define FMC_SDCMR_MODE_WRITE_MODE  4
-#define FMC_SDCMR_MODE_SELFREFRESH 5
-#define FMC_SDCMR_MODE_POWERDOWN   6
-
-#define FMC_SDCMR_BANK_1   BIT(4)
-#define FMC_SDCMR_BANK_2   BIT(3)
-
-#define FMC_SDCMR_MODE_REGISTER_SHIFT  9
-
-#define FMC_SDSR_BUSY  BIT(5)
-
-#define FMC_BUSY_WAIT()do { \
-   __asm__ __volatile__ ("dsb" : : : "memory"); \
-   while (STM32_SDRAM_FMC->sdsr & FMC_SDSR_BUSY) \
-   ; \
-   } while (0)
-
-
-#endif /* _MACH_FMC_H_ */
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c 
b/board/st/stm32f746-disco/stm32f746-disco.c
index fc4c60c..4314c71 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 902de2b..4146b9d 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -10,11 +10,68 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct stm32_fmc_regs {
+   u32 sdcr1;  /* Control register 1 */
+   u32 sdcr2;  /* Control register 2 */
+   u32 sdtr1;  /* Timing register 1 */
+   u32 sdtr2;  /* Timing register 2 */
+   u32 sdcmr;  /* Mode register */
+   u32 sdrtr;  /* Refresh timing register */
+   u32 sdsr;   /* Status register */
+};
+
+/*
+ * FMC registers base
+ */
+#define STM32_SDRAM_FMC((struct stm32_fmc_regs 
*)SDRAM_FMC_BASE)
+
+/* Control register SDCR */
+#define FMC_SDCR_RPIPE_SHIFT   13  /* RPIPE bit shift */
+#define FMC_SDCR_RBURST_SHIFT  12  /* RBURST bit shift */
+#define FMC_SDCR_SDCLK_SHIFT   10  /* SDRAM clock divisor shift */
+#define FMC_SDCR_WP_SHIFT  9   /* Write protection shift */
+#define FMC_SDCR_CAS_SHIFT 7   /* CAS latency shift 

Re: [U-Boot] [PATCH 2/3] configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

2017-07-13 Thread Lokesh Vutla


On 7/13/2017 5:15 AM, Tom Rini wrote:
> On Thu, Jul 13, 2017 at 12:18:43AM +0530, Lokesh Vutla wrote:
>>
>>
>> On 7/12/2017 11:01 PM, Tom Rini wrote:
>>> On Wed, Jul 12, 2017 at 07:16:27PM +0530, Lokesh Vutla wrote:
>>>
 + Andrew

 On 7/12/2017 3:25 PM, Jean-Jacques Hiblot wrote:
> This regulator is used for voltage switching on MMC1 IO lines.

 Can you enable on HS platforms as well.
>>>
>>> Is this a SoC thing (which includes a strongly encouraged to use in
>>> designs) or a board choice (you really can expect to find custom boards
>>> that wouldn't want this) ?  I'm asking because it sounds like perhaps we
>>> should be imply'ing somewhere instead so that HS and EVM and custom
>>> boards are in sync.  Thanks!
>>
>> Regulators are a board choice. Yes, that makes sense. These can be
>> implied for TARGET_DRA7XX_EVM.
> 
> And that's really true?  I ask since I recall there's some SoCs where
> it's a lot more theoretical than practical to have a PMIC other than the

Well, it is still possible to use a different PMIC and I guess it is
better to stick it that way.

> one the EVM uses.  But, yes, board level imply is the way to go then.
> The rule of thumb should be that if it's not really optional, the board
> or SoC should imply it if there's a reason to not have it, or select it
> if it's required.
> 

Jean,
Can you repost the patch as Tom suggested?

Thanks and regards,
Lokesh

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


Re: [U-Boot] [PATCH] usb: fix usb_stor_read/write on DM

2017-07-13 Thread Marek Vasut
On 07/13/2017 03:35 PM, Masahiro Yamada wrote:
> Prior to DM, we could not enable different types of USB controllers
> at the same time.  DM was supposed to loosen the limitation.  We can
> compile drivers, but not working.
> 
> For example, if EHCI is enabled, xHCI fails as follows:
> 
>   => usb read 8200 0 2000
> 
>   USB read: device 0 block # 0, count 8192 ... WARN halted endpoint, queueing 
> URB anyway.
>   Unexpected XHCI event TRB, skipping... (3fb54010 0001 1300 01008401)
>   BUG: failure at drivers/usb/host/xhci-ring.c:489/abort_td()!
>   BUG!
>   ### ERROR ### Please RESET the board ###
> 
> The cause of the error seems #ifdef CONFIG_USB_EHCI_HCD in
> common/usb_storage.c
> 
> To fix the problem, align USB_MAX_XFER_BLK to the lowest common
> denominator if CONFIG_DM is defined.

Meh, this is a workaround and a pretty bad one. This should be a
per-controller or even per-storage-device(?) knob. Opinions ?

> Signed-off-by: Masahiro Yamada 
> ---
> 
>  common/usb_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index df0b05730879..fa0cf68c3353 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -100,7 +100,7 @@ struct us_data {
>   trans_cmnd  transport;  /* transport routine */
>  };
>  
> -#ifdef CONFIG_USB_EHCI_HCD
> +#if !defined(CONFIG_DM_USB) && defined(CONFIG_USB_EHCI_HCD)
>  /*
>   * The U-Boot EHCI driver can handle any transfer length as long as there is
>   * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands 
> are
> 


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


[U-Boot] [PATCH] usb: fix usb_stor_read/write on DM

2017-07-13 Thread Masahiro Yamada
Prior to DM, we could not enable different types of USB controllers
at the same time.  DM was supposed to loosen the limitation.  We can
compile drivers, but not working.

For example, if EHCI is enabled, xHCI fails as follows:

  => usb read 8200 0 2000

  USB read: device 0 block # 0, count 8192 ... WARN halted endpoint, queueing 
URB anyway.
  Unexpected XHCI event TRB, skipping... (3fb54010 0001 1300 01008401)
  BUG: failure at drivers/usb/host/xhci-ring.c:489/abort_td()!
  BUG!
  ### ERROR ### Please RESET the board ###

The cause of the error seems #ifdef CONFIG_USB_EHCI_HCD in
common/usb_storage.c

To fix the problem, align USB_MAX_XFER_BLK to the lowest common
denominator if CONFIG_DM is defined.

Signed-off-by: Masahiro Yamada 
---

 common/usb_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/usb_storage.c b/common/usb_storage.c
index df0b05730879..fa0cf68c3353 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -100,7 +100,7 @@ struct us_data {
trans_cmnd  transport;  /* transport routine */
 };
 
-#ifdef CONFIG_USB_EHCI_HCD
+#if !defined(CONFIG_DM_USB) && defined(CONFIG_USB_EHCI_HCD)
 /*
  * The U-Boot EHCI driver can handle any transfer length as long as there is
  * enough free heap space left, but the SCSI READ(10) and WRITE(10) commands 
are
-- 
2.7.4

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


[U-Boot] [PATCH 0/2] move apalis t30/tk1, colibri t20/t30 to livetree

2017-07-13 Thread Marcel Ziswiler
This moves the four Toradex Tegra based boards to use a live device
tree as well.

This series depends on Simon's excellent work available at
u-boot-dm/livet-working.

This series is available at 
http://git.toradex.com/cgit/u-boot-toradex.git/log/?h=for-next


Marcel Ziswiler (2):
  apalis_t30: fix usb otg power enable
  dm: tegra: move apalis t30/tk1, colibri t20/t30 to livetree

 board/toradex/apalis_t30/pinmux-config-apalis_t30.h | 4 ++--
 configs/apalis-tk1_defconfig| 4 
 configs/apalis_t30_defconfig| 1 +
 configs/colibri_t20_defconfig   | 1 +
 configs/colibri_t30_defconfig   | 1 +
 5 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.9.4

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


Re: [U-Boot] [PATCH 06/14] powerpc: Remove unneccessary #ifdefs in reginfo

2017-07-13 Thread Christophe LEROY



Le 12/07/2017 à 21:56, Tom Rini a écrit :

On Wed, Jul 12, 2017 at 04:53:26PM +0200, Wolfgang Denk wrote:

Dear Christophe,

In message <194b25e4-81fc-52cf-aeef-61ce6f467...@c-s.fr> you wrote:


Oh ? Ok. I thought it would be a possible name because for instance in
the Linux Kernel, the watchdog driver is named that way and used also
for the 8xx and so was also the SPI driver before its name was change to
fsl_spi.


There are always bad examples ;-)


Isn't the 8xx an 81xx indeed ?


I have never seen this naming used; google does not know about it
either.


Any suggestion for a good name ? Would fsl_reginfo() be a good name ?


FSL does not even exist any more...


Soory, I was never good in naming things...


FSL doesn't exist, and I'm terrible at naming things as well, but I
think fsl_reginfo makes enough namespace sense, we have a lot of fsl_xxx
in arch/powerpc and qcom_ might start confusing folks more than helping
:)




Finally I called in print_reginfo() as it has indeed no dependency with 
any target type or arch. Should someone want to implement it for another 
arch like an ARM CPU, he could do by just defining print_reginfo() and 
maybe moving the declaration from asm/ppc.h to a more generic place.


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


[U-Boot] [PATCH 2/2] dm: tegra: move apalis t30/tk1, colibri t20/t30 to livetree

2017-07-13 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Change these board to use a live device tree after relocation.

Signed-off-by: Marcel Ziswiler 
---

 configs/apalis-tk1_defconfig  | 4 
 configs/apalis_t30_defconfig  | 1 +
 configs/colibri_t20_defconfig | 1 +
 configs/colibri_t30_defconfig | 1 +
 4 files changed, 7 insertions(+)

diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index ccff112..77b4cae 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -23,6 +23,10 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_EXT4_WRITE=y
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_LIVE=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index aaf1bfb..20a27a5 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -24,6 +24,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_LIVE=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/colibri_t20_defconfig b/configs/colibri_t20_defconfig
index 1d00055..591d4cd 100644
--- a/configs/colibri_t20_defconfig
+++ b/configs/colibri_t20_defconfig
@@ -28,6 +28,7 @@ CONFIG_CMD_UBI=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_LIVE=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/colibri_t30_defconfig b/configs/colibri_t30_defconfig
index 4c5a248..ee09775 100644
--- a/configs/colibri_t30_defconfig
+++ b/configs/colibri_t30_defconfig
@@ -24,6 +24,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_OF_LIVE=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
-- 
2.9.4

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


Re: [U-Boot] [PATCH 00/14] Cleanup for 8xx and other misc powerpc

2017-07-13 Thread Christophe LEROY



Le 12/07/2017 à 21:56, Tom Rini a écrit :

On Wed, Jul 12, 2017 at 11:43:16AM +0200, Christophe Leroy wrote:


This serie makes some cleanup in the powerpc area
following the reintroduction of the 8xx.

No travis verification done, travis is timing out

Christophe Leroy (14):
   powerpc, 8xx: Simplify brgclk calculation and remove get_brgclk()
   powerpc: get rid of addr_probe()
   powerpc, timer: Does 8xx specific actions in 8xx cpu_init
   power, timer: reset TBL before TBU
   powerpc: move set_msr() and get_msr() into .h
   powerpc: Remove unneccessary #ifdefs in reginfo
   Convert CONFIG_CMD_REGINFO to Kconfig
   powerpc, 8xx: Simplifying check_CPU()
   powerpc, 8xx: Move cache function into C files
   powerpc, 8xx: move get_immr() into C
   powerpc, 8xx: move cache helper into C
   powerpc: move get_pvr() and get_svr() into C
   powerpc, 8xx: fix missing function declarations.
   powerpc: Remove 8260 remainders


In general, please always have at least a simple one-line commit
message, that's missing in a few places.  Thanks!



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


[U-Boot] [PATCH v2 14/14] powerpc: Remove 8260 remainders

2017-07-13 Thread Christophe Leroy
commit 2eb48ff7a210d ("powerpc, 8260: remove support for mpc8260")
removed support for 8260 CPU.

This patch remove some remainders.

Signed-off-by: Christophe Leroy 
---
 MAINTAINERS  |  6 --
 arch/powerpc/include/asm/processor.h | 14 --
 drivers/i2c/soft_i2c.c   |  4 
 drivers/serial/serial.c  |  3 ---
 include/ioports.h|  7 ++-
 5 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1e8d7d9bb6..1778a76736 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -324,12 +324,6 @@ S: Maintained
 T: git git://git.denx.de/u-boot-mpc8xx.git
 F: arch/powerpc/cpu/mpc8xx/
 
-POWERPC MPC82XX
-M: Wolfgang Denk 
-S: Maintained
-T: git git://git.denx.de/u-boot-mpc82xx.git
-F: arch/powerpc/cpu/mpc82*/
-
 POWERPC MPC83XX
 M: Mario Six 
 S: Maintained
diff --git a/arch/powerpc/include/asm/processor.h 
b/arch/powerpc/include/asm/processor.h
index 30ac4f8c10..baf38f8441 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -978,18 +978,6 @@
 #define PVR_850PVR_821
 #define PVR_860PVR_821
 #define PVR_7400   0x000C
-#define PVR_8240   0x00810100
-
-/*
- * PowerQUICC II family processors report different PVR values depending
- * on silicon process (HiP3, HiP4, HiP7, etc.)
- */
-#define PVR_8260   PVR_8240
-#define PVR_8260_HIP3  0x00810101
-#define PVR_8260_HIP4  0x80811014
-#define PVR_8260_HIP7  0x80822011
-#define PVR_8260_HIP7R1 0x80822013
-#define PVR_8260_HIP7RA0x80822014
 
 /*
  * MPC 52xx
@@ -1345,8 +1333,6 @@ void ll_puts(const char *);
 void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
 
 int prt_83xx_rsr(void);
-int prt_8260_rsr(void);
-int prt_8260_clks(void);
 
 #endif /* ndef ASSEMBLY*/
 
diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c
index a21e4a2627..4fd5551a22 100644
--- a/drivers/i2c/soft_i2c.c
+++ b/drivers/i2c/soft_i2c.c
@@ -17,10 +17,6 @@
  */
 
 #include 
-#ifdef CONFIG_MPC8260  /* only valid for MPC8260 */
-#include 
-#include 
-#endif
 #if defined(CONFIG_AT91FAMILY)
 #include 
 #include 
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 87542f92df..cc4bdcb834 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -133,9 +133,6 @@ serial_initfunc(marvell_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
-serial_initfunc(mpc5xx_serial_initialize);
-serial_initfunc(mpc8260_scc_serial_initialize);
-serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
diff --git a/include/ioports.h b/include/ioports.h
index 1134ea5208..1cd3ceb37a 100644
--- a/include/ioports.h
+++ b/include/ioports.h
@@ -1,14 +1,12 @@
 /*
- * definitions for MPC8260 I/O Ports
- *
- * (in addition to those provided in )
+ * definitions for MPC8xxx I/O Ports
  *
  * murray.jen...@cmst.csiro.au, 20-Oct-00
  */
 
 /*
  * this structure mirrors the layout of the five port registers in
- * the internal memory map - see iop8260_t in 
+ * the internal memory map
  */
 typedef struct {
 unsigned int pdir; /* Port Data Direction Register (35-3) */
@@ -46,7 +44,6 @@ typedef struct {
 
 /*
  * a table that contains configuration information for all 32 pins
- * of all four MPC8260 I/O ports.
  *
  * NOTE: in the second dimension of this table, index 0 refers to pin 31
  * and index 31 refers to pin 0. this made the code in the table look more
-- 
2.12.0

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


[U-Boot] [PATCH 1/2] apalis_t30: fix usb otg power enable

2017-07-13 Thread Marcel Ziswiler
From: Marcel Ziswiler 

Fix USB OTG power enable aka USBO1_EN which on Apalis T30 is connected
to the T30 ball GEN2_I2C_SCL.

Signed-off-by: Marcel Ziswiler 
---

 board/toradex/apalis_t30/pinmux-config-apalis_t30.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/toradex/apalis_t30/pinmux-config-apalis_t30.h 
b/board/toradex/apalis_t30/pinmux-config-apalis_t30.h
index 16d1a64..e0b00ea 100644
--- a/board/toradex/apalis_t30/pinmux-config-apalis_t30.h
+++ b/board/toradex/apalis_t30/pinmux-config-apalis_t30.h
@@ -94,8 +94,8 @@ static struct pmux_pingrp_config tegra3_pinmux_common[] = {
I2C_PINMUX(GEN1_I2C_SDA_PC5, I2C1, NORMAL, NORMAL, INPUT, DISABLE, 
ENABLE),
 
/* I2C2 pinmux */
-   I2C_PINMUX(GEN2_I2C_SCL_PT5, I2C2, NORMAL, NORMAL, INPUT, DISABLE, 
ENABLE),
-   I2C_PINMUX(GEN2_I2C_SDA_PT6, I2C2, NORMAL, NORMAL, INPUT, DISABLE, 
ENABLE),
+   I2C_PINMUX(GEN2_I2C_SCL_PT5, RSVD3, NORMAL, NORMAL, INPUT, DEFAULT, 
DISABLE),
+   I2C_PINMUX(GEN2_I2C_SDA_PT6, RSVD3, NORMAL, NORMAL, INPUT, DEFAULT, 
DISABLE),
 
/* I2C3 pinmux */
I2C_PINMUX(CAM_I2C_SCL_PBB1, I2C3, NORMAL, TRISTATE, INPUT, DISABLE, 
ENABLE),
-- 
2.9.4

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


Re: [U-Boot] [PATCH 01/14] powerpc, 8xx: Simplify brgclk calculation and remove get_brgclk()

2017-07-13 Thread Christophe LEROY



Le 12/07/2017 à 14:52, Wolfgang Denk a écrit :

Dear Christophe,

In message 
<59ac182501e89d3b9ee1dc7c31ce358ff33c0877.1499629706.git.christophe.le...@c-s.fr>
 you wrote:

divider is calculated based on SCCR_DFBRG, with:
SCCR_DFBRG 00 => divider 1  = 1 << 0
SCCR_DFBRG 01 => divider 4  = 1 << 2
SCCR_DFBRG 10 => divider 16 = 1 << 4
SCCR_DFBRG 11 => divider 64 = 1 << 6

This can be easily converted to a single shift operation:
divider = 1 << (SCCR_DFBRG * 2)


Agreed, but...


-   switch ((sccr & SCCR_DFBRG11) >> 11) {

...

+   uint divider = 1 << ((sccr & SCCR_DFBRG11) >> 10);


The code would be easier to read / understand if you made the
calculation obvious, i. e.

uint divider = 1 << (((sccr & SCCR_DFBRG11) >> 11) * 2);

The compiler generates the same code, so there is no size effect.


Ok, done in v2

Christophe


Reviewed-by: Wolfgang Denk 


Best regards,

Wolfgang Denk


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


[U-Boot] [PATCH v2 13/14] powerpc, 8xx: fix missing function declarations.

2017-07-13 Thread Christophe Leroy
Add missing .h and add missing declarations in .h
Declare local functions as static

Based on warnings reported by 'make C=2'

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc8xx/immap.c | 13 +++--
 arch/powerpc/cpu/mpc8xx/traps.c |  2 +-
 arch/powerpc/include/asm/ppc.h  |  5 +
 arch/powerpc/lib/bootm.c|  2 ++
 arch/powerpc/lib/interrupts.c   |  3 ---
 drivers/net/mpc8xx_fec.c|  1 +
 6 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/immap.c b/arch/powerpc/cpu/mpc8xx/immap.c
index 6da085325d..2284979dd6 100644
--- a/arch/powerpc/cpu/mpc8xx/immap.c
+++ b/arch/powerpc/cpu/mpc8xx/immap.c
@@ -19,7 +19,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int do_siuinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_siuinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
 {
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
sysconf8xx_t __iomem *sc = >im_siu_conf;
@@ -36,7 +36,8 @@ int do_siuinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return 0;
 }
 
-int do_memcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_memcinfo(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
 {
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
memctl8xx_t __iomem *memctl = >im_memctl;
@@ -58,7 +59,7 @@ int do_memcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return 0;
 }
 
-int do_carinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_carinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
 {
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
car8xx_t __iomem *car = >im_clkrst;
@@ -119,7 +120,7 @@ static void binary(char *label, uint value, int nbits)
 #define PC_NBITS   12
 #define PD_NBITS   13
 
-int do_iopinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_iopinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
 {
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
iop8xx_t __iomem *iop = >im_ioport;
@@ -172,7 +173,7 @@ int do_iopinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
  * this needs a clean up for smaller tighter code
  * use *uint and set the address based on cmd + port
  */
-int do_iopset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_iopset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
uint rcode = 0;
iopin_t iopin;
@@ -328,7 +329,7 @@ static void prbrg(int n, uint val)
putc('\n');
 }
 
-int do_brginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_brginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
 {
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
cpm8xx_t __iomem *cp = >im_cpm;
diff --git a/arch/powerpc/cpu/mpc8xx/traps.c b/arch/powerpc/cpu/mpc8xx/traps.c
index ebf4e412c9..23646adadd 100644
--- a/arch/powerpc/cpu/mpc8xx/traps.c
+++ b/arch/powerpc/cpu/mpc8xx/traps.c
@@ -52,7 +52,7 @@ static void print_backtrace(unsigned long *sp)
printf("\n");
 }
 
-void show_regs(struct pt_regs *regs)
+static void show_regs(struct pt_regs *regs)
 {
int i;
 
diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index aa5dd85b44..dc12b981e6 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -122,6 +122,11 @@ static inline void set_msr(unsigned long msr)
 void print_reginfo(void);
 #endif
 
+void cpu_init_f(immap_t __iomem *immr);
+int interrupt_init_cpu(unsigned *);
+void timer_interrupt_cpu(struct pt_regs *);
+unsigned long search_exception_table(unsigned long addr);
+
 #endif /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_PPC
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 42a6afbc31..0e204027af 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #if defined(CONFIG_OF_LIBFDT)
 #include 
diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c
index ccba829710..46fa18c63f 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -28,9 +28,6 @@ void __board_show_activity (ulong dummy)
 #define CONFIG_SYS_WATCHDOG_FREQ (CONFIG_SYS_HZ / 2)
 #endif
 
-extern int interrupt_init_cpu (unsigned *);
-extern void timer_interrupt_cpu (struct pt_regs *);
-
 static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
 
 static __inline__ unsigned long get_dec (void)
diff --git a/drivers/net/mpc8xx_fec.c b/drivers/net/mpc8xx_fec.c
index e525d3b593..71fe984a5d 100644
--- a/drivers/net/mpc8xx_fec.c
+++ b/drivers/net/mpc8xx_fec.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
-- 
2.12.0


[U-Boot] [PATCH v2 12/14] powerpc: move get_pvr() and get_svr() into C

2017-07-13 Thread Christophe Leroy
Avoid unnecessary assembly functions when they can easily be written
in C.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc83xx/start.S | 10 --
 arch/powerpc/cpu/mpc85xx/start.S | 10 --
 arch/powerpc/cpu/mpc86xx/start.S | 10 --
 arch/powerpc/cpu/mpc8xx/start.S  |  5 -
 arch/powerpc/include/asm/ppc.h   | 11 +--
 5 files changed, 9 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index 2fed4a1fec..d99ae27a65 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -116,16 +116,6 @@ disable_addr_trans:
mtspr   SRR1, r3
rfi
 
-   .globl get_svr
-get_svr:
-   mfspr   r3, SVR
-   blr
-
-   .globl get_pvr
-get_pvr:
-   mfspr   r3, PVR
-   blr
-
.globl  ppcDWstore
 ppcDWstore:
lfd 1, 0(r4)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 63fdffddb1..f03e1a0bfe 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -1427,16 +1427,6 @@ dcache_status:
andi.   r3,r3,L1CSR0_DCE
blr
 
-   .globl get_pvr
-get_pvr:
-   mfspr   r3,PVR
-   blr
-
-   .globl get_svr
-get_svr:
-   mfspr   r3,SVR
-   blr
-
 
/*---
 */
 /* Function:in8 */
 /* Description: Input 8 bits */
diff --git a/arch/powerpc/cpu/mpc86xx/start.S b/arch/powerpc/cpu/mpc86xx/start.S
index ec5f4a756a..b9e544d23c 100644
--- a/arch/powerpc/cpu/mpc86xx/start.S
+++ b/arch/powerpc/cpu/mpc86xx/start.S
@@ -545,16 +545,6 @@ int_return:
 dc_read:
blr
 
-   .globl get_pvr
-get_pvr:
-   mfspr   r3, PVR
-   blr
-
-   .globl get_svr
-get_svr:
-   mfspr   r3, SVR
-   blr
-
 
 /*
  * Function:   in8
diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index 4c25d3765b..202ea81ae4 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -305,11 +305,6 @@ int_return:
SYNC
rfi
 
-   .globl get_pvr
-get_pvr:
-   mfspr   r3, PVR
-   blr
-
 
/*--*/
 
 /*
diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index 61838cb2d9..aa5dd85b44 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -48,8 +48,15 @@ static inline uint get_immr(uint mask)
return mask ? (immr & mask) : immr;
 }
 #endif
-uint get_pvr(void);
-uint get_svr(void);
+static inline uint get_pvr(void)
+{
+   return mfspr(PVR);
+}
+
+static inline uint get_svr(void)
+{
+   return mfspr(SVR);
+}
 
 #if defined(CONFIG_MPC85xx)|| \
defined(CONFIG_MPC86xx) || \
-- 
2.12.0

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


[U-Boot] [PATCH v2 08/14] powerpc, 8xx: Simplifying check_CPU()

2017-07-13 Thread Christophe Leroy
All complex case have been removed and we now only support
MPC866 and MPC885 families.

So check_CPU() can be made a lot simpler.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc8xx/cpu.c | 39 +++
 1 file changed, 7 insertions(+), 32 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 74e6c6d02c..1e0ea28a91 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -34,19 +34,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static char *cpu_warning = "\n " \
-   "*** Warning: CPU Core has Silicon Bugs -- Check the Errata ***";
-
 static int check_CPU(long clock, uint pvr, uint immr)
 {
-   char *id_str =
-   NULL;
immap_t __iomem *immap = (immap_t __iomem *)(immr & 0x);
-   uint k, m;
+   uint k;
char buf[32];
-   char pre = 'X';
-   char *mid = "xx";
-   char *suf;
 
/* the highest 16 bits should be 0x0050 for a 860 */
 
@@ -55,8 +47,6 @@ static int check_CPU(long clock, uint pvr, uint immr)
 
k = (immr << 16) |
in_be16(>im_cpm.cp_dparam16[PROFF_REVNUM / sizeof(u16)]);
-   m = 0;
-   suf = "";
 
/*
 * Some boards use sockets so different CPUs can be used.
@@ -65,32 +55,20 @@ static int check_CPU(long clock, uint pvr, uint immr)
switch (k) {
/* MPC866P/MPC866T/MPC859T/MPC859DSL/MPC852T */
case 0x08010004:/* Rev. A.0 */
-   suf = "A";
-   /* fall through */
+   printf("MPC866xxxZPnnA");
+   break;
case 0x0803:/* Rev. 0.3 */
-   pre = 'M'; m = 1;
-   if (id_str == NULL)
-   id_str =
-   "PC866x"; /* Unknown chip from MPC866 family */
+   printf("MPC866xxxZPnn");
break;
-   case 0x0900:
-   pre = 'M'; mid = suf = ""; m = 1;
-   if (id_str == NULL)
-   id_str = "PC885"; /* 870/875/880/885 */
+   case 0x0900:/* 870/875/880/885 */
+   puts("MPC885ZPnn");
break;
 
default:
-   suf = NULL;
+   printf("unknown MPC86x (0x%08x)", k);
break;
}
 
-   if (id_str == NULL)
-   id_str = "PC86x";   /* Unknown 86x chip */
-   if (suf)
-   printf("%c%s%sZPnn%s", pre, id_str, mid, suf);
-   else
-   printf("unknown M%s (0x%08x)", id_str, k);
-
printf(" at %s MHz: ", strmhz(buf, clock));
 
print_size(checkicache(), " I-Cache ");
@@ -102,9 +80,6 @@ static int check_CPU(long clock, uint pvr, uint immr)
if (in_be32(>im_cpm.cp_fec.fec_addr_low) == 0x12345678)
printf(" FEC present");
 
-   if (!m)
-   puts(cpu_warning);
-
putc('\n');
 
return 0;
-- 
2.12.0

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


[U-Boot] [PATCH v2 03/14] powerpc, timer: Does 8xx specific actions in 8xx cpu_init

2017-07-13 Thread Christophe Leroy
The actions inside #ifdef CONFIG_8xx in arch/powerpc/lib/time.c
can be performed before, in a 8xx dedicated function.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc8xx/cpu_init.c |  5 -
 arch/powerpc/lib/time.c| 11 ---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c 
b/arch/powerpc/cpu/mpc8xx/cpu_init.c
index 16e7bf5fd5..dc601a1297 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
@@ -38,7 +38,10 @@ void cpu_init_f(immap_t __iomem *immr)
/* unlock TBSCRK */
 
out_be32(>im_sitk.sitk_tbscrk, KAPWR_KEY);
-   out_be16(>im_sit.sit_tbscr, CONFIG_SYS_TBSCR);
+   out_be16(>im_sit.sit_tbscr, CONFIG_SYS_TBSCR | TBSCR_TBE);
+
+   /* Unlock timebase register */
+   out_be32(>im_sitk.sitk_tbk, KAPWR_KEY);
 
/* initialize the PIT (11-31) */
 
diff --git a/arch/powerpc/lib/time.c b/arch/powerpc/lib/time.c
index 41a271a42d..ff9bb67e28 100644
--- a/arch/powerpc/lib/time.c
+++ b/arch/powerpc/lib/time.c
@@ -65,21 +65,10 @@ int timer_init(void)
 {
unsigned long temp;
 
-#if defined(CONFIG_8xx)
-   immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
-
-   /* unlock */
-   out_be32(>im_sitk.sitk_tbk, KAPWR_KEY);
-#endif
-
/* reset */
asm volatile("li %0,0 ; mttbu %0 ; mttbl %0;"
 : "="(temp) );
 
-#if defined(CONFIG_8xx)
-   /* enable */
-   setbits_be16(>im_sit.sit_tbscr, TBSCR_TBE);
-#endif
return (0);
 }
 /* - */
-- 
2.12.0

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


[U-Boot] [PATCH v2 09/14] powerpc, 8xx: Move cache function into C files

2017-07-13 Thread Christophe Leroy
Avoid unnecessary assembly functions when they can easily be written
in C.

Also remove dc_read() as it is nowhere referenced

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc8xx/Makefile |  1 +
 arch/powerpc/cpu/mpc8xx/cache.c  | 49 +++
 arch/powerpc/cpu/mpc8xx/start.S  | 56 
 3 files changed, 50 insertions(+), 56 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc8xx/cache.c

diff --git a/arch/powerpc/cpu/mpc8xx/Makefile b/arch/powerpc/cpu/mpc8xx/Makefile
index b40bffb047..40f38923ec 100644
--- a/arch/powerpc/cpu/mpc8xx/Makefile
+++ b/arch/powerpc/cpu/mpc8xx/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_CMD_IMMAP) += immap.o
 obj-y  += interrupts.o
 obj-$(CONFIG_CMD_REGINFO) += reginfo.o
 obj-y  += speed.o
+obj-y  += cache.o
diff --git a/arch/powerpc/cpu/mpc8xx/cache.c b/arch/powerpc/cpu/mpc8xx/cache.c
new file mode 100644
index 00..f8cd5f5e33
--- /dev/null
+++ b/arch/powerpc/cpu/mpc8xx/cache.c
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2017
+ * Christophe Leroy, CS Systemes d'Information, christophe.le...@c-s.fr
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int icache_status(void)
+{
+   return !!(mfspr(IC_CST) & IDC_ENABLED);
+}
+
+void icache_enable(void)
+{
+   sync();
+   mtspr(IC_CST, IDC_INVALL);
+   mtspr(IC_CST, IDC_ENABLE);
+}
+
+void icache_disable(void)
+{
+   sync();
+   mtspr(IC_CST, IDC_DISABLE);
+}
+
+int dcache_status(void)
+{
+   return !!(mfspr(IC_CST) & IDC_ENABLED);
+}
+
+void dcache_enable(void)
+{
+   mtspr(MD_CTR, MD_RESETVAL); /* Set cache mode with MMU off */
+   mtspr(DC_CST, IDC_INVALL);
+   mtspr(DC_CST, IDC_ENABLE);
+}
+
+void dcache_disable(void)
+{
+   sync();
+   mtspr(DC_CST, IDC_DISABLE);
+   mtspr(DC_CST, IDC_INVALL);
+}
diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index b00696fc75..cd3b29425f 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -305,62 +305,6 @@ int_return:
SYNC
rfi
 
-/* Cache functions.
-*/
-   .globl  icache_enable
-icache_enable:
-   SYNC
-   lis r3, IDC_INVALL@h
-   mtspr   IC_CST, r3
-   lis r3, IDC_ENABLE@h
-   mtspr   IC_CST, r3
-   blr
-
-   .globl  icache_disable
-icache_disable:
-   SYNC
-   lis r3, IDC_DISABLE@h
-   mtspr   IC_CST, r3
-   blr
-
-   .globl  icache_status
-icache_status:
-   mfspr   r3, IC_CST
-   srwir3, r3, 31  /* >>31 => select bit 0 */
-   blr
-
-   .globl  dcache_enable
-dcache_enable:
-   lis r3, 0x0400  /* Set cache mode with MMU off */
-   mtspr   MD_CTR, r3
-
-   lis r3, IDC_INVALL@h
-   mtspr   DC_CST, r3
-   lis r3, IDC_ENABLE@h
-   mtspr   DC_CST, r3
-   blr
-
-   .globl  dcache_disable
-dcache_disable:
-   SYNC
-   lis r3, IDC_DISABLE@h
-   mtspr   DC_CST, r3
-   lis r3, IDC_INVALL@h
-   mtspr   DC_CST, r3
-   blr
-
-   .globl  dcache_status
-dcache_status:
-   mfspr   r3, DC_CST
-   srwir3, r3, 31  /* >>31 => select bit 0 */
-   blr
-
-   .globl  dc_read
-dc_read:
-   mtspr   DC_ADR, r3
-   mfspr   r3, DC_DAT
-   blr
-
 /*
  * unsigned int get_immr (unsigned int mask)
  *
-- 
2.12.0

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


[U-Boot] [PATCH v2 05/14] powerpc: move set_msr() and get_msr() into .h

2017-07-13 Thread Christophe Leroy
set_msr() and get_msr() are defined and used twice.
This patch moves them into ppc.h

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/include/asm/ppc.h | 14 ++
 arch/powerpc/lib/interrupts.c  | 14 --
 arch/powerpc/lib/kgdb.c| 14 --
 3 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index c6aa2f0dfb..89f08eccc7 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -96,6 +96,20 @@ static inline ulong get_ddr_freq(ulong dummy)
 ulong get_ddr_freq(ulong);
 #endif
 
+static inline unsigned long get_msr(void)
+{
+   unsigned long msr;
+
+   asm volatile ("mfmsr %0" : "=r" (msr) : );
+
+   return msr;
+}
+
+static inline void set_msr(unsigned long msr)
+{
+   asm volatile ("mtmsr %0" : : "r" (msr));
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_PPC
diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c
index 50313573fb..ccba829710 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -33,20 +33,6 @@ extern void timer_interrupt_cpu (struct pt_regs *);
 
 static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
 
-static __inline__ unsigned long get_msr (void)
-{
-   unsigned long msr;
-
-   asm volatile ("mfmsr %0":"=r" (msr):);
-
-   return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
-   asm volatile ("mtmsr %0"::"r" (msr));
-}
-
 static __inline__ unsigned long get_dec (void)
 {
unsigned long val;
diff --git a/arch/powerpc/lib/kgdb.c b/arch/powerpc/lib/kgdb.c
index 88c2af21eb..aa16a00a42 100644
--- a/arch/powerpc/lib/kgdb.c
+++ b/arch/powerpc/lib/kgdb.c
@@ -38,20 +38,6 @@ kgdb_longjmp(long *buf, int val)
 : "="(temp) : "r" (buf), "r" (val));
 }
 
-static inline unsigned long
-get_msr(void)
-{
-   unsigned long msr;
-   asm volatile("mfmsr %0" : "=r" (msr):);
-   return msr;
-}
-
-static inline void
-set_msr(unsigned long msr)
-{
-   asm volatile("mtmsr %0" : : "r" (msr));
-}
-
 /* Convert the SPARC hardware trap type code to a unix signal number. */
 /*
  * This table contains the mapping between PowerPC hardware trap types, and
-- 
2.12.0

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


[U-Boot] [PATCH v2 07/14] Convert CONFIG_CMD_REGINFO to Kconfig

2017-07-13 Thread Christophe Leroy
This patch converts CONFIG_CMD_REGINFO to Kconfig

Signed-off-by: Christophe Leroy 
---
 README| 1 -
 arch/powerpc/Kconfig  | 3 +++
 cmd/Kconfig   | 5 +
 include/config_cmd_all.h  | 1 -
 include/configs/B4860QDS.h| 2 --
 include/configs/BSC9131RDB.h  | 5 -
 include/configs/BSC9132QDS.h  | 5 -
 include/configs/C29XPCIE.h| 5 -
 include/configs/M5208EVBE.h   | 3 ---
 include/configs/M52277EVB.h   | 3 ---
 include/configs/M5235EVB.h| 1 -
 include/configs/M53017EVB.h   | 3 ---
 include/configs/M5329EVB.h| 2 --
 include/configs/M5373EVB.h| 2 --
 include/configs/M54418TWR.h   | 1 -
 include/configs/M54451EVB.h   | 3 ---
 include/configs/M54455EVB.h   | 1 -
 include/configs/M5475EVB.h| 1 -
 include/configs/M5485EVB.h| 1 -
 include/configs/MCR3000.h | 3 ---
 include/configs/MPC8536DS.h   | 2 --
 include/configs/MPC8541CDS.h  | 2 --
 include/configs/MPC8544DS.h   | 2 --
 include/configs/MPC8548CDS.h  | 2 --
 include/configs/MPC8555CDS.h  | 2 --
 include/configs/MPC8560ADS.h  | 2 --
 include/configs/MPC8568MDS.h  | 2 --
 include/configs/MPC8569MDS.h  | 2 --
 include/configs/MPC8572DS.h   | 2 --
 include/configs/MPC8610HPCD.h | 2 --
 include/configs/MPC8641HPCN.h | 2 --
 include/configs/P1010RDB.h| 5 -
 include/configs/P1022DS.h | 2 --
 include/configs/P1023RDB.h| 2 --
 include/configs/T102xQDS.h| 2 --
 include/configs/T102xRDB.h| 2 --
 include/configs/T1040QDS.h| 2 --
 include/configs/T104xRDB.h| 2 --
 include/configs/T208xQDS.h| 2 --
 include/configs/T208xRDB.h| 2 --
 include/configs/T4240RDB.h| 2 --
 include/configs/TQM834x.h | 2 --
 include/configs/UCP1020.h | 5 -
 include/configs/astro_mcf5373l.h  | 1 -
 include/configs/controlcenterd.h  | 3 ---
 include/configs/corenet_ds.h  | 2 --
 include/configs/cyrus.h   | 2 --
 include/configs/dragonboard410c.h | 1 -
 include/configs/p1_p2_rdb_pc.h| 5 -
 include/configs/p1_twr.h  | 5 -
 include/configs/qemu-ppce500.h| 2 --
 include/configs/s5p_goni.h| 1 -
 include/configs/sbc8548.h | 2 --
 include/configs/sbc8641d.h| 2 --
 include/configs/smdkc100.h| 1 -
 include/configs/socrates.h| 1 -
 include/configs/t4qds.h   | 2 --
 include/configs/vct.h | 1 -
 include/configs/xilinx-ppc.h  | 1 -
 include/configs/xpedite517x.h | 1 -
 include/configs/xpedite520x.h | 1 -
 include/configs/xpedite537x.h | 1 -
 include/configs/xpedite550x.h | 1 -
 scripts/config_whitelist.txt  | 1 -
 64 files changed, 8 insertions(+), 132 deletions(-)

diff --git a/README b/README
index c73f6dd574..ae5bcdc1ba 100644
--- a/README
+++ b/README
@@ -822,7 +822,6 @@ The following options need to be configured:
  host
CONFIG_CMD_PORTIO   * Port I/O
CONFIG_CMD_READ * Read raw data from partition
-   CONFIG_CMD_REGINFO  * Register dump
CONFIG_CMD_RUNrun command in env variable
CONFIG_CMD_SANDBOX  * sb command to access sandbox features
CONFIG_CMD_SAVES* save S record dump
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e9002a76ab..60c74f9c32 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -23,14 +23,17 @@ config MPC85xx
imply USB_EHCI_HCD if USB
imply CMD_HASH
imply CMD_IRQ
+   imply CMD_REGINFO
 
 config MPC86xx
bool "MPC86xx"
select SYS_FSL_DDR
select SYS_FSL_DDR_BE
+   imply CMD_REGINFO
 
 config 8xx
bool "MPC8xx"
+   imply CMD_REGINFO
 
 endchoice
 
diff --git a/cmd/Kconfig b/cmd/Kconfig
index c80ac364ea..016856b9f9 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -158,6 +158,11 @@ config CMD_LICENSE
help
  Print GPL license text
 
+config CMD_REGINFO
+   bool "reginfo"
+   help
+ Register dump
+
 endmenu
 
 menu "Boot commands"
diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h
index 2874a7850d..e6dfe07a2c 100644
--- a/include/config_cmd_all.h
+++ b/include/config_cmd_all.h
@@ -20,7 +20,6 @@
 #define CONFIG_CMD_PCI /* pciinfo  */
 #define CONFIG_CMD_PCMCIA  /* PCMCIA support   */
 #define CONFIG_CMD_PORTIO  /* Port I/O */
-#define CONFIG_CMD_REGINFO /* Register dump*/
 #define CONFIG_CMD_REISER  /* Reiserfs support */
 #define CONFIG_CMD_READ/* Read data from partition */
 #define CONFIG_CMD_SANDBOX /* sb command to access sandbox features */
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h

[U-Boot] [PATCH v2 11/14] powerpc, 8xx: move cache helper into C

2017-07-13 Thread Christophe Leroy
Avoid unnecessary assembly functions when they can easily be written
in C.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc8xx/start.S  | 32 
 arch/powerpc/include/asm/cache.h | 32 
 arch/powerpc/include/asm/ppc.h   |  6 --
 3 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index fbdc82a079..4c25d3765b 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -310,38 +310,6 @@ get_pvr:
mfspr   r3, PVR
blr
 
-
-   .globl wr_ic_cst
-wr_ic_cst:
-   mtspr   IC_CST, r3
-   blr
-
-   .globl rd_ic_cst
-rd_ic_cst:
-   mfspr   r3, IC_CST
-   blr
-
-   .globl wr_ic_adr
-wr_ic_adr:
-   mtspr   IC_ADR, r3
-   blr
-
-
-   .globl wr_dc_cst
-wr_dc_cst:
-   mtspr   DC_CST, r3
-   blr
-
-   .globl rd_dc_cst
-rd_dc_cst:
-   mfspr   r3, DC_CST
-   blr
-
-   .globl wr_dc_adr
-wr_dc_adr:
-   mtspr   DC_ADR, r3
-   blr
-
 
/*--*/
 
 /*
diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
index d3a83910b6..0801d2c367 100644
--- a/arch/powerpc/include/asm/cache.h
+++ b/arch/powerpc/include/asm/cache.h
@@ -107,6 +107,38 @@ void disable_cpc_sram(void);
 
 #define DC_DFWT0x4000  /* Data cache is forced write 
through */
 #define DC_LES 0x2000  /* Caches are little endian mode */
+
+#if !defined(__ASSEMBLY__)
+static inline uint rd_ic_cst(void)
+{
+   return mfspr(IC_CST);
+}
+
+static inline void wr_ic_cst(uint val)
+{
+   mtspr(IC_CST, val);
+}
+
+static inline void wr_ic_adr(uint val)
+{
+   mtspr(IC_ADR, val);
+}
+
+static inline uint rd_dc_cst(void)
+{
+   return mfspr(DC_CST);
+}
+
+static inline void wr_dc_cst(uint val)
+{
+   mtspr(DC_CST, val);
+}
+
+static inline void wr_dc_adr(uint val)
+{
+   mtspr(DC_ADR, val);
+}
+#endif
 #endif /* CONFIG_8xx */
 
 #endif
diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index e11f39801e..61838cb2d9 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -50,12 +50,6 @@ static inline uint get_immr(uint mask)
 #endif
 uint get_pvr(void);
 uint get_svr(void);
-uint rd_ic_cst(void);
-void wr_ic_cst(uint);
-void wr_ic_adr(uint);
-uint rd_dc_cst(void);
-void wr_dc_cst(uint);
-void wr_dc_adr(uint);
 
 #if defined(CONFIG_MPC85xx)|| \
defined(CONFIG_MPC86xx) || \
-- 
2.12.0

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


[U-Boot] [PATCH v2 04/14] power, timer: reset TBL before TBU

2017-07-13 Thread Christophe Leroy
In order to avoid TBU increment due to TBL reaching its max
and wrapping, reset TBL before resetting TBU

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/lib/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/time.c b/arch/powerpc/lib/time.c
index ff9bb67e28..c43f254481 100644
--- a/arch/powerpc/lib/time.c
+++ b/arch/powerpc/lib/time.c
@@ -66,7 +66,7 @@ int timer_init(void)
unsigned long temp;
 
/* reset */
-   asm volatile("li %0,0 ; mttbu %0 ; mttbl %0;"
+   asm volatile("li %0,0 ; mttbl %0 ; mttbu %0;"
 : "="(temp) );
 
return (0);
-- 
2.12.0

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


[U-Boot] [PATCH v2 06/14] powerpc: Remove unneccessary #ifdefs in reginfo

2017-07-13 Thread Christophe Leroy
reginfo command is calling mpc8xx_reginfo(), mpc85xx_reginfo()
or mpc86xx_reginfo() based on CONFIG_ symbol.
As those 3 functions can't me defined at the same time, let's
rename them print_reginfo() to avoid the #ifdefs
The name is kept generic as it is not at all dependent on
powerpc arch and any other arch could want to also print
such information.

In addition, as the Makefile compiles cmd/reginfo.c only when
CONFIG_CMD_REGINFO is set, there is no need to enclose the U_BOOT_CMD
definition inside a #ifdef CONFIG_CMD_REGINFO

Lets all remove the #ifdefs around the U_BOOT_CMD as this
file is only compiled when CONFIG_CMD_REGINFO is defined

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc85xx/cpu.c|  3 ++-
 arch/powerpc/cpu/mpc86xx/cpu.c|  3 ++-
 arch/powerpc/cpu/mpc8xx/reginfo.c |  3 ++-
 arch/powerpc/include/asm/ppc.h|  4 
 cmd/reginfo.c | 20 ++--
 5 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index e3ef4ae816..b3de164bd8 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -384,7 +385,7 @@ int cpu_mmc_init(bd_t *bis)
  * Currently prints out LAWs, BR0/OR0 for LBC, CSPR/CSOR/Timing
  * parameters for IFC and TLBs
  */
-void mpc85xx_reginfo(void)
+void print_reginfo(void)
 {
print_tlbcam();
print_laws();
diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index 7a9570c8ec..a02e872862 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -160,7 +161,7 @@ watchdog_reset(void)
  * Print out the state of various machine registers.
  * Currently prints out LAWs, BR0/OR0, and BATs
  */
-void mpc86xx_reginfo(void)
+void print_reginfo(void)
 {
print_bats();
print_laws();
diff --git a/arch/powerpc/cpu/mpc8xx/reginfo.c 
b/arch/powerpc/cpu/mpc8xx/reginfo.c
index 1ba4d22bdd..277d2753b2 100644
--- a/arch/powerpc/cpu/mpc8xx/reginfo.c
+++ b/arch/powerpc/cpu/mpc8xx/reginfo.c
@@ -8,8 +8,9 @@
 #include 
 #include 
 #include 
+#include 
 
-void mpc8xx_reginfo(void)
+void print_reginfo(void)
 {
immap_t __iomem *immap  = (immap_t __iomem *)CONFIG_SYS_IMMR;
memctl8xx_t __iomem *memctl = >im_memctl;
diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index 89f08eccc7..27d3b83e07 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -110,6 +110,10 @@ static inline void set_msr(unsigned long msr)
asm volatile ("mtmsr %0" : : "r" (msr));
 }
 
+#ifdef CONFIG_CMD_REGINFO
+void print_reginfo(void);
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_PPC
diff --git a/cmd/reginfo.c b/cmd/reginfo.c
index b364cc899a..b23883e4bf 100644
--- a/cmd/reginfo.c
+++ b/cmd/reginfo.c
@@ -7,36 +7,20 @@
 
 #include 
 #include 
-#if defined(CONFIG_8xx)
-void mpc8xx_reginfo(void);
-#elif defined(CONFIG_MPC86xx)
-extern void mpc86xx_reginfo(void);
-#elif defined(CONFIG_MPC85xx)
-extern void mpc85xx_reginfo(void);
-#endif
+#include 
 
 static int do_reginfo(cmd_tbl_t *cmdtp, int flag, int argc,
   char * const argv[])
 {
-#if defined(CONFIG_8xx)
-   mpc8xx_reginfo();
-
-#elif defined(CONFIG_MPC86xx)
-   mpc86xx_reginfo();
-
-#elif defined(CONFIG_MPC85xx)
-   mpc85xx_reginfo();
-#endif
+   print_reginfo();
 
return 0;
 }
 
  /**/
 
-#if defined(CONFIG_CMD_REGINFO)
 U_BOOT_CMD(
reginfo,2,  1,  do_reginfo,
"print register information",
""
 );
-#endif
-- 
2.12.0

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


[U-Boot] [PATCH v2 10/14] powerpc, 8xx: move get_immr() into C

2017-07-13 Thread Christophe Leroy
Avoid unnecessary assembly functions when they can easily be written
in C.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc8xx/start.S | 15 ---
 arch/powerpc/include/asm/ppc.h  |  9 -
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index cd3b29425f..fbdc82a079 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -305,21 +305,6 @@ int_return:
SYNC
rfi
 
-/*
- * unsigned int get_immr (unsigned int mask)
- *
- * return (mask ? (IMMR & mask) : IMMR);
- */
-   .globl  get_immr
-get_immr:
-   mr  r4,r3   /* save mask */
-   mfspr   r3, IMMR/* IMMR */
-   cmpwi   0,r4,0  /* mask != 0 ? */
-   beq 4f
-   and r3,r3,r4/* IMMR & mask */
-4:
-   blr
-
.globl get_pvr
 get_pvr:
mfspr   r3, PVR
diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index 27d3b83e07..e11f39801e 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -38,8 +38,15 @@
 #include 
 #endif
 
+#include 
+
 #if defined(CONFIG_8xx)
-uint get_immr(uint);
+static inline uint get_immr(uint mask)
+{
+   uint immr = mfspr(SPRN_IMMR);
+
+   return mask ? (immr & mask) : immr;
+}
 #endif
 uint get_pvr(void);
 uint get_svr(void);
-- 
2.12.0

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


[U-Boot] [PATCH v2 02/14] powerpc: get rid of addr_probe()

2017-07-13 Thread Christophe Leroy
This function has never been used, at least since the beginning
of the git repository

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc83xx/traps.c | 27 ---
 arch/powerpc/cpu/mpc85xx/traps.c |  8 
 arch/powerpc/cpu/mpc86xx/traps.c | 10 --
 arch/powerpc/cpu/mpc8xx/traps.c  |  8 
 4 files changed, 53 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/traps.c b/arch/powerpc/cpu/mpc83xx/traps.c
index 3dd6900c86..f238d0b91c 100644
--- a/arch/powerpc/cpu/mpc83xx/traps.c
+++ b/arch/powerpc/cpu/mpc83xx/traps.c
@@ -215,30 +215,3 @@ void DebugException(struct pt_regs *regs)
do_bedbug_breakpoint( regs );
 #endif
 }
-
-/* Probe an address by reading.  If not present, return -1, otherwise
- * return 0.
- */
-int addr_probe(uint *addr)
-{
-#if 0
-   int retval;
-
-   __asm__ __volatile__(   \
-   "1: lwz %0,0(%1)\n" \
-   "   eieio\n"\
-   "   li %0,0\n"  \
-   "2:\n"  \
-   ".section .fixup,\"ax\"\n"  \
-   "3: li %0,-1\n" \
-   "   b 2b\n" \
-   ".section __ex_table,\"a\"\n"   \
-   "   .align 2\n" \
-   "   .long 1b,3b\n"  \
-   ".text" \
-   : "=r" (retval) : "r"(addr));
-
-   return (retval);
-#endif
-   return 0;
-}
diff --git a/arch/powerpc/cpu/mpc85xx/traps.c b/arch/powerpc/cpu/mpc85xx/traps.c
index 24adbc3078..9d3556e50c 100644
--- a/arch/powerpc/cpu/mpc85xx/traps.c
+++ b/arch/powerpc/cpu/mpc85xx/traps.c
@@ -286,11 +286,3 @@ void DebugException(struct pt_regs *regs)
do_bedbug_breakpoint( regs );
 #endif
 }
-
-/* Probe an address by reading. If not present, return -1, otherwise
- * return 0.
- */
-int addr_probe(uint *addr)
-{
-   return 0;
-}
diff --git a/arch/powerpc/cpu/mpc86xx/traps.c b/arch/powerpc/cpu/mpc86xx/traps.c
index 92fb537453..da74146844 100644
--- a/arch/powerpc/cpu/mpc86xx/traps.c
+++ b/arch/powerpc/cpu/mpc86xx/traps.c
@@ -195,13 +195,3 @@ void UnknownException(struct pt_regs *regs)
   regs->nip, regs->msr, regs->trap);
_exception(0, regs);
 }
-
-/*
- * Probe an address by reading.
- * If not present, return -1,
- * otherwise return 0.
- */
-int addr_probe(uint *addr)
-{
-   return 0;
-}
diff --git a/arch/powerpc/cpu/mpc8xx/traps.c b/arch/powerpc/cpu/mpc8xx/traps.c
index 8b8d617eed..ebf4e412c9 100644
--- a/arch/powerpc/cpu/mpc8xx/traps.c
+++ b/arch/powerpc/cpu/mpc8xx/traps.c
@@ -155,11 +155,3 @@ void DebugException(struct pt_regs *regs)
printf("Debugger trap at @ %lx\n", regs->nip);
show_regs(regs);
 }
-
-/* Probe an address by reading.  If not present, return -1, otherwise
- * return 0.
- */
-int addr_probe(uint *addr)
-{
-   return 0;
-}
-- 
2.12.0

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


[U-Boot] [PATCH v2 01/14] powerpc, 8xx: Simplify brgclk calculation and remove get_brgclk()

2017-07-13 Thread Christophe Leroy
divider is calculated based on SCCR_DFBRG, with:
SCCR_DFBRG 00 => divider 1  = 1 << 0
SCCR_DFBRG 01 => divider 4  = 1 << 2
SCCR_DFBRG 10 => divider 16 = 1 << 4
SCCR_DFBRG 11 => divider 64 = 1 << 6

This can be easily converted to a single shift operation:
divider = 1 << (SCCR_DFBRG * 2)

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/cpu/mpc8xx/speed.c | 25 +++--
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/speed.c b/arch/powerpc/cpu/mpc8xx/speed.c
index 8d43efff6c..fa8f87cbc5 100644
--- a/arch/powerpc/cpu/mpc8xx/speed.c
+++ b/arch/powerpc/cpu/mpc8xx/speed.c
@@ -12,27 +12,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void get_brgclk(uint sccr)
-{
-   uint divider = 0;
-
-   switch ((sccr & SCCR_DFBRG11) >> 11) {
-   case 0:
-   divider = 1;
-   break;
-   case 1:
-   divider = 4;
-   break;
-   case 2:
-   divider = 16;
-   break;
-   case 3:
-   divider = 64;
-   break;
-   }
-   gd->arch.brg_clk = gd->cpu_clk / divider;
-}
-
 /*
  * get_clocks() fills in gd->cpu_clock depending on CONFIG_8xx_GCLK_FREQ
  */
@@ -41,6 +20,8 @@ int get_clocks(void)
uint immr = get_immr(0);/* Return full IMMR contents */
immap_t __iomem *immap = (immap_t __iomem *)(immr & 0x);
uint sccr = in_be32(>im_clkrst.car_sccr);
+   uint divider = 1 << (((sccr & SCCR_DFBRG11) >> 11) * 2);
+
/*
 * If for some reason measuring the gclk frequency won't
 * work, we return the hardwired value.
@@ -57,7 +38,7 @@ int get_clocks(void)
gd->bus_clk = gd->cpu_clk / 2;
}
 
-   get_brgclk(sccr);
+   gd->arch.brg_clk = gd->cpu_clk / divider;
 
return 0;
 }
-- 
2.12.0

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


[U-Boot] [PATCH v2 00/14] Cleanup for 8xx and other misc powerpc

2017-07-13 Thread Christophe Leroy
This serie makes some cleanup in the powerpc area
following the reintroduction of the 8xx.

v2 takes into account comments from Wolfgang and Tom

Christophe Leroy (14):
  powerpc, 8xx: Simplify brgclk calculation and remove get_brgclk()
  powerpc: get rid of addr_probe()
  powerpc, timer: Does 8xx specific actions in 8xx cpu_init
  power, timer: reset TBL before TBU
  powerpc: move set_msr() and get_msr() into .h
  powerpc: Remove unneccessary #ifdefs in reginfo
  Convert CONFIG_CMD_REGINFO to Kconfig
  powerpc, 8xx: Simplifying check_CPU()
  powerpc, 8xx: Move cache function into C files
  powerpc, 8xx: move get_immr() into C
  powerpc, 8xx: move cache helper into C
  powerpc: move get_pvr() and get_svr() into C
  powerpc, 8xx: fix missing function declarations.
  powerpc: Remove 8260 remainders

 MAINTAINERS  |   6 --
 README   |   1 -
 arch/powerpc/Kconfig |   3 +
 arch/powerpc/cpu/mpc83xx/start.S |  10 
 arch/powerpc/cpu/mpc83xx/traps.c |  27 -
 arch/powerpc/cpu/mpc85xx/cpu.c   |   3 +-
 arch/powerpc/cpu/mpc85xx/start.S |  10 
 arch/powerpc/cpu/mpc85xx/traps.c |   8 ---
 arch/powerpc/cpu/mpc86xx/cpu.c   |   3 +-
 arch/powerpc/cpu/mpc86xx/start.S |  10 
 arch/powerpc/cpu/mpc86xx/traps.c |  10 
 arch/powerpc/cpu/mpc8xx/Makefile |   1 +
 arch/powerpc/cpu/mpc8xx/cache.c  |  49 
 arch/powerpc/cpu/mpc8xx/cpu.c|  39 +++--
 arch/powerpc/cpu/mpc8xx/cpu_init.c   |   5 +-
 arch/powerpc/cpu/mpc8xx/immap.c  |  13 +++--
 arch/powerpc/cpu/mpc8xx/reginfo.c|   3 +-
 arch/powerpc/cpu/mpc8xx/speed.c  |  25 +---
 arch/powerpc/cpu/mpc8xx/start.S  | 108 ---
 arch/powerpc/cpu/mpc8xx/traps.c  |  10 +---
 arch/powerpc/include/asm/cache.h |  32 +++
 arch/powerpc/include/asm/ppc.h   |  49 +---
 arch/powerpc/include/asm/processor.h |  14 -
 arch/powerpc/lib/bootm.c |   2 +
 arch/powerpc/lib/interrupts.c|  17 --
 arch/powerpc/lib/kgdb.c  |  14 -
 arch/powerpc/lib/time.c  |  13 +
 cmd/Kconfig  |   5 ++
 cmd/reginfo.c|  20 +--
 drivers/i2c/soft_i2c.c   |   4 --
 drivers/net/mpc8xx_fec.c |   1 +
 drivers/serial/serial.c  |   3 -
 include/config_cmd_all.h |   1 -
 include/configs/B4860QDS.h   |   2 -
 include/configs/BSC9131RDB.h |   5 --
 include/configs/BSC9132QDS.h |   5 --
 include/configs/C29XPCIE.h   |   5 --
 include/configs/M5208EVBE.h  |   3 -
 include/configs/M52277EVB.h  |   3 -
 include/configs/M5235EVB.h   |   1 -
 include/configs/M53017EVB.h  |   3 -
 include/configs/M5329EVB.h   |   2 -
 include/configs/M5373EVB.h   |   2 -
 include/configs/M54418TWR.h  |   1 -
 include/configs/M54451EVB.h  |   3 -
 include/configs/M54455EVB.h  |   1 -
 include/configs/M5475EVB.h   |   1 -
 include/configs/M5485EVB.h   |   1 -
 include/configs/MCR3000.h|   3 -
 include/configs/MPC8536DS.h  |   2 -
 include/configs/MPC8541CDS.h |   2 -
 include/configs/MPC8544DS.h  |   2 -
 include/configs/MPC8548CDS.h |   2 -
 include/configs/MPC8555CDS.h |   2 -
 include/configs/MPC8560ADS.h |   2 -
 include/configs/MPC8568MDS.h |   2 -
 include/configs/MPC8569MDS.h |   2 -
 include/configs/MPC8572DS.h  |   2 -
 include/configs/MPC8610HPCD.h|   2 -
 include/configs/MPC8641HPCN.h|   2 -
 include/configs/P1010RDB.h   |   5 --
 include/configs/P1022DS.h|   2 -
 include/configs/P1023RDB.h   |   2 -
 include/configs/T102xQDS.h   |   2 -
 include/configs/T102xRDB.h   |   2 -
 include/configs/T1040QDS.h   |   2 -
 include/configs/T104xRDB.h   |   2 -
 include/configs/T208xQDS.h   |   2 -
 include/configs/T208xRDB.h   |   2 -
 include/configs/T4240RDB.h   |   2 -
 include/configs/TQM834x.h|   2 -
 include/configs/UCP1020.h|   5 --
 include/configs/astro_mcf5373l.h |   1 -
 include/configs/controlcenterd.h |   3 -
 include/configs/corenet_ds.h |   2 -
 include/configs/cyrus.h  |   2 -
 include/configs/dragonboard410c.h|   1 -
 include/configs/p1_p2_rdb_pc.h   |   5 --
 include/configs/p1_twr.h |   5 --
 include/configs/qemu-ppce500.h   |   2 -
 include/configs/s5p_goni.h   |   1 -
 include/configs/sbc8548.h|   2 -
 include/configs/sbc8641d.h   |   2 -
 include/configs/smdkc100.h   |   1 -
 include/configs/socrates.h   |   1 -
 include/configs/t4qds.h  |   2 -
 include/configs/vct.h|   1 -
 

Re: [U-Boot] Data Abort with gcc 7.1

2017-07-13 Thread Måns Rullgård
Maxime Ripard  writes:

> On Thu, Jul 13, 2017 at 11:20:34AM +0100, Peter Robinson wrote:
>> >>> What hardware did this happen on?  If it was on ARMv5, adding the packed
>> >>> attribute is probably the correct fix.  If it was ARMv6 or later,
>> >>> something else is broken as well.
>> >>
>> >> It does not matter if this was ARMv6+ hardware or not. The current
>> >> U-Boot code is wrong and we need to fix it.
>> >
>> > The question is how many errors there are.  That's why I asked about the
>> > hardware.
>> 
>> I've seen it on a number of devices but they were all ARMv7+
>> (AllWinner, Rockchips etc)
>
> It was on an Allwinner SoCs with a Cortex-A7 CPU, so armv7. However,
> as far as I know, the unaligned accesses are disable in u-boot.

Yes, so it seems, although I can't fathom why.

-- 
Måns Rullgård
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Data Abort with gcc 7.1

2017-07-13 Thread Maxime Ripard
On Thu, Jul 13, 2017 at 11:20:34AM +0100, Peter Robinson wrote:
> >>> What hardware did this happen on?  If it was on ARMv5, adding the packed
> >>> attribute is probably the correct fix.  If it was ARMv6 or later,
> >>> something else is broken as well.
> >>
> >> It does not matter if this was ARMv6+ hardware or not. The current
> >> U-Boot code is wrong and we need to fix it.
> >
> > The question is how many errors there are.  That's why I asked about the
> > hardware.
> 
> I've seen it on a number of devices but they were all ARMv7+
> (AllWinner, Rockchips etc)

It was on an Allwinner SoCs with a Cortex-A7 CPU, so armv7. However,
as far as I know, the unaligned accesses are disable in u-boot.

Maxime

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


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


Re: [U-Boot] Pull request: u-boot-mips

2017-07-13 Thread Tom Rini
On Thu, Jul 13, 2017 at 01:05:33PM +0200, Daniel Schwierzeck wrote:
> Hi Tom,
> 
> 2017-07-12 22:57 GMT+02:00 Tom Rini :
> > On Wed, Jul 12, 2017 at 10:32:29PM +0200, Daniel Schwierzeck wrote:
> >
> >> Hi Tom,
> >>
> >> This supports dynamic relocation on MIPS without the need for building a
> >> position-independent executable. This notably reduces the code size for
> >> all MIPS boards.
> >>
> >>
> >> The following changes since commit 
> >> d85ca029f257b53a96da6c2fb421e78a003a9943:
> >>
> >>   Prepare v2017.07 (2017-07-10 13:07:38 -0400)
> >>
> >> are available in the git repository at:
> >>
> >>   git://git.denx.de/u-boot-mips.git master
> >>
> >> for you to fetch changes up to f653dcd5720c4135607211f7304283d7a8ec3b8a:
> >>
> >>   MIPS: bootm: Fix broken boot_env_legacy codepath (2017-07-12 22:10:42 
> >> +0200)
> >>
> >
> > I'm seeing:
> >   mips:  +   tplink_wdr4300
> > +(tplink_wdr4300)pfx##hdr32[idx].field = _val;   \
> > +(tplink_wdr4300)  ^
> > +(tplink_wdr4300) ../tools/mips-relocs.c:51:11: note: ?_val? was declared 
> > here
> > +(tplink_wdr4300)   uint64_t _val;  \
> > +(tplink_wdr4300)^
> > +(tplink_wdr4300) ../tools/mips-relocs.c:88:2: note: in expansion of macro 
> > ?set_hdr_field?
> > +(tplink_wdr4300)   set_hdr_field(p, idx, field, val)
> > +(tplink_wdr4300)   ^
> > +(tplink_wdr4300) ../tools/mips-relocs.c:408:3: note: in expansion of macro 
> > ?set_phdr_field?
> > +(tplink_wdr4300)set_phdr_field(i, p_filesz, load_sz);
> > +(tplink_wdr4300)^~
> > w+(tplink_wdr4300) ../tools/mips-relocs.c: In function ?main?:
> > w+(tplink_wdr4300) ../tools/mips-relocs.c:77:25: warning: ?_val? may be 
> > used uninitialized in this function [-Wmaybe-uninitialized]
> >
> > for what I suspect is going to be all MIPS.  Host tools here are gcc-6.3.
> 
> how about adding a separate build step in Travis CI for all host tools
> and building that step with different compilers (recent gcc or clang)?
> Or we always install a recent x86_64 toolchain and override the host
> toolchain contained in the Ubuntu builder image. This toolchain is
> then used for all build steps.

Travis CI doesn't fail on warning only.  I'd like to move us to an
optional -Werror, but we're not there yet either.  That said, we might
be able to force clang to be used, which would probably have caught
that, even in the version shipped in Ubuntu 14.04, more easily than we
can update the host tools on the VMs.  But I'd be happy to look at
patches and I know you can tell travis to add feeds and then update
things.

-- 
Tom


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


[U-Boot] [PATCH] serial: ns16550: Add RX interrupt buffer support

2017-07-13 Thread Stefan Roese
Pasting longer lines into the U-Boot console prompt sometimes leads to
characters missing. One problem here is the small 16-byte FIFO of the
legacy NS16550 UART, e.g. on x86 platforms.

This patch now introduces a Kconfig option to enable RX interrupt
buffer support for NS16550 style UARTs. With this option enabled, I was
able paste really long lines into the U-Boot console, without any
characters missing.

Signed-off-by: Stefan Roese 
Cc: Simon Glass 
Cc: Bin Meng 
---
 drivers/serial/Kconfig   |  10 +
 drivers/serial/ns16550.c | 106 ---
 include/ns16550.h|   6 +++
 3 files changed, 117 insertions(+), 5 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index b7dd2ac103..8284febae3 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -64,6 +64,16 @@ config DM_SERIAL
  implements serial_putc() etc. The uclass interface is
  defined in include/serial.h.
 
+config SERIAL_IRQ_BUFFER
+   bool "Enable RX interrupt buffer for serial input"
+   depends on DM_SERIAL
+   default n
+   help
+ Enable RX interrupt buffer support for the serial driver.
+ This enables pasting longer strings, even when the RX FIFO
+ of the UART is not big enough (e.g. 16 bytes on the normal
+ NS16550).
+
 config SPL_DM_SERIAL
bool "Enable Driver Model for serial drivers in SPL"
depends on DM_SERIAL
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index e0e70244ce..686c088e1d 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -315,6 +315,80 @@ DEBUG_UART_FUNCS
 #endif
 
 #ifdef CONFIG_DM_SERIAL
+
+#if CONFIG_IS_ENABLED(SERIAL_IRQ_BUFFER)
+
+#define BUF_COUNT  256
+
+static void rx_fifo_to_buf(struct udevice *dev)
+{
+   struct NS16550 *const com_port = dev_get_priv(dev);
+   struct ns16550_platdata *plat = dev->platdata;
+
+   /* Read all available chars into buffer */
+   while ((serial_in(_port->lsr) & UART_LSR_DR)) {
+   plat->buf[plat->wr_ptr++] = serial_in(_port->rbr);
+   plat->wr_ptr %= BUF_COUNT;
+   }
+}
+
+static int rx_pending(struct udevice *dev)
+{
+   struct ns16550_platdata *plat = dev->platdata;
+
+   /*
+* At startup it may happen, that some already received chars are
+* "stuck" in the RX FIFO, even with the interrupt enabled. This
+* RX FIFO flushing makes sure, that these chars are read out and
+* the RX interrupts works as expected.
+*/
+   rx_fifo_to_buf(dev);
+
+   return plat->rd_ptr != plat->wr_ptr ? 1 : 0;
+}
+
+static int rx_get(struct udevice *dev)
+{
+   struct ns16550_platdata *plat = dev->platdata;
+   char val;
+
+   val = plat->buf[plat->rd_ptr++];
+   plat->rd_ptr %= BUF_COUNT;
+
+   return val;
+}
+
+void ns16550_handle_irq(void *data)
+{
+   struct udevice *dev = (struct udevice *)data;
+   struct NS16550 *const com_port = dev_get_priv(dev);
+
+   /* Check if interrupt is pending */
+   if (serial_in(_port->iir) & UART_IIR_NO_INT)
+   return;
+
+   /* Flush all available characters from the RX FIFO into the RX buffer */
+   rx_fifo_to_buf(dev);
+}
+
+#else /* CONFIG_SERIAL_IRQ_BUFFER */
+
+static int rx_pending(struct udevice *dev)
+{
+   struct NS16550 *const com_port = dev_get_priv(dev);
+
+   return serial_in(_port->lsr) & UART_LSR_DR ? 1 : 0;
+}
+
+static int rx_get(struct udevice *dev)
+{
+   struct NS16550 *const com_port = dev_get_priv(dev);
+
+   return serial_in(_port->rbr);
+}
+
+#endif /* CONFIG_SERIAL_IRQ_BUFFER */
+
 static int ns16550_serial_putc(struct udevice *dev, const char ch)
 {
struct NS16550 *const com_port = dev_get_priv(dev);
@@ -340,19 +414,17 @@ static int ns16550_serial_pending(struct udevice *dev, 
bool input)
struct NS16550 *const com_port = dev_get_priv(dev);
 
if (input)
-   return serial_in(_port->lsr) & UART_LSR_DR ? 1 : 0;
+   return rx_pending(dev);
else
return serial_in(_port->lsr) & UART_LSR_THRE ? 0 : 1;
 }
 
 static int ns16550_serial_getc(struct udevice *dev)
 {
-   struct NS16550 *const com_port = dev_get_priv(dev);
-
-   if (!(serial_in(_port->lsr) & UART_LSR_DR))
+   if (!ns16550_serial_pending(dev, true))
return -EAGAIN;
 
-   return serial_in(_port->rbr);
+   return rx_get(dev);
 }
 
 static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)
@@ -375,6 +447,21 @@ int ns16550_serial_probe(struct udevice *dev)
com_port->plat = dev_get_platdata(dev);
NS16550_init(com_port, -1);
 
+#if CONFIG_IS_ENABLED(SERIAL_IRQ_BUFFER)
+   if (gd->flags & GD_FLG_RELOC) {
+   struct ns16550_platdata *plat = dev->platdata;
+
+   /* Allocate the RX buffer */
+   plat->buf = 

[U-Boot] [PATCH 1/4] ARM: uniphier: remove SPL support for ARMv8 SoCs

2017-07-13 Thread Masahiro Yamada
It has been a while since ARM Trusted Firmware supported UniPhier SoC
family.  U-Boot SPL was intended as a temporary loader that runs in
secure world.  It is a maintenance headache to support two different
boot mechanisms.  Secure firmware is realm of ARM Trusted Firmware
and now U-Boot only serves as a non-secure boot loader for UniPhier
ARMv8 SoCs.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/dts/uniphier-ld11-global.dts|   9 -
 arch/arm/dts/uniphier-ld11-ref.dts   |   9 -
 arch/arm/dts/uniphier-ld11.dtsi  |   3 -
 arch/arm/dts/uniphier-ld20-global.dts|   9 -
 arch/arm/dts/uniphier-ld20-ref.dts   |   9 -
 arch/arm/dts/uniphier-ld20.dtsi  |   3 -
 arch/arm/mach-uniphier/Kconfig   |  27 +-
 arch/arm/mach-uniphier/arm64/Makefile|   9 -
 arch/arm/mach-uniphier/arm64/arm-cci500.c|  42 --
 arch/arm/mach-uniphier/arm64/smp.S   |  19 -
 arch/arm/mach-uniphier/arm64/smp_kick_cpus.c |  32 --
 arch/arm/mach-uniphier/arm64/timer.c |  37 --
 arch/arm/mach-uniphier/board_init.c  |   9 -
 arch/arm/mach-uniphier/boards.c  |  71 ---
 arch/arm/mach-uniphier/boot-device/Makefile  |   4 -
 arch/arm/mach-uniphier/boot-device/spl_board.c   | 262 --
 arch/arm/mach-uniphier/clk/Makefile  |   2 -
 arch/arm/mach-uniphier/clk/clk-dram-ld11.c   |  25 -
 arch/arm/mach-uniphier/clk/clk-dram-ld20.c   |  28 -
 arch/arm/mach-uniphier/clk/clk-early-ld11.c  |  20 -
 arch/arm/mach-uniphier/clk/dpll-ld11.c   |  16 -
 arch/arm/mach-uniphier/clk/dpll-ld20.c   |  19 -
 arch/arm/mach-uniphier/dram/Makefile |   2 -
 arch/arm/mach-uniphier/dram/ddruqphy-regs.h  |  79 ---
 arch/arm/mach-uniphier/dram/umc-ld11.c   | 491 -
 arch/arm/mach-uniphier/dram/umc-ld20.c   | 636 ---
 arch/arm/mach-uniphier/dram/umc64-regs.h |  85 ---
 arch/arm/mach-uniphier/init.h|  18 -
 arch/arm/mach-uniphier/spl_board_init.c  |  26 -
 configs/uniphier_ld11_defconfig  |  41 --
 configs/uniphier_ld20_defconfig  |  40 --
 doc/README.uniphier  |   6 +-
 drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c |  22 +-
 drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c |  22 +-
 drivers/pinctrl/uniphier/pinctrl-uniphier-pxs3.c |  22 +-
 include/configs/uniphier.h   |  36 +-
 36 files changed, 45 insertions(+), 2145 deletions(-)
 delete mode 100644 arch/arm/mach-uniphier/arm64/arm-cci500.c
 delete mode 100644 arch/arm/mach-uniphier/arm64/smp.S
 delete mode 100644 arch/arm/mach-uniphier/arm64/smp_kick_cpus.c
 delete mode 100644 arch/arm/mach-uniphier/arm64/timer.c
 delete mode 100644 arch/arm/mach-uniphier/boot-device/spl_board.c
 delete mode 100644 arch/arm/mach-uniphier/clk/clk-dram-ld11.c
 delete mode 100644 arch/arm/mach-uniphier/clk/clk-dram-ld20.c
 delete mode 100644 arch/arm/mach-uniphier/clk/clk-early-ld11.c
 delete mode 100644 arch/arm/mach-uniphier/clk/dpll-ld11.c
 delete mode 100644 arch/arm/mach-uniphier/clk/dpll-ld20.c
 delete mode 100644 arch/arm/mach-uniphier/dram/ddruqphy-regs.h
 delete mode 100644 arch/arm/mach-uniphier/dram/umc-ld11.c
 delete mode 100644 arch/arm/mach-uniphier/dram/umc-ld20.c
 delete mode 100644 arch/arm/mach-uniphier/dram/umc64-regs.h
 delete mode 100644 configs/uniphier_ld11_defconfig
 delete mode 100644 configs/uniphier_ld20_defconfig

diff --git a/arch/arm/dts/uniphier-ld11-global.dts 
b/arch/arm/dts/uniphier-ld11-global.dts
index 2ed13606b505..7a650a02486a 100644
--- a/arch/arm/dts/uniphier-ld11-global.dts
+++ b/arch/arm/dts/uniphier-ld11-global.dts
@@ -68,12 +68,3 @@
  {
status = "okay";
 };
-
-/* for U-Boot only */
- {
-   u-boot,dm-pre-reloc;
-};
-
-_uart0 {
-   u-boot,dm-pre-reloc;
-};
diff --git a/arch/arm/dts/uniphier-ld11-ref.dts 
b/arch/arm/dts/uniphier-ld11-ref.dts
index 4bdf1121d678..cc8ebe34c27c 100644
--- a/arch/arm/dts/uniphier-ld11-ref.dts
+++ b/arch/arm/dts/uniphier-ld11-ref.dts
@@ -62,12 +62,3 @@
  {
status = "okay";
 };
-
-/* for U-Boot only */
- {
-   u-boot,dm-pre-reloc;
-};
-
-_uart0 {
-   u-boot,dm-pre-reloc;
-};
diff --git a/arch/arm/dts/uniphier-ld11.dtsi b/arch/arm/dts/uniphier-ld11.dtsi
index 75dfd1ff3b6b..74f8f721a888 100644
--- a/arch/arm/dts/uniphier-ld11.dtsi
+++ b/arch/arm/dts/uniphier-ld11.dtsi
@@ -109,7 +109,6 @@
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 0 0 0x>;
-   u-boot,dm-pre-reloc;
 
serial0: serial@54006800 {
compatible = "socionext,uniphier-uart";
@@ -343,11 +342,9 @@
compatible = "socionext,uniphier-ld11-soc-glue",
 "simple-mfd", "syscon";

[U-Boot] [PATCH 3/4] ARM: uniphier: remove part number info from the boot log

2017-07-13 Thread Masahiro Yamada
As is often the case with SoC development, slightly different
products (i.e. different part number) are developed based on the
same silicon-die.  Such fine grained information is unmaintainable.

Also, "SoC:" is a better fit that "CPU:".

Signed-off-by: Masahiro Yamada 
---

 arch/arm/mach-uniphier/cpu-info.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-uniphier/cpu-info.c 
b/arch/arm/mach-uniphier/cpu-info.c
index 94dce7c90d8a..2ce73c5af888 100644
--- a/arch/arm/mach-uniphier/cpu-info.c
+++ b/arch/arm/mach-uniphier/cpu-info.c
@@ -20,37 +20,37 @@ int print_cpuinfo(void)
model = uniphier_get_soc_model();
rev = uniphier_get_soc_revision();
 
-   puts("CPU:   ");
+   puts("SoC:   ");
 
switch (id) {
case UNIPHIER_SLD3_ID:
-   puts("sLD3 (MN2WS0220)");
+   puts("sLD3");
required_model = 2;
break;
case UNIPHIER_LD4_ID:
-   puts("LD4 (MN2WS0250)");
+   puts("LD4");
required_rev = 2;
break;
case UNIPHIER_PRO4_ID:
-   puts("Pro4 (MN2WS0230)");
+   puts("Pro4");
break;
case UNIPHIER_SLD8_ID:
-   puts("sLD8 (MN2WS0270)");
+   puts("sLD8");
break;
case UNIPHIER_PRO5_ID:
-   puts("Pro5 (MN2WS0300)");
+   puts("Pro5");
break;
case UNIPHIER_PXS2_ID:
-   puts("PXs2 (MN2WS0310)");
+   puts("PXs2");
break;
case UNIPHIER_LD6B_ID:
-   puts("LD6b (MN2WS0320)");
+   puts("LD6b");
break;
case UNIPHIER_LD11_ID:
-   puts("LD11 (SC1405AP1)");
+   puts("LD11");
break;
case UNIPHIER_LD20_ID:
-   puts("LD20 (SC1401AJ1)");
+   puts("LD20");
break;
case UNIPHIER_PXS3_ID:
puts("PXs3");
@@ -60,7 +60,7 @@ int print_cpuinfo(void)
return -ENOTSUPP;
}
 
-   printf(" model %d (revision %d)\n", model, rev);
+   printf(" (model %d, revision %d)\n", model, rev);
 
if (model < required_model) {
printf("Only model %d or newer is supported.\n",
-- 
2.7.4

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


[U-Boot] [PATCH 4/4] ARM: uniphier: enable CONFIG_CMD_FS_GENERIC

2017-07-13 Thread Masahiro Yamada
Enable file system commands such as load, ls.

Signed-off-by: Masahiro Yamada 
---

 configs/uniphier_ld4_sld8_defconfig  | 1 +
 configs/uniphier_pro4_defconfig  | 1 +
 configs/uniphier_pxs2_ld6b_defconfig | 1 +
 configs/uniphier_sld3_defconfig  | 1 +
 configs/uniphier_v8_defconfig| 1 +
 5 files changed, 5 insertions(+)

diff --git a/configs/uniphier_ld4_sld8_defconfig 
b/configs/uniphier_ld4_sld8_defconfig
index 268543272c3c..c3b123409478 100644
--- a/configs/uniphier_ld4_sld8_defconfig
+++ b/configs/uniphier_ld4_sld8_defconfig
@@ -29,6 +29,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 # CONFIG_CMD_MISC is not set
 CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/uniphier_pro4_defconfig b/configs/uniphier_pro4_defconfig
index a00e5833a405..72bd99a4221c 100644
--- a/configs/uniphier_pro4_defconfig
+++ b/configs/uniphier_pro4_defconfig
@@ -28,6 +28,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 # CONFIG_CMD_MISC is not set
 CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/uniphier_pxs2_ld6b_defconfig 
b/configs/uniphier_pxs2_ld6b_defconfig
index d4af18a0b697..a409872ac0e8 100644
--- a/configs/uniphier_pxs2_ld6b_defconfig
+++ b/configs/uniphier_pxs2_ld6b_defconfig
@@ -29,6 +29,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 # CONFIG_CMD_MISC is not set
 CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/uniphier_sld3_defconfig b/configs/uniphier_sld3_defconfig
index 0f810ee32e82..b9d89efb68e2 100644
--- a/configs/uniphier_sld3_defconfig
+++ b/configs/uniphier_sld3_defconfig
@@ -29,6 +29,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 # CONFIG_CMD_MISC is not set
 CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/uniphier_v8_defconfig b/configs/uniphier_v8_defconfig
index 73bdaa872949..d71b8b7a1d74 100644
--- a/configs/uniphier_v8_defconfig
+++ b/configs/uniphier_v8_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 # CONFIG_CMD_MISC is not set
 CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_GPIO_UNIPHIER=y
 CONFIG_MISC=y
-- 
2.7.4

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


[U-Boot] [PATCH 2/4] doc: uniphier: rework README.uniphier

2017-07-13 Thread Masahiro Yamada
Rework the readme to reflect the latest boot mechanism on ARMv8 SoCs.

Signed-off-by: Masahiro Yamada 
---

 doc/README.uniphier | 118 ++--
 1 file changed, 59 insertions(+), 59 deletions(-)

diff --git a/doc/README.uniphier b/doc/README.uniphier
index e2f3b9a2ec23..f21c9d09ce3e 100644
--- a/doc/README.uniphier
+++ b/doc/README.uniphier
@@ -5,7 +5,7 @@ U-Boot for UniPhier SoC family
 Recommended toolchains
 --
 
-The UniPhir platform is well tested with Linaro toolchanis.
+The UniPhier platform is well tested with Linaro toolchains.
 You can download pre-built toolchains from:
 
 http://www.linaro.org/downloads/
@@ -14,97 +14,97 @@ You can download pre-built toolchains from:
 Compile the source
 --
 
-sLD3 reference board:
-$ make uniphier_sld3_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf-
+The source can be configured and built with the following commands:
 
-LD4 reference board:
-$ make uniphier_ld4_sld8_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf-
+$ make 
+$ make CROSS_COMPILE= DEVICE_TREE=
 
-sLD8 reference board:
-$ make uniphier_ld4_sld8_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-sld8-ref
+The recommended  is `arm-linux-gnueabihf-` for 32bit SoCs,
+`aarch64-linux-gnu-` for 64bit SoCs, but you may wish to change it to use your
+favorite compiler.
 
-Pro4 reference board:
-$ make uniphier_pro4_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf-
+The following tables show  and  for each board.
 
-Pro4 Ace board:
-$ make uniphier_pro4_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-pro4-ace
+32bit SoC boards:
 
-Pro4 Sanji board:
-$ make uniphier_pro4_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-pro4-sanji
+ Board |   | 
+---|--|--
+sLD3 reference | uniphier_sld3_defconfig  | uniphier-sld3-ref (default)
+LD4 reference  | uniphier_ld4_sld8_defconfig  | uniphier-ld4-ref (default)
+sld8 reference | uniphier_ld4_sld8_defconfig  | uniphier-sld8-def
+Pro4 reference | uniphier_pro4_defconfig  | uniphier-pro4-ref (default)
+Pro4 Ace   | uniphier_pro4_defconfig  | uniphier-pro4-ace
+Pro4 Sanji | uniphier_pro4_defconfig  | uniphier-pro4-sanji
+Pro5 4KBOX | uniphier_pxs2_ld6b_defconfig | uniphier-pro5-4kbox
+PXs2 Gentil| uniphier_pxs2_ld6b_defconfig | uniphier-pxs2-gentil
+PXs2 Vodka | uniphier_pxs2_ld6b_defconfig | uniphier-pxs2-vodka (default)
+LD6b reference | uniphier_pxs2_ld6b_defconfig | uniphier-ld6b-ref
 
-Pro5 4KBOX Board:
-$ make uniphier_pxs2_ld6b_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-pro5-4kbox
+64bit SoC boards:
 
-PXs2 Gentil board:
-$ make uniphier_pxs2_ld6b_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-pxs2-gentil
+ Board || 
+---|---|
+LD11 reference | uniphier_v8_defconfig | uniphier-ld11-ref
+LD11 Global| uniphier_v8_defconfig | uniphier-ld11-global
+LD20 reference | uniphier_v8_defconfig | uniphier-ld20-ref (default)
+LD20 Global| uniphier_v8_defconfig | uniphier-ld20-global
 
-PXs2 Vodka board:
-$ make uniphier_pxs2_ld6b_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf-
+For example, to compile the source for PXs2 Vodka board, run the following:
 
-LD6b reference board:
 $ make uniphier_pxs2_ld6b_defconfig
-$ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-ld6b-ref
+$ make CROSS_COMPILE=arm-linux-gnueabihf- DEVICE_TREE=uniphier-pxs2-vodka
 
-LD11 reference board:
-$ make uniphier_v8_defconfig
-$ make CROSS_COMPILE=aarch64-linux-gnu- DEVICE_TREE=uniphier-ld11-ref
+The device tree marked as (default) can be omitted.  `uniphier-pxs2-vodka` is
+the default device tree for the configuration `uniphier_pxs2_ld6b_defconfig`,
+so the following gives the same result.
 
-LD20 reference board:
-$ make uniphier_v8_defconfig
-$ make CROSS_COMPILE=aarch64-linux-gnu-
-
-PXs3 reference board:
-$ make uniphier_v8_defconfig
-$ make CROSS_COMPILE=aarch64-linux-gnu- DEVICE_TREE=uniphier-pxs3-ref
+$ make uniphier_pxs2_ld6b_defconfig
+$ make CROSS_COMPILE=arm-linux-gnueabihf-
 
-You may wish to change the "CROSS_COMPILE=..." to use your favorite compiler.
 
+Booting 32bit SoC boards
+
 
-Burn U-Boot images to NAND
---
+The build command will generate the following:
+- u-boot.bin
+- spl/u-boot.bin
 
-Write the following to the NAND device:
+U-Boot can boot UniPhier 32bit SoC boards by itself.  Flash the generated 
images
+to the storage device (NAND or eMMC) on your board.
 
  - spl/u-boot-spl.bin at the offset address 0x
  - 

Re: [U-Boot] Pull request: u-boot-mips

2017-07-13 Thread Daniel Schwierzeck
Hi Tom,

2017-07-12 22:57 GMT+02:00 Tom Rini :
> On Wed, Jul 12, 2017 at 10:32:29PM +0200, Daniel Schwierzeck wrote:
>
>> Hi Tom,
>>
>> This supports dynamic relocation on MIPS without the need for building a
>> position-independent executable. This notably reduces the code size for
>> all MIPS boards.
>>
>>
>> The following changes since commit d85ca029f257b53a96da6c2fb421e78a003a9943:
>>
>>   Prepare v2017.07 (2017-07-10 13:07:38 -0400)
>>
>> are available in the git repository at:
>>
>>   git://git.denx.de/u-boot-mips.git master
>>
>> for you to fetch changes up to f653dcd5720c4135607211f7304283d7a8ec3b8a:
>>
>>   MIPS: bootm: Fix broken boot_env_legacy codepath (2017-07-12 22:10:42 
>> +0200)
>>
>
> I'm seeing:
>   mips:  +   tplink_wdr4300
> +(tplink_wdr4300)pfx##hdr32[idx].field = _val;   \
> +(tplink_wdr4300)  ^
> +(tplink_wdr4300) ../tools/mips-relocs.c:51:11: note: ?_val? was declared here
> +(tplink_wdr4300)   uint64_t _val;  \
> +(tplink_wdr4300)^
> +(tplink_wdr4300) ../tools/mips-relocs.c:88:2: note: in expansion of macro 
> ?set_hdr_field?
> +(tplink_wdr4300)   set_hdr_field(p, idx, field, val)
> +(tplink_wdr4300)   ^
> +(tplink_wdr4300) ../tools/mips-relocs.c:408:3: note: in expansion of macro 
> ?set_phdr_field?
> +(tplink_wdr4300)set_phdr_field(i, p_filesz, load_sz);
> +(tplink_wdr4300)^~
> w+(tplink_wdr4300) ../tools/mips-relocs.c: In function ?main?:
> w+(tplink_wdr4300) ../tools/mips-relocs.c:77:25: warning: ?_val? may be used 
> uninitialized in this function [-Wmaybe-uninitialized]
>
> for what I suspect is going to be all MIPS.  Host tools here are gcc-6.3.
>

how about adding a separate build step in Travis CI for all host tools
and building that step with different compilers (recent gcc or clang)?
Or we always install a recent x86_64 toolchain and override the host
toolchain contained in the Ubuntu builder image. This toolchain is
then used for all build steps.

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


[U-Boot] [PATCH v2 1/9] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

2017-07-13 Thread Andy Yan
Some platforms has very small sram to run spl code, so it has no
enough sapce for so much malloc pool before relocation in
spl stage as the normal u-boot stake.
Make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN,
Then people can sets the pre-relocation malloc pool according to
the memory space indepently.

Signed-off-by: Andy Yan 

---

Changes in v2:
- introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon

 Kconfig   | 10 ++
 arch/sandbox/cpu/start.c  |  2 +-
 cmd/bdinfo.c  |  2 +-
 common/Makefile   |  2 +-
 common/board_f.c  |  4 ++--
 common/board_r.c  |  2 +-
 common/dlmalloc.c | 12 ++--
 common/init/board_init.c  |  4 ++--
 common/spl/spl.c  |  6 +++---
 drivers/core/Kconfig  |  8 
 drivers/serial/serial-uclass.c|  4 ++--
 include/asm-generic/global_data.h |  2 +-
 include/common.h  | 11 +++
 lib/asm-offsets.c |  2 +-
 lib/efi/efi_app.c |  2 +-
 15 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/Kconfig b/Kconfig
index bb80ada..c1451bc 100644
--- a/Kconfig
+++ b/Kconfig
@@ -95,6 +95,16 @@ config SYS_MALLOC_F_LEN
  particular needs this to operate, so that it can allocate the
  initial serial device and any others that are needed.
 
+config SPL_SYS_MALLOC_F_LEN
+hex "Size of malloc() pool in spl before relocation"
+depends on SYS_MALLOC_F
+default SYS_MALLOC_F_LEN
+help
+  Before relocation, memory is very limited on many platforms. Still,
+  we can provide a small malloc() pool if needed. Driver model in
+  particular needs this to operate, so that it can allocate the
+  initial serial device and any others that are needed.
+
 menuconfig EXPERT
bool "Configure standard U-Boot features (expert users)"
default y
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index f605d4d..17e531a 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -310,7 +310,7 @@ int main(int argc, char *argv[])
 
memset(, '\0', sizeof(data));
gd = 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#ifdef CONFIG_SYS_MALLOC_F
gd->malloc_base = CONFIG_MALLOC_F_ADDR;
 #endif
setup_ram_buf(state);
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 8971697..64836e9 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -346,7 +346,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 #endif
 #ifdef CONFIG_SYS_MALLOC_F
printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
-  CONFIG_SYS_MALLOC_F_LEN);
+  get_sys_malloc_f_len());
 #endif
if (gd->fdt_blob)
printf("fdt_blob = %p\n", gd->fdt_blob);
diff --git a/common/Makefile b/common/Makefile
index 17a92ea..29c880d 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -139,7 +139,7 @@ obj-y += console.o
 endif
 obj-$(CONFIG_CROS_EC) += cros_ec.o
 obj-y += dlmalloc.o
-ifdef CONFIG_SYS_MALLOC_F_LEN
+ifdef CONFIG_SYS_MALLOC_F
 obj-y += malloc_simple.o
 endif
 obj-y += image.o
diff --git a/common/board_f.c b/common/board_f.c
index ffa84e3..82dae70 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -727,7 +727,7 @@ static int initf_bootstage(void)
 
 static int initf_console_record(void)
 {
-#if defined(CONFIG_CONSOLE_RECORD) && defined(CONFIG_SYS_MALLOC_F_LEN)
+#if defined(CONFIG_CONSOLE_RECORD) && defined(CONFIG_SYS_MALLOC_F)
return console_record_init();
 #else
return 0;
@@ -736,7 +736,7 @@ static int initf_console_record(void)
 
 static int initf_dm(void)
 {
-#if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN)
+#if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F)
int ret;
 
bootstage_start(BOOTSTATE_ID_ACCUM_DM_F, "dm_f");
diff --git a/common/board_r.c b/common/board_r.c
index ecca1ed..e7d4010 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -256,7 +256,7 @@ static int initr_malloc(void)
 {
ulong malloc_start;
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#ifdef CONFIG_SYS_MALLOC_F
debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
  gd->malloc_ptr / 1024);
 #endif
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index fc1e8b3..d19c3e1 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1254,7 +1254,7 @@ Void_t* mALLOc(bytes) size_t bytes;
 
   INTERNAL_SIZE_T nb;
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#ifdef CONFIG_SYS_MALLOC_F
if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT))
return malloc_simple(bytes);
 #endif
@@ -1522,7 +1522,7 @@ void fREe(mem) Void_t* mem;
   mchunkptr fwd;   /* misc temp for linking */
   int   islr;  /* track whether merging with last_remainder */
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#ifdef CONFIG_SYS_MALLOC_F
/* free() is a no-op - 

[U-Boot] [PATCH v2 0/9] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

2017-07-13 Thread Andy Yan

Some platforms like RK3036 has very small sram to run spl code, so
it has no enough sapce for so much malloc pool before relocation in
spl stage as the normal u-boot stake.
As the long discussion in [1] [2], I make this series out, try to
make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN.

[1]https://lists.denx.de/pipermail/u-boot/2017-July/297370.html
[2]https://lists.denx.de/pipermail/u-boot/2017-July/297504.html


Changes in v2:
- introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon
- set spl pre relocation malloc pool by CONFIG_SPL_SYS_MALLOC_F_LEN

Andy Yan (9):
  make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
  mips: spl and normal u-boot stage set SYS_MALLOC_F indepently
  powerpc: spl and normal u-boot stage set SYS_MALLOC_F indepently
  microblaze: spl and normal u-boot stage set SYS_MALLOC_F indepently
  rockchip: set malloc pool size to 0 before relocation in spl state on
rk3036 based board
  rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
  rockchip: enable SPL_LIBGENERIC for rk3036 based boards
  rockchip: use debug() instead of printf when back to bootrom
  rockchip: add u-boot specific dts for rk3036 sdk

 Kconfig   | 10 ++
 arch/arm/dts/rk3036-sdk-u-boot.dtsi   | 11 +++
 arch/arm/mach-rockchip/bootrom.c  |  2 +-
 arch/arm/mach-rockchip/rk3036-board-spl.c |  6 --
 arch/microblaze/cpu/start.S   | 11 ---
 arch/mips/cpu/start.S |  8 ++--
 arch/powerpc/cpu/mpc83xx/start.S  | 13 +
 arch/powerpc/cpu/mpc85xx/start.S  | 16 ++--
 arch/sandbox/cpu/start.c  |  2 +-
 cmd/bdinfo.c  |  2 +-
 common/Makefile   |  2 +-
 common/board_f.c  |  4 ++--
 common/board_r.c  |  2 +-
 common/dlmalloc.c | 12 ++--
 common/init/board_init.c  |  4 ++--
 common/spl/spl.c  |  6 +++---
 configs/evb-rk3036_defconfig  |  5 +
 configs/kylin-rk3036_defconfig|  6 +-
 drivers/core/Kconfig  |  8 
 drivers/serial/serial-uclass.c|  4 ++--
 include/asm-generic/global_data.h |  2 +-
 include/common.h  | 11 +++
 lib/asm-offsets.c |  2 +-
 lib/efi/efi_app.c |  2 +-
 24 files changed, 102 insertions(+), 49 deletions(-)
 create mode 100644 arch/arm/dts/rk3036-sdk-u-boot.dtsi

-- 
2.7.4


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


Re: [U-Boot] Pull request: u-boot-mips

2017-07-13 Thread Daniel Schwierzeck
Hi Paul,

2017-07-13 2:33 GMT+02:00 Tom Rini :
> On Wed, Jul 12, 2017 at 04:57:42PM -0400, Tom Rini wrote:
>> On Wed, Jul 12, 2017 at 10:32:29PM +0200, Daniel Schwierzeck wrote:
>>
>> > Hi Tom,
>> >
>> > This supports dynamic relocation on MIPS without the need for building a
>> > position-independent executable. This notably reduces the code size for
>> > all MIPS boards.
>> >
>> >
>> > The following changes since commit 
>> > d85ca029f257b53a96da6c2fb421e78a003a9943:
>> >
>> >   Prepare v2017.07 (2017-07-10 13:07:38 -0400)
>> >
>> > are available in the git repository at:
>> >
>> >   git://git.denx.de/u-boot-mips.git master
>> >
>> > for you to fetch changes up to f653dcd5720c4135607211f7304283d7a8ec3b8a:
>> >
>> >   MIPS: bootm: Fix broken boot_env_legacy codepath (2017-07-12 22:10:42 
>> > +0200)
>> >
>>
>> I'm seeing:
>>   mips:  +   tplink_wdr4300
>> +(tplink_wdr4300)pfx##hdr32[idx].field = _val;   \
>> +(tplink_wdr4300)  ^
>> +(tplink_wdr4300) ../tools/mips-relocs.c:51:11: note: ?_val? was declared 
>> here
>> +(tplink_wdr4300)   uint64_t _val;  \
>> +(tplink_wdr4300)^
>> +(tplink_wdr4300) ../tools/mips-relocs.c:88:2: note: in expansion of macro 
>> ?set_hdr_field?
>> +(tplink_wdr4300)   set_hdr_field(p, idx, field, val)
>> +(tplink_wdr4300)   ^
>> +(tplink_wdr4300) ../tools/mips-relocs.c:408:3: note: in expansion of macro 
>> ?set_phdr_field?
>> +(tplink_wdr4300)set_phdr_field(i, p_filesz, load_sz);
>> +(tplink_wdr4300)^~
>> w+(tplink_wdr4300) ../tools/mips-relocs.c: In function ?main?:
>> w+(tplink_wdr4300) ../tools/mips-relocs.c:77:25: warning: ?_val? may be used 
>> uninitialized in this function [-Wmaybe-uninitialized]
>>
>> for what I suspect is going to be all MIPS.  Host tools here are gcc-6.3.
>
> Yeah, this is all MIPS boards.  Please fix, thanks!
>

Paul, could you send a follow-up patch to fix this? Thanks.


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


Re: [U-Boot] [PATCH v2 2/9] mips: spl and normal u-boot stage set SYS_MALLOC_F indepently

2017-07-13 Thread Daniel Schwierzeck
2017-07-13 5:23 GMT+02:00 Andy Yan :
> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
>
> Signed-off-by: Andy Yan 
> ---
>
> Changes in v2: None
>
>  arch/mips/cpu/start.S | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>

Acked-by: Daniel Schwierzeck 

> diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
> index d01ee9f..0cc140b 100644
> --- a/arch/mips/cpu/start.S
> +++ b/arch/mips/cpu/start.S
> @@ -60,8 +60,12 @@
> sp, sp, GD_SIZE # reserve space for gd
> and sp, sp, t0  # force 16 byte alignment
> movek0, sp  # save gd pointer
> -#ifdef CONFIG_SYS_MALLOC_F_LEN
> +#ifdef CONFIG_SYS_MALLOC_F
> +# ifdef CONFIG_SPL_BUILD
> +   li  t2, CONFIG_SPL_SYS_MALLOC_F_LEN
> +# else
> li  t2, CONFIG_SYS_MALLOC_F_LEN
> +# endif
> PTR_SUBU \
> sp, sp, t2  # reserve space for early malloc
> and sp, sp, t0  # force 16 byte alignment
> @@ -75,7 +79,7 @@
> blt t0, t1, 1b
>  PTR_ADDIU t0, PTRSIZE
>
> -#ifdef CONFIG_SYS_MALLOC_F_LEN
> +#ifdef CONFIG_SYS_MALLOC_F
> PTR_S   sp, GD_MALLOC_BASE(k0)  # gd->malloc_base offset
>  #endif
> .endm
> --
> 2.7.4
>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Data Abort with gcc 7.1

2017-07-13 Thread Peter Robinson
On Thu, Jul 13, 2017 at 11:11 AM, Måns Rullgård  wrote:
> Siarhei Siamashka  writes:
>
>> On Thu, 13 Jul 2017 01:43:37 +0100
>> Måns Rullgård  wrote:
>>
>>> Maxime Ripard  writes:
>>>
>>> > Hi,
>>> >
>>> > I recently got a gcc 7.1 based toolchain, and it seems like it
>>> > generates unaligned code, specifically in the net_set_ip_header
>>> > function in my case.
>>> >
>>> > Whenever some packet is sent, this data abort is triggered:
>>> >
>>> > => setenv ipaddr 10.42.0.1; ping 10.42.0.254
>>> > using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
>>> > MAC de:ad:be:ef:00:01
>>> > HOST MAC de:ad:be:af:00:00
>>> > RNDIS ready
>>> > musb-hdrc: peripheral reset irq lost!
>>> > high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
>>> > USB RNDIS network up!
>>> > Using usb_ether device
>>> > data abort
>>> > pc : [<7ff9db10>] lr : [<7ff9f00c>]
>>> > reloc pc : [<4a043b10>]   lr : [<4a04500c>]
>>> > sp : 7bf37cc8  ip : fp : 7ff6236c
>>> > r10: 7ffed2b8  r9 : 7bf39ee8r8 : 7ffed2b8
>>> > r7 : 0001  r6 : r5 : 002a  r4 : 7ffed30e
>>> > r3 : 1445  r2 : 01002a0ar1 : fe002a0a  r0 : 7ffed30e
>>> > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
>>> > Resetting CPU ...
>>> >
>>> > Running objdump on it gives us this:
>>> >
>>> > 4a043b04 :
>>> >
>>> >/*
>>> > *  Construct an IP header.
>>> > */
>>> >/* IP_HDR_SIZE / 4 (not including UDP) */
>>> >ip->ip_hl_v  = 0x45;
>>> > 4a043b04:  e59f3074ldr r3, [pc, #116]  ; 4a043b80 
>>> > 
>>> > {
>>> > 4a043b08:  e92d4013push{r0, r1, r4, lr}
>>> > 4a043b0c:  e1a04000mov r4, r0
>>> >ip->ip_hl_v  = 0x45;
>>> > 4a043b10:  e5803000str r3, [r0] < Abort
>>> >ip->ip_tos   = 0;
>>> >ip->ip_len   = htons(IP_HDR_SIZE);
>>> >ip->ip_id= htons(net_ip_id++);
>>> > 4a043b14:  e59f3068ldr r3, [pc, #104]  ; 4a043b84 
>>> > 
>>> >
>>> > It seems like r0 is indeed set to an unaligned address (0x7ffed30e)
>>> > for some reason.
>>> >
>>> > Using a Linaro 6.3 toolchain works on the same commit with the same
>>> > config, so it really seems to be a compiler-related issue.
>>> >
>>> > It generates this code:
>>> >
>>> > 4a043ec4 :
>>> >
>>> >/*
>>> > *  Construct an IP header.
>>> > */
>>> >/* IP_HDR_SIZE / 4 (not including UDP) */
>>> >ip->ip_hl_v  = 0x45;
>>> > 4a043ec4:  e3a03045mov r3, #69 ; 0x45
>>> > {
>>> > 4a043ec8:  e92d4013push{r0, r1, r4, lr}
>>> > 4a043ecc:  e1a04000mov r4, r0
>>> >ip->ip_hl_v  = 0x45;
>>> > 4a043ed0:  e5c03000strbr3, [r0]
>>> >ip->ip_tos   = 0;
>>> >ip->ip_len   = htons(IP_HDR_SIZE);
>>> > 4a043ed4:  e3a03b05mov r3, #5120   ; 0x1400
>>> >ip->ip_tos   = 0;
>>> > 4a043ed8:  e3a0mov r0, #0
>>> >ip->ip_len   = htons(IP_HDR_SIZE);
>>> > 4a043edc:  e1c430b2strhr3, [r4, #2]
>>> >ip->ip_id= htons(net_ip_id++);
>>> > 4a043ee0:  e59f3064ldr r3, [pc, #100]  ; 4a043f4c 
>>> > 
>>> >
>>> > And it seems like it's using an strb instruction to avoid the
>>> > unaligned access.
>>> >
>>> > As far as I know, we are passing --wno-unaligned-access, so the broken
>>> > situation should not arise, and yet it does, so I'm a bit confused,
>>> > and not really sure what to do from there.
>>>
>>> For reference, this is the relevant code:
>>>
>>> struct ip_udp_hdr {
>>>  u8  ip_hl_v;/* header length and version*/
>>>  u8  ip_tos; /* type of service  */
>>>  u16 ip_len; /* total length */
>>>  u16 ip_id;  /* identification   */
>>>  u16 ip_off; /* fragment offset field*/
>>>  u8  ip_ttl; /* time to live */
>>>  u8  ip_p;   /* protocol */
>>>  u16 ip_sum; /* checksum */
>>>  struct in_addr  ip_src; /* Source IP address*/
>>>  struct in_addr  ip_dst; /* Destination IP address   */
>>>  u16 udp_src;/* UDP source port  */
>>>  u16 udp_dst;/* UDP destination port */
>>>  u16 udp_len;/* Length of UDP packet */
>>>  u16 udp_xsum;   /* Checksum */
>>> };
>>>
>>> void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr 
>>> source)
>>> {
>>>  struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
>>>
>>>  /*
>>>   *  Construct an IP header.
>>>   */
>>>  /* IP_HDR_SIZE / 4 (not including UDP) */
>>>  ip->ip_hl_v  

Re: [U-Boot] Data Abort with gcc 7.1

2017-07-13 Thread Måns Rullgård
Siarhei Siamashka  writes:

> On Thu, 13 Jul 2017 01:43:37 +0100
> Måns Rullgård  wrote:
>
>> Maxime Ripard  writes:
>> 
>> > Hi,
>> >
>> > I recently got a gcc 7.1 based toolchain, and it seems like it
>> > generates unaligned code, specifically in the net_set_ip_header
>> > function in my case.
>> >
>> > Whenever some packet is sent, this data abort is triggered:
>> >  
>> > => setenv ipaddr 10.42.0.1; ping 10.42.0.254  
>> > using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
>> > MAC de:ad:be:ef:00:01
>> > HOST MAC de:ad:be:af:00:00
>> > RNDIS ready
>> > musb-hdrc: peripheral reset irq lost!
>> > high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
>> > USB RNDIS network up!
>> > Using usb_ether device
>> > data abort
>> > pc : [<7ff9db10>] lr : [<7ff9f00c>]
>> > reloc pc : [<4a043b10>]   lr : [<4a04500c>]
>> > sp : 7bf37cc8  ip : fp : 7ff6236c
>> > r10: 7ffed2b8  r9 : 7bf39ee8r8 : 7ffed2b8
>> > r7 : 0001  r6 : r5 : 002a  r4 : 7ffed30e
>> > r3 : 1445  r2 : 01002a0ar1 : fe002a0a  r0 : 7ffed30e
>> > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
>> > Resetting CPU ...
>> >
>> > Running objdump on it gives us this:
>> >
>> > 4a043b04 :
>> >
>> >/*
>> > *  Construct an IP header.
>> > */
>> >/* IP_HDR_SIZE / 4 (not including UDP) */
>> >ip->ip_hl_v  = 0x45;
>> > 4a043b04:  e59f3074ldr r3, [pc, #116]  ; 4a043b80 
>> > 
>> > {
>> > 4a043b08:  e92d4013push{r0, r1, r4, lr}
>> > 4a043b0c:  e1a04000mov r4, r0
>> >ip->ip_hl_v  = 0x45;
>> > 4a043b10:  e5803000str r3, [r0] < Abort
>> >ip->ip_tos   = 0;
>> >ip->ip_len   = htons(IP_HDR_SIZE);
>> >ip->ip_id= htons(net_ip_id++);
>> > 4a043b14:  e59f3068ldr r3, [pc, #104]  ; 4a043b84 
>> > 
>> >
>> > It seems like r0 is indeed set to an unaligned address (0x7ffed30e)
>> > for some reason.
>> >
>> > Using a Linaro 6.3 toolchain works on the same commit with the same
>> > config, so it really seems to be a compiler-related issue.
>> >
>> > It generates this code:
>> >
>> > 4a043ec4 :
>> >
>> >/*
>> > *  Construct an IP header.
>> > */
>> >/* IP_HDR_SIZE / 4 (not including UDP) */
>> >ip->ip_hl_v  = 0x45;
>> > 4a043ec4:  e3a03045mov r3, #69 ; 0x45
>> > {
>> > 4a043ec8:  e92d4013push{r0, r1, r4, lr}
>> > 4a043ecc:  e1a04000mov r4, r0
>> >ip->ip_hl_v  = 0x45;
>> > 4a043ed0:  e5c03000strbr3, [r0]
>> >ip->ip_tos   = 0;
>> >ip->ip_len   = htons(IP_HDR_SIZE);
>> > 4a043ed4:  e3a03b05mov r3, #5120   ; 0x1400
>> >ip->ip_tos   = 0;
>> > 4a043ed8:  e3a0mov r0, #0
>> >ip->ip_len   = htons(IP_HDR_SIZE);
>> > 4a043edc:  e1c430b2strhr3, [r4, #2]
>> >ip->ip_id= htons(net_ip_id++);
>> > 4a043ee0:  e59f3064ldr r3, [pc, #100]  ; 4a043f4c 
>> > 
>> >
>> > And it seems like it's using an strb instruction to avoid the
>> > unaligned access.
>> >
>> > As far as I know, we are passing --wno-unaligned-access, so the broken
>> > situation should not arise, and yet it does, so I'm a bit confused,
>> > and not really sure what to do from there.  
>> 
>> For reference, this is the relevant code:
>> 
>> struct ip_udp_hdr {
>>  u8  ip_hl_v;/* header length and version*/
>>  u8  ip_tos; /* type of service  */
>>  u16 ip_len; /* total length */
>>  u16 ip_id;  /* identification   */
>>  u16 ip_off; /* fragment offset field*/
>>  u8  ip_ttl; /* time to live */
>>  u8  ip_p;   /* protocol */
>>  u16 ip_sum; /* checksum */
>>  struct in_addr  ip_src; /* Source IP address*/
>>  struct in_addr  ip_dst; /* Destination IP address   */
>>  u16 udp_src;/* UDP source port  */
>>  u16 udp_dst;/* UDP destination port */
>>  u16 udp_len;/* Length of UDP packet */
>>  u16 udp_xsum;   /* Checksum */
>> };
>> 
>> void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr 
>> source)
>> {
>>  struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
>> 
>>  /*
>>   *  Construct an IP header.
>>   */
>>  /* IP_HDR_SIZE / 4 (not including UDP) */
>>  ip->ip_hl_v  = 0x45;
>>  ip->ip_tos   = 0;
>>  ip->ip_len   = htons(IP_HDR_SIZE);
>>  ip->ip_id= htons(net_ip_id++);
>>  ip->ip_off   = htons(IP_FLAGS_DFRAG);   /* Don't fragment 

Re: [U-Boot] [PATCH v4 00/20] dm: tegra: Move nyan-big, jetson-tk1, beaver to livetree

2017-07-13 Thread Marcel Ziswiler
Hi Simon

On Thu, 2017-07-13 at 03:22 -0600, Simon Glass wrote:
> Hi Marcel,
> 
> On 13 July 2017 at 02:38, Marcel Ziswiler  m> wrote:
> > On Tue, 2017-07-11 at 21:29 -0600, Simon Glass wrote:
> > > This moves four entire boards to use a live device tree as an
> > > example
> > > of
> > > the impact.
> > > 
> > > Nyan-big was chosen because I can easily and boot U-Boot without
> > > any
> > > media swapping, etc. Beaver is enabled as well since it failed to
> > > boot
> > > with serial v1 due to a disabled console node. Jetson-TK1 is
> > > chosen
> > > because I found some USB problems in the v2 patches. Jetson-TX1
> > > is
> > > added
> > > because Stephen Warren found some problems with PCI.
> > > 
> > > Total code size impact on this board is approximately 9KB on U-
> > > Boot
> > > and
> > > 64 bytes on SPL:
> > > 
> > > 27: dm: tegra: nyan-big: Move to livetree
> > >    arm: (for 1/1 boards) all +9264.0 bss -16.0 data +44.0
> > > rodata
> > > +92.0
> > >   spl/u-boot-spl:all +326.0 spl/u-boot-spl:rodata +262.0
> > >   spl/u-boot-spl:text +64.0 text +9144.0
> > > 
> > > Tegra does not use Thumb2, which would likely reduce the code
> > > size by
> > > about
> > > 25%, indicating a code-size impact of perhaps 7KB.
> > > 
> > > Boot time is affected slightly. For nyan-big the times with flat
> > > tree
> > > are:
> > > 
> > >  2,108  dm_r
> > >  7,924  dm_spl
> > >    120,724  dm_f
> > >    171,816  lcd
> > > 
> > > With the livetree:
> > > 
> > >    721  dm_r
> > >  3,764  of_live
> > >  7,990  dm_spl
> > >    120,736  dm_f
> > >    168,215  lcd
> > > 
> > > As expected the spl and pre-relocation times are not affected. In
> > > the
> > > post-relocation case, the live tree must be built, which here
> > > takes
> > > about
> > > 3.8ms. Driver-model device creation takes a bit of 1ms less time
> > > with
> > > the
> > > livetree, so all up the cost is about 2.4ms. After DM init there
> > > appears
> > > to be a slight reduction in the time taken to set up devices
> > > (from
> > > 327ms
> > > to 319ms) so overall the live tree does not appear to be any
> > > slower.
> > > This
> > > is because pre-parsing the device tree makes reading it later
> > > faster.
> > > 
> > > The use of livetree is controlled by a the CONFIG_OF_LIVE option.
> > > When
> > > enabled, U-Boot builds a livetree immediately after relocation
> > > and
> > > uses
> > > it from then on.
> > > 
> > > This series is available at u-boot-dm/livet-working
> > > 
> > > Changes in v4:
> > > - Add new patch to add ofnode_read_resource()
> > > - Add new patch to fix up ofnode_get_addr_index() for 64-bit
> > > values
> > > - Update to use ofnode_read_resource()
> > > - Drop fdtdec.h header
> > > - Update to deal with rename of ofnode_read_prop()
> > > - Rebase to master
> > > - Drop changes already applied
> > > - Fix PCI and i2c init problems on jetson-tx1
> > 
> > Could you elaborate a little bit more on this as from the actual
> > patch
> > set I don't seem to be able to figure out how/what exactly you did
> > in
> > that respect.
> > 
> > Other than that it at least works for me on my Beaver and Jetson
> > TK1 so
> > you may add the following to the whole series:
> > 
> > Tested-by: Marcel Ziswiler 
> > Tested-on: Beaver, Jetson-TK1
> 
> Thanks.

You are very welcome.

> I cannot test Jetson-TK1 yet but I think these changes are needed to
> make USB work, and possibly PCI:
> 
> > > - Add new patch to add ofnode_read_resource()
> > > - Update to use ofnode_read_resource()
> 
> (see the appropriate patches with these changes mentioned in the
> change log)

OK, yeah I saw those but just could not quite make the connection.

> Basically the code for setting up the USB PHY did not work and that
> stopped PCI from working, I believe.

OK, makes sense. So it was rather a high level issue then.

> The changes applicable to TX1 are:
> 
> > > - Add new patch to fix up ofnode_get_addr_index() for 64-bit
> > > values
> 
> (this fixed I2C reading the register address)

Perfect, while we should have a TX1 laying around somewhere as well I
currently failed finding it. Probably one of my co-workers currently on
vacation took it and is playing with it (;-p).

> [..]
> 
> Regards,
> Simon

Cheers

Marcel

BTW: I'm now in the process of migrating our boards as well and will send 
patches for that soon.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: ahci: Add a generic PCI-based AHCI driver

2017-07-13 Thread Simon Glass
Hi Bin,

On 6 July 2017 at 23:08, Bin Meng  wrote:
> Hi Simon,
>
> On Wed, Jun 21, 2017 at 1:00 PM, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Wed, Jun 21, 2017 at 11:29 AM, Simon Glass  wrote:
>>> Hi Bin,
>>>
>>> On 17 June 2017 at 07:35, Bin Meng  wrote:
 This adds support for PCI-based AHCI controller and enables it on
 x86 by default.

 Signed-off-by: Bin Meng 
 ---

  drivers/ata/Kconfig|  7 +++
  drivers/ata/Makefile   |  1 +
  drivers/ata/ahci-pci.c | 42 ++
  3 files changed, 50 insertions(+)
  create mode 100644 drivers/ata/ahci-pci.c
>>>
>>> I believe that if the device tree specifies this driver then it will
>>> override the generic PCI probing done here. Is that right?
>>>
>>
>> That's my understanding as well but I have no target to test. Can you
>> test that on Chromebook Link?
>
> Will this series be applied to u-boot-dm?

Yes, just got to testing this. Had some problems booting the device.

Reviewed-by: Simon Glass 
Tested-on: chromebook_link
Tested-by: Simon Glass 

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


Re: [U-Boot] [PATCH v4 00/20] dm: tegra: Move nyan-big, jetson-tk1, beaver to livetree

2017-07-13 Thread Simon Glass
Hi Marcel,

On 13 July 2017 at 02:38, Marcel Ziswiler  wrote:
> On Tue, 2017-07-11 at 21:29 -0600, Simon Glass wrote:
>> This moves four entire boards to use a live device tree as an example
>> of
>> the impact.
>>
>> Nyan-big was chosen because I can easily and boot U-Boot without any
>> media swapping, etc. Beaver is enabled as well since it failed to
>> boot
>> with serial v1 due to a disabled console node. Jetson-TK1 is chosen
>> because I found some USB problems in the v2 patches. Jetson-TX1 is
>> added
>> because Stephen Warren found some problems with PCI.
>>
>> Total code size impact on this board is approximately 9KB on U-Boot
>> and
>> 64 bytes on SPL:
>>
>> 27: dm: tegra: nyan-big: Move to livetree
>>arm: (for 1/1 boards) all +9264.0 bss -16.0 data +44.0 rodata
>> +92.0
>>   spl/u-boot-spl:all +326.0 spl/u-boot-spl:rodata +262.0
>>   spl/u-boot-spl:text +64.0 text +9144.0
>>
>> Tegra does not use Thumb2, which would likely reduce the code size by
>> about
>> 25%, indicating a code-size impact of perhaps 7KB.
>>
>> Boot time is affected slightly. For nyan-big the times with flat tree
>> are:
>>
>>  2,108  dm_r
>>  7,924  dm_spl
>>120,724  dm_f
>>171,816  lcd
>>
>> With the livetree:
>>
>>721  dm_r
>>  3,764  of_live
>>  7,990  dm_spl
>>120,736  dm_f
>>168,215  lcd
>>
>> As expected the spl and pre-relocation times are not affected. In the
>> post-relocation case, the live tree must be built, which here takes
>> about
>> 3.8ms. Driver-model device creation takes a bit of 1ms less time with
>> the
>> livetree, so all up the cost is about 2.4ms. After DM init there
>> appears
>> to be a slight reduction in the time taken to set up devices (from
>> 327ms
>> to 319ms) so overall the live tree does not appear to be any slower.
>> This
>> is because pre-parsing the device tree makes reading it later faster.
>>
>> The use of livetree is controlled by a the CONFIG_OF_LIVE option.
>> When
>> enabled, U-Boot builds a livetree immediately after relocation and
>> uses
>> it from then on.
>>
>> This series is available at u-boot-dm/livet-working
>>
>> Changes in v4:
>> - Add new patch to add ofnode_read_resource()
>> - Add new patch to fix up ofnode_get_addr_index() for 64-bit values
>> - Update to use ofnode_read_resource()
>> - Drop fdtdec.h header
>> - Update to deal with rename of ofnode_read_prop()
>> - Rebase to master
>> - Drop changes already applied
>> - Fix PCI and i2c init problems on jetson-tx1
>
> Could you elaborate a little bit more on this as from the actual patch
> set I don't seem to be able to figure out how/what exactly you did in
> that respect.
>
> Other than that it at least works for me on my Beaver and Jetson TK1 so
> you may add the following to the whole series:
>
> Tested-by: Marcel Ziswiler 
> Tested-on: Beaver, Jetson-TK1

Thanks.

I cannot test Jetson-TK1 yet but I think these changes are needed to
make USB work, and possibly PCI:

>> - Add new patch to add ofnode_read_resource()
>> - Update to use ofnode_read_resource()

(see the appropriate patches with these changes mentioned in the change log)

Basically the code for setting up the USB PHY did not work and that
stopped PCI from working, I believe.

The changes applicable to TX1 are:

>> - Add new patch to fix up ofnode_get_addr_index() for 64-bit values

(this fixed I2C reading the register address)

[..]

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


[U-Boot] [PATCH 2/2] km/ivm: allow to set locally administred MAC addresses

2017-07-13 Thread Holger Brunck
It is possible to flag MAC addresses as locally administred. In this
case they don't need to be unique. This is only allowed for interfaces
which have no connection to the outside. For the TEGR1 board we use
this feature.

Cc: Heiko Schocher 
Signed-off-by: Holger Brunck 
---
 board/keymile/common/ivm.c | 24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 3495fafffe..e9e518cf72 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -189,7 +189,7 @@ static int ivm_check_crc(unsigned char *buf, int block)
 
 /* take care of the possible MAC address offset and the IVM content offset */
 static int process_mac(unsigned char *valbuf, unsigned char *buf,
-   int offset)
+   int offset, bool unique)
 {
unsigned char mac[6];
unsigned long val = (buf[4] << 16) + (buf[5] << 8) + buf[6];
@@ -199,6 +199,13 @@ static int process_mac(unsigned char *valbuf, unsigned 
char *buf,
 */
memcpy(mac, buf+1, 6);
 
+   /* MAC adress can be set to locally administred, this is only allowed
+* for interfaces which have now connection to the outside. For these
+* addresses we need to set the second bit in the first byte.
+*/
+   if (!unique)
+   mac[0] |= 0x2;
+
if (offset) {
val += offset;
mac[3] = (val >> 16) & 0xff;
@@ -300,12 +307,23 @@ static int ivm_populate_env(unsigned char *buf, int len)
return 0;
page2 = [CONFIG_SYS_IVM_EEPROM_PAGE_LEN*2];
 
+#ifndef CONFIG_KMTEGR1
/* if an offset is defined, add it */
-   process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET);
+   process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
setenv((char *)"ethaddr", (char *)valbuf);
 #ifdef CONFIG_KMVECT1
 /* KMVECT1 has two ethernet interfaces */
-   process_mac(valbuf, page2, 1);
+   process_mac(valbuf, page2, 1, true);
+   setenv((char *)"eth1addr", (char *)valbuf);
+#endif
+#else
+/* KMTEGR1 has a special setup. eth0 has no connection to the outside and
+ * gets an locally administred MAC address, eth1 is the debug interface and
+ * gets the official MAC address from the IVM
+ */
+   process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, false);
+   setenv((char *)"ethaddr", (char *)valbuf);
+   process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
setenv((char *)"eth1addr", (char *)valbuf);
 #endif
 
-- 
2.12.0.rc1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/2] km/ivm: always set ethaddr after reading IVM

2017-07-13 Thread Holger Brunck
If we rebrand the IVM and ethaddr was set previously we need to change
ethaddr. Otherwise we end up with a wrong MAC adress for the ethernet
interface.

Cc: Heiko Schocher 
Signed-off-by: Holger Brunck 
---
 board/keymile/common/ivm.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 42db54221b..3495fafffe 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -302,14 +302,11 @@ static int ivm_populate_env(unsigned char *buf, int len)
 
/* if an offset is defined, add it */
process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET);
-   if (getenv("ethaddr") == NULL)
-   setenv((char *)"ethaddr", (char *)valbuf);
+   setenv((char *)"ethaddr", (char *)valbuf);
 #ifdef CONFIG_KMVECT1
 /* KMVECT1 has two ethernet interfaces */
-   if (getenv("eth1addr") == NULL) {
-   process_mac(valbuf, page2, 1);
-   setenv((char *)"eth1addr", (char *)valbuf);
-   }
+   process_mac(valbuf, page2, 1);
+   setenv((char *)"eth1addr", (char *)valbuf);
 #endif
 
return 0;
-- 
2.12.0.rc1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 18/20] dm: power: Convert as3722 to driver model

2017-07-13 Thread Marcel Ziswiler
On Tue, 2017-07-11 at 21:30 -0600, Simon Glass wrote:
> Convert this PMIC driver to driver model and fix up other users. The
> regulator and GPIO functions are now handled by separate drivers.
> 
> Update nyan-big to work correct. Three boards will need to be updated
> by
> the maintainers: apalis-tk1, jetson-tk1, cei-tk1-som
> 
> Signed-off-by: Simon Glass 
> Reviewed-by: Lukasz Majewski 
> ---
> 
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  arch/arm/mach-tegra/board2.c  |   6 -
>  board/cei/cei-tk1-som/cei-tk1-som.c   |   2 +
>  board/nvidia/jetson-tk1/jetson-tk1.c  |   2 +
>  board/nvidia/nyan-big/nyan-big.c  |  22 +--
>  board/toradex/apalis-tk1/apalis-tk1.c |   6 +
>  configs/apalis-tk1_defconfig  |   3 +
>  configs/cei-tk1-som_defconfig |   3 +
>  configs/jetson-tk1_defconfig  |   3 +
>  configs/nyan-big_defconfig|   1 +
>  drivers/power/pmic/Makefile   |   2 +-
>  drivers/power/pmic/as3722.c   | 292 --
> 
>  include/power/as3722.h|  18 +--
>  12 files changed, 133 insertions(+), 227 deletions(-)
> 
> diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-
> tegra/board2.c
> index 181dc30a6b..bd137969f0 100644
> --- a/arch/arm/mach-tegra/board2.c
> +++ b/arch/arm/mach-tegra/board2.c
> @@ -29,7 +29,6 @@
>  #ifdef CONFIG_TEGRA_CLOCK_SCALING
>  #include 
>  #endif
> -#include 
>  #include "emc.h"
>  
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -142,11 +141,6 @@ int board_init(void)
>   debug("Memory controller init failed: %d\n", err);
>  #  endif
>  # endif /* CONFIG_TEGRA_PMU */
> -#ifdef CONFIG_PMIC_AS3722
> - err = as3722_init(NULL);
> - if (err && err != -ENODEV)
> - return err;
> -#endif
>  #endif /* CONFIG_SYS_I2C_TEGRA */
>  
>  #ifdef CONFIG_USB_EHCI_TEGRA
> diff --git a/board/cei/cei-tk1-som/cei-tk1-som.c b/board/cei/cei-tk1-
> som/cei-tk1-som.c
> index 9ba7490c38..7c87bd1eb1 100644
> --- a/board/cei/cei-tk1-som/cei-tk1-som.c
> +++ b/board/cei/cei-tk1-som/cei-tk1-som.c
> @@ -39,6 +39,7 @@ void pinmux_init(void)
>  #ifdef CONFIG_PCI_TEGRA
>  int tegra_pcie_board_init(void)
>  {
> +/* TODO: Convert to driver model
>   struct udevice *pmic;
>   int err;
>  
> @@ -59,6 +60,7 @@ int tegra_pcie_board_init(void)
>   error("failed to set SD4 voltage: %d\n", err);
>   return err;
>   }
> +*/
>  
>   return 0;
>  }
> diff --git a/board/nvidia/jetson-tk1/jetson-tk1.c
> b/board/nvidia/jetson-tk1/jetson-tk1.c
> index a66b710cdd..48272d086c 100644
> --- a/board/nvidia/jetson-tk1/jetson-tk1.c
> +++ b/board/nvidia/jetson-tk1/jetson-tk1.c
> @@ -39,6 +39,7 @@ void pinmux_init(void)
>  #ifdef CONFIG_PCI_TEGRA
>  int tegra_pcie_board_init(void)
>  {
> +/* TODO: Convert to driver model

Is that still applicable or how was that one solved at the end?

>   struct udevice *pmic;
>   int err;
>  
> @@ -59,6 +60,7 @@ int tegra_pcie_board_init(void)
>   error("failed to set SD4 voltage: %d\n", err);
>   return err;
>   }
> +*/
>  
>   return 0;
>  }
> diff --git a/board/nvidia/nyan-big/nyan-big.c b/board/nvidia/nyan-
> big/nyan-big.c
> index 8f68ae9fbe..54acf5418d 100644
> --- a/board/nvidia/nyan-big/nyan-big.c
> +++ b/board/nvidia/nyan-big/nyan-big.c
> @@ -6,6 +6,7 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -46,20 +47,23 @@ int tegra_board_id(void)
>  
>  int tegra_lcd_pmic_init(int board_id)
>  {
> - struct udevice *pmic;
> + struct udevice *dev;
>   int ret;
>  
> - ret = as3722_get();
> - if (ret)
> - return -ENOENT;
> + ret = uclass_get_device_by_driver(UCLASS_PMIC,
> +   DM_GET_DRIVER(pmic_as3722)
> , );
> + if (ret) {
> + debug("%s: Failed to find PMIC\n", __func__);
> + return ret;
> + }
>  
>   if (board_id == 0)
> - as3722_write(pmic, 0x00, 0x3c);
> + pmic_reg_write(dev, 0x00, 0x3c);
>   else
> - as3722_write(pmic, 0x00, 0x50);
> - as3722_write(pmic, 0x12, 0x10);
> - as3722_write(pmic, 0x0c, 0x07);
> - as3722_write(pmic, 0x20, 0x10);
> + pmic_reg_write(dev, 0x00, 0x50);
> + pmic_reg_write(dev, 0x12, 0x10);
> + pmic_reg_write(dev, 0x0c, 0x07);
> + pmic_reg_write(dev, 0x20, 0x10);
>  
>   return 0;
>  }
> diff --git a/board/toradex/apalis-tk1/apalis-tk1.c
> b/board/toradex/apalis-tk1/apalis-tk1.c
> index c7e519c19b..5de61e7c2b 100644
> --- a/board/toradex/apalis-tk1/apalis-tk1.c
> +++ b/board/toradex/apalis-tk1/apalis-tk1.c
> @@ -61,6 +61,7 @@ void pinmux_init(void)
>  #ifdef CONFIG_PCI_TEGRA
>  int tegra_pcie_board_init(void)
>  {
> + /* TODO: Convert to driver model
>   struct udevice *pmic;
>   int err;
>  
> @@ -94,6 +95,7 @@ int tegra_pcie_board_init(void)
>   error("failed to set 

Re: [U-Boot] [PATCH v4 00/20] dm: tegra: Move nyan-big, jetson-tk1, beaver to livetree

2017-07-13 Thread Marcel Ziswiler
On Tue, 2017-07-11 at 21:29 -0600, Simon Glass wrote:
> This moves four entire boards to use a live device tree as an example
> of
> the impact.
> 
> Nyan-big was chosen because I can easily and boot U-Boot without any
> media swapping, etc. Beaver is enabled as well since it failed to
> boot
> with serial v1 due to a disabled console node. Jetson-TK1 is chosen
> because I found some USB problems in the v2 patches. Jetson-TX1 is
> added
> because Stephen Warren found some problems with PCI.
> 
> Total code size impact on this board is approximately 9KB on U-Boot
> and
> 64 bytes on SPL:
> 
> 27: dm: tegra: nyan-big: Move to livetree
>    arm: (for 1/1 boards) all +9264.0 bss -16.0 data +44.0 rodata
> +92.0
>   spl/u-boot-spl:all +326.0 spl/u-boot-spl:rodata +262.0
>   spl/u-boot-spl:text +64.0 text +9144.0
> 
> Tegra does not use Thumb2, which would likely reduce the code size by
> about
> 25%, indicating a code-size impact of perhaps 7KB.
> 
> Boot time is affected slightly. For nyan-big the times with flat tree
> are:
> 
>  2,108  dm_r
>  7,924  dm_spl
>    120,724  dm_f
>    171,816  lcd
> 
> With the livetree:
> 
>    721  dm_r
>  3,764  of_live
>  7,990  dm_spl
>    120,736  dm_f
>    168,215  lcd
> 
> As expected the spl and pre-relocation times are not affected. In the
> post-relocation case, the live tree must be built, which here takes
> about
> 3.8ms. Driver-model device creation takes a bit of 1ms less time with
> the
> livetree, so all up the cost is about 2.4ms. After DM init there
> appears
> to be a slight reduction in the time taken to set up devices (from
> 327ms
> to 319ms) so overall the live tree does not appear to be any slower.
> This
> is because pre-parsing the device tree makes reading it later faster.
> 
> The use of livetree is controlled by a the CONFIG_OF_LIVE option.
> When
> enabled, U-Boot builds a livetree immediately after relocation and
> uses
> it from then on.
> 
> This series is available at u-boot-dm/livet-working
> 
> Changes in v4:
> - Add new patch to add ofnode_read_resource()
> - Add new patch to fix up ofnode_get_addr_index() for 64-bit values
> - Update to use ofnode_read_resource()
> - Drop fdtdec.h header
> - Update to deal with rename of ofnode_read_prop()
> - Rebase to master
> - Drop changes already applied
> - Fix PCI and i2c init problems on jetson-tx1

Could you elaborate a little bit more on this as from the actual patch
set I don't seem to be able to figure out how/what exactly you did in
that respect.

Other than that it at least works for me on my Beaver and Jetson TK1 so
you may add the following to the whole series:

Tested-by: Marcel Ziswiler 
Tested-on: Beaver, Jetson-TK1

> Changes in v3:
> - Update commit message, enable for all tegra124 boards not just
> nyan-big
> - Add new patch to convert tegra PCI to device tree
> - Enable livetree for jetson-tk1 also
> 
> Changes in v2:
> - Enable livetree for beaver also
> - Add timing information
> 
> Simon Glass (20):
>   dm: core: Add ofnode_read_resource()
>   dm: core: Fix up ofnode_get_addr_index() for 64-bit values
>   tegra: spl: Enable debug UART
>   tegra: tegra124: Add a PMC syscon driver
>   dm: tegra: Convert USB setup to livetree
>   dm: tegra: Convert clock_decode_periph_id() to support livetree
>   dm: video: tegra124: Convert to livetree
>   tegra: dts: Move stdout-path to /chosen
>   dm: tegra: gpio: Convert to support livetree
>   dm: tegra: usb: Convert to livetree
>   dm: tegra: spi: Convert to livetree
>   dm: tegra: i2c: Convert to livetree
>   dm: tegra: pwm: Convert to livetree
>   dm: tegra: mmc: Convert to livetree
>   dm: tegra: pci: Convert to livetree
>   power: Add a regulator driver for the as3722 PMIC
>   power: Add a GPIO driver for the as3722 PMIC
>   dm: power: Convert as3722 to driver model
>   fdtdec: Drop old compatible values
>   dm: tegra: Move nyan-big, jetson-tk1/tx1, beaver to livetree
> 
>  arch/arm/dts/tegra124-nyan-big.dts|   5 +-
>  arch/arm/include/asm/arch-tegra/clock.h   |   2 +-
>  arch/arm/include/asm/arch-tegra/tegra.h   |   5 +
>  arch/arm/include/asm/arch-tegra/xusb-padctl.h |   2 +-
>  arch/arm/mach-tegra/Kconfig   |   2 +
>  arch/arm/mach-tegra/board2.c  |   8 +-
>  arch/arm/mach-tegra/clock.c   |   5 +-
>  arch/arm/mach-tegra/spl.c |   4 +
>  arch/arm/mach-tegra/tegra124/Makefile |   1 +
>  arch/arm/mach-tegra/tegra124/pmc.c|  19 ++
>  arch/arm/mach-tegra/tegra124/xusb-padctl.c|  36 +++-
>  arch/arm/mach-tegra/tegra210/xusb-padctl.c|  42 +++-
>  arch/arm/mach-tegra/xusb-padctl-common.c  |  60 +++---
>  arch/arm/mach-tegra/xusb-padctl-common.h  |   8 +-
>  arch/arm/mach-tegra/xusb-padctl-dummy.c   |   2 +-
>  board/cei/cei-tk1-som/cei-tk1-som.c   

Re: [U-Boot] [PATCH v11 3/6] kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig

2017-07-13 Thread Chee, Tien Fong
On Kha, 2017-07-13 at 08:31 +0200, Marek Vasut wrote:
> On 07/13/2017 03:46 AM, Chee, Tien Fong wrote:
> > 
> > On Rab, 2017-07-12 at 12:56 +0200, Marek Vasut wrote:
> > > 
> > > On 07/03/2017 11:07 AM, tien.fong.c...@intel.com wrote:
> > > > 
> > > > 
> > > > From: Tien Fong Chee 
> > > > 
> > > > This converts the following to Kconfig:
> > > >    CONFIG_FPGA
> > > >    CONFIG_FPGA_ALTERA
> > > > 
> > > > Signed-off-by: Tien Fong Chee 
> > > > Reviewed-by: Ley Foon Tan 
> > > > Reviewed-by: Dinh Nguyen 
> > > Did you run make savedefconfig on all these boards or did you
> > > just
> > > put
> > > the CONFIG_FPGA_ALTERA=y into their defconfigs ?
> > > 
> > I'm not only run make defconfig. I also running compilation on all
> > effeted defconfigs.
> That doesn't answer my question. Did you do something like
> make savedefconfig
> cp defconfig configs/foo_defconfig
> ?
> 
Sorry for confusing, i don't know make savedefconfig is for creating
new defconfig based on .config until i googled it. CONFIG_FPGA_ALTERA=y
was put into their defconfigs after running moveconfig script.
> > 
> > > 
> > > > 
> > > > 
> > > > ---
> > > >  configs/astro_mcf5373l_defconfig| 1 +
> > > >  configs/theadorable_debug_defconfig | 1 +
> > > >  configs/theadorable_defconfig   | 1 +
> > > >  include/configs/astro_mcf5373l.h| 2 --
> > > >  include/configs/theadorable.h   | 2 --
> > > >  5 files changed, 3 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/configs/astro_mcf5373l_defconfig
> > > > b/configs/astro_mcf5373l_defconfig
> > > > index d5e8430..80fb1fa 100644
> > > > --- a/configs/astro_mcf5373l_defconfig
> > > > +++ b/configs/astro_mcf5373l_defconfig
> > > > @@ -10,4 +10,5 @@ CONFIG_CMD_I2C=y
> > > >  # CONFIG_CMD_NFS is not set
> > > >  CONFIG_CMD_CACHE=y
> > > >  CONFIG_CMD_DATE=y
> > > > +CONFIG_FPGA_ALTERA=y
> > > >  CONFIG_MTD_NOR_FLASH=y
> > > > diff --git a/configs/theadorable_debug_defconfig
> > > > b/configs/theadorable_debug_defconfig
> > > > index 2164237..e07b7b6 100644
> > > > --- a/configs/theadorable_debug_defconfig
> > > > +++ b/configs/theadorable_debug_defconfig
> > > > @@ -43,6 +43,7 @@ CONFIG_EFI_PARTITION=y
> > > >  # CONFIG_SPL_PARTITION_UUIDS is not set
> > > >  CONFIG_NET_RANDOM_ETHADDR=y
> > > >  CONFIG_SPL_OF_TRANSLATE=y
> > > > +CONFIG_FPGA_ALTERA=y
> > > >  CONFIG_DM_GPIO=y
> > > >  # CONFIG_MMC is not set
> > > >  CONFIG_SPI_FLASH=y
> > > > diff --git a/configs/theadorable_defconfig
> > > > b/configs/theadorable_defconfig
> > > > index d5eef70..3d2977c 100644
> > > > --- a/configs/theadorable_defconfig
> > > > +++ b/configs/theadorable_defconfig
> > > > @@ -37,6 +37,7 @@ CONFIG_EFI_PARTITION=y
> > > >  # CONFIG_PARTITION_UUIDS is not set
> > > >  # CONFIG_SPL_PARTITION_UUIDS is not set
> > > >  CONFIG_SPL_OF_TRANSLATE=y
> > > > +CONFIG_FPGA_ALTERA=y
> > > >  CONFIG_DM_GPIO=y
> > > >  # CONFIG_MMC is not set
> > > >  CONFIG_SPI_FLASH=y
> > > > diff --git a/include/configs/astro_mcf5373l.h
> > > > b/include/configs/astro_mcf5373l.h
> > > > index 8899579..f4acea1 100644
> > > > --- a/include/configs/astro_mcf5373l.h
> > > > +++ b/include/configs/astro_mcf5373l.h
> > > > @@ -201,10 +201,8 @@
> > > >  #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE
> > > >  
> > > >  #define CONFIG_FPGA_COUNT  1
> > > > -#define CONFIG_FPGA
> > > >  #defineCONFIG_FPGA_XILINX
> > > >  #defineCONFIG_FPGA_SPARTAN3
> > > > -#define CONFIG_FPGA_ALTERA
> > > >  #define CONFIG_FPGA_CYCLON2
> > > >  #define CONFIG_SYS_FPGA_PROG_FEEDBACK
> > > >  #define CONFIG_SYS_FPGA_WAIT   1000
> > > > diff --git a/include/configs/theadorable.h
> > > > b/include/configs/theadorable.h
> > > > index 2a671e8..5459f4f 100644
> > > > --- a/include/configs/theadorable.h
> > > > +++ b/include/configs/theadorable.h
> > > > @@ -89,8 +89,6 @@
> > > >  #define CONFIG_SYS_MEM_TOP_HIDE0x8
> > > >  
> > > >  /* FPGA programming support */
> > > > -#define CONFIG_FPGA
> > > > -#define CONFIG_FPGA_ALTERA
> > > >  #define CONFIG_FPGA_STRATIX_V
> > > >  
> > > >  /*
> > > > 
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] [rfc] support booting arm64 android image

2017-07-13 Thread Bin Chen
Hi Tom,

Thanks for the review.

On 13 July 2017 at 04:25, Tom Rini  wrote:

> On Tue, Jul 11, 2017 at 03:56:04PM +1000, Bin Chen wrote:
>
> > It's my understanding that we are supposed to use booti, instead of
> bootm,
> > for arm64 image. But booti lacks of android image support. Bootm has
> > the andriod image support but lack of the arm64 image handling.
> >
> > So, what is suppose the right way of booting an android arm64 image?
> > or, should we create a separate command?
> >
> > This patch is an invitation for that discussion.
> >
> > It *hacked* the booti command and it aslo assume the dtb is in the
> second area
> > of android boot image. It also has other belives like u-boot should be
> > in control of where to put the kernnel/ramdisk/dtb images so it ignores
> > the value specified in the android images.
> >
> > Signed-off-by: Bin Chen 
>
> So, booti is very much for the "Image" format described in the Linux
> kernel in Documentation/arm64/booting.txt.  One can (and people have)
> used bootm on aarch64 for "uImage" style kernels and FIT kernels, and I
> would see being able to boot an aarch64 Android image with bootm as the
> way to go forward.


Are you suggesting that we should use bootm path, instead of booti?

I have two questions regarding this:

1. currently arm64 kernel don't have a uImage kernel target. And I'm not
sure
 if adding that will be something that is wanted and/or sensible.

2. bootm path doesn't have the logic that is currently in the booti, such
as the
kernel relocation.

Also, one other question raised during internal discussion was why the
booti
was created in the first place, if we could have had that implemented in
the
bootm path.



> The analogy would be that we use bootm for Android
> on arm not bootz.  Thanks!
>
> --
> Tom
>



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


Re: [U-Boot] rockchip: dts: rk3229: add dwc2 node for fastboot

2017-07-13 Thread Philipp Tomsich
> Add dwc2 node for fastboot to init dwc2 controller.
> 
> Signed-off-by: Meng Dongyang 
> ---
>  arch/arm/dts/rk3229-evb.dts |  4 
>  arch/arm/dts/rk322x.dtsi| 10 ++
>  2 files changed, 14 insertions(+)
> 

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


Re: [U-Boot] [PATCH 0/5] mmc: omap_hsmmc: Add support for ADMA

2017-07-13 Thread Jean-Jacques Hiblot



On 12/07/2017 19:30, Tom Rini wrote:

On Tue, Jul 11, 2017 at 06:20:09PM +0200, Jean-Jacques Hiblot wrote:


This series enables the ADMA present in some OMAP SOCs.
On a DRA7 the performances when reading from the eMMC go from 20MB/s
to 40MB/s.
Also while were at it, fix some incorrect bit operations

This is the first series of 3 which wille enable HS200 and UHS on the omap5
platforms (dra7 and am57).
This series applies on u-boot-mmc/hs200-ufs-testing although it could be
modified to apply on u-boot/master.

What hardware have you runtime tested this on?  If you haven't done
omap3, I can do some run-time testing there.  Thanks!

I haven't been able to test on omap3.
I did BBB, am437x SK, AM57X evm and DRA7 evm.

JJ




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


Re: [U-Boot] [PATCH v3 14/18] configs: Remove CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS in all boards

2017-07-13 Thread Bin Meng
On Wed, Jul 12, 2017 at 9:27 AM, Bin Meng  wrote:
> Now that EHCD does not use CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS,
> remove it in all boards' config files.
>
> Signed-off-by: Bin Meng 
> Reviewed-by: Simon Glass 
> Reviewed-by: Stefan Roese 
> Tested-by: Stefan Roese 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  arch/arm/include/asm/ehci-omap.h| 4 
>  include/configs/MPC8572DS.h | 1 -
>  include/configs/cm_t54.h| 1 -
>  include/configs/corvus.h| 3 ---
>  include/configs/duovero.h   | 2 --
>  include/configs/exynos5-common.h| 2 --
>  include/configs/ma5d4evk.h  | 1 -
>  include/configs/mcx.h   | 1 -
>  include/configs/mvebu_armada-37xx.h | 7 +--
>  include/configs/mvebu_armada-8k.h   | 7 +--
>  include/configs/mx35pdk.h   | 1 -
>  include/configs/odroid.h| 1 -
>  include/configs/omap3_beagle.h  | 1 -
>  include/configs/omap3_overo.h   | 1 -
>  include/configs/omap4_panda.h   | 2 --
>  include/configs/omap5_uevm.h| 1 -
>  include/configs/picosam9g45.h   | 3 ---
>  include/configs/sama5d2_ptc.h   | 4 
>  include/configs/snapper9g45.h   | 3 ---
>  include/configs/sunxi-common.h  | 1 -
>  include/configs/tam3517-common.h| 1 -
>  include/configs/tao3530.h   | 1 -
>  include/configs/tegra114-common.h   | 1 -
>  include/configs/tegra124-common.h   | 1 -
>  include/configs/tegra20-common.h| 1 -
>  include/configs/tegra210-common.h   | 1 -
>  include/configs/tegra30-common.h| 1 -
>  include/configs/vinco.h | 6 --
>  include/configs/x86-common.h| 1 -
>  scripts/config_whitelist.txt| 1 -
>  30 files changed, 2 insertions(+), 60 deletions(-)
>

Ah, this misses poplar board which was brought in before v2017.07 release.

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


Re: [U-Boot] [PATCH v11 3/6] kconfig: Convert FPGA and FPGA_ALTERA configuration to Kconfig

2017-07-13 Thread Marek Vasut
On 07/13/2017 03:46 AM, Chee, Tien Fong wrote:
> On Rab, 2017-07-12 at 12:56 +0200, Marek Vasut wrote:
>> On 07/03/2017 11:07 AM, tien.fong.c...@intel.com wrote:
>>>
>>> From: Tien Fong Chee 
>>>
>>> This converts the following to Kconfig:
>>>CONFIG_FPGA
>>>CONFIG_FPGA_ALTERA
>>>
>>> Signed-off-by: Tien Fong Chee 
>>> Reviewed-by: Ley Foon Tan 
>>> Reviewed-by: Dinh Nguyen 
>> Did you run make savedefconfig on all these boards or did you just
>> put
>> the CONFIG_FPGA_ALTERA=y into their defconfigs ?
>>
> I'm not only run make defconfig. I also running compilation on all
> effeted defconfigs.

That doesn't answer my question. Did you do something like
make savedefconfig
cp defconfig configs/foo_defconfig
?

>>>
>>> ---
>>>  configs/astro_mcf5373l_defconfig| 1 +
>>>  configs/theadorable_debug_defconfig | 1 +
>>>  configs/theadorable_defconfig   | 1 +
>>>  include/configs/astro_mcf5373l.h| 2 --
>>>  include/configs/theadorable.h   | 2 --
>>>  5 files changed, 3 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/configs/astro_mcf5373l_defconfig
>>> b/configs/astro_mcf5373l_defconfig
>>> index d5e8430..80fb1fa 100644
>>> --- a/configs/astro_mcf5373l_defconfig
>>> +++ b/configs/astro_mcf5373l_defconfig
>>> @@ -10,4 +10,5 @@ CONFIG_CMD_I2C=y
>>>  # CONFIG_CMD_NFS is not set
>>>  CONFIG_CMD_CACHE=y
>>>  CONFIG_CMD_DATE=y
>>> +CONFIG_FPGA_ALTERA=y
>>>  CONFIG_MTD_NOR_FLASH=y
>>> diff --git a/configs/theadorable_debug_defconfig
>>> b/configs/theadorable_debug_defconfig
>>> index 2164237..e07b7b6 100644
>>> --- a/configs/theadorable_debug_defconfig
>>> +++ b/configs/theadorable_debug_defconfig
>>> @@ -43,6 +43,7 @@ CONFIG_EFI_PARTITION=y
>>>  # CONFIG_SPL_PARTITION_UUIDS is not set
>>>  CONFIG_NET_RANDOM_ETHADDR=y
>>>  CONFIG_SPL_OF_TRANSLATE=y
>>> +CONFIG_FPGA_ALTERA=y
>>>  CONFIG_DM_GPIO=y
>>>  # CONFIG_MMC is not set
>>>  CONFIG_SPI_FLASH=y
>>> diff --git a/configs/theadorable_defconfig
>>> b/configs/theadorable_defconfig
>>> index d5eef70..3d2977c 100644
>>> --- a/configs/theadorable_defconfig
>>> +++ b/configs/theadorable_defconfig
>>> @@ -37,6 +37,7 @@ CONFIG_EFI_PARTITION=y
>>>  # CONFIG_PARTITION_UUIDS is not set
>>>  # CONFIG_SPL_PARTITION_UUIDS is not set
>>>  CONFIG_SPL_OF_TRANSLATE=y
>>> +CONFIG_FPGA_ALTERA=y
>>>  CONFIG_DM_GPIO=y
>>>  # CONFIG_MMC is not set
>>>  CONFIG_SPI_FLASH=y
>>> diff --git a/include/configs/astro_mcf5373l.h
>>> b/include/configs/astro_mcf5373l.h
>>> index 8899579..f4acea1 100644
>>> --- a/include/configs/astro_mcf5373l.h
>>> +++ b/include/configs/astro_mcf5373l.h
>>> @@ -201,10 +201,8 @@
>>>  #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE
>>>  
>>>  #define CONFIG_FPGA_COUNT  1
>>> -#define CONFIG_FPGA
>>>  #defineCONFIG_FPGA_XILINX
>>>  #defineCONFIG_FPGA_SPARTAN3
>>> -#define CONFIG_FPGA_ALTERA
>>>  #define CONFIG_FPGA_CYCLON2
>>>  #define CONFIG_SYS_FPGA_PROG_FEEDBACK
>>>  #define CONFIG_SYS_FPGA_WAIT   1000
>>> diff --git a/include/configs/theadorable.h
>>> b/include/configs/theadorable.h
>>> index 2a671e8..5459f4f 100644
>>> --- a/include/configs/theadorable.h
>>> +++ b/include/configs/theadorable.h
>>> @@ -89,8 +89,6 @@
>>>  #define CONFIG_SYS_MEM_TOP_HIDE0x8
>>>  
>>>  /* FPGA programming support */
>>> -#define CONFIG_FPGA
>>> -#define CONFIG_FPGA_ALTERA
>>>  #define CONFIG_FPGA_STRATIX_V
>>>  
>>>  /*
>>>


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


Re: [U-Boot] Ethernet not functional on i.MX6DL Sabre Auto

2017-07-13 Thread Miquel RAYNAL
Hi Fabio,

On Wed, 12 Jul 2017 17:17:28 -0300
Fabio Estevam  wrote:

> On Wed, Jul 12, 2017 at 4:52 PM, Fabio Estevam 
> wrote:
> 
> > I don't have my mx6sabreauto handy to investigate this problem.
> >
> > Does the change below make Ethernet to work again?
> > https://pastebin.com/VnEdBCa6  
> 
> And here is a patch against u-boot-imx tree (
> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=summary)
> 
> No need to change anything in defconfig. Only do:
> 
> make mx6sabreauto_defconfig
> make
> 
> and Ethernet should work with the patch applied.
> 
> Please let me know how your test goes.

Thank you for the very quick answer, I was not able to test the patch
yesterday but now I can confirm it works and Ethernet is functional
again on mx6sabreauto design.

The patch you sent does only apply on imx tree though (the path
contains mx6sabreauto instead of mx6qsabreauto).

Best regards,
Miquèl


-- 
Miquel Raynal, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot