Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/spi Fix wrong calculation of destination pointer in ...



details:   https://anonhg.NetBSD.org/src/rev/1248062770c5
branches:  trunk
changeset: 784965:1248062770c5
user:      rkujawa <rkujawa%NetBSD.org@localhost>
date:      Fri Feb 15 17:46:53 2013 +0000

description:
Fix wrong calculation of destination pointer in writes.

Existing calculation of destination pointer was always causing unnecessary erases of SPI Flash memory and was always writing each consecutive 2048 byte blocks of data into the same address of the SPI 
Flash memory. This commit fixes issue with writes of multiple blocks using 'dd' tool.

Patch from Semihalf.
Author: Michal Dubiel <md%semihalf.com@localhost>

diffstat:

 sys/dev/spi/spiflash.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 5f0f056800e7 -r 1248062770c5 sys/dev/spi/spiflash.c
--- a/sys/dev/spi/spiflash.c    Fri Feb 15 17:44:40 2013 +0000
+++ b/sys/dev/spi/spiflash.c    Fri Feb 15 17:46:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spiflash.c,v 1.10 2009/01/13 13:35:54 yamt Exp $ */
+/* $NetBSD: spiflash.c,v 1.11 2013/02/15 17:46:53 rkujawa Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.10 2009/01/13 13:35:54 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.11 2013/02/15 17:46:53 rkujawa Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -436,7 +436,7 @@
                            (unsigned)bp->b_blkno, bp->b_bcount, resid));
 
                data = bp->b_data;
-               dst = save + (bp->b_blkno - blkno) * DEV_BSIZE;
+               dst = save + (bp->b_blkno * DEV_BSIZE) - base;
 
                /*
                 * NOR flash bits.  We can clear a bit, but we cannot



Home | Main Index | Thread Index | Old Index