mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] m25p80 / fast read
@ 2013-08-20  7:54 Sascha Hauer
  2013-08-20  7:54 ` [PATCH 1/3] mtd: m25p80: Pass flags through CAT25_INFO macro Sascha Hauer
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-08-20  7:54 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Artem Bityutskiy, linux-kernel, kernel


Changes since v1:

- rebase on git.infradead.org/l2-mtd.git
- improve description for patch 2/3

Sascha

----------------------------------------------------------------
Markus Niebel (1):
      mtd: m25p80: add support for mr25h10

Sascha Hauer (2):
      mtd: m25p80: Pass flags through CAT25_INFO macro
      mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable

 drivers/mtd/devices/m25p80.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

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

* [PATCH 1/3] mtd: m25p80: Pass flags through CAT25_INFO macro
  2013-08-20  7:54 [PATCH v2] m25p80 / fast read Sascha Hauer
@ 2013-08-20  7:54 ` Sascha Hauer
  2013-08-20  7:54 ` [PATCH 2/3] mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable Sascha Hauer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-08-20  7:54 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-mtd, Artem Bityutskiy, linux-kernel, kernel, Sascha Hauer

The flags may have to be overwritten, so add them to the CAT25_INFO
macro.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/devices/m25p80.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 35d5851..0b8672b 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -703,13 +703,13 @@ struct flash_info {
 		.flags = (_flags),					\
 	})
 
-#define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width)	\
+#define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width, _flags)	\
 	((kernel_ulong_t)&(struct flash_info) {				\
 		.sector_size = (_sector_size),				\
 		.n_sectors = (_n_sectors),				\
 		.page_size = (_page_size),				\
 		.addr_width = (_addr_width),				\
-		.flags = M25P_NO_ERASE,					\
+		.flags = (_flags),					\
 	})
 
 /* NOTE: double check command sets and memory organization when you add
@@ -741,7 +741,7 @@ static const struct spi_device_id m25p_ids[] = {
 	{ "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) },
 
 	/* Everspin */
-	{ "mr25h256", CAT25_INFO(  32 * 1024, 1, 256, 2) },
+	{ "mr25h256", CAT25_INFO(  32 * 1024, 1, 256, 2, M25P_NO_ERASE) },
 
 	/* GigaDevice */
 	{ "gd25q32", INFO(0xc84016, 0, 64 * 1024,  64, SECT_4K) },
@@ -856,11 +856,11 @@ static const struct spi_device_id m25p_ids[] = {
 	{ "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K) },
 
 	/* Catalyst / On Semiconductor -- non-JEDEC */
-	{ "cat25c11", CAT25_INFO(  16, 8, 16, 1) },
-	{ "cat25c03", CAT25_INFO(  32, 8, 16, 2) },
-	{ "cat25c09", CAT25_INFO( 128, 8, 32, 2) },
-	{ "cat25c17", CAT25_INFO( 256, 8, 32, 2) },
-	{ "cat25128", CAT25_INFO(2048, 8, 64, 2) },
+	{ "cat25c11", CAT25_INFO(  16, 8, 16, 1, M25P_NO_ERASE) },
+	{ "cat25c03", CAT25_INFO(  32, 8, 16, 2, M25P_NO_ERASE) },
+	{ "cat25c09", CAT25_INFO( 128, 8, 32, 2, M25P_NO_ERASE) },
+	{ "cat25c17", CAT25_INFO( 256, 8, 32, 2, M25P_NO_ERASE) },
+	{ "cat25128", CAT25_INFO(2048, 8, 64, 2, M25P_NO_ERASE) },
 	{ },
 };
 MODULE_DEVICE_TABLE(spi, m25p_ids);
-- 
1.8.4.rc3


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

* [PATCH 2/3] mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable
  2013-08-20  7:54 [PATCH v2] m25p80 / fast read Sascha Hauer
  2013-08-20  7:54 ` [PATCH 1/3] mtd: m25p80: Pass flags through CAT25_INFO macro Sascha Hauer
@ 2013-08-20  7:54 ` Sascha Hauer
  2013-08-20  7:54 ` [PATCH 3/3] mtd: m25p80: add support for mr25h10 Sascha Hauer
  2013-08-20 23:36 ` [PATCH v2] m25p80 / fast read Brian Norris
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-08-20  7:54 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-mtd, Artem Bityutskiy, linux-kernel, kernel, Sascha Hauer

This patch adds a flag to struct flash_info indicating that
fast_read is not supported. This now gives the following logic
when determing whether to enable fastread:

If the flash chip does not support fast_read, then disable it.
Otherwise:
1) enable fast_read if device node contains m25p,fast-read
2) enable fast_read if forced in Kconfig

This makes enabling CONFIG_M25PXX_USE_FAST_READ a safe option
since we no longer enable the fast_read option unconditionally.

For now fast_read is disabled for the everspin mr25h256 and the
catalyst devices. Others may need the flag aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/devices/m25p80.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 0b8672b..6f93d32 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -691,6 +691,7 @@ struct flash_info {
 #define	SECT_4K		0x01		/* OPCODE_BE_4K works uniformly */
 #define	M25P_NO_ERASE	0x02		/* No erase command needed */
 #define	SST_WRITE	0x04		/* use SST byte programming */
+#define	M25P_NO_FR	0x08		/* Can't do fastread */
 };
 
 #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
@@ -741,7 +742,7 @@ static const struct spi_device_id m25p_ids[] = {
 	{ "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) },
 
 	/* Everspin */
-	{ "mr25h256", CAT25_INFO(  32 * 1024, 1, 256, 2, M25P_NO_ERASE) },
+	{ "mr25h256", CAT25_INFO(  32 * 1024, 1, 256, 2, M25P_NO_ERASE | M25P_NO_FR) },
 
 	/* GigaDevice */
 	{ "gd25q32", INFO(0xc84016, 0, 64 * 1024,  64, SECT_4K) },
@@ -856,11 +857,11 @@ static const struct spi_device_id m25p_ids[] = {
 	{ "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K) },
 
 	/* Catalyst / On Semiconductor -- non-JEDEC */
-	{ "cat25c11", CAT25_INFO(  16, 8, 16, 1, M25P_NO_ERASE) },
-	{ "cat25c03", CAT25_INFO(  32, 8, 16, 2, M25P_NO_ERASE) },
-	{ "cat25c09", CAT25_INFO( 128, 8, 32, 2, M25P_NO_ERASE) },
-	{ "cat25c17", CAT25_INFO( 256, 8, 32, 2, M25P_NO_ERASE) },
-	{ "cat25128", CAT25_INFO(2048, 8, 64, 2, M25P_NO_ERASE) },
+	{ "cat25c11", CAT25_INFO(  16, 8, 16, 1, M25P_NO_ERASE | M25P_NO_FR) },
+	{ "cat25c03", CAT25_INFO(  32, 8, 16, 2, M25P_NO_ERASE | M25P_NO_FR) },
+	{ "cat25c09", CAT25_INFO( 128, 8, 32, 2, M25P_NO_ERASE | M25P_NO_FR) },
+	{ "cat25c17", CAT25_INFO( 256, 8, 32, 2, M25P_NO_ERASE | M25P_NO_FR) },
+	{ "cat25128", CAT25_INFO(2048, 8, 64, 2, M25P_NO_ERASE | M25P_NO_FR) },
 	{ },
 };
 MODULE_DEVICE_TABLE(spi, m25p_ids);
@@ -1044,6 +1045,8 @@ static int m25p_probe(struct spi_device *spi)
 #ifdef CONFIG_M25PXX_USE_FAST_READ
 	flash->fast_read = true;
 #endif
+	if (info->flags & M25P_NO_FR)
+		flash->fast_read = false;
 
 	/* Default commands */
 	if (flash->fast_read)
-- 
1.8.4.rc3


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

* [PATCH 3/3] mtd: m25p80: add support for mr25h10
  2013-08-20  7:54 [PATCH v2] m25p80 / fast read Sascha Hauer
  2013-08-20  7:54 ` [PATCH 1/3] mtd: m25p80: Pass flags through CAT25_INFO macro Sascha Hauer
  2013-08-20  7:54 ` [PATCH 2/3] mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable Sascha Hauer
@ 2013-08-20  7:54 ` Sascha Hauer
  2013-08-20 23:36 ` [PATCH v2] m25p80 / fast read Brian Norris
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-08-20  7:54 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-mtd, Artem Bityutskiy, linux-kernel, kernel, Markus Niebel,
	Sascha Hauer

From: Markus Niebel <Markus.Niebel@tqs.de>

This adds support for the Everspin mr25h10 MRAM chip to the m25p80
driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/devices/m25p80.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6f93d32..a48f152 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -743,6 +743,7 @@ static const struct spi_device_id m25p_ids[] = {
 
 	/* Everspin */
 	{ "mr25h256", CAT25_INFO(  32 * 1024, 1, 256, 2, M25P_NO_ERASE | M25P_NO_FR) },
+	{ "mr25h10", CAT25_INFO(128 * 1024, 1, 256, 3, M25P_NO_ERASE | M25P_NO_FR) },
 
 	/* GigaDevice */
 	{ "gd25q32", INFO(0xc84016, 0, 64 * 1024,  64, SECT_4K) },
-- 
1.8.4.rc3


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

* Re: [PATCH v2] m25p80 / fast read
  2013-08-20  7:54 [PATCH v2] m25p80 / fast read Sascha Hauer
                   ` (2 preceding siblings ...)
  2013-08-20  7:54 ` [PATCH 3/3] mtd: m25p80: add support for mr25h10 Sascha Hauer
@ 2013-08-20 23:36 ` Brian Norris
  3 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2013-08-20 23:36 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linux-mtd, Artem Bityutskiy, linux-kernel, kernel

On Tue, Aug 20, 2013 at 09:54:38AM +0200, Sascha Hauer wrote:
> 
> Changes since v1:
> 
> - rebase on git.infradead.org/l2-mtd.git
> - improve description for patch 2/3

Thanks for these.

> Sascha
> 
> ----------------------------------------------------------------
> Markus Niebel (1):
>       mtd: m25p80: add support for mr25h10
> 
> Sascha Hauer (2):
>       mtd: m25p80: Pass flags through CAT25_INFO macro
>       mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable
> 
>  drivers/mtd/devices/m25p80.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)

Pushed to l2-mtd.git.

Brian

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

end of thread, other threads:[~2013-08-20 23:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-20  7:54 [PATCH v2] m25p80 / fast read Sascha Hauer
2013-08-20  7:54 ` [PATCH 1/3] mtd: m25p80: Pass flags through CAT25_INFO macro Sascha Hauer
2013-08-20  7:54 ` [PATCH 2/3] mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable Sascha Hauer
2013-08-20  7:54 ` [PATCH 3/3] mtd: m25p80: add support for mr25h10 Sascha Hauer
2013-08-20 23:36 ` [PATCH v2] m25p80 / fast read Brian Norris

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

all inboxes | Powered by JetHome®