[U-Boot] [PATCH] ddr: altera: silence PHY calibration unless in debug mode

2018-01-10 Thread Goldschmidt Simon
This driver has been using printf() including filename since it was
added. Convert to using debug() instead.

Signed-off-by: Simon Goldschmidt 
---

 drivers/ddr/altera/sequencer.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ddr/altera/sequencer.c b/drivers/ddr/altera/sequencer.c
index 6c6bd90e94..42e87b50d3 100644
--- a/drivers/ddr/altera/sequencer.c
+++ b/drivers/ddr/altera/sequencer.c
@@ -3534,7 +3534,7 @@ static void debug_mem_calibrate(int pass)
u32 debug_info;
 
if (pass) {
-   printf("%s: CALIBRATION PASSED\n", __FILE__);
+   debug("%s: CALIBRATION PASSED\n", __FILE__);
 
gbl->fom_in /= 2;
gbl->fom_out /= 2;
@@ -3553,7 +3553,7 @@ static void debug_mem_calibrate(int pass)
writel(debug_info, _mgr_cfg->cal_debug_info);
writel(PHY_MGR_CAL_SUCCESS, _mgr_cfg->cal_status);
} else {
-   printf("%s: CALIBRATION FAILED\n", __FILE__);
+   debug("%s: CALIBRATION FAILED\n", __FILE__);
 
debug_info = gbl->error_stage;
debug_info |= gbl->error_substage << 8;
@@ -3570,7 +3570,7 @@ static void debug_mem_calibrate(int pass)
writel(debug_info, _reg_file->failing_stage);
}
 
