Skip to contentSkip to conversation

OneNAND OMAP patches (resent)

PATCH Applied Adrian Hunter 5 participants 22 messages Dec 13, 2010 – Jan 5, 2011

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

cover OneNAND OMAP patches (resent)

Hi

(resent with corrected email for Artem)

Here are some OneNAND and related OMAP patches.

Adrian Hunter (7):
mtd: OneNAND: OMAP2/3: add support for command line partitioning
mtd: OneNAND: add enable / disable methods to onenand_chip
mtd: OneNAND: OMAP2/3: prevent regulator sleeping while OneNAND is in use OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds OMAP2/3: OneNAND: add 104MHz support
OMAP2/3: OneNAND: add platform data callback for PM constraints
mtd: OneNAND: lighten scary initial bad block messages

 arch/arm/mach-omap2/gpmc-nand.c           |    2 +-
 arch/arm/mach-omap2/gpmc-onenand.c        |   19 +++++--
 arch/arm/mach-omap2/gpmc.c                |   12 ++++-
 arch/arm/mach-omap2/usb-tusb6010.c        |    4 +-
 arch/arm/plat-omap/include/plat/gpmc.h    |    9 ++--
 arch/arm/plat-omap/include/plat/onenand.h |    9 +++
 drivers/mtd/onenand/omap2.c               |   85 +++++++++++++++++++++++------
 drivers/mtd/onenand/onenand_base.c        |   26 ++++++----
 drivers/mtd/onenand/onenand_bbt.c         |    4 +-
 include/linux/mtd/onenand.h               |    2 +
 10 files changed, 131 insertions(+), 41 deletions(-) 

Regards
Adrian

#1 lore raw

PATCH 1/7 mtd: OneNAND: OMAP2/3: add support for command line partitioning

Quoted 1 line

From d27a88c5f9f18a7c38784c085889c3e1053340cf Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Wed, 30 Dec 2009 07:40:16 +0100
Subject: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Add the ability to parse MTD partition information from the kernel command line.

Note that a pointless BUG_ON is removed, as are redundant calls to 'del_mtd_partitions()' and 'del_mtd_device()' because they are also done by 'onenand_release()'.

Finally note that 'add_mtd_device()' returns 1 on failure so the error condition was incorrect.

---
 drivers/mtd/onenand/omap2.c |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)
drivers/mtd/onenand/omap2.c +12 -15
index da25a90..324402f 100644
@@ -65,6 +65,10 @@ struct omap2_onenand {
 	int (*setup)(void __iomem *base, int freq);
 };
 
+#ifdef CONFIG_MTD_PARTITIONS
+static const char *part_probes[] = { "cmdlinepart", NULL,  };
+#endif
+
 static void omap2_onenand_dma_cb(int lch, u16 ch_status, void *data)
 {
 	struct omap2_onenand *c = data;
@@ -730,13 +734,15 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
 	}
 
 #ifdef CONFIG_MTD_PARTITIONS
-	if (pdata->parts != NULL)
-		r = add_mtd_partitions(&c->mtd, pdata->parts,
-				       pdata->nr_parts);
+	r = parse_mtd_partitions(&c->mtd, part_probes, &c->parts, 0);
+	if (r > 0)
+		r = add_mtd_partitions(&c->mtd, c->parts, r);
+	else if (pdata->parts != NULL)
+		r = add_mtd_partitions(&c->mtd, pdata->parts, pdata->nr_parts);
 	else
 #endif
 		r = add_mtd_device(&c->mtd);
-	if (r < 0)
+	if (r)
 		goto err_release_onenand;
 
 	platform_set_drvdata(pdev, c);
@@ -760,6 +766,7 @@ err_release_mem_region:
 err_free_cs:
 	gpmc_cs_free(c->gpmc_cs);
 err_kfree:
+	kfree(c->parts);
 	kfree(c);
 
 	return r;
@@ -769,17 +776,6 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
 {
 	struct omap2_onenand *c = dev_get_drvdata(&pdev->dev);
 
-	BUG_ON(c == NULL);
-
-#ifdef CONFIG_MTD_PARTITIONS
-	if (c->parts)
-		del_mtd_partitions(&c->mtd);
-	else
-		del_mtd_device(&c->mtd);
-#else
-	del_mtd_device(&c->mtd);
-#endif
-
 	onenand_release(&c->mtd);
 	if (c->dma_channel != -1)
 		omap_free_dma(c->dma_channel);
@@ -792,6 +788,7 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
 	iounmap(c->onenand.base);
 	release_mem_region(c->phys_base, ONENAND_IO_SIZE);
 	gpmc_cs_free(c->gpmc_cs);
+	kfree(c->parts);
 	kfree(c);
 
 	return 0;
Signature · 1 line
1.7.0.4
#13 lore raw

PATCH 4/7 OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

In reply to Adrian Hunter
Quoted 1 line

From c52e0cdeedffb7a0f9818ad3d6296d1f51b8669d Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Thu, 9 Dec 2010 10:48:27 +0200
Subject: [PATCH 4/7] OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

The calculations done with sync_clk are anyway in picoseconds and switching to picoseconds allows sync_clk values that are not a whole number of nanoseconds - which is sometimes the case.

---
 arch/arm/mach-omap2/gpmc-nand.c        |    2 +-
 arch/arm/mach-omap2/gpmc-onenand.c     |   10 +++++-----
 arch/arm/mach-omap2/gpmc.c             |   12 +++++++++++-
 arch/arm/mach-omap2/usb-tusb6010.c     |    4 ++--
 arch/arm/plat-omap/include/plat/gpmc.h |    9 +++++----
 5 files changed, 24 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +1 -1
index 7222096..2bb29c1 100644
@@ -41,7 +41,7 @@ static int omap2_nand_gpmc_retime(void)
 		return 0;
 
 	memset(&t, 0, sizeof(t));
-	t.sync_clk = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->sync_clk);
+	t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk;
 	t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on);
 	t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on);
 
arch/arm/mach-omap2/gpmc-onenand.c +5 -5
index 7bb6922..1db606c 100644
@@ -174,7 +174,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
 
 	switch (freq) {
 	case 83:
-		min_gpmc_clk_period = 12; /* 83 MHz */
+		min_gpmc_clk_period = 12000; /* 83 MHz */
 		t_ces   = 5;
 		t_avds  = 4;
 		t_avdh  = 2;
@@ -183,7 +183,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
 		t_rdyo  = 9;
 		break;
 	case 66:
-		min_gpmc_clk_period = 15; /* 66 MHz */
+		min_gpmc_clk_period = 15000; /* 66 MHz */
 		t_ces   = 6;
 		t_avds  = 5;
 		t_avdh  = 2;
@@ -192,7 +192,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
 		t_rdyo  = 11;
 		break;
 	default:
-		min_gpmc_clk_period = 18; /* 54 MHz */
+		min_gpmc_clk_period = 18500; /* 54 MHz */
 		t_ces   = 7;
 		t_avds  = 7;
 		t_avdh  = 7;
@@ -271,8 +271,8 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
 		t.wr_cycle  = t.rd_cycle;
 		if (cpu_is_omap34xx()) {
 			t.wr_data_mux_bus = gpmc_ticks_to_ns(fclk_offset +
-					gpmc_ns_to_ticks(min_gpmc_clk_period +
-					t_rdyo));
+					gpmc_ps_to_ticks(min_gpmc_clk_period +
+					t_rdyo * 1000));
 			t.wr_access = t.access;
 		}
 	} else {
arch/arm/mach-omap2/gpmc.c +11 -1
index f46933b..1b7b3e7 100644
@@ -168,6 +168,16 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
 	return (time_ns * 1000 + tick_ps - 1) / tick_ps;
 }
 
