mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] commands: spi: Fix spi read procedure
@ 2013-07-13  5:31 Alexander Shiyan
  2013-07-15  9:05 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2013-07-13  5:31 UTC (permalink / raw)
  To: barebox

Buffer for RX is set incorrectly.

barebox@Phytec phyCORE-i.MX27:/  spi -r 128 -v
device config
    bus_num       = 0
    max_speed_hz  = 1000000
    chip_select   = 0
    mode          = 0x0
    bits_per_word = 8

wrote 0 bytes
00000000:
read 128 bytes
00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
unable to handle paging request at address 0x4dffd3d0
pc : [<a7f05ec4>]    lr : [<a7f05ebc>]
sp : a7fff890  ip : a7fff860  fp : a7f68820
r10: a6ffe9bc  r9 : 00000000  r8 : 00000001
r7 : a6ffe9ec  r6 : a6f00000  r5 : a6ffe9ec  r4 : a6ffe9e4
r3 : a6ffe9e4  r2 : a6ffe9e5  r1 : a6ffe9e4  r0 : 4dffd3cc
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
...

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 commands/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/spi.c b/commands/spi.c
index 2f6b430..79fc539 100644
--- a/commands/spi.c
+++ b/commands/spi.c
@@ -81,7 +81,7 @@ static int do_spi(int argc, char *argv[])
 	}
 
 	tx_buf = xmalloc(count);
-	rx_buf = xmalloc(count);
+	rx_buf = xmalloc(read);
 
 	for (i = 0; i < count; i++)
 		tx_buf[i] = (u8) simple_strtol(argv[optind + i], NULL, 16);
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] commands: spi: Fix spi read procedure
  2013-07-13  5:31 [PATCH] commands: spi: Fix spi read procedure Alexander Shiyan
@ 2013-07-15  9:05 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-07-15  9:05 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Sat, Jul 13, 2013 at 09:31:40AM +0400, Alexander Shiyan wrote:
> Buffer for RX is set incorrectly.
> 
> barebox@Phytec phyCORE-i.MX27:/  spi -r 128 -v
> device config
>     bus_num       = 0
>     max_speed_hz  = 1000000
>     chip_select   = 0
>     mode          = 0x0
>     bits_per_word = 8
> 
> wrote 0 bytes
> 00000000:
> read 128 bytes
> 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> 00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
> unable to handle paging request at address 0x4dffd3d0
> pc : [<a7f05ec4>]    lr : [<a7f05ebc>]
> sp : a7fff890  ip : a7fff860  fp : a7f68820
> r10: a6ffe9bc  r9 : 00000000  r8 : 00000001
> r7 : a6ffe9ec  r6 : a6f00000  r5 : a6ffe9ec  r4 : a6ffe9e4
> r3 : a6ffe9e4  r2 : a6ffe9e5  r1 : a6ffe9e4  r0 : 4dffd3cc
> Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> ...
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-15  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-13  5:31 [PATCH] commands: spi: Fix spi read procedure Alexander Shiyan
2013-07-15  9:05 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox