All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller
@ 2012-02-24 12:23 Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 01/11] st_smi: Add support for SPEAr SMI driver Amit Virdi
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

In the current u-boot, a driver exists for ST's SMI controller. However, the
driver is SPEAr specific. This patchset makes the driver more generic so that it
can be used across multiple platforms.

In the first commit, the driver is renamed to st_smi. In subsequent patches,
changes are introduced so as to make the driver generic.

Amit Virdi (4):
  st_smi: Remove compilation warning
  st_smi: Return error in case TFF is not set
  st_smi: Change SMI timeout values
  st_smi: Enhance the error handling

Armando Visconti (3):
  st_smi: Removed no needed dependency on ST_M25Pxx_ID
  st_smi: Change the flash probing method
  st_smi: Fix bug in flash_print_info()

Shiraz Hashim (1):
  st_smi: Move status register read before modifying ctrl register

Vipin KUMAR (2):
  st_smi: Add support for SPEAr SMI driver
  st_smi: Read status until timeout happens

Vipin Kumar (1):
  st_smi: Fix smi read status

 drivers/mtd/Makefile                               |    2 +-
 drivers/mtd/{spr_smi.c => st_smi.c}                |  223 ++++++++++++--------
 include/configs/spear-common.h                     |    6 +-
 .../spr_smi.h => include/linux/mtd/st_smi.h        |   10 +-
 4 files changed, 140 insertions(+), 101 deletions(-)
 rename drivers/mtd/{spr_smi.c => st_smi.c} (66%)
 rename arch/arm/include/asm/arch-spear/spr_smi.h => include/linux/mtd/st_smi.h (95%)

-- 
1.7.2.2

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

* [U-Boot] [PATCH 01/11] st_smi: Add support for SPEAr SMI driver
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-04-20  7:47   ` Stefan Roese
  2012-02-24 12:23 ` [U-Boot] [PATCH 02/11] st_smi: Remove compilation warning Amit Virdi
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

From: Vipin KUMAR <vipin.kumar@st.com>

SMI is the serial memory interface controller provided by ST.

Earlier, a driver exists in the u-boot source code for the SMI IP. However, it
was specific to spear platforms. This commit converts the same driver to a more
generic driver. As a result, the driver files are renamed to st_smi.c and
st_smi.h and moved into drivers/mtd folder for reusability by other platforms
using smi controller peripheral.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/Makefile                               |    2 +-
 drivers/mtd/{spr_smi.c => st_smi.c}                |    5 +++--
 include/configs/spear-common.h                     |    6 +++---
 .../spr_smi.h => include/linux/mtd/st_smi.h        |    6 ++++--
 4 files changed, 11 insertions(+), 8 deletions(-)
 rename drivers/mtd/{spr_smi.c => st_smi.c} (99%)
 rename arch/arm/include/asm/arch-spear/spr_smi.h => include/linux/mtd/st_smi.h (98%)

diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 5a5ecdf..543c845 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -35,7 +35,7 @@ COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
 COBJS-$(CONFIG_FTSMC020) += ftsmc020.o
 COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
 COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o
-COBJS-$(CONFIG_SPEARSMI) += spr_smi.o
+COBJS-$(CONFIG_ST_SMI) += st_smi.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/mtd/spr_smi.c b/drivers/mtd/st_smi.c
similarity index 99%
rename from drivers/mtd/spr_smi.c
rename to drivers/mtd/st_smi.c
index 9a70a19..b514046 100644
--- a/drivers/mtd/spr_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -24,10 +24,10 @@
 #include <common.h>
 #include <flash.h>
 #include <linux/err.h>
+#include <linux/mtd/st_smi.h>
 
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/spr_smi.h>
 
 #if !defined(CONFIG_SYS_NO_FLASH)
 
@@ -82,6 +82,7 @@ static unsigned int smi_read_id(flash_info_t *info, int banknum)
 	writel(READ_ID, &smicntl->smi_tr);
 	writel((banknum << BANKSEL_SHIFT) | SEND | TX_LEN_1 | RX_LEN_3,
 	       &smicntl->smi_cr2);
+
 	smi_wait_xfer_finish(XFER_FINISH_TOUT);
 
 	value = (readl(&smicntl->smi_rr) & 0x00FFFFFF);
@@ -232,7 +233,7 @@ static int smi_write_enable(int bank)
  *
  * SMI initialization routine. Sets SMI control register1.
  */