+unsigned int gpmc_ps_to_ticks(unsigned int time_ps)
+{
+	unsigned long tick_ps;
+
+	/* Calculate in picosecs to yield more exact results */
+	tick_ps = gpmc_get_fclk_period();
+
+	return (time_ps + tick_ps - 1) / tick_ps;
+}
+
 unsigned int gpmc_ticks_to_ns(unsigned int ticks)
 {
 	return ticks * gpmc_get_fclk_period() / 1000;
@@ -235,7 +245,7 @@ int gpmc_cs_calc_divider(int cs, unsigned int sync_clk)
 	int div;
 	u32 l;
 
-	l = sync_clk * 1000 + (gpmc_get_fclk_period() - 1);
+	l = sync_clk + (gpmc_get_fclk_period() - 1);
 	div = l / gpmc_get_fclk_period();
 	if (div > 4)
 		return -1;
arch/arm/mach-omap2/usb-tusb6010.c +2 -2
index 64a0112..1e998ea 100644
@@ -120,8 +120,8 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps)
 	t.adv_on = next_clk(t.cs_on, t_scsnh_advnh - 7000, fclk_ps);
 
 	/* GPMC_CLK rate = fclk rate / div */
-	t.sync_clk = 12 /* 11.1 nsec */;
-	tmp = (t.sync_clk * 1000 + fclk_ps - 1) / fclk_ps;
+	t.sync_clk = 11100 /* 11.1 nsec */;
+	tmp = (t.sync_clk + fclk_ps - 1) / fclk_ps;
 	if (tmp > 4)
 		return -ERANGE;
 	if (tmp <= 0)
arch/arm/plat-omap/include/plat/gpmc.h +5 -4
index 9fd99b9..85ded59 100644
@@ -80,12 +80,12 @@
 #define GPMC_PREFETCH_STATUS_COUNT(val)	(val & 0x00003fff)
 
 /*
- * Note that all values in this struct are in nanoseconds, while
- * the register values are in gpmc_fck cycles.
+ * Note that all values in this struct are in nanoseconds except sync_clk
+ * (which is in picoseconds), while the register values are in gpmc_fck cycles.
  */
 struct gpmc_timings {
-	/* Minimum clock period for synchronous mode */
-	u16 sync_clk;
+	/* Minimum clock period for synchronous mode (in picoseconds) */
+	u32 sync_clk;
 
 	/* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
 	u16 cs_on;		/* Assertion time */
@@ -117,6 +117,7 @@ struct gpmc_timings {
 };
 
 extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns);
+extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps);
 extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
 extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns);
 extern unsigned long gpmc_get_fclk_period(void);
Signature · 1 line
1.7.0.4
#12 lore raw

PATCH 3/7 mtd: OneNAND: OMAP2/3: prevent regulator sleeping while OneNAND is in use

In reply to Adrian Hunter
Quoted 1 line

From 0781d7d541e0c93e2ef60fbe0a21f08f6228e68a Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Fri, 19 Feb 2010 15:39:53 +0100
Subject: [PATCH 3/7] mtd: OneNAND: OMAP2/3: prevent regulator sleeping while OneNAND is in use

Prevent OneNAND's voltage regulator from going to sleep while OneNAND is in use, by explicitly enabling and disabling the regulator as appropriate.

---
 arch/arm/plat-omap/include/plat/onenand.h |    1 +
 drivers/mtd/onenand/omap2.c               |   41 ++++++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletions(-)
arch/arm/plat-omap/include/plat/onenand.h +1 -0
index 72f433d..affe87e 100644
@@ -23,6 +23,7 @@ struct omap_onenand_platform_data {
 	int                     (*onenand_setup)(void __iomem *, int freq);
 	int			dma_channel;
 	u8			flags;
+	u8			regulator_can_sleep;
 };
 
 #define ONENAND_MAX_PARTITIONS 8
drivers/mtd/onenand/omap2.c +40 -1

78 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#8 lore raw

PATCH 2/7 mtd: OneNAND: add enable / disable methods to onenand_chip

In reply to Adrian Hunter
Quoted 1 line

From 16b760999cb79f9cf71728c9253f1399717be63a Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device(). These can be used, for example, to allow the driver to prevent the voltage regulator from being put to sleep while OneNAND is in use.

---
 drivers/mtd/onenand/onenand_base.c |    4 ++++
 include/linux/mtd/onenand.h        |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/mtd/onenand/onenand_base.c +4 -0
index c38bf9c..bde274f 100644
@@ -948,6 +948,8 @@ static int onenand_get_device(struct mtd_info *mtd, int new_state)
 		if (this->state == FL_READY) {
 			this->state = new_state;
 			spin_unlock(&this->chip_lock);
+			if (this->enable)
+				this->enable(mtd);
 			break;
 		}
 		if (new_state == FL_PM_SUSPENDED) {
@@ -974,6 +976,8 @@ static void onenand_release_device(struct mtd_info *mtd)
 {
 	struct onenand_chip *this = mtd->priv;
 
+	if (this->state != FL_PM_SUSPENDED && this->disable)
+		this->disable(mtd);
 	/* Release the chip */
 	spin_lock(&this->chip_lock);
 	this->state = FL_READY;
include/linux/mtd/onenand.h +2 -0
index 6da3fe3..ae418e4 100644
@@ -118,6 +118,8 @@ struct onenand_chip {
 	int (*chip_probe)(struct mtd_info *mtd);
 	int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
 	int (*scan_bbt)(struct mtd_info *mtd);
+	int (*enable)(struct mtd_info *mtd);
+	int (*disable)(struct mtd_info *mtd);
 
 	struct completion	complete;
 	int			irq;
Signature · 1 line
1.7.0.4
#17 lore raw

PATCH 5/7 OMAP2/3: OneNAND: add 104MHz support

In reply to Adrian Hunter
Quoted 1 line

From ab0260a2cc3b17b98fa918dee34e129c3ff2b9b6 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Thu, 9 Dec 2010 11:22:50 +0200
Subject: [PATCH 5/7] OMAP2/3: OneNAND: add 104MHz support

Add GPMC timings for 104MHz OneNAND.

---
 arch/arm/mach-omap2/gpmc-onenand.c |    9 +++++++++
 drivers/mtd/onenand/omap2.c        |    3 +++
 2 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/gpmc-onenand.c +9 -0
index 1db606c..3a7d25f 100644
@@ -173,6 +173,15 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
 	}
 
 	switch (freq) {
+	case 104:
+		min_gpmc_clk_period = 9600; /* 104 MHz */
+		t_ces   = 3;
+		t_avds  = 4;
+		t_avdh  = 2;
+		t_ach   = 3;
+		t_aavdh = 6;
+		t_rdyo  = 9;
+		break;
 	case 83:
 		min_gpmc_clk_period = 12000; /* 83 MHz */
 		t_ces   = 5;
drivers/mtd/onenand/omap2.c +3 -0
index 1a07bfc..ac31f46 100644
@@ -767,6 +767,9 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
 	case 3:
 		c->freq = 83;
 		break;
+	case 4:
+		c->freq = 104;
+		break;
 	}
 
 #ifdef CONFIG_MTD_PARTITIONS
Signature · 1 line
1.7.0.4
#19 lore raw

PATCH 7/7 mtd: OneNAND: lighten scary initial bad block messages

In reply to Adrian Hunter
Quoted 1 line

From 5fa7a6377683aabd617f78518cd6cd49eae1679e Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Fri, 10 Dec 2010 12:04:20 +0200
Subject: [PATCH 7/7] mtd: OneNAND: lighten scary initial bad block messages

Initial bad blocks are normal but the messages look like errors. Make the messages less scary, make the main message an informational message not a warning, make the message displaying registers a debug message and include the address there instead of in the informational message.

---
 drivers/mtd/onenand/onenand_base.c |   22 ++++++++++++----------
 drivers/mtd/onenand/onenand_bbt.c  |    4 ++--
 2 files changed, 14 insertions(+), 12 deletions(-)
drivers/mtd/onenand/onenand_base.c +12 -10
index bde274f..5065fc7 100644
@@ -1488,8 +1488,7 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)
 {
 	struct onenand_chip *this = mtd->priv;
 	unsigned long timeout;
-	unsigned int interrupt;
-	unsigned int ctrl;
+	unsigned int interrupt, ctrl, ecc, addr1, addr8;
 
 	/* The 20 msec is enough */
 	timeout = jiffies + msecs_to_jiffies(20);
@@ -1501,25 +1500,28 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)
 	/* To get correct interrupt status in timeout case */
 	interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT);
 	ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS);
+	addr1 = this->read_word(this->base + ONENAND_REG_START_ADDRESS1);
+	addr8 = this->read_word(this->base + ONENAND_REG_START_ADDRESS8);
 
 	if (interrupt & ONENAND_INT_READ) {
-		int ecc = onenand_read_ecc(this);
+		ecc = onenand_read_ecc(this);
 		if (ecc & ONENAND_ECC_2BIT_ALL) {
-			printk(KERN_WARNING "%s: ecc error = 0x%04x, "
-				"controller error 0x%04x\n",
-				__func__, ecc, ctrl);
+			printk(KERN_DEBUG "%s: ecc 0x%04x ctrl 0x%04x "
+			       "intr 0x%04x addr1 %#x addr8 %#x\n",
+			       __func__, ecc, ctrl, interrupt, addr1, addr8);
 			return ONENAND_BBT_READ_ECC_ERROR;
 		}
 	} else {
-		printk(KERN_ERR "%s: read timeout! ctrl=0x%04x intr=0x%04x\n",
-			__func__, ctrl, interrupt);
+		printk(KERN_ERR "%s: read timeout! ctrl 0x%04x "
+		       "intr 0x%04x addr1 %#x addr8 %#x\n",
+		       __func__, ctrl, interrupt, addr1, addr8);
 		return ONENAND_BBT_READ_FATAL_ERROR;
 	}
 
 	/* Initial bad block case: 0x2400 or 0x0400 */
 	if (ctrl & ONENAND_CTRL_ERROR) {
-		printk(KERN_DEBUG "%s: controller error = 0x%04x\n",
-			__func__, ctrl);
+		printk(KERN_DEBUG "%s: ctrl 0x%04x intr 0x%04x addr1 %#x "
+		       "addr8 %#x\n", __func__, ctrl, interrupt, addr1, addr8);
 		return ONENAND_BBT_READ_ERROR;
 	}
 
drivers/mtd/onenand/onenand_bbt.c +2 -2
index 905209b..fc2c16a 100644
@@ -101,8 +101,8 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
 			if (ret || check_short_pattern(&buf[j * scanlen],
 					       scanlen, this->writesize, bd)) {
 				bbm->bbt[i >> 3] |= 0x03 << (i & 0x6);
-				printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
-					i >> 1, (unsigned int) from);
+				printk(KERN_INFO "OneNAND eraseblock %d is an "
+					"initial bad block\n", i >> 1);
 				mtd->ecc_stats.badblocks++;
 				break;
 			}
Signature · 1 line
1.7.0.4
#18 lore raw

PATCH 6/7 OMAP2/3: OneNAND: add platform data callback for PM constraints

In reply to Adrian Hunter
Quoted 1 line

From b93b44d7463b3a3f6d5d1021681596de1881a62b Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Thu, 9 Dec 2010 12:56:24 +0200
Subject: [PATCH 6/7] OMAP2/3: OneNAND: add platform data callback for PM constraints

Make it possible for boards to set PM constraints such as maximum wakeup latency.

---
 arch/arm/plat-omap/include/plat/onenand.h |    8 ++++++++
 drivers/mtd/onenand/omap2.c               |   16 +++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)
arch/arm/plat-omap/include/plat/onenand.h +8 -0
index affe87e..1d07119 100644
@@ -15,12 +15,20 @@
 #define ONENAND_SYNC_READ	(1 << 0)
 #define ONENAND_SYNC_READWRITE	(1 << 1)
 
+enum {
+	ONENAND_PM_CONSTRAINT_OFF,
+	ONENAND_PM_CONSTRAINT_ERASING,
+	ONENAND_PM_CONSTRAINT_OTHER,
+};
+
 struct omap_onenand_platform_data {
 	int			cs;
 	int			gpio_irq;
 	struct mtd_partition	*parts;
 	int			nr_parts;
 	int                     (*onenand_setup)(void __iomem *, int freq);
+	void			(*set_pm_constraints)(struct device *dev,
+						      int on);
 	int			dma_channel;
 	u8			flags;
 	u8			regulator_can_sleep;
drivers/mtd/onenand/omap2.c +15 -1
index ac31f46..866b9f9 100644
@@ -64,6 +64,7 @@ struct omap2_onenand {
 	int dma_channel;
 	int freq;
 	int (*setup)(void __iomem *base, int freq);
+	void (*set_pm_constraints)(struct device *dev, int on);
 	struct regulator *regulator;
 };
 
@@ -605,13 +606,21 @@ static void omap2_onenand_shutdown(struct platform_device *pdev)
 
 static int omap2_onenand_enable(struct mtd_info *mtd)
 {
-	int ret;
+	int ret, on;
 	struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
 
 	ret = regulator_enable(c->regulator);
 	if (ret != 0)
 		dev_err(&c->pdev->dev, "cant enable regulator\n");
 
+	if (c->set_pm_constraints) {
+		if (c->onenand.state == FL_ERASING)
+			on = ONENAND_PM_CONSTRAINT_ERASING;
+		else
+			on = ONENAND_PM_CONSTRAINT_OTHER;
+		c->set_pm_constraints(&c->pdev->dev, on);
+	}
+
 	return ret;
 }
 
@@ -620,6 +629,9 @@ static int omap2_onenand_disable(struct mtd_info *mtd)
 	int ret;
 	struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
 
+	if (c->set_pm_constraints)
+		c->set_pm_constraints(&c->pdev->dev, ONENAND_PM_CONSTRAINT_OFF);
+
 	ret = regulator_disable(c->regulator);
 	if (ret != 0)
 		dev_err(&c->pdev->dev, "cant disable regulator\n");
@@ -682,6 +694,8 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
 		c->setup = pdata->onenand_setup;
 	}
 