-   printf("%s: Calibration complete\n", __FILE__);
+   debug("%s: Calibration complete\n", __FILE__);
 }
 
 /**
@@ -3741,7 +3741,7 @@ int sdram_calibration_full(void)
 
initialize_tracking();
 
-   printf("%s: Preparing to start memory calibration\n", __FILE__);
+   debug("%s: Preparing to start memory calibration\n", __FILE__);
 
debug("%s:%d\n", __func__, __LINE__);
debug_cond(DLEVEL >= 1,
-- 
2.11.0

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


[U-Boot] [PATCH v3 15/16] efi_selftest: test for (Dis)ConnectController

2018-01-10 Thread Heinrich Schuchardt
This unit test checks the following protocol services:
ConnectController, DisconnectController,
InstallProtocol, UninstallProtocol,
OpenProtocol, CloseProtcol, OpenProtocolInformation

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
define binding_interface as static struct
---
 lib/efi_selftest/Makefile   |   1 +
 lib/efi_selftest/efi_selftest_controllers.c | 385 
 2 files changed, 386 insertions(+)
 create mode 100644 lib/efi_selftest/efi_selftest_controllers.c

diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index 837e86228e..e549553c82 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -9,6 +9,7 @@
 
 obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \
 efi_selftest.o \
+efi_selftest_controllers.o \
 efi_selftest_console.o \
 efi_selftest_devicepath.o \
 efi_selftest_events.o \
diff --git a/lib/efi_selftest/efi_selftest_controllers.c 
b/lib/efi_selftest/efi_selftest_controllers.c
new file mode 100644
index 00..1a22aba6f4
--- /dev/null
+++ b/lib/efi_selftest/efi_selftest_controllers.c
@@ -0,0 +1,385 @@
+/*
+ * efi_selftest_controllers
+ *
+ * Copyright (c) 2017 Heinrich Schuchardt 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This unit test checks the following protocol services:
+ * ConnectController, DisconnectController,
+ * InstallProtocol, UninstallProtocol,
+ * OpenProtocol, CloseProtcol, OpenProtocolInformation
+ */
+
+#include 
+
+#define NUMBER_OF_CHILD_CONTROLLERS 4
+
+static struct efi_boot_services *boottime;
+const efi_guid_t guid_driver_binding_protocol =
+   EFI_DRIVER_BINDING_PROTOCOL_GUID;
+static efi_guid_t guid_controller =
+   EFI_GUID(0xe6ab1d96, 0x6bff, 0xdb42,
+0xaa, 0x05, 0xc8, 0x1f, 0x7f, 0x45, 0x26, 0x34);
+static efi_guid_t guid_child_controller =
+   EFI_GUID(0x1d41f6f5, 0x2c41, 0xddfb,
+0xe2, 0x9b, 0xb8, 0x0e, 0x2e, 0xe8, 0x3a, 0x85);
+static efi_handle_t handle_controller;
+static efi_handle_t handle_child_controller[NUMBER_OF_CHILD_CONTROLLERS];
+static efi_handle_t handle_driver;
+
+/*
+ * Count child controllers
+ *
+ * @handle handle on which child controllers are installed
+ * @protocol   protocol for which the child controlles where installed
+ * @count  number of child controllers
+ * @return status code
+ */
+static efi_status_t count_child_controllers(efi_handle_t handle,
+   efi_guid_t *protocol,
+   efi_uintn_t *count)
+{
+   efi_status_t ret;
+   efi_uintn_t entry_count;
+   struct efi_open_protocol_info_entry *entry_buffer;
+
+   *count = 0;
+   ret = boottime->open_protocol_information(handle, protocol,
+ _buffer, _count);
+   if (ret != EFI_SUCCESS)
+   return ret;
+   if (!entry_count)
+   return EFI_SUCCESS;
+   while (entry_count) {
+   if (entry_buffer[--entry_count].attributes &
+   EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER)
+   ++*count;
+   }
+   ret = boottime->free_pool(entry_buffer);
+   if (ret != EFI_SUCCESS)
+   efi_st_error("Cannot free buffer\n");
+   return ret;
+}
+
+/*
+ * Check if the driver supports the controller.
+ *
+ * @this   driver binding protocol
+ * @controller_handle  handle of the controller
+ * @remaining_device_path  path specifying the child controller
+ * @return status code
+ */
+static efi_status_t EFIAPI supported(
+   struct efi_driver_binding_protocol *this,
+   efi_handle_t controller_handle,
+   struct efi_device_path *remaining_device_path)
+{
+   efi_status_t ret;
+   void *interface;
+
+   ret = boottime->open_protocol(
+   controller_handle, _controller,
+   , handle_driver,
+   controller_handle, EFI_OPEN_PROTOCOL_BY_DRIVER);
+   switch (ret) {
+   case EFI_ACCESS_DENIED:
+   case EFI_ALREADY_STARTED:
+   return ret;
+   case EFI_SUCCESS:
+   break;
+   default:
+   return EFI_UNSUPPORTED;
+   }
+   ret = boottime->close_protocol(
+   controller_handle, _controller,
+   handle_driver, controller_handle);
+   if (ret != EFI_SUCCESS)
+   ret = EFI_UNSUPPORTED;
+   return ret;
+}
+
+/*
+ * Create child controllers and attach driver.
+ *
+ * @this   driver binding protocol
+ * @controller_handle  handle of the controller
+ * @remaining_device_path  path specifying the child controller
+ * @return status code
+ */
+static efi_status_t EFIAPI start(
+   struct efi_driver_binding_protocol 

[U-Boot] [PATCH v3 12/16] efi_loader: disconnect controllers in UninstallProtocol

2018-01-10 Thread Heinrich Schuchardt
The UninstallProtocol boot service should first try to
disconnect controllers that have been connected with
EFI_OPEN_PROTOCOL_BY_DRIVER.

If the protocol is still opened by an agent, it should be
closed.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_loader/efi_boottime.c | 29 +++--
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 7e16a3f2cf..ecf395f40b 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1077,26 +1077,43 @@ static efi_status_t EFIAPI 
efi_uninstall_protocol_interface(
void *handle, const efi_guid_t *protocol,
void *protocol_interface)
 {
+   struct efi_object *efiobj;
struct efi_handler *handler;
+   struct efi_open_protocol_info_item *item;
+   struct efi_open_protocol_info_item *pos;
efi_status_t r;
 
EFI_ENTRY("%p, %pUl, %p", handle, protocol, protocol_interface);
 
-   if (!handle || !protocol) {
+   /* Check handle */
+   efiobj = efi_search_obj(handle);
+   if (!efiobj) {
r = EFI_INVALID_PARAMETER;
goto out;
}
-
/* Find the protocol on the handle */
r = efi_search_protocol(handle, protocol, );
if (r != EFI_SUCCESS)
goto out;
-   if (handler->protocol_interface) {
-   /* TODO disconnect controllers */
+   /* Disconnect controllers */
+   efi_disconnect_all_drivers(efiobj, protocol, NULL);
+   if (!list_empty(>open_infos)) {
r =  EFI_ACCESS_DENIED;
-   } else {
-   r = efi_remove_protocol(handle, protocol, protocol_interface);
+   goto out;
+   }
+   /* Close protocol */
+   list_for_each_entry_safe(item, pos, >open_infos, link) {
+   if (item->info.attributes ==
+   EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL ||
+   item->info.attributes == EFI_OPEN_PROTOCOL_GET_PROTOCOL ||
+   item->info.attributes == EFI_OPEN_PROTOCOL_TEST_PROTOCOL)
+   list_del(>link);
+   }
+   if (!list_empty(>open_infos)) {
+   r =  EFI_ACCESS_DENIED;
+   goto out;
}
+   r = efi_remove_protocol(handle, protocol, protocol_interface);
 out:
return EFI_EXIT(r);
 }
-- 
2.14.2

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


[U-Boot] [PATCH v3 16/16] efi_loader: consistently use efi_handle_t for handles

2018-01-10 Thread Heinrich Schuchardt
We should consistently use the efi_handle_t typedef when
referring to handles.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 cmd/bootefi.c | 10 -
 include/efi_api.h | 20 ++
 include/efi_loader.h  | 14 +++--
 lib/efi_loader/efi_boottime.c | 49 +++
 lib/efi_loader/efi_console.c  |  6 +++---
 5 files changed, 53 insertions(+), 46 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 78ff109835..97a4f269ae 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -122,8 +122,8 @@ static void *copy_fdt(void *fdt)
 }
 
 static efi_status_t efi_do_enter(
-   void *image_handle, struct efi_system_table *st,
-   asmlinkage ulong (*entry)(void *image_handle,
+   efi_handle_t image_handle, struct efi_system_table *st,
+   asmlinkage ulong (*entry)(efi_handle_t image_handle,
  struct efi_system_table *st))
 {
efi_status_t ret = EFI_LOAD_ERROR;
@@ -136,8 +136,8 @@ static efi_status_t efi_do_enter(
 
 #ifdef CONFIG_ARM64
 static efi_status_t efi_run_in_el2(asmlinkage ulong (*entry)(
-   void *image_handle, struct efi_system_table *st),
-   void *image_handle, struct efi_system_table *st)
+   efi_handle_t image_handle, struct efi_system_table *st),
+   efi_handle_t image_handle, struct efi_system_table *st)
 {
/* Enable caches again */
dcache_enable();
@@ -159,7 +159,7 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt,
struct efi_device_path *memdp = NULL;
ulong ret;
 
-   ulong (*entry)(void *image_handle, struct efi_system_table *st)
+   ulong (*entry)(efi_handle_t image_handle, struct efi_system_table *st)
asmlinkage;
ulong fdt_pages, fdt_size, fdt_start, fdt_end;
const efi_guid_t fdt_guid = EFI_FDT_GUID;
diff --git a/include/efi_api.h b/include/efi_api.h
index 7164492f83..502fffed20 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -84,11 +84,12 @@ struct efi_boot_services {
efi_status_t (EFIAPI *reinstall_protocol_interface)(
void *handle, const efi_guid_t *protocol,
void *old_interface, void *new_interface);
-   efi_status_t (EFIAPI *uninstall_protocol_interface)(void *handle,
-   const efi_guid_t *protocol, void *protocol_interface);
-   efi_status_t (EFIAPI *handle_protocol)(efi_handle_t,
-  const efi_guid_t *protocol,
-  void **protocol_interface);
+   efi_status_t (EFIAPI *uninstall_protocol_interface)(
+   efi_handle_t handle, const efi_guid_t *protocol,
+   void *protocol_interface);
+   efi_status_t (EFIAPI *handle_protocol)(
+   efi_handle_t handle, const efi_guid_t *protocol,
+   void **protocol_interface);
void *reserved;
efi_status_t (EFIAPI *register_protocol_notify)(
const efi_guid_t *protocol, struct efi_event *event,
@@ -113,7 +114,7 @@ struct efi_boot_services {
efi_status_t (EFIAPI *exit)(efi_handle_t handle,
efi_status_t exit_status,
unsigned long exitdata_size, s16 *exitdata);
-   efi_status_t (EFIAPI *unload_image)(void *image_handle);
+   efi_status_t (EFIAPI *unload_image)(efi_handle_t image_handle);
efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t, unsigned long);
 
efi_status_t (EFIAPI *get_next_monotonic_count)(u64 *count);
@@ -139,9 +140,10 @@ struct efi_boot_services {
const efi_guid_t *protocol, void **interface,
efi_handle_t agent_handle,
efi_handle_t controller_handle, u32 attributes);
-   efi_status_t (EFIAPI *close_protocol)(void *handle,
-   const efi_guid_t *protocol, void *agent_handle,
-   void *controller_handle);
+   efi_status_t (EFIAPI *close_protocol)(
+   efi_handle_t handle, const efi_guid_t *protocol,
+   efi_handle_t agent_handle,
+   efi_handle_t controller_handle);
efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle,
const efi_guid_t *protocol,
struct efi_open_protocol_info_entry **entry_buffer,
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 6726c44c47..37389c33cc 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -205,23 +205,25 @@ void efi_set_bootdev(const char *dev, const char *devnr, 
const char *path);
 /* Add a new 

[U-Boot] [PATCH v3 13/16] efi_selftest: remove todo in manage protocols

2018-01-10 Thread Heinrich Schuchardt
The installation of UninstallProtocols is functional now.
So we do not expect errors when calling it.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_selftest/efi_selftest_manageprotocols.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_manageprotocols.c 
b/lib/efi_selftest/efi_selftest_manageprotocols.c
index f20f1528d4..874f86102d 100644
--- a/lib/efi_selftest/efi_selftest_manageprotocols.c
+++ b/lib/efi_selftest/efi_selftest_manageprotocols.c
@@ -194,7 +194,7 @@ static int execute(void)
, ,
NULL);
if (ret == EFI_SUCCESS) {
-   efi_st_todo("UninstallMultipleProtocolInterfaces did not catch 
error\n");
+   efi_st_error("UninstallMultipleProtocolInterfaces did not catch 
error\n");
return EFI_ST_FAILURE;
}
 
@@ -273,8 +273,8 @@ static int execute(void)
, ,
NULL);
if (ret != EFI_SUCCESS) {
-   efi_st_todo("UninstallMultipleProtocolInterfaces failed\n");
-   /* This test is known to fail due to missing implementation */
+   efi_st_error("UninstallMultipleProtocolInterfaces failed\n");
+   return EFI_ST_FAILURE;
}
/*
 * Check that the protocols are really uninstalled.
@@ -287,8 +287,8 @@ static int execute(void)
return EFI_ST_FAILURE;
}
if (count != 1) {
-   efi_st_todo("UninstallMultipleProtocolInterfaces failed to 
uninstall protocols\n");
-   /* This test is known to fail due to missing implementation */
+   efi_st_error("UninstallMultipleProtocolInterfaces failed to 
uninstall protocols\n");
+   return EFI_ST_FAILURE;
}
ret = find_in_buffer(handle1, count, buffer);
if (ret != EFI_SUCCESS) {
@@ -327,19 +327,19 @@ static int execute(void)
ret = boottime->uninstall_protocol_interface(handle1, ,
 );
if (ret != EFI_SUCCESS) {
-   efi_st_todo("UninstallProtocolInterface failed\n");
-   /* This test is known to fail due to missing implementation */
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
}
ret = boottime->handle_protocol(handle1, , (void **));
if (ret == EFI_SUCCESS) {
-   efi_st_todo("UninstallProtocolInterface failed\n");
-   /* This test is known to fail due to missing implementation */
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
}
ret = boottime->uninstall_protocol_interface(handle1, ,
 );
if (ret != EFI_SUCCESS) {
-   efi_st_todo("UninstallProtocolInterface failed\n");
-   /* This test is known to fail due to missing implementation */
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
}
 
return EFI_ST_SUCCESS;
-- 
2.14.2

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


[U-Boot] [PATCH v3 10/16] efi_loader: fix signature of efi_disconnect_controller

2018-01-10 Thread Heinrich Schuchardt
Handles should be passed as efi_handle_t and not as void *.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 include/efi_api.h | 6 --
 lib/efi_loader/efi_boottime.c | 7 ---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 81e580dbbc..7164492f83 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -125,8 +125,10 @@ struct efi_boot_services {
efi_handle_t *driver_image_handle,
struct efi_device_path *remaining_device_path,
bool recursive);
-   efi_status_t (EFIAPI *disconnect_controller)(void *controller_handle,
-   void *driver_image_handle, void *child_handle);
+   efi_status_t (EFIAPI *disconnect_controller)(
+   efi_handle_t controller_handle,
+   efi_handle_t driver_image_handle,
+   efi_handle_t child_handle);
 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x0001
 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL0x0002
 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL   0x0004
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 0687ded7f0..8f9d24f6a7 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1630,9 +1630,10 @@ static efi_status_t EFIAPI 
efi_set_watchdog_timer(unsigned long timeout,
  * @child_handle   handle of the child to destroy
  * @return status code
  */
-static efi_status_t EFIAPI efi_disconnect_controller(void *controller_handle,
-void *driver_image_handle,
-void *child_handle)
+static efi_status_t EFIAPI efi_disconnect_controller(
+   efi_handle_t controller_handle,
+   efi_handle_t driver_image_handle,
+   efi_handle_t child_handle)
 {
EFI_ENTRY("%p, %p, %p", controller_handle, driver_image_handle,
  child_handle);
-- 
2.14.2

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


[U-Boot] [PATCH v3 07/16] efi_loader: implement OpenProtocolInformation

2018-01-10 Thread Heinrich Schuchardt
efi_open_protocol_information provides the agent and controller
handles as well as the attributes and open count of an protocol
on a handle.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_loader/efi_boottime.c | 41 -
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a527e33141..44c9da0a7c 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1722,9 +1722,48 @@ static efi_status_t EFIAPI 
efi_open_protocol_information(efi_handle_t handle,
struct efi_open_protocol_info_entry **entry_buffer,
efi_uintn_t *entry_count)
 {
+   unsigned long buffer_size;
+   unsigned long count;
+   struct efi_handler *handler;
+   struct efi_open_protocol_info_item *item;
+   efi_status_t r;
+
EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, entry_buffer,
  entry_count);
-   return EFI_EXIT(EFI_NOT_FOUND);
+
+   /* Check parameters */
+   if (!entry_buffer) {
+   r = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+   r = efi_search_protocol(handle, protocol, );
+   if (r != EFI_SUCCESS)
+   goto out;
+
+   /* Count entries */
+   count = 0;
+   list_for_each_entry(item, >open_infos, link) {
+   ++count;
+   }
+   *entry_count = count;
+   *entry_buffer = NULL;
+   if (!count) {
+   r = EFI_SUCCESS;
+   goto out;
+   }
+
+   /* Copy entries */
+   buffer_size = count * sizeof(struct efi_open_protocol_info_entry);
+   r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, buffer_size,
+ (void **)entry_buffer);
+   if (r != EFI_SUCCESS)
+   goto out;
+   list_for_each_entry_reverse(item, >open_infos, link) {
+   if (item->info.open_count)
+   (*entry_buffer)[--count] = item->info;
+   }
+out:
+   return EFI_EXIT(r);
 }
 
 /*
-- 
2.14.2

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


[U-Boot] [PATCH v3 09/16] efi_loader: implement ConnectController

2018-01-10 Thread Heinrich Schuchardt
Implement the ConnectController boot service.

A unit test is supplied in a subsequent patch.

Signed-off-by: Heinrich Schuchardt 
---
v3
Add more code comments.
v2
no change
---
 include/efi_api.h |  22 +
 include/efi_loader.h  |   2 +
 lib/efi_loader/efi_boottime.c | 187 --
 3 files changed, 187 insertions(+), 24 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 46963f2891..81e580dbbc 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -805,4 +805,26 @@ struct efi_file_info {
s16 file_name[0];
 };
 
+#define EFI_DRIVER_BINDING_PROTOCOL_GUID \
+   EFI_GUID(0x18a031ab, 0xb443, 0x4d1a,\
+0xa5, 0xc0, 0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71)
+struct efi_driver_binding_protocol {
+   efi_status_t (EFIAPI * supported)(
+   struct efi_driver_binding_protocol *this,
+   efi_handle_t controller_handle,
+   struct efi_device_path *remaining_device_path);
+   efi_status_t (EFIAPI * start)(
+   struct efi_driver_binding_protocol *this,
+   efi_handle_t controller_handle,
+   struct efi_device_path *remaining_device_path);
+   efi_status_t (EFIAPI * stop)(
+   struct efi_driver_binding_protocol *this,
+   efi_handle_t controller_handle,
+   efi_uintn_t number_of_children,
+   efi_handle_t *child_handle_buffer);
+   u32 version;
+   efi_handle_t image_handle;
+   efi_handle_t driver_binding_handle;
+};
+
 #endif
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 4198329230..6726c44c47 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -89,6 +89,8 @@ uint16_t *efi_dp_str(struct efi_device_path *dp);
 extern const efi_guid_t efi_global_variable_guid;
 extern const efi_guid_t efi_guid_console_control;
 extern const efi_guid_t efi_guid_device_path;
+/* GUID of the EFI_DRIVER_BINDING_PROTOCOL */
+extern const efi_guid_t efi_guid_driver_binding_protocol;
 extern const efi_guid_t efi_guid_loaded_image;
 extern const efi_guid_t efi_guid_device_path_to_text_protocol;
 extern const efi_guid_t efi_simple_file_system_protocol_guid;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f82c0ba602..0687ded7f0 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -56,6 +56,9 @@ static volatile void *efi_gd, *app_gd;
 
 static int entry_count;
 static int nesting_level;
+/* GUID of the EFI_DRIVER_BINDING_PROTOCOL */
+const efi_guid_t efi_guid_driver_binding_protocol =
+   EFI_DRIVER_BINDING_PROTOCOL_GUID;
 
 /* Called on every callback entry */
 int __efi_entry_check(void)
@@ -1615,30 +1618,6 @@ static efi_status_t EFIAPI 
efi_set_watchdog_timer(unsigned long timeout,
return EFI_EXIT(efi_set_watchdog(timeout));
 }
 
-/*
- * Connect a controller to a driver.
- *
- * This function implements the ConnectController service.
- * See the Unified Extensible Firmware Interface (UEFI) specification
- * for details.
- *
- * @controller_handle  handle of the controller
- * @driver_image_handlehandle of the driver
- * @remain_device_path device path of a child controller
- * @recursive  true to connect all child controllers
- * @return status code
- */
-static efi_status_t EFIAPI efi_connect_controller(
-   efi_handle_t controller_handle,
-   efi_handle_t *driver_image_handle,
-   struct efi_device_path *remain_device_path,
-   bool recursive)
-{
-   EFI_ENTRY("%p, %p, %p, %d", controller_handle, driver_image_handle,
- remain_device_path, recursive);
-   return EFI_EXIT(EFI_NOT_FOUND);
-}
-
 /*
  * Disconnect a controller from a driver.
  *
@@ -2348,6 +2327,166 @@ static efi_status_t EFIAPI efi_handle_protocol(void 
*handle,
 NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
 }
 
+static efi_status_t efi_bind_controller(
+   efi_handle_t controller_handle,
+   efi_handle_t driver_image_handle,
+   struct efi_device_path *remain_device_path)
+{
+   struct efi_driver_binding_protocol *binding_protocol;
+   efi_status_t r;
+
+   r = EFI_CALL(efi_open_protocol(driver_image_handle,
+  _guid_driver_binding_protocol,
+  (void **)_protocol,
+  driver_image_handle, NULL,
+  EFI_OPEN_PROTOCOL_GET_PROTOCOL));
+   if (r != EFI_SUCCESS)
+   return r;
+   r = EFI_CALL(binding_protocol->supported(binding_protocol,
+controller_handle,
+   

[U-Boot] [PATCH v3 14/16] efi_selftest: remove todo in device path test

2018-01-10 Thread Heinrich Schuchardt
The installation of UninstallProtocol is functional now.
So we do not expect errors when calling it.

Call UninstallProtocol with correct level of indirection
for parameter handle.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_selftest/efi_selftest_devicepath.c | 40 +++---
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_devicepath.c 
b/lib/efi_selftest/efi_selftest_devicepath.c
index d9a6697892..2f8f3c7f15 100644
--- a/lib/efi_selftest/efi_selftest_devicepath.c
+++ b/lib/efi_selftest/efi_selftest_devicepath.c
@@ -192,31 +192,41 @@ static int teardown(void)
 {
efi_status_t ret;
 
-   ret = boottime->uninstall_protocol_interface(,
+   ret = boottime->uninstall_protocol_interface(handle1,
 _device_path,
 dp1);
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("UninstallProtocolInterface failed\n");
-   ret = boottime->uninstall_protocol_interface(,
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = boottime->uninstall_protocol_interface(handle1,
 _protocol,
 );
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("UninstallProtocolInterface failed\n");
-   ret = boottime->uninstall_protocol_interface(,
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = boottime->uninstall_protocol_interface(handle2,
 _device_path,
 dp2);
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("UninstallProtocolInterface failed\n");
-   ret = boottime->uninstall_protocol_interface(,
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = boottime->uninstall_protocol_interface(handle2,
 _protocol,
 );
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("UninstallProtocolInterface failed\n");
-   ret = boottime->uninstall_protocol_interface(,
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = boottime->uninstall_protocol_interface(handle3,
 _device_path,
 dp3);
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("UninstallProtocolInterface failed\n");
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("UninstallProtocolInterface failed\n");
+   return EFI_ST_FAILURE;
+   }
if (dp1) {
ret = boottime->free_pool(dp1);
if (ret != EFI_SUCCESS) {
-- 
2.14.2

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


[U-Boot] [PATCH v3 11/16] efi_loader: implement DisconnectController

2018-01-10 Thread Heinrich Schuchardt
Unfortunately we need a forward declaration because both
OpenProtocol and CloseProtocol have to call DisconnectController.
And DisconnectController calls both OpenProtcol and CloseProtocol.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
Return EFI_NOT_FOUND in disconnect_all_drivers if no
driver is disconnected.
---
 lib/efi_loader/efi_boottime.c | 284 ++
 1 file changed, 262 insertions(+), 22 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 8f9d24f6a7..7e16a3f2cf 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -60,6 +60,10 @@ static int nesting_level;
 const efi_guid_t efi_guid_driver_binding_protocol =
EFI_DRIVER_BINDING_PROTOCOL_GUID;
 
+static efi_status_t EFIAPI efi_disconnect_controller(void *controller_handle,
+void *driver_image_handle,
+void *child_handle);
+
 /* Called on every callback entry */
 int __efi_entry_check(void)
 {
@@ -954,6 +958,109 @@ static efi_status_t EFIAPI 
efi_reinstall_protocol_interface(void *handle,
return EFI_EXIT(EFI_ACCESS_DENIED);
 }
 
+/*
+ * Get all drivers associated to a controller.
+ * The allocated buffer has to be freed with free().
+ *
+ * @efiobj handle of the controller
+ * @protocol   protocol guid (optional)
+ * @number_of_drivers  number of child controllers
+ * @driver_handle_buffer   handles of the the drivers
+ * @return status code
+ */
+static efi_status_t efi_get_drivers(struct efi_object *efiobj,
+   const efi_guid_t *protocol,
+   efi_uintn_t *number_of_drivers,
+   efi_handle_t **driver_handle_buffer)
+{
+   struct efi_handler *handler;
+   struct efi_open_protocol_info_item *item;
+   efi_uintn_t count = 0, i;
+   bool duplicate;
+
+   /* Count all driver associations */
+   list_for_each_entry(handler, >protocols, link) {
+   if (protocol && guidcmp(handler->guid, protocol))
+   continue;
+   list_for_each_entry(item, >open_infos, link) {
+   if (item->info.attributes &
+   EFI_OPEN_PROTOCOL_BY_DRIVER)
+   ++count;
+   }
+   }
+   /*
+* Create buffer. In case of duplicate driver assignments the buffer
+* will be too large. But that does not harm.
+*/
+   *number_of_drivers = 0;
+   *driver_handle_buffer = calloc(count, sizeof(efi_handle_t));
+   if (!*driver_handle_buffer)
+   return EFI_OUT_OF_RESOURCES;
+   /* Collect unique driver handles */
+   list_for_each_entry(handler, >protocols, link) {
+   if (protocol && guidcmp(handler->guid, protocol))
+   continue;
+   list_for_each_entry(item, >open_infos, link) {
+   if (item->info.attributes &
+   EFI_OPEN_PROTOCOL_BY_DRIVER) {
+   /* Check this is a new driver */
+   duplicate = false;
+   for (i = 0; i < *number_of_drivers; ++i) {
+   if ((*driver_handle_buffer)[i] ==
+   item->info.agent_handle)
+   duplicate = true;
+   }
+   /* Copy handle to buffer */
+   if (!duplicate) {
+   i = (*number_of_drivers)++;
+   (*driver_handle_buffer)[i] =
+   item->info.agent_handle;
+   }
+   }
+   }
+   }
+   return EFI_SUCCESS;
+}
+
+/*
+ * Disconnect all drivers from a controller.
+ *
+ * This function implements the DisconnectController service.
+ * See the Unified Extensible Firmware Interface (UEFI) specification
+ * for details.
+ *
+ * @efiobj handle of the controller
+ * @protocol   protocol guid (optional)
+ * @child_handle   handle of the child to destroy
+ * @return status code
+ */
+static efi_status_t efi_disconnect_all_drivers(
+   struct efi_object *efiobj,
+   const efi_guid_t *protocol,
+   efi_handle_t child_handle)
+{
+   efi_uintn_t number_of_drivers;
+   efi_handle_t *driver_handle_buffer;
+   efi_status_t r, ret;
+
+   ret = efi_get_drivers(efiobj, protocol, _of_drivers,
+ _handle_buffer);
+   

[U-Boot] [PATCH v3 05/16] efi_loader: open_info in OpenProtocol

2018-01-10 Thread Heinrich Schuchardt
efi_open_protocol has to keep track of opened protocols.

OpenProtocol enters the agent and controller handle
information into this list.

A unit test is supplied with a subsequent patch.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_loader/efi_boottime.c | 107 --
 1 file changed, 103 insertions(+), 4 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f5ec2a8866..bb80c6066a 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2100,6 +2100,101 @@ static void EFIAPI efi_set_mem(void *buffer, size_t 
size, uint8_t value)
EFI_EXIT(EFI_SUCCESS);
 }
 
+/*
+ * Open protocol interface on a handle.
+ *
+ * @handlerhandler of a protocol
+ * @protocol_interface interface implementing the protocol
+ * @agent_handle   handle of the driver
+ * @controller_handle  handle of the controller
+ * @attributes attributes indicating how to open the protocol
+ * @return status code
+ */
+static efi_status_t efi_protocol_open(
+   struct efi_handler *handler,
+   void **protocol_interface, void *agent_handle,
+   void *controller_handle, uint32_t attributes)
+{
+   struct efi_open_protocol_info_item *item;
+   struct efi_open_protocol_info_entry *match = NULL;
+   bool opened_by_driver = false;
+   bool opened_exclusive = false;
+
+   /* If there is no agent, only return the interface */
+   if (!agent_handle)
+   goto out;
+
+   /* For TEST_PROTOCOL ignore interface attribute */
+   if (attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL)
+   *protocol_interface = NULL;
+
+   /*
+* Check if the protocol is already opened by a driver with the same
+* attributes or opened exclusively
+*/
+   list_for_each_entry(item, >open_infos, link) {
+   if (item->info.agent_handle == agent_handle) {
+   if ((attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) &&
+   (item->info.attributes == attributes))
+   return EFI_ALREADY_STARTED;
+   }
+   if (item->info.attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE)
+   opened_exclusive = true;
+   }
+
+   /* Only one controller can open the protocol exclusively */
+   if (opened_exclusive && attributes &
+   (EFI_OPEN_PROTOCOL_EXCLUSIVE | EFI_OPEN_PROTOCOL_BY_DRIVER))
+   return EFI_ACCESS_DENIED;
+
+   /* Prepare exclusive opening */
+   if (attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) {
+   /* Try to disconnect controllers */
+   list_for_each_entry(item, >open_infos, link) {
+   if (item->info.attributes ==
+   EFI_OPEN_PROTOCOL_BY_DRIVER)
+   EFI_CALL(efi_disconnect_controller(
+   item->info.controller_handle,
+   item->info.agent_handle,
+   NULL));
+   }
+   opened_by_driver = false;
+   /* Check if all controllers are disconnected */
+   list_for_each_entry(item, >open_infos, link) {
+   if (item->info.attributes & EFI_OPEN_PROTOCOL_BY_DRIVER)
+   opened_by_driver = true;
+   }
+   /* Only one controller can be conncected */
+   if (opened_by_driver)
+   return EFI_ACCESS_DENIED;
+   }
+
+   /* Find existing entry */
+   list_for_each_entry(item, >open_infos, link) {
+   if (item->info.agent_handle == agent_handle &&
+   item->info.controller_handle == controller_handle)
+   match = >info;
+   }
+   /* None found, create one */
+   if (!match) {
+   match = efi_create_open_info(handler);
+   if (!match)
+   return EFI_OUT_OF_RESOURCES;
+   }
+
+   match->agent_handle = agent_handle;
+   match->controller_handle = controller_handle;
+   match->attributes = attributes;
+   match->open_count++;
+
+out:
+   /* For TEST_PROTOCOL ignore interface attribute. */
+   if (attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL)
+   *protocol_interface = handler->protocol_interface;
+
+   return EFI_SUCCESS;
+}
+
 /*
  * Open protocol interface on a handle.
  *
@@ -2141,12 +2236,16 @@ static efi_status_t EFIAPI efi_open_protocol(
case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER:
if (controller_handle == handle)
goto out;
+   /* fall-through */
case EFI_OPEN_PROTOCOL_BY_DRIVER:
case 

[U-Boot] [PATCH v3 08/16] efi_loader: debug output installed device path

2018-01-10 Thread Heinrich Schuchardt
When a device path protocol is installed write the device
path to the console in debug mode.

For printing the new macro EFI_PRINT is used, which can be reused
for future diagnostic output.

Remove unused EFI_PRINT_GUID macro

Signed-off-by: Heinrich Schuchardt 
---
v3
Avoid memory leak. Use printf("%pD") for device path output.
v2
Remove unused EFI_PRINT_GUID macro.
Use new macro EFI_PRINT to output device path.
---
 include/efi_loader.h  | 7 ---
 lib/efi_loader/efi_boottime.c | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 637e6e166d..4198329230 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -69,10 +69,11 @@ const char *__efi_nesting_dec(void);
} while(0)
 
 /*
- * Write GUID
+ * Write an indented message with EFI prefix
  */
-#define EFI_PRINT_GUID(txt, guid) ({ \
-   debug("%sEFI: %s %pUl\n", __efi_nesting(), txt, guid); \
+#define EFI_PRINT(format, ...) ({ \
+   debug("%sEFI: " format, __efi_nesting(), \
+   ##__VA_ARGS__); \
})
 
 extern struct efi_runtime_services efi_runtime_services;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 44c9da0a7c..d232ed2c70 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -876,6 +876,8 @@ efi_status_t efi_add_protocol(const void *handle, const 
efi_guid_t *protocol,
handler->protocol_interface = protocol_interface;
INIT_LIST_HEAD(>open_infos);
list_add_tail(>link, >protocols);
+   if (!guidcmp(_guid_device_path, protocol))
+   EFI_PRINT("installed device path '%pD'\n", protocol_interface);
return EFI_SUCCESS;
 }
 
-- 
2.14.2

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


[U-Boot] [PATCH v3 04/16] efi_loader: list of open protocol infos

2018-01-10 Thread Heinrich Schuchardt
Add a list of open protocol infos to each protocol of a handle.

Provide helper functions to access the list items.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 include/efi_loader.h  | 15 ++-
 lib/efi_loader/efi_boottime.c | 35 +++
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 6185055e78..637e6e166d 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -96,15 +96,28 @@ extern const efi_guid_t efi_file_info_guid;
 extern unsigned int __efi_runtime_start, __efi_runtime_stop;
 extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
 
+/*
+ * When a protocol is opened a open protocol info entry is created.
+ * These are maintained in a list.
+ */
+struct efi_open_protocol_info_item {
+   /* Link to the list of open protocol info entries of a protocol */
+   struct list_head link;
+   struct efi_open_protocol_info_entry info;
+};
+
 /*
  * When the UEFI payload wants to open a protocol on an object to get its
  * interface (usually a struct with callback functions), this struct maps the
- * protocol GUID to the respective protocol interface */
+ * protocol GUID to the respective protocol interface
+ */
 struct efi_handler {
/* Link to the list of protocols of a handle */
struct list_head link;
const efi_guid_t *guid;
void *protocol_interface;
+   /* Link to the list of open protocol info items */
+   struct list_head open_infos;
 };
 
 /*
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 99eb36c306..f5ec2a8866 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -814,6 +814,40 @@ struct efi_object *efi_search_obj(const void *handle)
return NULL;
 }
 
+/*
+ * Create open protocol info entry and add it to a protocol.
+ *
+ * @handlerhandler of a protocol
+ * @return open protocol info entry
+ */
+static struct efi_open_protocol_info_entry *efi_create_open_info(
+   struct efi_handler *handler)
+{
+   struct efi_open_protocol_info_item *item;
+
+   item = calloc(1, sizeof(struct efi_open_protocol_info_item));
+   if (!item)
+   return NULL;
+   /* Append the item to the open protocol info list. */
+   list_add_tail(>link, >open_infos);
+
+   return >info;
+}
+
+/*
+ * Remove an open protocol info entry from a protocol.
+ *
+ * @handlerhandler of a protocol
+ * @return status code
+ */
+static efi_status_t efi_delete_open_info(
+   struct efi_open_protocol_info_item *item)
+{
+   list_del(>link);
+   free(item);
+   return EFI_SUCCESS;
+}
+
 /*
  * Install new protocol on a handle.
  *
@@ -840,6 +874,7 @@ efi_status_t efi_add_protocol(const void *handle, const 
efi_guid_t *protocol,
return EFI_OUT_OF_RESOURCES;
handler->guid = protocol;
handler->protocol_interface = protocol_interface;
+   INIT_LIST_HEAD(>open_infos);
list_add_tail(>link, >protocols);
return EFI_SUCCESS;
 }
-- 
2.14.2

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


[U-Boot] [PATCH v3 00/16] efi_loader: implement driver management

2018-01-10 Thread Heinrich Schuchardt
This series implements the OpenProtocolInformation, ConnectController,
and DisconnectController boot services.

The EFI application creating a new device will call ConnectController
to request the installation of all necessary drivers. Before
deleting the device it will call DisconectController to remove all
child controllers and to detach the driver.

E.g. iPXE may be used to connect an iSCSI target. It then creates a
handle by installing the EFI_BLOCK_IO_PROTOCOL. It calls
ConnectController and expects U-Boot to create the partition handles
and to provide the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. (The driver
connecting to the EFI_BLOCK_IO_PROTOCOL is not yet implemented in
U-Boot.)

A self test is provided for the driver management.
The bootefi selftest now creates colored output.
Two bug fixes are included.

To complete the implementation of the EFI boot services the following
future work is needed:
* manage events in a linked list (see Rob's proposal)
* implement ReinstallProtocol and RegisterProtocolNotify
---
v3:
Add more comments to code.  
Avoid memory leak when debug printing device path.
v2:
Clean up debug output in efi_add_protocol (patch 8).
Correctly return EFI_NOT_FOUND if no driver is uninstalled in
DisconnectController (patch 11).
Define a local structure as static (patch 15).

Heinrich Schuchardt (16):
  efi_selftest: colored test output
  efi_loader: simplify efi_remove_all_protocols
  efi_selftest: do not try to close device path protocol
  efi_loader: list of open protocol infos
  efi_loader: open_info in OpenProtocol
  efi_loader: open_info in CloseProtocol
  efi_loader: implement OpenProtocolInformation
  efi_loader: debug output installed device path
  efi_loader: implement ConnectController
  efi_loader: fix signature of efi_disconnect_controller
  efi_loader: implement DisconnectController
  efi_loader: disconnect controllers in UninstallProtocol
  efi_selftest: remove todo in manage protocols
  efi_selftest: remove todo in device path test
  efi_selftest: test for (Dis)ConnectController
  efi_loader: consistently use efi_handle_t for handles

 cmd/bootefi.c   |  10 +-
 include/efi_api.h   |  48 +-
 include/efi_loader.h|  38 +-
 include/efi_selftest.h  |  27 +-
 lib/efi_loader/efi_boottime.c   | 763 +---
 lib/efi_loader/efi_console.c|   6 +-
 lib/efi_selftest/Makefile   |   1 +
 lib/efi_selftest/efi_selftest.c |  25 +-
 lib/efi_selftest/efi_selftest_console.c |  13 +-
 lib/efi_selftest/efi_selftest_controllers.c | 385 
 lib/efi_selftest/efi_selftest_devicepath.c  |  48 +-
 lib/efi_selftest/efi_selftest_manageprotocols.c |  22 +-
 12 files changed, 1219 insertions(+), 167 deletions(-)
 create mode 100644 lib/efi_selftest/efi_selftest_controllers.c

-- 
2.14.2

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


[U-Boot] [PATCH v3 02/16] efi_loader: simplify efi_remove_all_protocols

2018-01-10 Thread Heinrich Schuchardt
Replace list_for_each_safe() and list_entry() by
list_for_each_entry_safe().

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_loader/efi_boottime.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 02bc9fdcf0..99eb36c306 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -425,18 +425,15 @@ efi_status_t efi_remove_protocol(const void *handle, 
const efi_guid_t *protocol,
 efi_status_t efi_remove_all_protocols(const void *handle)
 {
struct efi_object *efiobj;
-   struct list_head *lhandle;
-   struct list_head *pos;
+   struct efi_handler *protocol;
+   struct efi_handler *pos;
 
efiobj = efi_search_obj(handle);
if (!efiobj)
return EFI_INVALID_PARAMETER;
-   list_for_each_safe(lhandle, pos, >protocols) {
-   struct efi_handler *protocol;
+   list_for_each_entry_safe(protocol, pos, >protocols, link) {
efi_status_t ret;
 
-   protocol = list_entry(lhandle, struct efi_handler, link);
-
ret = efi_remove_protocol(handle, protocol->guid,
  protocol->protocol_interface);
if (ret != EFI_SUCCESS)
-- 
2.14.2

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


[U-Boot] [PATCH v3 06/16] efi_loader: open_info in CloseProtocol

2018-01-10 Thread Heinrich Schuchardt
efi_open_protocol and efi_close_protocol have to keep track of
opened protocols.

Check if the protocol was opened for the same agent and
controller.

Remove all open protocol information for this pair.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_loader/efi_boottime.c | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index bb80c6066a..a527e33141 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1675,9 +1675,33 @@ static efi_status_t EFIAPI efi_close_protocol(void 
*handle,
  void *agent_handle,
  void *controller_handle)
 {
+   struct efi_handler *handler;
+   struct efi_open_protocol_info_item *item;
+   struct efi_open_protocol_info_item *pos;
+   efi_status_t r;
+
EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, agent_handle,
  controller_handle);
-   return EFI_EXIT(EFI_NOT_FOUND);
+
+   if (!agent_handle) {
+   r = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+   r = efi_search_protocol(handle, protocol, );
+   if (r != EFI_SUCCESS)
+   goto out;
+
+   r = EFI_NOT_FOUND;
+   list_for_each_entry_safe(item, pos, >open_infos, link) {
+   if (item->info.agent_handle == agent_handle &&
+   item->info.controller_handle == controller_handle) {
+   efi_delete_open_info(item);
+   r = EFI_SUCCESS;
+   break;
+   }
+   }
+out:
+   return EFI_EXIT(r);
 }
 
 /*
-- 
2.14.2

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


[U-Boot] [PATCH v3 03/16] efi_selftest: do not try to close device path protocol

2018-01-10 Thread Heinrich Schuchardt
CloseProtocol cannot be called without agent handle.

There is no need to close the device path protocol if
it has been opened without agent handle.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
no change
---
 lib/efi_selftest/efi_selftest_devicepath.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_devicepath.c 
b/lib/efi_selftest/efi_selftest_devicepath.c
index 1ab54ebb37..d9a6697892 100644
--- a/lib/efi_selftest/efi_selftest_devicepath.c
+++ b/lib/efi_selftest/efi_selftest_devicepath.c
@@ -299,10 +299,10 @@ static int execute(void)
efi_st_error("FreePool failed\n");
return EFI_ST_FAILURE;
}
-   ret = boottime->close_protocol(handles[i], _device_path,
-  NULL, NULL);
-   if (ret != EFI_SUCCESS)
-   efi_st_todo("Cannot close device path protocol.\n");
+   /*
+* CloseProtocol cannot be called without agent handle.
+* There is no need to close the device path protocol.
+*/
}
ret = boottime->free_pool(handles);
if (ret != EFI_SUCCESS) {
-- 
2.14.2

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


[U-Boot] [PATCH v3 01/16] efi_selftest: colored test output

2018-01-10 Thread Heinrich Schuchardt
Add color coding to output:
test sectionblue
success green
errors  red
todoyellow
summary white
others  light gray

Signed-off-by: Heinrich Schuchardt 
---
v3
add more comments for function parameters
v2
no change
---
 include/efi_selftest.h  | 27 +--
 lib/efi_selftest/efi_selftest.c | 25 ++---
 lib/efi_selftest/efi_selftest_console.c | 13 +
 3 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/include/efi_selftest.h b/include/efi_selftest.h
index be5ba4bfa9..08dd8e43ad 100644
--- a/include/efi_selftest.h
+++ b/include/efi_selftest.h
@@ -18,14 +18,20 @@
 #define EFI_ST_SUCCESS 0
 #define EFI_ST_FAILURE 1
 
+/*
+ * Prints a message.
+ */
+#define efi_st_printf(...) \
+   (efi_st_printc(-1, __VA_ARGS__))
+
 /*
  * Prints an error message.
  *
  * @...format string followed by fields to print
  */
 #define efi_st_error(...) \
-   (efi_st_printf("%s(%u):\nERROR: ", __FILE__, __LINE__), \
-   efi_st_printf(__VA_ARGS__)) \
+   (efi_st_printc(EFI_LIGHTRED, "%s(%u):\nERROR: ", __FILE__, __LINE__), \
+   efi_st_printc(EFI_LIGHTRED, __VA_ARGS__))
 
 /*
  * Prints a TODO message.
@@ -33,8 +39,8 @@
  * @...format string followed by fields to print
  */
 #define efi_st_todo(...) \
-   (efi_st_printf("%s(%u):\nTODO: ", __FILE__, __LINE__), \
-   efi_st_printf(__VA_ARGS__)) \
+   (efi_st_printc(EFI_YELLOW, "%s(%u):\nTODO: ", __FILE__, __LINE__), \
+   efi_st_printc(EFI_YELLOW, __VA_ARGS__)) \
 
 /*
  * A test may be setup and executed at boottime,
@@ -61,14 +67,15 @@ extern struct efi_simple_input_interface *con_in;
 void efi_st_exit_boot_services(void);
 
 /*
- * Print a pointer to an u16 string
+ * Print a colored message
  *
- * @pointer: pointer
- * @buf: pointer to buffer address
- * on return position of terminating zero word
+ * @color  color, see constants in efi_api.h, use -1 for no color
+ * @fmtprintf format
+ * @...arguments to be printed
+ * on return position of terminating zero word
  */
-void efi_st_printf(const char *fmt, ...)
-__attribute__ ((format (__printf__, 1, 2)));
+void efi_st_printc(int color, const char *fmt, ...)
+__attribute__ ((format (__printf__, 2, 3)));
 
 /*
  * Compare memory.
diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index 4e5a12c47c..fc5ef254a1 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ -65,7 +65,7 @@ void efi_st_exit_boot_services(void)
efi_st_error("ExitBootServices did not return EFI_SUCCESS\n");
return;
}
-   efi_st_printf("\nBoot services terminated\n");
+   efi_st_printc(EFI_WHITE, "\nBoot services terminated\n");
 }
 
 /*
@@ -81,13 +81,14 @@ static int setup(struct efi_unit_test *test, unsigned int 
*failures)
 
if (!test->setup)
return EFI_ST_SUCCESS;
-   efi_st_printf("\nSetting up '%s'\n", test->name);
+   efi_st_printc(EFI_LIGHTBLUE, "\nSetting up '%s'\n", test->name);
ret = test->setup(handle, systable);
if (ret != EFI_ST_SUCCESS) {
efi_st_error("Setting up '%s' failed\n", test->name);
++*failures;
} else {
-   efi_st_printf("Setting up '%s' succeeded\n", test->name);
+   efi_st_printc(EFI_LIGHTGREEN,
+ "Setting up '%s' succeeded\n", test->name);
}
return ret;
 }
@@ -105,13 +106,14 @@ static int execute(struct efi_unit_test *test, unsigned 
int *failures)
 
if (!test->execute)
return EFI_ST_SUCCESS;
-   efi_st_printf("\nExecuting '%s'\n", test->name);
+   efi_st_printc(EFI_LIGHTBLUE, "\nExecuting '%s'\n", test->name);
ret = test->execute();
if (ret != EFI_ST_SUCCESS) {
efi_st_error("Executing '%s' failed\n", test->name);
++*failures;
} else {
-   efi_st_printf("Executing '%s' succeeded\n", test->name);
+   efi_st_printc(EFI_LIGHTGREEN,
+ "Executing '%s' succeeded\n", test->name);
}
return ret;
 }
@@ -129,13 +131,14 @@ static int teardown(struct efi_unit_test *test, unsigned 
int *failures)
 
if (!test->teardown)
return EFI_ST_SUCCESS;
-   efi_st_printf("\nTearing down '%s'\n", test->name);
+   efi_st_printc(EFI_LIGHTBLUE, "\nTearing down '%s'\n", test->name);
ret = test->teardown();
if (ret != EFI_ST_SUCCESS) {
efi_st_error("Tearing down '%s' failed\n", test->name);
++*failures;
} else {
-   efi_st_printf("Tearing down '%s' succeeded\n", test->name);
+   efi_st_printc(EFI_LIGHTGREEN,
+ "Tearing down 

Re: [U-Boot] [PATCH v7 02/13] wait_bit: use wait_for_bit_le32 instead of wait_for_bit

2018-01-10 Thread Jagan Teki
On Thu, Jan 11, 2018 at 7:20 AM, Daniel Schwierzeck
 wrote:
>
>
> On 10.01.2018 21:26, Álvaro Fernández Rojas wrote:
>> wait_for_bit callers use the 32 bit LE version
>>
>> Signed-off-by: Álvaro Fernández Rojas 
>> ---
>>  v7: Introduce changes suggested by Jagan Teki:
>>  - Remove wait_for_bit and update callers to wait_for_bit_le32.
>>
>>  arch/arm/mach-imx/mx6/ddr.c   | 22 -
>>  arch/arm/mach-socfpga/clock_manager.c |  4 +-
>>  arch/arm/mach-socfpga/clock_manager_gen5.c|  8 ++--
>>  arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +++
>>  arch/mips/mach-ath79/ar934x/clk.c |  2 +-
>>  board/samtec/vining_2000/vining_2000.c|  4 +-
>>  drivers/clk/clk_pic32.c   | 12 ++---
>>  drivers/clk/renesas/clk-rcar-gen3.c   |  4 +-
>>  drivers/ddr/microchip/ddr2.c  |  8 ++--
>>  drivers/fpga/socfpga_arria10.c| 17 +++
>>  drivers/mmc/msm_sdhci.c   |  8 ++--
>>  drivers/mtd/pic32_flash.c |  4 +-
>>  drivers/net/ag7xxx.c  | 16 +++
>>  drivers/net/dwc_eth_qos.c | 17 +++
>>  drivers/net/ethoc.c   |  8 ++--
>>  drivers/net/pic32_eth.c   | 12 ++---
>>  drivers/net/pic32_mdio.c  | 28 ++--
>>  drivers/net/ravb.c|  4 +-
>>  drivers/net/xilinx_axi_emac.c |  4 +-
>>  drivers/net/zynq_gem.c| 12 ++---
>>  drivers/reset/sti-reset.c |  4 +-
>>  drivers/serial/serial_pic32.c |  4 +-
>>  drivers/spi/atmel_spi.c   |  4 +-
>>  drivers/spi/cadence_qspi_apb.c| 14 +++---
>>  drivers/spi/fsl_qspi.c| 20 -
>>  drivers/spi/mvebu_a3700_spi.c | 20 +
>>  drivers/usb/host/dwc2.c   | 24 +-
>>  drivers/usb/host/ehci-msm.c   |  3 +-
>>  drivers/usb/host/ehci-mx6.c   |  5 +--
>>  drivers/usb/host/ohci-lpc32xx.c   | 12 ++---
>>  drivers/usb/host/xhci-rcar.c  | 12 ++---
>>  drivers/video/atmel_hlcdfb.c  | 64 
>> +--
>>  32 files changed, 207 insertions(+), 209 deletions(-)
>>
>
> Reviewed-by: Daniel Schwierzeck 

squash this with 03/13

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


Re: [U-Boot] [PATCH v7 01/13] wait_bit: add 8/16/32 BE/LE versions of wait_for_bit

2018-01-10 Thread Jagan Teki
On Thu, Jan 11, 2018 at 7:20 AM, Daniel Schwierzeck
 wrote:
>
>
> On 10.01.2018 21:26, Álvaro Fernández Rojas wrote:
>> Add 8/16/32 bits and BE/LE versions of wait_for_bit.
>> This is needed for reading registers that are not aligned to 32 bits, and for
>> Big Endian platforms.
>>
>> Signed-off-by: Álvaro Fernández Rojas 
>> ---
>>  v7: Introduce changes suggested by Daniel Schwierzeck:
>>  - Use const void* reg for compatibility with 64 bit systems.
>>  - Remove prefix and use __func__ instead.
>>  v6: Introduce changes suggested by Jagan Teki:
>>  - Switch to wait_for_bit instead of infinite loop.
>>
>>  include/wait_bit.h | 61 
>> ++
>>  1 file changed, 61 insertions(+)
>>
>
> Reviewed-by: Daniel Schwierzeck 

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


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

2018-01-10 Thread Jagan Teki
On Thu, Jan 11, 2018 at 11:38 AM, Stefan Mavrodiev  wrote:
> On 01/02/2018 01:01 PM, Stefan Mavrodiev wrote:
>>
>> On 12/26/2017 11:47 AM, Jagan Teki wrote:
>>>
>>> On Fri, Dec 22, 2017 at 3:30 PM, Stefan Mavrodiev 
>>> wrote:

 Driver testing is done with A20-OLinuXino-Lime2. Testing
 requirements are:
- Exposing spi0 alternative pins in the dts file
- Add alias node, enabling driver probing
- Enable spi flash related options in the defconfig file

 The testing log is:
U-Boot SPL 2018.01-rc2-00023-gfa13cb3-dirty (Dec 22 2017 - 11:39:48)
DRAM: 1024 MiB
CPU: 91200Hz, AXI/AHB/APB: 3/2/2
Trying to boot from sunxi SPI


U-Boot 2018.01-rc2-00023-gfa13cb3-dirty (Dec 22 2017 - 11:39:48
 +0200) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: Olimex A20-OLinuXino-LIME2
>>>
>>> Lime2 doen't have in-built spi-nor is it?
>>
>> We have some prototypes with this option.
>>>
>>>
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
MMC: no card present
mmc_init: -123, time 1
*** Warning - MMC init failed, using default environment
>>>
>>> you lost the env? since it's spi-nor better to use flash env.
>>
>> What's the point since this is only test case?
>>>
>>>
In:serial
Out:   serial
Err:   serial
Allwinner mUSB OTG (Peripheral)
SCSI:  SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst
Net:   No ethernet found.
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
=> sspi

=> sf probe
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB,
 total 16 MiB
>>>
>>> try to use erase/write and read commands to verify
>>
>> # Erase one sector
>> => sf erase 0x1000 0x100
>> SF: 256 bytes @ 0x1000 Erased: ERROR
>> => sf erase 0x1000 0x1000
>> SF: 4096 bytes @ 0x1000 Erased: OK
>>
>> # Get some random data
>> => md.b 0x5000 0x100
>> 5000: d6 4d d0 7e 93 d8 0f 48 1b ef 7f 7e be 4e a8 5d .M.~...H...~.N.]
>> 5010: fd 9f e5 7f 2f 7b 5b 19 ed de d8 58 99 7a 24 da /{[X.z$.
>> 5020: ef dd 9c 45 d7 97 ab 4f e7 fb ee 61 bc de 6a 1a ...E...O...a..j.
>> 5030: 9a 9f f4 3a be 4b 2f f3 ce 77 87 7e 07 23 af ff ...:.K/..w.~.#..
>> 5040: e5 e5 c0 fa 65 e2 78 9b 16 38 42 52 e5 6c 52 0d e.x..8BR.lR.
>> 5050: f5 ff da 94 7f 98 96 d7 f0 9d 66 ae 9b b9 a2 cd ..f.
>> 5060: 0b dd f1 c9 1d 3b fe 5b cf ef d6 ce 8b c5 fd 56 .;.[...V
>> 5070: e2 52 eb 78 d4 f1 bf 57 56 6a 57 58 52 f1 0e 9d .R.x...WVjWXR...
>> 5080: df be f8 19 bf cf d7 ac 4b 3e 86 21 3f c3 fe 3e K>.!?..>
>> 5090: ea 27 52 ca 1f 79 bd 7b ef bf 96 c9 9d f6 81 d3 .'R..y.{
>> 50a0: cc 2e 8b c8 34 7f c5 2f 29 19 a8 dc 54 7a 07 1d 4../)...Tz..
>> 50b0: f4 e6 db ed 38 03 59 bb 31 ee b3 dd 5c e6 be 58 8.Y.1...\..X
>> 50c0: a6 7c 87 61 84 47 e0 b1 a1 fc 6e d3 d5 93 bf 8a .|.a.Gn.
>> 50d0: 5d a3 be 4b cf 07 1d 92 ff 36 f9 46 fb 5a cb 8f ]..K.6.F.Z..
>> 50e0: f9 27 7a b8 7b 07 2e 22 a1 ee 56 bc a7 de 57 6a .'z.{.."..V...Wj
>> 50f0: da d4 7d 7f ee db 7a e2 bc 5c 44 64 b7 fc ea 3e ..}...z..\Dd...
>>
>> # Write one page to spi-nor
>> => sf write 0x5000 0x1000 0x100
>> device 0 offset 0x1000, size 0x100
>> SF: 256 bytes @ 0x1000 Written: OK
>>
>> # Readback data
>> => sf read 0x5100 0x1000 0x100
>> device 0 offset 0x1000, size 0x100
>> SF: 256 bytes @ 0x1000 Read: OK
>>
>> # Compare data
>> => cmp.b 0x5000 0x5100 0x100
>> Total of 256 byte(s) were the same
>>>
>>>
=> sf test 0 10
SPI flash test:
0 erase: 11407 ticks, 89 KiB/s 0.712 Mbps
1 check: 8881 ticks, 115 KiB/s 0.920 Mbps
2 write: 10824 ticks, 94 KiB/s 0.752 Mbps
3 read: 8872 ticks, 115 KiB/s 0.920 Mbps
Test passed
0 erase: 11407 ticks, 89 KiB/s 0.712 Mbps
1 check: 8881 ticks, 115 KiB/s 0.920 Mbps
2 write: 10824 ticks, 94 KiB/s 0.752 Mbps
3 read: 8872 ticks, 115 KiB/s 0.920 Mbps
=>

 Signed-off-by: Stefan Mavrodiev 
 ---
   arch/arm/dts/sun7i-a20-olinuxino-lime2.dts | 21 +
   configs/A20-OLinuXino-Lime2_defconfig  |  8 
   2 files changed, 29 insertions(+)

 diff --git a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
 b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
 index d5c796c..3c708da 100644
 

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

2018-01-10 Thread Stefan Mavrodiev

On 01/02/2018 01:01 PM, Stefan Mavrodiev wrote:

On 12/26/2017 11:47 AM, Jagan Teki wrote:
On Fri, Dec 22, 2017 at 3:30 PM, Stefan Mavrodiev  
wrote:

Driver testing is done with A20-OLinuXino-Lime2. Testing
requirements are:
   - Exposing spi0 alternative pins in the dts file
   - Add alias node, enabling driver probing
   - Enable spi flash related options in the defconfig file

The testing log is:
   U-Boot SPL 2018.01-rc2-00023-gfa13cb3-dirty (Dec 22 2017 - 11:39:48)
   DRAM: 1024 MiB
   CPU: 91200Hz, AXI/AHB/APB: 3/2/2
   Trying to boot from sunxi SPI


   U-Boot 2018.01-rc2-00023-gfa13cb3-dirty (Dec 22 2017 - 11:39:48 
+0200) Allwinner Technology


   CPU:   Allwinner A20 (SUN7I)
   Model: Olimex A20-OLinuXino-LIME2

Lime2 doen't have in-built spi-nor is it?

We have some prototypes with this option.



   I2C:   ready
   DRAM:  1 GiB
   MMC:   SUNXI SD/MMC: 0
   MMC: no card present
   mmc_init: -123, time 1
   *** Warning - MMC init failed, using default environment

you lost the env? since it's spi-nor better to use flash env.

What's the point since this is only test case?



   In:    serial
   Out:   serial
   Err:   serial
   Allwinner mUSB OTG (Peripheral)
   SCSI:  SATA link 0 timeout.
   AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
   flags: ncq stag pm led clo only pmp pio slum part ccc apst
   Net:   No ethernet found.
   starting USB...
   USB0:   USB EHCI 1.00
   USB1:   USB OHCI 1.0
   USB2:   USB EHCI 1.00
   USB3:   USB OHCI 1.0
   scanning bus 0 for devices... 1 USB Device(s) found
   scanning bus 2 for devices... 1 USB Device(s) found
  scanning usb for storage devices... 0 Storage Device(s) found
   Hit any key to stop autoboot:  0
   => sspi

   => sf probe
   SF: Detected w25q128bv with page size 256 Bytes, erase size 4 
KiB, total 16 MiB

try to use erase/write and read commands to verify

# Erase one sector
=> sf erase 0x1000 0x100
SF: 256 bytes @ 0x1000 Erased: ERROR
=> sf erase 0x1000 0x1000
SF: 4096 bytes @ 0x1000 Erased: OK

# Get some random data
=> md.b 0x5000 0x100
5000: d6 4d d0 7e 93 d8 0f 48 1b ef 7f 7e be 4e a8 5d 
.M.~...H...~.N.]
5010: fd 9f e5 7f 2f 7b 5b 19 ed de d8 58 99 7a 24 da 
/{[X.z$.
5020: ef dd 9c 45 d7 97 ab 4f e7 fb ee 61 bc de 6a 1a 
...E...O...a..j.
5030: 9a 9f f4 3a be 4b 2f f3 ce 77 87 7e 07 23 af ff 
...:.K/..w.~.#..
5040: e5 e5 c0 fa 65 e2 78 9b 16 38 42 52 e5 6c 52 0d 
e.x..8BR.lR.
5050: f5 ff da 94 7f 98 96 d7 f0 9d 66 ae 9b b9 a2 cd 
..f.
5060: 0b dd f1 c9 1d 3b fe 5b cf ef d6 ce 8b c5 fd 56 
.;.[...V
5070: e2 52 eb 78 d4 f1 bf 57 56 6a 57 58 52 f1 0e 9d 
.R.x...WVjWXR...
5080: df be f8 19 bf cf d7 ac 4b 3e 86 21 3f c3 fe 3e 
K>.!?..>
5090: ea 27 52 ca 1f 79 bd 7b ef bf 96 c9 9d f6 81 d3 
.'R..y.{
50a0: cc 2e 8b c8 34 7f c5 2f 29 19 a8 dc 54 7a 07 1d 
4../)...Tz..
50b0: f4 e6 db ed 38 03 59 bb 31 ee b3 dd 5c e6 be 58 
8.Y.1...\..X
50c0: a6 7c 87 61 84 47 e0 b1 a1 fc 6e d3 d5 93 bf 8a 
.|.a.Gn.
50d0: 5d a3 be 4b cf 07 1d 92 ff 36 f9 46 fb 5a cb 8f 
]..K.6.F.Z..
50e0: f9 27 7a b8 7b 07 2e 22 a1 ee 56 bc a7 de 57 6a 
.'z.{.."..V...Wj

50f0: da d4 7d 7f ee db 7a e2 bc 5c 44 64 b7 fc ea 3e ..}...z..\Dd...

# Write one page to spi-nor
=> sf write 0x5000 0x1000 0x100
device 0 offset 0x1000, size 0x100
SF: 256 bytes @ 0x1000 Written: OK

# Readback data
=> sf read 0x5100 0x1000 0x100
device 0 offset 0x1000, size 0x100
SF: 256 bytes @ 0x1000 Read: OK

# Compare data
=> cmp.b 0x5000 0x5100 0x100
Total of 256 byte(s) were the same



   => sf test 0 10
   SPI flash test:
   0 erase: 11407 ticks, 89 KiB/s 0.712 Mbps
   1 check: 8881 ticks, 115 KiB/s 0.920 Mbps
   2 write: 10824 ticks, 94 KiB/s 0.752 Mbps
   3 read: 8872 ticks, 115 KiB/s 0.920 Mbps
   Test passed
   0 erase: 11407 ticks, 89 KiB/s 0.712 Mbps
   1 check: 8881 ticks, 115 KiB/s 0.920 Mbps
   2 write: 10824 ticks, 94 KiB/s 0.752 Mbps
   3 read: 8872 ticks, 115 KiB/s 0.920 Mbps
   =>

Signed-off-by: Stefan Mavrodiev 
---
  arch/arm/dts/sun7i-a20-olinuxino-lime2.dts | 21 +
  configs/A20-OLinuXino-Lime2_defconfig  |  8 
  2 files changed, 29 insertions(+)

diff --git a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts 
b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts

index d5c796c..3c708da 100644
--- a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
+++ b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
@@ -54,6 +54,7 @@

 aliases {
 serial0 = 
+   spi0 = 
 };

 chosen {
@@ -215,6 +216,20 @@
 allwinner,pull = ;
 };

+   spi0_pins_b: spi0@1 {
+   allwinner,pins = "PC0", "PC1", "PC2";
+   allwinner,function = "spi0";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spi0_cs0_pins_b: spi0_cs0@1 {
+   allwinner,pins = 

[U-Boot] Please pull u-boot-fsl-qoriq master

2018-01-10 Thread York Sun
Tom,

The following changes since commit f3dd87e0b98999a78e500e8c6d2b063ebadf535a:

  Prepare v2018.01 (2018-01-08 20:25:29 -0500)

are available in the git repository at:

  git://git.denx.de/u-boot-fsl-qoriq.git

for you to fetch changes up to 1cabeb88ebbae0e5d418333cdd2526b06b397c91:

  ls1088ardb: Add SD Secure boot target support (2018-01-10 12:32:45 -0800)


Ahmed Mansour (2):
  drivers/misc: Share qbman init between archs
  configs: Move SYS_DPAA_QBMAN to Kconfig

Alison Wang (1):
  armv8: Implement workaround for Cortex-A53 erratum 855873

Ashish Kumar (1):
  armv8: ls1088 : MC alignment should always be fixed to 512MB

Bao Xiaowei (1):
  Powerpc: T208xQDS: Modify the comment of the CONFIG_FSL_PCIE_RESET
macro

Sumit Garg (3):
  armv8: fsl-layerscape: SPL size reduction
  armv8: ls1088a: SPL size reduction
  ls1088ardb: Add SD Secure boot target support

Yuantian Tang (1):
  armv8: layerscape: sata: refine port register configuration

 arch/arm/Kconfig   |   3 +
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig  |   6 +-
 arch/arm/cpu/armv8/fsl-layerscape/Makefile |   2 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c|   4 +
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c|   9 +
 .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c |  14 +
 arch/arm/cpu/armv8/fsl-layerscape/soc.c|   6 +
 arch/arm/cpu/armv8/start.S |  24 +-
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  29 ++
 arch/arm/include/asm/arch-fsl-layerscape/soc.h |   2 +
 arch/arm/include/asm/arch-fsl-layerscape/speed.h   |   3 +
 arch/arm/include/asm/fsl_secure_boot.h |  16 +-
 arch/powerpc/cpu/mpc85xx/cpu_init.c|   3 +-
 arch/powerpc/cpu/mpc85xx/fdt.c |   1 +
 arch/powerpc/cpu/mpc85xx/portals.c | 281
---
 arch/powerpc/include/asm/fsl_liodn.h   |   7 +-
 arch/powerpc/include/asm/fsl_portals.h |   4 -
 arch/powerpc/include/asm/immap_85xx.h  |  60 
 board/freescale/ls1088a/MAINTAINERS|   5 +
 board/freescale/ls1088a/Makefile   |   4 +-
 board/freescale/ls1088a/ls1088a.c  |  16 +-
 board/freescale/p1023rdb/p1023rdb.c|   3 +-
 board/keymile/kmp204x/kmp204x.c|   2 +-
 board/varisys/cyrus/cyrus.c|   2 +-
 configs/T1024QDS_DDR4_defconfig|   1 +
 .../ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig   |  44 +++
 drivers/misc/Makefile  |   1 +
 drivers/misc/fsl_portals.c | 305
+
 drivers/net/Kconfig|  24 ++
 include/configs/B4860QDS.h |   1 -
 include/configs/P1023RDB.h |   1 -
 include/configs/P2041RDB.h |   1 -
 include/configs/T102xQDS.h |   1 -
 include/configs/T102xRDB.h |   1 -
 include/configs/T1040QDS.h |   1 -
 include/configs/T104xRDB.h |   1 -
 include/configs/T208xQDS.h |   4 +-
 include/configs/T208xRDB.h |   1 -
 include/configs/T4240QDS.h |   1 -
 include/configs/T4240RDB.h |   1 -
 include/configs/corenet_ds.h   |   1 -
 include/configs/cyrus.h|   1 -
 include/configs/km/kmp204x-common.h|   1 -
 include/configs/ls1046a_common.h   |   4 -
 include/configs/ls1088a_common.h   |  34 ++-
 include/configs/ls1088ardb.h   |  20 ++
 include/fsl_qbman.h|  75 +
 47 files changed, 641 insertions(+), 390 deletions(-)
 create mode 100644 configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
 create mode 100644 drivers/misc/fsl_portals.c
 create mode 100644 include/fsl_qbman.h

Thanks.

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


Re: [U-Boot] [PATCH v2 3/3] ls1088ardb: Add SD Secure boot target support

2018-01-10 Thread Sumit Garg
> -Original Message-
> From: York Sun
> Sent: Thursday, January 11, 2018 1:03 AM
> To: Sumit Garg ; u-boot@lists.denx.de
> Cc: Ruchika Gupta ; Prabhakar Kushwaha
> ; Ashish Kumar ;
> Udit Agarwal 
> Subject: Re: [PATCH v2 3/3] ls1088ardb: Add SD Secure boot target support
> 
> On 01/05/2018 08:00 AM, Sumit Garg wrote:
> > Signed-off-by: Udit Agarwal 
> > Signed-off-by: Sumit Garg 
> > ---
> >
> > Changes in v2:
> > Rebased to top of master
> >
> >  arch/arm/include/asm/fsl_secure_boot.h | 16 
> >  board/freescale/ls1088a/MAINTAINERS|  5 +++
> >  .../ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig   | 45
> ++
> >  include/configs/ls1088a_common.h   | 15 +++-
> >  4 files changed, 72 insertions(+), 9 deletions(-)  create mode 100644
> > configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> >
> > diff --git a/arch/arm/include/asm/fsl_secure_boot.h
> > b/arch/arm/include/asm/fsl_secure_boot.h
> > index ec6463d..3f30470 100644
> > --- a/arch/arm/include/asm/fsl_secure_boot.h
> > +++ b/arch/arm/include/asm/fsl_secure_boot.h
> > @@ -26,6 +26,14 @@
> >
> >  #define CONFIG_KEY_REVOCATION
> >
> > +#if defined(CONFIG_FSL_LAYERSCAPE)
> > +/*
> > + * For fsl layerscape based platforms, ESBC image Address in Header
> > + * is 64 bit.
> > + */
> > +#define CONFIG_ESBC_ADDR_64BIT
> > +#endif
> > +
> >  #ifndef CONFIG_SPL_BUILD
> >  #ifndef CONFIG_SYS_RAMBOOT
> >  /* The key used for verification of next level images @@ -42,14 +50,6
> > @@
> >
> >  #endif
> >
> > -#if defined(CONFIG_FSL_LAYERSCAPE)
> > -/*
> > - * For fsl layerscape based platforms, ESBC image Address in Header
> > - * is 64 bit.
> > - */
> > -#define CONFIG_ESBC_ADDR_64BIT
> > -#endif
> > -
> >  #ifdef CONFIG_ARCH_LS2080A
> >  #define CONFIG_EXTRA_ENV \
> > "setenv fdt_high 0xa000;"   \
> > diff --git a/board/freescale/ls1088a/MAINTAINERS
> > b/board/freescale/ls1088a/MAINTAINERS
> > index de3961d..371e5db 100644
> > --- a/board/freescale/ls1088a/MAINTAINERS
> > +++ b/board/freescale/ls1088a/MAINTAINERS
> > @@ -27,3 +27,8 @@ M:Udit Agarwal 
> >  M: Vinitha Pillai-B57223 
> >  S: Maintained
> >  F: configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
> > +
> > +LS1088ARDB_SD_SECURE_BOOT BOARD
> > +M: Sumit Garg 
> > +S: Maintained
> > +F: configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> > diff --git a/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> > b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> > new file mode 100644
> > index 000..ba90e64
> > --- /dev/null
> > +++ b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> > @@ -0,0 +1,45 @@
> > +CONFIG_ARM=y
> > +CONFIG_TARGET_LS1088ARDB=y
> > +CONFIG_SPL_LIBCOMMON_SUPPORT=y
> > +CONFIG_SPL_LIBGENERIC_SUPPORT=y
> > +CONFIG_FSL_LS_PPA=y
> > +CONFIG_SPL_MMC_SUPPORT=y
> > +CONFIG_SPL_SERIAL_SUPPORT=y
> > +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
> > +CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1088a-rdb"
> > +CONFIG_DISTRO_DEFAULTS=y
> > +# CONFIG_SYS_MALLOC_F is not set
> > +CONFIG_FIT_VERBOSE=y
> > +CONFIG_OF_BOARD_SETUP=y
> > +CONFIG_SYS_EXTRA_OPTIONS="SD_BOOT_QSPI"
> > +CONFIG_SECURE_BOOT=y
> > +CONFIG_SD_BOOT=y
> > +# CONFIG_USE_BOOTCOMMAND is not set
> > +# CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SPL=y
> > +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
> > +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
> > +CONFIG_SPL_ENV_SUPPORT=y
> > +CONFIG_SPL_I2C_SUPPORT=y
> > +CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT=y
> > +CONFIG_CMD_I2C=y
> > +CONFIG_CMD_MMC=y
> > +CONFIG_CMD_SF=y
> > +# CONFIG_CMD_SETEXPR is not set
> > +CONFIG_OF_CONTROL=y
> > +CONFIG_ENV_IS_IN_MMC=y
> 
> This looks wrong. For secure boot you don't use env, do you? If you agree I 
> can
> drop this line when applying this patch.
> 
> York
 
Yeah I agree with you. Please drop this config.

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


[U-Boot] [PATCH] TCP and wget implementation v5.1

2018-01-10 Thread Duncan Hare
Date: Wed, 10 Jan 2018 17:54:07 -0800
Subject: [PATCH] git_msg_1

TCP and wget implementation.

This is the interface and Kconfig files for introducing TCP and wget
into u-boot.

Interfaces are in net.c and net.h, ping.c is modified to the new ip send
interface, and UDP and TCP have shim procedures call map the protocol
interface to the ip interface.

The UDP interface is unchanged, and the existing UDP programs need no
changes.

All the code is new, and not copied from any source.

This code should compile.

Next step? git push? And I do wish  I could get git send-mail configureg
with yahoo.

Signed-off-by: Duncan Hare 

From: Duncan Hare 
Date: Wed, 10 Jan 2018 17:54:07 -0800
Subject: [PATCH] git_msg_1

Signed-off-by: Duncan Hare 
---

 include/net.h |  32 ++
 net/Kconfig   |   5 +++
 net/net.c | 102 +++---
 net/ping.c|   9 ++
 4 files changed, 115 insertions(+), 33 deletions(-)

diff --git a/include/net.h b/include/net.h
index 455b48f6c7..d231987e6e 100644
--- a/include/net.h
+++ b/include/net.h
@@ -15,17 +15,26 @@
 #include 
 #include  /* for nton* / ntoh* stuff */
 
-#define DEBUG_LL_STATE 0   /* Link local state machine changes */
-#define DEBUG_DEV_PKT 0/* Packets or info directed to the 
device */
-#define DEBUG_NET_PKT 0/* Packets on info on the network at 
large */
+#define DEBUG_LL_STATE  0  /* Link local state machine changes */
+#define DEBUG_DEV_PKT   0  /* Packets or info directed to the device */
+#define DEBUG_NET_PKT   0  /* Packets on info on the network at large */
 #define DEBUG_INT_STATE 0  /* Internal network state changes */
 
 /*
  * The number of receive packet buffers, and the required packet buffer
  * alignment in memory.
  *
+ * The nuber of buffers for TCP is used to calculate a static TCP window
+ * size, becuse TCP window size is a promise to the sending TCP to be able
+ * to buffer up to the window size of data.
+ * When the sending TCP has a window size of outstanding unacknowledged
+ * data, the sending TCP will stop sending.
  */
 
+#if defined(CONFIG_TCP)
+#define CONFIG_SYS_RX_ETH_BUFFER 50/* For TCP */
+#endif
+
 #ifdef CONFIG_SYS_RX_ETH_BUFFER
 # define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER
 #else
@@ -354,6 +363,8 @@ struct vlan_ethernet_hdr {
 
 #define IPPROTO_ICMP1  /* Internet Control Message Protocol*/
 #define IPPROTO_UDP17  /* User Datagram Protocol   */
+#define IPPROTO_TCP 6  /* Transmission Control Protocol*/
+
 
 /*
  * Internet Protocol (IP) header.
@@ -538,7 +549,7 @@ extern int  net_restart_wrap;   /* Tried all 
network devices */
 
 enum proto_t {
BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
-   TFTPSRV, TFTPPUT, LINKLOCAL
+   TFTPSRV, TFTPPUT, LINKLOCAL, WGET
 };
 
 extern charnet_boot_file_name[1024];/* Boot File name */
@@ -596,10 +607,10 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, 
uint prot);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
-void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source);
+void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source,
+  u16  pkt_len, u8 prot);
 void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport,
-   int sport, int len);
-
+   int sport, int len);
 /**
  * compute_ip_checksum() - Compute IP checksum
  *
@@ -670,9 +681,16 @@ static inline void net_send_packet(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
+int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport,
+  int payload_len, int proto, u8 action, u32 tcp_seq_num,
+  u32 tcp_ack_num);
+
 int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
int sport, int payload_len);
 
+int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action,
+   u32 tcp_seq_num, u32 tcp_ack_num);
+
 /* Processes a received packet */
 void net_process_received_packet(uchar *in_packet, int len);
 
diff --git a/net/Kconfig b/net/Kconfig
index 414c5497c7..625ad291bb 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -45,4 +45,9 @@ config BOOTP_VCI_STRING
default "U-Boot.arm" if ARM
default "U-Boot"
 
+config TCP
+   bool "Include Subset TCP stack for wget"
+   help
+ TCP protocol support for wget.
+
 endif   # if NET
diff --git a/net/net.c b/net/net.c
index 4259c9e321..79255c11eb 100644
--- a/net/net.c
+++ b/net/net.c
@@ -107,6 +107,12 @@
 #if defined(CONFIG_CMD_SNTP)
 #include "sntp.h"
 #endif
+#if defined(CONFIG_TCP)
+#include "tcp.h"
+#endif

[U-Boot] [PULL] u-boot-socfpga/master

2018-01-10 Thread Marek Vasut
The following changes since commit f3dd87e0b98999a78e500e8c6d2b063ebadf535a:

  Prepare v2018.01 (2018-01-08 20:25:29 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-socfpga.git master

for you to fetch changes up to b4b9814f1c737d175213b85c5bf1cab0806e2a73:

  arm: socfpga: Guard commands with CONFIG_SPL_BUILD tests (2018-01-09
12:38:55 +0100)


Andrey Zhizhikin (1):
  ARM: socfpga: Enable part command for socfpga platform

Tom Rini (1):
  arm: socfpga: Guard commands with CONFIG_SPL_BUILD tests

 arch/arm/mach-socfpga/clock_manager.c  |  4 +++-
 arch/arm/mach-socfpga/misc_gen5.c  | 13 -
 configs/socfpga_arria10_defconfig  |  1 +
 configs/socfpga_arria5_defconfig   |  1 +
 configs/socfpga_cyclone5_defconfig |  1 +
 configs/socfpga_de0_nano_soc_defconfig |  1 +
 configs/socfpga_de10_nano_defconfig|  1 +
 configs/socfpga_de1_soc_defconfig  |  1 +
 configs/socfpga_is1_defconfig  |  1 +
 configs/socfpga_mcvevk_defconfig   |  1 +
 configs/socfpga_sockit_defconfig   |  1 +
 configs/socfpga_socrates_defconfig |  1 +
 configs/socfpga_sr1500_defconfig   |  1 +
 configs/socfpga_vining_fpga_defconfig  |  1 +
 14 files changed, 23 insertions(+), 6 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [GIT] Pull request: u-boot-dfu (09.01.2018)

2018-01-10 Thread Marek Vasut
On 01/09/2018 03:24 PM, Lukasz Majewski wrote:
> Dear Marek,

Pulled, thanks.

> The following changes since commit
> 91f4fb9b89c94838bed41e12c3705c5553662c83:
> 
>   arm64: layerscape: Move CONFIG_HAS_FSL_DR_USB to Kconfig (2018-01-09
>   12:37:15 +0100)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-dfu.git 
> 
> for you to fetch changes up to f76c4432cede6142279f2f1c545a9d2e926f7cd3:
> 
>   rockchip: rk3288: enable rockusb support on rk3288 based device
>   (2018-01-09 15:20:29 +0100)
> 
> 
> Eddie Cai (4):
>   usb: rockchip: add the rockusb gadget
>   usb: rockchip: add rockusb command
>   rockchip:usb: add a simple readme for rockusb
>   rockchip: rk3288: enable rockusb support on rk3288 based device
> 
>  MAINTAINERS|   7 +
>  arch/arm/include/asm/arch-rockchip/f_rockusb.h | 133 +++
>  arch/arm/mach-rockchip/Kconfig |   2 +
>  cmd/Kconfig|   8 +
>  cmd/Makefile   |   1 +
>  cmd/rockusb.c  |  74 +++
>  configs/chromebit_mickey_defconfig |   7 +
>  configs/chromebook_jerry_defconfig |   7 +
>  configs/chromebook_minnie_defconfig|   7 +
>  configs/evb-rk3288_defconfig   |   9 +
>  configs/fennec-rk3288_defconfig|   5 +
>  configs/firefly-rk3288_defconfig   |   7 +
>  configs/miqi-rk3288_defconfig  |   5 +
>  configs/phycore-rk3288_defconfig   |   6 +
>  configs/popmetal-rk3288_defconfig  |   5 +
>  configs/rock2_defconfig|   8 +
>  configs/tinker-rk3288_defconfig|   5 +
>  configs/vyasa-rk3288_defconfig |  25 +++
>  doc/README.rockusb |  51 +
>  drivers/usb/gadget/Kconfig |   8 +
>  drivers/usb/gadget/Makefile|   1 +
>  drivers/usb/gadget/f_rockusb.c | 718
>   22 files
>  changed, 1099 insertions(+) create mode 100644
>  arch/arm/include/asm/arch-rockchip/f_rockusb.h create mode 100644
>  cmd/rockusb.c create mode 100644 doc/README.rockusb
>  create mode 100644 drivers/usb/gadget/f_rockusb.c
> 
> 
> travis-ci build log:
> https://travis-ci.org/lmajewski/u-boot-dfu/builds
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
> 


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


[U-Boot] [PULL] u-boot-usb/master

2018-01-10 Thread Marek Vasut
The following changes since commit f3dd87e0b98999a78e500e8c6d2b063ebadf535a:

  Prepare v2018.01 (2018-01-08 20:25:29 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-usb.git master

for you to fetch changes up to c3d098e762d3b064ad86e72babfbcaf188180d90:

  rockchip: rk3288: enable rockusb support on rk3288 based device
(2018-01-10 11:11:06 +0100)


Chen-Yu Tsai (1):
  musb: sunxi: Use base address from device tree

Eddie Cai (4):
  usb: rockchip: add the rockusb gadget
  usb: rockchip: add rockusb command
  rockchip:usb: add a simple readme for rockusb
  rockchip: rk3288: enable rockusb support on rk3288 based device

Ran Wang (3):
  armv8: ls1012a: Add USB 2.0 controller phy type for ls1012aqds board
  usb: ehci: fsl: Fix some compile warnings.
  arm64: layerscape: Move CONFIG_HAS_FSL_DR_USB to Kconfig

 MAINTAINERS|   7 ++
 arch/arm/dts/fsl-ls1012a-qds.dtsi  |   5 +
 arch/arm/include/asm/arch-rockchip/f_rockusb.h | 133
++
 arch/arm/mach-rockchip/Kconfig |   2 +
 cmd/Kconfig|   8 ++
 cmd/Makefile   |   1 +
 cmd/rockusb.c  |  74 +++
 configs/chromebit_mickey_defconfig |   7 ++
 configs/chromebook_jerry_defconfig |   7 ++
 configs/chromebook_minnie_defconfig|   7 ++
 configs/evb-rk3288_defconfig   |   9 ++
 configs/fennec-rk3288_defconfig|   5 +
 configs/firefly-rk3288_defconfig   |   7 ++
 configs/miqi-rk3288_defconfig  |   5 +
 configs/phycore-rk3288_defconfig   |   6 ++
 configs/popmetal-rk3288_defconfig  |   5 +
 configs/rock2_defconfig|   8 ++
 configs/tinker-rk3288_defconfig|   5 +
 configs/vyasa-rk3288_defconfig |  25 +
 doc/README.rockusb |  51 ++
 drivers/usb/gadget/Kconfig |   8 ++
 drivers/usb/gadget/Makefile|   1 +
 drivers/usb/gadget/f_rockusb.c | 718

 drivers/usb/host/Kconfig   |   6 ++
 drivers/usb/host/ehci-fsl.c|   8 +-
 drivers/usb/musb-new/sunxi.c   |   9 +-
 include/configs/ls1012aqds.h   |  11 ---
 include/configs/ls1021aqds.h   |  11 ---
 include/configs/ls1021atwr.h   |  20 
 29 files changed, 1120 insertions(+), 49 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-rockchip/f_rockusb.h
 create mode 100644 cmd/rockusb.c
 create mode 100644 doc/README.rockusb
 create mode 100644 drivers/usb/gadget/f_rockusb.c
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] compilation issue pine64

2018-01-10 Thread Peter Robinson
On Wed, Jan 10, 2018 at 3:58 PM, Akash Gajjar  wrote:
> Hi All,
>
> Facing compilation issue building pine64 mainline u-boot.
> Please see below build log.
>
> user]$ export CROSS_COMPILE=aarch64-linux-gnu-
>
> user]$ make pine64_plus_defconfig
>   HOSTCC  scripts/basic/fixdep
>   HOSTCC  scripts/kconfig/conf.o
>   HOSTCC  scripts/kconfig/zconf.tab.o
>   HOSTLD  scripts/kconfig/conf
> #
> # configuration written to .config
> #
>
> user]$ make
>   .
>   .
>   .
>   LDS spl/u-boot-spl.lds
>   LD  spl/u-boot-spl
> aarch64-linux-gnu-ld.bfd: u-boot-spl section `.rodata' will not fit in
> region `.sram'
> aarch64-linux-gnu-ld.bfd: region `.sram' overflowed by 6032 bytes
> make[1]: *** [spl/u-boot-spl] Error 1
> make: *** [spl/u-boot-spl] Error 2

It works fine for me on Fedora 27 with gcc 7.2.1 on both the latest
master head and 2018.01 GA

mkdir -p builds/pine64_plus/
cp ~/arm-trusted-firmware/sun50iw1p1/bl31.bin builds/pine64_plus/
make pine64_plus_defconfig V=1 O=builds/pine64_plus/
make CROSS_COMPILE="/usr/bin/aarch64-linux-gnu-" V=1 O=builds/pine64_plus/
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v7 01/13] wait_bit: add 8/16/32 BE/LE versions of wait_for_bit

2018-01-10 Thread Daniel Schwierzeck


On 10.01.2018 21:26, Álvaro Fernández Rojas wrote:
> Add 8/16/32 bits and BE/LE versions of wait_for_bit.
> This is needed for reading registers that are not aligned to 32 bits, and for
> Big Endian platforms.
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  v7: Introduce changes suggested by Daniel Schwierzeck:
>  - Use const void* reg for compatibility with 64 bit systems.
>  - Remove prefix and use __func__ instead.
>  v6: Introduce changes suggested by Jagan Teki:
>  - Switch to wait_for_bit instead of infinite loop.
> 
>  include/wait_bit.h | 61 
> ++
>  1 file changed, 61 insertions(+)
> 

Reviewed-by: Daniel Schwierzeck 

-- 
- Daniel



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


Re: [U-Boot] [PATCH v7 03/13] wait_bit: remove old wait_for_bit function

2018-01-10 Thread Daniel Schwierzeck


On 10.01.2018 21:26, Álvaro Fernández Rojas wrote:
> Since wait_for_bit callers have been updated to use wait_for_bit_le32,
> wait_for_bit is no longer needed.
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  v7: Introduce changes suggested by Jagan Teki:
>  - Remove wait_for_bit and update callers to wait_for_bit_le32.
> 
>  include/wait_bit.h | 54 
> --
>  1 file changed, 54 deletions(-)
> 

Reviewed-by: Daniel Schwierzeck 

-- 
- Daniel



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


Re: [U-Boot] [PATCH v7 02/13] wait_bit: use wait_for_bit_le32 instead of wait_for_bit

2018-01-10 Thread Daniel Schwierzeck


On 10.01.2018 21:26, Álvaro Fernández Rojas wrote:
> wait_for_bit callers use the 32 bit LE version
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  v7: Introduce changes suggested by Jagan Teki:
>  - Remove wait_for_bit and update callers to wait_for_bit_le32.
> 
>  arch/arm/mach-imx/mx6/ddr.c   | 22 -
>  arch/arm/mach-socfpga/clock_manager.c |  4 +-
>  arch/arm/mach-socfpga/clock_manager_gen5.c|  8 ++--
>  arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +++
>  arch/mips/mach-ath79/ar934x/clk.c |  2 +-
>  board/samtec/vining_2000/vining_2000.c|  4 +-
>  drivers/clk/clk_pic32.c   | 12 ++---
>  drivers/clk/renesas/clk-rcar-gen3.c   |  4 +-
>  drivers/ddr/microchip/ddr2.c  |  8 ++--
>  drivers/fpga/socfpga_arria10.c| 17 +++
>  drivers/mmc/msm_sdhci.c   |  8 ++--
>  drivers/mtd/pic32_flash.c |  4 +-
>  drivers/net/ag7xxx.c  | 16 +++
>  drivers/net/dwc_eth_qos.c | 17 +++
>  drivers/net/ethoc.c   |  8 ++--
>  drivers/net/pic32_eth.c   | 12 ++---
>  drivers/net/pic32_mdio.c  | 28 ++--
>  drivers/net/ravb.c|  4 +-
>  drivers/net/xilinx_axi_emac.c |  4 +-
>  drivers/net/zynq_gem.c| 12 ++---
>  drivers/reset/sti-reset.c |  4 +-
>  drivers/serial/serial_pic32.c |  4 +-
>  drivers/spi/atmel_spi.c   |  4 +-
>  drivers/spi/cadence_qspi_apb.c| 14 +++---
>  drivers/spi/fsl_qspi.c| 20 -
>  drivers/spi/mvebu_a3700_spi.c | 20 +
>  drivers/usb/host/dwc2.c   | 24 +-
>  drivers/usb/host/ehci-msm.c   |  3 +-
>  drivers/usb/host/ehci-mx6.c   |  5 +--
>  drivers/usb/host/ohci-lpc32xx.c   | 12 ++---
>  drivers/usb/host/xhci-rcar.c  | 12 ++---
>  drivers/video/atmel_hlcdfb.c  | 64 
> +--
>  32 files changed, 207 insertions(+), 209 deletions(-)
> 

Reviewed-by: Daniel Schwierzeck 

nits below

>  
> diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
> index dc743e113d..a39f9c5c86 100644
> --- a/drivers/net/ravb.c
> +++ b/drivers/net/ravb.c
> @@ -222,8 +222,8 @@ static int ravb_reset(struct udevice *dev)
>   writel(CCC_OPC_CONFIG, eth->iobase + RAVB_REG_CCC);
>  
>   /* Check the operating mode is changed to the config mode. */
> - return wait_for_bit(dev->name, (void *)eth->iobase + RAVB_REG_CSR,
> - CSR_OPS_CONFIG, true, 100, true);
> + return wait_for_bit_le32((void *)eth->iobase + RAVB_REG_CSR,
> +  CSR_OPS_CONFIG, true, 100, true);

the cast to (void *) is not necessary anymore

>  }
>  
>  static void ravb_base_desc_init(struct ravb_priv *eth)
> diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
> index 9a2a578ff9..55fa1e49d5 100644
> --- a/drivers/net/xilinx_axi_emac.c
> +++ b/drivers/net/xilinx_axi_emac.c
> @@ -366,8 +366,8 @@ static int axi_ethernet_init(struct axidma_priv *priv)
>* processor mode and hence bypass in this mode
>*/
>   if (!priv->eth_hasnobuf) {
> - err = wait_for_bit(__func__, (const u32 *)>is,
> -XAE_INT_MGTRDY_MASK, true, 200, false);
> + err = wait_for_bit_le32((const u32 *)>is,
> + XAE_INT_MGTRDY_MASK, true, 200, false);

the cast to (const u32 *) is not necessary anymore

>   if (err) {
>   printf("%s: Timeout\n", __func__);
>   return 1;


-- 
- Daniel



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


Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVK

2018-01-10 Thread Peng Fan
Hi Diego,

On Wed, Jan 10, 2018 at 11:08:54AM -0200, Diego Dorta wrote:
>Hi Peng,
>
>2018-01-10 3:20 GMT-02:00 Peng Fan :
>> This patchset is to add i.MX8M and i.MX8MQ-EVK support
>>
>> V5:
>>  Drop wait_mask_set/clr_timeout and switch to use readl_poll_timeout in
>>  the patchset.
>>
>> V4:
>>  Regenerate patchset based on Tom's master tree.
>>  In this patchset, https://patchwork.ozlabs.org/patch/855027/
>>  "arm: imx: Rework i.MX specific commands to be excluded from SPL" from
>>  Tom is included to avoid merge conflicts because the i.mx8m change
>>  also has some modification to bootaux and arch/arm/mach-imx/Makefile.
>>  Because CONFIG_GPT_TIMER change, I did a small modification to apply
>>  Tom's patch, no function change.
>>
>>  Include ATF link in README.
>>
>> V3:
>>  This patchset based on https://patchwork.ozlabs.org/patch/855027/
>>  "arm: imx: Rework i.MX specific commands to be excluded from SPL" from
>>  Tom to avoid this patchset fail apply after Tom's patch merged.
>>
>>  Previously "power: pmic/regulator allow dm be omited by SPL" broke other
>>  boards, in V3 patchset, only touch pfuze100 related options.
>>
>>  Sharing code about get mac from fuse between mx7/mx8m
>>  Sharing code about bootaux between mx6/7/mx8m
>>  Sharing code about cpu speed grade between mx7/mx8m
>>  Sharing code about get boot device between mx7/mx8m
>>  Sharding code about mmc env between mx7/mx8m
>>
>>  Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll 
>> configuration
>>
>>  Correct authorship of fix building warning on fec arm64, patch 27/31.
>>
>>  Switch to use structure for DDR Controller. For DDR PHY registers,
>>  there are about more than 10 thousands registers, I could not convert
>>  them with detailed register name, and the script is generated from IC team,
>>  So I use regs[0x] arrays here fo easily converting between IC team
>>  released script and uboot ddr phy cod.
>>
>>  Improve REAMME file to include where to download firmware and imx-mkimage
>>  and how to build
>>
>>  Add review tags on the V2 patchset.
>>
>>  Hope this patchset could catch up next release :)
>>
>> V2:
>>
>>  patch 02/23: convert to structure, drop is_boot_from_usb and
>>   disconnect_from_usb
>>  patch 04/23: conver to use structure for the clock driver, removed the
>>   CCM_xxx macros. Add static for local functons.
>>   Add init_usdhc_clk, init_uart_clk and etc to not enable
>>   them all at default.
>>  patch 05/23: Add more commit msg for the sip part.
>>  patch 08/23: Merge the spl boot device with i.MX7
>>  patch 12/23: Typo fix and return error fix from Heiko for the SoC related 
>> part
>>  patch 22/23: Use a weak function ddr_init. If patch 23/23 could not be
>>   accepted at current stage, to make others still be could be
>>   compiled.
>>
>> The patchset depends on
>> https://patchwork.ozlabs.org/patch/841934/
>> https://patchwork.ozlabs.org/patch/841958/
>> to be tested on real hardware.
>>
>> V1:
>>
>> patch: "power: pmic.h: include dm/ofnode.h" and
>> "power: pmic/regulator allow dm be omited by SPL" is previously reviewed
>> in mailist to not merged. If no issue, you may pick it up.
>>
>> The board support is a large patch because of the ddr related code.
>> If it is not good, please first review/pick-up other patches if they
>> are ok.
>>
>>
>>
>> Peng Fan (29):
>>   imx: add i.MX8M into Kconfig
>>   imx: mx8m: add register definition header file
>>   imx: mx8m: add pin header file
>>   imx: mx8m: add clock driver
>>   imx: add sip function
>>   imx: boot_mode: add USB_BOOT entry
>>   imx: cpu: update cpu file to support i.MX8M
>>   imx: spl: implement spl_boot_device for i.MX8M
>>   imx: add i.MX8MQ SoC Revision and is_mx8m helper
>>   imx: add pad settings bit definition for i.MX8M
>>   imx: cpu: move speed/temp to common cpu
>>   imx: cpu: add cpu speed/grade for i.MX8M
>>   imx: refactor imx_get_mac_from_fuse
>>   imx: cleanup bootaux
>>   imx: bootaux: support i.MX8M
>>   imx: mx7: move get_boot_device to cpu.c
>>   imx: cpu: support get_boot_device for i.MX8M
>>   imx: mx7: move mmc env code to mmc_env.c
>>   imx: mx8m: add soc related settings and files
>>   imx: makefile: compile files for i.MX8M
>>   misc: ocotp: add i.MX8M support
>>   mmc: fsl_esdhc: support i.MX8M
>>   imx: lcdif: include i.MX8M
>>   gpio: mxc: add i.MX8M support
>>   net: fec: do not access reserved register for i.MX8M
>>   imx: imx8mq: add dtsi file
>>   power: pmic/regulator allow dm be omitted by SPL
>>   imx: mx8m: add ddr controller memory map
>>   imx: add i.MX8MQ EVK support
>>
>> Tom Rini (1):
>>   arm: imx: Rework i.MX specific commands to be excluded from SPL
>
>Thanks for your V5 patches, this time I had no problem on compiling it.
>
>But, even following your README step by step, the U-Boot hangs
>completely on this point:
>
>U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
>PMIC:  PFUZE100 

Re: [U-Boot] [GIT PULL] ZFS: lundman/master

2018-01-10 Thread Jorgen Lundman
> 
> I'm reluctant to just take this as-is.  That's a lot of code changes in
> a single commit that was not posted (as far as I can see) to the mailing
> list.  Can you break that down into a series of changes that can be
> reviewed and post that?  Thanks!
> 

I received an email that ZFS U-boot booting was tricky to get to work,
since it required old pool version, and didn't work at all with big endian.

When I first did ZFS, I took the GRUB sources in 2012. So this time around,
I collected the commits from 2012 to now, and merged them into u-boot. Some
~50 commits or so. It makes U-boot work with modern pools, and current
default compression (lz4) as well as raidz/mirror boots.

It is a large change, I agree. But I'm unsure how to split it into smaller
commits. It is mostly bring it up to current with its upstream.

If it is preferred to post to the ML, I will do so - I thought "git pull"
was an alternate. Please advice,

Lund

-- 
Jorgen Lundman   | 
Unix Administrator   | +81 (0)90-5578-8500
Shibuya-ku, Tokyo| Japan

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


Re: [U-Boot] [PATCH] Makefile: ensure DTB doesn't overflow into initial stack

2018-01-10 Thread Stephen Warren

On 01/10/2018 04:04 PM, Simon Glass wrote:

On 9 January 2018 at 11:52, Stephen Warren  wrote:

With CONFIG_SYS_INIT_SP_BSS_OFFSET enabled, the initial (pre-relocation)
stack is placed some distance after bss_start. The control DTB is appended
to the U-Boot binary at bss_start. If the DTB is too large, or the SP BSS
offset too small, then the initial stack could corrupt the DTB. Enhance
the Makefile to check whether this is likely to occur.

...

Looking at the code here I wonder if it would be easy to check this in binman?


Well, considering it's already implemented in the Makefile, and quite 
simply, I'd have to say no:-)

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


Re: [U-Boot] [PATCH] Makefile: ensure DTB doesn't overflow into initial stack

2018-01-10 Thread Stephen Warren

On 01/10/2018 02:56 PM, Tom Warren wrote:

Stephen Warren wrote at Tuesday, January 9, 2018 12:52 PM:
> With CONFIG_SYS_INIT_SP_BSS_OFFSET enabled, the initial (pre-relocation)
> stack is placed some distance after bss_start. The control DTB is
> appended to the U-Boot binary at bss_start. If the DTB is too large, or
> the SP BSS offset too small, then the initial stack could corrupt the
> DTB. Enhance the Makefile to check whether this is likely to occur.
>
> Signed-off-by: Stephen Warren  --- This builds on
> top of my previous patch "ARMv8: Allow dynamic early stack pointer".
> However, since all the logic is conditional and only activated if
> CONFIG_SYS_INIT_SP_BSS_OFFSET is defined, it can be applied with or
> without that other patch. It'd make sense to apply it afterwards and in
> the same branch though, or the change won't make a lot of sense to
> someone reading history in order.

I've got this in my TOT u-boot-tegra/master, ready to send a PR to TomR.
But it's delegated to him in Patchwork.  Do you want me to remove it
from my PR, or leave it in?


From my perspective, either way is fine. Since you've already applied 
it, you may as well include it in your pull request.

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


Re: [U-Boot] [PATCH] Makefile: ensure DTB doesn't overflow into initial stack

2018-01-10 Thread Simon Glass
Hi Stephen,

On 9 January 2018 at 11:52, Stephen Warren  wrote:
>
> From: Stephen Warren 
>
> With CONFIG_SYS_INIT_SP_BSS_OFFSET enabled, the initial (pre-relocation)
> stack is placed some distance after bss_start. The control DTB is appended
> to the U-Boot binary at bss_start. If the DTB is too large, or the SP BSS
> offset too small, then the initial stack could corrupt the DTB. Enhance
> the Makefile to check whether this is likely to occur.
>
> Signed-off-by: Stephen Warren 
> ---
> This builds on top of my previous patch "ARMv8: Allow dynamic early stack
> pointer". However, since all the logic is conditional and only activated
> if CONFIG_SYS_INIT_SP_BSS_OFFSET is defined, it can be applied with or
> without that other patch. It'd make sense to apply it afterwards and in
> the same branch though, or the change won't make a lot of sense to someone
> reading history in order.
>
>  Makefile | 31 +++
>  1 file changed, 31 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index d8f419bcd900..52cd6ea72161 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -811,6 +811,10 @@ ifneq ($(CONFIG_BUILD_TARGET),)
>  ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
>  endif
>
> +ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
> +ALL-y += init_sp_bss_offset_check
> +endif
> +
>  LDFLAGS_u-boot += $(LDFLAGS_FINAL)
>
>  # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
> @@ -939,6 +943,33 @@ binary_size_check: u-boot-nodtb.bin FORCE
> fi \
> fi
>
> +ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
> +ifneq ($(CONFIG_SYS_MALLOC_F_LEN),)
> +subtract_sys_malloc_f_len = space=$$(($${space} - 
> $(CONFIG_SYS_MALLOC_F_LEN)))
> +else
> +subtract_sys_malloc_f_len = true
> +endif
> +# The 1/4 margin below is somewhat arbitrary. The likely initial SP usage is
> +# so low that the DTB could probably use 90%+ of the available space, for
> +# current values of CONFIG_SYS_INIT_SP_BSS_OFFSET at least. However, let's be
> +# safe for now and tweak this later if space becomes tight.
> +# A rejected alternative would be to check that some absolute minimum stack
> +# space was available. However, since CONFIG_SYS_INIT_SP_BSS_OFFSET is
> +# deliberately build-specific, to take account of build-to-build stack usage
> +# differences due to different feature sets, there is no common absolute 
> value
> +# to check against.
> +init_sp_bss_offset_check: u-boot.dtb FORCE
> +   @dtb_size=$(shell wc -c u-boot.dtb | awk '{print $$1}') ; \
> +   space=$(CONFIG_SYS_INIT_SP_BSS_OFFSET) ; \
> +   $(subtract_sys_malloc_f_len) ; \
> +   quarter_space=$$(($${space} / 4)) ; \
> +   if [ $${dtb_size} -gt $${quarter_space} ]; then \
> +   echo "u-boot.dtb is larger than 1 quarter of " >&2 ; \
> +   echo "(CONFIG_SYS_INIT_SP_BSS_OFFSET - 
> CONFIG_SYS_MALLOC_F_LEN)" >&2 ; \
> +   exit 1 ; \
> +   fi
> +endif
> +
>  u-boot-nodtb.bin: u-boot FORCE
> $(call if_changed,objcopy)
> $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
> --
> 2.15.1
>

Looking at the code here I wonder if it would be easy to check this in binman?

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


Re: [U-Boot] [PATCH] Makefile: ensure DTB doesn't overflow into initial stack

2018-01-10 Thread Tom Warren
Stephen,

-Original Message-
From: Stephen Warren [mailto:swar...@wwwdotorg.org] 
Sent: Tuesday, January 9, 2018 12:52 PM
To: u-boot@lists.denx.de; Simon Glass ; Tom Warren 
; Stephen Warren 
Cc: Tom Rini 
Subject: [PATCH] Makefile: ensure DTB doesn't overflow into initial stack

From: Stephen Warren 

With CONFIG_SYS_INIT_SP_BSS_OFFSET enabled, the initial (pre-relocation) stack 
is placed some distance after bss_start. The control DTB is appended to the 
U-Boot binary at bss_start. If the DTB is too large, or the SP BSS offset too 
small, then the initial stack could corrupt the DTB. Enhance the Makefile to 
check whether this is likely to occur.

Signed-off-by: Stephen Warren 
---
This builds on top of my previous patch "ARMv8: Allow dynamic early stack 
pointer". However, since all the logic is conditional and only activated if 
CONFIG_SYS_INIT_SP_BSS_OFFSET is defined, it can be applied with or without 
that other patch. It'd make sense to apply it afterwards and in the same branch 
though, or the change won't make a lot of sense to someone reading history in 
order.

I've got this in my TOT u-boot-tegra/master, ready to send a PR to TomR.  But 
it's delegated to him in Patchwork.  Do you want me to remove it from my PR, or 
leave it in?

Tom

 Makefile | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/Makefile b/Makefile
index d8f419bcd900..52cd6ea72161 100644
--- a/Makefile
+++ b/Makefile
@@ -811,6 +811,10 @@ ifneq ($(CONFIG_BUILD_TARGET),)  ALL-y += 
$(CONFIG_BUILD_TARGET:"%"=%)  endif
 
+ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
+ALL-y += init_sp_bss_offset_check
+endif
+
 LDFLAGS_u-boot += $(LDFLAGS_FINAL)
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
@@ -939,6 +943,33 @@ binary_size_check: u-boot-nodtb.bin FORCE
fi \
fi
 
+ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
+ifneq ($(CONFIG_SYS_MALLOC_F_LEN),)
+subtract_sys_malloc_f_len = space=$$(($${space} - 
+$(CONFIG_SYS_MALLOC_F_LEN))) else subtract_sys_malloc_f_len = true 
+endif # The 1/4 margin below is somewhat arbitrary. The likely initial 
+SP usage is # so low that the DTB could probably use 90%+ of the 
+available space, for # current values of CONFIG_SYS_INIT_SP_BSS_OFFSET 
+at least. However, let's be # safe for now and tweak this later if 
+space becomes tight.
+# A rejected alternative would be to check that some absolute minimum 
+stack # space was available. However, since 
+CONFIG_SYS_INIT_SP_BSS_OFFSET is # deliberately build-specific, to take 
+account of build-to-build stack usage # differences due to different 
+feature sets, there is no common absolute value # to check against.
+init_sp_bss_offset_check: u-boot.dtb FORCE
+   @dtb_size=$(shell wc -c u-boot.dtb | awk '{print $$1}') ; \
+   space=$(CONFIG_SYS_INIT_SP_BSS_OFFSET) ; \
+   $(subtract_sys_malloc_f_len) ; \
+   quarter_space=$$(($${space} / 4)) ; \
+   if [ $${dtb_size} -gt $${quarter_space} ]; then \
+   echo "u-boot.dtb is larger than 1 quarter of " >&2 ; \
+   echo "(CONFIG_SYS_INIT_SP_BSS_OFFSET - 
CONFIG_SYS_MALLOC_F_LEN)" >&2 ; \
+   exit 1 ; \
+   fi
+endif
+
 u-boot-nodtb.bin: u-boot FORCE
$(call if_changed,objcopy)
$(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
--
2.15.1
--
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] Relax check for valid environment in __hwconfig

2018-01-10 Thread Alexander Kabaev
The function only needs env_get to be functional, so check
the env_valid flag instead. There is no reason why this function
should not work if environment is available early, say by being
directly mapped in SPI.
---
 common/hwconfig.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/hwconfig.c b/common/hwconfig.c
index e5186d7796..4006aad59c 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -12,6 +12,7 @@
 #ifndef HWCONFIG_TEST
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -76,7 +77,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
 
/* if we are passed a buffer use it, otherwise try the environment */
if (!env_hwconfig) {
-   if (!(gd->flags & GD_FLG_ENV_READY)) {
+   if (gd->env_valid == ENV_INVALID) {
printf("WARNING: Calling __hwconfig without a buffer "
"and before environment is ready\n");
return NULL;
-- 
2.15.1

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


[U-Boot] [PATCH v7 13/13] mips: bmips: enable the SPI flash on the Netgear CG3100D

2018-01-10 Thread Álvaro Fernández Rojas
It's a Spansion (s25fl064a) 8 MB SPI flash.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: sync with master
 v4: switch to CONFIG_BCM63XX_SPI
 v3: no changes
 v2: remove spi alias

 arch/mips/dts/netgear,cg3100d.dts | 12 
 configs/netgear_cg3100d_ram_defconfig |  8 
 2 files changed, 20 insertions(+)

diff --git a/arch/mips/dts/netgear,cg3100d.dts 
b/arch/mips/dts/netgear,cg3100d.dts
index db1e2e7616..5f85c7346f 100644
--- a/arch/mips/dts/netgear,cg3100d.dts
+++ b/arch/mips/dts/netgear,cg3100d.dts
@@ -90,6 +90,18 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+
+   spi-flash@0 {
+   compatible = "spi-flash";
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   spi-max-frequency = <2500>;
+   };
+};
+
  {
u-boot,dm-pre-reloc;
status = "okay";
diff --git a/configs/netgear_cg3100d_ram_defconfig 
b/configs/netgear_cg3100d_ram_defconfig
index 7665c78d3f..369c919ac7 100644
--- a/configs/netgear_cg3100d_ram_defconfig
+++ b/configs/netgear_cg3100d_ram_defconfig
@@ -41,3 +41,11 @@ CONFIG_RESET_BCM6345=y
 CONFIG_DM_SERIAL=y
 CONFIG_BCM6345_SERIAL=y
 CONFIG_WDT_BCM6345=y
+CONFIG_BCM63XX_SPI=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPI_FLASH_SPANSION=y
-- 
2.11.0

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


[U-Boot] [PATCH v7 11/13] mips: bmips: add bcm63xx-spi driver support for BCM63268

2018-01-10 Thread Álvaro Fernández Rojas
This driver manages the low speed SPI controller present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: add spi alias

 arch/mips/dts/brcm,bcm63268.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm63268.dtsi b/arch/mips/dts/brcm,bcm63268.dtsi
index 113a96bef8..6e3d9c3820 100644
--- a/arch/mips/dts/brcm,bcm63268.dtsi
+++ b/arch/mips/dts/brcm,bcm63268.dtsi
@@ -13,6 +13,10 @@
 / {
compatible = "brcm,bcm63268";
 
+   aliases {
+   spi0 = 
+   };
+
cpus {
reg = <0x1000 0x4>;
#address-cells = <1>;
@@ -136,6 +140,19 @@
#power-domain-cells = <1>;
};
 
+   lsspi: spi@1800 {
+   compatible = "brcm,bcm6358-spi";
+   reg = <0x1800 0x70c>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <_clk BCM63268_CLK_SPI>;
+   resets = <_rst BCM63268_RST_SPI>;
+   spi-max-frequency = <2000>;
+   num-cs = <8>;
+
+   status = "disabled";
+   };
+
leds: led-controller@10001900 {
compatible = "brcm,bcm6328-leds";
reg = <0x10001900 0x24>;
-- 
2.11.0

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


[U-Boot] [PATCH v7 05/13] drivers: spi: consider command bytes when sending transfers

2018-01-10 Thread Álvaro Fernández Rojas
Command bytes are part of the written bytes and they should be taken into
account when sending a spi transfer.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: no changes
 v4: no changes
 v3: Fix bug introduced in v2: sizeof(cmd) vs len
 v2: Introduce changes requested by Simon Glass:
  - Always include command bytes when determining max write size.

 drivers/mtd/spi/spi_flash.c | 2 +-
 include/spi.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index e40e1c01de..294d9f9d79 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -405,7 +405,7 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 
offset,
 
if (spi->max_write_size)
chunk_len = min(chunk_len,
-   (size_t)spi->max_write_size);
+   spi->max_write_size - sizeof(cmd));
 
spi_flash_addr(write_addr, cmd);
 
diff --git a/include/spi.h b/include/spi.h
index 4787454e59..5a7df1c706 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -89,7 +89,7 @@ struct dm_spi_slave_platdata {
  * @max_read_size: If non-zero, the maximum number of bytes which can
  * be read at once.
  * @max_write_size:If non-zero, the maximum number of bytes which can
- * be written at once, excluding command bytes.
+ * be written at once.
  * @memory_map:Address of read-only SPI flash access.
  * @flags: Indication of SPI flags.
  */
-- 
2.11.0

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


[U-Boot] [PATCH v7 12/13] mips: bmips: enable the SPI flash on the Sagem F@ST1704

2018-01-10 Thread Álvaro Fernández Rojas
It's a Winbond (w25x32) 4 MB SPI flash.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: sync with master
 v4: switch to CONFIG_BCM63XX_SPI
 v3: rename BCM6338 SPI driver to BCM6348
 v2: remove spi alias

 arch/mips/dts/sagem,f...@st1704.dts | 12 
 configs/sagem_f@st1704_ram_defconfig |  8 
 2 files changed, 20 insertions(+)

diff --git a/arch/mips/dts/sagem,f...@st1704.dts 
b/arch/mips/dts/sagem,f...@st1704.dts
index be15fe5551..dd0e5b8b7c 100644
--- a/arch/mips/dts/sagem,f...@st1704.dts
+++ b/arch/mips/dts/sagem,f...@st1704.dts
@@ -44,6 +44,18 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+
+   spi-flash@0 {
+   compatible = "spi-flash";
+   reg = <0>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   spi-max-frequency = <2000>;
+   };
+};
+
  {
u-boot,dm-pre-reloc;
status = "okay";
diff --git a/configs/sagem_f@st1704_ram_defconfig 
b/configs/sagem_f@st1704_ram_defconfig
index cfc56cba37..5c091353e5 100644
--- a/configs/sagem_f@st1704_ram_defconfig
+++ b/configs/sagem_f@st1704_ram_defconfig
@@ -39,3 +39,11 @@ CONFIG_RESET_BCM6345=y
 # CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_DM_SERIAL=y
 CONFIG_BCM6345_SERIAL=y
+CONFIG_BCM63XX_SPI=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPI_FLASH_WINBOND=y
-- 
2.11.0

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


[U-Boot] [PATCH v7 04/13] drivers: spi: allow limiting reads

2018-01-10 Thread Álvaro Fernández Rojas
For some SPI controllers it's not possible to keep the CS active between
transfers and they are limited to a known number of bytes.
This splits spi_flash reads into different iterations in order to respect
the SPI controller limits.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: no changes

 drivers/mtd/spi/spi_flash.c | 3 +++
 include/spi.h   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 51e28bf07b..e40e1c01de 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -516,6 +516,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 
offset,
else
read_len = remain_len;
 
+   if (spi->max_read_size)
+   read_len = min(read_len, spi->max_read_size);
+
spi_flash_addr(read_addr, cmd);
 
ret = spi_flash_read_common(flash, cmd, cmdsz, data, read_len);
diff --git a/include/spi.h b/include/spi.h
index 08c7480fda..4787454e59 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -86,6 +86,8 @@ struct dm_spi_slave_platdata {
  * @cs:ID of the chip select connected to the slave.
  * @mode:  SPI mode to use for this slave (see SPI mode flags)
  * @wordlen:   Size of SPI word in number of bits
+ * @max_read_size: If non-zero, the maximum number of bytes which can
+ * be read at once.
  * @max_write_size:If non-zero, the maximum number of bytes which can
  * be written at once, excluding command bytes.
  * @memory_map:Address of read-only SPI flash access.
@@ -102,6 +104,7 @@ struct spi_slave {
 #endif
uint mode;
unsigned int wordlen;
+   unsigned int max_read_size;
unsigned int max_write_size;
void *memory_map;
 
-- 
2.11.0

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


[U-Boot] [PATCH v7 09/13] mips: bmips: add bcm63xx-spi driver support for BCM6358

2018-01-10 Thread Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: add spi alias

 arch/mips/dts/brcm,bcm6358.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6358.dtsi b/arch/mips/dts/brcm,bcm6358.dtsi
index 4f63cf80e0..1662783279 100644
--- a/arch/mips/dts/brcm,bcm6358.dtsi
+++ b/arch/mips/dts/brcm,bcm6358.dtsi
@@ -12,6 +12,10 @@
 / {
compatible = "brcm,bcm6358";
 
+   aliases {
+   spi0 = 
+   };
+
cpus {
reg = <0xfffe 0x4>;
#address-cells = <1>;
@@ -142,6 +146,19 @@
status = "disabled";
};
 
+   spi: spi@fffe0800 {
+   compatible = "brcm,bcm6358-spi";
+   reg = <0xfffe0800 0x70c>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <_clk BCM6358_CLK_SPI>;
+   resets = <_rst BCM6358_RST_SPI>;
+   spi-max-frequency = <2000>;
+   num-cs = <4>;
+
+   status = "disabled";
+   };
+
memory-controller@fffe1200 {
compatible = "brcm,bcm6358-mc";
reg = <0xfffe1200 0x4c>;
-- 
2.11.0

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


[U-Boot] [PATCH v7 08/13] mips: bmips: add bcm63xx-spi driver support for BCM6348

2018-01-10 Thread Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: no changes
 v4: no changes
 v3: rename BCM6338 SPI driver to BCM6348
 v2: add spi alias

 arch/mips/dts/brcm,bcm6348.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6348.dtsi b/arch/mips/dts/brcm,bcm6348.dtsi
index 711b643b5a..540b9fea5b 100644
--- a/arch/mips/dts/brcm,bcm6348.dtsi
+++ b/arch/mips/dts/brcm,bcm6348.dtsi
@@ -12,6 +12,10 @@
 / {
compatible = "brcm,bcm6348";
 
+   aliases {
+   spi0 = 
+   };
+
cpus {
reg = <0xfffe 0x4>;
#address-cells = <1>;
@@ -118,6 +122,19 @@
status = "disabled";
};
 
+   spi: spi@fffe0c00 {
+   compatible = "brcm,bcm6348-spi";
+   reg = <0xfffe0c00 0xc0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <_clk BCM6348_CLK_SPI>;
+   resets = <_rst BCM6348_RST_SPI>;
+   spi-max-frequency = <2000>;
+   num-cs = <4>;
+
+   status = "disabled";
+   };
+
memory-controller@fffe2300 {
compatible = "brcm,bcm6338-mc";
reg = <0xfffe2300 0x38>;
-- 
2.11.0

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


[U-Boot] [PATCH v7 02/13] wait_bit: use wait_for_bit_le32 instead of wait_for_bit

2018-01-10 Thread Álvaro Fernández Rojas
wait_for_bit callers use the 32 bit LE version

Signed-off-by: Álvaro Fernández Rojas 
---
 v7: Introduce changes suggested by Jagan Teki:
 - Remove wait_for_bit and update callers to wait_for_bit_le32.

 arch/arm/mach-imx/mx6/ddr.c   | 22 -
 arch/arm/mach-socfpga/clock_manager.c |  4 +-
 arch/arm/mach-socfpga/clock_manager_gen5.c|  8 ++--
 arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +++
 arch/mips/mach-ath79/ar934x/clk.c |  2 +-
 board/samtec/vining_2000/vining_2000.c|  4 +-
 drivers/clk/clk_pic32.c   | 12 ++---
 drivers/clk/renesas/clk-rcar-gen3.c   |  4 +-
 drivers/ddr/microchip/ddr2.c  |  8 ++--
 drivers/fpga/socfpga_arria10.c| 17 +++
 drivers/mmc/msm_sdhci.c   |  8 ++--
 drivers/mtd/pic32_flash.c |  4 +-
 drivers/net/ag7xxx.c  | 16 +++
 drivers/net/dwc_eth_qos.c | 17 +++
 drivers/net/ethoc.c   |  8 ++--
 drivers/net/pic32_eth.c   | 12 ++---
 drivers/net/pic32_mdio.c  | 28 ++--
 drivers/net/ravb.c|  4 +-
 drivers/net/xilinx_axi_emac.c |  4 +-
 drivers/net/zynq_gem.c| 12 ++---
 drivers/reset/sti-reset.c |  4 +-
 drivers/serial/serial_pic32.c |  4 +-
 drivers/spi/atmel_spi.c   |  4 +-
 drivers/spi/cadence_qspi_apb.c| 14 +++---
 drivers/spi/fsl_qspi.c| 20 -
 drivers/spi/mvebu_a3700_spi.c | 20 +
 drivers/usb/host/dwc2.c   | 24 +-
 drivers/usb/host/ehci-msm.c   |  3 +-
 drivers/usb/host/ehci-mx6.c   |  5 +--
 drivers/usb/host/ohci-lpc32xx.c   | 12 ++---
 drivers/usb/host/xhci-rcar.c  | 12 ++---
 drivers/video/atmel_hlcdfb.c  | 64 +--
 32 files changed, 207 insertions(+), 209 deletions(-)

diff --git a/arch/arm/mach-imx/mx6/ddr.c b/arch/arm/mach-imx/mx6/ddr.c
index 52a9a25904..f07f938c65 100644
--- a/arch/arm/mach-imx/mx6/ddr.c
+++ b/arch/arm/mach-imx/mx6/ddr.c
@@ -21,10 +21,10 @@ static void reset_read_data_fifos(void)
 
/* Reset data FIFOs twice. */
setbits_le32(>mpdgctrl0, 1 << 31);
-   wait_for_bit("MMDC", >mpdgctrl0, 1 << 31, 0, 100, 0);
+   wait_for_bit_le32(>mpdgctrl0, 1 << 31, 0, 100, 0);
 
setbits_le32(>mpdgctrl0, 1 << 31);
-   wait_for_bit("MMDC", >mpdgctrl0, 1 << 31, 0, 100, 0);
+   wait_for_bit_le32(>mpdgctrl0, 1 << 31, 0, 100, 0);
 }
 
 static void precharge_all(const bool cs0_enable, const bool cs1_enable)
@@ -39,12 +39,12 @@ static void precharge_all(const bool cs0_enable, const bool 
cs1_enable)
 */
if (cs0_enable) { /* CS0 */
writel(0x04008050, >mdscr);
-   wait_for_bit("MMDC", >mdscr, 1 << 14, 1, 100, 0);
+   wait_for_bit_le32(>mdscr, 1 << 14, 1, 100, 0);
}
 
if (cs1_enable) { /* CS1 */
writel(0x04008058, >mdscr);
-   wait_for_bit("MMDC", >mdscr, 1 << 14, 1, 100, 0);
+   wait_for_bit_le32(>mdscr, 1 << 14, 1, 100, 0);
}
 }
 
@@ -146,7 +146,7 @@ int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo 
const *sysinfo)
 * 7. Upon completion of this process the MMDC de-asserts
 * the MPWLGCR[HW_WL_EN]
 */
-   wait_for_bit("MMDC", >mpwlgcr, 1 << 0, 0, 100, 0);
+   wait_for_bit_le32(>mpwlgcr, 1 << 0, 0, 100, 0);
 
/*
 * 8. check for any errors: check both PHYs for x64 configuration,
@@ -278,7 +278,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const 
*sysinfo)
writel(0x8028, >mdscr);
 
/* poll to make sure the con_ack bit was asserted */
-   wait_for_bit("MMDC", >mdscr, 1 << 14, 1, 100, 0);
+   wait_for_bit_le32(>mdscr, 1 << 14, 1, 100, 0);
 
/*
 * Check MDMISC register CALIB_PER_CS to see which CS calibration
@@ -312,7 +312,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const 
*sysinfo)
 * this bit until it clears to indicate completion of the write access.
 */
setbits_le32(>mpswdar0, 1);
-   wait_for_bit("MMDC", >mpswdar0, 1 << 0, 0, 100, 0);
+   wait_for_bit_le32(>mpswdar0, 1 << 0, 0, 100, 0);
 
/* Set the RD_DL_ABS# bits to their default values
 * (will be calibrated later in the read delay-line calibration).
@@ -359,7 +359,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const 
*sysinfo)
setbits_le32(>mpdgctrl0, 5 << 28);
 
/* Poll for completion.  MPDGCTRL0[HW_DG_EN] should be 0 */
-   wait_for_bit("MMDC", >mpdgctrl0, 1 << 28, 0, 100, 0);
+   wait_for_bit_le32(>mpdgctrl0, 1 << 28, 0, 100, 0);
 

[U-Boot] [PATCH v7 10/13] mips: bmips: add bcm63xx-spi driver support for BCM3380

2018-01-10 Thread Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: no changes
 v4: no changes
 v3: no changes
 v2: add spi alias

 arch/mips/dts/brcm,bcm3380.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm3380.dtsi b/arch/mips/dts/brcm,bcm3380.dtsi
index 64245eb048..f83a6ea8df 100644
--- a/arch/mips/dts/brcm,bcm3380.dtsi
+++ b/arch/mips/dts/brcm,bcm3380.dtsi
@@ -12,6 +12,10 @@
 / {
compatible = "brcm,bcm3380";
 
+   aliases {
+   spi0 = 
+   };
+
cpus {
reg = <0x14e0 0x4>;
#address-cells = <1>;
@@ -142,6 +146,19 @@
status = "disabled";
};
 
+   spi: spi@14e02000 {
+   compatible = "brcm,bcm6358-spi";
+   reg = <0x14e02000 0x70c>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <_clk0 BCM3380_CLK0_SPI>;
+   resets = <_rst0 BCM3380_RST0_SPI>;
+   spi-max-frequency = <2500>;
+   num-cs = <6>;
+
+   status = "disabled";
+   };
+
leds: led-controller@14e00f00 {
compatible = "brcm,bcm6328-leds";
reg = <0x14e00f00 0x1c>;
-- 
2.11.0

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


[U-Boot] [PATCH v7 07/13] mips: bmips: add bcm63xx-spi driver support for BCM6338

2018-01-10 Thread Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: no changes
 v6: no changes
 v5: no changes
 v4: no changes
 v3: rename BCM6338 SPI driver to BCM6348
 v2: add spi alias

 arch/mips/dts/brcm,bcm6338.dtsi | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6338.dtsi b/arch/mips/dts/brcm,bcm6338.dtsi
index eb51a4372b..0cab44cb8d 100644
--- a/arch/mips/dts/brcm,bcm6338.dtsi
+++ b/arch/mips/dts/brcm,bcm6338.dtsi
@@ -12,6 +12,10 @@
 / {
compatible = "brcm,bcm6338";
 
+   aliases {
+   spi0 = 
+   };
+
cpus {
reg = <0xfffe 0x4>;
#address-cells = <1>;
@@ -109,6 +113,19 @@
status = "disabled";
};
 
+   spi: spi@fffe0c00 {
+   compatible = "brcm,bcm6348-spi";
+   reg = <0xfffe0c00 0xc0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <_clk BCM6338_CLK_SPI>;
+   resets = <_rst BCM6338_RST_SPI>;
+   spi-max-frequency = <2000>;
+   num-cs = <4>;
+
+   status = "disabled";
+   };
+
memory-controller@fffe3100 {
compatible = "brcm,bcm6338-mc";
reg = <0xfffe3100 0x38>;
-- 
2.11.0

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


[U-Boot] [PATCH v7 03/13] wait_bit: remove old wait_for_bit function

2018-01-10 Thread Álvaro Fernández Rojas
Since wait_for_bit callers have been updated to use wait_for_bit_le32,
wait_for_bit is no longer needed.

Signed-off-by: Álvaro Fernández Rojas 
---
 v7: Introduce changes suggested by Jagan Teki:
 - Remove wait_for_bit and update callers to wait_for_bit_le32.

 include/wait_bit.h | 54 --
 1 file changed, 54 deletions(-)

diff --git a/include/wait_bit.h b/include/wait_bit.h
index bde6d2cfc3..9f00e54e50 100644
--- a/include/wait_bit.h
+++ b/include/wait_bit.h
@@ -16,60 +16,6 @@
 #include 
 
 /**
- * wait_for_bit()  waits for bit set/cleared in register
- *
- * Function polls register waiting for specific bit(s) change
- * (either 0->1 or 1->0). It can fail under two conditions:
- * - Timeout
- * - User interaction (CTRL-C)
- * Function succeeds only if all bits of masked register are set/cleared
- * (depending on set option).
- *
- * @param prefix   Prefix added to timeout messagge (message visible only
- * with debug enabled)
- * @param reg  Register that will be read (using readl())
- * @param mask Bit(s) of register that must be active
- * @param set  Selects wait condition (bit set or clear)
- * @param timeout_ms   Timeout (in miliseconds)
- * @param breakableEnables CTRL-C interruption
- * @return 0 on success, -ETIMEDOUT or -EINTR on failure
- */
-static inline int wait_for_bit(const char *prefix, const u32 *reg,
-  const u32 mask, const bool set,
-  const unsigned int timeout_ms,
-  const bool breakable)
-{
-   u32 val;
-   unsigned long start = get_timer(0);
-
-   while (1) {
-   val = readl(reg);
-
-   if (!set)
-   val = ~val;
-
-   if ((val & mask) == mask)
-   return 0;
-
-   if (get_timer(start) > timeout_ms)
-   break;
-
-   if (breakable && ctrlc()) {
-   puts("Abort\n");
-   return -EINTR;
-   }
-
-   udelay(1);
-   WATCHDOG_RESET();
-   }
-
-   debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n", prefix, reg, mask,
- set);
-
-   return -ETIMEDOUT;
-}
-
-/**
  * wait_for_bit_x()waits for bit set/cleared in register
  *
  * Function polls register waiting for specific bit(s) change
-- 
2.11.0

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


[U-Boot] [PATCH v7 06/13] dm: spi: add BCM63xx SPI driver

2018-01-10 Thread Álvaro Fernández Rojas
This driver is a simplified version of linux/drivers/spi/spi-bcm63xx.c

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Jagan Teki 
---
 v7: Introduce changes suggested by Daniel Schwierzeck:
 - Remove prefix and use __func__ instead.
 v6: Introduce changes suggested by Jagan Teki:
 - Use cmd instead of val to avoid confusions.
 - Switch to wait_for_bit instead of infinite loop.
 v5: Introduce changes suggested by Jagan Teki:
  - Use long structure instead of a custom bmips_spi_hw structure.
  - Define constants for each SPI core.
 v4: Introduce changes suggested by Jagan Teki:
  - Add data for each HW controller instead of having two separate configs.
  - Also check clock and reset returns as suggested by Simon Glass for HSSPI.
 v3: rename BCM6338 SPI driver to BCM6348
  switch to devfdt_get_addr_size_index()
 v2: no changes

 drivers/spi/Kconfig   |   8 +
 drivers/spi/Makefile  |   1 +
 drivers/spi/bcm63xx_spi.c | 433 ++
 3 files changed, 442 insertions(+)
 create mode 100644 drivers/spi/bcm63xx_spi.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 494639fb01..ebc71c2e42 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -40,6 +40,14 @@ config ATMEL_SPI
  many AT91 (ARM) chips. This driver can be used to access
  the SPI Flash, such as AT25DF321.
 
+config BCM63XX_SPI
+   bool "BCM6348 SPI driver"
+   depends on ARCH_BMIPS
+   help
+ Enable the BCM6348/BCM6358 SPI driver. This driver can be used to
+ access the SPI NOR flash on platforms embedding these Broadcom
+ SPI cores.
+
 config CADENCE_QSPI
bool "Cadence QSPI driver"
help
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index e3184db67f..5770b3f7cc 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -18,6 +18,7 @@ endif
 obj-$(CONFIG_ALTERA_SPI) += altera_spi.o
 obj-$(CONFIG_ATH79_SPI) += ath79_spi.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
+obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c
new file mode 100644
index 00..f0df6871d8
--- /dev/null
+++ b/drivers/spi/bcm63xx_spi.c
@@ -0,0 +1,433 @@
+/*
+ * Copyright (C) 2017 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/spi/spi-bcm63xx.c:
+ * Copyright (C) 2009-2012 Florian Fainelli 
+ * Copyright (C) 2010 Tanguy Bouzeloc 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* BCM6348 SPI core */
+#define SPI_6348_CLK   0x06
+#define SPI_6348_CMD   0x00
+#define SPI_6348_CTL   0x40
+#define SPI_6348_CTL_SHIFT 6
+#define SPI_6348_FILL  0x07
+#define SPI_6348_IR_MASK   0x04
+#define SPI_6348_IR_STAT   0x02
+#define SPI_6348_RX0x80
+#define SPI_6348_RX_SIZE   0x3f
+#define SPI_6348_TX0x41
+#define SPI_6348_TX_SIZE   0x3f
+
+/* BCM6358 SPI core */
+#define SPI_6358_CLK   0x706
+#define SPI_6358_CMD   0x700
+#define SPI_6358_CTL   0x000
+#define SPI_6358_CTL_SHIFT 14
+#define SPI_6358_FILL  0x707
+#define SPI_6358_IR_MASK   0x702
+#define SPI_6358_IR_STAT   0x704
+#define SPI_6358_RX0x400
+#define SPI_6358_RX_SIZE   0x220
+#define SPI_6358_TX0x002
+#define SPI_6358_TX_SIZE   0x21e
+
+/* SPI Clock register */
+#define SPI_CLK_SHIFT  0
+#define SPI_CLK_20MHZ  (0 << SPI_CLK_SHIFT)
+#define SPI_CLK_0_391MHZ   (1 << SPI_CLK_SHIFT)
+#define SPI_CLK_0_781MHZ   (2 << SPI_CLK_SHIFT)
+#define SPI_CLK_1_563MHZ   (3 << SPI_CLK_SHIFT)
+#define SPI_CLK_3_125MHZ   (4 << SPI_CLK_SHIFT)
+#define SPI_CLK_6_250MHZ   (5 << SPI_CLK_SHIFT)
+#define SPI_CLK_12_50MHZ   (6 << SPI_CLK_SHIFT)
+#define SPI_CLK_25MHZ  (7 << SPI_CLK_SHIFT)
+#define SPI_CLK_MASK   (7 << SPI_CLK_SHIFT)
+#define SPI_CLK_SSOFF_SHIFT3
+#define SPI_CLK_SSOFF_2(2 << SPI_CLK_SSOFF_SHIFT)
+#define SPI_CLK_SSOFF_MASK (7 << SPI_CLK_SSOFF_SHIFT)
+#define SPI_CLK_BSWAP_SHIFT7
+#define SPI_CLK_BSWAP_MASK (1 << SPI_CLK_BSWAP_SHIFT)
+
+/* SPI Command register */
+#define SPI_CMD_OP_SHIFT   0
+#define SPI_CMD_OP_START   (0x3 << SPI_CMD_OP_SHIFT)
+#define SPI_CMD_SLAVE_SHIFT4
+#define SPI_CMD_SLAVE_MASK (0xf << SPI_CMD_SLAVE_SHIFT)
+#define 

[U-Boot] [PATCH v7 00/13] mips: bmips: add SPI support

2018-01-10 Thread Álvaro Fernández Rojas
BCM63xx SPI controller is a bit tricky since it doesn't allow keeping CS
active between transfers, so I had to modify the spi_flash driver in order
to allow limiting reads.

v7: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Use const void* reg for compatibility with 64 bit systems.
- Remove prefix and use __func__ instead.
- Remove wait_for_bit and update callers to wait_for_bit_le32.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch to wait_for_bit instead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structs for registers
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
v3: Fix bug introduced in v2: sizeof(cmd) vs len.
Also rename BCM6338 SPI driver to BCM6348 SPI since BCM6338 is a stripped
down version of the BCM6348.
Switch to devfdt_get_addr_size_index().
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size.
Also move SPI aliases from .dts to .dtsi files.

Álvaro Fernández Rojas (13):
  wait_bit: add 8/16/32 BE/LE versions of wait_for_bit
  wait_bit: use wait_for_bit_le32 instead of wait_for_bit
  wait_bit: remove old wait_for_bit function
  drivers: spi: allow limiting reads
  drivers: spi: consider command bytes when sending transfers
  dm: spi: add BCM63xx SPI driver
  mips: bmips: add bcm63xx-spi driver support for BCM6338
  mips: bmips: add bcm63xx-spi driver support for BCM6348
  mips: bmips: add bcm63xx-spi driver support for BCM6358
  mips: bmips: add bcm63xx-spi driver support for BCM3380
  mips: bmips: add bcm63xx-spi driver support for BCM63268
  mips: bmips: enable the SPI flash on the Sagem F@ST1704
  mips: bmips: enable the SPI flash on the Netgear CG3100D

 arch/arm/mach-imx/mx6/ddr.c   |  22 +-
 arch/arm/mach-socfpga/clock_manager.c |   4 +-
 arch/arm/mach-socfpga/clock_manager_gen5.c|   8 +-
 arch/arm/mach-socfpga/reset_manager_arria10.c |  36 +--
 arch/mips/dts/brcm,bcm3380.dtsi   |  17 +
 arch/mips/dts/brcm,bcm63268.dtsi  |  17 +
 arch/mips/dts/brcm,bcm6338.dtsi   |  17 +
 arch/mips/dts/brcm,bcm6348.dtsi   |  17 +
 arch/mips/dts/brcm,bcm6358.dtsi   |  17 +
 arch/mips/dts/netgear,cg3100d.dts |  12 +
 arch/mips/dts/sagem,f...@st1704.dts  |  12 +
 arch/mips/mach-ath79/ar934x/clk.c |   2 +-
 board/samtec/vining_2000/vining_2000.c|   4 +-
 configs/netgear_cg3100d_ram_defconfig |   8 +
 configs/sagem_f@st1704_ram_defconfig  |   8 +
 drivers/clk/clk_pic32.c   |  12 +-
 drivers/clk/renesas/clk-rcar-gen3.c   |   4 +-
 drivers/ddr/microchip/ddr2.c  |   8 +-
 drivers/fpga/socfpga_arria10.c|  17 +-
 drivers/mmc/msm_sdhci.c   |   8 +-
 drivers/mtd/pic32_flash.c |   4 +-
 drivers/mtd/spi/spi_flash.c   |   5 +-
 drivers/net/ag7xxx.c  |  16 +-
 drivers/net/dwc_eth_qos.c |  17 +-
 drivers/net/ethoc.c   |   8 +-
 drivers/net/pic32_eth.c   |  12 +-
 drivers/net/pic32_mdio.c  |  28 +-
 drivers/net/ravb.c|   4 +-
 drivers/net/xilinx_axi_emac.c |   4 +-
 drivers/net/zynq_gem.c|  12 +-
 drivers/reset/sti-reset.c |   4 +-
 drivers/serial/serial_pic32.c |   4 +-
 drivers/spi/Kconfig   |   8 +
 drivers/spi/Makefile  |   1 +
 drivers/spi/atmel_spi.c   |   4 +-
 drivers/spi/bcm63xx_spi.c | 433 ++
 drivers/spi/cadence_qspi_apb.c|  14 +-
 drivers/spi/fsl_qspi.c|  20 +-
 drivers/spi/mvebu_a3700_spi.c |  20 +-
 drivers/usb/host/dwc2.c   |  24 +-
 drivers/usb/host/ehci-msm.c   |   3 +-
 drivers/usb/host/ehci-mx6.c   |   5 +-
 drivers/usb/host/ohci-lpc32xx.c   |  12 +-
 drivers/usb/host/xhci-rcar.c  |  12 +-
 drivers/video/atmel_hlcdfb.c  |  64 ++--
 include/spi.h |   5 +-
 include/wait_bit.h|  81 ++---
 47 files changed, 826 insertions(+), 248 deletions(-)
 create mode 100644 drivers/spi/bcm63xx_spi.c

-- 
2.11.0

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


[U-Boot] [PATCH v7 01/13] wait_bit: add 8/16/32 BE/LE versions of wait_for_bit

2018-01-10 Thread Álvaro Fernández Rojas
Add 8/16/32 bits and BE/LE versions of wait_for_bit.
This is needed for reading registers that are not aligned to 32 bits, and for
Big Endian platforms.

Signed-off-by: Álvaro Fernández Rojas 
---
 v7: Introduce changes suggested by Daniel Schwierzeck:
 - Use const void* reg for compatibility with 64 bit systems.
 - Remove prefix and use __func__ instead.
 v6: Introduce changes suggested by Jagan Teki:
 - Switch to wait_for_bit instead of infinite loop.

 include/wait_bit.h | 61 ++
 1 file changed, 61 insertions(+)

diff --git a/include/wait_bit.h b/include/wait_bit.h
index 06ad43a122..bde6d2cfc3 100644
--- a/include/wait_bit.h
+++ b/include/wait_bit.h
@@ -69,5 +69,66 @@ static inline int wait_for_bit(const char *prefix, const u32 
*reg,
return -ETIMEDOUT;
 }
 
+/**
+ * wait_for_bit_x()waits for bit set/cleared in register
+ *
+ * Function polls register waiting for specific bit(s) change
+ * (either 0->1 or 1->0). It can fail under two conditions:
+ * - Timeout
+ * - User interaction (CTRL-C)
+ * Function succeeds only if all bits of masked register are set/cleared
+ * (depending on set option).
+ *
+ * @param reg  Register that will be read (using read_x())
+ * @param mask Bit(s) of register that must be active
+ * @param set  Selects wait condition (bit set or clear)
+ * @param timeout_ms   Timeout (in milliseconds)
+ * @param breakableEnables CTRL-C interruption
+ * @return 0 on success, -ETIMEDOUT or -EINTR on failure
+ */
+
+#define BUILD_WAIT_FOR_BIT(sfx, type, read)\
+   \
+static inline int wait_for_bit_##sfx(const void *reg,  \
+const type mask,   \
+const bool set,\
+const unsigned int timeout_ms, \
+const bool breakable)  \
+{  \
+   type val;   \
+   unsigned long start = get_timer(0); \
+   \
+   while (1) { \
+   val = read(reg);\
+   \
+   if (!set)   \
+   val = ~val; \
+   \
+   if ((val & mask) == mask)   \
+   return 0;   \
+   \
+   if (get_timer(start) > timeout_ms)  \
+   break;  \
+   \
+   if (breakable && ctrlc()) { \
+   puts("Abort\n");\
+   return -EINTR;  \
+   }   \
+   \
+   udelay(1);  \
+   WATCHDOG_RESET();   \
+   }   \
+   \
+   debug("%s: Timeout (reg=%p mask=%x wait_set=%i)\n", __func__,   \
+ reg, mask, set);  \
+   \
+   return -ETIMEDOUT;  \
+}
+
+BUILD_WAIT_FOR_BIT(8, u8, readb)
+BUILD_WAIT_FOR_BIT(le16, u16, readw)
+BUILD_WAIT_FOR_BIT(be16, u16, readw_be)
+BUILD_WAIT_FOR_BIT(le32, u32, readl)
+BUILD_WAIT_FOR_BIT(be32, u32, readl_be)
 
 #endif
-- 
2.11.0

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


[U-Boot] [PATCH v2] Relax check for valid environment in __hwconfig

2018-01-10 Thread Alexander Kabaev
Previous one was sent from WIP tree.

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


[U-Boot] [PATCH] Relax check for valid environment in __hconfig

2018-01-10 Thread Alexander Kabaev
The function only needs env_get to be functional, so check
do env_valid flag instead. There is no reason why this function
should not work if environment is available early.
---
 common/hwconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/hwconfig.c b/common/hwconfig.c
index e5186d7796..d7aed7b31a 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -76,7 +76,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
 
/* if we are passed a buffer use it, otherwise try the environment */
if (!env_hwconfig) {
-   if (!(gd->flags & GD_FLG_ENV_READY)) {
+   if (gd->env_valid != ENV_INVALID) {
printf("WARNING: Calling __hwconfig without a buffer "
"and before environment is ready\n");
return NULL;
-- 
2.15.1

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


[U-Boot] [PATCHv2 14/15] configs: ge_bx50v3: automatic partition selection and video output failure message

2018-01-10 Thread Sebastian Reichel
From: Ian Ray 

The exact definition of a successful boot is defined by user-space.
Determine the boot partition automatically.  A partition is selected if
file `/boot/bootcause/firstboot' exists (meaning that the partition has
freshly installed software) OR if file `/boot/fitImage' exists.

When userspace determines that new software was successfully installed,
it must (1) delete `/boot/fitImage' on the _inactive_ partition and (2)
remove `/boot/bootcause/firstboot'.

Enable video, but do not display logos or other version information.
Silence kernel console logging by default.

Print a message to VGA screen in case of boot failure and reset bootcount
to allow the user to attempt boot again.

Signed-off-by: Ian Ray 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 include/configs/ge_bx50v3.h | 82 +
 1 file changed, 53 insertions(+), 29 deletions(-)

diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index e006485dc659..6078681c7cbb 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -109,39 +109,62 @@
 #define CONFIG_SYS_TEXT_BASE   0x1780
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
-   "script=boot.scr\0" \
+   "bootcause=POR\0" \
"bootlimit=10\0" \
"image=/boot/fitImage\0" \
+   "fdt_high=0x\0" \
+   "dev=mmc\0" \
+   "devnum=1\0" \
+   "rootdev=mmcblk0p\0" \
+   "quiet=quiet loglevel=0\0" \
"console=" CONSOLE_DEV "\0" \
-   "fdt_high=0x\0"   \
-   "sddev=0\0" \
-   "emmcdev=1\0" \
-   "partnum=1\0" \
-   "setargs=setenv bootargs console=${console},${baudrate} " \
-   "root=/dev/${rootdev} ro rootwait cma=128M " \
+   "setargs=setenv bootargs root=/dev/${rootdev}${partnum} " \
+   "ro rootwait cma=128M " \
+   "bootcause=${bootcause} " \
+   "${quiet} console=${console} " \
BX50V3_BOOTARGS_EXTRA "\0" \
+   "doquiet=" \
+   "if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
+   "then setenv quiet; fi\0" \
+   "hasfirstboot=" \
+   "ext2load ${dev} ${devnum}:${partnum} 0x7000A000 " \
+   "/boot/bootcause/firstboot\0" \
+   "swappartitions=" \
+   "setexpr partnum 3 - ${partnum}\0" \
+   "failbootcmd=" \
+   "msg=\"Monitor failed to start.  Try again, or contact GE 
Service for support.\"; " \
+   "echo $msg; " \
+   "setenv stdout vga; " \
+   "echo \"\n\n\n\n\" $msg; " \
+   "setenv stdout serial; " \
+   "mw.b 0x7000A000 0xbc; " \
+   "mw.b 0x7000A001 0x00; " \
+   "ext4write ${dev} ${devnum}:5 0x7000A000 /boot/failures 2\0" \
+   "altbootcmd=" \
+   "run doquiet; " \
+   "setenv partnum 1; run hasfirstboot || setenv partnum 2; " \
+   "run hasfirstboot || setenv partnum 0; " \
+   "if test ${partnum} != 0; then " \
+   "setenv bootcause REVERT; " \
+   "run swappartitions loadimage doboot; " \
+   "fi; " \
+   "run failbootcmd\0" \
"loadimage=" \
"ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \
-   "tryboot=" \
-   "if run loadimage; then " \
-   "run doboot; " \
-   "fi;\0" \
-   "doboot=echo Booting from ${dev}:${devnum}:${partnum} ...; " \
+   "doboot=" \
+   "echo Booting from ${dev}:${devnum}:${partnum} ...; " \
"run setargs; " \
-   "bootm ${loadaddr}#conf@${confidx};\0 " \
+   "bootm ${loadaddr}#conf@${confidx}\0" \
+   "tryboot=" \
+   "setenv partnum 1; run hasfirstboot || setenv partnum 2; " \
+   "run loadimage || run swappartitions && run loadimage || " \
+   "setenv partnum 0 && echo MISSING IMAGE;" \
+   "run doboot; " \
+   "run failbootcmd\0" \
 
 #define CONFIG_MMCBOOTCOMMAND \
-   "setenv dev mmc; " \
-   "setenv devnum ${emmcdev}; " \
-   \
-   "if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/active/boot.img ; " \
-   "then " \
-   "source 0x7000A000; " \
-   "fi; " \
-   \
-   "setenv rootdev mmcblk0p${partnum}; " \
-   \
"if mmc dev ${devnum}; then " \
+   "run doquiet; " \
"run tryboot; " \
"fi; " \
 
@@ -196,16 +219,17 @@
 #define CONFIG_SYS_FSL_USDHC_NUM   3
 
 /* Framebuffer */
+#define CONFIG_VIDEO
 #ifdef CONFIG_VIDEO
 #define CONFIG_VIDEO_IPUV3
-#define CONFIG_VIDEO_BMP_RLE8
-#define CONFIG_SPLASH_SCREEN
-#define CONFIG_SPLASH_SCREEN_ALIGN
-#define CONFIG_BMP_16BPP
-#define CONFIG_VIDEO_LOGO
-#define 

[U-Boot] [PATCHv2 09/15] board: ge: bx50v3: Enable hardware watchdog

2018-01-10 Thread Sebastian Reichel
From: Martyn Welch 

Enable the hardware watchdog on bx50v3 to cause it to reset in the event
the board hangs.

Configure GPIO_9 pin as WDOG1_B so that a watchdog timeout results in a
full system reset.

The watchdog is used and reconfigured by systemd approximately 1.7 seconds
into boot. Adding a few seconds for U-Boot and a few more seconds as a
safety margin.

Note that the PCIe controller is _not_ put back into a safe state prior
to board reset.  This is a problem if board reset is implemented as CPU
reset.

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

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 07b42988e4eb..48c26e0f9fa5 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -659,6 +659,7 @@ static iomux_v3_cfg_t const misc_pads[] = {
MX6_PAD_EIM_OE__GPIO2_IO25  | MUX_PAD_CTRL(NC_PAD_CTRL),
MX6_PAD_EIM_BCLK__GPIO6_IO31| MUX_PAD_CTRL(NC_PAD_CTRL),
MX6_PAD_GPIO_1__GPIO1_IO01  | MUX_PAD_CTRL(NC_PAD_CTRL),
+   MX6_PAD_GPIO_9__WDOG1_B | MUX_PAD_CTRL(NC_PAD_CTRL),
 };
 #define SUS_S3_OUT IMX_GPIO_NR(4, 11)
 #define WIFI_ENIMX_GPIO_NR(6, 14)
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 4ae1b158fb9e..cc067ccee657 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -44,6 +44,10 @@
 #define CONFIG_REVISION_TAG
 #define CONFIG_SYS_MALLOC_LEN  (10 * SZ_1M)
 
+#define CONFIG_HW_WATCHDOG
+#define CONFIG_IMX_WATCHDOG
+#define CONFIG_WATCHDOG_TIMEOUT_MSECS 6000
+
 #define CONFIG_LAST_STAGE_INIT
 
 #define CONFIG_MXC_GPIO
-- 
2.15.1

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


[U-Boot] [PATCHv2 13/15] board: ge: bx50v3: mount rootfs read-only

2018-01-10 Thread Sebastian Reichel
From: Hannu Lounento 

Change the kernel command line to mount the root filesystem read-only in
order to be able to run filesystem check on it on boot.

Signed-off-by: Hannu Lounento 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 include/configs/ge_bx50v3.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index efea303393a0..e006485dc659 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -118,7 +118,7 @@
"emmcdev=1\0" \
"partnum=1\0" \
"setargs=setenv bootargs console=${console},${baudrate} " \
-   "root=/dev/${rootdev} rw rootwait cma=128M " \
+   "root=/dev/${rootdev} ro rootwait cma=128M " \
BX50V3_BOOTARGS_EXTRA "\0" \
"loadimage=" \
"ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \
-- 
2.15.1

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


[U-Boot] [PATCHv2 07/15] board: ge: bx50v3: move FEC MAC address programming to driver

2018-01-10 Thread Sebastian Reichel
From: Martyn Welch 

Instead of programming the hardware directly in the board
implementation, follow the flow documented in doc/README.enetaddr: set
the enet[0-9]*addr environment variable and let the driver program the
hardware.

This avoids duplicating the implementation as it already exists in the
driver (drivers/net/fec_mxc.c: fec_set_hwaddr).

The mapping from the driver's index to the environment variable's name
is documented in README: Note for Redundant Ethernet Interfaces. It is
assumed that eth_devices for the controllers on the board are always
indexed in the same order, i.e. FEC always has the index 2.

The FEC driver does *not* set the flag Set MAC Address on Transmit (bit
set_eth0_mac_address used to do but this is unnecessary as the Linux
networking stack fills in the MAC address.

Signed-off-by: Hannu Lounento 
Signed-off-by: Ian Ray 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c| 79 ++---
 include/configs/ge_bx50v3.h |  2 ++
 2 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index cb4deb043406..0468dcfa8e26 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -546,63 +547,54 @@ int overwrite_console(void)
 #define VPD_PRODUCT_B850 1
 #define VPD_PRODUCT_B650 2
 #define VPD_PRODUCT_B450 3
+#define VPD_HAS_MAC1 0x1
+#define VPD_MAC_ADDRESS_LENGTH 6
 
 struct vpd_cache {
-   uint8_t product_id;
-   uint8_t macbits;
-   unsigned char mac1[6];
+   u8 product_id;
+   u8 has;
+   unsigned char mac1[VPD_MAC_ADDRESS_LENGTH];
 };
 
 /*
  * Extracts MAC and product information from the VPD.
  */
-static int vpd_callback(
-   void *userdata,
-   uint8_t id,
-   uint8_t version,
-   uint8_t type,
-   size_t size,
-   uint8_t const *data)
+static int vpd_callback(void *userdata, u8 id, u8 version, u8 type,
+   size_t size, u8 const *data)
 {
struct vpd_cache *vpd = (struct vpd_cache *)userdata;
 
-   if (   id == VPD_BLOCK_HWID
-   && version == 1
-   && type != VPD_TYPE_INVALID
-   && size >= 1) {
+   if (id == VPD_BLOCK_HWID && version == 1 && type != VPD_TYPE_INVALID &&
+   size >= 1) {
vpd->product_id = data[0];
-
-   } else if (   id == VPD_BLOCK_NETWORK
-  && version == 1
-  && type != VPD_TYPE_INVALID
-  && size >= 6) {
-   vpd->macbits |= 1;
-   memcpy(vpd->mac1, data, 6);
+   } else if (id == VPD_BLOCK_NETWORK && version == 1 &&
+  type != VPD_TYPE_INVALID) {
+   if (size >= 6) {
+   vpd->has |= VPD_HAS_MAC1;
+   memcpy(vpd->mac1, data, VPD_MAC_ADDRESS_LENGTH);
+   }
}
 
return 0;
 }
 
-static void set_eth0_mac_address(unsigned char * mac)
-{
-   uint32_t *ENET_TCR = (uint32_t*)0x21880c4;
-   uint32_t *ENET_PALR = (uint32_t*)0x21880e4;
-   uint32_t *ENET_PAUR = (uint32_t*)0x21880e8;
-
-   *ENET_TCR |= 0x100;  /* ADDINS */
-   *ENET_PALR |= (mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3];
-   *ENET_PAUR |= (mac[4] << 24) | (mac[5] << 16);
-}
-
 static void process_vpd(struct vpd_cache *vpd)
 {
-   if (   vpd->product_id == VPD_PRODUCT_B850
-   || vpd->product_id == VPD_PRODUCT_B650
-   || vpd->product_id == VPD_PRODUCT_B450) {
-   if (vpd->macbits & 1) {
-   set_eth0_mac_address(vpd->mac1);
-   }
+   int fec_index = -1;
+
+   switch (vpd->product_id) {
+   case VPD_PRODUCT_B450:
+   /* fall thru */
+   case VPD_PRODUCT_B650:
+   fec_index = 1;
+   break;
+   case VPD_PRODUCT_B850:
+   fec_index = 2;
+   break;
}
+
+   if (fec_index >= 0 && (vpd->has & VPD_HAS_MAC1))
+   eth_env_set_enetaddr_by_index("eth", fec_index, vpd->mac1);
 }
 
 static int read_vpd(uint eeprom_bus)
@@ -694,8 +686,6 @@ int board_init(void)
setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info2);
setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, _pad_info3);
 
-   read_vpd(CONFIG_SYS_I2C_EEPROM_BUS);
-
return 0;
 }
 
@@ -761,6 +751,8 @@ void pmic_init(void)
 
 int board_late_init(void)
 {
+   read_vpd(CONFIG_SYS_I2C_EEPROM_BUS);
+
 #ifdef CONFIG_CMD_BMODE
add_board_boot_modes(board_boot_modes);
 #endif
@@ -788,6 +780,13 @@ int board_late_init(void)
return 0;
 }
 
+int last_stage_init(void)
+{
+   env_set("ethaddr", NULL);
+
+   return 0;
+}
+
 int checkboard(void)
 {

[U-Boot] [PATCHv2 12/15] configs: ge_bx50v3: enable bootcount

2018-01-10 Thread Sebastian Reichel
From: Ian Ray 

Enable bootcount using an EXT file.

Signed-off-by: Ian Ray 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 include/configs/ge_bx50v3.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index b9c73eb8..efea303393a0 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -110,6 +110,7 @@
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
"script=boot.scr\0" \
+   "bootlimit=10\0" \
"image=/boot/fitImage\0" \
"console=" CONSOLE_DEV "\0" \
"fdt_high=0x\0"   \
@@ -242,4 +243,11 @@
 
 #define CONFIG_BCH
 
+#define CONFIG_BOOTCOUNT_LIMIT
+#define CONFIG_BOOTCOUNT_EXT
+#define CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE "mmc"
+#define CONFIG_SYS_BOOTCOUNT_EXT_DEVPART   "1:5"
+#define CONFIG_SYS_BOOTCOUNT_EXT_NAME  "/boot/failures"
+#define CONFIG_SYS_BOOTCOUNT_ADDR  0x7000A000
+
 #endif /* __GE_BX50V3_CONFIG_H */
-- 
2.15.1

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


[U-Boot] [PATCHv2 15/15] board,ge,bx50v3 - rtc time validation

2018-01-10 Thread Sebastian Reichel
From: Nandor Han 

Validate the time at startup:
 - in case rtc error add to kernel command line RTC_ERROR
 - clamp date to 1-Jan-2036

Signed-off-by: Nandor Han 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c| 3 +++
 configs/ge_b850v3_defconfig | 1 +
 include/configs/ge_bx50v3.h | 6 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index e35afa0317a8..c7a29185bf49 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include "../common/ge_common.h"
 #include "../common/vpd_reader.h"
 #include "../../../drivers/net/e1000.h"
 DECLARE_GLOBAL_DATA_PTR;
@@ -805,6 +806,8 @@ int board_late_init(void)
/* board specific pmic init */
pmic_init();
 
+   check_time();
+
return 0;
 }
 
diff --git a/configs/ge_b850v3_defconfig b/configs/ge_b850v3_defconfig
index 4f9d77cc4fe4..b78667520232 100644
--- a/configs/ge_b850v3_defconfig
+++ b/configs/ge_b850v3_defconfig
@@ -13,6 +13,7 @@ CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_FPGA is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
+CONFIG_RTC_RX8010SJ=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 # CONFIG_CMD_NFS is not set
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 6078681c7cbb..c192281eee73 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -121,7 +121,7 @@
"setargs=setenv bootargs root=/dev/${rootdev}${partnum} " \
"ro rootwait cma=128M " \
"bootcause=${bootcause} " \
-   "${quiet} console=${console} " \
+   "${quiet} console=${console} ${rtc_status} " \
BX50V3_BOOTARGS_EXTRA "\0" \
"doquiet=" \
"if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
@@ -242,6 +242,10 @@
 #define CONFIG_PCIE_IMX_PERST_GPIO IMX_GPIO_NR(7, 12)
 #define CONFIG_PCIE_IMX_POWER_GPIO IMX_GPIO_NR(1, 5)
 
+#define CONFIG_RTC_RX8010SJ
+#define CONFIG_SYS_RTC_BUS_NUM 2
+#define CONFIG_SYS_I2C_RTC_ADDR0x32
+
 /* I2C Configs */
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MXC
-- 
2.15.1

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


[U-Boot] [PATCHv2 05/15] board: ge: Enable access to i2c bus 1 and 2

2018-01-10 Thread Sebastian Reichel
From: Martyn Welch 

The change in i2c configuration added to support access to the VPD has
inadvertantly caused access to i2c buses 1 & 2 to be lost. This has
resulted in the configuration for the PMIC to be attempted on the wrong
bus and thus isn't taking effect.

Add the required configuration to return access to buses 1 & 2. In order
to ensure that any users of the bus numbering prior to addition in VPD
patches work, add buses before configuration related to mux on bus 0 and
tweak VPD bus usage to fit new numbering scheme.

Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c| 2 +-
 include/configs/ge_bx50v3.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 37de9901767a..cb4deb043406 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -37,7 +37,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #ifndef CONFIG_SYS_I2C_EEPROM_BUS
-#define CONFIG_SYS_I2C_EEPROM_BUS   2
+#define CONFIG_SYS_I2C_EEPROM_BUS   4
 #endif
 
 #define NC_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 1454577dbfc4..a1c624fd2151 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -297,9 +297,11 @@
 #define CONFIG_SYS_I2C_MXC_I2C2
 #define CONFIG_SYS_I2C_MXC_I2C3
 
-#define CONFIG_SYS_NUM_I2C_BUSES9
+#define CONFIG_SYS_NUM_I2C_BUSES11
 #define CONFIG_SYS_I2C_MAX_HOPS 1
 #define CONFIG_SYS_I2C_BUSES   {   {0, {I2C_NULL_HOP} }, \
+   {1, {I2C_NULL_HOP} }, \
+   {2, {I2C_NULL_HOP} }, \
{0, {{I2C_MUX_PCA9547, 0x70, 0} } }, \
{0, {{I2C_MUX_PCA9547, 0x70, 1} } }, \
{0, {{I2C_MUX_PCA9547, 0x70, 2} } }, \
-- 
2.15.1

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


[U-Boot] [PATCHv2 08/15] board: ge: bx50v3: program MAC address to I210

2018-01-10 Thread Sebastian Reichel
From: Hannu Lounento 

There are two I210s on the b850v3 and one on the b450v3 and b650v3.
One is connected to Marvell 88e6240 which is already programmed.

Follow the flow documented in doc/README.enetaddr: set the
enet[0-9]*addr environment variable and let the driver program the
hardware.

The mapping from the driver's index to the environment variable's name
is documented in README: Note for Redundant Ethernet Interfaces. It is
assumed that eth_devices for the controllers on the board are always
indexed in the same order.

The environment variables are removed after programming the hardware
because the variables seem to influence MAC addresses also after U-Boot.
Specifically the MAC address of FEC (MC interface) would be incorrectly
set: 'ethaddr', which maps to the first I210 chip and is set to I210's
default address read from the driver by eth_write_hwaddr in eth_legacy.c
because the variable is undefined (not set even by bx50v3.c), would
result in the eth0 interface's MAC address to be set to I210's default
address.

Signed-off-by: Hannu Lounento 
Signed-off-by: Ian Ray 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 0468dcfa8e26..07b42988e4eb 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include "../common/vpd_reader.h"
+#include "../../../drivers/net/e1000.h"
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifndef CONFIG_SYS_I2C_EEPROM_ADDR
@@ -548,12 +549,14 @@ int overwrite_console(void)
 #define VPD_PRODUCT_B650 2
 #define VPD_PRODUCT_B450 3
 #define VPD_HAS_MAC1 0x1
+#define VPD_HAS_MAC2 0x2
 #define VPD_MAC_ADDRESS_LENGTH 6
 
 struct vpd_cache {
u8 product_id;
u8 has;
unsigned char mac1[VPD_MAC_ADDRESS_LENGTH];
+   unsigned char mac2[VPD_MAC_ADDRESS_LENGTH];
 };
 
 /*
@@ -573,6 +576,10 @@ static int vpd_callback(void *userdata, u8 id, u8 version, 
u8 type,
vpd->has |= VPD_HAS_MAC1;
memcpy(vpd->mac1, data, VPD_MAC_ADDRESS_LENGTH);
}
+   if (size >= 12) {
+   vpd->has |= VPD_HAS_MAC2;
+   memcpy(vpd->mac2, data + 6, VPD_MAC_ADDRESS_LENGTH);
+   }
}
 
return 0;
@@ -581,20 +588,26 @@ static int vpd_callback(void *userdata, u8 id, u8 
version, u8 type,
 static void process_vpd(struct vpd_cache *vpd)
 {
int fec_index = -1;
+   int i210_index = -1;
 
switch (vpd->product_id) {
case VPD_PRODUCT_B450:
/* fall thru */
case VPD_PRODUCT_B650:
+   i210_index = 0;
fec_index = 1;
break;
case VPD_PRODUCT_B850:
+   i210_index = 1;
fec_index = 2;
break;
}
 
if (fec_index >= 0 && (vpd->has & VPD_HAS_MAC1))
eth_env_set_enetaddr_by_index("eth", fec_index, vpd->mac1);
+
+   if (i210_index >= 0 && (vpd->has & VPD_HAS_MAC2))
+   eth_env_set_enetaddr_by_index("eth", i210_index, vpd->mac2);
 }
 
 static int read_vpd(uint eeprom_bus)
@@ -633,6 +646,8 @@ int board_eth_init(bd_t *bis)
setup_iomux_enet();
setup_pcie();
 
+   e1000_initialize(bis);
+
return cpu_eth_init(bis);
 }
 
@@ -780,9 +795,29 @@ int board_late_init(void)
return 0;
 }
 
+/*
+ * Removes the 'eth[0-9]*addr' environment variable with the given index
+ *
+ * @param index [in] the index of the eth_device whose variable is to be 
removed
+ */
+static void remove_ethaddr_env_var(int index)
+{
+   char env_var_name[9];
+
+   sprintf(env_var_name, index == 0 ? "ethaddr" : "eth%daddr", index);
+   env_set(env_var_name, NULL);
+}
+
 int last_stage_init(void)
 {
-   env_set("ethaddr", NULL);
+   int i;
+
+   /*
+* Remove first three ethaddr which may have been created by
+* function process_vpd().
+*/
+   for (i = 0; i < 3; ++i)
+   remove_ethaddr_env_var(i);
 
return 0;
 }
-- 
2.15.1

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


[U-Boot] [PATCHv2 11/15] config: ge_bx50v3: read boot script

2018-01-10 Thread Sebastian Reichel
From: Ian Ray 

Read boot script from shared partition, if available.

Signed-off-by: Ian Ray 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 include/configs/ge_bx50v3.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 1c1b82a77734..b9c73eb8 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -131,15 +131,15 @@
 
 #define CONFIG_MMCBOOTCOMMAND \
"setenv dev mmc; " \
-   "setenv rootdev mmcblk0p${partnum}; " \
+   "setenv devnum ${emmcdev}; " \
\
-   "setenv devnum ${sddev}; " \
-   "if mmc dev ${devnum}; then " \
-   "run tryboot; " \
-   "setenv rootdev mmcblk1p${partnum}; " \
+   "if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/active/boot.img ; " \
+   "then " \
+   "source 0x7000A000; " \
"fi; " \
\
-   "setenv devnum ${emmcdev}; " \
+   "setenv rootdev mmcblk0p${partnum}; " \
+   \
"if mmc dev ${devnum}; then " \
"run tryboot; " \
"fi; " \
-- 
2.15.1

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


[U-Boot] [PATCHv2 10/15] board: ge: bx50v3: Support FIT and select configuration based on VPD

2018-01-10 Thread Sebastian Reichel
From: Ian Ray 

Modify configuration to support FIT. Set variable `confidx' from VPD,
in order to load the correct device tree. Modify/simplify U-Boot
environment to support loading FIT image.