-static void smi_init(void)
+void smi_init(void)
 {
 	/* Setting the fast mode values. SMI working at 166/4 = 41.5 MHz */
 	writel(HOLD1 | FAST_MODE | BANK_EN | DSEL_TIME | PRESCAL4,
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index 3947fd5..5a582e8 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -55,10 +55,10 @@
 #if defined(CONFIG_FLASH_PNOR)
 #define CONFIG_SPEAR_EMI
 #else
-#define CONFIG_SPEARSMI
+#define CONFIG_ST_SMI
 #endif
 
-#if defined(CONFIG_SPEARSMI)
+#if defined(CONFIG_ST_SMI)
 
 #define CONFIG_SYS_MAX_FLASH_BANKS		2
 #define CONFIG_SYS_FLASH_BASE			0xF8000000
@@ -124,7 +124,7 @@
  * U-Boot Environment placing definitions.
  */
 #if defined(CONFIG_ENV_IS_IN_FLASH)
-#ifdef CONFIG_SPEARSMI
+#ifdef CONFIG_ST_SMI
 /*
  * Environment is in serial NOR flash
  */
diff --git a/arch/arm/include/asm/arch-spear/spr_smi.h b/include/linux/mtd/st_smi.h
similarity index 98%
rename from arch/arm/include/asm/arch-spear/spr_smi.h
rename to include/linux/mtd/st_smi.h
index 06df745..b7a78ac 100644
--- a/arch/arm/include/asm/arch-spear/spr_smi.h
+++ b/include/linux/mtd/st_smi.h
@@ -21,8 +21,8 @@
  * MA 02111-1307 USA
  */
 
-#ifndef SPR_SMI_H
-#define SPR_SMI_H
+#ifndef ST_SMI_H
+#define ST_SMI_H
 
 /* 0xF800.0000 . 0xFBFF.FFFF	64MB	SMI (Serial Flash Mem) */
 /* 0xFC00.0000 . 0xFC1F.FFFF	2MB	SMI (Serial Flash Reg.) */
@@ -112,4 +112,6 @@ struct flash_dev {
 #define XFER_FINISH_TOUT	2	/* xfer finish timeout */
 #define WMODE_TOUT		2	/* write enable timeout */
 
+extern void smi_init(void);
+
 #endif
-- 
1.7.2.2

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

* [U-Boot] [PATCH 02/11] st_smi: Remove compilation warning
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 01/11] st_smi: Add support for SPEAr SMI driver Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set Amit Virdi
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index b514046..82f1fe1 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -323,24 +323,19 @@ static int smi_write(unsigned int *src_addr, unsigned int *dst_addr,
 		     unsigned int length, ulong bank_addr)
 {
 	int banknum;
-	unsigned int WM;
 
 	switch (bank_addr) {
 	case SMIBANK0_BASE:
 		banknum = BANK0;
-		WM = WM0;
 		break;
 	case SMIBANK1_BASE:
 		banknum = BANK1;
-		WM = WM1;
 		break;
 	case SMIBANK2_BASE:
 		banknum = BANK2;
-		WM = WM2;
 		break;
 	case SMIBANK3_BASE:
 		banknum = BANK3;
-		WM = WM3;
 		break;
 	default:
 		return -1;
-- 
1.7.2.2

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

* [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 01/11] st_smi: Add support for SPEAr SMI driver Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 02/11] st_smi: Remove compilation warning Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-27 10:26   ` Stefan Roese
  2012-02-24 12:23 ` [U-Boot] [PATCH 04/11] st_smi: Change SMI timeout values Amit Virdi
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

Curently the code makes wrong assumption that the Transfer finished flag shall
be set within the stipulated time. However, there may occur a scenario in which
the TFF flag is not set. Return error in that case.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 82f1fe1..ec19b0d 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -58,13 +58,15 @@ static struct flash_dev flash_ids[] = {
  *
  * Wait until TFF is set in status register
  */
-static void smi_wait_xfer_finish(int timeout)
+static int smi_wait_xfer_finish(int timeout)
 {
-	while (timeout--) {
+	do {
 		if (readl(&smicntl->smi_sr) & TFF)
-			break;
+			return 0;
 		udelay(1000);
-	}
+	} while (timeout--);
+
+	return -1;
 }
 
 /*
@@ -83,7 +85,8 @@ static unsigned int smi_read_id(flash_info_t *info, int banknum)
 	writel((banknum << BANKSEL_SHIFT) | SEND | TX_LEN_1 | RX_LEN_3,
 	       &smicntl->smi_cr2);
 
-	smi_wait_xfer_finish(XFER_FINISH_TOUT);
+	if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
+		return -EIO;
 
 	value = (readl(&smicntl->smi_rr) & 0x00FFFFFF);
 
@@ -151,7 +154,8 @@ static unsigned int smi_read_sr(int bank)
 	/* Performing a RSR instruction in HW mode */
 	writel((bank << BANKSEL_SHIFT) | RD_STATUS_REG, &smicntl->smi_cr2);
 
-	smi_wait_xfer_finish(XFER_FINISH_TOUT);
+	if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
+		return -1;
 
 	/* Restore the CTRL REG1 state */
 	writel(ctrlreg1, &smicntl->smi_cr1);
@@ -211,7 +215,8 @@ static int smi_write_enable(int bank)
 	/* Give the Flash, Write Enable command */
 	writel((bank << BANKSEL_SHIFT) | WE, &smicntl->smi_cr2);
 
-	smi_wait_xfer_finish(XFER_FINISH_TOUT);
+	if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
+		return -1;
 
 	/* Restore the CTRL REG1 state */
 	writel(ctrlreg1, &smicntl->smi_cr1);
@@ -292,7 +297,8 @@ static int smi_sector_erase(flash_info_t *info, unsigned int sector)
 		writel(instruction, &smicntl->smi_tr);
 		writel((bank << BANKSEL_SHIFT) | SEND | TX_LEN_4,
 		       &smicntl->smi_cr2);
-		smi_wait_xfer_finish(XFER_FINISH_TOUT);
+		if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
+			return -EIO;
 
 		if (smi_wait_till_ready(bank, CONFIG_SYS_FLASH_ERASE_TOUT))
 			return -EBUSY;
-- 
1.7.2.2

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

* [U-Boot] [PATCH 04/11] st_smi: Change SMI timeout values
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (2 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 05/11] st_smi: Enhance the error handling Amit Virdi
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 include/linux/mtd/st_smi.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mtd/st_smi.h b/include/linux/mtd/st_smi.h
index b7a78ac..04f81ea 100644
--- a/include/linux/mtd/st_smi.h
+++ b/include/linux/mtd/st_smi.h
@@ -109,8 +109,8 @@ struct flash_dev {
 };
 
 #define SFLASH_PAGE_SIZE	0x100	/* flash page size */
-#define XFER_FINISH_TOUT	2	/* xfer finish timeout */
-#define WMODE_TOUT		2	/* write enable timeout */
+#define XFER_FINISH_TOUT	15	/* xfer finish timeout(in ms) */
+#define WMODE_TOUT		15	/* write enable timeout(in ms) */
 
 extern void smi_init(void);
 
-- 
1.7.2.2

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

* [U-Boot] [PATCH 05/11] st_smi: Enhance the error handling
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (3 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 04/11] st_smi: Change SMI timeout values Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 06/11] st_smi: Read status until timeout happens Amit Virdi
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

This commit does the following:
 - Reports error if SNOR flash is not found on the board
 - Changes smi_read_sr to return error using which a retry mechanism is
   implemented for reading flash status

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |   34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index ec19b0d..ce50fc1 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -108,11 +108,17 @@ static ulong flash_get_size(ulong base, int banknum)
 {
 	flash_info_t *info = &flash_info[banknum];
 	struct flash_dev *dev;
-	unsigned int value;
+	int value;
 	unsigned int density;
 	int i;
 
 	value = smi_read_id(info, banknum);
+
+	if (value < 0) {
+		printf("Flash id could not be read\n");
+		return 0;
+	}
+
 	density = (value >> 16) & 0xff;
 
 	for (i = 0, dev = &flash_ids[0]; dev->density != 0x0;
@@ -140,7 +146,7 @@ static ulong flash_get_size(ulong base, int banknum)
  * This routine will get the status register of the flash chip present at the
  * given bank
  */
-static unsigned int smi_read_sr(int bank)
+static int smi_read_sr(int bank)
 {
 	u32 ctrlreg1;
 
@@ -174,13 +180,11 @@ static unsigned int smi_read_sr(int bank)
  */
 static int smi_wait_till_ready(int bank, int timeout)
 {
-	int count;
-	unsigned int sr;
+	int sr;
 
 	/* One chip guarantees max 5 msec wait here after page writes,
 	   but potentially three seconds (!) after page erase. */
-	for (count = 0; count < timeout; count++) {
-
+	do {
 		sr = smi_read_sr(bank);
 		if (sr < 0)
 			break;
@@ -189,7 +193,8 @@ static int smi_wait_till_ready(int bank, int timeout)
 
 		/* Try again after 1m-sec */
 		udelay(1000);
-	}
+	} while (timeout--);
+
 	printf("SMI controller is still in wait, timeout=%d\n", timeout);
 	return -EIO;
 }
@@ -205,6 +210,7 @@ static int smi_write_enable(int bank)
 {
 	u32 ctrlreg1;
 	int timeout = WMODE_TOUT;
+	int sr;
 
 	/* Store the CTRL REG1 state */
 	ctrlreg1 = readl(&smicntl->smi_cr1);
@@ -221,14 +227,16 @@ static int smi_write_enable(int bank)
 	/* Restore the CTRL REG1 state */
 	writel(ctrlreg1, &smicntl->smi_cr1);
 
-	while (timeout--) {
-		if (smi_read_sr(bank) & (1 << (bank + WM_SHIFT)))
+	do {
+		sr = smi_read_sr(bank);
+		if (sr < 0)
 			break;
-		udelay(1000);
-	}
+		else if (sr & (1 << (bank + WM_SHIFT)))
+			return 0;
 
-	if (timeout)
-		return 0;
+		/* Try again after 1m-sec */
+		udelay(1000);
+	} while (timeout--);
 
 	return -1;
 }
-- 
1.7.2.2

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

* [U-Boot] [PATCH 06/11] st_smi: Read status until timeout happens
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (4 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 05/11] st_smi: Enhance the error handling Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 07/11] st_smi: Move status register read before modifying ctrl register Amit Virdi
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

From: Vipin KUMAR <vipin.kumar@st.com>

SMI driver read status fails because the control register could not be
overwritten. Instead, the read status should be tried until timeout.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index ce50fc1..7b4c6f3 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -187,7 +187,7 @@ static int smi_wait_till_ready(int bank, int timeout)
 	do {
 		sr = smi_read_sr(bank);
 		if (sr < 0)
-			break;
+			continue;	/* try until timeout */
 		else if (!(sr & WIP_BIT))
 			return 0;
 
-- 
1.7.2.2

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

* [U-Boot] [PATCH 07/11] st_smi: Move status register read before modifying ctrl register
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (5 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 06/11] st_smi: Read status until timeout happens Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 08/11] st_smi: Fix smi read status Amit Virdi
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

From: Shiraz Hashim <shiraz.hashim@st.com>

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 7b4c6f3..eb902b2 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -148,7 +148,7 @@ static ulong flash_get_size(ulong base, int banknum)
  */
 static int smi_read_sr(int bank)
 {
-	u32 ctrlreg1;
+	u32 ctrlreg1, val;
 
 	/* store the CTRL REG1 state */
 	ctrlreg1 = readl(&smicntl->smi_cr1);
@@ -163,10 +163,12 @@ static int smi_read_sr(int bank)
 	if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
 		return -1;
 
+	val = readl(&smicntl->smi_sr);
+
 	/* Restore the CTRL REG1 state */
 	writel(ctrlreg1, &smicntl->smi_cr1);
 
-	return readl(&smicntl->smi_sr);
+	return val;
 }
 
 /*
-- 
1.7.2.2

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

* [U-Boot] [PATCH 08/11] st_smi: Fix smi read status
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (6 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 07/11] st_smi: Move status register read before modifying ctrl register Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 09/11] st_smi: Removed no needed dependency on ST_M25Pxx_ID Amit Virdi
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

From: Vipin Kumar <vipin.kumar@st.com>

smi_read_sr fails sometimes because of TFF not getting set within assumed time.
This condition may arise because of, for example, smi memory being in a erase
mode.

This fix is to enable reading the status register until timeout.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index eb902b2..e5c803b 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -188,9 +188,7 @@ static int smi_wait_till_ready(int bank, int timeout)
 	   but potentially three seconds (!) after page erase. */
 	do {
 		sr = smi_read_sr(bank);
-		if (sr < 0)
-			continue;	/* try until timeout */
-		else if (!(sr & WIP_BIT))
+		if ((sr >= 0) && (!(sr & WIP_BIT)))
 			return 0;
 
 		/* Try again after 1m-sec */
@@ -231,9 +229,7 @@ static int smi_write_enable(int bank)
 
 	do {
 		sr = smi_read_sr(bank);
-		if (sr < 0)
-			break;
-		else if (sr & (1 << (bank + WM_SHIFT)))
+		if ((sr >= 0) && (sr & (1 << (bank + WM_SHIFT))))
 			return 0;
 
 		/* Try again after 1m-sec */
-- 
1.7.2.2

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

* [U-Boot] [PATCH 09/11] st_smi: Removed no needed dependency on ST_M25Pxx_ID
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (7 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 08/11] st_smi: Fix smi read status Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 10/11] st_smi: Change the flash probing method Amit Virdi
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

From: Armando Visconti <armando.visconti@st.com>

Since the smi erase code is very generic and works for any kind
of flash, there is no need to test for ST_M25Pxx_ID flash types
like m25p40 flashes).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |   50 ++++++++++++++++++--------------------------------
 1 files changed, 18 insertions(+), 32 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index e5c803b..43eb2ab 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -37,8 +37,6 @@ static ulong bank_base[CONFIG_SYS_MAX_FLASH_BANKS] =
     CONFIG_SYS_FLASH_ADDR_BASE;
 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
 
-#define ST_M25Pxx_ID		0x00002020
-
 static struct flash_dev flash_ids[] = {
 	{0x10, 0x10000, 2},	/* 64K Byte */
 	{0x11, 0x20000, 4},	/* 128K Byte */
@@ -287,39 +285,32 @@ static int smi_sector_erase(flash_info_t *info, unsigned int sector)
 
 	writel(readl(&smicntl->smi_sr) & ~(ERF1 | ERF2), &smicntl->smi_sr);
 
-	if (info->flash_id == ST_M25Pxx_ID) {
-		/* Wait until finished previous write command. */
-		if (smi_wait_till_ready(bank, CONFIG_SYS_FLASH_ERASE_TOUT))
-			return -EBUSY;
+	/* Wait until finished previous write command. */
+	if (smi_wait_till_ready(bank, CONFIG_SYS_FLASH_ERASE_TOUT))
+		return -EBUSY;
 
-		/* Send write enable, before erase commands. */
-		if (smi_write_enable(bank))
-			return -EIO;
+	/* Send write enable, before erase commands. */
+	if (smi_write_enable(bank))
+		return -EIO;
 
-		/* Put SMI in SW mode */
-		writel(readl(&smicntl->smi_cr1) | SW_MODE, &smicntl->smi_cr1);
+	/* Put SMI in SW mode */
+	writel(readl(&smicntl->smi_cr1) | SW_MODE, &smicntl->smi_cr1);
 
-		/* Send Sector Erase command in SW Mode */
-		writel(instruction, &smicntl->smi_tr);
-		writel((bank << BANKSEL_SHIFT) | SEND | TX_LEN_4,
+	/* Send Sector Erase command in SW Mode */
+	writel(instruction, &smicntl->smi_tr);
+	writel((bank << BANKSEL_SHIFT) | SEND | TX_LEN_4,
 		       &smicntl->smi_cr2);
-		if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
-			return -EIO;
+	if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
+		return -EIO;
 
-		if (smi_wait_till_ready(bank, CONFIG_SYS_FLASH_ERASE_TOUT))
-			return -EBUSY;
+	if (smi_wait_till_ready(bank, CONFIG_SYS_FLASH_ERASE_TOUT))
+		return -EBUSY;
 
-		/* Put SMI in HW mode */
-		writel(readl(&smicntl->smi_cr1) & ~SW_MODE,
+	/* Put SMI in HW mode */
+	writel(readl(&smicntl->smi_cr1) & ~SW_MODE,
 		       &smicntl->smi_cr1);
 
-		return 0;
-	} else {
-		/* Put SMI in HW mode */
-		writel(readl(&smicntl->smi_cr1) & ~SW_MODE,
-		       &smicntl->smi_cr1);
-		return -EINVAL;
-	}
+	return 0;
 }
 
 /*
@@ -496,11 +487,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 	int prot = 0;
 	flash_sect_t sect;
 
-	if (info->flash_id != ST_M25Pxx_ID) {
-		puts("Can't erase unknown flash type - aborted\n");
-		return 1;
-	}
-
 	if ((s_first < 0) || (s_first > s_last)) {
 		puts("- no sectors to erase\n");
 		return 1;
-- 
1.7.2.2

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

* [U-Boot] [PATCH 10/11] st_smi: Change the flash probing method
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (8 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 09/11] st_smi: Removed no needed dependency on ST_M25Pxx_ID Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-02-24 12:23 ` [U-Boot] [PATCH 11/11] st_smi: Fix bug in flash_print_info() Amit Virdi
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

From: Armando Visconti <armando.visconti@st.com>

THis patch introduces a new methodology for flash probing
in which flash_devices[] table, looked-up thru the dev_id, is
used to locate the flash geometry and information.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |   92 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 65 insertions(+), 27 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 43eb2ab..a308399 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -37,17 +37,61 @@ static ulong bank_base[CONFIG_SYS_MAX_FLASH_BANKS] =
     CONFIG_SYS_FLASH_ADDR_BASE;
 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
 
-static struct flash_dev flash_ids[] = {
-	{0x10, 0x10000, 2},	/* 64K Byte */
-	{0x11, 0x20000, 4},	/* 128K Byte */
-	{0x12, 0x40000, 4},	/* 256K Byte */
-	{0x13, 0x80000, 8},	/* 512K Byte */
-	{0x14, 0x100000, 16},	/* 1M Byte */
-	{0x15, 0x200000, 32},	/* 2M Byte */
-	{0x16, 0x400000, 64},	/* 4M Byte */
-	{0x17, 0x800000, 128},	/* 8M Byte */
-	{0x18, 0x1000000, 64},	/* 16M Byte */
-	{0x00,}
+/* data structure to maintain flash ids from different vendors */
+struct flash_device {
+	char *name;
+	u8 erase_cmd;
+	u32 device_id;
+	u32 pagesize;
+	unsigned long sectorsize;
+	unsigned long size_in_bytes;
+};
+
+#define FLASH_ID(n, es, id, psize, ssize, size)	\
+{				\
+	.name = n,		\
+	.erase_cmd = es,	\
+	.device_id = id,	\
+	.pagesize = psize,	\
+	.sectorsize = ssize,	\
+	.size_in_bytes = size	\
+}
+
+/*
+ * List of supported flash devices.
+ * Currently the erase_cmd field is not used in this driver.
+ */
+static struct flash_device flash_devices[] = {
+	FLASH_ID("st m25p16"     , 0xd8, 0x00152020, 0x100, 0x10000, 0x200000),
+	FLASH_ID("st m25p32"     , 0xd8, 0x00162020, 0x100, 0x10000, 0x400000),
+	FLASH_ID("st m25p64"     , 0xd8, 0x00172020, 0x100, 0x10000, 0x800000),
+	FLASH_ID("st m25p128"    , 0xd8, 0x00182020, 0x100, 0x40000, 0x1000000),
+	FLASH_ID("st m25p05"     , 0xd8, 0x00102020, 0x80 , 0x8000 , 0x10000),
+	FLASH_ID("st m25p10"     , 0xd8, 0x00112020, 0x80 , 0x8000 , 0x20000),
+	FLASH_ID("st m25p20"     , 0xd8, 0x00122020, 0x100, 0x10000, 0x40000),
+	FLASH_ID("st m25p40"     , 0xd8, 0x00132020, 0x100, 0x10000, 0x80000),
+	FLASH_ID("st m25p80"     , 0xd8, 0x00142020, 0x100, 0x10000, 0x100000),
+	FLASH_ID("st m45pe10"    , 0xd8, 0x00114020, 0x100, 0x10000, 0x20000),
+	FLASH_ID("st m45pe20"    , 0xd8, 0x00124020, 0x100, 0x10000, 0x40000),
+	FLASH_ID("st m45pe40"    , 0xd8, 0x00134020, 0x100, 0x10000, 0x80000),
+	FLASH_ID("st m45pe80"    , 0xd8, 0x00144020, 0x100, 0x10000, 0x100000),
+	FLASH_ID("sp s25fl004"   , 0xd8, 0x00120201, 0x100, 0x10000, 0x80000),
+	FLASH_ID("sp s25fl008"   , 0xd8, 0x00130201, 0x100, 0x10000, 0x100000),
+	FLASH_ID("sp s25fl016"   , 0xd8, 0x00140201, 0x100, 0x10000, 0x200000),
+	FLASH_ID("sp s25fl032"   , 0xd8, 0x00150201, 0x100, 0x10000, 0x400000),
+	FLASH_ID("sp s25fl064"   , 0xd8, 0x00160201, 0x100, 0x10000, 0x800000),
+	FLASH_ID("mac 25l512"    , 0xd8, 0x001020C2, 0x010, 0x10000, 0x10000),
+	FLASH_ID("mac 25l1005"   , 0xd8, 0x001120C2, 0x010, 0x10000, 0x20000),
+	FLASH_ID("mac 25l2005"   , 0xd8, 0x001220C2, 0x010, 0x10000, 0x40000),
+	FLASH_ID("mac 25l4005"   , 0xd8, 0x001320C2, 0x010, 0x10000, 0x80000),
+	FLASH_ID("mac 25l4005a"  , 0xd8, 0x001320C2, 0x010, 0x10000, 0x80000),
+	FLASH_ID("mac 25l8005"   , 0xd8, 0x001420C2, 0x010, 0x10000, 0x100000),
+	FLASH_ID("mac 25l1605"   , 0xd8, 0x001520C2, 0x100, 0x10000, 0x200000),
+	FLASH_ID("mac 25l1605a"  , 0xd8, 0x001520C2, 0x010, 0x10000, 0x200000),
+	FLASH_ID("mac 25l3205"   , 0xd8, 0x001620C2, 0x100, 0x10000, 0x400000),
+	FLASH_ID("mac 25l3205a"  , 0xd8, 0x001620C2, 0x100, 0x10000, 0x400000),
+	FLASH_ID("mac 25l6405"   , 0xd8, 0x001720C2, 0x100, 0x10000, 0x800000),
+	FLASH_ID("wbd w25q128" , 0xd8, 0x001840EF, 0x1000, 0x10000, 0x1000000),
 };
 
 /*
@@ -105,9 +149,7 @@ static unsigned int smi_read_id(flash_info_t *info, int banknum)
 static ulong flash_get_size(ulong base, int banknum)
 {
 	flash_info_t *info = &flash_info[banknum];
-	struct flash_dev *dev;
 	int value;
-	unsigned int density;
 	int i;
 
 	value = smi_read_id(info, banknum);
@@ -117,24 +159,20 @@ static ulong flash_get_size(ulong base, int banknum)
 		return 0;
 	}
 
-	density = (value >> 16) & 0xff;
+	/* Matches chip-id to entire list of 'serial-nor flash' ids */
+	for (i = 0; i < ARRAY_SIZE(flash_devices); i++) {
+		if (flash_devices[i].device_id == value) {
+			info->size = flash_devices[i].size_in_bytes;
+			info->flash_id = value;
+			info->start[0] = base;
+			info->sector_count =
+					info->size/flash_devices[i].sectorsize;
 
-	for (i = 0, dev = &flash_ids[0]; dev->density != 0x0;
-	     i++, dev = &flash_ids[i]) {
-		if (dev->density == density) {
-			info->size = dev->size;
-			info->sector_count = dev->sector_count;
-			break;
+			return info->size;
 		}
 	}
 
-	if (dev->density == 0x0)
-		return 0;
-
-	info->flash_id = value & 0xffff;
-	info->start[0] = base;
-
-	return info->size;
+	return 0;
 }
 
 /*
-- 
1.7.2.2

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

* [U-Boot] [PATCH 11/11] st_smi: Fix bug in flash_print_info()
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (9 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 10/11] st_smi: Change the flash probing method Amit Virdi
@ 2012-02-24 12:23 ` Amit Virdi
  2012-03-07 10:02 ` [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
  2012-03-30  6:12 ` [U-Boot] [PATCH] st_smi: Fixed page size for Winbond W25Q128FV flash Amit Virdi
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-02-24 12:23 UTC (permalink / raw)
  To: u-boot

From: Armando Visconti <armando.visconti@st.com>

If the flash size was smaller than 1MB then flash_print_info()
was erroneously reporting 0 MB.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index a308399..6d4edba 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -471,8 +471,13 @@ void flash_print_info(flash_info_t *info)
 		puts("missing or unknown FLASH type\n");
 		return;
 	}
-	printf("  Size: %ld MB in %d Sectors\n",
-	       info->size >> 20, info->sector_count);
+
+	if (info->size >= 0x100000)
+		printf("  Size: %ld MB in %d Sectors\n",
+		       info->size >> 20, info->sector_count);
+	else
+		printf("  Size: %ld KB in %d Sectors\n",
+		       info->size >> 10, info->sector_count);
 
 	puts("  Sector Start Addresses:");
 	for (i = 0; i < info->sector_count; ++i) {
-- 
1.7.2.2

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

* [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set
  2012-02-24 12:23 ` [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set Amit Virdi
@ 2012-02-27 10:26   ` Stefan Roese
  2012-02-29  9:10     ` Amit Virdi
  0 siblings, 1 reply; 21+ messages in thread
From: Stefan Roese @ 2012-02-27 10:26 UTC (permalink / raw)
  To: u-boot

On Friday 24 February 2012 13:23:06 Amit Virdi wrote:
> Curently the code makes wrong assumption that the Transfer finished flag
> shall be set within the stipulated time. However, there may occur a
> scenario in which the TFF flag is not set. Return error in that case.
> 
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> Signed-off-by: Amit Virdi <amit.virdi@st.com>
> ---
>  drivers/mtd/st_smi.c |   22 ++++++++++++++--------
>  1 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
> index 82f1fe1..ec19b0d 100644
> --- a/drivers/mtd/st_smi.c
> +++ b/drivers/mtd/st_smi.c
> @@ -58,13 +58,15 @@ static struct flash_dev flash_ids[] = {
>   *
>   * Wait until TFF is set in status register
>   */
> -static void smi_wait_xfer_finish(int timeout)
> +static int smi_wait_xfer_finish(int timeout)
>  {
> -	while (timeout--) {
> +	do {
>  		if (readl(&smicntl->smi_sr) & TFF)
> -			break;
> +			return 0;
>  		udelay(1000);
> -	}
> +	} while (timeout--);
> +
> +	return -1;

Somewhat unrelated to the patch topic, but I don't really like this kind of 
timeout loops. Since it always adds at least 1ms delay after initial failing 
test. Better use something like this:

static int smi_wait_xfer_finish(int timeout)
{
	ulong start = get_timer(0);

	while (get_timer(start) < timeout) {
		if (readl(&smicntl->smi_sr) & TFF)
			return 0;

		/* Try again after 100usec */
		udelay(100);
	}

	return -1;
}

You could tune this udelay(100) down more or even remove it completely.

But such a change could be done in a addon cleanup patch, changing all timeout 
loops this way. I suggest you take a look at my version, here these loops are 
changes. In the designware networking driver as well, iirc.

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set
  2012-02-27 10:26   ` Stefan Roese
@ 2012-02-29  9:10     ` Amit Virdi
  2012-03-02 13:32       ` Stefan Roese
  0 siblings, 1 reply; 21+ messages in thread
From: Amit Virdi @ 2012-02-29  9:10 UTC (permalink / raw)
  To: u-boot

Hello Stefan,

On 2/27/2012 3:56 PM, Stefan Roese wrote:
> On Friday 24 February 2012 13:23:06 Amit Virdi wrote:
>> Curently the code makes wrong assumption that the Transfer finished flag
>> shall be set within the stipulated time. However, there may occur a
>> scenario in which the TFF flag is not set. Return error in that case.
>>
>> Signed-off-by: Vipin Kumar<vipin.kumar@st.com>
>> Signed-off-by: Amit Virdi<amit.virdi@st.com>
>> ---
>>   drivers/mtd/st_smi.c |   22 ++++++++++++++--------
>>   1 files changed, 14 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
>> index 82f1fe1..ec19b0d 100644
>> --- a/drivers/mtd/st_smi.c
>> +++ b/drivers/mtd/st_smi.c
>> @@ -58,13 +58,15 @@ static struct flash_dev flash_ids[] = {
>>    *
>>    * Wait until TFF is set in status register
>>    */
>> -static void smi_wait_xfer_finish(int timeout)
>> +static int smi_wait_xfer_finish(int timeout)
>>   {
>> -	while (timeout--) {
>> +	do {
>>   		if (readl(&smicntl->smi_sr)&  TFF)
>> -			break;
>> +			return 0;
>>   		udelay(1000);
>> -	}
>> +	} while (timeout--);
>> +
>> +	return -1;
>
> Somewhat unrelated to the patch topic, but I don't really like this kind of
> timeout loops. Since it always adds at least 1ms delay after initial failing
> test. Better use something like this:
>
> static int smi_wait_xfer_finish(int timeout)
> {
> 	ulong start = get_timer(0);
>
> 	while (get_timer(start)<  timeout) {
> 		if (readl(&smicntl->smi_sr)&  TFF)
> 			return 0;
>
> 		/* Try again after 100usec */
> 		udelay(100);
> 	}
>
> 	return -1;
> }
>
> You could tune this udelay(100) down more or even remove it completely.
>
> But such a change could be done in a addon cleanup patch, changing all timeout
> loops this way. I suggest you take a look at my version, here these loops are
> changes. In the designware networking driver as well, iirc.
>

Thanks for pointing out. In a separate cleanup patch, I shall be 
changing all the timeout loops for smi driver. I'll check other ST 
drivers too and change the timer implementation there too.

Regards
Amit Virdi

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

* [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set
  2012-02-29  9:10     ` Amit Virdi
@ 2012-03-02 13:32       ` Stefan Roese
  0 siblings, 0 replies; 21+ messages in thread
From: Stefan Roese @ 2012-03-02 13:32 UTC (permalink / raw)
  To: u-boot

Hi Amit,

On Wednesday 29 February 2012 10:10:20 Amit Virdi wrote:
> > You could tune this udelay(100) down more or even remove it completely.
> > 
> > But such a change could be done in a addon cleanup patch, changing all
> > timeout loops this way. I suggest you take a look at my version, here
> > these loops are changes. In the designware networking driver as well,
> > iirc.
> 
> Thanks for pointing out. In a separate cleanup patch, I shall be
> changing all the timeout loops for smi driver. I'll check other ST
> drivers too and change the timer implementation there too.

Good.

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (10 preceding siblings ...)
  2012-02-24 12:23 ` [U-Boot] [PATCH 11/11] st_smi: Fix bug in flash_print_info() Amit Virdi
@ 2012-03-07 10:02 ` Amit Virdi
  2012-03-07 11:27   ` Stefan Roese
  2012-03-30  6:12 ` [U-Boot] [PATCH] st_smi: Fixed page size for Winbond W25Q128FV flash Amit Virdi
  12 siblings, 1 reply; 21+ messages in thread
From: Amit Virdi @ 2012-03-07 10:02 UTC (permalink / raw)
  To: u-boot

Hello Stefan,

On 2/24/2012 5:53 PM, Amit VIRDI wrote:
> In the current u-boot, a driver exists for ST's SMI controller. However, the
> driver is SPEAr specific. This patchset makes the driver more generic so that it
> can be used across multiple platforms.
>
> In the first commit, the driver is renamed to st_smi. In subsequent patches,
> changes are introduced so as to make the driver generic.
>
> Amit Virdi (4):
>    st_smi: Remove compilation warning
>    st_smi: Return error in case TFF is not set
>    st_smi: Change SMI timeout values
>    st_smi: Enhance the error handling
>
> Armando Visconti (3):
>    st_smi: Removed no needed dependency on ST_M25Pxx_ID
>    st_smi: Change the flash probing method
>    st_smi: Fix bug in flash_print_info()
>
> Shiraz Hashim (1):
>    st_smi: Move status register read before modifying ctrl register
>
> Vipin KUMAR (2):
>    st_smi: Add support for SPEAr SMI driver
>    st_smi: Read status until timeout happens
>
> Vipin Kumar (1):
>    st_smi: Fix smi read status
>
>   drivers/mtd/Makefile                               |    2 +-
>   drivers/mtd/{spr_smi.c =>  st_smi.c}                |  223 ++++++++++++--------
>   include/configs/spear-common.h                     |    6 +-
>   .../spr_smi.h =>  include/linux/mtd/st_smi.h        |   10 +-
>   4 files changed, 140 insertions(+), 101 deletions(-)
>   rename drivers/mtd/{spr_smi.c =>  st_smi.c} (66%)
>   rename arch/arm/include/asm/arch-spear/spr_smi.h =>  include/linux/mtd/st_smi.h (95%)
>

I'm not sure about the status of this patchset. Can you please tell me 
who's the custodian for SNOR flash devices?

Thanks
Amit Virdi

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

* [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller
  2012-03-07 10:02 ` [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
@ 2012-03-07 11:27   ` Stefan Roese
  2012-03-07 11:46     ` Amit Virdi
  0 siblings, 1 reply; 21+ messages in thread
From: Stefan Roese @ 2012-03-07 11:27 UTC (permalink / raw)
  To: u-boot

Hi Amit,

On Wednesday 07 March 2012 11:02:04 Amit Virdi wrote:
> > In the current u-boot, a driver exists for ST's SMI controller. However,
> > the driver is SPEAr specific. This patchset makes the driver more
> > generic so that it can be used across multiple platforms.
> > 
> > In the first commit, the driver is renamed to st_smi. In subsequent
> > patches, changes are introduced so as to make the driver generic.
> > 
> > Amit Virdi (4):
> >    st_smi: Remove compilation warning
> >    st_smi: Return error in case TFF is not set
> >    st_smi: Change SMI timeout values
> >    st_smi: Enhance the error handling
> > 
> > Armando Visconti (3):
> >    st_smi: Removed no needed dependency on ST_M25Pxx_ID
> >    st_smi: Change the flash probing method
> >    st_smi: Fix bug in flash_print_info()
> > 
> > Shiraz Hashim (1):
> >    st_smi: Move status register read before modifying ctrl register
> > 
> > Vipin KUMAR (2):
> >    st_smi: Add support for SPEAr SMI driver
> >    st_smi: Read status until timeout happens
> > 
> > Vipin Kumar (1):
> >    st_smi: Fix smi read status
> >   
> >   drivers/mtd/Makefile                               |    2 +-
> >   drivers/mtd/{spr_smi.c =>  st_smi.c}                |  223
> >   ++++++++++++-------- include/configs/spear-common.h                   
> >    |    6 +-
> >   .../spr_smi.h =>  include/linux/mtd/st_smi.h        |   10 +-
> >   4 files changed, 140 insertions(+), 101 deletions(-)
> >   rename drivers/mtd/{spr_smi.c =>  st_smi.c} (66%)
> >   rename arch/arm/include/asm/arch-spear/spr_smi.h => 
> >   include/linux/mtd/st_smi.h (95%)
> 
> I'm not sure about the status of this patchset. Can you please tell me
> who's the custodian for SNOR flash devices?

Usually I handle those kind of patches, as I'm the CFI flash custodian. I have 
assigned those patches to me. Since its not really bug fixes, I'll add them to 
the next branch, once it opens. So they will get pushed after the upcoming 
release.

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller
  2012-03-07 11:27   ` Stefan Roese
@ 2012-03-07 11:46     ` Amit Virdi
  2012-03-07 11:49       ` Stefan Roese
  0 siblings, 1 reply; 21+ messages in thread
From: Amit Virdi @ 2012-03-07 11:46 UTC (permalink / raw)
  To: u-boot

Dear Stefan,

>>
>> I'm not sure about the status of this patchset. Can you please tell me
>> who's the custodian for SNOR flash devices?
>
> Usually I handle those kind of patches, as I'm the CFI flash custodian. I have
> assigned those patches to me. Since its not really bug fixes, I'll add them to
> the next branch, once it opens. So they will get pushed after the upcoming
> release.
>

Thanks for the information. I have added another patch as a cleanup for 
the timeout loops. Will you prefer V2 for this patchset with that commit 
added or you're fine with that as a separate commit?

Thanks
Amit Virdi

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

* [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller
  2012-03-07 11:46     ` Amit Virdi
@ 2012-03-07 11:49       ` Stefan Roese
  0 siblings, 0 replies; 21+ messages in thread
From: Stefan Roese @ 2012-03-07 11:49 UTC (permalink / raw)
  To: u-boot

Hi Amit,

On Wednesday 07 March 2012 12:46:43 Amit Virdi wrote:
> >> I'm not sure about the status of this patchset. Can you please tell me
> >> who's the custodian for SNOR flash devices?
> > 
> > Usually I handle those kind of patches, as I'm the CFI flash custodian. I
> > have assigned those patches to me. Since its not really bug fixes, I'll
> > add them to the next branch, once it opens. So they will get pushed
> > after the upcoming release.
> 
> Thanks for the information. I have added another patch as a cleanup for
> the timeout loops. Will you prefer V2 for this patchset with that commit
> added or you're fine with that as a separate commit?

Separate patch is fine with me.

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH] st_smi: Fixed page size for Winbond W25Q128FV flash
  2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
                   ` (11 preceding siblings ...)
  2012-03-07 10:02 ` [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
@ 2012-03-30  6:12 ` Amit Virdi
  12 siblings, 0 replies; 21+ messages in thread
From: Amit Virdi @ 2012-03-30  6:12 UTC (permalink / raw)
  To: u-boot

From: Armando Visconti <armando.visconti@st.com>

Signed-off-by: Armando Visconti <armando.visconti@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/mtd/st_smi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index bd5602b..3f689e7 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -91,7 +91,7 @@ static struct flash_device flash_devices[] = {
 	FLASH_ID("mac 25l3205"   , 0xd8, 0x001620C2, 0x100, 0x10000, 0x400000),
 	FLASH_ID("mac 25l3205a"  , 0xd8, 0x001620C2, 0x100, 0x10000, 0x400000),
 	FLASH_ID("mac 25l6405"   , 0xd8, 0x001720C2, 0x100, 0x10000, 0x800000),
-	FLASH_ID("wbd w25q128" , 0xd8, 0x001840EF, 0x1000, 0x10000, 0x1000000),
+	FLASH_ID("wbd w25q128" , 0xd8, 0x001840EF, 0x100, 0x10000, 0x1000000),
 };
 
 /*
-- 
1.7.2.2

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

* [U-Boot] [PATCH 01/11] st_smi: Add support for SPEAr SMI driver
  2012-02-24 12:23 ` [U-Boot] [PATCH 01/11] st_smi: Add support for SPEAr SMI driver Amit Virdi
@ 2012-04-20  7:47   ` Stefan Roese
  0 siblings, 0 replies; 21+ messages in thread
From: Stefan Roese @ 2012-04-20  7:47 UTC (permalink / raw)
  To: u-boot

Hi Amit,

On Friday 24 February 2012 13:23:04 Amit Virdi wrote:
> From: Vipin KUMAR <vipin.kumar@st.com>
> 
> SMI is the serial memory interface controller provided by ST.
> 
> Earlier, a driver exists in the u-boot source code for the SMI IP. However,
> it was specific to spear platforms. This commit converts the same driver
> to a more generic driver. As a result, the driver files are renamed to
> st_smi.c and st_smi.h and moved into drivers/mtd folder for reusability by
> other platforms using smi controller peripheral.

Since u-boot/next is now available, I wanted to apply some SPEAr patches. 
Mainly the "st_smi" patch series:

[PATCH 01/11] st_smi: Add support for SPEAr SMI driver
...

and the SPEAr platform rework:

[PATCH V2 00/24] SPEAr: Update platform support for SPEAr3xx/6xx
...

Unfortunately the first patch series doesn't apply any more to "next":

[stefan at kubuntu u-boot-staging (sr at denx.de)]$ git am -s bundle-2819.mbox
Applying: st_smi: Add support for SPEAr SMI driver
error: patch failed: include/configs/spear-common.h:55
error: include/configs/spear-common.h: patch does not apply
Patch failed at 0001 st_smi: Add support for SPEAr SMI driver

Could you please rebase your patch series on "next"? And make sure that all 
SPEAr based boards still compile clean?

Thanks,
Stefan

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

end of thread, other threads:[~2012-04-20  7:47 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-24 12:23 [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 01/11] st_smi: Add support for SPEAr SMI driver Amit Virdi
2012-04-20  7:47   ` Stefan Roese
2012-02-24 12:23 ` [U-Boot] [PATCH 02/11] st_smi: Remove compilation warning Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF is not set Amit Virdi
2012-02-27 10:26   ` Stefan Roese
2012-02-29  9:10     ` Amit Virdi
2012-03-02 13:32       ` Stefan Roese
2012-02-24 12:23 ` [U-Boot] [PATCH 04/11] st_smi: Change SMI timeout values Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 05/11] st_smi: Enhance the error handling Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 06/11] st_smi: Read status until timeout happens Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 07/11] st_smi: Move status register read before modifying ctrl register Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 08/11] st_smi: Fix smi read status Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 09/11] st_smi: Removed no needed dependency on ST_M25Pxx_ID Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 10/11] st_smi: Change the flash probing method Amit Virdi
2012-02-24 12:23 ` [U-Boot] [PATCH 11/11] st_smi: Fix bug in flash_print_info() Amit Virdi
2012-03-07 10:02 ` [U-Boot] [PATCH 00/11] mtd/SMI: Add support for ST SMI controller Amit Virdi
2012-03-07 11:27   ` Stefan Roese
2012-03-07 11:46     ` Amit Virdi
2012-03-07 11:49       ` Stefan Roese
2012-03-30  6:12 ` [U-Boot] [PATCH] st_smi: Fixed page size for Winbond W25Q128FV flash Amit Virdi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.