+	c->set_pm_constraints = pdata->set_pm_constraints;
+
 	if (c->gpio_irq) {
 		if ((r = gpio_request(c->gpio_irq, "OneNAND irq")) < 0) {
 			dev_err(&pdev->dev,  "Failed to request GPIO%d for "
Signature · 1 line
1.7.0.4
maintainer
#9 lore raw

Re: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

In reply to Adrian Hunter

Hi,

Now I'm used the clock gating for OneNAND instead of regulator. so I think the mechanism is similar.

Quoted 20 lines · Adrian Hunter

From 16b760999cb79f9cf71728c9253f1399717be63a Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device(). These can be used, for example, to allow the driver to prevent the voltage regulator from being put to sleep while OneNAND is in use.

---
 drivers/mtd/onenand/onenand_base.c |    4 ++++
 include/linux/mtd/onenand.h        |    2 ++

 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/mtd/onenand/onenand_base.c +0 -0
index c38bf9c..bde274f 100644

drivers/mtd/onenand/onenand_base.c static int onenand_get_device(struct mtd_info *mtd, int new_state) · line 955

Quoted 8 lines
drivers/mtd/onenand/onenand_base.c +2 -0
@@ -948,6 +948,8 @@ static int onenand_get_device(struct mtd_info *mtd, int new_state)
                if (this->state == FL_READY) {
                        this->state = new_state;
                        spin_unlock(&this->chip_lock);
+                       if (this->enable)
+                               this->enable(mtd);
                        break;
                }
                if (new_state == FL_PM_SUSPENDED) {

I put the code the end of function like:

static int onenand_get_device(struct mtd_info *mtd, int new_state)

{
        struct onenand_chip *this = mtd->priv;
        DECLARE_WAITQUEUE(wait, current);

        /*
         * Grab the lock and see if the device is available
         */
        while (1) {
                spin_lock(&this->chip_lock);
                if (this->state == FL_READY) {
                        this->state = new_state;
                        spin_unlock(&this->chip_lock);
                        break;
                }
                if (new_state == FL_PM_SUSPENDED) {
                        spin_unlock(&this->chip_lock);
                        return (this->state == FL_PM_SUSPENDED) ? 0 : -EAGAIN;
                }
                set_current_state(TASK_UNINTERRUPTIBLE);
                add_wait_queue(&this->wq, &wait);
                spin_unlock(&this->chip_lock);
                schedule();
                remove_wait_queue(&this->wq, &wait);
        }

        if (this->clk)
                clk_enable(this->clk);

        return 0;
}

drivers/mtd/onenand/onenand_base.c static void onenand_release_device(struct mtd_info *mtd) · line 980

Quoted 6 lines
drivers/mtd/onenand/onenand_base.c +2 -0
@@ -974,6 +976,8 @@ static void onenand_release_device(struct mtd_info *mtd)
  {
        struct onenand_chip *this = mtd->priv;
 
+       if (this->state != FL_PM_SUSPENDED && this->disable)
+               this->disable(mtd);

Need to check the SUSPENDED at here? when enter the suspend get_device is called.
release device is called when resume. so no need to check FL_PM_SUSPENDED in my case.

drivers/mtd/onenand/onenand_base.c static void onenand_release_device(struct mtd_info *mtd) · line 983

Quoted 3 lines
drivers/mtd/onenand/onenand_base.c +0 -0
        /* Release the chip */
        spin_lock(&this->chip_lock);
        this->state = FL_READY;

and put the same as like:

static void onenand_release_device(struct mtd_info *mtd)

{
        struct onenand_chip *this = mtd->priv;

        /* Release the chip */
        spin_lock(&this->chip_lock);
        this->state = FL_READY;
        wake_up(&this->wq);
        spin_unlock(&this->chip_lock);

        if (this->clk)
                clk_disable(this->clk);
}

Thank you,
Kyungmin Park

Quoted 21 lines
include/linux/mtd/onenand.h +2 -1
index 6da3fe3..ae418e4 100644
@@ -118,6 +118,8 @@ struct onenand_chip {
        int (*chip_probe)(struct mtd_info *mtd);
        int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
        int (*scan_bbt)(struct mtd_info *mtd);
+       int (*enable)(struct mtd_info *mtd);
+       int (*disable)(struct mtd_info *mtd);
 
        struct completion       complete;
        int                     irq;
--

1.7.0.4

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

Acked-by on v1 7/7
#20 lore raw

Re: [PATCH 7/7] mtd: OneNAND: lighten scary initial bad block messages

In reply to Adrian Hunter
Quoted 91 lines · Adrian Hunter

From 5fa7a6377683aabd617f78518cd6cd49eae1679e Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Fri, 10 Dec 2010 12:04:20 +0200
Subject: [PATCH 7/7] mtd: OneNAND: lighten scary initial bad block messages

Initial bad blocks are normal but the messages look like errors.  Make the messages less scary, make the main message an informational message not a warning, make the message displaying registers a debug message and include the address there instead of in the informational message.

---
 drivers/mtd/onenand/onenand_base.c |   22 ++++++++++++---------- drivers/mtd/onenand/onenand_bbt.c  |    4 ++--

 2 files changed, 14 insertions(+), 12 deletions(-)
drivers/mtd/onenand/onenand_base.c +12 -10
index bde274f..5065fc7 100644
@@ -1488,8 +1488,7 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)
  {
        struct onenand_chip *this = mtd->priv;
        unsigned long timeout;
-       unsigned int interrupt;
-       unsigned int ctrl;
+       unsigned int interrupt, ctrl, ecc, addr1, addr8;
 
        /* The 20 msec is enough */
        timeout = jiffies + msecs_to_jiffies(20);
@@ -1501,25 +1500,28 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)
        /* To get correct interrupt status in timeout case */
        interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT);
        ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS);
+       addr1 = this->read_word(this->base + ONENAND_REG_START_ADDRESS1);
+       addr8 = this->read_word(this->base + ONENAND_REG_START_ADDRESS8);
 
        if (interrupt & ONENAND_INT_READ) {
-               int ecc = onenand_read_ecc(this);
+               ecc = onenand_read_ecc(this);
                if (ecc & ONENAND_ECC_2BIT_ALL) {
-                       printk(KERN_WARNING "%s: ecc error = 0x%04x, "
-                               "controller error 0x%04x\n",
-                               __func__, ecc, ctrl);
+                       printk(KERN_DEBUG "%s: ecc 0x%04x ctrl 0x%04x "
+                              "intr 0x%04x addr1 %#x addr8 %#x\n",
+                              __func__, ecc, ctrl, interrupt, addr1, addr8);
                        return ONENAND_BBT_READ_ECC_ERROR;
                }
        } else {
-               printk(KERN_ERR "%s: read timeout! ctrl=0x%04x intr=0x%04x\n",
-                       __func__, ctrl, interrupt);
+               printk(KERN_ERR "%s: read timeout! ctrl 0x%04x "
+                      "intr 0x%04x addr1 %#x addr8 %#x\n",
+                      __func__, ctrl, interrupt, addr1, addr8);
                return ONENAND_BBT_READ_FATAL_ERROR;
        }
 
        /* Initial bad block case: 0x2400 or 0x0400 */
        if (ctrl & ONENAND_CTRL_ERROR) {
-               printk(KERN_DEBUG "%s: controller error = 0x%04x\n",
-                       __func__, ctrl);
+               printk(KERN_DEBUG "%s: ctrl 0x%04x intr 0x%04x addr1 %#x "
+                      "addr8 %#x\n", __func__, ctrl, interrupt, addr1, addr8);
                return ONENAND_BBT_READ_ERROR;
        }
 
drivers/mtd/onenand/onenand_bbt.c +2 -3
index 905209b..fc2c16a 100644
@@ -101,8 +101,8 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
                        if (ret || check_short_pattern(&buf[j * scanlen],
                                               scanlen, this->writesize, bd)) {
                                bbm->bbt[i >> 3] |= 0x03 << (i & 0x6);
-                               printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
-                                       i >> 1, (unsigned int) from);
+                               printk(KERN_INFO "OneNAND eraseblock %d is an "
+                                       "initial bad block\n", i >> 1);
                                mtd->ecc_stats.badblocks++;
                                break;
                        }
--

1.7.0.4

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

maintainer
#14 lore raw

Re: [PATCH 4/7] OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

In reply to Adrian Hunter
Quoted 10 lines · Adrian Hunter

From c52e0cdeedffb7a0f9818ad3d6296d1f51b8669d Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Thu, 9 Dec 2010 10:48:27 +0200
Subject: [PATCH 4/7] OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

The calculations done with sync_clk are anyway in picoseconds and switching to picoseconds allows sync_clk values that are not a whole number of nanoseconds - which is sometimes the case.

Quoted 8 lines
---
 arch/arm/mach-omap2/gpmc-nand.c        |    2 +-
 arch/arm/mach-omap2/gpmc-onenand.c     |   10 +++++-----
 arch/arm/mach-omap2/gpmc.c             |   12 +++++++++++-
 arch/arm/mach-omap2/usb-tusb6010.c     |    4 ++--
 arch/arm/plat-omap/include/plat/gpmc.h |    9 +++++----
 5 files changed, 24 insertions(+), 13 deletions(-)

Hmm I think I already replied to this.. But looks like not so here's a new attempt..

This one you should send to linux-omap and linux-arm-kernel and Cc Felipe Balbi so we can make sure the timing changes work with tusb6010. Then we can ack it an it can go via the MTD list.

Regards,

Tony

#15 lore raw

PATCH 4/7 OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

Quoted 1 line

From c52e0cdeedffb7a0f9818ad3d6296d1f51b8669d Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Thu, 9 Dec 2010 10:48:27 +0200
Subject: [PATCH 4/7] OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

The calculations done with sync_clk are anyway in picoseconds and switching to picoseconds allows sync_clk values that are not a whole number of nanoseconds - which is sometimes the case.

---
  arch/arm/mach-omap2/gpmc-nand.c        |    2 +-
  arch/arm/mach-omap2/gpmc-onenand.c     |   10 +++++-----
  arch/arm/mach-omap2/gpmc.c             |   12 +++++++++++-
  arch/arm/mach-omap2/usb-tusb6010.c     |    4 ++--
  arch/arm/plat-omap/include/plat/gpmc.h |    9 +++++----
  5 files changed, 24 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +1 -1
index 7222096..2bb29c1 100644
@@ -41,7 +41,7 @@ static int omap2_nand_gpmc_retime(void)
  		return 0;
  
  	memset(&t, 0, sizeof(t));
-	t.sync_clk = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->sync_clk);
+	t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk;
  	t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on);
  	t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on);
  