Signed-off-by: Ian Ray 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 board/ge/bx50v3/bx50v3.c| 12 +++
 configs/ge_b450v3_defconfig |  1 +
 configs/ge_b650v3_defconfig |  1 +
 configs/ge_b850v3_defconfig |  1 +
 include/configs/ge_bx50v3.h | 88 +++--
 5 files changed, 20 insertions(+), 83 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 48c26e0f9fa5..e35afa0317a8 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -590,6 +590,18 @@ static void process_vpd(struct vpd_cache *vpd)
int fec_index = -1;
int i210_index = -1;
 
+   switch (vpd->product_id) {
+   case VPD_PRODUCT_B450:
+   env_set("confidx", "1");
+   break;
+   case VPD_PRODUCT_B650:
+   env_set("confidx", "2");
+   break;
+   case VPD_PRODUCT_B850:
+   env_set("confidx", "3");
+   break;
+   }
+
switch (vpd->product_id) {
case VPD_PRODUCT_B450:
/* fall thru */
diff --git a/configs/ge_b450v3_defconfig b/configs/ge_b450v3_defconfig
index f95c3cdc7957..76cc4070e04d 100644
--- a/configs/ge_b450v3_defconfig
+++ b/configs/ge_b450v3_defconfig
@@ -32,3 +32,4 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_PCI=y
 CONFIG_E1000=y
 CONFIG_CMD_E1000=y
+CONFIG_FIT=y
diff --git a/configs/ge_b650v3_defconfig b/configs/ge_b650v3_defconfig
index 3af063023430..e82abe21eb14 100644
--- a/configs/ge_b650v3_defconfig
+++ b/configs/ge_b650v3_defconfig
@@ -32,3 +32,4 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_PCI=y
 CONFIG_E1000=y
 CONFIG_CMD_E1000=y
+CONFIG_FIT=y
diff --git a/configs/ge_b850v3_defconfig b/configs/ge_b850v3_defconfig
index 5f008eac750c..4f9d77cc4fe4 100644
--- a/configs/ge_b850v3_defconfig
+++ b/configs/ge_b850v3_defconfig
@@ -32,3 +32,4 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_PCI=y
 CONFIG_E1000=y
 CONFIG_CMD_E1000=y
+CONFIG_FIT=y
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index cc067ccee657..1c1b82a77734 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -110,95 +110,24 @@
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
"script=boot.scr\0" \
-   "image=/boot/uImage\0" \
-   "uboot=u-boot.imx\0" \
-   "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
-   "fdt_addr=0x1800\0" \
-   "boot_fdt=yes\0" \
-   "ip_dyn=yes\0" \
+   "image=/boot/fitImage\0" \
"console=" CONSOLE_DEV "\0" \
"fdt_high=0x\0"   \
-   "initrd_high=0x\0" \
"sddev=0\0" \
"emmcdev=1\0" \
"partnum=1\0" \
-   "update_sd_firmware=" \
-   "if test ${ip_dyn} = yes; then " \
-   "setenv get_cmd dhcp; " \
-   "else " \
-   "setenv get_cmd tftp; " \
-   "fi; " \
-   "if mmc dev ${mmcdev}; then "   \
-   "if ${get_cmd} ${update_sd_firmware_filename}; then " \
-   "setexpr fw_sz ${filesize} / 0x200; " \
-   "setexpr fw_sz ${fw_sz} + 1; "  \
-   "mmc write ${loadaddr} 0x2 ${fw_sz}; " \
-   "fi; "  \
-   "fi\0" \
-   "update_sf_uboot=" \
-   "if tftp $loadaddr $uboot; then " \
-   "sf probe; " \
-   "sf erase 0 0xC; " \
-   "sf write $loadaddr 0x400 $filesize; " \
-   "echo 'U-Boot upgraded. Please reset'; " \
-   "fi\0" \
"setargs=setenv bootargs console=${console},${baudrate} " \
"root=/dev/${rootdev} rw rootwait cma=128M " \
BX50V3_BOOTARGS_EXTRA "\0" \
-   "loadbootscript=" \
-   "ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${script};\0" 
\
-   "bootscript=echo Running bootscript from ${dev}:${devnum}:${partnum};" \
-   " source\0" \
"loadimage=" \
"ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \
-   "loadfdt=ext2load ${dev} ${devnum}:${partnum} ${fdt_addr} 
${fdt_file}\0" \
"tryboot=" \
-   "if run loadbootscript; then " \
-   "run bootscript; " \
-   "else " \
-   "if run loadimage; then " \
-   "run doboot; " \
-   "fi; " \
+   "if run loadimage; then " \
+   "run doboot; " \
"fi;\0" \
"doboot=echo Booting from ${dev}:${devnum}:${partnum} ...; " \
"run setargs; " \
-   "if test ${boot_fdt} = 

[U-Boot] [PATCHv2 06/15] configs: Add network device support for bx50v3 products

2018-01-10 Thread Sebastian Reichel
From: Ian Ray 

Modify b450v3, b650v3 and b850v3 defconfigs to enable the network devices
found in these products.

Signed-off-by: Ian Ray 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 configs/ge_b450v3_defconfig | 6 +-
 configs/ge_b650v3_defconfig | 6 +-
 configs/ge_b850v3_defconfig | 6 +-
 include/configs/ge_bx50v3.h | 4 ++--
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/configs/ge_b450v3_defconfig b/configs/ge_b450v3_defconfig
index 43a6c12708f0..f95c3cdc7957 100644
--- a/configs/ge_b450v3_defconfig
+++ b/configs/ge_b450v3_defconfig
@@ -15,7 +15,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
-# CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
@@ -28,3 +27,8 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_NETDEVICES=y
+CONFIG_CMD_NET=y
+CONFIG_CMD_PCI=y
+CONFIG_E1000=y
+CONFIG_CMD_E1000=y
diff --git a/configs/ge_b650v3_defconfig b/configs/ge_b650v3_defconfig
index 4e22e9579a1a..3af063023430 100644
--- a/configs/ge_b650v3_defconfig
+++ b/configs/ge_b650v3_defconfig
@@ -15,7 +15,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
-# CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
@@ -28,3 +27,8 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_NETDEVICES=y
+CONFIG_CMD_NET=y
+CONFIG_CMD_PCI=y
+CONFIG_E1000=y
+CONFIG_CMD_E1000=y
diff --git a/configs/ge_b850v3_defconfig b/configs/ge_b850v3_defconfig
index cb5899dc3a75..5f008eac750c 100644
--- a/configs/ge_b850v3_defconfig
+++ b/configs/ge_b850v3_defconfig
@@ -15,7 +15,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
-# CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
@@ -28,3 +27,8 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_NETDEVICES=y
+CONFIG_CMD_NET=y
+CONFIG_CMD_PCI=y
+CONFIG_E1000=y
+CONFIG_CMD_E1000=y
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index a1c624fd2151..6498c6c74de3 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -282,12 +282,12 @@
 #define CONFIG_PWM_IMX
 #define CONFIG_IMX6_PWM_PER_CLK6600
 
-#ifdef CONFIG_CMD_PCI
+#define CONFIG_PCI
+#define CONFIG_PCI_PNP
 #define CONFIG_PCI_SCAN_SHOW
 #define CONFIG_PCIE_IMX
 #define CONFIG_PCIE_IMX_PERST_GPIO IMX_GPIO_NR(7, 12)
 #define CONFIG_PCIE_IMX_POWER_GPIO IMX_GPIO_NR(1, 5)
-#endif
 
 /* I2C Configs */
 #define CONFIG_SYS_I2C
-- 
2.15.1

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


[U-Boot] [PATCHv2 04/15] rtc: adding RX8010SJ rtc driver

2018-01-10 Thread Sebastian Reichel
From: Nandor Han 

Add a new driver for RX8010SJ rtc chip. The driver implements both
formats of U-Boot driver model.

Signed-off-by: Nandor Han 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 drivers/rtc/Kconfig|   6 +
 drivers/rtc/Makefile   |   1 +
 drivers/rtc/rx8010sj.c | 378 +
 3 files changed, 385 insertions(+)
 create mode 100644 drivers/rtc/rx8010sj.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 2964bb221106..95ac0312439d 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -30,6 +30,12 @@ config RTC_DS1307
  Support for Dallas Semiconductor (now Maxim) DS1307 and DS1338/9 and
  compatible Real Time Clock devices.
 
+config RTC_RX8010SJ
+   bool "Enable RX8010SJ driver"
+   depends on DM_RTC
+   help
+ Support for Epson RX8010SJ Real Time Clock devices.
+
 config RTC_S35392A
bool "Enable S35392A driver"
select BITREVERSE
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 7a8f97a05fe1..9723fb774c57 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -48,6 +48,7 @@ obj-$(CONFIG_RTC_PT7C4338) += pt7c4338.o
 obj-$(CONFIG_RTC_RS5C372A) += rs5c372.o
 obj-$(CONFIG_RTC_RV3029) += rv3029.o
 obj-$(CONFIG_RTC_RX8025) += rx8025.o
+obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.o
 obj-$(CONFIG_RTC_S3C24X0) += s3c24x0_rtc.o
 obj-$(CONFIG_RTC_S35392A) += s35392a.o
 obj-$(CONFIG_SANDBOX) += sandbox_rtc.o
diff --git a/drivers/rtc/rx8010sj.c b/drivers/rtc/rx8010sj.c
new file mode 100644
index ..81560e16cef1
--- /dev/null
+++ b/drivers/rtc/rx8010sj.c
@@ -0,0 +1,378 @@
+/*
+ * Epson RX8010 RTC driver.
+ *
+ * Copyright (c) 2017, General Electric Company
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*-*/
+/* #undef DEBUG_RTC */
+
+#ifdef DEBUG_RTC
+#define DEBUGR(fmt, args...) printf(fmt, ##args)
+#else
+#define DEBUGR(fmt, args...)
+#endif
+/*-*/
+
+#ifndef CONFIG_SYS_I2C_RTC_ADDR
+# define CONFIG_SYS_I2C_RTC_ADDR   0x32
+#endif
+
+/*
+ * RTC register addresses
+ */
+#define RX8010_SEC 0x10
+#define RX8010_MIN 0x11
+#define RX8010_HOUR0x12
+#define RX8010_WDAY0x13
+#define RX8010_MDAY0x14
+#define RX8010_MONTH   0x15
+#define RX8010_YEAR0x16
+#define RX8010_YEAR0x16
+#define RX8010_RESV17  0x17
+#define RX8010_ALMIN   0x18
+#define RX8010_ALHOUR  0x19
+#define RX8010_ALWDAY  0x1A
+#define RX8010_TCOUNT0 0x1B
+#define RX8010_TCOUNT1 0x1C
+#define RX8010_EXT 0x1D
+#define RX8010_FLAG0x1E
+#define RX8010_CTRL0x1F
+/* 0x20 to 0x2F are user registers */
+#define RX8010_RESV30  0x30
+#define RX8010_RESV31  0x32
+#define RX8010_IRQ 0x32
+
+#define RX8010_EXT_WADA  BIT(3)
+
+#define RX8010_FLAG_VLF  BIT(1)
+#define RX8010_FLAG_AF   BIT(3)
+#define RX8010_FLAG_TF   BIT(4)
+#define RX8010_FLAG_UF   BIT(5)
+
+#define RX8010_CTRL_AIE  BIT(3)
+#define RX8010_CTRL_UIE  BIT(5)
+#define RX8010_CTRL_STOP BIT(6)
+#define RX8010_CTRL_TEST BIT(7)
+
+#define RX8010_ALARM_AE  BIT(7)
+
+#ifdef CONFIG_DM_RTC
+
+#define DEV_TYPE struct udevice
+
+#else
+
+/* Local udevice */
+struct ludevice {
+   u8 chip;
+};
+
+#define DEV_TYPE struct ludevice
+
+#endif
+
+static int rx8010sj_rtc_read8(DEV_TYPE *dev, unsigned int reg)
+{
+   u8 val;
+   int ret;
+
+#ifdef CONFIG_DM_RTC
+   ret = dm_i2c_read(dev, reg, , sizeof(val));
+#else
+   ret = i2c_read(dev->chip, reg, 1, , 1);
+#endif
+
+   return ret < 0 ? ret : val;
+}
+
+static int rx8010sj_rtc_write8(DEV_TYPE *dev, unsigned int reg, int val)
+{
+   int ret;
+   u8 lval = val;
+
+#ifdef CONFIG_DM_RTC
+   ret = dm_i2c_write(dev, reg, , 1);
+#else
+   ret = i2c_write(dev->chip, reg, 1, , 1);
+#endif
+
+   return ret < 0 ? ret : 0;
+}
+
+static int validate_time(const struct rtc_time *tm)
+{
+   if ((tm->tm_year < 2000) || (tm->tm_year > 2099))
+   return -EINVAL;
+
+   if ((tm->tm_mon < 1) || (tm->tm_mon > 12))
+   return -EINVAL;
+
+   if ((tm->tm_mday < 1) || (tm->tm_mday > 31))
+   return -EINVAL;
+
+   if ((tm->tm_wday < 0) || 

[U-Boot] [PATCHv2 03/15] net: e1000: implement eth_write_hwaddr

2018-01-10 Thread Sebastian Reichel
From: Hannu Lounento 

Implement programming MAC address to the hardware, i.e. external flash
seen as EEPROM.

MAC address is only written if it differs from what is already stored in
flash or if reading the current MAC address fails.

Signed-off-by: Hannu Lounento 
CC: Joe Hershberger 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 drivers/net/e1000.c | 40 
 1 file changed, 40 insertions(+)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 868616b488a7..8316854bc177 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5649,6 +5649,45 @@ e1000_poll(struct eth_device *nic)
return len ? 1 : 0;
 }
 
+static int e1000_write_hwaddr(struct eth_device *dev)
+{
+#ifndef CONFIG_E1000_NO_NVM
+   unsigned char *mac = dev->enetaddr;
+   unsigned char current_mac[6];
+   struct e1000_hw *hw = dev->priv;
+   uint16_t data[3];
+   int ret_val, i;
+
+   DEBUGOUT("%s: mac=%pM\n", __func__, mac);
+
+   memset(current_mac, 0, 6);
+
+   /* Read from EEPROM, not from registers, to make sure
+* the address is persistently configured
+*/
+   ret_val = e1000_read_mac_addr_from_eeprom(hw, current_mac);
+   DEBUGOUT("%s: current mac=%pM\n", __func__, current_mac);
+
+   /* Only write to EEPROM if the given address is different or
+* reading the current address failed
+*/
+   if (!ret_val && memcmp(current_mac, mac, 6) == 0)
+   return 0;
+
+   for (i = 0; i < 3; ++i)
+   data[i] = mac[i * 2 + 1] << 8 | mac[i * 2];
+
+   ret_val = e1000_write_eeprom_srwr(hw, 0x0, 3, data);
+
+   if (!ret_val)
+   ret_val = e1000_update_eeprom_checksum_i210(hw);
+
+   return ret_val;
+#else
+   return 0;
+#endif
+}
+
 /**
 PROBE - Look for an adapter, this routine's visible to the outside
 You should omit the last argument struct pci_device * for a non-PCI NIC
@@ -5698,6 +5737,7 @@ e1000_initialize(bd_t * bis)
nic->recv = e1000_poll;
nic->send = e1000_transmit;
nic->halt = e1000_disable;
+   nic->write_hwaddr = e1000_write_hwaddr;
eth_register(nic);
}
 
-- 
2.15.1

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


[U-Boot] [PATCHv2 02/15] net: e1000: split e1000_read_mac_addr

2018-01-10 Thread Sebastian Reichel
From: Hannu Lounento 

Split the implementation of e1000_read_mac_addr into eeprom and register
versions called by e1000_read_mac_addr.

This allows for calling e1000_read_mac_addr when MAC address is needed
with no constraints where it is read from, and for calling the register
and, especially, the eeprom version directly in order to specify where
to read the address from.

Signed-off-by: Hannu Lounento 
CC: Joe Hershberger 
Signed-off-by: Martyn Welch 
Signed-off-by: Sebastian Reichel 
---
 drivers/net/e1000.c | 81 +
 1 file changed, 63 insertions(+), 18 deletions(-)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 1d9f8f3ae2e4..868616b488a7 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -1313,33 +1313,21 @@ static bool e1000_is_second_port(struct e1000_hw *hw)
 
 #ifndef CONFIG_E1000_NO_NVM
 /**
- * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the
- * second function of dual function devices
+ * Reads the adapter's MAC address from the EEPROM
  *
- * nic - Struct containing variables accessed by shared code
+ * hw - Struct containing variables accessed by shared code
+ * enetaddr - buffering where the MAC address will be stored
  */
-static int
-e1000_read_mac_addr(struct e1000_hw *hw, unsigned char enetaddr[6])
+static int e1000_read_mac_addr_from_eeprom(struct e1000_hw *hw,
+  unsigned char enetaddr[6])
 {
uint16_t offset;
uint16_t eeprom_data;
-   uint32_t reg_data = 0;
int i;
 
-   DEBUGFUNC();
-
for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) {
offset = i >> 1;
-   if (hw->mac_type == e1000_igb) {
-   /* i210 preloads MAC address into RAL/RAH registers */
-   if (offset == 0)
-   reg_data = E1000_READ_REG_ARRAY(hw, RA, 0);
-   else if (offset == 1)
-   reg_data >>= 16;
-   else if (offset == 2)
-   reg_data = E1000_READ_REG_ARRAY(hw, RA, 1);
-   eeprom_data = reg_data & 0x;
-   } else if (e1000_read_eeprom(hw, offset, 1, _data) < 0) {
+   if (e1000_read_eeprom(hw, offset, 1, _data) < 0) {
DEBUGOUT("EEPROM Read Error\n");
return -E1000_ERR_EEPROM;
}
@@ -1347,6 +1335,63 @@ e1000_read_mac_addr(struct e1000_hw *hw, unsigned char 
enetaddr[6])
enetaddr[i + 1] = (eeprom_data >> 8) & 0xff;
}
 
+   return 0;
+}
+
+/**
+ * Reads the adapter's MAC address from the RAL/RAH registers
+ *
+ * hw - Struct containing variables accessed by shared code
+ * enetaddr - buffering where the MAC address will be stored
+ */
+static int e1000_read_mac_addr_from_regs(struct e1000_hw *hw,
+unsigned char enetaddr[6])
+{
+   uint16_t offset, tmp;
+   uint32_t reg_data = 0;
+   int i;
+
+   if (hw->mac_type != e1000_igb)
+   return -E1000_ERR_MAC_TYPE;
+
+   for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) {
+   offset = i >> 1;
+
+   if (offset == 0)
+   reg_data = E1000_READ_REG_ARRAY(hw, RA, 0);
+   else if (offset == 1)
+   reg_data >>= 16;
+   else if (offset == 2)
+   reg_data = E1000_READ_REG_ARRAY(hw, RA, 1);
+   tmp = reg_data & 0x;
+
+   enetaddr[i] = tmp & 0xff;
+   enetaddr[i + 1] = (tmp >> 8) & 0xff;
+   }
+
+   return 0;
+}
+
+/**
+ * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the
+ * second function of dual function devices
+ *
+ * hw - Struct containing variables accessed by shared code
+ * enetaddr - buffering where the MAC address will be stored
+ */
+static int e1000_read_mac_addr(struct e1000_hw *hw, unsigned char enetaddr[6])
+{
+   int ret_val;
+
+   if (hw->mac_type == e1000_igb) {
+   /* i210 preloads MAC address into RAL/RAH registers */
+   ret_val = e1000_read_mac_addr_from_regs(hw, enetaddr);
+   } else {
+   ret_val = e1000_read_mac_addr_from_eeprom(hw, enetaddr);
+   }
+   if (ret_val)
+   return 

[U-Boot] [PATCHv2 01/15] net: e1000: add support for writing to EEPROM

2018-01-10 Thread Sebastian Reichel
From: Hannu Lounento 

Port functions for writing to EEPROM, updating the checksum and
committing data to flash from the Linux kernel igb driver.

Functions were ported from Linux 4.8-rc2 (694d0d0bb20).

Signed-off-by: Hannu Lounento 
CC: Joe Hershberger 
Signed-off-by: Martyn Welch 
Reviewed-by: Stefano Babic 
Acked-by: Joe Hershberger 
Signed-off-by: Sebastian Reichel 
---
 drivers/net/e1000.c | 173 +++-
 drivers/net/e1000.h |   3 +
 2 files changed, 174 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 875682b1b89e..1d9f8f3ae2e4 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -150,6 +150,7 @@ static int32_t e1000_check_phy_reset_block(struct e1000_hw 
*hw);
 
 #ifndef CONFIG_E1000_NO_NVM
 static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);
+static int32_t e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw);
 static int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset,
