From fb6a34924d0a6919443dd98223b5bd04ec86a49a Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 1 Aug 2017 09:43:10 +0100 Subject: [PATCH] 2017.09 RC1, Initial patch rebase --- AW64-add-spl-atf-support.patch | 1753 ------------------------- arm-tegra-nyan-chromebook.patch | 109 -- mx6cuboxi-Add-support-for-sata.patch | 74 -- sources | 2 +- sti-STiH410-B2260-support.patch | 1775 +------------------------- uboot-tools.spec | 27 +- 6 files changed, 59 insertions(+), 3681 deletions(-) delete mode 100644 arm-tegra-nyan-chromebook.patch delete mode 100644 mx6cuboxi-Add-support-for-sata.patch diff --git a/AW64-add-spl-atf-support.patch b/AW64-add-spl-atf-support.patch index f2fafdf..8a5cbc6 100644 --- a/AW64-add-spl-atf-support.patch +++ b/AW64-add-spl-atf-support.patch @@ -1,1197 +1,3 @@ -From patchwork Fri Mar 31 22:31:13 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,01/19] SPL: FIT: refactor FDT loading -From: Andre Przywara -X-Patchwork-Id: 745822 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-2-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:13 +0100 - -Currently the SPL FIT loader uses the spl_fit_select_fdt() function to -find the offset to the right DTB within the FIT image. -For this it iterates over all subnodes of the /configuration node in -the FIT tree and compares all "description" strings therein using a -board specific matching function. -If that finds a match, it uses the string in the "fdt" property of that -subnode to locate the matching subnode in the /images node, which points -to the DTB data. -Now this works very well, but is quite specific to cover this particular -use case. To open up the door for a more generic usage, let's split this -function into: -1) a function that just returns the node offset for the matching - configuration node (spl_fit_find_config_node()) -2) a function that returns the image data any given property in a given - configuration node points to, additionally using a given index into - a possbile list of strings (spl_fit_select_index()) -This allows us to replace the specific function above by asking for the -image the _first string of the "fdt" property_ in the matching -configuration subnode points to. - -This patch introduces no functional changes, it just refactors the code -to allow reusing it later. - -(diff is overly clever here and produces a hard-to-read patch, so I -recommend to throw a look at the result instead). - -Signed-off-by: Andre Przywara -Reviewed-by: Lokesh Vutla -Reviewed-by: Simon Glass ---- - common/spl/spl_fit.c | 88 ++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 57 insertions(+), 31 deletions(-) - -diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c -index aae556f..bf9fbb6 100644 ---- a/common/spl/spl_fit.c -+++ b/common/spl/spl_fit.c -@@ -22,13 +22,16 @@ static ulong fdt_getprop_u32(const void *fdt, int node, const char *prop) - return fdt32_to_cpu(*cell); - } - --static int spl_fit_select_fdt(const void *fdt, int images, int *fdt_offsetp) -+/* -+ * Iterate over all /configurations subnodes and call a platform specific -+ * function to find the matching configuration. -+ * Returns the node offset. -+ */ -+static int spl_fit_find_config_node(const void *fdt) - { -- const char *name, *fdt_name; -- int conf, node, fdt_node; -- int len; -+ const char *name; -+ int conf, node, len; - -- *fdt_offsetp = 0; - conf = fdt_path_offset(fdt, FIT_CONFS_PATH); - if (conf < 0) { - debug("%s: Cannot find /configurations node: %d\n", __func__, -@@ -50,39 +53,61 @@ static int spl_fit_select_fdt(const void *fdt, int images, int *fdt_offsetp) - continue; - - debug("Selecting config '%s'", name); -- fdt_name = fdt_getprop(fdt, node, FIT_FDT_PROP, &len); -- if (!fdt_name) { -- debug("%s: Cannot find fdt name property: %d\n", -- __func__, len); -- return -EINVAL; -- } - -- debug(", fdt '%s'\n", fdt_name); -- fdt_node = fdt_subnode_offset(fdt, images, fdt_name); -- if (fdt_node < 0) { -- debug("%s: Cannot find fdt node '%s': %d\n", -- __func__, fdt_name, fdt_node); -- return -EINVAL; -+ return node; -+ } -+ -+ return -1; -+} -+ -+static int spl_fit_select_index(const void *fit, int images, int *offsetp, -+ const char *type, int index) -+{ -+ const char *name, *str; -+ int node, conf_node; -+ int len, i; -+ -+ *offsetp = 0; -+ conf_node = spl_fit_find_config_node(fit); -+ if (conf_node < 0) { -+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT -+ printf("No matching DT out of these options:\n"); -+ for (node = fdt_first_subnode(fit, conf_node); -+ node >= 0; -+ node = fdt_next_subnode(fit, node)) { -+ name = fdt_getprop(fit, node, "description", &len); -+ printf(" %s\n", name); - } -+#endif -+ return -ENOENT; -+ } - -- *fdt_offsetp = fdt_getprop_u32(fdt, fdt_node, "data-offset"); -- len = fdt_getprop_u32(fdt, fdt_node, "data-size"); -- debug("FIT: Selected '%s'\n", name); -+ name = fdt_getprop(fit, conf_node, type, &len); -+ if (!name) { -+ debug("cannot find property '%s': %d\n", type, len); -+ return -EINVAL; -+ } - -- return len; -+ str = name; -+ for (i = 0; i < index; i++) { -+ str = strchr(str, '\0') + 1; -+ if (!str || (str - name >= len)) { -+ debug("no string for index %d\n", index); -+ return -E2BIG; -+ } - } - --#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT -- printf("No matching DT out of these options:\n"); -- for (node = fdt_first_subnode(fdt, conf); -- node >= 0; -- node = fdt_next_subnode(fdt, node)) { -- name = fdt_getprop(fdt, node, "description", &len); -- printf(" %s\n", name); -+ debug("%s: '%s'\n", type, str); -+ node = fdt_subnode_offset(fit, images, str); -+ if (node < 0) { -+ debug("cannot find image node '%s': %d\n", str, node); -+ return -EINVAL; - } --#endif - -- return -ENOENT; -+ *offsetp = fdt_getprop_u32(fit, node, "data-offset"); -+ len = fdt_getprop_u32(fit, node, "data-size"); -+ -+ return len; - } - - static int get_aligned_image_offset(struct spl_load_info *info, int offset) -@@ -218,7 +243,8 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - memcpy(dst, src, data_size); - - /* Figure out which device tree the board wants to use */ -- fdt_len = spl_fit_select_fdt(fit, images, &fdt_offset); -+ fdt_len = spl_fit_select_index(fit, images, &fdt_offset, -+ FIT_FDT_PROP, 0); - if (fdt_len < 0) - return fdt_len; - -From patchwork Fri Mar 31 22:31:14 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,02/19] SPL: FIT: rework U-Boot image loading -From: Andre Przywara -X-Patchwork-Id: 745823 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-3-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:14 +0100 - -Currently the SPL FIT loader always looks only for the first image in -the /images node a FIT tree, which it loads and later executes. - -Generalize this by looking for a "firmware" property in the matched -configuration subnode, or, if that does not exist, for the first string -in the "loadables" property. Then using the string in that property, -load the image of that name from the /images node. -This still loads only one image at the moment, but refactors the code to -allow extending this in a following patch. -To simplify later re-usage, we also generalize the spl_fit_select_index() -function to not return the image location, but just the node offset. - -Signed-off-by: Andre Przywara -Reviewed-by: Lokesh Vutla -Reviewed-by: Simon Glass ---- - common/spl/spl_fit.c | 45 +++++++++++++++++++++++++++++++-------------- - 1 file changed, 31 insertions(+), 14 deletions(-) - -diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c -index bf9fbb6..a4ac27b 100644 ---- a/common/spl/spl_fit.c -+++ b/common/spl/spl_fit.c -@@ -60,14 +60,24 @@ static int spl_fit_find_config_node(const void *fdt) - return -1; - } - --static int spl_fit_select_index(const void *fit, int images, int *offsetp, -- const char *type, int index) -+/* -+ * By using the matching configuration subnode, retrieve the name of an image, -+ * specified by a property name and an index into that. -+ * @fit: Pointer to the FDT blob. -+ * @images: Offset of the /images subnode. -+ * @type: Name of the property within the configuration subnode. -+ * @index: Index into the list of strings in this property. -+ * -+ * Returns the node offset of the respective image node or a negative error -+ * number. -+ */ -+static int spl_fit_get_image_node(const void *fit, int images, -+ const char *type, int index) - { - const char *name, *str; - int node, conf_node; - int len, i; - -- *offsetp = 0; - conf_node = spl_fit_find_config_node(fit); - if (conf_node < 0) { - #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT -@@ -104,10 +114,7 @@ static int spl_fit_select_index(const void *fit, int images, int *offsetp, - return -EINVAL; - } - -- *offsetp = fdt_getprop_u32(fit, node, "data-offset"); -- len = fdt_getprop_u32(fit, node, "data-size"); -- -- return len; -+ return node; - } - - static int get_aligned_image_offset(struct spl_load_info *info, int offset) -@@ -193,15 +200,22 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - if (count == 0) - return -EIO; - -- /* find the firmware image to load */ -+ /* find the node holding the images information */ - images = fdt_path_offset(fit, FIT_IMAGES_PATH); - if (images < 0) { - debug("%s: Cannot find /images node: %d\n", __func__, images); - return -1; - } -- node = fdt_first_subnode(fit, images); -+ -+ /* find the U-Boot image */ -+ node = spl_fit_get_image_node(fit, images, "firmware", 0); -+ if (node < 0) { -+ debug("could not find firmware image, trying loadables...\n"); -+ node = spl_fit_get_image_node(fit, images, "loadables", 0); -+ } - if (node < 0) { -- debug("%s: Cannot find first image node: %d\n", __func__, node); -+ debug("%s: Cannot find u-boot image node: %d\n", -+ __func__, node); - return -1; - } - -@@ -243,10 +257,13 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - memcpy(dst, src, data_size); - - /* Figure out which device tree the board wants to use */ -- fdt_len = spl_fit_select_index(fit, images, &fdt_offset, -- FIT_FDT_PROP, 0); -- if (fdt_len < 0) -- return fdt_len; -+ node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0); -+ if (node < 0) { -+ debug("%s: cannot find FDT node\n", __func__); -+ return node; -+ } -+ fdt_offset = fdt_getprop_u32(fit, node, "data-offset"); -+ fdt_len = fdt_getprop_u32(fit, node, "data-size"); - - /* - * Read the device tree and place it after the image. There may be -From patchwork Fri Mar 31 22:31:15 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,03/19] SPL: FIT: improve error handling -From: Andre Przywara -X-Patchwork-Id: 745824 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-4-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:15 +0100 - -At the moment we ignore any errors due to missing FIT properties, -instead go ahead and calculate our addresses with the -1 return value. -Fix this and bail out if any of the mandatory properties are missing. - -Signed-off-by: Andre Przywara -Reviewed-by: Simon Glass ---- - common/spl/spl_fit.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c -index a4ac27b..55da37a 100644 ---- a/common/spl/spl_fit.c -+++ b/common/spl/spl_fit.c -@@ -11,14 +11,17 @@ - #include - #include - -+#define FDT_ERROR ((ulong)(-1)) -+ - static ulong fdt_getprop_u32(const void *fdt, int node, const char *prop) - { - const u32 *cell; - int len; - - cell = fdt_getprop(fdt, node, prop, &len); -- if (len != sizeof(*cell)) -- return -1U; -+ if (!cell || len != sizeof(*cell)) -+ return FDT_ERROR; -+ - return fdt32_to_cpu(*cell); - } - -@@ -221,7 +224,11 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - - /* Get its information and set up the spl_image structure */ - data_offset = fdt_getprop_u32(fit, node, "data-offset"); -+ if (data_offset == FDT_ERROR) -+ return -1; - data_size = fdt_getprop_u32(fit, node, "data-size"); -+ if (data_size == FDT_ERROR) -+ return -1; - load = fdt_getprop_u32(fit, node, "load"); - debug("data_offset=%x, data_size=%x\n", data_offset, data_size); - spl_image->load_addr = load; -@@ -264,6 +271,10 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - } - fdt_offset = fdt_getprop_u32(fit, node, "data-offset"); - fdt_len = fdt_getprop_u32(fit, node, "data-size"); -+ if (fdt_offset == FDT_ERROR || fdt_len == FDT_ERROR) { -+ debug("%s: cannot load FDT data\n" __func__); -+ return -1; -+ } - - /* - * Read the device tree and place it after the image. There may be -From patchwork Fri Mar 31 22:31:16 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,04/19] SPL: FIT: factor out spl_load_fit_image() -From: Andre Przywara -X-Patchwork-Id: 745826 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-5-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:16 +0100 - -At the moment we load two images from a FIT image: the actual U-Boot -image and the .dtb file. Both times we have very similar code, that deals -with alignment requirements the media we load from imposes upon us. -Factor out this code into a new function, which we just call twice. - -Signed-off-by: Andre Przywara -Reviewed-by: Simon Glass ---- - common/spl/spl_fit.c | 160 +++++++++++++++++++++++++-------------------------- - 1 file changed, 78 insertions(+), 82 deletions(-) - -diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c -index 55da37a..cfcb1fe 100644 ---- a/common/spl/spl_fit.c -+++ b/common/spl/spl_fit.c -@@ -158,19 +158,79 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size, - return (data_size + info->bl_len - 1) / info->bl_len; - } - -+/* -+ * spl_load_fit_image loads the image described in a certain FIT node. -+ * @info: points to information about the device to load data from -+ * @sector: the start sector of the FIT image on the device -+ * @fit: points to the flattened device tree blob describing the FIT image -+ * @base_offset: the beginning of the data area containing the actual -+ * image data, relative to the beginning of the FIT -+ * @node: offset of the DT node describing the image to load (relative to @fit) -+ * @image_info: will be filled with information about the loaded image -+ * If the FIT node does not contain a "load" (address) property, -+ * the image gets loaded to the address pointed to by the -+ * load_addr member in this struct. -+ * -+ * Returns an error value or 0 on success. -+ */ -+static int spl_load_fit_image(struct spl_load_info *info, ulong sector, -+ void *fit, ulong base_offset, int node, -+ struct spl_image_info *image_info) -+{ -+ ulong offset; -+ size_t length; -+ ulong load_addr, load_ptr; -+ void *src; -+ ulong overhead; -+ int nr_sectors; -+ int align_len = ARCH_DMA_MINALIGN - 1; -+ -+ offset = fdt_getprop_u32(fit, node, "data-offset"); -+ if (offset == FDT_ERROR) -+ return -ENOENT; -+ offset += base_offset; -+ length = fdt_getprop_u32(fit, node, "data-size"); -+ if (length == FDT_ERROR) -+ return -ENOENT; -+ load_addr = fdt_getprop_u32(fit, node, "load"); -+ if (load_addr == FDT_ERROR && image_info) -+ load_addr = image_info->load_addr; -+ load_ptr = (load_addr + align_len) & ~align_len; -+ -+ overhead = get_aligned_image_overhead(info, offset); -+ nr_sectors = get_aligned_image_size(info, length, offset); -+ -+ if (info->read(info, sector + get_aligned_image_offset(info, offset), -+ nr_sectors, (void*)load_ptr) != nr_sectors) -+ return -EIO; -+ debug("image: dst=%lx, offset=%lx, size=%lx\n", load_ptr, offset, -+ (unsigned long)length); -+ -+ src = (void *)load_ptr + overhead; -+#ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS -+ board_fit_image_post_process(&src, &length); -+#endif -+ -+ memcpy((void*)load_addr, src, length); -+ -+ if (image_info) { -+ image_info->load_addr = load_addr; -+ image_info->size = length; -+ image_info->entry_point = fdt_getprop_u32(fit, node, "entry"); -+ } -+ -+ return 0; -+} -+ - int spl_load_simple_fit(struct spl_image_info *spl_image, - struct spl_load_info *info, ulong sector, void *fit) - { - int sectors; -- ulong size, load; -+ ulong size; - unsigned long count; -- int node, images; -- void *load_ptr; -- int fdt_offset, fdt_len; -- int data_offset, data_size; -+ struct spl_image_info image_info; -+ int node, images, ret; - int base_offset, align_len = ARCH_DMA_MINALIGN - 1; -- int src_sector; -- void *dst, *src; - - /* - * Figure out where the external images start. This is the base for the -@@ -222,46 +282,13 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - return -1; - } - -- /* Get its information and set up the spl_image structure */ -- data_offset = fdt_getprop_u32(fit, node, "data-offset"); -- if (data_offset == FDT_ERROR) -- return -1; -- data_size = fdt_getprop_u32(fit, node, "data-size"); -- if (data_size == FDT_ERROR) -- return -1; -- load = fdt_getprop_u32(fit, node, "load"); -- debug("data_offset=%x, data_size=%x\n", data_offset, data_size); -- spl_image->load_addr = load; -- spl_image->entry_point = load; -- spl_image->os = IH_OS_U_BOOT; -- -- /* -- * Work out where to place the image. We read it so that the first -- * byte will be at 'load'. This may mean we need to load it starting -- * before then, since we can only read whole blocks. -- */ -- data_offset += base_offset; -- sectors = get_aligned_image_size(info, data_size, data_offset); -- load_ptr = (void *)load; -- debug("U-Boot size %x, data %p\n", data_size, load_ptr); -- dst = load_ptr; -- -- /* Read the image */ -- src_sector = sector + get_aligned_image_offset(info, data_offset); -- debug("Aligned image read: dst=%p, src_sector=%x, sectors=%x\n", -- dst, src_sector, sectors); -- count = info->read(info, src_sector, sectors, dst); -- if (count != sectors) -- return -EIO; -- debug("image: dst=%p, data_offset=%x, size=%x\n", dst, data_offset, -- data_size); -- src = dst + get_aligned_image_overhead(info, data_offset); -+ /* Load the image and set up the spl_image structure */ -+ ret = spl_load_fit_image(info, sector, fit, base_offset, node, -+ spl_image); -+ if (ret) -+ return ret; - --#ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS -- board_fit_image_post_process((void **)&src, (size_t *)&data_size); --#endif -- -- memcpy(dst, src, data_size); -+ spl_image->os = IH_OS_U_BOOT; - - /* Figure out which device tree the board wants to use */ - node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0); -@@ -269,43 +296,12 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - debug("%s: cannot find FDT node\n", __func__); - return node; - } -- fdt_offset = fdt_getprop_u32(fit, node, "data-offset"); -- fdt_len = fdt_getprop_u32(fit, node, "data-size"); -- if (fdt_offset == FDT_ERROR || fdt_len == FDT_ERROR) { -- debug("%s: cannot load FDT data\n" __func__); -- return -1; -- } - - /* -- * Read the device tree and place it after the image. There may be -- * some extra data before it since we can only read entire blocks. -- * And also align the destination address to ARCH_DMA_MINALIGN. -+ * Read the device tree and place it after the image. -+ * Align the destination address to ARCH_DMA_MINALIGN. - */ -- dst = (void *)((load + data_size + align_len) & ~align_len); -- fdt_offset += base_offset; -- sectors = get_aligned_image_size(info, fdt_len, fdt_offset); -- src_sector = sector + get_aligned_image_offset(info, fdt_offset); -- count = info->read(info, src_sector, sectors, dst); -- debug("Aligned fdt read: dst %p, src_sector = %x, sectors %x\n", -- dst, src_sector, sectors); -- if (count != sectors) -- return -EIO; -- -- /* -- * Copy the device tree so that it starts immediately after the image. -- * After this we will have the U-Boot image and its device tree ready -- * for us to start. -- */ -- debug("fdt: dst=%p, data_offset=%x, size=%x\n", dst, fdt_offset, -- fdt_len); -- src = dst + get_aligned_image_overhead(info, fdt_offset); -- dst = load_ptr + data_size; -- --#ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS -- board_fit_image_post_process((void **)&src, (size_t *)&fdt_len); --#endif -- -- memcpy(dst, src, fdt_len); -- -- return 0; -+ image_info.load_addr = spl_image->load_addr + spl_image->size; -+ return spl_load_fit_image(info, sector, fit, base_offset, node, -+ &image_info); - } -From patchwork Fri Mar 31 22:31:17 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,05/19] SPL: FIT: allow loading multiple images -From: Andre Przywara -X-Patchwork-Id: 745827 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-6-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:17 +0100 - -So far we were not using the FIT image format to its full potential: -The SPL FIT loader was just loading the first image from the /images -node plus one of the listed DTBs. -Now with the refactored loader code it's easy to load an arbitrary -number of images in addition to the two mentioned above. -As described in the FIT image source file format description, iterate -over all images listed at the "loadables" property in the configuration -node and load every image at its desired location. -This allows to load any kind of images: -- firmware images to execute before U-Boot proper (for instance - ARM Trusted Firmware (ATF)) -- firmware images for management processors (SCP, arisc, ...) -- firmware images for devices like WiFi controllers -- bit files for FPGAs -- additional configuration data -- kernels and/or ramdisks -The actual usage of this feature would be platform and/or board specific. - -Also update the FIT documentation to mention the new SPL feature. - -Signed-off-by: Andre Przywara -Reviewed-by: Lokesh Vutla -Reviewed-by: Simon Glass ---- - common/spl/spl_fit.c | 42 ++++++++++++++++++++++++++++++++++++++++-- - doc/uImage.FIT/howto.txt | 21 +++++++++++++++++++++ - 2 files changed, 61 insertions(+), 2 deletions(-) - -diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c -index cfcb1fe..edf4a43 100644 ---- a/common/spl/spl_fit.c -+++ b/common/spl/spl_fit.c -@@ -231,6 +231,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - struct spl_image_info image_info; - int node, images, ret; - int base_offset, align_len = ARCH_DMA_MINALIGN - 1; -+ int index = 0; - - /* - * Figure out where the external images start. This is the base for the -@@ -275,6 +276,11 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - if (node < 0) { - debug("could not find firmware image, trying loadables...\n"); - node = spl_fit_get_image_node(fit, images, "loadables", 0); -+ /* -+ * If we pick the U-Boot image from "loadables", start at -+ * the second image when later loading additional images. -+ */ -+ index = 1; - } - if (node < 0) { - debug("%s: Cannot find u-boot image node: %d\n", -@@ -302,6 +308,38 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, - * Align the destination address to ARCH_DMA_MINALIGN. - */ - image_info.load_addr = spl_image->load_addr + spl_image->size; -- return spl_load_fit_image(info, sector, fit, base_offset, node, -- &image_info); -+ ret = spl_load_fit_image(info, sector, fit, base_offset, node, -+ &image_info); -+ if (ret < 0) -+ return ret; -+ -+ /* Now check if there are more images for us to load */ -+ for (; ; index++) { -+ node = spl_fit_get_image_node(fit, images, "loadables", index); -+ if (node < 0) -+ break; -+ -+ ret = spl_load_fit_image(info, sector, fit, base_offset, node, -+ &image_info); -+ if (ret < 0) -+ continue; -+ -+ /* -+ * If the "firmware" image did not provide an entry point, -+ * use the first valid entry point from the loadables. -+ */ -+ if (spl_image->entry_point == FDT_ERROR && -+ image_info.entry_point != FDT_ERROR) -+ spl_image->entry_point = image_info.entry_point; -+ } -+ -+ /* -+ * If a platform does not provide CONFIG_SYS_UBOOT_START, U-Boot's -+ * Makefile will set it to 0 and it will end up as the entry point -+ * here. What it actually means is: use the load address. -+ */ -+ if (spl_image->entry_point == FDT_ERROR || spl_image->entry_point == 0) -+ spl_image->entry_point = spl_image->load_addr; -+ -+ return 0; - } -diff --git a/doc/uImage.FIT/howto.txt b/doc/uImage.FIT/howto.txt -index 14e316f..2988a52 100644 ---- a/doc/uImage.FIT/howto.txt -+++ b/doc/uImage.FIT/howto.txt -@@ -44,6 +44,27 @@ image source file mkimage + dtc transfer to target - + ---------------> image file --------------------> bootm - image data file(s) - -+SPL usage -+--------- -+ -+The SPL can make use of the new image format as well, this traditionally -+is used to ship multiple device tree files within one image. Code in the SPL -+will choose the one matching the current board and append this to the -+U-Boot proper binary to be automatically used up by it. -+Aside from U-Boot proper and one device tree blob the SPL can load multiple, -+arbitrary image files as well. These binaries should be specified in their -+own subnode under the /images node, which should then be referenced from one or -+multiple /configurations subnodes. The required images must be enumerated in -+the "loadables" property as a list of strings. -+ -+If a platform specific image source file (.its) is shipped with the U-Boot -+source, it can be specified using the CONFIG_SPL_FIT_SOURCE Kconfig symbol. -+In this case it will be automatically used by U-Boot's Makefile to generate -+the image. -+If a static source file is not flexible enough, CONFIG_SPL_FIT_GENERATOR -+can point to a script which generates this image source file during -+the build process. It gets passed a list of device tree files (taken from the -+CONFIG_OF_LIST symbol). - - Example 1 -- old-style (non-FDT) kernel booting - ----------------------------------------------- -From patchwork Fri Mar 31 22:31:18 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,06/19] Kconfig: fix SPL_FIT dependency -From: Andre Przywara -X-Patchwork-Id: 745825 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-7-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:18 +0100 - -SPL_FIT obviously requires libfdt in SPL, so let Kconfig express that by -selecting SPL_OF_LIBFDT. -Also make the actual options that users want (SPL signature and SPL FIT -loading) visible in the menu and let them select the SPL_FIT as a -requirement. -Also remove the now redundant SPL_OF_LIBFDT from those Kconfigs that had -it in for the SPL FIT loading feature. - -Signed-off-by: Andre Przywara ---- - Kconfig | 4 +++- - configs/am335x_evm_defconfig | 1 - - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/Kconfig b/Kconfig -index e0744d1..a2f45d3 100644 ---- a/Kconfig -+++ b/Kconfig -@@ -208,15 +208,17 @@ config FIT_IMAGE_POST_PROCESS - config SPL_FIT - bool "Support Flattened Image Tree within SPL" - depends on SPL -+ select SPL_OF_LIBFDT - - config SPL_FIT_SIGNATURE - bool "Enable signature verification of FIT firmware within SPL" -- depends on SPL_FIT - depends on SPL_DM -+ select SPL_FIT - select SPL_RSA - - config SPL_LOAD_FIT - bool "Enable SPL loading U-Boot as a FIT" -+ select SPL_FIT - help - Normally with the SPL framework a legacy image is generated as part - of the build. This contains U-Boot along with information as to -diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig -index ab7b9aa..525d07e 100644 ---- a/configs/am335x_evm_defconfig -+++ b/configs/am335x_evm_defconfig -@@ -57,4 +57,3 @@ CONFIG_G_DNL_MANUFACTURER="Texas Instruments" - CONFIG_G_DNL_VENDOR_NUM=0x0451 - CONFIG_G_DNL_PRODUCT_NUM=0xd022 - CONFIG_RSA=y --CONFIG_SPL_OF_LIBFDT=y -From patchwork Fri Mar 31 22:31:19 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,07/19] tools: mksunxiboot: allow larger SPL binaries -From: Andre Przywara -X-Patchwork-Id: 745829 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-8-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:19 +0100 - -mksunxiboot limits the size of the resulting SPL binaries to pretty -conservative values to cover all SoCs and all boot media (NAND). -It turns out that we have limit checks in place in the build process, -so mksunxiboot can be relaxed and allow packaging binaries up to the -actual 32KB the mask boot ROM actually imposes. -This allows to have a bigger SPL, which is crucial for AArch64 builds. - -Signed-off-by: Andre Przywara -Reviewed-by: Simon Glass ---- - tools/mksunxiboot.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tools/mksunxiboot.c b/tools/mksunxiboot.c -index 0f0b003..111d74a 100644 ---- a/tools/mksunxiboot.c -+++ b/tools/mksunxiboot.c -@@ -48,8 +48,8 @@ int gen_check_sum(struct boot_file_head *head_p) - #define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a)-1) - #define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) - --#define SUN4I_SRAM_SIZE 0x7600 /* 0x7748+ is used by BROM */ --#define SRAM_LOAD_MAX_SIZE (SUN4I_SRAM_SIZE - sizeof(struct boot_file_head)) -+#define SUNXI_SRAM_SIZE 0x8000 /* SoC with smaller size are limited before */ -+#define SRAM_LOAD_MAX_SIZE (SUNXI_SRAM_SIZE - sizeof(struct boot_file_head)) - - /* - * BROM (at least on A10 and A20) requires NAND-images to be explicitly aligned -From patchwork Fri Mar 31 22:31:20 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,08/19] armv8: SPL: only compile GIC code if needed -From: Andre Przywara -X-Patchwork-Id: 745832 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-9-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:20 +0100 - -Not every SoC needs to set up the GIC interrupt controller, so link -think code only when the respective config option is set. -This shaves off some bytes from the SPL code size. - -Signed-off-by: Andre Przywara -Reviewed-by: Simon Glass ---- - arch/arm/lib/Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile -index b95e105..5733430 100644 ---- a/arch/arm/lib/Makefile -+++ b/arch/arm/lib/Makefile -@@ -44,7 +44,9 @@ ifdef CONFIG_CPU_V7M - obj-y += interrupts_m.o - else ifdef CONFIG_ARM64 - obj-y += ccn504.o -+ifneq ($(CONFIG_GICV2)$(CONFIG_GICV3),) - obj-y += gic_64.o -+endif - obj-y += interrupts_64.o - else - obj-y += interrupts.o -From patchwork Fri Mar 31 22:31:21 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,09/19] armv8: fsl: move ccn504 code into FSL Makefile -From: Andre Przywara -X-Patchwork-Id: 745839 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-10-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:21 +0100 - -The generic ARMv8 assembly code contains routines for setting up -a CCN interconnect, though the Freescale SoCs are the only user. -Link this code only for Freescale targets, this saves some precious -bytes in the chronically tight SPL. - -Signed-off-by: Andre Przywara ---- - arch/arm/lib/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile -index 5733430..82154f6 100644 ---- a/arch/arm/lib/Makefile -+++ b/arch/arm/lib/Makefile -@@ -43,7 +43,7 @@ obj-y += stack.o - ifdef CONFIG_CPU_V7M - obj-y += interrupts_m.o - else ifdef CONFIG_ARM64 --obj-y += ccn504.o -+obj-$(CONFIG_FSL_LAYERSCAPE) += ccn504.o - ifneq ($(CONFIG_GICV2)$(CONFIG_GICV3),) - obj-y += gic_64.o - endif -From patchwork Fri Mar 31 22:31:22 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,10/19] sunxi: A64: move SPL stack to end of SRAM A2 -From: Andre Przywara -X-Patchwork-Id: 745830 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-11-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:22 +0100 - -The SPL stack is usually located at the end of SRAM A1, where it grows -towards the end of the SPL. -For the really big AArch64 binaries the stack overwrites code pretty -soon, so move the SPL stack to the end of SRAM A2, which is unused at this -time. - -Signed-off-by: Andre Przywara -Reviewed-by: Simon Glass -Acked-by: Maxime Ripard ---- - include/configs/sunxi-common.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h -index 171cea2..b7eb95e 100644 ---- a/include/configs/sunxi-common.h -+++ b/include/configs/sunxi-common.h -@@ -182,7 +182,12 @@ - #ifdef CONFIG_SUNXI_HIGH_SRAM - #define CONFIG_SPL_TEXT_BASE 0x10040 /* sram start+header */ - #define CONFIG_SPL_MAX_SIZE 0x7fc0 /* 32 KiB */ -+#ifdef CONFIG_ARM64 -+/* end of SRAM A2 for now, as SRAM A1 is pretty tight for an ARM64 build */ -+#define LOW_LEVEL_SRAM_STACK 0x00054000 -+#else - #define LOW_LEVEL_SRAM_STACK 0x00018000 -+#endif /* !CONFIG_ARM64 */ - #else - #define CONFIG_SPL_TEXT_BASE 0x40 /* sram start+header */ - #define CONFIG_SPL_MAX_SIZE 0x5fc0 /* 24KB on sun4i/sun7i */ -From patchwork Fri Mar 31 22:31:23 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,11/19] sunxi: SPL: store RAM size in gd -From: Andre Przywara -X-Patchwork-Id: 745837 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-12-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:23 +0100 - -The sunxi SPL was holding the detected RAM size in some local variable -only, so it wasn't accessible for other functions. -Store the value in gd->ram_size instead, so it can be used later on. - -Signed-off-by: Andre Przywara -Reviewed-by: Simon Glass -Acked-by: Maxime Ripard ---- - board/sunxi/board.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/board/sunxi/board.c b/board/sunxi/board.c -index b966012..a510422 100644 ---- a/board/sunxi/board.c -+++ b/board/sunxi/board.c -@@ -480,7 +480,6 @@ void i2c_init_board(void) - void sunxi_board_init(void) - { - int power_failed = 0; -- unsigned long ramsize; - - #ifdef CONFIG_SY8106A_POWER - power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT); -@@ -541,9 +540,9 @@ void sunxi_board_init(void) - #endif - #endif - printf("DRAM:"); -- ramsize = sunxi_dram_init(); -- printf(" %d MiB\n", (int)(ramsize >> 20)); -- if (!ramsize) -+ gd->ram_size = sunxi_dram_init(); -+ printf(" %d MiB\n", (int)(gd->ram_size >> 20)); -+ if (!gd->ram_size) - hang(); - - /* -From patchwork Fri Mar 31 22:31:24 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot, v3, - 12/19] sunxi: SPL: add FIT config selector for Pine64 boards -From: Andre Przywara -X-Patchwork-Id: 745838 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-13-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:24 +0100 - -For a board or platform to support FIT loading in the SPL, it has to -provide a board_fit_config_name_match() routine, which helps to select -one of possibly multiple DTBs contained in a FIT image. -Provide a simple function which chooses the DT name U-Boot was -configured with. -If the DT name is one of the two Pine64 versions, determine the exact -model by checking the DRAM size. - -Signed-off-by: Andre Przywara -Reviewed-by: Simon Glass -Acked-by: Maxime Ripard ---- - board/sunxi/board.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/board/sunxi/board.c b/board/sunxi/board.c -index a510422..2ddff28 100644 ---- a/board/sunxi/board.c -+++ b/board/sunxi/board.c -@@ -725,3 +725,26 @@ int ft_board_setup(void *blob, bd_t *bd) - #endif - return 0; - } -+ -+#ifdef CONFIG_SPL_LOAD_FIT -+int board_fit_config_name_match(const char *name) -+{ -+ const char *cmp_str; -+ -+#ifdef CONFIG_DEFAULT_DEVICE_TREE -+ cmp_str = CONFIG_DEFAULT_DEVICE_TREE; -+#else -+ return 0; -+#endif -+ -+/* Differentiate the two Pine64 board DTs by their DRAM size. */ -+ if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) { -+ if ((gd->ram_size > 512 * 1024 * 1024)) -+ return !strstr(name, "plus"); -+ else -+ return !!strstr(name, "plus"); -+ } else { -+ return strcmp(name, cmp_str); -+ } -+} -+#endif -From patchwork Fri Mar 31 22:31:25 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot,v3,13/19] Makefile: add rules to generate SPL FIT images -From: Andre Przywara -X-Patchwork-Id: 745835 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-14-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:25 +0100 - -Some platforms require more complex U-Boot images than we can easily -generate via the mkimage command line, for instance to load additional -image files. -Introduce a CONFIG_SPL_FIT_SOURCE and CONFIG_SPL_FIT_GENERATOR symbol, -which can either hold an .its source file describing the image layout, -or, in the second case, a generator tool (script) to create such -a source file. This script gets passed the list of device tree files -from the CONFIG_OF_LIST variable. -A platform or board can define either of those in their defconfig file -to allow an easy building of such an image. - -Signed-off-by: Andre Przywara ---- - Kconfig | 17 +++++++++++++++++ - Makefile | 20 ++++++++++++++++++++ - 2 files changed, 37 insertions(+) - -diff --git a/Kconfig b/Kconfig -index a2f45d3..5c82788 100644 ---- a/Kconfig -+++ b/Kconfig -@@ -241,6 +241,23 @@ config SPL_FIT_IMAGE_POST_PROCESS - injected into the FIT creation (i.e. the blobs would have been pre- - processed before being added to the FIT image). - -+config SPL_FIT_SOURCE -+ string ".its source file for U-Boot FIT image" -+ depends on SPL_FIT -+ help -+ Specifies a (platform specific) FIT source file to generate the -+ U-Boot FIT image. This could specify further image to load and/or -+ execute. -+ -+config SPL_FIT_GENERATOR -+ string ".its file generator script for U-Boot FIT image" -+ depends on SPL_FIT -+ help -+ Specifies a (platform specific) script file to generate the FIT -+ source file used to build the U-Boot FIT image file. This gets -+ passed a list of supported device tree file stub names to -+ include in the generated image. -+ - endif # FIT - - config OF_BOARD_SETUP -diff --git a/Makefile b/Makefile -index 539fb20..5ecf40f 100644 ---- a/Makefile -+++ b/Makefile -@@ -827,6 +827,10 @@ quiet_cmd_mkimage = MKIMAGE $@ - cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \ - $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) - -+quiet_cmd_mkfitimage = MKIMAGE $@ -+cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -f $(U_BOOT_ITS) -E $@ \ -+ $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT)) -+ - quiet_cmd_cat = CAT $@ - cmd_cat = cat $(filter-out $(PHONY), $^) > $@ - -@@ -946,6 +950,19 @@ quiet_cmd_cpp_cfg = CFG $@ - cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ - -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $< - -+# Boards with more complex image requirments can provide an .its source file -+# or a generator script -+ifneq ($(CONFIG_SPL_FIT_SOURCE),"") -+U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) -+else -+ifneq ($(CONFIG_SPL_FIT_GENERATOR),"") -+U_BOOT_ITS := u-boot.its -+$(U_BOOT_ITS): FORCE -+ $(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \ -+ $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@ -+endif -+endif -+ - ifdef CONFIG_SPL_LOAD_FIT - MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ - -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -@@ -978,6 +995,9 @@ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ - $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin dts/dt.dtb,u-boot.bin) FORCE - $(call if_changed,mkimage) - -+u-boot.itb: u-boot-nodtb.bin dts/dt.dtb $(U_BOOT_ITS) FORCE -+ $(call if_changed,mkfitimage) -+ - u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE - $(call if_changed,mkimage) - From patchwork Fri Mar 31 22:31:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 @@ -1307,47 +113,6 @@ index 0000000..afa22e8 + }; +}; +__ITS_EOF -From patchwork Fri Mar 31 22:31:27 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot, v3, - 15/19] sunxi: defconfig: add supported DT list for Pine64 and - OrangePi PC 2 -From: Andre Przywara -X-Patchwork-Id: 745834 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-16-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:27 +0100 - -When a board uses a FIT image to load U-Boot proper, it requires a list -of supported device trees to be supplied, from which it chooses the -right one at runtime. -Add this list for the Pine64 and OrangePi PC2 board. - -Signed-off-by: Andre Przywara ---- - configs/pine64_plus_defconfig | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/configs/pine64_plus_defconfig b/configs/pine64_plus_defconfig -index 92bda60..593e24a 100644 ---- a/configs/pine64_plus_defconfig -+++ b/configs/pine64_plus_defconfig -@@ -3,6 +3,7 @@ CONFIG_ARCH_SUNXI=y - CONFIG_MACH_SUN50I=y - CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y - CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pine64-plus" -+CONFIG_OF_LIST="sun50i-a64-pine64 sun50i-a64-pine64-plus" - # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set - CONFIG_CONSOLE_MUX=y - CONFIG_SPL=y From patchwork Fri Mar 31 22:31:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 @@ -1426,522 +191,4 @@ index b7eb95e..1982063 100644 /* Serial & console */ #define CONFIG_SYS_NS16550_SERIAL /* ns16550 reg in the low bits of cpu reg */ -From patchwork Fri Mar 31 22:31:29 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot, v3, - 17/19] sunxi: Store the device tree name in the SPL header -From: Andre Przywara -X-Patchwork-Id: 745828 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-18-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:29 +0100 - -From: Siarhei Siamashka - -This patch updates the mksunxiboot tool to optionally add -the default device tree name string to the SPL header. This -information can be used by the firmware upgrade tools to -protect users from harming themselves by trying to upgrade -to an incompatible bootloader. - -The primary use case here is a non-removable bootable media -(such as NAND, eMMC or SPI flash), which already may have -a properly working, but a little bit outdated bootloader -installed. For example, the user may download or build a -new U-Boot image for "Cubieboard", and then attemept to -install it on a "Cubieboard2" hardware by mistake as a -replacement for the already existing bootloader. If this -happens, the flash programming tool can identify this -problem and warn the user. - -The size of the SPL header is also increased from 64 bytes -to 96 bytes to provide enough space for the device tree name -string. -[Andre: split patch to remove OF_LIST hash feature] - -Signed-off-by: Siarhei Siamashka -Signed-off-by: Andre Przywara ---- - arch/arm/include/asm/arch-sunxi/spl.h | 19 +++++++++++--- - include/configs/sunxi-common.h | 8 +++--- - scripts/Makefile.spl | 3 ++- - tools/mksunxiboot.c | 49 ++++++++++++++++++++++++++++++++--- - 4 files changed, 67 insertions(+), 12 deletions(-) - -diff --git a/arch/arm/include/asm/arch-sunxi/spl.h b/arch/arm/include/asm/arch-sunxi/spl.h -index 831d0c0..9358397 100644 ---- a/arch/arm/include/asm/arch-sunxi/spl.h -+++ b/arch/arm/include/asm/arch-sunxi/spl.h -@@ -10,7 +10,7 @@ - - #define BOOT0_MAGIC "eGON.BT0" - #define SPL_SIGNATURE "SPL" /* marks "sunxi" SPL header */ --#define SPL_HEADER_VERSION 1 -+#define SPL_HEADER_VERSION 2 - - #ifdef CONFIG_SUNXI_HIGH_SRAM - #define SPL_ADDR 0x10000 -@@ -58,11 +58,24 @@ struct boot_file_head { - * compatible format, ready to be imported via "env import -t". - */ - uint32_t fel_uEnv_length; -- uint32_t reserved1[2]; -+ /* -+ * Offset of an ASCIIZ string (relative to the SPL header), which -+ * contains the default device tree name (CONFIG_DEFAULT_DEVICE_TREE). -+ * This is optional and may be set to NULL. Is intended to be used -+ * by flash programming tools for providing nice informative messages -+ * to the users. -+ */ -+ uint32_t dt_name_offset; -+ uint32_t reserved1; - uint32_t boot_media; /* written here by the boot ROM */ -- uint32_t reserved2[5]; /* padding, align to 64 bytes */ -+ /* A padding area (may be used for storing text strings) */ -+ uint32_t string_pool[13]; -+ /* The header must be a multiple of 32 bytes (for VBAR alignment) */ - }; - -+/* Compile time check to assure proper alignment of structure */ -+typedef char boot_file_head_not_multiple_of_32[1 - 2*(sizeof(struct boot_file_head) % 32)]; -+ - #define is_boot0_magic(addr) (memcmp((void *)addr, BOOT0_MAGIC, 8) == 0) - - #endif -diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h -index 1982063..65f0f69 100644 ---- a/include/configs/sunxi-common.h -+++ b/include/configs/sunxi-common.h -@@ -184,8 +184,8 @@ - #endif - - #ifdef CONFIG_SUNXI_HIGH_SRAM --#define CONFIG_SPL_TEXT_BASE 0x10040 /* sram start+header */ --#define CONFIG_SPL_MAX_SIZE 0x7fc0 /* 32 KiB */ -+#define CONFIG_SPL_TEXT_BASE 0x10060 /* sram start+header */ -+#define CONFIG_SPL_MAX_SIZE 0x7fa0 /* 32 KiB */ - #ifdef CONFIG_ARM64 - /* end of SRAM A2 for now, as SRAM A1 is pretty tight for an ARM64 build */ - #define LOW_LEVEL_SRAM_STACK 0x00054000 -@@ -193,8 +193,8 @@ - #define LOW_LEVEL_SRAM_STACK 0x00018000 - #endif /* !CONFIG_ARM64 */ - #else --#define CONFIG_SPL_TEXT_BASE 0x40 /* sram start+header */ --#define CONFIG_SPL_MAX_SIZE 0x5fc0 /* 24KB on sun4i/sun7i */ -+#define CONFIG_SPL_TEXT_BASE 0x60 /* sram start+header */ -+#define CONFIG_SPL_MAX_SIZE 0x5fa0 /* 24KB on sun4i/sun7i */ - #define LOW_LEVEL_SRAM_STACK 0x00008000 /* End of sram */ - #endif - -diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl -index d01af3b..d134b74 100644 ---- a/scripts/Makefile.spl -+++ b/scripts/Makefile.spl -@@ -294,7 +294,8 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE - $(call if_changed,mkimage) - - quiet_cmd_mksunxiboot = MKSUNXI $@ --cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@ -+cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \ -+ --default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@ - $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE - $(call if_changed,mksunxiboot) - -diff --git a/tools/mksunxiboot.c b/tools/mksunxiboot.c -index 111d74a..db0f10e 100644 ---- a/tools/mksunxiboot.c -+++ b/tools/mksunxiboot.c -@@ -70,11 +70,40 @@ int main(int argc, char *argv[]) - struct boot_img img; - unsigned file_size; - int count; -+ char *tool_name = argv[0]; -+ char *default_dt = NULL; - -- if (argc < 2) { -- printf("\tThis program makes an input bin file to sun4i " \ -- "bootable image.\n" \ -- "\tUsage: %s input_file out_putfile\n", argv[0]); -+ /* a sanity check */ -+ if ((sizeof(img.header) % 32) != 0) { -+ fprintf(stderr, "ERROR: the SPL header must be a multiple "); -+ fprintf(stderr, "of 32 bytes.\n"); -+ return EXIT_FAILURE; -+ } -+ -+ /* process optional command line switches */ -+ while (argc >= 2 && argv[1][0] == '-') { -+ if (strcmp(argv[1], "--default-dt") == 0) { -+ if (argc >= 3) { -+ default_dt = argv[2]; -+ argv += 2; -+ argc -= 2; -+ continue; -+ } -+ fprintf(stderr, "ERROR: no --default-dt arg\n"); -+ return EXIT_FAILURE; -+ } else { -+ fprintf(stderr, "ERROR: bad option '%s'\n", argv[1]); -+ return EXIT_FAILURE; -+ } -+ } -+ -+ if (argc < 3) { -+ printf("This program converts an input binary file to a sunxi bootable image.\n"); -+ printf("\nUsage: %s [options] input_file output_file\n", -+ tool_name); -+ printf("Where [options] may be:\n"); -+ printf(" --default-dt arg - 'arg' is the default device tree name\n"); -+ printf(" (CONFIG_DEFAULT_DEVICE_TREE).\n"); - return EXIT_FAILURE; - } - -@@ -122,6 +151,18 @@ int main(int argc, char *argv[]) - memcpy(img.header.spl_signature, SPL_SIGNATURE, 3); /* "sunxi" marker */ - img.header.spl_signature[3] = SPL_HEADER_VERSION; - -+ if (default_dt) { -+ if (strlen(default_dt) + 1 <= sizeof(img.header.string_pool)) { -+ strcpy((char *)img.header.string_pool, default_dt); -+ img.header.dt_name_offset = -+ cpu_to_le32(offsetof(struct boot_file_head, -+ string_pool)); -+ } else { -+ printf("WARNING: The SPL header is too small\n"); -+ printf(" and has no space to store the dt name.\n"); -+ } -+ } -+ - gen_check_sum(&img.header); - - count = write(fd_out, &img, le32_to_cpu(img.header.length)); -From patchwork Fri Mar 31 22:31:30 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [U-Boot, v3, - 18/19] sunxi: use SPL header DT name for FIT board matching -From: Andre Przywara -X-Patchwork-Id: 745833 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-19-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:30 +0100 - -Now that we can store a DT name in the SPL header, use this string (if -available) when finding the right DT blob to load for U-Boot proper. -This allows a generic U-Boot (proper) image to be combined with a bunch -of supported DTs, with just the SPL (possibly only that string) to be -different. -Eventually this string can be written after the build process by some -firmware update tool. - -Signed-off-by: Andre Przywara ---- - board/sunxi/board.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/board/sunxi/board.c b/board/sunxi/board.c -index 2ddff28..714f8fd 100644 ---- a/board/sunxi/board.c -+++ b/board/sunxi/board.c -@@ -729,13 +729,19 @@ int ft_board_setup(void *blob, bd_t *bd) - #ifdef CONFIG_SPL_LOAD_FIT - int board_fit_config_name_match(const char *name) - { -- const char *cmp_str; -+ struct boot_file_head *spl = (void *)(ulong)SPL_ADDR; -+ const char *cmp_str = (void *)(ulong)SPL_ADDR; - -+ /* Check if there is a DT name stored in the SPL header and use that. */ -+ if (spl->dt_name_offset) { -+ cmp_str += spl->dt_name_offset; -+ } else { - #ifdef CONFIG_DEFAULT_DEVICE_TREE -- cmp_str = CONFIG_DEFAULT_DEVICE_TREE; -+ cmp_str = CONFIG_DEFAULT_DEVICE_TREE; - #else -- return 0; -+ return 0; - #endif -+ }; - - /* Differentiate the two Pine64 board DTs by their DRAM size. */ - if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) { -From patchwork Fri Mar 31 22:31:31 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -Subject: [U-Boot,v3,19/19] sunxi: update Pine64 README -From: Andre Przywara -X-Patchwork-Id: 745836 -X-Patchwork-Delegate: jagannadh.teki@gmail.com -Message-Id: <1490999491-14899-20-git-send-email-andre.przywara@arm.com> -To: Maxime Ripard , - Jagan Teki , Simon Glass , - Tom Rini -Cc: Philipp Tomsich , - Michal Simek , u-boot@lists.denx.de, - Icenowy Zheng -Date: Fri, 31 Mar 2017 23:31:31 +0100 - -With the DRAM init code and the SPL's ability to load the ATF binary as -well, we can now officially get rid of the boot0 boot method, which -involed a closed-source proprietary blob to be used. -Rework the Pine64 README file to document how to build the firmware. - -Signed-off-by: Andre Przywara -Tested-by: Andreas Färber -Reviewed-by: Simon Glass ---- - board/sunxi/README.pine64 | 177 ++++++++++++++++++++++++++++++---------------- - 1 file changed, 115 insertions(+), 62 deletions(-) - -diff --git a/board/sunxi/README.pine64 b/board/sunxi/README.pine64 -index 5553415..41fb58e 100644 ---- a/board/sunxi/README.pine64 -+++ b/board/sunxi/README.pine64 -@@ -8,75 +8,130 @@ This chip has ARM Cortex A-53 cores and thus can run both in AArch32 - in AArch32 mode and executes 32-bit code from the Boot ROM (BROM). - This has some implications on U-Boot. - --Quick start --============ --- Get hold of a boot0.img file (see below for more details). --- Get the boot0img tool source from the tools directory in [1] and compile -- that on your host. --- Build U-Boot: -+Quick Start / Overview -+====================== -+- Build the ARM Trusted Firmware binary (see "ARM Trusted firmware (ATF)" below) -+- Build U-Boot (see "SPL/U-Boot" below) -+- Transfer to an uSD card (see "microSD card" below) -+- Boot and enjoy! -+ -+Building the firmware -+===================== -+ -+The Allwinner A64 firmware consists of three parts: U-Boot's SPL, an -+ARM Trusted Firmware (ATF) build and the U-Boot proper. -+The SPL will load both ATF and U-Boot proper along with the right device -+tree blob (.dtb) and will pass execution to ATF (in EL3), which in turn will -+drop into the U-Boot proper (in EL2). -+As the ATF binary will become part of the U-Boot image file, you will need -+to build it first. -+ -+ ARM Trusted firmware (ATF) -+---------------------------- -+Checkout the "allwinner" branch from the github repository [1] and build it: -+$ export CROSS_COMPILE=aarch64-linux-gnu- -+$ make PLAT=sun50iw1p1 DEBUG=1 bl31 -+ The resulting binary is build/sun50iw1p1/debug/bl31.bin. Copy this to the -+ root of the U-Boot source tree (or create a symbolic link). -+ -+ SPL/U-Boot -+------------ -+Both U-Boot proper and the SPL are using the 64-bit mode. As the boot ROM -+enters the SPL still in AArch32 secure SVC mode, there is some shim code to -+enter AArch64 very early. The rest of the SPL runs in AArch64 EL3. -+U-boot proper runs in EL2 and can load any AArch64 code, EFI applications or -+arm64 Linux kernel images (often named "Image") using the booti command. -+ -+$ make clean - $ export CROSS_COMPILE=aarch64-linux-gnu- - $ make pine64_plus_defconfig - $ make --- You also need a compiled ARM Trusted Firmware (ATF) binary. Checkout the -- "allwinner" branch from the github repository [2] and build it: --$ export CROSS_COMPILE=aarch64-linux-gnu- --$ make PLAT=sun50iw1p1 DEBUG=1 bl31 -- The resulting binary is build/sun50iw1p1/debug/bl31.bin. - --Now put an empty (or disposable) micro SD card in your card reader and learn --its device file name, replacing /dev/sd below with the result (that could --be /dev/mmcblk as well): -+This will build the SPL in spl/sunxi-spl.bin and a FIT image called u-boot.itb, -+which contains the rest of the firmware. -+ - --$ ./boot0img --device /dev/sd -e -u u-boot.bin -B boot0.img \ -- -d trampoline64:0x44000 -s bl31.bin -a 0x44008 -p 100 --(either copying the respective files to the working directory or specifying --the paths directly) -+Boot process -+============ -+The on-die BROM code will try several methods to load and execute the firmware. -+On the Pine64 this will result in the following boot order: -+1) Reading 32KB from sector 16 (@8K) of the microSD card to SRAM A1. If the -+BROM finds the magic "eGON" header in the first bytes, it will execute that -+code. If not, it will: -+2) Initialize the SPI0 controller and try to access a NOR flash connected to -+it (using the CS0 pin). If a flash chip is found, the BROM will load the -+first 32KB (from offset 0) into SRAM A1. Now it checks for the magic eGON -+header and will execute the code upon finding it. If not, it will: -+3) Initialize the USB OTG controller and will wait for a host to connect to -+it, speaking the Allwinner proprietary (but deciphered) "FEL" USB protocol. -+ -+To boot the Pine64 board, you can use U-Boot and any of the described methods. - --This will create a new partition table (with a 100 MB FAT boot partition), --copies boot0.img, ATF and U-Boot to the proper locations on the SD card and --will fill in the magic Allwinner header to be recognized by boot0. --Prefix the above call with "sudo" if you don't have write access to the --uSD card. You can also use "-o output.img" instead of "--device /dev/sd" --to create an image file and "dd" that to the uSD card. --Omitting the "-p" option will skip the partition table. -+FEL boot (USB OTG) -+------------------ -+FEL is the name of the Allwinner defined USB boot protocol built in the -+mask ROM of most Allwinner SoCs. It allows to bootstrap a board solely -+by using the USB-OTG interface and a host port on another computer. -+As the FEL mode is controlled by the boot ROM, it expects to be running in -+AArch32. For now the AArch64 SPL cannot properly return into FEL mode, so the -+feature is disabled in the configuration at the moment. - --Now put this uSD card in the board and power it on. You should be greeted by --the U-Boot prompt. -+microSD card -+------------ -+Transfer the SPL and the U-Boot FIT image directly to an uSD card: -+# dd if=spl/sunxi-spl.bin of=/dev/sdx bs=8k seek=1 -+# dd if=u-boot.itb of=/dev/sdx bs=8k seek=5 -+# sync -+(replace /dev/sdx with you SD card device file name, which could be -+/dev/mmcblk[x] as well). - -+Alternative you can concatenate the SPL and the U-Boot FIT image into a single -+file and transfer that instead: -+$ cat spl/sunxi-spl.bin u-boot.itb > u-boot-sunxi-with-spl.bin -+# dd if=u-boot-sunxi-with-spl.bin of=/dev/sdx bs=8k seek=1 - --Main U-Boot --============ --The main U-Boot proper is a real 64-bit ARMv8 port and runs entirely in the --64-bit AArch64 mode. It can load any AArch64 code, EFI applications or arm64 --Linux kernel images (often named "Image") using the booti command. --Launching 32-bit code and kernels is technically possible, though not without --drawbacks (or hacks to avoid them) and currently not implemented. -+You can partition the microSD card, but leave the first MB unallocated (most -+partitioning tools will do this anyway). - --SPL support --============ --The main task of the SPL support is to bring up the DRAM controller and make --DRAM actually accessible. At the moment there is no documentation or source --code available which would do this. --There are currently two ways to overcome this situation: using a tainted 32-bit --SPL (involving some hacks and resulting in a non-redistributable binary, thus --not described here) or using the Allwinner boot0 blob. -- --boot0 method --------------- -+NOR flash -+--------- -+The Pine64 board can be booted via an SPI NOR flash chip connected to SPI0/CS0 -+on the PI-2 headers. The SoPine module and the Pinebook notebook come with -+a SPI flash soldered already. -+Create the SPL and FIT image like described above for the SD card. -+Now connect either an "A to A" USB cable to the upper USB port on the Pine64 -+or get an adaptor and use a regular A-microB cable connected to it. -+Remove a microSD card from the slot and power on the board. -+On your host computer download and build the sunxi-tools package[2], then -+use "sunxi-fel" to access the board: -+$ ./sunxi-fel ver -v -p -+This should give you an output starting with: AWUSBFEX soc=00001689(A64) ... -+Now use the sunxi-fel tool to write to the NOR flash: -+$ ./sunxi-fel spiflash-write 0 spl/sunxi-spl.bin -+$ ./sunxi-fel spiflash-write 32768 u-boot.itb -+Now boot the board without an SD card inserted and you should see the -+U-Boot prompt on the serial console. -+ -+(Legacy) boot0 method -+--------------------- - boot0 is Allwiner's secondary program loader and it can be used as some kind --of SPL replacement to get U-Boot up and running. --The binary is a 32 KByte blob and contained on every Pine64 image distributed --so far. It can be easily extracted from a micro SD card or an image file: -+of SPL replacement to get U-Boot up and running from an microSD card. -+For some time using boot0 was the only option to get the Pine64 booted. -+With working DRAM init code in U-Boot's SPL this is no longer necessary, -+but this method is described here for the sake of completeness. -+ -+The boot0 binary is a 32 KByte blob and contained in the official Pine64 images -+distributed by Pine64 or Allwinner. It can be easily extracted from a micro -+SD card or an image file: - # dd if=/dev/sd of=boot0.bin bs=8k skip=1 count=4 - where /dev/sd is the device name of the uSD card or the name of the image - file. Apparently Allwinner allows re-distribution of this proprietary code - as-is. --For the time being this boot0 blob is the only redistributable way of making --U-Boot work on the Pine64. Beside loading the various parts of the (original) --firmware it also switches the core into AArch64 mode. -+This boot0 blob takes care of DRAM initialisation and loads the remaining -+firmware parts, then switches the core into AArch64 mode. - The original boot0 code looks for U-Boot at a certain place on an uSD card - (at 19096 KB), also it expects a header with magic bytes and a checksum. --There is a tool called boot0img[1] which takes a boot0.bin image and a compiled -+There is a tool called boot0img[3] which takes a boot0.bin image and a compiled - U-Boot binary (plus other binaries) and will populate that header accordingly. - To make space for the magic header, the pine64_plus_defconfig will make sure - there is sufficient space at the beginning of the U-Boot binary. -@@ -85,14 +140,12 @@ places on the uSD card and works around unused, but mandatory parts by using - trampoline code. See the output of "boot0img -h" for more information. - boot0img can also patch boot0 to avoid loading U-Boot from 19MB, instead - fetching it from just behind the boot0 binary (-B option). -+$ ./boot0img -o firmware.img -B boot0.img -u u-boot-dtb.bin -e -s bl31.bin \ -+-a 0x44008 -d trampoline64:0x44000 -+Then write this image to a microSD card, replacing /dev/sdx with the right -+device file (see above): -+$ dd if=firmware.img of=/dev/sdx bs=8k seek=1 - --FEL boot --========= --FEL is the name of the Allwinner defined USB boot protocol built-in the --mask ROM of most Allwinner SoCs. It allows to bootstrap a board solely --by using the USB-OTG interface and a host port on another computer. --Since FEL boot does not work with boot0, it requires the libdram hack, which --is not described here. -- --[1] https://github.com/apritzel/pine64/ --[2] https://github.com/apritzel/arm-trusted-firmware.git -+[1] https://github.com/apritzel/arm-trusted-firmware.git -+[2] git://github.com/linux-sunxi/sunxi-tools.git -+[3] https://github.com/apritzel/pine64/ -From 94c1de70cdbe12a893cf283e704c5da28724a561 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Wed, 3 May 2017 14:18:41 +0100 -Subject: [PATCH] add OF LIST - ---- - configs/orangepi_pc2_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configs/orangepi_pc2_defconfig b/configs/orangepi_pc2_defconfig -index 8e01284f75..c1f173711b 100644 ---- a/configs/orangepi_pc2_defconfig -+++ b/configs/orangepi_pc2_defconfig -@@ -5,6 +5,7 @@ CONFIG_MACH_SUN50I_H5=y - CONFIG_DRAM_CLK=672 - CONFIG_DRAM_ZQ=3881977 - CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-pc2" -+CONFIG_OF_LIST="sun50i-h5-orangepi-pc2" - # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set - CONFIG_CONSOLE_MUX=y - CONFIG_SPL=y --- -2.12.2 diff --git a/arm-tegra-nyan-chromebook.patch b/arm-tegra-nyan-chromebook.patch deleted file mode 100644 index 9a8f657..0000000 --- a/arm-tegra-nyan-chromebook.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 68b78517e76a87445147dc76b774d3995d825933 Mon Sep 17 00:00:00 2001 -From: Simon Glass -Date: Wed, 31 May 2017 17:57:10 -0600 -Subject: [PATCH 13/16] Allow displaying the U-Boot banner on a video display - -At present the U-Boot banner is only displayed on the serial console. If -this is not visible to the user, the banner does not show. Some devices -have a video display which can usefully display this information. - -Add a banner which is printed after relocation only on non-serial devices -if CONFIG_DISPLAY_BOARDINFO_LATE is defined. - -Signed-off-by: Simon Glass ---- - common/board_r.c | 1 + - common/console.c | 15 +++++++++++---- - include/console.h | 12 ++++++++++++ - 3 files changed, 24 insertions(+), 4 deletions(-) - -diff --git a/common/board_r.c b/common/board_r.c -index d69a33c4a3..20d412293a 100644 ---- a/common/board_r.c -+++ b/common/board_r.c -@@ -844,6 +844,7 @@ static init_fnc_t init_sequence_r[] = { - #endif - console_init_r, /* fully init console as a device */ - #ifdef CONFIG_DISPLAY_BOARDINFO_LATE -+ console_announce_r, - show_board_info, - #endif - #ifdef CONFIG_ARCH_MISC_INIT -diff --git a/common/console.c b/common/console.c -index 1232808df5..3fcd7ce66b 100644 ---- a/common/console.c -+++ b/common/console.c -@@ -202,7 +202,6 @@ static void console_putc(int file, const char c) - } - } - --#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER) - static void console_puts_noserial(int file, const char *s) - { - int i; -@@ -214,7 +213,6 @@ static void console_puts_noserial(int file, const char *s) - dev->puts(dev, s); - } - } --#endif - - static void console_puts(int file, const char *s) - { -@@ -248,13 +246,11 @@ static inline void console_putc(int file, const char c) - stdio_devices[file]->putc(stdio_devices[file], c); - } - --#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER) - static inline void console_puts_noserial(int file, const char *s) - { - if (strcmp(stdio_devices[file]->name, "serial") != 0) - stdio_devices[file]->puts(stdio_devices[file], s); - } --#endif - - static inline void console_puts(int file, const char *s) - { -@@ -699,6 +695,17 @@ static void console_update_silent(void) - #endif - } - -+int console_announce_r(void) -+{ -+ char buf[DISPLAY_OPTIONS_BANNER_LENGTH]; -+ -+ display_options_get_banner(false, buf, sizeof(buf)); -+ -+ console_puts_noserial(stdout, buf); -+ -+ return 0; -+} -+ - /* Called before relocation - use serial functions */ - int console_init_f(void) - { -diff --git a/include/console.h b/include/console.h -index 3d37f6a53b..511b38e9e7 100644 ---- a/include/console.h -+++ b/include/console.h -@@ -42,6 +42,18 @@ void console_record_reset(void); - */ - void console_record_reset_enable(void); - -+/** -+ * console_announce_r() - print a U-Boot console on non-serial consoles -+ * -+ * When U-Boot starts up with a display it generally does not account itself -+ * on the display. The banner is emitted on the UART before relocation instead. -+ * This function prints a banner on devices which (we assume) did not receive -+ * it before relocation. -+ * -+ * @return 0 (meaning no errors) -+ */ -+int console_announce_r(void); -+ - /* - * CONSOLE multiplexing. - */ --- -2.13.0 - diff --git a/mx6cuboxi-Add-support-for-sata.patch b/mx6cuboxi-Add-support-for-sata.patch deleted file mode 100644 index f9a4425..0000000 --- a/mx6cuboxi-Add-support-for-sata.patch +++ /dev/null @@ -1,74 +0,0 @@ -From ee16d90048ee985df6199c987e64daeac3378777 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sat, 4 Mar 2017 14:26:19 +0000 -Subject: [PATCH] v2 mx6cuboxi: Add support for sata - -The Cubox-i and Hummingboard series of devices have an option of -SATA on board, and depending on how the fuses are blown even the -option to boot SPL from SATA. So enable support for it so it can -be used to boot the OS from if people desire. - -Signed-off-by: Peter Robinson ---- - board/solidrun/mx6cuboxi/mx6cuboxi.c | 7 +++++++ - include/configs/mx6cuboxi.h | 12 ++++++++++++ - 2 files changed, 19 insertions(+) - -diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c -index 285588d..59a78df 100644 ---- a/board/solidrun/mx6cuboxi/mx6cuboxi.c -+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -314,6 +315,12 @@ int board_early_init_f(void) - ret = setup_display(); - #endif - -+#ifdef CONFIG_CMD_SATA -+ /* Only mx6q/mx6q has SATA */ -+ if (is_mx6dq()) -+ setup_sata(); -+#endif -+ - #ifdef CONFIG_USB_EHCI_MX6 - setup_usb(); - #endif -diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h -index 2782911..cec626a 100644 ---- a/include/configs/mx6cuboxi.h -+++ b/include/configs/mx6cuboxi.h -@@ -21,6 +21,17 @@ - /* MMC Configs */ - #define CONFIG_SYS_FSL_ESDHC_ADDR USDHC2_BASE_ADDR - -+/* SATA Configuration */ -+#define CONFIG_CMD_SATA -+#ifdef CONFIG_CMD_SATA -+#define CONFIG_DWC_AHSATA -+#define CONFIG_SYS_SATA_MAX_DEVICE 1 -+#define CONFIG_DWC_AHSATA_PORT_ID 0 -+#define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR -+#define CONFIG_LBA48 -+#define CONFIG_LIBATA -+#endif -+ - /* Ethernet Configuration */ - #define CONFIG_FEC_MXC - #define CONFIG_MII -@@ -119,6 +130,7 @@ - - #define BOOT_TARGET_DEVICES(func) \ - func(MMC, mmc, 0) \ -+ func(SATA, sata, 0) \ - func(USB, usb, 0) \ - func(PXE, pxe, na) \ - func(DHCP, dhcp, na) --- -2.9.3 - diff --git a/sources b/sources index c57dd06..0d00a57 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2017.07.tar.bz2) = 821175dd414e1fd0e5b6d9293a5766cbc8ae63a2361e82309f67e92c02b881263a7832dba0bcfc820b036a582981ddc20a8f484f2995d110f3240907a3ff7a95 +SHA512 (u-boot-2017.09-rc1.tar.bz2) = 83ce6309013ea52c22a9b32d67c50d4b4e64b5f4fd3b396b36204274cdd16c0a3539ae473bf245cd64d3a86fff52b882a9b490378ccf63c4f8e04dcf3f4c4319 diff --git a/sti-STiH410-B2260-support.patch b/sti-STiH410-B2260-support.patch index abe62e8..78bf1d5 100644 --- a/sti-STiH410-B2260-support.patch +++ b/sti-STiH410-B2260-support.patch @@ -232,1571 +232,6 @@ index d6c4d677b8..8b1b2c08a1 100644 -- 2.12.2 -From 2692e55b3ed1579c33bd288d5ecddd562349d248 Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Tue, 28 Mar 2017 14:35:42 +0200 -Subject: [PATCH 04/16] dm: usb: Add a uclass for USB PHY - -This is a basic implementation of USB PHY which -define a standard API that link USB PHY client to -USB PHY driver controller. - -Signed-off-by: Patrice Chotard ---- - drivers/usb/Kconfig | 4 ++ - drivers/usb/phy/Kconfig | 10 ++++ - drivers/usb/phy/Makefile | 1 + - drivers/usb/phy/usb_phy_uclass.c | 90 +++++++++++++++++++++++++++++++ - include/dm/uclass-id.h | 1 + - include/usb_phy-uclass.h | 42 +++++++++++++++ - include/usb_phy.h | 112 +++++++++++++++++++++++++++++++++++++++ - 7 files changed, 260 insertions(+) - create mode 100644 drivers/usb/phy/Kconfig - create mode 100644 drivers/usb/phy/usb_phy_uclass.c - create mode 100644 include/usb_phy-uclass.h - create mode 100644 include/usb_phy.h - -diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig -index da3ec2fa75..e30c9d6273 100644 ---- a/drivers/usb/Kconfig -+++ b/drivers/usb/Kconfig -@@ -94,4 +94,8 @@ endif - - source "drivers/usb/gadget/Kconfig" - -+comment "USB PHY" -+ -+source "drivers/usb/phy/Kconfig" -+ - endif -diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig -new file mode 100644 -index 0000000000..0539401c29 ---- /dev/null -+++ b/drivers/usb/phy/Kconfig -@@ -0,0 +1,10 @@ -+menu "USB PHY drivers" -+ -+config USB_PHY -+ bool "Enable driver model for USB PHY drivers" -+ depends on DM -+ help -+ Enable driver model for USB PHY access. It defines basic -+ init and exit API. -+ -+endmenu -diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile -index 4e548c24ec..5314dcbc58 100644 ---- a/drivers/usb/phy/Makefile -+++ b/drivers/usb/phy/Makefile -@@ -5,6 +5,7 @@ - # SPDX-License-Identifier: GPL-2.0+ - # - -+obj-$(CONFIG_USB_PHY) += usb_phy_uclass.o - obj-$(CONFIG_TWL4030_USB) += twl4030.o - obj-$(CONFIG_OMAP_USB_PHY) += omap_usb_phy.o - obj-$(CONFIG_ROCKCHIP_USB2_PHY) += rockchip_usb2_phy.o -diff --git a/drivers/usb/phy/usb_phy_uclass.c b/drivers/usb/phy/usb_phy_uclass.c -new file mode 100644 -index 0000000000..11da635f1d ---- /dev/null -+++ b/drivers/usb/phy/usb_phy_uclass.c -@@ -0,0 +1,90 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include -+#include -+#include -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+static inline struct usb_phy_ops *usb_phy_dev_ops(struct udevice *dev) -+{ -+ return (struct usb_phy_ops *)dev->driver->ops; -+} -+ -+int usb_phy_get_by_index(struct udevice *dev, int index, -+ struct usb_phy_desc *usb_phy_desc) -+{ -+ struct fdtdec_phandle_args args; -+ int ret; -+ struct udevice *dev_usb_phy; -+ -+ debug("%s(dev=%p, index=%d, usb_phy_desc=%p)\n", __func__, dev, index, -+ usb_phy_desc); -+ -+ ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev), -+ "phys", "#phy-cells", 0, -+ index, &args); -+ if (ret) { -+ debug("%s: fdtdec_parse_phandle_with_args failed: %d\n", -+ __func__, ret); -+ return ret; -+ } -+ -+ ret = uclass_get_device_by_of_offset(UCLASS_USB_PHY, args.node, -+ &dev_usb_phy); -+ if (ret) { -+ debug("%s: uclass_get_device_by_of_offset failed: %d\n", -+ __func__, ret); -+ return ret; -+ } -+ -+ usb_phy_desc->dev = dev_usb_phy; -+ -+ return 0; -+} -+ -+int usb_phy_get_by_name(struct udevice *dev, const char *name, -+ struct usb_phy_desc *usb_phy_desc) -+{ -+ int index; -+ -+ debug("%s(dev=%p, name=%s, usb_phy_desc=%p)\n", __func__, dev, name, -+ usb_phy_desc); -+ -+ index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev), -+ "phy-names", name); -+ if (index < 0) { -+ debug("fdt_stringlist_search() failed: %d\n", index); -+ return index; -+ } -+ -+ return usb_phy_get_by_index(dev, index, usb_phy_desc); -+} -+ -+int usb_phy_init(struct usb_phy_desc *usb_phy_desc) -+{ -+ struct usb_phy_ops *ops = usb_phy_dev_ops(usb_phy_desc->dev); -+ -+ debug("%s(usb_phy_desc=%p)\n", __func__, usb_phy_desc); -+ -+ return ops->init(usb_phy_desc); -+} -+ -+int usb_phy_exit(struct usb_phy_desc *usb_phy_desc) -+{ -+ struct usb_phy_ops *ops = usb_phy_dev_ops(usb_phy_desc->dev); -+ -+ debug("%s(usb_phy_desc=%p)\n", __func__, usb_phy_desc); -+ -+ return ops->exit(usb_phy_desc); -+} -+ -+UCLASS_DRIVER(usb_phy) = { -+ .id = UCLASS_USB_PHY, -+ .name = "usb_phy", -+}; -diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h -index 8c92d0b030..feb6689aa1 100644 ---- a/include/dm/uclass-id.h -+++ b/include/dm/uclass-id.h -@@ -80,6 +80,7 @@ enum uclass_id { - UCLASS_USB, /* USB bus */ - UCLASS_USB_DEV_GENERIC, /* USB generic device */ - UCLASS_USB_HUB, /* USB hub */ -+ UCLASS_USB_PHY, /* USB Phy */ - UCLASS_VIDEO, /* Video or LCD device */ - UCLASS_VIDEO_BRIDGE, /* Video bridge, e.g. DisplayPort to LVDS */ - UCLASS_VIDEO_CONSOLE, /* Text console driver for video device */ -diff --git a/include/usb_phy-uclass.h b/include/usb_phy-uclass.h -new file mode 100644 -index 0000000000..07a134c81c ---- /dev/null -+++ b/include/usb_phy-uclass.h -@@ -0,0 +1,42 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#ifndef _USB_PHY_UCLASS_H -+#define _USB_PHY_UCLASS_H -+ -+/* See usb_phy.h for background documentation. */ -+ -+#include -+ -+struct udevice; -+ -+/** -+ * struct usb_phy_ops - The functions that a usb_phy controller driver must -+ * implement. -+ */ -+struct usb_phy_ops { -+ /** -+ * init - operations to be performed for USB PHY initialisation -+ * -+ * Typically, registers init and reset deassertion -+ * -+ * @usb_phy_desc: The usb_phy struct to init; -+ * @return 0 if OK, or a negative error code. -+ */ -+ int (*init)(struct usb_phy_desc *usb_phy_desc); -+ /** -+ * exit - operations to be performed while exiting -+ * -+ * Typically reset assertion -+ * -+ * @usb_phy_desc: The usb_phy to free. -+ * @return 0 if OK, or a negative error code. -+ */ -+ int (*exit)(struct usb_phy_desc *usb_phy_desc); -+}; -+ -+#endif -diff --git a/include/usb_phy.h b/include/usb_phy.h -new file mode 100644 -index 0000000000..c2ddf8fbf1 ---- /dev/null -+++ b/include/usb_phy.h -@@ -0,0 +1,112 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#ifndef _USB_PHY_H -+#define _USB_PHY_H -+ -+#include -+ -+struct udevice; -+ -+/** -+ * struct usb_phy_desc - A handle to a USB PHY. -+ * -+ * Clients provide storage for reset control handles. The content of the -+ * structure is managed solely by the reset API and reset drivers. A reset -+ * control struct is initialized by "get"ing the reset control struct. The -+ * reset control struct is passed to all other reset APIs to identify which -+ * reset signal to operate upon. -+ * -+ * @dev: The device which implements the reset signal. -+ * -+ */ -+struct usb_phy_desc { -+ struct udevice *dev; -+}; -+ -+#ifdef CONFIG_DM_RESET -+/** -+ * reset_get_by_index - Get/request a USB PHY by integer index. -+ * -+ * This looks up and requests a USB PHY. The index is relative to the -+ * client device; each device is assumed to have n USB PHY associated -+ * with it somehow, and this function finds and requests one of them. -+ * -+ * @dev: The client device. -+ * @index: The index of the USB PHY to request, within the client's -+ * list of USB PHYs. -+ * @usb_phy_desc A pointer to a USB PHY struct to initialize. -+ * @return 0 if OK, or a negative error code. -+ */ -+int usb_phy_get_by_index(struct udevice *dev, int index, -+ struct usb_phy_desc *usb_phy_desc); -+ -+/** -+ * usb_phy_get_by_name - Get/request a USB PHY by name. -+ * -+ * This looks up and requests a USB PHY. The name is relative to the -+ * client device; each device is assumed to have n USB PHY associated -+ * with it somehow, and this function finds and requests one of them. -+ * -+ * @dev: The client device. -+ * @name: The name of the USB PHY to request, within the client's -+ * list of USB PHYs. -+ * @usb_phy_desc: A pointer to a USB PHY struct to initialize. -+ * @return 0 if OK, or a negative error code. -+ */ -+int usb_phy_get_by_name(struct udevice *dev, const char *name, -+ struct usb_phy_desc *usb_phy_desc); -+ -+/** -+ * init - Initialize a USB PHY. -+ * -+ * Typically initialize PHY specific registers -+ * and deassert USB PHY associated reset signals. -+ * -+ * @usb_phy_desc: A USB PHY struct that was previously successfully -+ * requested by reset_get_by_*(). -+ * @return 0 if OK, or a negative error code. -+ */ -+int usb_phy_init(struct usb_phy_desc *usb_phy_desc); -+ -+/** -+ * exit - operations to be performed while exiting -+ * -+ * Typically deassert USB PHY associated reset signals. -+ * -+ * @usb_phy_desc: A USB PHY struct that was previously successfully -+ * requested by reset_get_by_*(). -+ * @return 0 if OK, or a negative error code. -+ */ -+int usb_phy_exit(struct usb_phy_desc *usb_phy_desc); -+ -+#else -+static inline int usb_phy_get_by_index(struct udevice *dev, int index, -+ struct usb_phy_desc *usb_phy_desc) -+{ -+ return -ENOTSUPP; -+} -+ -+static inline int usb_phy_get_by_name(struct udevice *dev, const char *name, -+ struct usb_phy_desc *usb_phy_desc) -+{ -+ return -ENOTSUPP; -+} -+ -+static inline int init(struct usb_phy_desc *usb_phy_desc) -+{ -+ return 0; -+} -+ -+static inline int exit(struct usb_phy_desc *usb_phy_desc) -+{ -+ return 0; -+} -+ -+#endif -+ -+#endif --- -2.12.2 - -From 6c1aa774cc65570b245885c1a2d7059dacc57eb2 Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Tue, 28 Mar 2017 14:47:30 +0200 -Subject: [PATCH 05/16] usb: phy: Add STi USB2 PHY - -This is the generic phy driver for the picoPHY ports -used by USB2/1.1 controllers. It is found on STiH407 SoC -family from STMicroelectronics. - -Signed-off-by: Patrice Chotard ---- - doc/device-tree-bindings/phy/phy-stih407-usb.txt | 24 +++ - drivers/usb/phy/Kconfig | 9 ++ - drivers/usb/phy/Makefile | 1 + - drivers/usb/phy/sti_usb_phy.c | 181 +++++++++++++++++++++++ - 4 files changed, 215 insertions(+) - create mode 100644 doc/device-tree-bindings/phy/phy-stih407-usb.txt - create mode 100644 drivers/usb/phy/sti_usb_phy.c - -diff --git a/doc/device-tree-bindings/phy/phy-stih407-usb.txt b/doc/device-tree-bindings/phy/phy-stih407-usb.txt -new file mode 100644 -index 0000000000..de6a706abc ---- /dev/null -+++ b/doc/device-tree-bindings/phy/phy-stih407-usb.txt -@@ -0,0 +1,24 @@ -+ST STiH407 USB PHY controller -+ -+This file documents the dt bindings for the usb picoPHY driver which is the PHY for both USB2 and USB3 -+host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC family from STMicroelectronics. -+ -+Required properties: -+- compatible : should be "st,stih407-usb2-phy" -+- st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets -+- resets : list of phandle and reset specifier pairs. There should be two entries, one -+ for the whole phy and one for the port -+- reset-names : list of reset signal names. Should be "global" and "port" -+See: Documentation/devicetree/bindings/reset/st,sti-powerdown.txt -+See: Documentation/devicetree/bindings/reset/reset.txt -+ -+Example: -+ -+usb2_picophy0: usbpicophy@f8 { -+ compatible = "st,stih407-usb2-phy"; -+ #phy-cells = <0>; -+ st,syscfg = <&syscfg_core 0x100 0xf4>; -+ resets = <&softreset STIH407_PICOPHY_SOFTRESET>, -+ <&picophyreset STIH407_PICOPHY0_RESET>; -+ reset-names = "global", "port"; -+}; -diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig -index 0539401c29..98c1995282 100644 ---- a/drivers/usb/phy/Kconfig -+++ b/drivers/usb/phy/Kconfig -@@ -7,4 +7,13 @@ config USB_PHY - Enable driver model for USB PHY access. It defines basic - init and exit API. - -+config STI_USB_PHY -+ bool "STMicroelectronics USB2 picoPHY driver for STiH407 family" -+ depends on USB_PHY -+ default y if ARCH_STI -+ help -+ This is the generic phy driver for the picoPHY ports -+ used by USB2 and USB3 Host controllers available on -+ STiH407 SoC families. -+ - endmenu -diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile -index 5314dcbc58..584cc9672e 100644 ---- a/drivers/usb/phy/Makefile -+++ b/drivers/usb/phy/Makefile -@@ -9,3 +9,4 @@ obj-$(CONFIG_USB_PHY) += usb_phy_uclass.o - obj-$(CONFIG_TWL4030_USB) += twl4030.o - obj-$(CONFIG_OMAP_USB_PHY) += omap_usb_phy.o - obj-$(CONFIG_ROCKCHIP_USB2_PHY) += rockchip_usb2_phy.o -+obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o -diff --git a/drivers/usb/phy/sti_usb_phy.c b/drivers/usb/phy/sti_usb_phy.c -new file mode 100644 -index 0000000000..905824602b ---- /dev/null -+++ b/drivers/usb/phy/sti_usb_phy.c -@@ -0,0 +1,181 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+/* Default PHY_SEL and REFCLKSEL configuration */ -+#define STIH407_USB_PICOPHY_CTRL_PORT_CONF 0x6 -+ -+/* ports parameters overriding */ -+#define STIH407_USB_PICOPHY_PARAM_DEF 0x39a4dc -+ -+#define PHYPARAM_REG 1 -+#define PHYCTRL_REG 2 -+#define PHYPARAM_NB 3 -+ -+struct sti_usb_phy { -+ struct regmap *regmap; -+ struct reset_ctl global_ctl; -+ struct reset_ctl port_ctl; -+ int param; -+ int ctrl; -+}; -+ -+static int sti_usb_phy_deassert(struct sti_usb_phy *phy) -+{ -+ int ret; -+ -+ ret = reset_deassert(&phy->global_ctl); -+ if (ret < 0) { -+ error("PHY global deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = reset_deassert(&phy->port_ctl); -+ if (ret < 0) -+ error("PHY port deassert failed: %d", ret); -+ -+ return ret; -+} -+ -+static int sti_usb_phy_init(struct usb_phy_desc *usb_phy_desc) -+{ -+ struct udevice *dev = usb_phy_desc->dev; -+ struct sti_usb_phy *phy = dev_get_priv(dev); -+ void __iomem *reg; -+ -+ /* set ctrl picophy value */ -+ reg = (void __iomem *)phy->regmap->base + phy->ctrl; -+ /* CTRL_PORT mask is 0x1f */ -+ clrsetbits_le32(reg, 0x1f, STIH407_USB_PICOPHY_CTRL_PORT_CONF); -+ -+ /* set ports parameters overriding */ -+ reg = (void __iomem *)phy->regmap->base + phy->param; -+ /* PARAM_DEF mask is 0xffffffff */ -+ clrsetbits_le32(reg, 0xffffffff, STIH407_USB_PICOPHY_PARAM_DEF); -+ -+ return sti_usb_phy_deassert(phy); -+} -+ -+static int sti_usb_phy_exit(struct usb_phy_desc *usb_phy_desc) -+{ -+ struct udevice *dev = usb_phy_desc->dev; -+ struct sti_usb_phy *phy = dev_get_priv(dev); -+ int ret; -+ -+ ret = reset_deassert(&phy->port_ctl); -+ if (ret < 0) { -+ error("PHY port deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = reset_deassert(&phy->global_ctl); -+ if (ret < 0) -+ error("PHY global deassert failed: %d", ret); -+ -+ return ret; -+} -+ -+struct usb_phy_ops sti_usb_phy_ops = { -+ .init = sti_usb_phy_init, -+ .exit = sti_usb_phy_exit, -+}; -+ -+int sti_usb_phy_probe(struct udevice *dev) -+{ -+ struct sti_usb_phy *priv = dev_get_priv(dev); -+ struct udevice *syscon; -+ struct fdtdec_phandle_args syscfg_phandle; -+ u32 cells[PHYPARAM_NB]; -+ int ret, count; -+ -+ /* get corresponding syscon phandle */ -+ ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset, -+ "st,syscfg", NULL, 0, 0, -+ &syscfg_phandle); -+ if (ret < 0) { -+ error("Can't get syscfg phandle: %d\n", ret); -+ return ret; -+ } -+ -+ ret = uclass_get_device_by_of_offset(UCLASS_SYSCON, syscfg_phandle.node, -+ &syscon); -+ if (ret) { -+ error("unable to find syscon device (%d)\n", ret); -+ return ret; -+ } -+ -+ priv->regmap = syscon_get_regmap(syscon); -+ if (!priv->regmap) { -+ error("unable to find regmap\n"); -+ return -ENODEV; -+ } -+ -+ /* get phy param offset */ -+ count = fdtdec_get_int_array_count(gd->fdt_blob, dev->of_offset, -+ "st,syscfg", cells, -+ ARRAY_SIZE(cells)); -+ -+ if (count < 0) { -+ error("Bad PHY st,syscfg property %d\n", count); -+ return -EINVAL; -+ } -+ -+ if (count > PHYPARAM_NB) { -+ error("Unsupported PHY param count %d\n", count); -+ return -EINVAL; -+ } -+ -+ priv->param = cells[PHYPARAM_REG]; -+ priv->ctrl = cells[PHYCTRL_REG]; -+ -+ /* get global reset control */ -+ ret = reset_get_by_name(dev, "global", &priv->global_ctl); -+ if (ret) { -+ error("can't get global reset for %s (%d)", dev->name, ret); -+ return ret; -+ } -+ -+ /* get port reset control */ -+ ret = reset_get_by_name(dev, "port", &priv->port_ctl); -+ if (ret) { -+ error("can't get port reset for %s (%d)", dev->name, ret); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static const struct udevice_id sti_usb_phy_ids[] = { -+ { .compatible = "st,stih407-usb2-phy" }, -+ { } -+}; -+ -+U_BOOT_DRIVER(sti_usb_phy) = { -+ .name = "sti_usb_phy", -+ .id = UCLASS_USB_PHY, -+ .of_match = sti_usb_phy_ids, -+ .probe = sti_usb_phy_probe, -+ .ops = &sti_usb_phy_ops, -+ .priv_auto_alloc_size = sizeof(struct sti_usb_phy), -+}; --- -2.12.2 - -From 04154023ccd7b08cbc5dfcd7321dae7505b53850 Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Fri, 17 Mar 2017 14:40:27 +0100 -Subject: [PATCH 06/16] usb: ehci: Add STi ehci support - -Add support for on-chip ehci controller available -on STMicrolectronics SoCs. -ehci support will be then available on both type A -USB 2.0 connectors. - -Signed-off-by: Patrice Chotard ---- - drivers/usb/host/Kconfig | 9 ++++ - drivers/usb/host/Makefile | 1 + - drivers/usb/host/ehci-sti.c | 116 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 126 insertions(+) - create mode 100644 drivers/usb/host/ehci-sti.c - -diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 0bf8274405..7c29bf5c80 100644 ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -121,6 +121,15 @@ config USB_EHCI_MSM - This driver supports combination of Chipidea USB controller - and Synapsys USB PHY in host mode only. - -+config USB_EHCI_STI -+ bool "Support for STMicroelectronics on-chip EHCI USB controller" -+ depends on ARCH_STI -+ select STI_PHY_USB -+ default y -+ ---help--- -+ Enables support for the on-chip EHCI controller on -+ STMicroelectronics SoCs. -+ - config USB_EHCI_ZYNQ - bool "Support for Xilinx Zynq on-chip EHCI USB controller" - depends on ARCH_ZYNQ -diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index 58c0cf54c2..303aa32fbe 100644 ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -46,6 +46,7 @@ obj-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o - obj-$(CONFIG_USB_EHCI_MSM) += ehci-msm.o - obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o - obj-$(CONFIG_USB_EHCI_SPEAR) += ehci-spear.o -+obj-$(CONFIG_USB_EHCI_STI) += ehci-sti.o - obj-$(CONFIG_USB_EHCI_SUNXI) += ehci-sunxi.o - obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o - obj-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o -diff --git a/drivers/usb/host/ehci-sti.c b/drivers/usb/host/ehci-sti.c -new file mode 100644 -index 0000000000..b4171704c0 ---- /dev/null -+++ b/drivers/usb/host/ehci-sti.c -@@ -0,0 +1,116 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include -+#include -+#include -+#include -+#include "ehci.h" -+#include -+#include -+#include -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+struct sti_ehci_priv { -+ struct ehci_ctrl ctrl; -+ struct reset_ctl power_ctl; -+ struct reset_ctl softreset_ctl; -+ struct usb_phy_desc usb_phy; -+}; -+ -+static int sti_ehci_probe(struct udevice *dev) -+{ -+ struct sti_ehci_priv *priv = dev_get_priv(dev); -+ struct ehci_hccr *hccr = priv->ctrl.hccr; -+ struct ehci_hcor *hcor; -+ int ret; -+ -+ hccr = (struct ehci_hccr *)dev_get_addr(dev); -+ -+ if (hccr == (void *)FDT_ADDR_T_NONE) -+ return -EINVAL; -+ -+ ret = reset_get_by_name(dev, "power", &priv->power_ctl); -+ if (ret) { -+ error("can't get power for %s: %d", dev->name, ret); -+ return ret; -+ } -+ -+ ret = reset_get_by_name(dev, "softreset", &priv->softreset_ctl); -+ if (ret) { -+ error("can't get soft reset for %s: %d", dev->name, ret); -+ return ret; -+ } -+ -+ ret = usb_phy_get_by_name(dev, "usb", &priv->usb_phy); -+ if (ret) { -+ error("USB PHY DT node not found for %s: %d", dev->name, ret); -+ return ret; -+ } -+ -+ ret = reset_deassert(&priv->softreset_ctl); -+ if (ret < 0) { -+ error("EHCI soft reset deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = reset_deassert(&priv->power_ctl); -+ if (ret < 0) { -+ error("EHCI power deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = usb_phy_init(&priv->usb_phy); -+ if (ret) { -+ error("Can't init USB PHY for %s: %d\n", dev->name, ret); -+ return ret; -+ } -+ -+ hcor = (struct ehci_hcor *)((phys_addr_t)hccr + -+ HC_LENGTH(ehci_readl(&(hccr)->cr_capbase))); -+ -+ return ehci_register(dev, hccr, hcor, NULL, 0, USB_INIT_HOST); -+} -+ -+static int sti_ehci_remove(struct udevice *dev) -+{ -+ struct sti_ehci_priv *priv = dev_get_priv(dev); -+ int ret; -+ -+ ret = ehci_deregister(dev); -+ if (ret) -+ return ret; -+ -+ ret = reset_assert(&priv->power_ctl); -+ if (ret < 0) { -+ error("EHCI power assert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = reset_assert(&priv->softreset_ctl); -+ if (ret < 0) -+ error("EHCI soft reset assert failed: %d", ret); -+ -+ return ret; -+} -+ -+static const struct udevice_id sti_usb_ids[] = { -+ { .compatible = "st,st-ehci-300x" }, -+ { } -+}; -+ -+U_BOOT_DRIVER(ehci_sti) = { -+ .name = "ehci_sti", -+ .id = UCLASS_USB, -+ .of_match = sti_usb_ids, -+ .probe = sti_ehci_probe, -+ .remove = sti_ehci_remove, -+ .ops = &ehci_usb_ops, -+ .priv_auto_alloc_size = sizeof(struct sti_ehci_priv), -+ .flags = DM_FLAG_ALLOC_PRIV_DMA, -+}; --- -2.12.2 - -From 93cfa25edb32da2b3fa9ba02de58bcc64cdf09fe Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Mon, 20 Mar 2017 13:38:41 +0100 -Subject: [PATCH 07/16] usb: ohci: Add STi ohci support - -Add support for on-chip ohci controller available -on STMicrolectronics SoCs. -Ohci support will be then available on both type A -USB 2.0 connectors. - -Signed-off-by: Patrice Chotard ---- - drivers/usb/host/Kconfig | 9 +++++ - drivers/usb/host/Makefile | 1 + - drivers/usb/host/ohci-sti.c | 93 +++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 103 insertions(+) - create mode 100644 drivers/usb/host/ohci-sti.c - -diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 7c29bf5c80..b259a05ca3 100644 ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -169,6 +169,15 @@ config USB_OHCI_GENERIC - ---help--- - Enables support for generic OHCI controller. - -+config USB_OHCI_STI -+ bool "Support for STMicroelectronics OHCI USB controller" -+ depends on ARCH_STI -+ depends on OF_CONTROL -+ depends on DM_USB -+ select USB_HOST -+ ---help--- -+ Enables support for the on-chip OHCI controller on STMicroelectronics SoCs. -+ - endif # USB_OHCI_HCD - - config USB_UHCI_HCD -diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index 303aa32fbe..b78e632214 100644 ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -22,6 +22,7 @@ obj-$(CONFIG_USB_OHCI_EP93XX) += ohci-ep93xx.o - obj-$(CONFIG_USB_OHCI_SUNXI) += ohci-sunxi.o - obj-$(CONFIG_USB_OHCI_LPC32XX) += ohci-lpc32xx.o - obj-$(CONFIG_USB_OHCI_GENERIC) += ohci-generic.o -+obj-$(CONFIG_USB_OHCI_STI) += ohci-sti.o - - # echi - obj-$(CONFIG_USB_EHCI) += ehci-hcd.o -diff --git a/drivers/usb/host/ohci-sti.c b/drivers/usb/host/ohci-sti.c -new file mode 100644 -index 0000000000..c221313409 ---- /dev/null -+++ b/drivers/usb/host/ohci-sti.c -@@ -0,0 +1,93 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include -+#include -+#include -+#include -+#include "ohci.h" -+#include -+#include -+#include -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+#if !defined(CONFIG_USB_OHCI_NEW) -+# error "Generic OHCI driver requires CONFIG_USB_OHCI_NEW" -+#endif -+ -+struct sti_ohci_priv { -+ ohci_t ohci; -+ struct reset_ctl power_ctl; -+ struct reset_ctl softreset_ctl; -+ struct usb_phy_desc usb_phy; -+}; -+ -+static int ohci_usb_probe(struct udevice *dev) -+{ -+ struct sti_ohci_priv *priv = dev_get_priv(dev); -+ struct ohci_regs *regs; -+ int ret; -+ -+ regs = (struct ohci_regs *)dev_get_addr(dev); -+ if (regs == (void *)FDT_ADDR_T_NONE) -+ return -EINVAL; -+ -+ ret = reset_get_by_name(dev, "power", &priv->power_ctl); -+ if (ret) { -+ error("can't get power reset for %s (%d)", dev->name, ret); -+ return ret; -+ } -+ -+ ret = reset_get_by_name(dev, "softreset", &priv->softreset_ctl); -+ if (ret) { -+ error("can't get USB PHY for %s (%d)", dev->name, ret); -+ return ret; -+ } -+ -+ ret = usb_phy_get_by_name(dev, "usb", &priv->usb_phy); -+ if (ret) { -+ error("can't get soft reset for %s (%d)", dev->name, ret); -+ return ret; -+ } -+ -+ ret = reset_deassert(&priv->power_ctl); -+ if (ret < 0) { -+ error("OHCI power reset deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = reset_deassert(&priv->softreset_ctl); -+ if (ret < 0) { -+ error("OHCI soft reset deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = usb_phy_init(&priv->usb_phy); -+ if (ret) { -+ error("Can't init USB PHY\n"); -+ return ret; -+ } -+ -+ return ohci_register(dev, regs); -+} -+ -+static const struct udevice_id sti_usb_ids[] = { -+ { .compatible = "st,st-ohci-300x" }, -+ { } -+}; -+ -+U_BOOT_DRIVER(ohci_sti) = { -+ .name = "ohci_sti", -+ .id = UCLASS_USB, -+ .of_match = sti_usb_ids, -+ .probe = ohci_usb_probe, -+ .remove = ohci_deregister, -+ .ops = &ohci_usb_ops, -+ .priv_auto_alloc_size = sizeof(struct sti_ohci_priv), -+ .flags = DM_FLAG_ALLOC_PRIV_DMA, -+}; --- -2.12.2 - -From 47d42b930529f77bd90f30a7d20cc0e32e1efcfa Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Tue, 28 Mar 2017 15:33:28 +0200 -Subject: [PATCH 08/16] usb: xhci: Add STi xhci support - -Add support for on-chip DWC3 controller available -on STMicrolectronics STiH407 family SoCs. -On B2260 board, the type AB USB connector is managed -by a DWC3 IP. As USB3 signals are not wired, only USB2 -is supported. - -Signed-off-by: Patrice Chotard ---- - drivers/usb/host/Kconfig | 8 ++++ - drivers/usb/host/Makefile | 1 + - drivers/usb/host/xhci-sti.c | 114 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 123 insertions(+) - create mode 100644 drivers/usb/host/xhci-sti.c - -diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index b259a05ca3..62dc5b6f6e 100644 ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -38,6 +38,14 @@ config USB_XHCI_ROCKCHIP - help - Enables support for the on-chip xHCI controller on Rockchip SoCs. - -+config USB_XHCI_STI -+ bool "Support for STMicroelectronics STiH407 family on-chip xHCI USB controller" -+ depends on ARCH_STI -+ default y -+ help -+ Enables support for the on-chip xHCI controller on STMicroelectronics -+ STiH407 family SoCs. -+ - config USB_XHCI_ZYNQMP - bool "Support for Xilinx ZynqMP on-chip xHCI USB controller" - depends on ARCH_ZYNQMP -diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index b78e632214..40ff830673 100644 ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -66,6 +66,7 @@ obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o - obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o - obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o - obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o -+obj-$(CONFIG_USB_XHCI_STI) += xhci-sti.o - - # designware - obj-$(CONFIG_USB_DWC2) += dwc2.o -diff --git a/drivers/usb/host/xhci-sti.c b/drivers/usb/host/xhci-sti.c -new file mode 100644 -index 0000000000..c445dc545d ---- /dev/null -+++ b/drivers/usb/host/xhci-sti.c -@@ -0,0 +1,114 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "xhci.h" -+#include -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+__weak int __board_usb_init(int index, enum usb_init_type init) -+{ -+ return 0; -+} -+/*int board_usb_init(int index, enum usb_init_type init)*/ -+/* __attribute__((weak, alias("__board_usb_init")));*/ -+ -+struct sti_xhci_platdata { -+ struct usb_phy_desc usb_phy; -+ phys_addr_t dwc3_regs; -+}; -+ -+struct sti_xhci_priv { -+ struct xhci_ctrl ctrl; -+}; -+ -+static int sti_xhci_core_init(struct dwc3 *dwc3_reg) -+{ -+ int ret; -+ -+ ret = dwc3_core_init(dwc3_reg); -+ if (ret) { -+ debug("failed to initialize core\n"); -+ return ret; -+ } -+ -+ /* We are hard-coding DWC3 core to Host Mode */ -+ dwc3_set_mode(dwc3_reg, DWC3_GCTL_PRTCAP_HOST); -+ -+ return 0; -+} -+ -+static int sti_xhci_ofdata_to_platdata(struct udevice *dev) -+{ -+ struct sti_xhci_platdata *plat = dev_get_platdata(dev); -+ u32 reg[2]; -+ int ret; -+ -+ /* get the dwc3 register space base address */ -+ if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "reg", reg, -+ ARRAY_SIZE(reg))) { -+ debug("dwc3 node has bad/missing 'reg' property\n"); -+ return -FDT_ERR_NOTFOUND; -+ } -+ plat->dwc3_regs = reg[0]; -+ -+ ret = usb_phy_get_by_name(dev, "usb2-phy", &plat->usb_phy); -+ if (ret) -+ error("USB PHY DT node not found for %s\n", dev->name); -+ -+ return 0; -+} -+ -+static int sti_xhci_probe(struct udevice *dev) -+{ -+ struct sti_xhci_platdata *plat = dev_get_platdata(dev); -+ struct xhci_hcor *hcor; -+ struct xhci_hccr *hccr; -+ struct dwc3 *dwc3_reg; -+ int ret; -+ -+ hccr = (struct xhci_hccr *)plat->dwc3_regs; -+ hcor = (struct xhci_hcor *)((phys_addr_t)hccr + -+ HC_LENGTH(xhci_readl(&(hccr)->cr_capbase))); -+ -+ ret = usb_phy_init(&plat->usb_phy); -+ if (ret) { -+ error("Can't init USB PHY for %s\n", dev->name); -+ return ret; -+ } -+ -+ dwc3_reg = (struct dwc3 *)((char *)(hccr) + DWC3_REG_OFFSET); -+ -+ sti_xhci_core_init(dwc3_reg); -+ -+ return xhci_register(dev, hccr, hcor); -+} -+ -+static const struct udevice_id sti_xhci_ids[] = { -+ { .compatible = "snps,dwc3" }, -+ { } -+}; -+ -+U_BOOT_DRIVER(xhci_sti) = { -+ .name = "xhci_sti", -+ .id = UCLASS_USB, -+ .of_match = sti_xhci_ids, -+ .ofdata_to_platdata = sti_xhci_ofdata_to_platdata, -+ .probe = sti_xhci_probe, -+ .remove = xhci_deregister, -+ .ops = &xhci_usb_ops, -+ .priv_auto_alloc_size = sizeof(struct sti_xhci_priv), -+ .platdata_auto_alloc_size = sizeof(struct sti_xhci_platdata), -+ .flags = DM_FLAG_ALLOC_PRIV_DMA, -+}; --- -2.12.2 - -From 17d48e44c2a2b567ee665a6a8123716ad3976c6c Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Tue, 28 Mar 2017 15:43:17 +0200 -Subject: [PATCH 09/16] usb: dwc3: Add dwc3 glue driver support for STi - -This patch adds the ST glue logic to manage the DWC3 HC -on STiH407 SoC family. It configures the internal glue -logic and syscfg registers. - -Part of this code been extracted from kernel.org driver -(drivers/usb/dwc3/dwc3-st.c) - -Signed-off-by: Patrice Chotard ---- - arch/arm/include/asm/arch-stih410/sys_proto.h | 11 + - doc/device-tree-bindings/usb/dwc3-st.txt | 60 ++++++ - drivers/usb/host/Makefile | 2 +- - drivers/usb/host/dwc3-sti-glue.c | 278 ++++++++++++++++++++++++++ - include/dwc3-sti-glue.h | 43 ++++ - 5 files changed, 393 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/include/asm/arch-stih410/sys_proto.h - create mode 100644 doc/device-tree-bindings/usb/dwc3-st.txt - create mode 100644 drivers/usb/host/dwc3-sti-glue.c - create mode 100644 include/dwc3-sti-glue.h - -diff --git a/arch/arm/include/asm/arch-stih410/sys_proto.h b/arch/arm/include/asm/arch-stih410/sys_proto.h -new file mode 100644 -index 0000000000..5c40d3b0a4 ---- /dev/null -+++ b/arch/arm/include/asm/arch-stih410/sys_proto.h -@@ -0,0 +1,11 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#ifndef _ASM_ARCH_SYS_PROTO_H -+#define _ASM_ARCH_SYS_PROTO_H -+ -+#endif /* _ASM_ARCH_SYS_PROTO_H */ -diff --git a/doc/device-tree-bindings/usb/dwc3-st.txt b/doc/device-tree-bindings/usb/dwc3-st.txt -new file mode 100644 -index 0000000000..a26a1397ed ---- /dev/null -+++ b/doc/device-tree-bindings/usb/dwc3-st.txt -@@ -0,0 +1,60 @@ -+ST DWC3 glue logic -+ -+This file documents the parameters for the dwc3-st driver. -+This driver controls the glue logic used to configure the dwc3 core on -+STiH407 based platforms. -+ -+Required properties: -+ - compatible : must be "st,stih407-dwc3" -+ - reg : glue logic base address and USB syscfg ctrl register offset -+ - reg-names : should be "reg-glue" and "syscfg-reg" -+ - st,syscon : should be phandle to system configuration node which -+ encompasses the glue registers -+ - resets : list of phandle and reset specifier pairs. There should be two entries, one -+ for the powerdown and softreset lines of the usb3 IP -+ - reset-names : list of reset signal names. Names should be "powerdown" and "softreset" -+ -+ - #address-cells, #size-cells : should be '1' if the device has sub-nodes -+ with 'reg' property -+ -+ - pinctl-names : A pinctrl state named "default" must be defined -+ -+ - pinctrl-0 : Pin control group -+ -+ - ranges : allows valid 1:1 translation between child's address space and -+ parent's address space -+ -+Sub-nodes: -+The dwc3 core should be added as subnode to ST DWC3 glue as shown in the -+example below. -+ -+NB: The dr_mode property is NOT optional for this driver, as the default value -+is "otg", which isn't supported by this SoC. Valid dr_mode values for dwc3-st are -+either "host" or "device". -+ -+Example: -+ -+st_dwc3: dwc3@8f94000 { -+ status = "disabled"; -+ compatible = "st,stih407-dwc3"; -+ reg = <0x08f94000 0x1000>, <0x110 0x4>; -+ reg-names = "reg-glue", "syscfg-reg"; -+ st,syscfg = <&syscfg_core>; -+ resets = <&powerdown STIH407_USB3_POWERDOWN>, -+ <&softreset STIH407_MIPHY2_SOFTRESET>; -+ reset-names = "powerdown", "softreset"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pinctrl_usb3>; -+ ranges; -+ -+ dwc3: dwc3@9900000 { -+ compatible = "snps,dwc3"; -+ reg = <0x09900000 0x100000>; -+ interrupts = ; -+ dr_mode = "host"; -+ phy-names = "usb2-phy", "usb3-phy"; -+ phys = <&usb2_picophy2>, <&phy_port2 PHY_TYPE_USB3>; -+ }; -+}; -diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index 40ff830673..6be40b8fb0 100644 ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -66,7 +66,7 @@ obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o - obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o - obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o - obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o --obj-$(CONFIG_USB_XHCI_STI) += xhci-sti.o -+obj-$(CONFIG_USB_XHCI_STI) += xhci-sti.o dwc3-sti-glue.o - - # designware - obj-$(CONFIG_USB_DWC2) += dwc2.o -diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c -new file mode 100644 -index 0000000000..368d7efc3c ---- /dev/null -+++ b/drivers/usb/host/dwc3-sti-glue.c -@@ -0,0 +1,278 @@ -+/* -+ * STiH407 family DWC3 specific Glue layer -+ * -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+struct sti_dwc3_glue_platdata { -+ phys_addr_t syscfg_base; -+ phys_addr_t glue_base; -+ phys_addr_t syscfg_offset; -+ struct reset_ctl powerdown_ctl; -+ struct reset_ctl softreset_ctl; -+ enum usb_dr_mode mode; -+}; -+ -+static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_platdata *plat) -+{ -+ unsigned long val; -+ -+ val = readl(plat->syscfg_base + plat->syscfg_offset); -+ -+ val &= USB3_CONTROL_MASK; -+ -+ switch (plat->mode) { -+ case USB_DR_MODE_PERIPHERAL: -+ val &= ~(USB3_DELAY_VBUSVALID -+ | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) -+ | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 -+ | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); -+ -+ val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID; -+ break; -+ -+ case USB_DR_MODE_HOST: -+ val &= ~(USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID -+ | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) -+ | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 -+ | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2); -+ -+ val |= USB3_DELAY_VBUSVALID; -+ break; -+ -+ default: -+ error("Unsupported mode of operation %d\n", plat->mode); -+ return -EINVAL; -+ } -+ return writel(val, plat->syscfg_base + plat->syscfg_offset); -+} -+ -+static void sti_dwc3_glue_init(struct sti_dwc3_glue_platdata *plat) -+{ -+ unsigned long reg; -+ -+ reg = readl(plat->glue_base + CLKRST_CTRL); -+ -+ reg |= AUX_CLK_EN | EXT_CFG_RESET_N | XHCI_REVISION; -+ reg &= ~SW_PIPEW_RESET_N; -+ -+ writel(reg, plat->glue_base + CLKRST_CTRL); -+ -+ /* configure mux for vbus, powerpresent and bvalid signals */ -+ reg = readl(plat->glue_base + USB2_VBUS_MNGMNT_SEL1); -+ -+ reg |= SEL_OVERRIDE_VBUSVALID(USB2_VBUS_UTMIOTG) | -+ SEL_OVERRIDE_POWERPRESENT(USB2_VBUS_UTMIOTG) | -+ SEL_OVERRIDE_BVALID(USB2_VBUS_UTMIOTG); -+ -+ writel(reg, plat->glue_base + USB2_VBUS_MNGMNT_SEL1); -+ -+ setbits_le32(plat->glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N); -+} -+ -+int sti_dwc3_init(enum usb_dr_mode mode) -+{ -+ struct sti_dwc3_glue_platdata plat; -+ struct fdtdec_phandle_args syscfg_phandle; -+ struct udevice *syscon; -+ struct regmap *regmap; -+ int node, ret; -+ const void *blob = gd->fdt_blob; -+ u32 reg[4]; -+ -+ /* find the dwc3 node */ -+ node = fdt_node_offset_by_compatible(blob, -1, "st,stih407-dwc3"); -+ -+ ret = fdtdec_get_int_array(blob, node, "reg", reg, ARRAY_SIZE(reg)); -+ if (ret) { -+ error("unable to find st,stih407-dwc3 reg property(%d)\n", ret); -+ return ret; -+ } -+ -+ plat.glue_base = reg[0]; -+ plat.syscfg_offset = reg[2]; -+ plat.mode = mode; -+ -+ /* get corresponding syscon phandle */ -+ ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, node, -+ "st,syscfg", NULL, 0, 0, -+ &syscfg_phandle); -+ if (ret < 0) { -+ error("Can't get syscfg phandle: %d\n", ret); -+ return ret; -+ } -+ -+ ret = uclass_get_device_by_of_offset(UCLASS_SYSCON, syscfg_phandle.node, -+ &syscon); -+ if (ret) { -+ error("unable to find syscon device (%d)\n", ret); -+ return ret; -+ } -+ -+ /* get syscfg-reg base address */ -+ regmap = syscon_get_regmap(syscon); -+ if (!regmap) { -+ error("unable to find regmap\n"); -+ return -ENODEV; -+ } -+ plat.syscfg_base = regmap->base; -+ -+ sti_dwc3_glue_drd_init(&plat); -+ sti_dwc3_glue_init(&plat); -+ -+ return 0; -+} -+ -+static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev) -+{ -+ struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); -+ struct fdtdec_phandle_args syscfg_phandle; -+ struct udevice *syscon; -+ struct regmap *regmap; -+ int ret; -+ u32 reg[4]; -+ -+ ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), -+ "reg", reg, ARRAY_SIZE(reg)); -+ if (ret) { -+ error("unable to find st,stih407-dwc3 reg property(%d)\n", ret); -+ return ret; -+ } -+ -+ plat->glue_base = reg[0]; -+ plat->syscfg_offset = reg[2]; -+ -+ /* get corresponding syscon phandle */ -+ ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev), -+ "st,syscfg", NULL, 0, 0, -+ &syscfg_phandle); -+ if (ret < 0) { -+ error("Can't get syscfg phandle: %d\n", ret); -+ return ret; -+ } -+ -+ ret = uclass_get_device_by_of_offset(UCLASS_SYSCON, syscfg_phandle.node, -+ &syscon); -+ if (ret) { -+ error("unable to find syscon device (%d)\n", ret); -+ return ret; -+ } -+ -+ /* get syscfg-reg base address */ -+ regmap = syscon_get_regmap(syscon); -+ if (!regmap) { -+ error("unable to find regmap\n"); -+ return -ENODEV; -+ } -+ plat->syscfg_base = regmap->base; -+ -+ /* get powerdown reset */ -+ ret = reset_get_by_name(dev, "powerdown", &plat->powerdown_ctl); -+ if (ret) { -+ error("can't get powerdown reset for %s (%d)", dev->name, ret); -+ return ret; -+ } -+ -+ /* get softreset reset */ -+ ret = reset_get_by_name(dev, "softreset", &plat->softreset_ctl); -+ if (ret) -+ error("can't get soft reset for %s (%d)", dev->name, ret); -+ -+ return ret; -+}; -+ -+static int sti_dwc3_glue_bind(struct udevice *dev) -+{ -+ int dwc3_node; -+ -+ /* check if one subnode is present */ -+ dwc3_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev)); -+ if (dwc3_node <= 0) { -+ error("Can't find subnode for %s\n", dev->name); -+ return -ENODEV; -+ } -+ -+ /* check if the subnode compatible string is the dwc3 one*/ -+ if (fdt_node_check_compatible(gd->fdt_blob, dwc3_node, -+ "snps,dwc3") != 0) { -+ error("Can't find dwc3 subnode for %s\n", dev->name); -+ return -ENODEV; -+ } -+ -+ return dm_scan_fdt_dev(dev); -+} -+ -+static int sti_dwc3_glue_probe(struct udevice *dev) -+{ -+ struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); -+ int ret; -+ -+ /* deassert both powerdown and softreset */ -+ ret = reset_deassert(&plat->powerdown_ctl); -+ if (ret < 0) { -+ error("DWC3 powerdown reset deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = reset_deassert(&plat->softreset_ctl); -+ if (ret < 0) -+ error("DWC3 soft reset deassert failed: %d", ret); -+ -+ return ret; -+} -+ -+static int sti_dwc3_glue_remove(struct udevice *dev) -+{ -+ struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); -+ int ret; -+ -+ /* assert both powerdown and softreset */ -+ ret = reset_assert(&plat->powerdown_ctl); -+ if (ret < 0) { -+ error("DWC3 powerdown reset deassert failed: %d", ret); -+ return ret; -+ } -+ -+ ret = reset_assert(&plat->softreset_ctl); -+ if (ret < 0) -+ error("DWC3 soft reset deassert failed: %d", ret); -+ -+ return ret; -+} -+ -+static const struct udevice_id sti_dwc3_glue_ids[] = { -+ { .compatible = "st,stih407-dwc3" }, -+ { } -+}; -+ -+U_BOOT_DRIVER(dwc3_sti_glue) = { -+ .name = "dwc3_sti_glue", -+ .id = UCLASS_MISC, -+ .of_match = sti_dwc3_glue_ids, -+ .ofdata_to_platdata = sti_dwc3_glue_ofdata_to_platdata, -+ .probe = sti_dwc3_glue_probe, -+ .remove = sti_dwc3_glue_remove, -+ .bind = sti_dwc3_glue_bind, -+ .platdata_auto_alloc_size = sizeof(struct sti_dwc3_glue_platdata), -+ .flags = DM_FLAG_ALLOC_PRIV_DMA, -+}; -diff --git a/include/dwc3-sti-glue.h b/include/dwc3-sti-glue.h -new file mode 100644 -index 0000000000..2083427188 ---- /dev/null -+++ b/include/dwc3-sti-glue.h -@@ -0,0 +1,43 @@ -+/* -+ * Copyright (c) 2017 -+ * Patrice Chotard -+ * -+ * SPDX-License-Identifier: GPL-2.0+ -+ */ -+ -+#ifndef __DWC3_STI_UBOOT_H_ -+#define __DWC3_STI_UBOOT_H_ -+ -+#include -+ -+/* glue registers */ -+#define CLKRST_CTRL 0x00 -+#define AUX_CLK_EN BIT(0) -+#define SW_PIPEW_RESET_N BIT(4) -+#define EXT_CFG_RESET_N BIT(8) -+ -+#define XHCI_REVISION BIT(12) -+ -+#define USB2_VBUS_MNGMNT_SEL1 0x2C -+#define USB2_VBUS_UTMIOTG 0x1 -+ -+#define SEL_OVERRIDE_VBUSVALID(n) ((n) << 0) -+#define SEL_OVERRIDE_POWERPRESENT(n) ((n) << 4) -+#define SEL_OVERRIDE_BVALID(n) ((n) << 8) -+ -+/* Static DRD configuration */ -+#define USB3_CONTROL_MASK 0xf77 -+ -+#define USB3_DEVICE_NOT_HOST BIT(0) -+#define USB3_FORCE_VBUSVALID BIT(1) -+#define USB3_DELAY_VBUSVALID BIT(2) -+#define USB3_SEL_FORCE_OPMODE BIT(4) -+#define USB3_FORCE_OPMODE(n) ((n) << 5) -+#define USB3_SEL_FORCE_DPPULLDOWN2 BIT(8) -+#define USB3_FORCE_DPPULLDOWN2 BIT(9) -+#define USB3_SEL_FORCE_DMPULLDOWN2 BIT(10) -+#define USB3_FORCE_DMPULLDOWN2 BIT(11) -+ -+int sti_dwc3_init(enum usb_dr_mode mode); -+ -+#endif /* __DWC3_STI_UBOOT_H_ */ --- -2.12.2 - From bec77a7aaeeaa5f77fc239c672aa23d7aaa481b7 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Mon, 20 Mar 2017 13:40:41 +0100 @@ -1823,82 +258,6 @@ index 6f4070ff43..3df0e04768 100644 -- 2.12.2 -From 172ba7069e065c6cd9b84c59dfa92d6545b34b9b Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Mon, 20 Mar 2017 14:37:27 +0100 -Subject: [PATCH 11/16] board: STiH410-B2260: add fastboot support - -Add usb_gadget_handle_interrupts(), board_usb_init(), -board_usb_cleanup() and g_dnl_board_usb_cable_connected() -callbacks needed for FASTBOOT support - -Signed-off-by: Patrice Chotard ---- - board/st/stih410-b2260/board.c | 44 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c -index 92b0695593..899a3e97bd 100644 ---- a/board/st/stih410-b2260/board.c -+++ b/board/st/stih410-b2260/board.c -@@ -7,6 +7,9 @@ - */ - - #include -+#include -+#include -+#include - - DECLARE_GLOBAL_DATA_PTR; - -@@ -36,3 +39,44 @@ int board_init(void) - { - return 0; - } -+ -+#ifdef CONFIG_USB_DWC3 -+static struct dwc3_device dwc3_device_data = { -+ .maximum_speed = USB_SPEED_HIGH, -+ .dr_mode = USB_DR_MODE_PERIPHERAL, -+ .index = 0, -+}; -+ -+int usb_gadget_handle_interrupts(int index) -+{ -+ dwc3_uboot_handle_interrupt(index); -+ return 0; -+} -+ -+int board_usb_init(int index, enum usb_init_type init) -+{ -+ int node; -+ const void *blob = gd->fdt_blob; -+ -+ /* find the snps,dwc3 node */ -+ node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc3"); -+ -+ dwc3_device_data.base = fdtdec_get_addr(blob, node, "reg"); -+ -+ /* init dwc3 glue with mode forced to PERIPHERAL */ -+ sti_dwc3_init(USB_DR_MODE_PERIPHERAL); -+ -+ return dwc3_uboot_init(&dwc3_device_data); -+} -+ -+int board_usb_cleanup(int index, enum usb_init_type init) -+{ -+ dwc3_uboot_exit(index); -+ return 0; -+} -+ -+int g_dnl_board_usb_cable_connected(void) -+{ -+ return 1; -+} -+#endif --- -2.12.2 - From f6976cd38b82390054b9ff135f8346119082f2ad Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Mon, 20 Mar 2017 14:38:49 +0100 @@ -1937,38 +296,59 @@ index 3df0e04768..6c84e9b485 100644 -- 2.12.2 -From fe2e566d10892d0abe93cf56471caeea1facb77e Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Tue, 28 Mar 2017 16:11:08 +0200 -Subject: [PATCH 13/16] STiH410-B2260: enable USB, fastboot, reset related - flags +From 4b762469b09955d56bf45b81af8f5d26433e933d Mon Sep 17 00:00:00 2001 +From: Nicolas Le Bayon +Date: Mon, 27 Mar 2017 16:10:45 +0200 +Subject: [PATCH 15/16] board: STiH410-B2260: fix sdram size -Signed-off-by: Patrice Chotard +32MB are reserved for Trusted Zone purpose + +Signed-off-by: Nicolas Le Bayon --- - configs/stih410-b2260_defconfig | 36 ++++++++++++++++++++++++++++++++---- - 1 file changed, 32 insertions(+), 4 deletions(-) + include/configs/stih410-b2260.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h +index 7fcb327a52..ccbbf32470 100644 +--- a/include/configs/stih410-b2260.h ++++ b/include/configs/stih410-b2260.h +@@ -14,7 +14,7 @@ + #define CONFIG_NR_DRAM_BANKS 1 + #define PHYS_SDRAM_1 0x40000000 + #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +-#define PHYS_SDRAM_1_SIZE 0x3FE00000 ++#define PHYS_SDRAM_1_SIZE 0x3E000000 + #define CONFIG_SYS_TEXT_BASE 0x7D600000 + #define CONFIG_SYS_LOAD_ADDR PHYS_SDRAM_1 /* default load addr */ + +-- +2.12.2 + +From 8837ece92eb62dd285feb8b98ac2e606ccbb5745 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 1 Aug 2017 09:02:13 +0100 +Subject: [PATCH] sti: enable distro defaults, USB and a few other bits + +Signed-off-by: Peter Robinson +--- + configs/stih410-b2260_defconfig | 25 +++++++++++++++++++++---- + include/configs/stih410-b2260.h | 31 +++++++++++++++++++++++++------ + 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/configs/stih410-b2260_defconfig b/configs/stih410-b2260_defconfig -index 4e6942f56c..b8df85c638 100644 +index e29c29bc6f..d19b3579d3 100644 --- a/configs/stih410-b2260_defconfig +++ b/configs/stih410-b2260_defconfig -@@ -2,25 +2,53 @@ CONFIG_ARM=y +@@ -2,26 +2,43 @@ CONFIG_ARM=y CONFIG_ARCH_STI=y CONFIG_IDENT_STRING="STMicroelectronics STiH410-B2260" CONFIG_DEFAULT_DEVICE_TREE="stih410-b2260" +CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y + CONFIG_ENV_IS_NOWHERE=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SYS_PROMPT="stih410-b2260 => " -+CONFIG_FASTBOOT=y -+CONFIG_USB_FUNCTION_FASTBOOT=y -+CONFIG_CMD_FASTBOOT=y -+CONFIG_ANDROID_BOOT_IMAGE=y -+CONFIG_FASTBOOT_BUF_ADDR=0x40000000 -+CONFIG_FASTBOOT_BUF_SIZE=0x3DF00000 -+CONFIG_FASTBOOT_FLASH=y -+CONFIG_FASTBOOT_FLASH_MMC_DEV=0 # CONFIG_CMD_IMLS is not set +CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y @@ -1988,7 +368,6 @@ index 4e6942f56c..b8df85c638 100644 CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_STI=y CONFIG_PINCTRL=y -+CONFIG_STI_RESET=y CONFIG_STI_ASC_SERIAL=y CONFIG_SYSRESET=y CONFIG_TIMER=y @@ -1998,8 +377,6 @@ index 4e6942f56c..b8df85c638 100644 +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_OHCI_HCD=y -+CONFIG_USB_OHCI_STI=y -+CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y @@ -2010,21 +387,8 @@ index 4e6942f56c..b8df85c638 100644 +CONFIG_USB_PHY=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SPL_OF_LIBFDT=y --- -2.12.2 - -From 552bdf8d8c4604ac7d6352ff9cb187c0d7b93021 Mon Sep 17 00:00:00 2001 -From: Patrice Chotard -Date: Wed, 22 Mar 2017 18:06:18 +0100 -Subject: [PATCH 14/16] board: STiH410-B2260: update environment variable - -Signed-off-by: Patrice Chotard ---- - include/configs/stih410-b2260.h | 31 +++++++++++++++++++++++++------ - 1 file changed, 25 insertions(+), 6 deletions(-) - diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h -index 6c84e9b485..7fcb327a52 100644 +index eaa93a5830..1909f3b0d6 100644 --- a/include/configs/stih410-b2260.h +++ b/include/configs/stih410-b2260.h @@ -20,13 +20,32 @@ @@ -2061,64 +425,11 @@ index 6c84e9b485..7fcb327a52 100644 + "scriptaddr=0x50000000\0" \ + "fdt_high=0xffffffffffffffff\0" \ + "initrd_high=0xffffffffffffffff\0" \ -+ BOOTENV -+ - - #define CONFIG_ENV_IS_NOWHERE - #define CONFIG_ENV_SIZE 0x4000 --- -2.12.2 - -From 4b762469b09955d56bf45b81af8f5d26433e933d Mon Sep 17 00:00:00 2001 -From: Nicolas Le Bayon -Date: Mon, 27 Mar 2017 16:10:45 +0200 -Subject: [PATCH 15/16] board: STiH410-B2260: fix sdram size - -32MB are reserved for Trusted Zone purpose - -Signed-off-by: Nicolas Le Bayon ---- - include/configs/stih410-b2260.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h -index 7fcb327a52..ccbbf32470 100644 ---- a/include/configs/stih410-b2260.h -+++ b/include/configs/stih410-b2260.h -@@ -14,7 +14,7 @@ - #define CONFIG_NR_DRAM_BANKS 1 - #define PHYS_SDRAM_1 0x40000000 - #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 --#define PHYS_SDRAM_1_SIZE 0x3FE00000 -+#define PHYS_SDRAM_1_SIZE 0x3E000000 - #define CONFIG_SYS_TEXT_BASE 0x7D600000 - #define CONFIG_SYS_LOAD_ADDR PHYS_SDRAM_1 /* default load addr */ - --- -2.12.2 - -From 4cc3772e0f7c93d8b00f82cbfe493a732ecac313 Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Thu, 30 Mar 2017 11:18:45 +0200 -Subject: [PATCH 16/16] board: STiH410-B2260: set ramdisk_addr_r to 0x48000000 - -Signed-off-by: Lee Jones ---- - include/configs/stih410-b2260.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/configs/stih410-b2260.h b/include/configs/stih410-b2260.h -index ccbbf32470..b83bef5b0e 100644 ---- a/include/configs/stih410-b2260.h -+++ b/include/configs/stih410-b2260.h -@@ -44,6 +44,7 @@ - "scriptaddr=0x50000000\0" \ - "fdt_high=0xffffffffffffffff\0" \ - "initrd_high=0xffffffffffffffff\0" \ + "ramdisk_addr_r=0x48000000\0" \ - BOOTENV ++ BOOTENV + #define CONFIG_ENV_SIZE 0x4000 -- -2.12.2 +2.13.3 diff --git a/uboot-tools.spec b/uboot-tools.spec index 950e9d3..02b0d5d 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,8 +1,8 @@ -#global candidate rc3 +%global candidate rc1 Name: uboot-tools -Version: 2017.07 -Release: 2%{?candidate:.%{candidate}}%{?dist} +Version: 2017.09 +Release: 0.1%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -13,17 +13,16 @@ Source2: arm-chromebooks Source3: aarch64-boards Source4: aarch64-chromebooks +# Fedoraisms patches, general fixes Patch1: add-BOOTENV_INIT_COMMAND-for-commands-that-may-be-ne.patch -Patch2: dragonboard-fixes.patch -Patch3: mx6cuboxi-Add-support-for-sata.patch -Patch4: mx6-Initial-Hummingboard-2-support.patch -Patch5: uefi-fixes.patch -Patch6: use-Fedora-specific-EFI-path-name.patch -Patch7: net-Mark-the-ip_udp_hdr-struct-as-packed.patch +Patch2: use-Fedora-specific-EFI-path-name.patch +Patch3: net-Mark-the-ip_udp_hdr-struct-as-packed.patch + +# Board fixes and enablement +Patch10: dragonboard-fixes.patch +Patch11: mx6-Initial-Hummingboard-2-support.patch +Patch12: sti-STiH410-B2260-support.patch -# Patch11: sti-STiH410-B2260-support.patch -# Patch12: AW64-add-spl-atf-support.patch -# Patch13: arm-tegra-nyan-chromebook.patch # Patch14: 0001-arm-mvebu-enable-generic-distro-boot-config.patch BuildRequires: bc @@ -275,6 +274,10 @@ cp -p board/warp7/README builds/docs/README.warp7 %endif %changelog +* Tue Aug 1 2017 Peter Robinson 2017.09-0.1.rc1 +- 2017.09 RC1 +- Initial patch rebase + * Thu Jul 27 2017 Fedora Release Engineering - 2017.07-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild