From 01c429ca1a843997597a32e3e1310dd18dca2b44 Mon Sep 17 00:00:00 2001 From: P L Sai Krishna Date: Fri, 29 May 2015 13:11:34 +0530 Subject: [PATCH] xilisf: Modified the check in flash read APIs for parallel case. This patch modifies the check for whether bank crossover in flash read functions for parallel case. This will fix the bug where wrap around occurs to the top of flash when reading very bottom.. Signed-off-by: P L Sai Krishna --- lib/sw_services/xilisf/src/include/xilisf.h | 2 ++ lib/sw_services/xilisf/src/xilisf_read.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/sw_services/xilisf/src/include/xilisf.h b/lib/sw_services/xilisf/src/include/xilisf.h index 0a6d4e58..4d84ff33 100644 --- a/lib/sw_services/xilisf/src/include/xilisf.h +++ b/lib/sw_services/xilisf/src/include/xilisf.h @@ -494,6 +494,8 @@ * APIs were added to enter and exit from 4 byte mode. Changes were * made in read, erase and write APIs to support 4 byte mode. * These were done to fix CR#858950. +* 5.3 sk 06/01/15 Used Half of Actual byte count for calculating +* Real Byte count in parallel mode. CR# 859979. * * * diff --git a/lib/sw_services/xilisf/src/xilisf_read.c b/lib/sw_services/xilisf/src/xilisf_read.c index ae999aee..a40a7eaf 100644 --- a/lib/sw_services/xilisf/src/xilisf_read.c +++ b/lib/sw_services/xilisf/src/xilisf_read.c @@ -55,6 +55,8 @@ * * 5.2 asa 05/12/15 Added support for Micron (N25Q256A) flash part * which supports 4 byte addressing. +* 5.3 sk 06/01/15 Used Half of Actual byte count for calculating +* Real Byte count in parallel mode. CR# 859979. * * ******************************************************************************/ @@ -367,6 +369,7 @@ static int ReadData(XIsf *InstancePtr, u32 Address, u8 *ReadPtr, u32 ByteCount) u32 TotalByteCnt = ByteCount; u32 LocalByteCnt = ByteCount; u32 LocalAddress = Address; + u32 TempByteCnt = LocalByteCnt; u8 WriteBuffer[10] = {0}; if (LocalByteCnt <= 0 ) { return (int)XST_FAILURE; @@ -408,12 +411,17 @@ static int ReadData(XIsf *InstancePtr, u32 Address, u8 *ReadPtr, u32 ByteCount) XIsf_SetTransferMode(InstancePtr, Mode); } + if(InstancePtr->SpiInstPtr->Config.ConnectionMode == + XQSPIPS_CONNECTION_MODE_PARALLEL) { + TempByteCnt = LocalByteCnt/2; + } + /* * If data to be read spans beyond the current bank, then * calculate RealByteCnt in current bank. Else * RealByteCnt is the same as ByteCount */ - if((RealAddr & BANKMASK) != ((RealAddr+LocalByteCnt) & BANKMASK)) { + if((RealAddr & BANKMASK) != ((RealAddr+TempByteCnt) & BANKMASK)) { RealByteCnt = ((RealAddr & BANKMASK) + SIXTEENMB) - RealAddr; } else { @@ -528,6 +536,7 @@ static int FastReadData(XIsf *InstancePtr, u8 Command, u32 Address, u32 TotalByteCnt = ByteCount; u32 LocalByteCnt = ByteCount; u32 LocalAddress = Address; + u32 TempByteCnt = LocalByteCnt; u8 WriteBuffer[5]= {0}; if (LocalByteCnt <= 0 ) { @@ -573,12 +582,16 @@ static int FastReadData(XIsf *InstancePtr, u8 Command, u32 Address, XIsf_SetTransferMode(InstancePtr, Mode); } + if(InstancePtr->SpiInstPtr->Config.ConnectionMode == + XQSPIPS_CONNECTION_MODE_PARALLEL) { + TempByteCnt = LocalByteCnt/2; + } /* * If data to be read spans beyond the current bank, then * calculate RealByteCnt in current bank. Else * RealByteCnt is the same as ByteCount */ - if((RealAddr & BANKMASK) != ((RealAddr+LocalByteCnt) & BANKMASK)) { + if((RealAddr & BANKMASK) != ((RealAddr+TempByteCnt) & BANKMASK)) { RealByteCnt = ((RealAddr & BANKMASK) + SIXTEENMB) - RealAddr; } else {