* [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects
@ 2012-01-30 20:02 Eric Nelson
2012-01-30 20:02 ` [U-Boot] [PATCH 1/2] sf command: allow default bus and chip selects Eric Nelson
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Eric Nelson @ 2012-01-30 20:02 UTC (permalink / raw)
To: u-boot
Patch 1 modifies the 'sf' command to allow a default bus and chip-select
to be specified by board headers. This allows a bare 'sf' probe command:
U-Boot> sf probe
instead of the more cumbersome usage when a GPIO is tacked onto
the chip-select. Otherwise, this command-line would be needed
to specify GP3:19 on SabreLite:
U-Boot> sf probe 0x5300
Patch 2 provides a description of usage and configuration of CONFIG_CMD_SF.
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* [U-Boot] [PATCH 1/2] sf command: allow default bus and chip selects 2012-01-30 20:02 [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Eric Nelson @ 2012-01-30 20:02 ` Eric Nelson 2012-01-31 10:37 ` Matthias Fuchs 2012-01-30 20:02 ` [U-Boot] [PATCH 2/2] README: Add description of SPI Flash (SF) command configuration Eric Nelson 2012-01-31 15:16 ` [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Mike Frysinger 2 siblings, 1 reply; 8+ messages in thread From: Eric Nelson @ 2012-01-30 20:02 UTC (permalink / raw) To: u-boot This patch allows a board configuration file to provide default bus and chip-selects for SPI 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 Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> --- common/cmd_sf.c | 37 +++++++++++++++++++++---------------- 1 files changed, 21 insertions(+), 16 deletions(-) diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 612fd18..98e4162 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -17,6 +17,12 @@ #ifndef CONFIG_SF_DEFAULT_MODE # define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 #endif +#ifndef CONFIG_SF_DEFAULT_CS +# define CONFIG_SF_DEFAULT_CS 0 +#endif +#ifndef CONFIG_SF_DEFAULT_BUS +# define CONFIG_SF_DEFAULT_BUS 0 +#endif static struct spi_flash *flash; @@ -63,27 +69,26 @@ static int sf_parse_len_arg(char *arg, ulong *len) static int do_spi_flash_probe(int argc, char * const argv[]) { - unsigned int bus = 0; - unsigned int cs; + unsigned int bus = CONFIG_SF_DEFAULT_BUS; + unsigned int cs = CONFIG_SF_DEFAULT_CS; unsigned int speed = CONFIG_SF_DEFAULT_SPEED; unsigned int mode = CONFIG_SF_DEFAULT_MODE; char *endp; struct spi_flash *new; - if (argc < 2) - return -1; - - cs = simple_strtoul(argv[1], &endp, 0); - if (*argv[1] == 0 || (*endp != 0 && *endp != ':')) - return -1; - if (*endp == ':') { - if (endp[1] == 0) - return -1; - - bus = cs; - cs = simple_strtoul(endp + 1, &endp, 0); - if (*endp != 0) + if (argc >= 2) { + cs = simple_strtoul(argv[1], &endp, 0); + if (*argv[1] == 0 || (*endp != 0 && *endp != ':')) return -1; + if (*endp == ':') { + if (endp[1] == 0) + return -1; + + bus = cs; + cs = simple_strtoul(endp + 1, &endp, 0); + if (*endp != 0) + return -1; + } } if (argc >= 3) { @@ -299,7 +304,7 @@ usage: U_BOOT_CMD( sf, 5, 1, do_spi_flash, "SPI flash sub-system", - "probe [bus:]cs [hz] [mode] - init flash device on given SPI bus\n" + "probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus\n" " and chip select\n" "sf read addr offset len - read `len' bytes starting at\n" " `offset' to memory at `addr'\n" -- 1.7.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 1/2] sf command: allow default bus and chip selects 2012-01-30 20:02 ` [U-Boot] [PATCH 1/2] sf command: allow default bus and chip selects Eric Nelson @ 2012-01-31 10:37 ` Matthias Fuchs 0 siblings, 0 replies; 8+ messages in thread From: Matthias Fuchs @ 2012-01-31 10:37 UTC (permalink / raw) To: u-boot Works fine. Matthias Tested-by: Matthias Fuchs <matthias.fuchs@esd.eu> On 30.01.2012 21:02, Eric Nelson wrote: > This patch allows a board configuration file to provide default bus > and chip-selects for SPI 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 > Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> > --- > common/cmd_sf.c | 37 +++++++++++++++++++++---------------- > 1 files changed, 21 insertions(+), 16 deletions(-) > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 2/2] README: Add description of SPI Flash (SF) command configuration 2012-01-30 20:02 [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Eric Nelson 2012-01-30 20:02 ` [U-Boot] [PATCH 1/2] sf command: allow default bus and chip selects Eric Nelson @ 2012-01-30 20:02 ` Eric Nelson 2012-01-31 15:16 ` [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Mike Frysinger 2 siblings, 0 replies; 8+ messages in thread From: Eric Nelson @ 2012-01-30 20:02 UTC (permalink / raw) To: u-boot Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> --- README | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/README b/README index 9d713e8..4dbebcb 100644 --- a/README +++ b/README @@ -809,6 +809,7 @@ The following options need to be configured: (requires CONFIG_CMD_I2C) CONFIG_CMD_SETGETDCR Support for DCR Register access (4xx only) + CONFIG_CMD_SF * Read/write/erase SPI NOR flash CONFIG_CMD_SHA1SUM print sha1 memory digest (requires CONFIG_CMD_MEMORY) CONFIG_CMD_SOURCE "source" command Support @@ -2191,6 +2192,25 @@ The following options need to be configured: allows to read/write in Dataflash via the standard commands cp, md... +- Serial Flash support + CONFIG_CMD_SF + + Defining this option enables SPI flash commands + 'sf probe/read/write/erase/update'. + + Usage requires an initial 'probe' to define the serial + flash parameters, followed by read/write/erase/update + commands. + + The following defaults may be provided by the platform + to handle the common case when only a single serial + flash is present on the system. + + CONFIG_SF_DEFAULT_BUS Bus identifier + CONFIG_SF_DEFAULT_CS Chip-select + CONFIG_SF_DEFAULT_MODE (see include/spi.h) + CONFIG_SF_DEFAULT_SPEED in Hz + - SystemACE Support: CONFIG_SYSTEMACE -- 1.7.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects 2012-01-30 20:02 [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Eric Nelson 2012-01-30 20:02 ` [U-Boot] [PATCH 1/2] sf command: allow default bus and chip selects Eric Nelson 2012-01-30 20:02 ` [U-Boot] [PATCH 2/2] README: Add description of SPI Flash (SF) command configuration Eric Nelson @ 2012-01-31 15:16 ` Mike Frysinger 2012-01-31 15:19 ` Eric Nelson 2012-01-31 16:21 ` Dirk Behme 2 siblings, 2 replies; 8+ messages in thread From: Mike Frysinger @ 2012-01-31 15:16 UTC (permalink / raw) To: u-boot On Monday 30 January 2012 15:02:24 Eric Nelson wrote: > Patch 1 modifies the 'sf' command to allow a default bus and chip-select > to be specified by board headers. This allows a bare 'sf' probe command: > U-Boot> sf probe > instead of the more cumbersome usage when a GPIO is tacked onto > the chip-select. Otherwise, this command-line would be needed > to specify GP3:19 on SabreLite: > U-Boot> sf probe 0x5300 > > Patch 2 provides a description of usage and configuration of CONFIG_CMD_SF. thanks, i'll merge both into my sf branch and then push to wolfgang for next merge window (if he doesn't pick things up directly himself) -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/20120131/f5824209/attachment.pgp> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects 2012-01-31 15:16 ` [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Mike Frysinger @ 2012-01-31 15:19 ` Eric Nelson 2012-01-31 16:21 ` Dirk Behme 1 sibling, 0 replies; 8+ messages in thread From: Eric Nelson @ 2012-01-31 15:19 UTC (permalink / raw) To: u-boot On 01/31/2012 08:16 AM, Mike Frysinger wrote: > On Monday 30 January 2012 15:02:24 Eric Nelson wrote: >> Patch 1 modifies the 'sf' command to allow a default bus and chip-select >> to be specified by board headers. This allows a bare 'sf' probe command: >> U-Boot> sf probe >> instead of the more cumbersome usage when a GPIO is tacked onto >> the chip-select. Otherwise, this command-line would be needed >> to specify GP3:19 on SabreLite: >> U-Boot> sf probe 0x5300 >> >> Patch 2 provides a description of usage and configuration of CONFIG_CMD_SF. > > thanks, i'll merge both into my sf branch and then push to wolfgang for next > merge window (if he doesn't pick things up directly himself) > -mike Thanks Mike ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects 2012-01-31 15:16 ` [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Mike Frysinger 2012-01-31 15:19 ` Eric Nelson @ 2012-01-31 16:21 ` Dirk Behme 2012-01-31 18:20 ` Mike Frysinger 1 sibling, 1 reply; 8+ messages in thread From: Dirk Behme @ 2012-01-31 16:21 UTC (permalink / raw) To: u-boot On 31.01.2012 16:16, Mike Frysinger wrote: > On Monday 30 January 2012 15:02:24 Eric Nelson wrote: >> Patch 1 modifies the 'sf' command to allow a default bus and chip-select >> to be specified by board headers. This allows a bare 'sf' probe command: >> U-Boot> sf probe >> instead of the more cumbersome usage when a GPIO is tacked onto >> the chip-select. Otherwise, this command-line would be needed >> to specify GP3:19 on SabreLite: >> U-Boot> sf probe 0x5300 >> >> Patch 2 provides a description of usage and configuration of CONFIG_CMD_SF. > > thanks, i'll merge both into my sf branch and then push to wolfgang for next > merge window (if he doesn't pick things up directly himself) As we had the first version of the initial patch series already at the list while the last merge window was still open, I was hoping for a chance to get this into v2012.03 ;) Anyway, many thanks and best regards Dirk ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects 2012-01-31 16:21 ` Dirk Behme @ 2012-01-31 18:20 ` Mike Frysinger 0 siblings, 0 replies; 8+ messages in thread From: Mike Frysinger @ 2012-01-31 18:20 UTC (permalink / raw) To: u-boot On Tuesday 31 January 2012 11:21:29 Dirk Behme wrote: > On 31.01.2012 16:16, Mike Frysinger wrote: > > On Monday 30 January 2012 15:02:24 Eric Nelson wrote: > >> Patch 1 modifies the 'sf' command to allow a default bus and chip-select > >> > >> to be specified by board headers. This allows a bare 'sf' probe command: > >> U-Boot> sf probe > >> > >> instead of the more cumbersome usage when a GPIO is tacked onto > >> the chip-select. Otherwise, this command-line would be needed > >> > >> to specify GP3:19 on SabreLite: > >> U-Boot> sf probe 0x5300 > >> > >> Patch 2 provides a description of usage and configuration of > >> CONFIG_CMD_SF. > > > > thanks, i'll merge both into my sf branch and then push to wolfgang for > > next merge window (if he doesn't pick things up directly himself) > > As we had the first version of the initial patch series already at the > list while the last merge window was still open, I was hoping for a > chance to get this into v2012.03 ;) i'm fine with pushing them through this merge window. i tend to just try and avoid any back&forths with Wolfgang in case it missed the merge window. less hassle that way. -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/20120131/a11473cd/attachment.pgp> ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-01-31 18:20 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-01-30 20:02 [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Eric Nelson 2012-01-30 20:02 ` [U-Boot] [PATCH 1/2] sf command: allow default bus and chip selects Eric Nelson 2012-01-31 10:37 ` Matthias Fuchs 2012-01-30 20:02 ` [U-Boot] [PATCH 2/2] README: Add description of SPI Flash (SF) command configuration Eric Nelson 2012-01-31 15:16 ` [U-Boot] [PATCH 0/2] SPI flash enhancements: allow default bus and chip-selects Mike Frysinger 2012-01-31 15:19 ` Eric Nelson 2012-01-31 16:21 ` Dirk Behme 2012-01-31 18:20 ` Mike Frysinger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox