[U-Boot] [PATCH V3 4/6] sf command: allow default chip select through CONFIG_SPI_FLASH_CS
Mike Frysinger
vapier at gentoo.org
Tue Jan 24 19:08:06 CET 2012
On Tuesday 24 January 2012 11:18:22 Eric Nelson wrote:
> This patch allows a board configuration file to provide a default
> chip-select for serial flash so that first argument to the 'sf' command
> is optional.
>
> On boards that use the mxc_spi driver and a GPIO for chip select, this
> allows a much simpler command line:
> U-Boot> sf probe
> instead of
> U-Boot> sf probe 0x5300
NAK (to this version of the patch): missing README update, and other issues
below
> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
>
> +#ifndef CONFIG_SPI_FLASH_CS
> + if (argc < 2) {
> + printf("%s: missing arguments\n", __func__);
> return -1;
return cmd_usage(cmdtp);
> - if (*endp == ':') {
> - if (endp[1] == 0)
> - return -1;
> + }
> +#else
> + cs = CONFIG_SPI_FLASH_CS ;
> +#endif
you're setting the default CS, not locking it in. so a better config knob name
would be something like:
CONFIG_SF_DEFAULT_CS
this matches the existing CONFIG_SF_XXX defines
also, you have a spurious space before the semicolon there
> U_BOOT_CMD(
> sf, 5, 1, do_spi_flash,
> "SPI flash sub-system",
> +#ifndef CONFIG_SPI_FLASH_CS
> "probe [bus:]cs [hz] [mode] - init flash device on given SPI bus\n"
> +#else
> + "probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus\n"
> +#endif
> " and chip select\n"
> "sf read addr offset len - read `len' bytes starting at\n"
> " `offset' to memory at `addr'\n"
this is ugly. i'd rather just omit it and not worry about the syntax being
perfect.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120124/0eb55ae8/attachment.pgp>
More information about the U-Boot
mailing list