uint16_t words,
uint16_t *data);
@@ -861,6 +862,174 @@ e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset,
return E1000_SUCCESS;
 }
 
+#ifndef CONFIG_DM_ETH
+/**
+ *  e1000_write_eeprom_srwr - Write to Shadow Ram using EEWR
+ *  @hw: pointer to the HW structure
+ *  @offset: offset within the Shadow Ram to be written to
+ *  @words: number of words to write
+ *  @data: 16 bit word(s) to be written to the Shadow Ram
+ *
+ *  Writes data to Shadow Ram at offset using EEWR register.
+ *
+ *  If e1000_update_eeprom_checksum_i210 is not called after this function, the
+ *  Shadow Ram will most likely contain an invalid checksum.
+ */
+static int32_t e1000_write_eeprom_srwr(struct e1000_hw *hw, uint16_t offset,
+  uint16_t words, uint16_t *data)
+{
+   struct e1000_eeprom_info *eeprom = >eeprom;
+   uint32_t i, k, eewr = 0;
+   uint32_t attempts = 10;
+   int32_t ret_val = 0;
+
+   /* A check for invalid values:  offset too large, too many words,
+* too many words for the offset, and not enough words.
+*/
+   if ((offset >= eeprom->word_size) ||
+   (words > (eeprom->word_size - offset)) || (words == 0)) {
+   DEBUGOUT("nvm parameter(s) out of bounds\n");
+   ret_val = -E1000_ERR_EEPROM;
+   goto out;
+   }
+
+   for (i = 0; i < words; i++) {
+   eewr = ((offset + i) << E1000_EEPROM_RW_ADDR_SHIFT)
+   | (data[i] << E1000_EEPROM_RW_REG_DATA) |
+   E1000_EEPROM_RW_REG_START;
+
+   E1000_WRITE_REG(hw, I210_EEWR, eewr);
+
+   for (k = 0; k < attempts; k++) {
+   if (E1000_EEPROM_RW_REG_DONE &
+   E1000_READ_REG(hw, I210_EEWR)) {
+   ret_val = 0;
+   break;
+   }
+   udelay(5);
+   }
+
+   if (ret_val) {
+   DEBUGOUT("Shadow RAM write EEWR timed out\n");
+   break;
+   }
+   }
+
+out:
+   return ret_val;
+}
+
+/**
+ *  e1000_pool_flash_update_done_i210 - Pool FLUDONE status.
+ *  @hw: pointer to the HW structure
+ *
+ */
+static int32_t e1000_pool_flash_update_done_i210(struct e1000_hw *hw)
+{
+   int32_t ret_val = -E1000_ERR_EEPROM;
+   uint32_t i, reg;
+
+   for (i = 0; i < E1000_FLUDONE_ATTEMPTS; i++) {
+   reg = E1000_READ_REG(hw, EECD);
+   if (reg & E1000_EECD_FLUDONE_I210) {
+   ret_val = 0;
+   break;
+   }
+   udelay(5);
+   }
+
+   return ret_val;
+}
+
+/**
+ *  e1000_update_flash_i210 - Commit EEPROM to the flash
+ *  @hw: pointer to the HW structure
+ *
+ */
+static int32_t e1000_update_flash_i210(struct e1000_hw *hw)
+{
+   int32_t ret_val = 0;
+   uint32_t flup;
+
+   ret_val = e1000_pool_flash_update_done_i210(hw);
+   if (ret_val == -E1000_ERR_EEPROM) {
+   DEBUGOUT("Flash update time out\n");
+   goto out;
+   }
+
+   flup = E1000_READ_REG(hw, EECD) | E1000_EECD_FLUPD_I210;
+   E1000_WRITE_REG(hw, EECD, flup);
+
+   ret_val = 

[U-Boot] [PATCHv2 00/15] Updates / improvements to bx50v3 support

2018-01-10 Thread Sebastian Reichel
This series improves the support on the bx50v3 devices (b540v3, b650v3
and b850v3). Changes outside of the bx50v3 specific areas:

- Added driver for RX8010SJ RTC.
- Added functionality to e1000 driver to enable wrting of EEPROM/MAC
  address.

Changes since PATCHv1:
 * Rebased to v2018.01
 * Fixed compiler warning for qemu amd64 target

-- Sebastian

Hannu Lounento (5):
  net: e1000: add support for writing to EEPROM
  net: e1000: split e1000_read_mac_addr
  net: e1000: implement eth_write_hwaddr
  board: ge: bx50v3: program MAC address to I210
  board: ge: bx50v3: mount rootfs read-only

Ian Ray (5):
  configs: Add network device support for bx50v3 products
  board: ge: bx50v3: Support FIT and select configuration based on VPD
  config: ge_bx50v3: read boot script
  configs: ge_bx50v3: enable bootcount
  configs: ge_bx50v3: automatic partition selection and video output
failure message

Martyn Welch (3):
  board: ge: Enable access to i2c bus 1 and 2
  board: ge: bx50v3: move FEC MAC address programming to driver
  board: ge: bx50v3: Enable hardware watchdog

Nandor Han (2):
  rtc: adding RX8010SJ rtc driver
  board,ge,bx50v3 - rtc time validation

 board/ge/bx50v3/bx50v3.c| 130 ++-
 configs/ge_b450v3_defconfig |   7 +-
 configs/ge_b650v3_defconfig |   7 +-
 configs/ge_b850v3_defconfig |   8 +-
 drivers/net/e1000.c | 294 +++---
 drivers/net/e1000.h |   3 +
 drivers/rtc/Kconfig |   6 +
 drivers/rtc/Makefile|   1 +
 drivers/rtc/rx8010sj.c  | 378 
 include/configs/ge_bx50v3.h | 190 +-
 10 files changed, 849 insertions(+), 175 deletions(-)
 create mode 100644 drivers/rtc/rx8010sj.c

-- 
2.15.1

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


[U-Boot] compilation issue pine64

2018-01-10 Thread Akash Gajjar
Hi All,

Facing compilation issue building pine64 mainline u-boot.
Please see below build log.

user]$ export CROSS_COMPILE=aarch64-linux-gnu-

