All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] Fastboot OEM commands
@ 2015-01-26 21:48 Rob Herring
  2015-01-26 21:49 ` [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support Rob Herring
  2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
  0 siblings, 2 replies; 14+ messages in thread
From: Rob Herring @ 2015-01-26 21:48 UTC (permalink / raw)
  To: u-boot

This series adds fastboot oem sub-command infrastructure and support for 
"oem format" command which partitions and formats the storage device. 
The partition layout is set within the u-boot env and is implemented 
using the "gpt write" command.

Rob

Michael Scott (1):
  fastboot: add "fastboot oem" command support

Rob Herring (1):
  fastboot: add support for "oem format" command

 drivers/usb/gadget/f_fastboot.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support
  2015-01-26 21:48 [U-Boot] [PATCH 0/2] Fastboot OEM commands Rob Herring
@ 2015-01-26 21:49 ` Rob Herring
  2015-01-29  8:30   ` Lukasz Majewski
                     ` (2 more replies)
  2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
  1 sibling, 3 replies; 14+ messages in thread
From: Rob Herring @ 2015-01-26 21:49 UTC (permalink / raw)
  To: u-boot

From: Michael Scott <michael.scott@linaro.org>

Add code stub to handle "fastboot oem __" command. As unlock is a common
fastboot command, distinguish that it is not implemented.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 310175a..e2fda86 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 }
 #endif
 
+static void cb_oem(struct usb_ep *ep, struct usb_request *req)
+{
+	char *cmd = req->buf;
+	if (strncmp("unlock", cmd + 4, 8) == 0) {
+		fastboot_tx_write_str("FAILnot implemented");
+	}
+	else {
+		fastboot_tx_write_str("FAILunknown oem command");
+	}
+}
+
 struct cmd_dispatch_info {
 	char *cmd;
 	void (*cb)(struct usb_ep *ep, struct usb_request *req);
@@ -541,6 +552,10 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
 		.cb = cb_flash,
 	},
 #endif
+	{
+		.cmd = "oem",
+		.cb = cb_oem,
+	},
 };
 
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command
  2015-01-26 21:48 [U-Boot] [PATCH 0/2] Fastboot OEM commands Rob Herring
  2015-01-26 21:49 ` [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support Rob Herring
@ 2015-01-26 21:49 ` Rob Herring
  2015-01-29  8:31   ` Lukasz Majewski
                     ` (3 more replies)
  1 sibling, 4 replies; 14+ messages in thread
From: Rob Herring @ 2015-01-26 21:49 UTC (permalink / raw)
  To: u-boot

Add "oem format" command to write partition table. This relies on the
env variable partitions to contain the list of partitions as required by
the gpt command.

Note that this does not erase any data other than the partition table.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/usb/gadget/f_fastboot.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index e2fda86..f7d84bf 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 static void cb_oem(struct usb_ep *ep, struct usb_request *req)
 {
 	char *cmd = req->buf;
+#ifdef CONFIG_FASTBOOT_FLASH
+	if (strncmp("format", cmd + 4, 6) == 0) {
+		char cmdbuf[32];
+                sprintf(cmdbuf, "gpt write mmc %x $partitions",
+			CONFIG_FASTBOOT_FLASH_MMC_DEV);
+                if (run_command(cmdbuf, 0))
+			fastboot_tx_write_str("FAIL");
+                else
+			fastboot_tx_write_str("OKAY");
+	} else
+#endif
 	if (strncmp("unlock", cmd + 4, 8) == 0) {
 		fastboot_tx_write_str("FAILnot implemented");
 	}
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support
  2015-01-26 21:49 ` [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support Rob Herring
@ 2015-01-29  8:30   ` Lukasz Majewski
  2015-01-29 16:49     ` Marek Vasut
  2015-01-30 14:20     ` Rob Herring
  2015-01-29 23:27   ` Steve Rae
  2015-01-30 15:02   ` Lukasz Majewski
  2 siblings, 2 replies; 14+ messages in thread
From: Lukasz Majewski @ 2015-01-29  8:30 UTC (permalink / raw)
  To: u-boot

Hi Rob,

> From: Michael Scott <michael.scott@linaro.org>
> 
> Add code stub to handle "fastboot oem __" command. As unlock is a
> common fastboot command, distinguish that it is not implemented.
> 
> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> usb_request *req) }
>  #endif
>  
> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> +{
> +	char *cmd = req->buf;
> +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> +		fastboot_tx_write_str("FAILnot implemented");
> +	}
> +	else {
> +		fastboot_tx_write_str("FAILunknown oem command");
> +	}

