Re: [U-Boot] [PATCH V4 1/8] tools: imximage: add plugin support

2016-10-26 Thread Stefano Babic
On 25/10/2016 02:09, Peng Fan wrote:
> Hi Stefano,
> On Mon, Oct 24, 2016 at 04:05:53PM +0200, Stefano Babic wrote:
>> Hi Peng,
>>
>> On 11/10/2016 08:29, Peng Fan wrote:
>>> Add plugin support for imximage.
>>>
>>> Define CONFIG_USE_IMXIMG_PLUGIN in defconfig to enable using plugin.
>>>
>>> Signed-off-by: Peng Fan 
>>> Cc: Stefano Babic 
>>> Cc: Eric Nelson 
>>> Cc: Ye Li 
>>> Reviewed-by: Tom Rini 
>>> ---
>>>
>>
>> I have just the same issue as with Jagan's patches. Due to recent
>> changes, we need to unset a couple of defines in defconfig (ull without
>> plugin is already fixed).
>>
>> This means:
>>
>> diff --git a/configs/mx6ull_14x14_evk_plugin_defconfig
>> b/configs/mx6ull_14x14_evk_plugin_defconfig
>> index ff15c8e..095e48d 100644
>> --- a/configs/mx6ull_14x14_evk_plugin_defconfig
>> +++ b/configs/mx6ull_14x14_evk_plugin_defconfig
>> @@ -25,6 +25,8 @@ CONFIG_DM_GPIO=y
>> CONFIG_DM_74X164=y
>> CONFIG_DM_I2C=y
>> CONFIG_DM_MMC=y
>> +# CONFIG_BLK is not set
>> +# CONFIG_DM_MMC_OPS is not set
>> CONFIG_PINCTRL=y
>> CONFIG_PINCTRL_IMX6=y
>> CONFIG_DM_REGULATOR=y
>>
>>
>> If you agree, I will make the change by applying it.
> 
> Yeah. Please help do this.

ok, thanks - applied to master.

Best regards,
Stefano Babic

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


Re: [U-Boot] [PATCH V4 1/8] tools: imximage: add plugin support

2016-10-24 Thread Peng Fan
Hi Stefano,
On Mon, Oct 24, 2016 at 04:05:53PM +0200, Stefano Babic wrote:
>Hi Peng,
>
>On 11/10/2016 08:29, Peng Fan wrote:
>> Add plugin support for imximage.
>> 
>> Define CONFIG_USE_IMXIMG_PLUGIN in defconfig to enable using plugin.
>> 
>> Signed-off-by: Peng Fan 
>> Cc: Stefano Babic 
>> Cc: Eric Nelson 
>> Cc: Ye Li 
>> Reviewed-by: Tom Rini 
>> ---
>> 
>
>I have just the same issue as with Jagan's patches. Due to recent
>changes, we need to unset a couple of defines in defconfig (ull without
>plugin is already fixed).
>
>This means:
>
>diff --git a/configs/mx6ull_14x14_evk_plugin_defconfig
>b/configs/mx6ull_14x14_evk_plugin_defconfig
>index ff15c8e..095e48d 100644
>--- a/configs/mx6ull_14x14_evk_plugin_defconfig
>+++ b/configs/mx6ull_14x14_evk_plugin_defconfig
>@@ -25,6 +25,8 @@ CONFIG_DM_GPIO=y
> CONFIG_DM_74X164=y
> CONFIG_DM_I2C=y
> CONFIG_DM_MMC=y
>+# CONFIG_BLK is not set
>+# CONFIG_DM_MMC_OPS is not set
> CONFIG_PINCTRL=y
> CONFIG_PINCTRL_IMX6=y
> CONFIG_DM_REGULATOR=y
>
>
>If you agree, I will make the change by applying it.

Yeah. Please help do this.

Thanks,
Peng.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V4 1/8] tools: imximage: add plugin support

2016-10-24 Thread Stefano Babic
Hi Peng,

On 11/10/2016 08:29, Peng Fan wrote:
> Add plugin support for imximage.
> 
> Define CONFIG_USE_IMXIMG_PLUGIN in defconfig to enable using plugin.
> 
> Signed-off-by: Peng Fan 
> Cc: Stefano Babic 
> Cc: Eric Nelson 
> Cc: Ye Li 
> Reviewed-by: Tom Rini 
> ---
> 

I have just the same issue as with Jagan's patches. Due to recent
changes, we need to unset a couple of defines in defconfig (ull without
plugin is already fixed).

This means:

diff --git a/configs/mx6ull_14x14_evk_plugin_defconfig
b/configs/mx6ull_14x14_evk_plugin_defconfig
index ff15c8e..095e48d 100644
--- a/configs/mx6ull_14x14_evk_plugin_defconfig
+++ b/configs/mx6ull_14x14_evk_plugin_defconfig
@@ -25,6 +25,8 @@ CONFIG_DM_GPIO=y
 CONFIG_DM_74X164=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+# CONFIG_BLK is not set
+# CONFIG_DM_MMC_OPS is not set
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_REGULATOR=y


If you agree, I will make the change by applying it.

Best regards,
Stefano


