diff mbox series

[U-Boot,RFC,v2,16/20] fastboot: net: Add NAND support

Message ID 1525077174-6211-17-git-send-email-alex.kiernan@gmail.com
State RFC
Delegated to: Lukasz Majewski
Headers show
Series Add fastboot UDP support | expand

Commit Message

Alex Kiernan April 30, 2018, 8:32 a.m. UTC
Add NAND support to fastboot UDP flash/erase commands

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

Changes in v2: None

 net/fastboot.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Joe Hershberger May 3, 2018, 9:24 p.m. UTC | #1
On Mon, Apr 30, 2018 at 3:32 AM, Alex Kiernan <alex.kiernan@gmail.com> wrote:
> Add NAND support to fastboot UDP flash/erase commands
>
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Jocelyn Bohr May 8, 2018, 6:53 a.m. UTC | #2
On Mon, Apr 30, 2018 at 1:33 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:

> Add NAND support to fastboot UDP flash/erase commands
>
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
>
> Changes in v2: None
>
>  net/fastboot.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/net/fastboot.c b/net/fastboot.c
> index 119011c..a07b1ad 100644
> --- a/net/fastboot.c
> +++ b/net/fastboot.c
> @@ -60,7 +60,7 @@ static int fastboot_our_port;
>  static void cb_okay(char *, char *, unsigned int, char *);
>  static void cb_getvar(char *, char *, unsigned int, char *);
>  static void cb_download(char *, char *, unsigned int, char *);
> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
>  static void cb_flash(char *, char *, unsigned int, char *);
>  static void cb_erase(char *, char *, unsigned int, char *);
>  #endif
> @@ -74,7 +74,7 @@ static void (*fb_net_dispatch[])(char *cmd_parameter,
>         [FB_CMD_GETVAR] = cb_getvar,
>         [FB_CMD_DOWNLOAD] = cb_download,
>         [FB_CMD_VERIFY] = NULL,
> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
>         [FB_CMD_FLASH] = cb_flash,
>         [FB_CMD_ERASE] = cb_erase,
>  #else
> @@ -324,7 +324,7 @@ static void cb_download(char *cmd_parameter, char
> *fastboot_data,
>         }
>  }
>
> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
>  /**
>   * Writes the previously downloaded image to the partition indicated by
>   * cmd_parameter. Writes to response.
> @@ -334,8 +334,14 @@ static void cb_download(char *cmd_parameter, char
> *fastboot_data,
>  static void cb_flash(char *cmd_parameter, char *fastboot_data,
>                      unsigned int fastboot_data_len, char *response)
>  {
> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
>         fb_mmc_flash_write(cmd_parameter, (void *)CONFIG_FASTBOOT_BUF_ADDR,
>                            image_size, response);
> +#endif
> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
> +       fb_nand_flash_write(cmd_parameter, (void
> *)CONFIG_FASTBOOT_BUF_ADDR,
> +                           image_size, response);
> +#endif
>

Is there a way to make FASTBOOT_FLASH_MMC and FASTBOOT_FLASH_NAND
mutually exclusive? Currently here and elsewhere, both mmc and nand write
are executed
when both configs are enabled, and I'm not sure if that's the intended
behavior.
Joe Hershberger May 8, 2018, 7:19 a.m. UTC | #3
On Tue, May 8, 2018 at 1:53 AM, Jocelyn Bohr <bohr@verily.com> wrote:
> On Mon, Apr 30, 2018 at 1:33 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:
>
>> Add NAND support to fastboot UDP flash/erase commands
>>
>> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/fastboot.c | 17 ++++++++++++++---
>>  1 file changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/net/fastboot.c b/net/fastboot.c
>> index 119011c..a07b1ad 100644
>> --- a/net/fastboot.c
>> +++ b/net/fastboot.c
>> @@ -60,7 +60,7 @@ static int fastboot_our_port;
>>  static void cb_okay(char *, char *, unsigned int, char *);
>>  static void cb_getvar(char *, char *, unsigned int, char *);
>>  static void cb_download(char *, char *, unsigned int, char *);
>> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
>> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
>>  static void cb_flash(char *, char *, unsigned int, char *);
>>  static void cb_erase(char *, char *, unsigned int, char *);
>>  #endif
>> @@ -74,7 +74,7 @@ static void (*fb_net_dispatch[])(char *cmd_parameter,
>>         [FB_CMD_GETVAR] = cb_getvar,
>>         [FB_CMD_DOWNLOAD] = cb_download,
>>         [FB_CMD_VERIFY] = NULL,
>> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
>> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
>>         [FB_CMD_FLASH] = cb_flash,
>>         [FB_CMD_ERASE] = cb_erase,
>>  #else
>> @@ -324,7 +324,7 @@ static void cb_download(char *cmd_parameter, char
>> *fastboot_data,
>>         }
>>  }
>>
>> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
>> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
>>  /**
>>   * Writes the previously downloaded image to the partition indicated by
>>   * cmd_parameter. Writes to response.
>> @@ -334,8 +334,14 @@ static void cb_download(char *cmd_parameter, char
>> *fastboot_data,
>>  static void cb_flash(char *cmd_parameter, char *fastboot_data,
>>                      unsigned int fastboot_data_len, char *response)
>>  {
>> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
>>         fb_mmc_flash_write(cmd_parameter, (void *)CONFIG_FASTBOOT_BUF_ADDR,
>>                            image_size, response);
>> +#endif
>> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
>> +       fb_nand_flash_write(cmd_parameter, (void
>> *)CONFIG_FASTBOOT_BUF_ADDR,
>> +                           image_size, response);
>> +#endif
>>
>
> Is there a way to make FASTBOOT_FLASH_MMC and FASTBOOT_FLASH_NAND
> mutually exclusive? Currently here and elsewhere, both mmc and nand write
> are executed
> when both configs are enabled, and I'm not sure if that's the intended
> behavior.

I thought in Kconfig those two configs are a "choice" so only one can
be enabled at a time.

> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Alex Kiernan May 8, 2018, 9:09 a.m. UTC | #4
On Tue, May 8, 2018 at 8:20 AM Joe Hershberger <joe.hershberger@ni.com>
wrote:

> On Tue, May 8, 2018 at 1:53 AM, Jocelyn Bohr <bohr@verily.com> wrote:
> > On Mon, Apr 30, 2018 at 1:33 AM Alex Kiernan <alex.kiernan@gmail.com>
wrote:
> >
> >> Add NAND support to fastboot UDP flash/erase commands
> >>
> >> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> >> ---
> >>
> >> Changes in v2: None
> >>
> >>  net/fastboot.c | 17 ++++++++++++++---
> >>  1 file changed, 14 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/net/fastboot.c b/net/fastboot.c
> >> index 119011c..a07b1ad 100644
> >> --- a/net/fastboot.c
> >> +++ b/net/fastboot.c
> >> @@ -60,7 +60,7 @@ static int fastboot_our_port;
> >>  static void cb_okay(char *, char *, unsigned int, char *);
> >>  static void cb_getvar(char *, char *, unsigned int, char *);
> >>  static void cb_download(char *, char *, unsigned int, char *);
> >> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
> >>  static void cb_flash(char *, char *, unsigned int, char *);
> >>  static void cb_erase(char *, char *, unsigned int, char *);
> >>  #endif
> >> @@ -74,7 +74,7 @@ static void (*fb_net_dispatch[])(char *cmd_parameter,
> >>         [FB_CMD_GETVAR] = cb_getvar,
> >>         [FB_CMD_DOWNLOAD] = cb_download,
> >>         [FB_CMD_VERIFY] = NULL,
> >> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
> >>         [FB_CMD_FLASH] = cb_flash,
> >>         [FB_CMD_ERASE] = cb_erase,
> >>  #else
> >> @@ -324,7 +324,7 @@ static void cb_download(char *cmd_parameter, char
> >> *fastboot_data,
> >>         }
> >>  }
> >>
> >> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
> >>  /**
> >>   * Writes the previously downloaded image to the partition indicated
by
> >>   * cmd_parameter. Writes to response.
> >> @@ -334,8 +334,14 @@ static void cb_download(char *cmd_parameter, char
> >> *fastboot_data,
> >>  static void cb_flash(char *cmd_parameter, char *fastboot_data,
> >>                      unsigned int fastboot_data_len, char *response)
> >>  {
> >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> >>         fb_mmc_flash_write(cmd_parameter, (void
*)CONFIG_FASTBOOT_BUF_ADDR,
> >>                            image_size, response);
> >> +#endif
> >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
> >> +       fb_nand_flash_write(cmd_parameter, (void
> >> *)CONFIG_FASTBOOT_BUF_ADDR,
> >> +                           image_size, response);
> >> +#endif
> >>
> >
> > Is there a way to make FASTBOOT_FLASH_MMC and FASTBOOT_FLASH_NAND
> > mutually exclusive? Currently here and elsewhere, both mmc and nand
write
> > are executed
> > when both configs are enabled, and I'm not sure if that's the intended
> > behavior.

> I thought in Kconfig those two configs are a "choice" so only one can
> be enabled at a time.

They are.

--
Alex Kiernan
Jocelyn Bohr May 8, 2018, 4:37 p.m. UTC | #5
On Tue, May 8, 2018 at 2:09 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:

> On Tue, May 8, 2018 at 8:20 AM Joe Hershberger <joe.hershberger@ni.com>
> wrote:
>
> > On Tue, May 8, 2018 at 1:53 AM, Jocelyn Bohr <bohr@verily.com> wrote:
> > > On Mon, Apr 30, 2018 at 1:33 AM Alex Kiernan <alex.kiernan@gmail.com>
> wrote:
> > >
> > >> Add NAND support to fastboot UDP flash/erase commands
> > >>
> > >> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > >> ---
> > >>
> > >> Changes in v2: None
> > >>
> > >>  net/fastboot.c | 17 ++++++++++++++---
> > >>  1 file changed, 14 insertions(+), 3 deletions(-)
> > >>
> > >> diff --git a/net/fastboot.c b/net/fastboot.c
> > >> index 119011c..a07b1ad 100644
> > >> --- a/net/fastboot.c
> > >> +++ b/net/fastboot.c
> > >> @@ -60,7 +60,7 @@ static int fastboot_our_port;
> > >>  static void cb_okay(char *, char *, unsigned int, char *);
> > >>  static void cb_getvar(char *, char *, unsigned int, char *);
> > >>  static void cb_download(char *, char *, unsigned int, char *);
> > >> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> > >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
> > >>  static void cb_flash(char *, char *, unsigned int, char *);
> > >>  static void cb_erase(char *, char *, unsigned int, char *);
> > >>  #endif
> > >> @@ -74,7 +74,7 @@ static void (*fb_net_dispatch[])(char
> *cmd_parameter,
> > >>         [FB_CMD_GETVAR] = cb_getvar,
> > >>         [FB_CMD_DOWNLOAD] = cb_download,
> > >>         [FB_CMD_VERIFY] = NULL,
> > >> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> > >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
> > >>         [FB_CMD_FLASH] = cb_flash,
> > >>         [FB_CMD_ERASE] = cb_erase,
> > >>  #else
> > >> @@ -324,7 +324,7 @@ static void cb_download(char *cmd_parameter, char
> > >> *fastboot_data,
> > >>         }
> > >>  }
> > >>
> > >> -#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> > >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
> > >>  /**
> > >>   * Writes the previously downloaded image to the partition indicated
> by
> > >>   * cmd_parameter. Writes to response.
> > >> @@ -334,8 +334,14 @@ static void cb_download(char *cmd_parameter, char
> > >> *fastboot_data,
> > >>  static void cb_flash(char *cmd_parameter, char *fastboot_data,
> > >>                      unsigned int fastboot_data_len, char *response)
> > >>  {
> > >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
> > >>         fb_mmc_flash_write(cmd_parameter, (void
> *)CONFIG_FASTBOOT_BUF_ADDR,
> > >>                            image_size, response);
> > >> +#endif
> > >> +#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
> > >> +       fb_nand_flash_write(cmd_parameter, (void
> > >> *)CONFIG_FASTBOOT_BUF_ADDR,
> > >> +                           image_size, response);
> > >> +#endif
> > >>
> > >
> > > Is there a way to make FASTBOOT_FLASH_MMC and FASTBOOT_FLASH_NAND
> > > mutually exclusive? Currently here and elsewhere, both mmc and nand
> write
> > > are executed
> > > when both configs are enabled, and I'm not sure if that's the intended
> > > behavior.
>
> > I thought in Kconfig those two configs are a "choice" so only one can
> > be enabled at a time.
>
> They are.
>

Oh great, sorry I'm not super familiar with Kconfig. LGTM then!

>
> --
> Alex Kiernan
>
Jocelyn Bohr May 8, 2018, 4:38 p.m. UTC | #6
On Thu, May 3, 2018 at 2:24 PM Joe Hershberger <joe.hershberger@ni.com>
wrote:

> On Mon, Apr 30, 2018 at 3:32 AM, Alex Kiernan <alex.kiernan@gmail.com>
> wrote:
> > Add NAND support to fastboot UDP flash/erase commands
> >
> > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>

Reviewed-by: Jocelyn Bohr <bohr@google.com>
diff mbox series

Patch

diff --git a/net/fastboot.c b/net/fastboot.c
index 119011c..a07b1ad 100644
--- a/net/fastboot.c
+++ b/net/fastboot.c
@@ -60,7 +60,7 @@  static int fastboot_our_port;
 static void cb_okay(char *, char *, unsigned int, char *);
 static void cb_getvar(char *, char *, unsigned int, char *);
 static void cb_download(char *, char *, unsigned int, char *);
-#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
 static void cb_flash(char *, char *, unsigned int, char *);
 static void cb_erase(char *, char *, unsigned int, char *);
 #endif
@@ -74,7 +74,7 @@  static void (*fb_net_dispatch[])(char *cmd_parameter,
 	[FB_CMD_GETVAR] = cb_getvar,
 	[FB_CMD_DOWNLOAD] = cb_download,
 	[FB_CMD_VERIFY] = NULL,
-#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
 	[FB_CMD_FLASH] = cb_flash,
 	[FB_CMD_ERASE] = cb_erase,
 #else
@@ -324,7 +324,7 @@  static void cb_download(char *cmd_parameter, char *fastboot_data,
 	}
 }
 
-#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
 /**
  * Writes the previously downloaded image to the partition indicated by
  * cmd_parameter. Writes to response.
@@ -334,8 +334,14 @@  static void cb_download(char *cmd_parameter, char *fastboot_data,
 static void cb_flash(char *cmd_parameter, char *fastboot_data,
 		     unsigned int fastboot_data_len, char *response)
 {
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
 	fb_mmc_flash_write(cmd_parameter, (void *)CONFIG_FASTBOOT_BUF_ADDR,
 			   image_size, response);
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
+	fb_nand_flash_write(cmd_parameter, (void *)CONFIG_FASTBOOT_BUF_ADDR,
+			    image_size, response);
+#endif
 }
 
 /**
@@ -347,7 +353,12 @@  static void cb_flash(char *cmd_parameter, char *fastboot_data,
 static void cb_erase(char *cmd_parameter, char *fastboot_data,
 		     unsigned int fastboot_data_len, char *response)
 {
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
 	fb_mmc_erase(cmd_parameter, response);
+#endif
+#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND)
+	fb_nand_erase(cmd_parameter, response);
+#endif
 }
 #endif