arch/arm/mach-omap2/gpmc-onenand.c +5 -5
index 7bb6922..1db606c 100644
@@ -174,7 +174,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
  
  	switch (freq) {
  	case 83:
-		min_gpmc_clk_period = 12; /* 83 MHz */
+		min_gpmc_clk_period = 12000; /* 83 MHz */
  		t_ces   = 5;
  		t_avds  = 4;
  		t_avdh  = 2;
@@ -183,7 +183,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
  		t_rdyo  = 9;
  		break;
  	case 66:
-		min_gpmc_clk_period = 15; /* 66 MHz */
+		min_gpmc_clk_period = 15000; /* 66 MHz */
  		t_ces   = 6;
  		t_avds  = 5;
  		t_avdh  = 2;
@@ -192,7 +192,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
  		t_rdyo  = 11;
  		break;
  	default:
-		min_gpmc_clk_period = 18; /* 54 MHz */
+		min_gpmc_clk_period = 18500; /* 54 MHz */
  		t_ces   = 7;
  		t_avds  = 7;
  		t_avdh  = 7;
@@ -271,8 +271,8 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
  		t.wr_cycle  = t.rd_cycle;
  		if (cpu_is_omap34xx()) {
  			t.wr_data_mux_bus = gpmc_ticks_to_ns(fclk_offset +
-					gpmc_ns_to_ticks(min_gpmc_clk_period +
-					t_rdyo));
+					gpmc_ps_to_ticks(min_gpmc_clk_period +
+					t_rdyo * 1000));
  			t.wr_access = t.access;
  		}
  	} else {
arch/arm/mach-omap2/gpmc.c +11 -1
index f46933b..1b7b3e7 100644
@@ -168,6 +168,16 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
  	return (time_ns * 1000 + tick_ps - 1) / tick_ps;
  }
  
+unsigned int gpmc_ps_to_ticks(unsigned int time_ps)
+{
+	unsigned long tick_ps;
+
+	/* Calculate in picosecs to yield more exact results */
+	tick_ps = gpmc_get_fclk_period();
+
+	return (time_ps + tick_ps - 1) / tick_ps;
+}
+
  unsigned int gpmc_ticks_to_ns(unsigned int ticks)
  {
  	return ticks * gpmc_get_fclk_period() / 1000;
@@ -235,7 +245,7 @@ int gpmc_cs_calc_divider(int cs, unsigned int sync_clk)
  	int div;
  	u32 l;
  
-	l = sync_clk * 1000 + (gpmc_get_fclk_period() - 1);
+	l = sync_clk + (gpmc_get_fclk_period() - 1);
  	div = l / gpmc_get_fclk_period();
  	if (div > 4)
  		return -1;
arch/arm/mach-omap2/usb-tusb6010.c +2 -2
index 64a0112..1e998ea 100644
@@ -120,8 +120,8 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps)
  	t.adv_on = next_clk(t.cs_on, t_scsnh_advnh - 7000, fclk_ps);
  
  	/* GPMC_CLK rate = fclk rate / div */
-	t.sync_clk = 12 /* 11.1 nsec */;
-	tmp = (t.sync_clk * 1000 + fclk_ps - 1) / fclk_ps;
+	t.sync_clk = 11100 /* 11.1 nsec */;
+	tmp = (t.sync_clk + fclk_ps - 1) / fclk_ps;
  	if (tmp > 4)
  		return -ERANGE;
  	if (tmp <= 0)
arch/arm/plat-omap/include/plat/gpmc.h +5 -4
index 9fd99b9..85ded59 100644
@@ -80,12 +80,12 @@
  #define GPMC_PREFETCH_STATUS_COUNT(val)	(val & 0x00003fff)
  
  /*
- * Note that all values in this struct are in nanoseconds, while
- * the register values are in gpmc_fck cycles.
+ * Note that all values in this struct are in nanoseconds except sync_clk
+ * (which is in picoseconds), while the register values are in gpmc_fck cycles.
   */
  struct gpmc_timings {
-	/* Minimum clock period for synchronous mode */
-	u16 sync_clk;
+	/* Minimum clock period for synchronous mode (in picoseconds) */
+	u32 sync_clk;
  
  	/* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
  	u16 cs_on;		/* Assertion time */
@@ -117,6 +117,7 @@ struct gpmc_timings {
  };
  
  extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns);
+extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps);
  extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
  extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns);
  extern unsigned long gpmc_get_fclk_period(void);

