From f75188db381a7b823d43964a47de2ba4e3e02aeb Mon Sep 17 00:00:00 2001 From: Markus Helgesson Date: Wed, 24 Nov 2010 11:27:20 +0100 Subject: SPI: fixed compiler warnings in common/cmd_spi.c Fixed compiler warnings in common/cmd_spi.c. ST-Ericsson ID: 269867 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I78b973ca5e1e5ae5de8058abff897ff2cf545574 Signed-off-by: Markus Helgesson Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/9520 Reviewed-by: Michael BRANDT --- common/cmd_spi.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'common') diff --git a/common/cmd_spi.c b/common/cmd_spi.c index b38dffd7c..4a809ac39 100644 --- a/common/cmd_spi.c +++ b/common/cmd_spi.c @@ -48,19 +48,27 @@ * Values from last command. */ static unsigned int device; -static int bitlen; -static uchar dout[MAX_SPI_BYTES]; -static uchar din[MAX_SPI_BYTES]; +static int bitlen; +static uchar dout[MAX_SPI_BYTES]; +static uchar din[MAX_SPI_BYTES]; +static uchar *din_p = (uchar *) &din; +static unsigned int bus = CONFIG_DEFAULT_SPI_BUS; +static unsigned int mode = CONFIG_DEFAULT_SPI_MODE; +static unsigned int max_hz = 1000000; /* * SPI read/write * * Syntax: - * spi {dev} {num_bits} {dout} + * spi {dev} {num_bits} {dout} {use_din} {din} {bus} {max_hz} * {dev} is the device number for controlling chip select (see TBD) * {num_bits} is the number of bits to send & receive (base 10) * {dout} is a hexadecimal string of data to send - * The command prints out the hexadecimal string received via SPI. + * {use_din} is wether we should ignore the received data or not + * {bus} is which on the SPI controller to use + * {mode} is the mode flag used for initializing the SPI slave + * {max_hz} is the maximum allowed frequenzy + * The command prints the hexadecimal string sent and received via SPI. */ int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -70,10 +78,6 @@ int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) uchar tmp; int j; int rcode = 0; - uchar *din_p = (uchar *) &din; - unsigned int bus; - unsigned int mode; - unsigned int max_hz; /* * We use the last specified parameters, unless new ones are @@ -103,25 +107,18 @@ int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) dout[j / 2] |= tmp; } } - - if (argc >= 5) + if (argc >= 5) { if (0 == simple_strtoul(argv[4], NULL, 10)) din_p = NULL; - + else + din_p = (uchar *) &din; + } if (argc >= 6) bus = simple_strtoul(argv[5], NULL, 10); - else - bus = CONFIG_DEFAULT_SPI_BUS; - if (argc >= 7) mode = simple_strtoul(argv[6], NULL, 10); - else - mode = CONFIG_DEFAULT_SPI_MODE; - if (argc >= 8) max_hz = simple_strtoul(argv[7], NULL, 10); - else - max_hz = 1000000; } if ((bitlen < 0) || (bitlen > (MAX_SPI_BYTES * 8))) { -- cgit v1.2.3