[U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command

Jagan Teki jteki at openedev.com
Thu Nov 19 17:57:01 CET 2015


On 13 November 2015 at 18:55, Valentin Longchamp
<valentin.longchamp at keymile.com> wrote:
> The release command is the pendant of the probe command. This command
> allows to call spi_flash_free from the command line. This may be
> necessary for some boards where sf probe does change the state of the
> hardware (like with some pin multiplexing changes for instance).

So you want to change the state of pin multiplexing on your board with
connected slave devices example: spi nor flash is it? what exactly the
need of releasing? why can't we use pin multiplexing changes like
selecting or deselecting particular lines through driver or from board
files itself.

>
> Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>
> ---
>
> Changes in v3:
> - Rebased on v2015.10
>
> Changes in v2:
> - Rebased on v2014.10
>
>  common/cmd_sf.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
> index ac7f5df..9c51dca 100644
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
> @@ -152,6 +152,14 @@ static int do_spi_flash_probe(int argc, char * const argv[])
>         return 0;
>  }
>
> +static int do_spi_flash_release(int argc, char * const argv[])
> +{
> +       if (flash)
> +               spi_flash_free(flash);
> +       flash = NULL;
> +
> +       return 0;
> +}
>  /**
>   * Write a block of data to SPI flash, first checking if it is different from
>   * what is already there.
> @@ -540,6 +548,8 @@ static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc,
>                 ret = do_spi_flash_read_write(argc, argv);
>         else if (strcmp(cmd, "erase") == 0)
>                 ret = do_spi_flash_erase(argc, argv);
> +       else if (strcmp(cmd, "release") == 0)
> +               ret = do_spi_flash_release(argc, argv);
>  #ifdef CONFIG_CMD_SF_TEST
>         else if (!strcmp(cmd, "test"))
>                 ret = do_spi_flash_test(argc, argv);
> @@ -579,5 +589,6 @@ U_BOOT_CMD(
>         "sf update addr offset|partition len    - erase and write `len' bytes from memory\n"
>         "                                         at `addr' to flash at `offset'\n"
>         "                                         or to start of mtd `partition'\n"
> +       "sf release                             - release the current flash device\n"
>         SF_TEST_HELP
>  );
> --
> 1.8.3.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



-- 
Jagan | openedev.


More information about the U-Boot mailing list