Skip to contentSkip to conversation

OneNAND: interrupt based wait support (for reference)

PATCH Kyungmin Park 2 participants 2 messages Nov 3, 2006

Subsystems (6)
lore
Share & tools
lore

Kyungmin Park

author maintainer
#0 lore raw

Hi,

The previous mail has some problem. So I send it again.

Here's full referenece code against mtd tree.

Just reference to apollon source. Apollon patch will be sent to omap mailing list.

Please apply the previous patch. :)

Thank you,
Kyungmin Park

--

arch/arm/mach-omap2/board-apollon.c +28 -6
index 03d6905..e181945 100644
@@ -24,6 +24,7 @@ #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/irq.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
@@ -45,6 +46,8 @@ #define SW_ENTER_GPIO16		16
 #define SW_UP_GPIO17		17
 #define SW_DOWN_GPIO58		58
 
+#define APOLLON_FLASH_GPIO_IRQ	72
+
 static struct mtd_partition apollon_partitions[] = {
 	{
 		.name		= "X-Loader + U-Boot",
@@ -84,10 +87,17 @@ static struct flash_platform_data apollo
 	.nr_parts	= ARRAY_SIZE(apollon_partitions),
 };
 
-static struct resource apollon_flash_resource = {
-	.start		= APOLLON_CS0_BASE,
-	.end		= APOLLON_CS0_BASE + SZ_128K,
-	.flags		= IORESOURCE_MEM,
+static struct resource apollon_flash_resource[] = {
+	[0] = {
+		.start	= APOLLON_CS0_BASE,
+		.end	= APOLLON_CS0_BASE + SZ_128K,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= OMAP_GPIO_IRQ(APOLLON_FLASH_GPIO_IRQ),
+		.end	= OMAP_GPIO_IRQ(APOLLON_FLASH_GPIO_IRQ),
+		.flags	= IORESOURCE_IRQ,
+	},
 };
 
 static struct platform_device apollon_onenand_device = {
@@ -96,8 +106,8 @@ static struct platform_device apollon_on
 	.dev		= {
 		.platform_data	= &apollon_flash_data,
 	},
-	.num_resources	= ARRAY_SIZE(&apollon_flash_resource),
-	.resource	= &apollon_flash_resource,
+	.num_resources	= ARRAY_SIZE(apollon_flash_resource),
+	.resource	= apollon_flash_resource,
 };
 
 static struct resource apollon_smc91x_resources[] = {
@@ -152,12 +162,24 @@ static inline void __init apollon_init_s
 	omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1);
 }
 
+static inline void __init apollon_init_flash(void)
+{
+	if (omap_request_gpio(APOLLON_FLASH_GPIO_IRQ) < 0) {
+		printk(KERN_ERR "Failed to request GPIO%d for onenand IRQ\n",
+			APOLLON_FLASH_GPIO_IRQ);
+		return;
+	}
+	omap_set_gpio_direction(APOLLON_FLASH_GPIO_IRQ, 1);
+	set_irq_type(OMAP_GPIO_IRQ(APOLLON_FLASH_GPIO_IRQ), IRQT_RISING);
+}
+
 static void __init omap_apollon_init_irq(void)
 {
 	omap2_init_common_hw();
 	omap_init_irq();
 	omap_gpio_init();
 	apollon_init_smc91x();
+	apollon_init_flash();
 }
 
 static struct omap_uart_config apollon_uart_config __initdata = {
drivers/mtd/onenand/generic.c +1 -0
index af06a80..cdf80c6 100644
@@ -63,6 +63,7 @@ static int __devinit generic_onenand_pro
 	}
 
 	info->onenand.mmcontrol = pdata->mmcontrol;
+	info->onenand.irq = platform_get_irq(pdev, 0);
 
 	info->mtd.name = pdev->dev.bus_id;
 	info->mtd.priv = &info->onenand;
drivers/mtd/onenand/onenand_base.c +107 -2

133 lines not on this page · raw message

include/asm-arm/arch-omap/omap24xx.h +2 -0
index 6e59805..a497dcc 100644
@@ -16,6 +16,8 @@ #define VA_IC_BASE		IO_ADDRESS(OMAP24XX_
 #define OMAP24XX_IVA_INTC_BASE	0x40000000
 #define IRQ_SIR_IRQ		0x0040
 
+#define OMAP242X_CONTROL_STATUS	(L4_24XX_BASE + 0x2f8)
+
 #define OMAP24XX_32KSYNCT_BASE	(L4_24XX_BASE + 0x4000)
 #define OMAP24XX_PRCM_BASE	(L4_24XX_BASE + 0x8000)
 #define OMAP24XX_SDRC_BASE	(L3_24XX_BASE + 0x9000)
include/linux/mtd/onenand.h +4 -0
index 6f045b5..df963f1 100644
@@ -13,6 +13,7 @@ #ifndef __LINUX_MTD_ONENAND_H
 #define __LINUX_MTD_ONENAND_H
 
 #include <linux/spinlock.h>
+#include <linux/completion.h>
 #include <linux/mtd/onenand_regs.h>
 #include <linux/mtd/bbm.h>
 
@@ -120,6 +121,9 @@ struct onenand_chip {
 	int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
 	int (*scan_bbt)(struct mtd_info *mtd);
 
+	struct completion	complete;
+	int			irq;
+
 	spinlock_t		chip_lock;
 	wait_queue_head_t	wq;
 	onenand_state_t		state;
#1 lore raw
Quoted 3 lines · Kyungmin Park

Hi,

The previous mail has some problem. So I send it again.

OK

Quoted 1 line

Please apply the previous patch. :)

So the previous or this one? :-)

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