user]$ make pine64_plus_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

user]$ make
  .
  .
  .
  LDS spl/u-boot-spl.lds
  LD  spl/u-boot-spl
aarch64-linux-gnu-ld.bfd: u-boot-spl section `.rodata' will not fit in
region `.sram'
aarch64-linux-gnu-ld.bfd: region `.sram' overflowed by 6032 bytes
make[1]: *** [spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl] Error 2

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


Re: [U-Boot] [PATCH v2 3/3] ls1088ardb: Add SD Secure boot target support

2018-01-10 Thread York Sun
On 01/05/2018 08:00 AM, Sumit Garg wrote:
> Signed-off-by: Udit Agarwal 
> Signed-off-by: Sumit Garg 
> ---
> 
> Changes in v2:
> Rebased to top of master
> 
>  arch/arm/include/asm/fsl_secure_boot.h | 16 
>  board/freescale/ls1088a/MAINTAINERS|  5 +++
>  .../ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig   | 45 
> ++
>  include/configs/ls1088a_common.h   | 15 +++-
>  4 files changed, 72 insertions(+), 9 deletions(-)
>  create mode 100644 configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> 
> diff --git a/arch/arm/include/asm/fsl_secure_boot.h 
> b/arch/arm/include/asm/fsl_secure_boot.h
> index ec6463d..3f30470 100644
> --- a/arch/arm/include/asm/fsl_secure_boot.h
> +++ b/arch/arm/include/asm/fsl_secure_boot.h
> @@ -26,6 +26,14 @@
>  
>  #define CONFIG_KEY_REVOCATION
>  
> +#if defined(CONFIG_FSL_LAYERSCAPE)
> +/*
> + * For fsl layerscape based platforms, ESBC image Address in Header
> + * is 64 bit.
> + */
> +#define CONFIG_ESBC_ADDR_64BIT
> +#endif
> +
>  #ifndef CONFIG_SPL_BUILD
>  #ifndef CONFIG_SYS_RAMBOOT
>  /* The key used for verification of next level images
> @@ -42,14 +50,6 @@
>  
>  #endif
>  
> -#if defined(CONFIG_FSL_LAYERSCAPE)
> -/*
> - * For fsl layerscape based platforms, ESBC image Address in Header
> - * is 64 bit.
> - */
> -#define CONFIG_ESBC_ADDR_64BIT
> -#endif
> -
>  #ifdef CONFIG_ARCH_LS2080A
>  #define CONFIG_EXTRA_ENV \
>   "setenv fdt_high 0xa000;"   \
> diff --git a/board/freescale/ls1088a/MAINTAINERS 
> b/board/freescale/ls1088a/MAINTAINERS
> index de3961d..371e5db 100644
> --- a/board/freescale/ls1088a/MAINTAINERS
> +++ b/board/freescale/ls1088a/MAINTAINERS
> @@ -27,3 +27,8 @@ M:  Udit Agarwal 
>  M:   Vinitha Pillai-B57223 
>  S:   Maintained
>  F:   configs/ls1088ardb_qspi_SECURE_BOOT_defconfig
> +
> +LS1088ARDB_SD_SECURE_BOOT BOARD
> +M:   Sumit Garg 
> +S:   Maintained
> +F:   configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> diff --git a/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig 
> b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> new file mode 100644
> index 000..ba90e64
> --- /dev/null
> +++ b/configs/ls1088ardb_sdcard_qspi_SECURE_BOOT_defconfig
> @@ -0,0 +1,45 @@
> +CONFIG_ARM=y
> +CONFIG_TARGET_LS1088ARDB=y
> +CONFIG_SPL_LIBCOMMON_SUPPORT=y
> +CONFIG_SPL_LIBGENERIC_SUPPORT=y
> +CONFIG_FSL_LS_PPA=y
> +CONFIG_SPL_MMC_SUPPORT=y
> +CONFIG_SPL_SERIAL_SUPPORT=y
> +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
> +CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1088a-rdb"
> +CONFIG_DISTRO_DEFAULTS=y
> +# CONFIG_SYS_MALLOC_F is not set
> +CONFIG_FIT_VERBOSE=y
> +CONFIG_OF_BOARD_SETUP=y
> +CONFIG_SYS_EXTRA_OPTIONS="SD_BOOT_QSPI"
> +CONFIG_SECURE_BOOT=y
> +CONFIG_SD_BOOT=y
> +# CONFIG_USE_BOOTCOMMAND is not set
> +# CONFIG_DISPLAY_BOARDINFO is not set
> +CONFIG_SPL=y
> +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
> +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x8b0
> +CONFIG_SPL_ENV_SUPPORT=y
> +CONFIG_SPL_I2C_SUPPORT=y
> +CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT=y
> +CONFIG_CMD_I2C=y
> +CONFIG_CMD_MMC=y
> +CONFIG_CMD_SF=y
> +# CONFIG_CMD_SETEXPR is not set
> +CONFIG_OF_CONTROL=y
> +CONFIG_ENV_IS_IN_MMC=y

This looks wrong. For secure boot you don't use env, do you? If you
agree I can drop this line when applying this patch.

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


[U-Boot] [PATCH v1 1/2] x86: zImage: Move subarch assignment out of cmd_line check

2018-01-10 Thread Andy Shevchenko
The commit

  20bfac0599bd ("x86: zImage: add Intel MID platforms support")

introduced an assignment of subarch field in boot parameters, though
missed the right place of doing that. It doesn't matter if we have or
not a kernel command line supplied, we just set that field. Although
guard it by protocol version which supports it.

Fixes: 20bfac0599bd ("x86: zImage: add Intel MID platforms support")
Cc: Vincent Tinelli 
Signed-off-by: Andy Shevchenko 
---
 arch/x86/lib/zimage.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 00172dc7c1..d224db4e07 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -246,14 +246,15 @@ int setup_zimage(struct boot_params *setup_base, char 
*cmd_line, int auto_boot,
hdr->setup_move_size = 0x9100;
}
 
-#if defined(CONFIG_INTEL_MID)
-   hdr->hardware_subarch = X86_SUBARCH_INTEL_MID;
-#endif
-
/* build command line at COMMAND_LINE_OFFSET */
build_command_line(cmd_line, auto_boot);
}
 
+#ifdef CONFIG_INTEL_MID
+   if (bootproto >= 0x0207)
+   hdr->hardware_subarch = X86_SUBARCH_INTEL_MID;
+#endif
+
setup_video(_base->screen_info);
 
return 0;
-- 
2.15.1

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


[U-Boot] [PATCH v1 2/2] x86: zImage: Propagate acpi_rsdp_addr to kernel via boot parameters

2018-01-10 Thread Andy Shevchenko
New field acpi_rsdp_addr, which has been introduced in boot protocol
v2.14 [1], in boot parameters tells kernel the exact address of RDSP
ACPI table. Knowing it increases robustness of the kernel by avoiding
in some cases traversal through a part of physical memory.
It will slightly reduce boot time by the same reason.

[1] See Linux kernel commit

  2f74cbf947f4 ("x86/boot: Add the ACPI RSDP address to struct 
setup_header::acpi_rdsp_addr")

for the details.

Signed-off-by: Andy Shevchenko 
---
 arch/x86/include/asm/bootparam.h |  1 +
 arch/x86/lib/acpi_table.c|  7 +++
 arch/x86/lib/acpi_table.h| 10 ++
 arch/x86/lib/zimage.c|  6 ++
 4 files changed, 24 insertions(+)
 create mode 100644 arch/x86/lib/acpi_table.h

diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
index 48b138c6b0..90768a99ce 100644
--- a/arch/x86/include/asm/bootparam.h
+++ b/arch/x86/include/asm/bootparam.h
@@ -66,6 +66,7 @@ struct setup_header {
__u64   pref_address;
__u32   init_size;
__u32   handover_offset;
+   __u64   acpi_rsdp_addr;
 } __attribute__((packed));
 
 struct sys_desc_table {
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 7b33cd371e..45bfc111ef 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include "acpi_table.h"
 
 /*
  * IASL compiles the dsdt entries and writes the hex values
@@ -27,6 +28,11 @@
  */
 extern const unsigned char AmlCode[];
 
+/*
+ * ACPI RSDP address to be used in boot parameters.
+ */
+unsigned long acpi_rsdp_addr;
+
 static void acpi_write_rsdp(struct acpi_rsdp *rsdp, struct acpi_rsdt *rsdt,
struct acpi_xsdt *xsdt)
 {
@@ -460,6 +466,7 @@ ulong write_acpi_tables(ulong start)
 
debug("current = %x\n", current);
 
+   acpi_rsdp_addr = (unsigned long)rsdp;
debug("ACPI: done\n");
 
/* Don't touch ACPI hardware on HW reduced platforms */
diff --git a/arch/x86/lib/acpi_table.h b/arch/x86/lib/acpi_table.h
new file mode 100644
index 00..cece5d1420
--- /dev/null
+++ b/arch/x86/lib/acpi_table.h
@@ -0,0 +1,10 @@
+/*
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#ifndef _X86_LIB_ACPI_TABLES_H
+#define _X86_LIB_ACPI_TABLES_H
+
+extern unsigned long acpi_rsdp_addr;
+
+#endif
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index d224db4e07..eae26635b1 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -24,6 +24,7 @@
 #include 
 #endif
 #include 
+#include "acpi_table.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -255,6 +256,11 @@ int setup_zimage(struct boot_params *setup_base, char 
*cmd_line, int auto_boot,
hdr->hardware_subarch = X86_SUBARCH_INTEL_MID;
 #endif
 
+#ifdef CONFIG_GENERATE_ACPI_TABLE
+   if (bootproto >= 0x020e)
+   hdr->acpi_rsdp_addr = acpi_rsdp_addr;
+#endif
+
setup_video(_base->screen_info);
 
return 0;
-- 
2.15.1

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


[U-Boot] [PATCH v1] x86: Fix reference to QEMU variant of write_acpi_tables()

2018-01-10 Thread Andy Shevchenko
The commit

  eece493a7ac1 ("cmd: qfw: bring ACPI generation code into qfw core")

moves ACPI related code to another file and missed an update of
references in acpi_table.c.

Do it now.

Fixes: eece493a7ac1 ("cmd: qfw: bring ACPI generation code into qfw core")
Cc: Miao Yan 
Signed-off-by: Andy Shevchenko 
---
 arch/x86/lib/acpi_table.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 3eb101105b..7b33cd371e 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -357,8 +357,7 @@ void enter_acpi_mode(int pm1_cnt)
 }
 
 /*
- * QEMU's version of write_acpi_tables is defined in
- * arch/x86/cpu/qemu/acpi_table.c
+ * QEMU's version of write_acpi_tables is defined in drivers/misc/qfw.c
  */
 ulong write_acpi_tables(ulong start)
 {
-- 
2.15.1

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


[U-Boot] [PATCH v4 1/1] vsprintf.c: add EFI device path printing

2018-01-10 Thread Heinrich Schuchardt
For debugging efi_loader we need the capability to print EFI
device paths. With this patch we can write:

debug("device path: %pD", dp);

A possible output would be

device path: /MemoryMapped(0x0,0x3ff93a82,0x3ff93a82)

This enhancement is not available when building without EFI support
and neither in the SPL nor in the API example.

A test is provided. It can be executed in the sandbox with command
ut_print.

The development for EFI support in the sandbox is currently in
branch u-boot-dm/efi-working. The branch currently lacks
commit 6ea8b580f06b ("efi_loader: correct DeviceNodeToText
for media types"). Ater rebasing the aforementioned branch on
U-Boot v2018.01 the test is executed successfully.

Without EFI support in the sandbox the test is simply skipped.

Cc: Wolfgang Denk 
Cc: Simon Glass 
Suggested-by: Rob Clark 
Signed-off-by: Heinrich Schuchardt 
---
I propose Alex picks up this patch for the EFI tree.

v4:
Add unit test.
v3:
Return -ENOMEM if out of memory.
Avoid missing dependency error when building the SPL of the
API example.
v2:
Panic if out of memory.
Wolfgang suggested not to silently ignore an out of memory
situation.
---
 examples/api/Makefile |  3 +++
 lib/vsprintf.c| 47 +--
 test/print_ut.c   | 37 +
 3 files changed, 81 insertions(+), 6 deletions(-)

diff --git a/examples/api/Makefile b/examples/api/Makefile
index 899527267d..9068727b98 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -4,6 +4,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+# Provide symbol API_BUILD to signal that the API example is being built.
+KBUILD_CPPFLAGS += -DAPI_BUILD
+
 ifeq ($(ARCH),powerpc)
 LOAD_ADDR = 0x4
 endif
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index dd572d2868..226f4eb3e5 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -11,16 +11,17 @@
  * from hush: simple_itoa() was lifted from boa-0.93.15
  */
 
-#include 
-#include 
-#include 
-#include 
-
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
-#include 
 #define noinline __attribute__((noinline))
 
 /* we use this so that we can do without the ctype library */
@@ -292,6 +293,26 @@ static char *string16(char *buf, char *end, u16 *s, int 
field_width,
return buf;
 }
 
+#if defined(CONFIG_EFI_LOADER) && \
+   !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+static char *device_path_string(char *buf, char *end, void *dp, int 
field_width,
+   int precision, int flags)
+{
+   u16 *str;
+
+   if (!dp)
+   return "";
+
+   str = efi_dp_str((struct efi_device_path *)dp);
+   if (!str)
+   return ERR_PTR(-ENOMEM);
+
+   buf = string16(buf, end, str, field_width, precision, flags);
+   efi_free_pool(str);
+   return buf;
+}
+#endif
+
 #ifdef CONFIG_CMD_NET
 static const char hex_asc[] = "0123456789abcdef";
 #define hex_asc_lo(x)  hex_asc[((x) & 0x0f)]
@@ -435,6 +456,12 @@ static char *pointer(const char *fmt, char *buf, char 
*end, void *ptr,
 #endif
 
switch (*fmt) {
+#if defined(CONFIG_EFI_LOADER) && \
+   !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+   case 'D':
+   return device_path_string(buf, end, ptr, field_width,
+ precision, flags);
+#endif
 #ifdef CONFIG_CMD_NET
case 'a':
flags |= SPECIAL | ZEROPAD;
@@ -604,6 +631,8 @@ repeat:
str = pointer(fmt + 1, str, end,
va_arg(args, void *),
field_width, precision, flags);
+   if (IS_ERR(str))
+   return PTR_ERR(str);
/* Skip all alphanumeric pointer suffixes */
while (isalnum(fmt[1]))
fmt++;
@@ -768,6 +797,9 @@ int printf(const char *fmt, ...)
i = vscnprintf(printbuffer, sizeof(printbuffer), fmt, args);
va_end(args);
 
+   /* Handle error */
+   if (i <= 0)
+   return i;
/* Print the string */
puts(printbuffer);
return i;
@@ -784,6 +816,9 @@ int vprintf(const char *fmt, va_list args)
 */
i = vscnprintf(printbuffer, sizeof(printbuffer), fmt, args);
 
+   /* Handle error */
+   if (i <= 0)
+   return i;
/* Print the string */
puts(printbuffer);
return i;
diff --git a/test/print_ut.c b/test/print_ut.c
index a42c554bef..d10ed8695b 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -7,12 +7,46 @@
 #define DEBUG
 
 #include 
+#if defined(CONFIG_EFI_LOADER) && \
+   !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+#include 
+#endif
 #include 
 

Re: [U-Boot] [U-Boot,2/2] sh: Drop unreferenced CONFIG_* defines

2018-01-10 Thread Tom Rini
On Thu, Dec 21, 2017 at 03:58:54AM +0200, Tuomas Tynkkynen wrote:

> The following config symbols are only defined once and never referenced
> anywhere else:
> 
> CONFIG_AP325RXA
> CONFIG_AP_SH4A_4A
> CONFIG_CPU_SH_TYPE_R
> CONFIG_ECOVEC
> CONFIG_ESPT
> CONFIG_MIGO_R
> CONFIG_MPR2
> CONFIG_MS7720SE
> CONFIG_MS7722SE
> CONFIG_MS7750SE
> CONFIG_R0P7734
> CONFIG_R2DPLUS
> CONFIG_RSK7203
> CONFIG_RSK7264
> CONFIG_RSK7269
> CONFIG_SH7752EVB
> CONFIG_SH7753EVB
> CONFIG_SH7757LCR
> CONFIG_SH7763RDP
> CONFIG_SH7785LCR
> 
> Most of them are config symbols named after the respective boards which
> seems to have been a standard practice at some point.
> 
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] configs: am57xx_evm: fix ethernet phy configuration

2018-01-10 Thread Tom Rini
On Wed, Dec 20, 2017 at 08:39:14PM +0530, Sekhar Nori wrote:

> Configure AM57xx EVMs for the exact PHY part that is
> present on the various boards. This makes U-Boot apply
> configurations needed for this PHY like centering the
> FLP timing.
> 
> For configurations to take effect, DM_ETH needs to be
> enabled. Do that too.
> 
> Tested on BeagleBoard x15 and AM571x IDK.
> 
> Reviewed-by: Lokesh Vutla 
> Signed-off-by: Sekhar Nori 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] linux/kernel.h: Add ALIGN_DOWN macro

2018-01-10 Thread Tom Rini
On Thu, Dec 21, 2017 at 01:51:46PM +0900, Masahiro Yamada wrote:

> Follow Linux commit ed067d4a859f ("linux/kernel.h: Add ALIGN_DOWN
> macro").
> 
> Signed-off-by: Masahiro Yamada 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 05/14] configs: stm32f429-disco: enable MISC, STM32_RCC, DM_RESET and STM32_RESET

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:36AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> This allows to support rcc MFD driver.
> By enabling all these flags, we need to increase malloc area to avoid
> crash during early stage.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 06/14] board: stm32f429-disco: switch to DM STM32 serial driver

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:37AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Remove serial_stm32.c driver and uart init from board file,
> use available DM serial_stm32x7.c driver compatible for
> STM32F4/F7 and H7 SoCs.
> 
> The serial_stm32x7.c driver will be renamed later with a more
> generic name as it's shared with all STM32 Socs.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 1/2] ARM: Drop unreferenced CONFIG_MACH_* defines

2018-01-10 Thread Tom Rini
On Thu, Dec 21, 2017 at 03:58:53AM +0200, Tuomas Tynkkynen wrote:

> These macros are all defined once and never checked or used anywhere:
> 
> CONFIG_MACH_ASPENITE
> CONFIG_MACH_DAVINCI_CALIMAIN
> CONFIG_MACH_DOCKSTAR
> CONFIG_MACH_EDMINIV2
> CONFIG_MACH_GOFLEXHOME
> CONFIG_MACH_GONI
> CONFIG_MACH_GURUPLUG
> CONFIG_MACH_KM_KIRKWOOD
> CONFIG_MACH_OPENRD_BASE
> CONFIG_MACH_SHEEVAPLUG
> 
> Almost all of them were only used for the mach_is_foo() logic in
> arch/arm/asm/mach-types.h that were dropped in
> commit f9dadaef8b75fa ("arm: Re-sync asm/mach-types.h with
> Linux Kernel v4.9")
> 
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 09/14] board: stm32f429-disco: switch to DM STM32 pinctrl and gpio driver

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:40AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Use available DM stm32f7_gpio.c and pinctrl_stm32.c drivers
> instead of board GPIO initialization.
> 
> Remove stm32_gpio.c which is no more used and migrate
> structs stm32_gpio_regs and stm32_gpio_priv into
> arch-stm32f4/gpio.h to not break compilation.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 2/2] configs: stm32f746-disco: enable MMC related flags

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 10:15:00AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> STM32F469-disco embeds an arm_pl180 mmc IP, so
> enable CMD_MMC, DM_MMC and ARM_PL180_MMCI flags.
> 
> Also enables all filesystem command related flags :
>   _ CMD_EXT2
>   _ CMD_EXT4
>   _ CMD_FAT
>   _ CMD_FS_GENERIC
>   _ CMD_GPT
>   _ CMD_BOOTZ
> 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 2/3] build: Drop CONFIG_SPL_BUILD guards in some cases

2018-01-10 Thread Tom Rini
On Thu, Dec 21, 2017 at 10:13:22PM -0500, Tom Rini wrote:

> Given gcc-6.1 and later we can now safely have strings discarded when
> the functions are unused.  This lets us drop certain cases of not
> building something so that we don't have the strings brought in when the
> code was discarded.  Simplify the code now by dropping guards we don't
> need now.
> 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: Chander Kashyap 
> Cc: Thomas Abraham 
> Cc: Vipin Kumar 
> Cc: Wenyou Yang 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] PCI: Drop CONFIG_TSI108_PCI

2018-01-10 Thread Tom Rini
On Tue, Dec 19, 2017 at 12:28:42AM +0200, Tuomas Tynkkynen wrote:

> Last user of this option went away in 2015 in commit:
> d928664f41 ("powerpc: 74xx_7xx: remove 74xx_7xx cpu support")
> 
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 13/14] board: stm32: add stm32f469-discovery board support

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:44AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> This board offers :
> 
>  _ STM32F469NIH6 microcontroller featuring 2 Mbytes of Flash memory
>and 324 Kbytes of RAM in BGA216 package
>  _ On-board ST-LINK/V2-1 SWD debugger, supporting USB reenumeration 
> capability:
>  _ Mbed-enabled (mbed.org)
>  _ USB functions: USB virtual COM port, mass storage, debug port
>  _ 4 inches 800x480 pixel TFT color LCD with MIPI DSI interface and capacitive
>touch screen
>  _ SAI Audio DAC, with a stereo headphone output jack
>  _ 3 MEMS microphones
>  _ MicroSD card connector
>  _ I2C extension connector
>  _ 4Mx32bit SDRAM
>  _ 128-Mbit Quad-SPI NOR Flash
>  _ Reset and wake-up buttons
>  _ 4 color user LEDs
>  _ USB OTG FS with Micro-AB connector
>  _ Three power supply options:
>  _ Expansion connectors and Arduino™ UNO V3 connectors
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 07/14] mach-stm32: stmf32f4: timer: remove clock_get() call

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:38AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> In order to use common clock driver between STM32F4 and
> STM32F7, remove clock_get() call
> As APB_PSC is always set to 2, only case when
> clock_get(CLOCK_AHB) != clock_get(CLOCK_APB1) is kept
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Travis-CI: Split 't208xrdb t4qds t102*'-job into separate jobs

2018-01-10 Thread Tom Rini
On Wed, Dec 20, 2017 at 11:06:31AM +0100, Philipp Tomsich wrote:

> The 't208xrdb t4qds t102*' job is close to the time limit and
> sometimes fails, so this splits it into 3 separate jobs.
> 
> Signed-off-by: Philipp Tomsich 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] BCM283x ALT5 function for JTAG pins

2018-01-10 Thread Tom Rini
On Mon, Dec 18, 2017 at 12:13:30AM -0800, henryzhan...@yahoo.com wrote:

> From: Henry Zhang 
> 
> BCM2835 ARM Peripherals doc shows gpio pins 4, 5, 6, 12 and 13 carry altenate
> function, ALT5 for ARM JTAG
> 
> Signed-off-by: Henry Zhang 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 03/14] board: stm32f429-discovery: switch to DM STM32 sdram driver

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:34AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Use available DM stm32_sdram.c driver instead of board
> SDRAM initialization.
> For that, enable OF_CONTROL, OF_EMBED and STM32_SDRAM flags.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 10/14] ram: stm32: add memory mapping selection support

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:41AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> This allows to controls the memory internal mapping at
> address 0x .
> We can either map at 0x  :
>   _ main flash memory
>   _ system flash memory
>   _ FMC bank1 (NOR/PSRAM 1 and 2)
>   _ embedded SRAM
>   _ FMC/SDRAM bank1
> 
> This is needed for future STM32F469-disco board
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 11/14] ARM: DTS: add STM32F469 Discovery board support

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:42AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> This DT file comes from kernel v4.15-rc1
> 
> stm32f469-pinctrl.dtsi header has been updated with correct
> STMicroelectronics Copyright.
> 
> Remove the paragraph about writing to the Free Software
> Foundation's mailing address as requested by checkpatch.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 1/2] ARM: DTS: stm32: add MMC nodes for stm32f746-disco and stm32f769-disco

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 10:14:59AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Add DT nodes to enable ARM_PL180_MMCI IP support for STM32F746
> and STM32F769 discovery boards
> 
> There is a hardware issue on these boards, it misses a pullup on the GPIO line
> used as card detect to allow correct SD card detection.
> As workaround, cd-gpios property is not present in DT.
> So SD card is always considered present in the slot.
> 
> Signed-off-by: Christophe Priouzeau 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 12/14] ARM: DTS: stm32: add stm32f469-disco-u-boot dts file

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:43AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
>   _ Add gpio compatible and aliases for stm32f469
> 
>   _ Add FMC sdram node
> 
>   _ Add "u-boot,dm-pre-reloc" for rcc, fmc, fixed-clock, pinctrl,
> pwrcfg and gpio nodes.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] fat write: Fixed a problem with the case of file names when writing files

2018-01-10 Thread Tom Rini
On Thu, Dec 21, 2017 at 12:49:47PM +0100, Jean-Jacques Hiblot wrote:

> commit 21a24c3bf35b ("fs/fat: fix case for FAT shortnames") made it
> possible that get_name() returns file names with some upper cases.
> find_directory_entry() must be updated to take this account, and use
> case-insensitive functions to compare file names.
> 
> Signed-off-by: Jean-Jacques Hiblot 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 14/14] ARM: DTS: stm32: add SDIO controller support for stm32f469-disco

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:45AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> STM32F469 SoC uses an arm_pl180_mmci SDIO controller.
> 
> Signed-off-by: Andrea Merello 
> Signed-off-by: Alexandre Torgue 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 08/14] board: stm32f429-disco: switch to DM STM32 clock driver

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:39AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> Use available DM clk_stm32f.c driver instead of dedicated
> mach-stm32/stm32f4/clock.c.
> 
> Migrate periph_clock defines from stm32_periph.h directly in
> CLK driver. These periph_clock defines will be removed when STMMAC,
> TIMER2 and SYSCFG drivers will support DM CLK.
> 
> Enable also CLK flag.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, RESEND, 04/14] pinctrl: stm32: add stm32f4 pinctrl compatible strings

2018-01-10 Thread Tom Rini
On Tue, Dec 12, 2017 at 09:49:35AM +0100, patrice.chot...@st.com wrote:

> From: Patrice Chotard 
> 
> STM32F4 SoCs uses the same pinctrl block as found into
> STM32F7 and H7 SoCs.
> We can add "st,stm32f429-pinctrl" and "st,stm32f469-pinctrl"
> compatible string into pinctrl_stm32.c.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


  1   2   >