> V4:
>  Max 64KB for plugin code.
>  
> V3:
>  Fix compile error.
> 
>  V2:
>   Drop the CONFIG_USE_PLUGIN, make plugin always support in imximage.
> 
>  tools/imximage.c | 283 
> +++
>  tools/imximage.h |   7 +-
>  2 files changed, 230 insertions(+), 60 deletions(-)
> 
> diff --git a/tools/imximage.c b/tools/imximage.c
> index 092d550..615a64e 100644
> --- a/tools/imximage.c
> +++ b/tools/imximage.c
> @@ -27,6 +27,7 @@ static table_entry_t imximage_cmds[] = {
>   {CMD_CHECK_BITS_CLR,"CHECK_BITS_CLR",   "Reg Check bits clr", },
>   {CMD_CSF,   "CSF",   "Command Sequence File", },
>   {CMD_IMAGE_VERSION, "IMAGE_VERSION","image version",  },
> + {CMD_PLUGIN,"PLUGIN",   "file plugin_addr",  },
>   {-1,"", "",   },
>  };
>  
> @@ -80,6 +81,9 @@ static uint32_t imximage_ivt_offset = UNDEFINED;
>  static uint32_t imximage_csf_size = UNDEFINED;
>  /* Initial Load Region Size */
>  static uint32_t imximage_init_loadsize;
> +static uint32_t imximage_iram_free_start;
> +static uint32_t imximage_plugin_size;
> +static uint32_t plugin_image;
>  
>  static set_dcd_val_t set_dcd_val;
>  static set_dcd_param_t set_dcd_param;
> @@ -118,7 +122,11 @@ static uint32_t detect_imximage_version(struct 
> imx_header *imx_hdr)
>  
>   /* Try to detect V2 */
>   if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
> - (hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
> + (hdr_v2->data.dcd_table.header.tag == DCD_HEADER_TAG))
> + return IMXIMAGE_V2;
> +
> + if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
> + hdr_v2->boot_data.plugin)
>   return IMXIMAGE_V2;
>  
>   return IMXIMAGE_VER_INVALID;
> @@ -165,7 +173,7 @@ static struct dcd_v2_cmd *gd_last_cmd;
>  static void set_dcd_param_v2(struct imx_header *imxhdr, uint32_t dcd_len,
>   int32_t cmd)
>  {
> - dcd_v2_t *dcd_v2 = >header.hdr_v2.dcd_table;
> + dcd_v2_t *dcd_v2 = >header.hdr_v2.data.dcd_table;
>   struct dcd_v2_cmd *d = gd_last_cmd;
>   struct dcd_v2_cmd *d2;
>   int len;
> @@ -261,21 +269,23 @@ static void set_dcd_rst_v1(struct imx_header *imxhdr, 
> uint32_t dcd_len,
>  static void set_dcd_rst_v2(struct imx_header *imxhdr, uint32_t dcd_len,
>   char *name, int lineno)
>  {
> - dcd_v2_t *dcd_v2 = >header.hdr_v2.dcd_table;
> - struct dcd_v2_cmd *d = gd_last_cmd;
> - int len;
> -
> - if (!d)
> - d = _v2->dcd_cmd;
> - len = be16_to_cpu(d->write_dcd_command.length);
> - if (len > 4)
> - d = (struct dcd_v2_cmd *)(((char *)d) + len);
> -
> - len = (char *)d - (char *)_v2->header;
> -
> - dcd_v2->header.tag = DCD_HEADER_TAG;
> - dcd_v2->header.length = cpu_to_be16(len);
> - dcd_v2->header.version = DCD_VERSION;
> + if (!imxhdr->header.hdr_v2.boot_data.plugin) {
> + dcd_v2_t *dcd_v2 = >header.hdr_v2.data.dcd_table;
> + struct dcd_v2_cmd *d = gd_last_cmd;
> + int len;
> +
> + if (!d)
> + d = _v2->dcd_cmd;
> + len = be16_to_cpu(d->write_dcd_command.length);
> + if (len > 4)
> + d = (struct dcd_v2_cmd *)(((char *)d) + len);
> +
> + len = (char *)d - (char *)_v2->header;
> +
> + dcd_v2->header.tag = DCD_HEADER_TAG;
> + dcd_v2->header.length = cpu_to_be16(len);
> + dcd_v2->header.version = DCD_VERSION;
> + }
>  }
>  
>  static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
> @@ -317,24 +327,94 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, 
> uint32_t dcd_len,
>   fhdr_v2->header.length = cpu_to_be16(sizeof(flash_header_v2_t));
>   fhdr_v2->header.version = IVT_VERSION; 

[U-Boot] [PATCH V4 1/8] tools: imximage: add plugin support

2016-10-11 Thread Peng Fan
Add plugin support for imximage.

Define CONFIG_USE_IMXIMG_PLUGIN in defconfig to enable using plugin.

Signed-off-by: Peng Fan 
Cc: Stefano Babic 
Cc: Eric Nelson 
Cc: Ye Li 
Reviewed-by: Tom Rini 
---

V4:
 Max 64KB for plugin code.
 
V3:
 Fix compile error.

 V2:
  Drop the CONFIG_USE_PLUGIN, make plugin always support in imximage.

 tools/imximage.c | 283 +++
 tools/imximage.h |   7 +-
 2 files changed, 230 insertions(+), 60 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 092d550..615a64e 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -27,6 +27,7 @@ static table_entry_t imximage_cmds[] = {
{CMD_CHECK_BITS_CLR,"CHECK_BITS_CLR",   "Reg Check bits clr", },
{CMD_CSF,   "CSF",   "Command Sequence File", },
{CMD_IMAGE_VERSION, "IMAGE_VERSION","image version",  },
+   {CMD_PLUGIN,"PLUGIN",   "file plugin_addr",  },
{-1,"", "",   },
 };
 
@@ -80,6 +81,9 @@ static uint32_t imximage_ivt_offset = UNDEFINED;
 static uint32_t imximage_csf_size = UNDEFINED;
 /* Initial Load Region Size */
 static uint32_t imximage_init_loadsize;
+static uint32_t imximage_iram_free_start;
+static uint32_t imximage_plugin_size;
+static uint32_t plugin_image;
 
 static set_dcd_val_t set_dcd_val;
 static set_dcd_param_t set_dcd_param;
@@ -118,7 +122,11 @@ static uint32_t detect_imximage_version(struct imx_header 
*imx_hdr)
 
/* Try to detect V2 */
if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
-   (hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
+   (hdr_v2->data.dcd_table.header.tag == DCD_HEADER_TAG))
+   return IMXIMAGE_V2;
+
+   if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
+   hdr_v2->boot_data.plugin)
return IMXIMAGE_V2;
 
return IMXIMAGE_VER_INVALID;
@@ -165,7 +173,7 @@ static struct dcd_v2_cmd *gd_last_cmd;
 static void set_dcd_param_v2(struct imx_header *imxhdr, uint32_t dcd_len,
int32_t cmd)
 {
-   dcd_v2_t *dcd_v2 = >header.hdr_v2.dcd_table;
+   dcd_v2_t *dcd_v2 = >header.hdr_v2.data.dcd_table;
struct dcd_v2_cmd *d = gd_last_cmd;
struct dcd_v2_cmd *d2;
int len;
@@ -261,21 +269,23 @@ static void set_dcd_rst_v1(struct imx_header *imxhdr, 
uint32_t dcd_len,
 static void set_dcd_rst_v2(struct imx_header *imxhdr, uint32_t dcd_len,
char *name, int lineno)
 {
-   dcd_v2_t *dcd_v2 = >header.hdr_v2.dcd_table;
-   struct dcd_v2_cmd *d = gd_last_cmd;
-   int len;
-
-   if (!d)
-   d = _v2->dcd_cmd;
-   len = be16_to_cpu(d->write_dcd_command.length);
-   if (len > 4)
-   d = (struct dcd_v2_cmd *)(((char *)d) + len);
-
-   len = (char *)d - (char *)_v2->header;
-
-   dcd_v2->header.tag = DCD_HEADER_TAG;
-   dcd_v2->header.length = cpu_to_be16(len);
-   dcd_v2->header.version = DCD_VERSION;
+   if (!imxhdr->header.hdr_v2.boot_data.plugin) {
+   dcd_v2_t *dcd_v2 = >header.hdr_v2.data.dcd_table;
+   struct dcd_v2_cmd *d = gd_last_cmd;
+   int len;
+
+   if (!d)
+   d = _v2->dcd_cmd;
+   len = be16_to_cpu(d->write_dcd_command.length);
+   if (len > 4)
+   d = (struct dcd_v2_cmd *)(((char *)d) + len);
+
+   len = (char *)d - (char *)_v2->header;
+
+   dcd_v2->header.tag = DCD_HEADER_TAG;
+   dcd_v2->header.length = cpu_to_be16(len);
+   dcd_v2->header.version = DCD_VERSION;
+   }
 }
 
 static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
@@ -317,24 +327,94 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, 
uint32_t dcd_len,
fhdr_v2->header.length = cpu_to_be16(sizeof(flash_header_v2_t));
fhdr_v2->header.version = IVT_VERSION; /* 0x40 */
 
-   fhdr_v2->entry = entry_point;
-   fhdr_v2->reserved1 = fhdr_v2->reserved2 = 0;
-   hdr_base = entry_point - imximage_init_loadsize +
-   flash_offset;
-   fhdr_v2->self = hdr_base;
-   if (dcd_len > 0)
-   fhdr_v2->dcd_ptr = hdr_base
-   + offsetof(imx_header_v2_t, dcd_table);
-   else
+   if (!hdr_v2->boot_data.plugin) {
+   fhdr_v2->entry = entry_point;
+   fhdr_v2->reserved1 = 0;
+   fhdr_v2->reserved1 = 0;
+   hdr_base = entry_point - imximage_init_loadsize +
+   flash_offset;
+   fhdr_v2->self = hdr_base;
+   if (dcd_len > 0)
+   fhdr_v2->dcd_ptr = hdr_base +
+   offsetof(imx_header_v2_t, data);
+   else
+