Just a minor comment - those braces could be removed.

BTW: Marek shall I take those patches to dfu tree or would you take
them to -usb tree ?

> +}
> +
>  struct cmd_dispatch_info {
>  	char *cmd;
>  	void (*cb)(struct usb_ep *ep, struct usb_request *req);
> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
> cmd_dispatch_info[] = { .cb = cb_flash,
>  	},
>  #endif
> +	{
> +		.cmd = "oem",
> +		.cb = cb_oem,
> +	},
>  };
>  
>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
> *req)



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command
  2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
@ 2015-01-29  8:31   ` Lukasz Majewski
  2015-01-29 23:27   ` Steve Rae
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Lukasz Majewski @ 2015-01-29  8:31 UTC (permalink / raw)
  To: u-boot

Hi Rob,

> Add "oem format" command to write partition table. This relies on the
> env variable partitions to contain the list of partitions as required
> by the gpt command.
> 
> Note that this does not erase any data other than the partition table.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/usb/gadget/f_fastboot.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index e2fda86..f7d84bf 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct
> usb_request *req) static void cb_oem(struct usb_ep *ep, struct
> usb_request *req) {
>  	char *cmd = req->buf;
> +#ifdef CONFIG_FASTBOOT_FLASH
> +	if (strncmp("format", cmd + 4, 6) == 0) {
> +		char cmdbuf[32];
> +                sprintf(cmdbuf, "gpt write mmc %x $partitions",
> +			CONFIG_FASTBOOT_FLASH_MMC_DEV);
> +                if (run_command(cmdbuf, 0))
> +			fastboot_tx_write_str("FAIL");
> +                else
> +			fastboot_tx_write_str("OKAY");
> +	} else
> +#endif
>  	if (strncmp("unlock", cmd + 4, 8) == 0) {
>  		fastboot_tx_write_str("FAILnot implemented");
>  	}

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support
  2015-01-29  8:30   ` Lukasz Majewski
@ 2015-01-29 16:49     ` Marek Vasut
  2015-01-30 14:20     ` Rob Herring
  1 sibling, 0 replies; 14+ messages in thread
From: Marek Vasut @ 2015-01-29 16:49 UTC (permalink / raw)
  To: u-boot

On Thursday, January 29, 2015 at 09:30:27 AM, Lukasz Majewski wrote:
> Hi Rob,

Hi all!

> > From: Michael Scott <michael.scott@linaro.org>
> > 
> > Add code stub to handle "fastboot oem __" command. As unlock is a
> > common fastboot command, distinguish that it is not implemented.
> > 
> > Signed-off-by: Michael Scott <michael.scott@linaro.org>
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> > 
> >  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/drivers/usb/gadget/f_fastboot.c
> > b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> > --- a/drivers/usb/gadget/f_fastboot.c
> > +++ b/drivers/usb/gadget/f_fastboot.c
> > @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> > usb_request *req) }
> > 
> >  #endif
> > 
> > +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> > +{
> > +	char *cmd = req->buf;
> > +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> > +		fastboot_tx_write_str("FAILnot implemented");
> > +	}
> > +	else {
> > +		fastboot_tx_write_str("FAILunknown oem command");
> > +	}
> 
> Just a minor comment - those braces could be removed.
> 
> BTW: Marek shall I take those patches to dfu tree or would you take
> them to -usb tree ?

Take them through DFU please, thank you!

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support
  2015-01-26 21:49 ` [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support Rob Herring
  2015-01-29  8:30   ` Lukasz Majewski
@ 2015-01-29 23:27   ` Steve Rae
  2015-01-30 15:02   ` Lukasz Majewski
  2 siblings, 0 replies; 14+ messages in thread
From: Steve Rae @ 2015-01-29 23:27 UTC (permalink / raw)
  To: u-boot



On 15-01-26 01:49 PM, Rob Herring wrote:
> From: Michael Scott <michael.scott@linaro.org>
>
> Add code stub to handle "fastboot oem __" command. As unlock is a common
> fastboot command, distinguish that it is not implemented.
>
> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>   drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index 310175a..e2fda86 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
>   }
>   #endif
>
> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> +{
> +	char *cmd = req->buf;
> +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> +		fastboot_tx_write_str("FAILnot implemented");
> +	}
> +	else {
> +		fastboot_tx_write_str("FAILunknown oem command");
> +	}
> +}
> +
>   struct cmd_dispatch_info {
>   	char *cmd;
>   	void (*cb)(struct usb_ep *ep, struct usb_request *req);
> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
>   		.cb = cb_flash,
>   	},
>   #endif
> +	{
> +		.cmd = "oem",
> +		.cb = cb_oem,
> +	},
>   };
>
>   static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
>

Tested-by: Steve Rae <srae@broadcom.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command
  2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
  2015-01-29  8:31   ` Lukasz Majewski
@ 2015-01-29 23:27   ` Steve Rae
  2015-01-30 15:03   ` Lukasz Majewski
  2015-02-11 19:44   ` Steve Rae
  3 siblings, 0 replies; 14+ messages in thread
From: Steve Rae @ 2015-01-29 23:27 UTC (permalink / raw)
  To: u-boot



On 15-01-26 01:49 PM, Rob Herring wrote:
> Add "oem format" command to write partition table. This relies on the
> env variable partitions to contain the list of partitions as required by
> the gpt command.
>
> Note that this does not erase any data other than the partition table.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>   drivers/usb/gadget/f_fastboot.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index e2fda86..f7d84bf 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
>   static void cb_oem(struct usb_ep *ep, struct usb_request *req)
>   {
>   	char *cmd = req->buf;
> +#ifdef CONFIG_FASTBOOT_FLASH
> +	if (strncmp("format", cmd + 4, 6) == 0) {
> +		char cmdbuf[32];
> +                sprintf(cmdbuf, "gpt write mmc %x $partitions",
> +			CONFIG_FASTBOOT_FLASH_MMC_DEV);
> +                if (run_command(cmdbuf, 0))
> +			fastboot_tx_write_str("FAIL");
> +                else
> +			fastboot_tx_write_str("OKAY");
> +	} else
> +#endif
>   	if (strncmp("unlock", cmd + 4, 8) == 0) {
>   		fastboot_tx_write_str("FAILnot implemented");
>   	}
>

Reviewed-by: Steve Rae <srae@broadcom.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support
  2015-01-29  8:30   ` Lukasz Majewski
  2015-01-29 16:49     ` Marek Vasut
@ 2015-01-30 14:20     ` Rob Herring
  2015-01-30 14:29       ` Lukasz Majewski
  1 sibling, 1 reply; 14+ messages in thread
From: Rob Herring @ 2015-01-30 14:20 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 29, 2015 at 2:30 AM, Lukasz Majewski <l.majewski@samsung.com> wrote:
> Hi Rob,
>
>> From: Michael Scott <michael.scott@linaro.org>
>>
>> Add code stub to handle "fastboot oem __" command. As unlock is a
>> common fastboot command, distinguish that it is not implemented.
>>
>> Signed-off-by: Michael Scott <michael.scott@linaro.org>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/f_fastboot.c
>> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
>> --- a/drivers/usb/gadget/f_fastboot.c
>> +++ b/drivers/usb/gadget/f_fastboot.c
>> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
>> usb_request *req) }
>>  #endif
>>
>> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
>> +{
>> +     char *cmd = req->buf;
>> +     if (strncmp("unlock", cmd + 4, 8) == 0) {
>> +             fastboot_tx_write_str("FAILnot implemented");
>> +     }
>> +     else {
>> +             fastboot_tx_write_str("FAILunknown oem command");
>> +     }
>
> Just a minor comment - those braces could be removed.

When the format command is added in the next patch, then they need to
be added back if you want all clauses to be the same (braces or not).

Rob

> BTW: Marek shall I take those patches to dfu tree or would you take
> them to -usb tree ?
>
>> +}
>> +
>>  struct cmd_dispatch_info {
>>       char *cmd;
>>       void (*cb)(struct usb_ep *ep, struct usb_request *req);
>> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
>> cmd_dispatch_info[] = { .cb = cb_flash,
>>       },
>>  #endif
>> +     {
>> +             .cmd = "oem",
>> +             .cb = cb_oem,
>> +     },
>>  };
>>
>>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
>> *req)
>
>
>
> --
> Best regards,
>
> Lukasz Majewski
>
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support
  2015-01-30 14:20     ` Rob Herring
@ 2015-01-30 14:29       ` Lukasz Majewski
  0 siblings, 0 replies; 14+ messages in thread
From: Lukasz Majewski @ 2015-01-30 14:29 UTC (permalink / raw)
  To: u-boot

Hi Rob,

> On Thu, Jan 29, 2015 at 2:30 AM, Lukasz Majewski
> <l.majewski@samsung.com> wrote:
> > Hi Rob,
> >
> >> From: Michael Scott <michael.scott@linaro.org>
> >>
> >> Add code stub to handle "fastboot oem __" command. As unlock is a
> >> common fastboot command, distinguish that it is not implemented.
> >>
> >> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> >> Signed-off-by: Rob Herring <robh@kernel.org>
> >> ---
> >>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
> >>  1 file changed, 15 insertions(+)
> >>
> >> diff --git a/drivers/usb/gadget/f_fastboot.c
> >> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> >> --- a/drivers/usb/gadget/f_fastboot.c
> >> +++ b/drivers/usb/gadget/f_fastboot.c
> >> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> >> usb_request *req) }
> >>  #endif
> >>
> >> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> >> +{
> >> +     char *cmd = req->buf;
> >> +     if (strncmp("unlock", cmd + 4, 8) == 0) {
> >> +             fastboot_tx_write_str("FAILnot implemented");
> >> +     }
> >> +     else {
> >> +             fastboot_tx_write_str("FAILunknown oem command");
> >> +     }
> >
> > Just a minor comment - those braces could be removed.
> 
> When the format command is added in the next patch, then they need to
> be added back if you want all clauses to be the same (braces or not).

Then the patch can stay as it is. Thanks for explanation :-)

> 
> Rob
> 
> > BTW: Marek shall I take those patches to dfu tree or would you take
> > them to -usb tree ?
> >
> >> +}
> >> +
> >>  struct cmd_dispatch_info {
> >>       char *cmd;
> >>       void (*cb)(struct usb_ep *ep, struct usb_request *req);
> >> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
> >> cmd_dispatch_info[] = { .cb = cb_flash,
> >>       },
> >>  #endif
> >> +     {
> >> +             .cmd = "oem",
> >> +             .cb = cb_oem,
> >> +     },
> >>  };
> >>
> >>  static void rx_handler_command(struct usb_ep *ep, struct
> >> usb_request *req)
> >
> >
> >
> > --
> > Best regards,
> >
> > Lukasz Majewski
> >
> > Samsung R&D Institute Poland (SRPOL) | Linux Platform Group



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support
  2015-01-26 21:49 ` [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support Rob Herring
  2015-01-29  8:30   ` Lukasz Majewski
  2015-01-29 23:27   ` Steve Rae
@ 2015-01-30 15:02   ` Lukasz Majewski
  2 siblings, 0 replies; 14+ messages in thread
From: Lukasz Majewski @ 2015-01-30 15:02 UTC (permalink / raw)
  To: u-boot

Hi Rob,

> From: Michael Scott <michael.scott@linaro.org>
> 
> Add code stub to handle "fastboot oem __" command. As unlock is a
> common fastboot command, distinguish that it is not implemented.
> 
> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> usb_request *req) }
>  #endif
>  
> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> +{
> +	char *cmd = req->buf;
> +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> +		fastboot_tx_write_str("FAILnot implemented");
> +	}
> +	else {
> +		fastboot_tx_write_str("FAILunknown oem command");
> +	}
> +}
> +
>  struct cmd_dispatch_info {
>  	char *cmd;
>  	void (*cb)(struct usb_ep *ep, struct usb_request *req);
> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
> cmd_dispatch_info[] = { .cb = cb_flash,
>  	},
>  #endif
> +	{
> +		.cmd = "oem",
> +		.cb = cb_oem,
> +	},
>  };
>  
>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
> *req)

Applied to u-boot-dfu.

Thanks.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command
  2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
  2015-01-29  8:31   ` Lukasz Majewski
  2015-01-29 23:27   ` Steve Rae
@ 2015-01-30 15:03   ` Lukasz Majewski
  2015-02-11 19:44   ` Steve Rae
  3 siblings, 0 replies; 14+ messages in thread
From: Lukasz Majewski @ 2015-01-30 15:03 UTC (permalink / raw)
  To: u-boot

Hi Rob,

> Add "oem format" command to write partition table. This relies on the
> env variable partitions to contain the list of partitions as required
> by the gpt command.
> 
> Note that this does not erase any data other than the partition table.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/usb/gadget/f_fastboot.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index e2fda86..f7d84bf 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct
> usb_request *req) static void cb_oem(struct usb_ep *ep, struct
> usb_request *req) {
>  	char *cmd = req->buf;
> +#ifdef CONFIG_FASTBOOT_FLASH
> +	if (strncmp("format", cmd + 4, 6) == 0) {
> +		char cmdbuf[32];
> +                sprintf(cmdbuf, "gpt write mmc %x $partitions",
> +			CONFIG_FASTBOOT_FLASH_MMC_DEV);
> +                if (run_command(cmdbuf, 0))
> +			fastboot_tx_write_str("FAIL");
> +                else
> +			fastboot_tx_write_str("OKAY");
> +	} else
> +#endif
>  	if (strncmp("unlock", cmd + 4, 8) == 0) {
>  		fastboot_tx_write_str("FAILnot implemented");
>  	}

Applied to u-boot-dfu.

Thanks.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command
  2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
                     ` (2 preceding siblings ...)
  2015-01-30 15:03   ` Lukasz Majewski
@ 2015-02-11 19:44   ` Steve Rae
  2015-02-12  1:46     ` Rob Herring
  3 siblings, 1 reply; 14+ messages in thread
From: Steve Rae @ 2015-02-11 19:44 UTC (permalink / raw)
  To: u-boot



On 15-01-26 01:49 PM, Rob Herring wrote:
> Add "oem format" command to write partition table. This relies on the
> env variable partitions to contain the list of partitions as required by
> the gpt command.
>
> Note that this does not erase any data other than the partition table.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>   drivers/usb/gadget/f_fastboot.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index e2fda86..f7d84bf 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
>   static void cb_oem(struct usb_ep *ep, struct usb_request *req)
>   {
>   	char *cmd = req->buf;
> +#ifdef CONFIG_FASTBOOT_FLASH
> +	if (strncmp("format", cmd + 4, 6) == 0) {
> +		char cmdbuf[32];
> +                sprintf(cmdbuf, "gpt write mmc %x $partitions",
> +			CONFIG_FASTBOOT_FLASH_MMC_DEV);
> +                if (run_command(cmdbuf, 0))
> +			fastboot_tx_write_str("FAIL");
> +                else
> +			fastboot_tx_write_str("OKAY");
> +	} else
> +#endif
>   	if (strncmp("unlock", cmd + 4, 8) == 0) {
>   		fastboot_tx_write_str("FAILnot implemented");
>   	}
>

Please clarify the "partitions" env variable.
For example, if I have (snippet from the 'mmc part' command):
   3     0x00011000      0x000117ff      "u-boot"
         attrs:  0x0000000000000000
         type:   ebcf4a1c-b9e7-8f06-9885-3bd8b4a46cff
         guid:   d5b495eb-57aa-fc70-23bb-d1897fa4e840
   7     0x0001c000      0x00023fff      "kernel"
         attrs:  0x0000000000000000
         type:   3c3ea4a6-5eaa-7f7c-1cb7-9374b8191c5d
         guid:   43b9c433-a106-68bf-aff4-890416fc87d7
what would the corresponding "partitions" env variable look like?

Thanks, Steve
PS.
from doc/README.gpt:

148 Creating GPT partitions in U-Boot:
149 ==============
150
151 To restore GUID partition table one needs to:
152 1. Define partition layout in the environment.
153    Format of partitions layout:
154      "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
155         name=kernel,size=60MiB,uuid=...;"
156      or
157      "partitions=uuid_disk=${uuid_gpt_disk};name=${uboot_name},
158         size=${uboot_size},uuid=${uboot_uuid};"
159
160    Fields 'name', 'size' and 'uuid' are mandatory for every partition.
161    The field 'start' is optional.
162
163    option: CONFIG_RANDOM_UUID
164    If any partition "UUID" no exists then it is randomly generated.
165
166 2. Define 'CONFIG_EFI_PARTITION' and 'CONFIG_CMD_GPT'
167
168 2. From u-boot prompt type:
169    gpt write mmc 0 $partitions

How can dump the current "uuid_disk=" (not in the 'mmc part' command?)
Is the "uuid=" parameter the 'type:' or the 'guid:' in the 'mmc part' 
command?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command
  2015-02-11 19:44   ` Steve Rae
@ 2015-02-12  1:46     ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2015-02-12  1:46 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 11, 2015 at 1:44 PM, Steve Rae <srae@broadcom.com> wrote:
>
>
> On 15-01-26 01:49 PM, Rob Herring wrote:
>>
>> Add "oem format" command to write partition table. This relies on the
>> env variable partitions to contain the list of partitions as required by
>> the gpt command.
>>
>> Note that this does not erase any data other than the partition table.
>>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>>   drivers/usb/gadget/f_fastboot.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/f_fastboot.c
>> b/drivers/usb/gadget/f_fastboot.c
>> index e2fda86..f7d84bf 100644
>> --- a/drivers/usb/gadget/f_fastboot.c
>> +++ b/drivers/usb/gadget/f_fastboot.c
>> @@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct
>> usb_request *req)
>>   static void cb_oem(struct usb_ep *ep, struct usb_request *req)
>>   {
>>         char *cmd = req->buf;
>> +#ifdef CONFIG_FASTBOOT_FLASH
>> +       if (strncmp("format", cmd + 4, 6) == 0) {
>> +               char cmdbuf[32];
>> +                sprintf(cmdbuf, "gpt write mmc %x $partitions",
>> +                       CONFIG_FASTBOOT_FLASH_MMC_DEV);
>> +                if (run_command(cmdbuf, 0))
>> +                       fastboot_tx_write_str("FAIL");
>> +                else
>> +                       fastboot_tx_write_str("OKAY");
>> +       } else
>> +#endif
>>         if (strncmp("unlock", cmd + 4, 8) == 0) {
>>                 fastboot_tx_write_str("FAILnot implemented");
>>         }
>>
>
> Please clarify the "partitions" env variable.
> For example, if I have (snippet from the 'mmc part' command):
>   3     0x00011000      0x000117ff      "u-boot"
>         attrs:  0x0000000000000000
>         type:   ebcf4a1c-b9e7-8f06-9885-3bd8b4a46cff
>         guid:   d5b495eb-57aa-fc70-23bb-d1897fa4e840
>   7     0x0001c000      0x00023fff      "kernel"
>         attrs:  0x0000000000000000
>         type:   3c3ea4a6-5eaa-7f7c-1cb7-9374b8191c5d
>         guid:   43b9c433-a106-68bf-aff4-890416fc87d7
> what would the corresponding "partitions" env variable look like?

Here is what I have:

"partitions=" \
"name=DTIM,start=0x00200000,size=0x200000;" \
"name=recovery,start=0x00400000,size=0xb00000;" \
"name=bootloader,start=0x00F00000,size=0x100000;" \
"name=boot,start=0x01000000,size=0x1000000;" \
"name=dtb,start=0x02000000,size=0x1000000;" \
"name=system,start=0x03000000,size=0x30000000;" \
"name=vendor,start=0x33000000,size=0x10000000;" \
"name=cache,start=0x43000000,size=0x20000000;" \
"name=userdata,start=0x63000000,size=0x15d000000\0"

The main difference from mmc partition dump is start and size in bytes
rather than start and end in blocks.

> 166 2. Define 'CONFIG_EFI_PARTITION' and 'CONFIG_CMD_GPT'
> 167
> 168 2. From u-boot prompt type:
> 169    gpt write mmc 0 $partitions
>
> How can dump the current "uuid_disk=" (not in the 'mmc part' command?)
> Is the "uuid=" parameter the 'type:' or the 'guid:' in the 'mmc part'
> command?

There may not be a way to get the disk uuid currently other than
dumping the raw partition table hex. The uuid is the guid. The type
used is something corresponds "Windows data" which seems strange.
Probably that should be configurable, but it doesn't seem to really
matter.

Rob

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-02-12  1:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 21:48 [U-Boot] [PATCH 0/2] Fastboot OEM commands Rob Herring
2015-01-26 21:49 ` [U-Boot] [PATCH 1/2] fastboot: add "fastboot oem" command support Rob Herring
2015-01-29  8:30   ` Lukasz Majewski
2015-01-29 16:49     ` Marek Vasut
2015-01-30 14:20     ` Rob Herring
2015-01-30 14:29       ` Lukasz Majewski
2015-01-29 23:27   ` Steve Rae
2015-01-30 15:02   ` Lukasz Majewski
2015-01-26 21:49 ` [U-Boot] [PATCH 2/2] fastboot: add support for "oem format" command Rob Herring
2015-01-29  8:31   ` Lukasz Majewski
2015-01-29 23:27   ` Steve Rae
2015-01-30 15:03   ` Lukasz Majewski
2015-02-11 19:44   ` Steve Rae
2015-02-12  1:46     ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.