-- 1.7.0.4

#10 lore raw

Re: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

In reply to Kyungmin Park
Quoted 4 lines · Kyungmin Park

Hi,

Now I'm used the clock gating for OneNAND instead of regulator. so I think the mechanism is similar.

I am not sure what you are trying to say here. We need the regulator enable / disable to stop the regulator going to sleep (because it cannot supply enough current when it is asleep) and also we need to call down to the board level to set latency constraints. These things seem pretty specific to the OMAP driver hence the new enable() / disable() methods.

We do not need any clock gating. The OneNAND clock is dealt with by the OMAP GPMC OneNAND controller and GPMC has auto-idle / smart-idle facilities that let OMAP gate clocks and power it off when it is not being used.

Quoted 70 lines · Adrian Hunter
Quoted 20 lines

From 16b760999cb79f9cf71728c9253f1399717be63a Mon Sep 17 00:00:00 2001
From: Adrian Hunter<[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device(). These can be used, for example, to allow the driver to prevent the voltage regulator from being put to sleep while OneNAND is in use.

---
  drivers/mtd/onenand/onenand_base.c |    4 ++++
  include/linux/mtd/onenand.h        |    2 ++
  2 files changed, 6 insertions(+), 0 deletions(-)
drivers/mtd/onenand/onenand_base.c +0 -0
index c38bf9c..bde274f 100644

drivers/mtd/onenand/onenand_base.c static int onenand_get_device(struct mtd_info *mtd, int new_state) · line 955

Quoted 8 lines
drivers/mtd/onenand/onenand_base.c +2 -0
@@ -948,6 +948,8 @@ static int onenand_get_device(struct mtd_info *mtd, int new_state)
                if (this->state == FL_READY) {
                        this->state = new_state;
                        spin_unlock(&this->chip_lock);
+                       if (this->enable)
+                               this->enable(mtd);
                        break;
                }
                if (new_state == FL_PM_SUSPENDED) {

I put the code the end of function like:

static int onenand_get_device(struct mtd_info *mtd, int new_state)

{
         struct onenand_chip *this = mtd->priv;
         DECLARE_WAITQUEUE(wait, current);

         /*
          * Grab the lock and see if the device is available
          */
         while (1) {
                 spin_lock(&this->chip_lock);
                 if (this->state == FL_READY) {
                         this->state = new_state;
                         spin_unlock(&this->chip_lock);
                         break;
                 }
                 if (new_state == FL_PM_SUSPENDED) {
                         spin_unlock(&this->chip_lock);
                         return (this->state == FL_PM_SUSPENDED) ? 0 : -EAGAIN;
                 }
                 set_current_state(TASK_UNINTERRUPTIBLE);
                 add_wait_queue(&this->wq,&wait);
                 spin_unlock(&this->chip_lock);
                 schedule();
                 remove_wait_queue(&this->wq,&wait);
         }

         if (this->clk)
                 clk_enable(this->clk);

         return 0;
}
Quoted 4 lines
drivers/mtd/onenand/onenand_base.c +0 -0
@@ -974,6 +976,8 @@ static void onenand_release_device(struct mtd_info *mtd)
  {
        struct onenand_chip *this = mtd->priv;
 
Quoted 6 lines

drivers/mtd/onenand/onenand_base.c static void onenand_release_device(struct mtd_info *mtd) · line 980

Quoted 2 lines
drivers/mtd/onenand/onenand_base.c +2 -0
+       if (this->state != FL_PM_SUSPENDED&&  this->disable)
+               this->disable(mtd);

Need to check the SUSPENDED at here? when enter the suspend get_device is called.
release device is called when resume. so no need to check FL_PM_SUSPENDED in my case.

onenand-get_device should have had:

	if (new_state != FL_PM_SUSPENDED && this->enable)
		this->enable(mtd);

I will resend the patch.

Quoted 46 lines

drivers/mtd/onenand/onenand_base.c static void onenand_release_device(struct mtd_info *mtd) · line 983

Quoted 4 lines
drivers/mtd/onenand/onenand_base.c +0 -0
        /* Release the chip */
        spin_lock(&this->chip_lock);
        this->state = FL_READY;

and put the same as like:

static void onenand_release_device(struct mtd_info *mtd)

{
         struct onenand_chip *this = mtd->priv;

         /* Release the chip */
         spin_lock(&this->chip_lock);
         this->state = FL_READY;
         wake_up(&this->wq);
         spin_unlock(&this->chip_lock);

         if (this->clk)
                 clk_disable(this->clk);
}

Thank you,
Kyungmin Park

Quoted 21 lines
include/linux/mtd/onenand.h +2 -1
index 6da3fe3..ae418e4 100644
@@ -118,6 +118,8 @@ struct onenand_chip {
        int (*chip_probe)(struct mtd_info *mtd);
        int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
        int (*scan_bbt)(struct mtd_info *mtd);
+       int (*enable)(struct mtd_info *mtd);
+       int (*disable)(struct mtd_info *mtd);
 
        struct completion       complete;
        int                     irq;
--

1.7.0.4

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#11 lore raw

Re: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

In reply to Kyungmin Park

From ece28a7fdec36fb40d60d35a5639326871c162f6 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH V2 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device(). These can be used, for example, to allow the driver to prevent the voltage regulator from being put to sleep while OneNAND is in use.

---
 drivers/mtd/onenand/onenand_base.c |    4 ++++
 include/linux/mtd/onenand.h        |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/mtd/onenand/onenand_base.c +4 -0
index c38bf9c..5639e43 100644
@@ -948,6 +948,8 @@ static int onenand_get_device(struct mtd_info *mtd, int new_state)
 		if (this->state == FL_READY) {
 			this->state = new_state;
 			spin_unlock(&this->chip_lock);
+			if (new_state != FL_PM_SUSPENDED && this->enable)
+				this->enable(mtd);
 			break;
 		}
 		if (new_state == FL_PM_SUSPENDED) {
@@ -974,6 +976,8 @@ static void onenand_release_device(struct mtd_info *mtd)
 {
 	struct onenand_chip *this = mtd->priv;
 
+	if (this->state != FL_PM_SUSPENDED && this->disable)
+		this->disable(mtd);
 	/* Release the chip */
 	spin_lock(&this->chip_lock);
 	this->state = FL_READY;
include/linux/mtd/onenand.h +2 -0
index 6da3fe3..ae418e4 100644
@@ -118,6 +118,8 @@ struct onenand_chip {
 	int (*chip_probe)(struct mtd_info *mtd);
 	int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
 	int (*scan_bbt)(struct mtd_info *mtd);
+	int (*enable)(struct mtd_info *mtd);
+	int (*disable)(struct mtd_info *mtd);
 
 	struct completion	complete;
 	int			irq;
Signature · 1 line
1.7.0.4
#21 lore raw

Re: [PATCH 7/7] mtd: OneNAND: lighten scary initial bad block messages

In reply to Adrian Hunter
Quoted 5 lines · Adrian Hunter

From 5fa7a6377683aabd617f78518cd6cd49eae1679e Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Fri, 10 Dec 2010 12:04:20 +0200
Subject: [PATCH 7/7] mtd: OneNAND: lighten scary initial bad block messages

Quoted 7 lines

Initial bad blocks are normal but the messages look like errors. Make the messages less scary, make the main message an informational message not a warning, make the message displaying registers a debug message and include the address there instead of in the informational message.

Pushed this one to l2-mtd-2.6.git, thanks.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#2 lore raw

Re: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

In reply to Adrian Hunter
Quoted 8 lines · Adrian Hunter

From d27a88c5f9f18a7c38784c085889c3e1053340cf Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Wed, 30 Dec 2009 07:40:16 +0100
Subject: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Add the ability to parse MTD partition information from the kernel command line.

Quoted 8 lines

Note that a pointless BUG_ON is removed, as are redundant calls to 'del_mtd_partitions()' and 'del_mtd_device()' because they are also done by 'onenand_release()'.

Finally note that 'add_mtd_device()' returns 1 on failure so the error condition was incorrect.

I've pushed patches 1 and 7 to l2-mtd-2.6, but patch #2 is not applicable. I think this is because of changes Kyungmin made recently. Could you please re-send patches 2 and 3 on top of the l2 tree?

I guess I can apply 2 and 3 now. Patch 4 should wait for comments from Tony, AFAICS. Patches 5 and 6 are dependent, and hence should wait as well, AFAICS.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#7 lore raw

Re: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

In reply to Adrian Hunter
Quoted 8 lines · Adrian Hunter

From d27a88c5f9f18a7c38784c085889c3e1053340cf Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Wed, 30 Dec 2009 07:40:16 +0100
Subject: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Add the ability to parse MTD partition information from the kernel command line.

Quoted 8 lines

Note that a pointless BUG_ON is removed, as are redundant calls to 'del_mtd_partitions()' and 'del_mtd_device()' because they are also done by 'onenand_release()'.

Finally note that 'add_mtd_device()' returns 1 on failure so the error condition was incorrect.

Pushed this one to l2-mtd-2.6.git, thank you.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
maintainer
#16 lore raw

Re: [PATCH 4/7] OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

In reply to Adrian Hunter
Quoted 8 lines · Adrian Hunter

From c52e0cdeedffb7a0f9818ad3d6296d1f51b8669d Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Thu, 9 Dec 2010 10:48:27 +0200
Subject: [PATCH 4/7] OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds

The calculations done with sync_clk are anyway in picoseconds and switching to picoseconds allows sync_clk values that are not a whole number of nanoseconds - which is sometimes the

Can you please post patches 4 - 5 of this series as separate patches and Cc linux-omap and linux-arm-kernel mailing lists?

This is assuming patches 4 - 5 do not have dependencies to the other patches in the series..

Thanks,

Tony

#3 lore raw

Re: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

In reply to Artem Bityutskiy
Quoted 13 lines · ext Artem Bityutskiy
Quoted 12 lines · Adrian Hunter

From d27a88c5f9f18a7c38784c085889c3e1053340cf Mon Sep 17 00:00:00 2001
From: Adrian Hunter<[email protected]>
Date: Wed, 30 Dec 2009 07:40:16 +0100
Subject: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Add the ability to parse MTD partition information from the kernel command line.

Note that a pointless BUG_ON is removed, as are redundant calls to 'del_mtd_partitions()' and 'del_mtd_device()' because they are also done by 'onenand_release()'.

Quoted 8 lines
Quoted 4 lines

Finally note that 'add_mtd_device()' returns 1 on failure so the error condition was incorrect.

I've pushed patches 1 and 7 to l2-mtd-2.6, but patch #2 is not applicable. I think this is because of changes Kyungmin made recently. Could you please re-send patches 2 and 3 on top of the l2 tree?

I just tried to apply them to l2 and they applied fine as is. Has something changed? Do I have the wrong tree?

	git://git.infradead.org/users/dedekind/l2-mtd-2.6.git
Quoted 5 lines

I guess I can apply 2 and 3 now. Patch 4 should wait for comments from Tony, AFAICS. Patches 5 and 6 are dependent, and hence should wait as well, AFAICS.

#4 lore raw

Re: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Quoted 17 lines · Adrian Hunter
Quoted 16 lines · ext Artem Bityutskiy
Quoted 15 lines · Adrian Hunter

From d27a88c5f9f18a7c38784c085889c3e1053340cf Mon Sep 17 00:00:00 2001
From: Adrian Hunter<[email protected]>
Date: Wed, 30 Dec 2009 07:40:16 +0100
Subject: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Add the ability to parse MTD partition information from the kernel command line.

Note that a pointless BUG_ON is removed, as are redundant calls to 'del_mtd_partitions()' and 'del_mtd_device()' because they are also done by 'onenand_release()'.

Finally note that 'add_mtd_device()' returns 1 on failure so the error condition was incorrect.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I've pushed patches 1 and 7 to l2-mtd-2.6, but patch #2 is not applicable. I think this is because of changes Kyungmin made recently. Could you please re-send patches 2 and 3 on top of the l2 tree?

I just tried to apply them to l2 and they applied fine as is. Has something changed? Do I have the wrong tree?

Just tried to apply patch 2 which you re-sent on "Wed, 05 Jan 2011 13:02:40 +0200"

[dedekind@koala l2-mtd-2.6]$ git am -i -s ~/tmp/adrian.mbox Commit Body is:
--------------------------
mtd: OneNAND: add enable / disable methods to onenand_chip

From ece28a7fdec36fb40d60d35a5639326871c162f6 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH V2 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device().
These can be used, for example, to allow the driver to prevent the voltage
regulator from being put to sleep while OneNAND is in use.

--------------------------
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all e Commit Body is:
--------------------------
mtd: OneNAND: add enable / disable methods to onenand_chip

From ece28a7fdec36fb40d60d35a5639326871c162f6 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH V2 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device().
These can be used, for example, to allow the driver to prevent the voltage
regulator from being put to sleep while OneNAND is in use.

--------------------------
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: mtd: OneNAND: add enable / disable methods to onenand_chip
error: patch failed: drivers/mtd/onenand/onenand_base.c:948
error: drivers/mtd/onenand/onenand_base.c: patch does not apply
error: patch failed: include/linux/mtd/onenand.h:118
error: include/linux/mtd/onenand.h: patch does not apply Patch failed at 0001 mtd: OneNAND: add enable / disable methods to onenand_chip
When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". [dedekind@koala l2-mtd-2.6]$ patch -p1 < .git/rebase-apply/patch patching file drivers/mtd/onenand/onenand_base.c
Hunk #1 FAILED at 948.
Hunk #2 FAILED at 974.
2 out of 2 hunks FAILED -- saving rejects to file drivers/mtd/onenand/onenand_base.c.rej
patching file include/linux/mtd/onenand.h
Hunk #1 FAILED at 118.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/mtd/onenand.h.rej
[dedekind@koala l2-mtd-2.6]$ cat drivers/mtd/onenand/onenand_base.c.rej

mtd/onenand/onenand_base.c +1 -0
@@ -948,6 +948,8 @@
                if (this->state == FL_READY) {
                        this->state = new_state;
                        spin_unlock(&this->chip_lock);
+                       if (new_state != FL_PM_SUSPENDED &&

this->enable)

+                               this->enable(mtd);
                        break;
                }
                if (new_state == FL_PM_SUSPENDED) {
@@ -974,6 +976,8 @@
  {
        struct onenand_chip *this = mtd->priv;

+ if (this->state != FL_PM_SUSPENDED && this->disable)

+               this->disable(mtd);
        /* Release the chip */
        spin_lock(&this->chip_lock);
        this->state = FL_READY;

[dedekind@koala l2-mtd-2.6]$ cat include/linux/mtd/onenand.h.rej

linux/mtd/onenand.h +2 -0
@@ -118,6 +118,8 @@
        int (*chip_probe)(struct mtd_info *mtd);
        int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
        int (*scan_bbt)(struct mtd_info *mtd);
+       int (*enable)(struct mtd_info *mtd);
+       int (*disable)(struct mtd_info *mtd);
  
        struct completion       complete;
        int                     irq;

[dedekind@koala l2-mtd-2.6]$ git log
commit 5fca82e7d3827249e840393fb28d19404d337fbf

Author: Aleksandr Koltsoff <[email protected]>
Date:   Tue Jan 4 10:42:35 2011 +0200

mtd: m25p80: Fix JEDEC ID for AT26DF321

The last byte of the ID should be zero for this chip. Was added in commit d0e8c47c58575b9131e786edb488fd029eba443e . Reported by Tomi Varjo.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
#5 lore raw

Re: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Quoted 24 lines · ext Artem Bityutskiy
Quoted 23 lines · Adrian Hunter
Quoted 21 lines · ext Artem Bityutskiy
Quoted 8 lines · Adrian Hunter
   From d27a88c5f9f18a7c38784c085889c3e1053340cf Mon Sep 17 00:00:00 2001

From: Adrian Hunter<[email protected]>
Date: Wed, 30 Dec 2009 07:40:16 +0100
Subject: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Add the ability to parse MTD partition information from the kernel command line.

Quoted 8 lines

Note that a pointless BUG_ON is removed, as are redundant calls to 'del_mtd_partitions()' and 'del_mtd_device()' because they are also done by 'onenand_release()'.

Finally note that 'add_mtd_device()' returns 1 on failure so the error condition was incorrect.

I've pushed patches 1 and 7 to l2-mtd-2.6, but patch #2 is not applicable. I think this is because of changes Kyungmin made recently. Could you please re-send patches 2 and 3 on top of the l2 tree?

Quoted 5 lines
Quoted 2 lines

I just tried to apply them to l2 and they applied fine as is. Has something changed? Do I have the wrong tree?

Just tried to apply patch 2 which you re-sent on "Wed, 05 Jan 2011 13:02:40 +0200"

I guess the patches got munched. Here they are tarred

Quoted 109 lines

[dedekind@koala l2-mtd-2.6]$ git am -i -s ~/tmp/adrian.mbox Commit Body is:
--------------------------
mtd: OneNAND: add enable / disable methods to onenand_chip

From ece28a7fdec36fb40d60d35a5639326871c162f6 Mon Sep 17 00:00:00 2001
From: Adrian Hunter<[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH V2 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device().
These can be used, for example, to allow the driver to prevent the voltage
regulator from being put to sleep while OneNAND is in use.

--------------------------
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all e Commit Body is:
--------------------------
mtd: OneNAND: add enable / disable methods to onenand_chip

From ece28a7fdec36fb40d60d35a5639326871c162f6 Mon Sep 17 00:00:00 2001
From: Adrian Hunter<[email protected]>
Date: Fri, 19 Feb 2010 15:39:52 +0100
Subject: [PATCH V2 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip

Add enable / disable methods called from get_device() / release_device().
These can be used, for example, to allow the driver to prevent the voltage
regulator from being put to sleep while OneNAND is in use.

--------------------------
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: mtd: OneNAND: add enable / disable methods to onenand_chip
error: patch failed: drivers/mtd/onenand/onenand_base.c:948
error: drivers/mtd/onenand/onenand_base.c: patch does not apply
error: patch failed: include/linux/mtd/onenand.h:118
error: include/linux/mtd/onenand.h: patch does not apply Patch failed at 0001 mtd: OneNAND: add enable / disable methods to onenand_chip
When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". [dedekind@koala l2-mtd-2.6]$ patch -p1< .git/rebase-apply/patch patching file drivers/mtd/onenand/onenand_base.c
Hunk #1 FAILED at 948.
Hunk #2 FAILED at 974.
2 out of 2 hunks FAILED -- saving rejects to file drivers/mtd/onenand/onenand_base.c.rej
patching file include/linux/mtd/onenand.h
Hunk #1 FAILED at 118.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/mtd/onenand.h.rej
[dedekind@koala l2-mtd-2.6]$ cat drivers/mtd/onenand/onenand_base.c.rej

mtd/onenand/onenand_base.c +2 -0
@@ -948,6 +948,8 @@
                 if (this->state == FL_READY) {
                         this->state = new_state;
                         spin_unlock(&this->chip_lock);
+                       if (new_state != FL_PM_SUSPENDED&&
 this->enable)
+                               this->enable(mtd);
                         break;
                 }
                 if (new_state == FL_PM_SUSPENDED) {
mtd/onenand/onenand_base.c +2 -0
@@ -974,6 +976,8 @@
   {
         struct onenand_chip *this = mtd->priv;
 
+       if (this->state != FL_PM_SUSPENDED&&  this->disable)
+               this->disable(mtd);
         /* Release the chip */
         spin_lock(&this->chip_lock);
         this->state = FL_READY;

[dedekind@koala l2-mtd-2.6]$ cat include/linux/mtd/onenand.h.rej

linux/mtd/onenand.h +2 -0
@@ -118,6 +118,8 @@
         int (*chip_probe)(struct mtd_info *mtd);
         int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
         int (*scan_bbt)(struct mtd_info *mtd);
+       int (*enable)(struct mtd_info *mtd);
+       int (*disable)(struct mtd_info *mtd);
 
         struct completion       complete;
         int                     irq;

[dedekind@koala l2-mtd-2.6]$ git log
commit 5fca82e7d3827249e840393fb28d19404d337fbf

Author: Aleksandr Koltsoff<[email protected]>
Date:   Tue Jan 4 10:42:35 2011 +0200

mtd: m25p80: Fix JEDEC ID for AT26DF321

The last byte of the ID should be zero for this chip. Was added in commit d0e8c47c58575b9131e786edb488fd029eba443e . Reported by Tomi Varjo.

#6 lore raw

Re: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Quoted 25 lines · Adrian Hunter
Quoted 24 lines · ext Artem Bityutskiy
Quoted 23 lines · Adrian Hunter
Quoted 21 lines · ext Artem Bityutskiy
Quoted 8 lines · Adrian Hunter
   From d27a88c5f9f18a7c38784c085889c3e1053340cf Mon Sep 17 00:00:00 2001

From: Adrian Hunter<[email protected]>
Date: Wed, 30 Dec 2009 07:40:16 +0100
Subject: [PATCH 1/7] mtd: OneNAND: OMAP2/3: add support for command line partitioning

Add the ability to parse MTD partition information from the kernel command line.

Quoted 8 lines

Note that a pointless BUG_ON is removed, as are redundant calls to 'del_mtd_partitions()' and 'del_mtd_device()' because they are also done by 'onenand_release()'.

Finally note that 'add_mtd_device()' returns 1 on failure so the error condition was incorrect.

I've pushed patches 1 and 7 to l2-mtd-2.6, but patch #2 is not applicable. I think this is because of changes Kyungmin made recently. Could you please re-send patches 2 and 3 on top of the l2 tree?

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I just tried to apply them to l2 and they applied fine as is. Has something changed? Do I have the wrong tree?

Just tried to apply patch 2 which you re-sent on "Wed, 05 Jan 2011 13:02:40 +0200"

I guess the patches got munched. Here they are tarred

Pushed to l2 tree both (patches 2 and 3).

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Битюцкий Артём)