public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] ARM: OMAP: Fix omap mmu framework for omap1
@ 2007-07-30 11:03 Hiroshi.DOYU
  2007-07-30 11:03 ` [PATCH 2/8] " Hiroshi.DOYU
  0 siblings, 1 reply; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:03 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/mach-omap1/mmu.c            |    3 +-
 arch/arm/mach-omap1/mmu.h            |   43 ++++++++++++++++-----------------
 arch/arm/mach-omap2/mmu.c            |   21 ++++++++++------
 arch/arm/mach-omap2/mmu.h            |   24 +++++++++++++++++++
 arch/arm/plat-omap/mmu.c             |   37 +++++++++++++++--------------
 include/asm-arm/arch-omap/mmu.h      |   19 ---------------
 include/asm-arm/arch-omap/omap16xx.h |    2 +-
 7 files changed, 79 insertions(+), 70 deletions(-)

diff --git a/arch/arm/mach-omap1/mmu.c b/arch/arm/mach-omap1/mmu.c
index e1e29e0..876952e 100644
--- a/arch/arm/mach-omap1/mmu.c
+++ b/arch/arm/mach-omap1/mmu.c
@@ -86,8 +86,7 @@ static int omap1_mmu_mem_enable(struct omap_mmu *mmu, void *addr)
 	if (omap_mmu_internal_memory(mmu, addr)) {
 		if (intmem_usecount++ == 0)
 			ret = omap_dsp_request_mem();
-	} else
-		ret = -EIO;
+	}
 
 	return ret;
 }
diff --git a/arch/arm/mach-omap1/mmu.h b/arch/arm/mach-omap1/mmu.h
index d86d966..75966b2 100644
--- a/arch/arm/mach-omap1/mmu.h
+++ b/arch/arm/mach-omap1/mmu.h
@@ -7,28 +7,27 @@
 #define MMU_LOCK_BASE_MASK		(0x3f << 10)
 #define MMU_LOCK_VICTIM_MASK		(0x3f << 4)
 
-#define OMAP_MMU_BASE			(0xfffed200)
-#define OMAP_MMU_PREFETCH		(OMAP_MMU_BASE + 0x00)
-#define OMAP_MMU_WALKING_ST		(OMAP_MMU_BASE + 0x04)
-#define OMAP_MMU_CNTL			(OMAP_MMU_BASE + 0x08)
-#define OMAP_MMU_FAULT_AD_H		(OMAP_MMU_BASE + 0x0c)
-#define OMAP_MMU_FAULT_AD_L		(OMAP_MMU_BASE + 0x10)
-#define OMAP_MMU_FAULT_ST		(OMAP_MMU_BASE + 0x14)
-#define OMAP_MMU_IT_ACK			(OMAP_MMU_BASE + 0x18)
-#define OMAP_MMU_TTB_H			(OMAP_MMU_BASE + 0x1c)
-#define OMAP_MMU_TTB_L			(OMAP_MMU_BASE + 0x20)
-#define OMAP_MMU_LOCK			(OMAP_MMU_BASE + 0x24)
-#define OMAP_MMU_LD_TLB			(OMAP_MMU_BASE + 0x28)
-#define OMAP_MMU_CAM_H			(OMAP_MMU_BASE + 0x2c)
-#define OMAP_MMU_CAM_L			(OMAP_MMU_BASE + 0x30)
-#define OMAP_MMU_RAM_H			(OMAP_MMU_BASE + 0x34)
-#define OMAP_MMU_RAM_L			(OMAP_MMU_BASE + 0x38)
-#define OMAP_MMU_GFLUSH			(OMAP_MMU_BASE + 0x3c)
-#define OMAP_MMU_FLUSH_ENTRY		(OMAP_MMU_BASE + 0x40)
-#define OMAP_MMU_READ_CAM_H		(OMAP_MMU_BASE + 0x44)
-#define OMAP_MMU_READ_CAM_L		(OMAP_MMU_BASE + 0x48)
-#define OMAP_MMU_READ_RAM_H		(OMAP_MMU_BASE + 0x4c)
-#define OMAP_MMU_READ_RAM_L		(OMAP_MMU_BASE + 0x50)
+#define OMAP_MMU_PREFETCH		0x00
+#define OMAP_MMU_WALKING_ST		0x04
+#define OMAP_MMU_CNTL			0x08
+#define OMAP_MMU_FAULT_AD_H		0x0c
+#define OMAP_MMU_FAULT_AD_L		0x10
+#define OMAP_MMU_FAULT_ST		0x14
+#define OMAP_MMU_IT_ACK			0x18
+#define OMAP_MMU_TTB_H			0x1c
+#define OMAP_MMU_TTB_L			0x20
+#define OMAP_MMU_LOCK			0x24
+#define OMAP_MMU_LD_TLB			0x28
+#define OMAP_MMU_CAM_H			0x2c
+#define OMAP_MMU_CAM_L			0x30
+#define OMAP_MMU_RAM_H			0x34
+#define OMAP_MMU_RAM_L			0x38
+#define OMAP_MMU_GFLUSH			0x3c
+#define OMAP_MMU_FLUSH_ENTRY		0x40
+#define OMAP_MMU_READ_CAM_H		0x44
+#define OMAP_MMU_READ_CAM_L		0x48
+#define OMAP_MMU_READ_RAM_H		0x4c
+#define OMAP_MMU_READ_RAM_L		0x50
 
 #define OMAP_MMU_CNTL_BURST_16MNGT_EN	0x0020
 #define OMAP_MMU_CNTL_WTL_EN		0x0004
diff --git a/arch/arm/mach-omap2/mmu.c b/arch/arm/mach-omap2/mmu.c
index 2f0e6ed..ca21541 100644
--- a/arch/arm/mach-omap2/mmu.c
+++ b/arch/arm/mach-omap2/mmu.c
@@ -42,16 +42,16 @@ static void *dspvect_page;
 static inline void
 omap2_mmu_read_tlb(struct omap_mmu *mmu, struct cam_ram_regset *cr)
 {
-	cr->cam = omap_mmu_read_reg(mmu, MMU_READ_CAM);
-	cr->ram = omap_mmu_read_reg(mmu, MMU_READ_RAM);
+	cr->cam = omap_mmu_read_reg(mmu, OMAP_MMU_READ_CAM);
+	cr->ram = omap_mmu_read_reg(mmu, OMAP_MMU_READ_RAM);
 }
 
 static inline void
 omap2_mmu_load_tlb(struct omap_mmu *mmu, struct cam_ram_regset *cr)
 {
 	/* Set the CAM and RAM entries */
-	omap_mmu_write_reg(mmu, cr->cam | OMAP_MMU_CAM_V, MMU_CAM);
-	omap_mmu_write_reg(mmu, cr->ram, MMU_RAM);
+	omap_mmu_write_reg(mmu, cr->cam | OMAP_MMU_CAM_V, OMAP_MMU_CAM);
+	omap_mmu_write_reg(mmu, cr->ram, OMAP_MMU_RAM);
 }
 
 static void exmap_setup_iomap_page(struct omap_mmu *mmu, unsigned long phys,
@@ -145,6 +145,11 @@ static void exmap_clear_preserved_entries(struct omap_mmu *mmu)
 
 static int omap2_mmu_startup(struct omap_mmu *mmu)
 {
+	u32 rev = omap_mmu_read_reg(mmu, OMAP_MMU_REVISION);
+
+	pr_info("MMU: OMAP %s MMU initialized (HW v%d.%d)\n", mmu->name,
+		(rev >> 4) & 0xf, rev & 0xf);
+
 	dspvect_page = (void *)__get_dma_pages(GFP_KERNEL, 0);
 	if (dspvect_page == NULL) {
 		printk(KERN_ERR "MMU: failed to allocate memory "
@@ -154,7 +159,7 @@ static int omap2_mmu_startup(struct omap_mmu *mmu)
 
 	mmu->nr_exmap_preserved = exmap_setup_preserved_entries(mmu);
 
-	omap_mmu_write_reg(mmu, MMU_IRQ_MASK, MMU_IRQENABLE);
+	omap_mmu_write_reg(mmu, MMU_IRQ_MASK, OMAP_MMU_IRQENABLE);
 
 	return 0;
 }
@@ -283,8 +288,8 @@ static void omap2_mmu_interrupt(struct omap_mmu *mmu)
 {
 	unsigned long status, va;
 
-	status = MMU_IRQ_MASK & omap_mmu_read_reg(mmu, MMU_IRQSTATUS);
-	va = omap_mmu_read_reg(mmu, MMU_FAULT_AD);
+	status = MMU_IRQ_MASK & omap_mmu_read_reg(mmu, OMAP_MMU_IRQSTATUS);
+	va = omap_mmu_read_reg(mmu, OMAP_MMU_FAULT_AD);
 
 	pr_info("%s\n", (status & OMAP_MMU_IRQ_MULTIHITFAULT)		? "multi hit":"");
 	pr_info("%s\n", (status & OMAP_MMU_IRQ_TABLEWALKFAULT)		? "table walk fault":"");
@@ -294,7 +299,7 @@ static void omap2_mmu_interrupt(struct omap_mmu *mmu)
 	pr_info("fault address = %#08lx\n", va);
 
 	omap_mmu_disable(mmu);
-	omap_mmu_write_reg(mmu, status, MMU_IRQSTATUS);
+	omap_mmu_write_reg(mmu, status, OMAP_MMU_IRQSTATUS);
 
 	mmu->fault_address = va;
 	schedule_work(&mmu->irq_work);
diff --git a/arch/arm/mach-omap2/mmu.h b/arch/arm/mach-omap2/mmu.h
index 7520f91..c4922d1 100644
--- a/arch/arm/mach-omap2/mmu.h
+++ b/arch/arm/mach-omap2/mmu.h
@@ -7,6 +7,30 @@
 #define MMU_LOCK_BASE_MASK		(0x1f << 10)
 #define MMU_LOCK_VICTIM_MASK		(0x1f << 4)
 
+#define OMAP_MMU_REVISION		0x00
+#define OMAP_MMU_SYSCONFIG		0x10
+#define OMAP_MMU_SYSSTATUS		0x14
+#define OMAP_MMU_IRQSTATUS		0x18
+#define OMAP_MMU_IRQENABLE		0x1c
+#define OMAP_MMU_WALKING_ST		0x40
+#define OMAP_MMU_CNTL			0x44
+#define OMAP_MMU_FAULT_AD		0x48
+#define OMAP_MMU_TTB			0x4c
+#define OMAP_MMU_LOCK			0x50
+#define OMAP_MMU_LD_TLB			0x54
+#define OMAP_MMU_CAM			0x58
+#define OMAP_MMU_RAM			0x5c
+#define OMAP_MMU_GFLUSH			0x60
+#define OMAP_MMU_FLUSH_ENTRY		0x64
+#define OMAP_MMU_READ_CAM		0x68
+#define OMAP_MMU_READ_RAM		0x6c
+#define OMAP_MMU_EMU_FAULT_AD		0x70
+
+#define OMAP_MMU_CNTL_BURST_16MNGT_EN   0x0020
+#define OMAP_MMU_CNTL_WTL_EN            0x0004
+#define OMAP_MMU_CNTL_MMU_EN            0x0002
+#define OMAP_MMU_CNTL_RESET_SW          0x0001
+
 #define OMAP_MMU_IRQ_MULTIHITFAULT	0x00000010
 #define OMAP_MMU_IRQ_TABLEWALKFAULT	0x00000008
 #define OMAP_MMU_IRQ_EMUMISS		0x00000004
diff --git a/arch/arm/plat-omap/mmu.c b/arch/arm/plat-omap/mmu.c
index 30c646e..cb675d4 100644
--- a/arch/arm/plat-omap/mmu.c
+++ b/arch/arm/plat-omap/mmu.c
@@ -523,7 +523,7 @@ static int omap_mmu_cam_ram_valid(struct omap_mmu *mmu,
 static inline void
 omap_mmu_get_tlb_lock(struct omap_mmu *mmu, struct omap_mmu_tlb_lock *tlb_lock)
 {
-	unsigned long lock = omap_mmu_read_reg(mmu, MMU_LOCK);
+	unsigned long lock = omap_mmu_read_reg(mmu, OMAP_MMU_LOCK);
 	int mask;
 
 	mask = (mmu->type == OMAP_MMU_CAMERA) ?
@@ -540,17 +540,18 @@ omap_mmu_set_tlb_lock(struct omap_mmu *mmu, struct omap_mmu_tlb_lock *lock)
 {
 	omap_mmu_write_reg(mmu,
 			   (lock->base << MMU_LOCK_BASE_SHIFT) |
-			   (lock->victim << MMU_LOCK_VICTIM_SHIFT), MMU_LOCK);
+			   (lock->victim << MMU_LOCK_VICTIM_SHIFT),
+			   OMAP_MMU_LOCK);
 }
 
 static inline void omap_mmu_flush(struct omap_mmu *mmu)
 {
-	omap_mmu_write_reg(mmu, 0x1, MMU_FLUSH_ENTRY);
+	omap_mmu_write_reg(mmu, 0x1, OMAP_MMU_FLUSH_ENTRY);
 }
 
 static inline void omap_mmu_ldtlb(struct omap_mmu *mmu)
 {
-	omap_mmu_write_reg(mmu, 0x1, MMU_LD_TLB);
+	omap_mmu_write_reg(mmu, 0x1, OMAP_MMU_LD_TLB);
 }
 
 void omap_mmu_read_tlb(struct omap_mmu *mmu, struct omap_mmu_tlb_lock *lock,
@@ -671,7 +672,7 @@ static void omap_mmu_gflush(struct omap_mmu *mmu)
 	clk_enable(mmu->clk);
 	omap_dsp_request_mem();
 
-	omap_mmu_write_reg(mmu, 0x1, MMU_GFLUSH);
+	omap_mmu_write_reg(mmu, 0x1, OMAP_MMU_GFLUSH);
 	lock.base = lock.victim = mmu->nr_exmap_preserved;
 	omap_mmu_set_tlb_lock(mmu, &lock);
 
@@ -1015,35 +1016,39 @@ EXPORT_SYMBOL_GPL(exmap_clear_mem_page);
 
 static void omap_mmu_reset(struct omap_mmu *mmu)
 {
+#if defined(CONFIG_ARCH_OMAP2) /* FIXME */
 	int i;
 
-	omap_mmu_write_reg(mmu, 0x2, MMU_SYSCONFIG);
+	omap_mmu_write_reg(mmu, 0x2, OMAP_MMU_SYSCONFIG);
 
 	for (i = 0; i < 10000; i++)
-		if (likely(omap_mmu_read_reg(mmu, MMU_SYSSTATUS) & 0x1))
+		if (likely(omap_mmu_read_reg(mmu, OMAP_MMU_SYSSTATUS) & 0x1))
 			break;
+#endif
 }
 
 void omap_mmu_disable(struct omap_mmu *mmu)
 {
-	omap_mmu_write_reg(mmu, 0x00, MMU_CNTL);
+	omap_mmu_write_reg(mmu, 0x00, OMAP_MMU_CNTL);
 }
 EXPORT_SYMBOL_GPL(omap_mmu_disable);
 
 void omap_mmu_enable(struct omap_mmu *mmu, int reset)
 {
-	u32 val = MMU_CNTL_MMUENABLE;
-	u32 pa = (u32)virt_to_phys(mmu->twl_mm->pgd);
+	u32 val = OMAP_MMU_CNTL_MMU_EN;
 
 	if (likely(reset))
 		omap_mmu_reset(mmu);
-
+#if defined(CONFIG_ARCH_OMAP2) /* FIXME */
 	if (mmu->ops->pte_get_attr) {
-		omap_mmu_write_reg(mmu, pa, MMU_TTB);
+		omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd),
+				   OMAP_MMU_TTB);
 		val |= MMU_CNTL_TWLENABLE;
 	}
-
-	omap_mmu_write_reg(mmu, val, MMU_CNTL);
+#else
+	val |= OMAP_MMU_CNTL_RESET_SW;
+#endif
+	omap_mmu_write_reg(mmu, val, OMAP_MMU_CNTL);
 }
 EXPORT_SYMBOL_GPL(omap_mmu_enable);
 
@@ -1472,10 +1477,6 @@ int omap_mmu_register(struct omap_mmu *mmu)
 
 	init_rwsem(&mmu->exmap_sem);
 
-	ret = omap_mmu_read_reg(mmu, MMU_REVISION);
-	printk(KERN_NOTICE "MMU: OMAP %s MMU initialized (HW v%d.%d)\n",
-	       mmu->name, (ret >> 4) & 0xf, ret & 0xf);
-
 	ret = omap_mmu_init(mmu);
 	if (unlikely(ret))
 		goto err_mmu_init;
diff --git a/include/asm-arm/arch-omap/mmu.h b/include/asm-arm/arch-omap/mmu.h
index bff433b..7d1e450 100644
--- a/include/asm-arm/arch-omap/mmu.h
+++ b/include/asm-arm/arch-omap/mmu.h
@@ -4,25 +4,6 @@
 #include <linux/device.h>
 #include <linux/workqueue.h>
 
-#define MMU_REVISION		0x00
-#define MMU_SYSCONFIG		0x10
-#define MMU_SYSSTATUS		0x14
-#define MMU_IRQSTATUS		0x18
-#define MMU_IRQENABLE		0x1c
-#define MMU_WALKING_ST		0x40
-#define MMU_CNTL		0x44
-#define MMU_FAULT_AD		0x48
-#define MMU_TTB			0x4c
-#define MMU_LOCK		0x50
-#define MMU_LD_TLB		0x54
-#define MMU_CAM			0x58
-#define MMU_RAM			0x5c
-#define MMU_GFLUSH		0x60
-#define MMU_FLUSH_ENTRY		0x64
-#define MMU_READ_CAM		0x68
-#define MMU_READ_RAM		0x6c
-#define MMU_EMU_FAULT_AD	0x70
-
 enum exmap_type {
 	EXMAP_TYPE_MEM,
 	EXMAP_TYPE_FB
diff --git a/include/asm-arm/arch-omap/omap16xx.h b/include/asm-arm/arch-omap/omap16xx.h
index f7f5cdf..db85276 100644
--- a/include/asm-arm/arch-omap/omap16xx.h
+++ b/include/asm-arm/arch-omap/omap16xx.h
@@ -190,7 +190,7 @@
 #define WSPR_DISABLE_0         (0x0000aaaa)
 #define WSPR_DISABLE_1         (0x00005555)
 
-/* Mailbox */
+#define OMAP16XX_DSP_MMU_BASE	(0xfffed200)
 #define OMAP16XX_MAILBOX_BASE	(0xfffcf000)
 
 #endif /*  __ASM_ARCH_OMAP16XX_H */
-- 
1.5.3.rc3.24.g83b3d

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

* [PATCH 2/8] ARM: OMAP: Fix omap mmu framework for omap1
  2007-07-30 11:03 [PATCH 1/8] ARM: OMAP: Fix omap mmu framework for omap1 Hiroshi.DOYU
@ 2007-07-30 11:03 ` Hiroshi.DOYU
  2007-07-30 11:04   ` [PATCH 3/8] DSPGW: Remove CONFIG_OMAP_DSP_TASK_MULTIOPEN Hiroshi.DOYU
  0 siblings, 1 reply; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:03 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

DSPGW specific part

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/plat-omap/dsp/mmu.h       |    4 +-
 arch/arm/plat-omap/dsp/omap1_dsp.h |   74 ------------------------------------
 arch/arm/plat-omap/dsp/omap2_dsp.h |   69 ---------------------------------
 3 files changed, 2 insertions(+), 145 deletions(-)

diff --git a/arch/arm/plat-omap/dsp/mmu.h b/arch/arm/plat-omap/dsp/mmu.h
index 7787b9f..9d60e9e 100644
--- a/arch/arm/plat-omap/dsp/mmu.h
+++ b/arch/arm/plat-omap/dsp/mmu.h
@@ -7,7 +7,7 @@
 struct omap_mmu dsp_mmu = {
 	.name		= "mmu:dsp",
 	.type		= OMAP_MMU_DSP,
-	.base		= DSP_MMU_BASE,
+	.base		= IO_ADDRESS(OMAP1510_DSP_MMU_BASE),
 	.membase	= OMAP1510_DSP_BASE,
 	.memsize	= OMAP1510_DSP_SIZE,
 	.nr_tlb_entries	= 32,
@@ -20,7 +20,7 @@ struct omap_mmu dsp_mmu = {
 struct omap_mmu dsp_mmu = {
 	.name		= "mmu:dsp",
 	.type		= OMAP_MMU_DSP,
-	.base		= DSP_MMU_BASE,
+	.base		= IO_ADDRESS(OMAP16XX_DSP_MMU_BASE),
 	.membase	= OMAP16XX_DSP_BASE,
 	.memsize	= OMAP16XX_DSP_SIZE,
 	.nr_tlb_entries	= 32,
diff --git a/arch/arm/plat-omap/dsp/omap1_dsp.h b/arch/arm/plat-omap/dsp/omap1_dsp.h
index 45fdb50..f4ec73e 100644
--- a/arch/arm/plat-omap/dsp/omap1_dsp.h
+++ b/arch/arm/plat-omap/dsp/omap1_dsp.h
@@ -101,80 +101,6 @@
 #define TC_ENDIANISM_EN			0x00000001
 
 /*
- * DSP MMU
- */
-#define DSP_MMU_BASE			(0xfefed200)
-#define DSP_MMU_PREFETCH		(DSP_MMU_BASE + 0x00)
-#define DSP_MMU_WALKING_ST		(DSP_MMU_BASE + 0x04)
-#define DSP_MMU_CNTL			(DSP_MMU_BASE + 0x08)
-#define DSP_MMU_FAULT_AD_H		(DSP_MMU_BASE + 0x0c)
-#define DSP_MMU_FAULT_AD_L		(DSP_MMU_BASE + 0x10)
-#define DSP_MMU_FAULT_ST		(DSP_MMU_BASE + 0x14)
-#define DSP_MMU_IT_ACK			(DSP_MMU_BASE + 0x18)
-#define DSP_MMU_TTB_H			(DSP_MMU_BASE + 0x1c)
-#define DSP_MMU_TTB_L			(DSP_MMU_BASE + 0x20)
-#define DSP_MMU_LOCK			(DSP_MMU_BASE + 0x24)
-#define DSP_MMU_LD_TLB			(DSP_MMU_BASE + 0x28)
-#define DSP_MMU_CAM_H			(DSP_MMU_BASE + 0x2c)
-#define DSP_MMU_CAM_L			(DSP_MMU_BASE + 0x30)
-#define DSP_MMU_RAM_H			(DSP_MMU_BASE + 0x34)
-#define DSP_MMU_RAM_L			(DSP_MMU_BASE + 0x38)
-#define DSP_MMU_GFLUSH			(DSP_MMU_BASE + 0x3c)
-#define DSP_MMU_FLUSH_ENTRY		(DSP_MMU_BASE + 0x40)
-#define DSP_MMU_READ_CAM_H		(DSP_MMU_BASE + 0x44)
-#define DSP_MMU_READ_CAM_L		(DSP_MMU_BASE + 0x48)
-#define DSP_MMU_READ_RAM_H		(DSP_MMU_BASE + 0x4c)
-#define DSP_MMU_READ_RAM_L		(DSP_MMU_BASE + 0x50)
-
-#define DSP_MMU_CNTL_BURST_16MNGT_EN	0x0020
-#define DSP_MMU_CNTL_WTL_EN		0x0004
-#define DSP_MMU_CNTL_MMU_EN		0x0002
-#define DSP_MMU_CNTL_RESET_SW		0x0001
-
-#define DSP_MMU_FAULT_AD_H_DP		0x0100
-#define DSP_MMU_FAULT_AD_H_ADR_MASK	0x00ff
-
-#define DSP_MMU_FAULT_ST_PREF		0x0008
-#define DSP_MMU_FAULT_ST_PERM		0x0004
-#define DSP_MMU_FAULT_ST_TLB_MISS	0x0002
-#define DSP_MMU_FAULT_ST_TRANS		0x0001
-
-#define DSP_MMU_IT_ACK_IT_ACK		0x0001
-
-#define DSP_MMU_LOCK_BASE_MASK		0xfc00
-#define DSP_MMU_LOCK_BASE_SHIFT		10
-#define DSP_MMU_LOCK_VICTIM_MASK	0x03f0
-#define DSP_MMU_LOCK_VICTIM_SHIFT	4
-
-#define DSP_MMU_CAM_H_VA_TAG_H_MASK		0x0003
-
-#define DSP_MMU_CAM_L_VA_TAG_L1_MASK		0xc000
-#define DSP_MMU_CAM_L_VA_TAG_L2_MASK_1MB	0x0000
-#define DSP_MMU_CAM_L_VA_TAG_L2_MASK_64KB	0x3c00
-#define DSP_MMU_CAM_L_VA_TAG_L2_MASK_4KB	0x3fc0
-#define DSP_MMU_CAM_L_VA_TAG_L2_MASK_1KB	0x3ff0
-#define DSP_MMU_CAM_L_P				0x0008
-#define DSP_MMU_CAM_L_V				0x0004
-#define DSP_MMU_CAM_L_PAGESIZE_MASK		0x0003
-#define DSP_MMU_CAM_L_PAGESIZE_1MB		0x0000
-#define DSP_MMU_CAM_L_PAGESIZE_64KB		0x0001
-#define DSP_MMU_CAM_L_PAGESIZE_4KB		0x0002
-#define DSP_MMU_CAM_L_PAGESIZE_1KB		0x0003
-
-#define DSP_MMU_RAM_L_RAM_LSB_MASK	0xfc00
-#define DSP_MMU_RAM_L_AP_MASK		0x0300
-#define DSP_MMU_RAM_L_AP_NA		0x0000
-#define DSP_MMU_RAM_L_AP_RO		0x0200
-#define DSP_MMU_RAM_L_AP_FA		0x0300
-
-#define DSP_MMU_GFLUSH_GFLUSH		0x0001
-
-#define DSP_MMU_FLUSH_ENTRY_FLUSH_ENTRY	0x0001
-
-#define DSP_MMU_LD_TLB_RD		0x0002
-#define DSP_MMU_LD_TLB_LD		0x0001
-
-/*
  * DSP ICR
  */
 #define DSPREG_ICR_RESERVED_BITS	0xffc0
diff --git a/arch/arm/plat-omap/dsp/omap2_dsp.h b/arch/arm/plat-omap/dsp/omap2_dsp.h
index af93be2..0dc43f0 100644
--- a/arch/arm/plat-omap/dsp/omap2_dsp.h
+++ b/arch/arm/plat-omap/dsp/omap2_dsp.h
@@ -78,75 +78,6 @@
 #define DSP_BOOT_ADR_INTERNAL		0x024000
 
 /*
- * DSP MMU: mapped to 0xe2000000 -- use readX(), writeX()
- */
-#define DSP_MMU_BASE			DSP_MMU_24XX_VIRT
-#define DSP_MMU_REVISION		(DSP_MMU_BASE + 0x00)
-#define DSP_MMU_SYSCONFIG		(DSP_MMU_BASE + 0x10)
-#define DSP_MMU_SYSSTATUS		(DSP_MMU_BASE + 0x14)
-#define DSP_MMU_IRQSTATUS		(DSP_MMU_BASE + 0x18)
-#define DSP_MMU_IRQENABLE		(DSP_MMU_BASE + 0x1c)
-#define DSP_MMU_WALKING_ST		(DSP_MMU_BASE + 0x40)
-#define DSP_MMU_CNTL			(DSP_MMU_BASE + 0x44)
-#define DSP_MMU_FAULT_AD		(DSP_MMU_BASE + 0x48)
-#define DSP_MMU_TTB			(DSP_MMU_BASE + 0x4c)
-#define DSP_MMU_LOCK			(DSP_MMU_BASE + 0x50)
-#define DSP_MMU_LD_TLB			(DSP_MMU_BASE + 0x54)
-#define DSP_MMU_CAM			(DSP_MMU_BASE + 0x58)
-#define DSP_MMU_RAM			(DSP_MMU_BASE + 0x5c)
-#define DSP_MMU_GFLUSH			(DSP_MMU_BASE + 0x60)
-#define DSP_MMU_FLUSH_ENTRY		(DSP_MMU_BASE + 0x64)
-#define DSP_MMU_READ_CAM		(DSP_MMU_BASE + 0x68)
-#define DSP_MMU_READ_RAM		(DSP_MMU_BASE + 0x6c)
-#define DSP_MMU_EMU_FAULT_AD		(DSP_MMU_BASE + 0x70)
-
-#define DSP_MMU_SYSCONFIG_CLOCKACTIVITY_MASK	0x00000300
-#define DSP_MMU_SYSCONFIG_IDLEMODE_MASK		0x00000018
-#define DSP_MMU_SYSCONFIG_SOFTRESET		0x00000002
-#define DSP_MMU_SYSCONFIG_AUTOIDLE		0x00000001
-
-#define DSP_MMU_IRQ_MULTIHITFAULT	0x00000010
-#define DSP_MMU_IRQ_TABLEWALKFAULT	0x00000008
-#define DSP_MMU_IRQ_EMUMISS		0x00000004
-#define DSP_MMU_IRQ_TRANSLATIONFAULT	0x00000002
-#define DSP_MMU_IRQ_TLBMISS		0x00000001
-
-#define DSP_MMU_CNTL_EMUTLBUPDATE	0x00000008
-#define DSP_MMU_CNTL_TWLENABLE		0x00000004
-#define DSP_MMU_CNTL_MMUENABLE		0x00000002
-
-#define DSP_MMU_LOCK_BASE_MASK		0x00007c00
-#define DSP_MMU_LOCK_BASE_SHIFT		10
-#define DSP_MMU_LOCK_VICTIM_MASK	0x000001f0
-#define DSP_MMU_LOCK_VICTIM_SHIFT	4
-
-#define DSP_MMU_CAM_VATAG_MASK		0xfffff000
-#define DSP_MMU_CAM_P			0x00000008
-#define DSP_MMU_CAM_V			0x00000004
-#define DSP_MMU_CAM_PAGESIZE_MASK	0x00000003
-#define DSP_MMU_CAM_PAGESIZE_1MB	0x00000000
-#define DSP_MMU_CAM_PAGESIZE_64KB	0x00000001
-#define DSP_MMU_CAM_PAGESIZE_4KB	0x00000002
-#define DSP_MMU_CAM_PAGESIZE_16MB	0x00000003
-
-#define DSP_MMU_RAM_PADDR_MASK		0xfffff000
-#define DSP_MMU_RAM_ENDIANNESS		0x00000200
-#define DSP_MMU_RAM_ENDIANNESS_BIG	0x00000200
-#define DSP_MMU_RAM_ENDIANNESS_LITTLE	0x00000000
-#define DSP_MMU_RAM_ELEMENTSIZE_MASK	0x00000180
-#define DSP_MMU_RAM_ELEMENTSIZE_8	0x00000000
-#define DSP_MMU_RAM_ELEMENTSIZE_16	0x00000080
-#define DSP_MMU_RAM_ELEMENTSIZE_32	0x00000100
-#define DSP_MMU_RAM_ELEMENTSIZE_NONE	0x00000180
-#define DSP_MMU_RAM_MIXED		0x00000040
-
-#define DSP_MMU_GFLUSH_GFLUSH		0x00000001
-
-#define DSP_MMU_FLUSH_ENTRY_FLUSH_ENTRY	0x00000001
-
-#define DSP_MMU_LD_TLB_LD		0x00000001
-
-/*
  * DSP ICR
  */
 #define DSPREG_ICR_RESERVED_BITS	0xfc00
-- 
1.5.3.rc3.24.g83b3d

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

* [PATCH 3/8] DSPGW: Remove CONFIG_OMAP_DSP_TASK_MULTIOPEN
  2007-07-30 11:03 ` [PATCH 2/8] " Hiroshi.DOYU
@ 2007-07-30 11:04   ` Hiroshi.DOYU
  2007-07-30 11:04     ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Hiroshi.DOYU
  0 siblings, 1 reply; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:04 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

This MULTIOPEN feature should always be enabled.

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/plat-omap/dsp/Kconfig |    7 -------
 arch/arm/plat-omap/dsp/task.c  |    7 -------
 2 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/arch/arm/plat-omap/dsp/Kconfig b/arch/arm/plat-omap/dsp/Kconfig
index 0d62bee..122164a 100644
--- a/arch/arm/plat-omap/dsp/Kconfig
+++ b/arch/arm/plat-omap/dsp/Kconfig
@@ -14,13 +14,6 @@ config OMAP_DSP_MBCMD_VERBOSE
           This enables kernel log output in the Mailbox command exchanges
 	  in the DSP Gateway driver.
 
-config OMAP_DSP_TASK_MULTIOPEN
-	bool "DSP Task Multiopen Capability"
-	depends on OMAP_DSP
-	help
-          This enables DSP tasks to be opened by multiple times at a time.
-	  Otherwise, they can be opened only once at a time.
-
 config OMAP_DSP_FBEXPORT
 	bool "Framebuffer export to DSP"
 	depends on OMAP_DSP && FB
diff --git a/arch/arm/plat-omap/dsp/task.c b/arch/arm/plat-omap/dsp/task.c
index f2ccbdf..b43f704 100644
--- a/arch/arm/plat-omap/dsp/task.c
+++ b/arch/arm/plat-omap/dsp/task.c
@@ -1453,13 +1453,6 @@ static int dsp_task_open(struct inode *inode, struct file *file)
 	}
 
  attached:
-	/* ATTACHED */
-#ifndef CONFIG_OMAP_DSP_TASK_MULTIOPEN
-	if (dev->usecount > 0) {
-		up_write(&dev->state_sem);
-		return -EBUSY;
-	}
-#endif
 	ret = proc_list_add(&dev->proc_list_lock,
 			    &dev->proc_list, current, file);
 	if (ret)
-- 
1.5.3.rc3.24.g83b3d

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

* [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly
  2007-07-30 11:04   ` [PATCH 3/8] DSPGW: Remove CONFIG_OMAP_DSP_TASK_MULTIOPEN Hiroshi.DOYU
@ 2007-07-30 11:04     ` Hiroshi.DOYU
  2007-07-30 11:04       ` [PATCH 5/8] DSPGW: Use kfifo APIs instead of homemade ones Hiroshi.DOYU
  2007-08-06 13:31       ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Trilok Soni
  0 siblings, 2 replies; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:04 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 include/linux/kfifo.h |   35 ++++++++++++++++++++++++++++++
 kernel/kfifo.c        |   57 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 404f446..2dd610d 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -43,6 +43,9 @@ extern unsigned int __kfifo_put(struct kfifo *fifo,
 				unsigned char *buffer, unsigned int len);
 extern unsigned int __kfifo_get(struct kfifo *fifo,
 				unsigned char *buffer, unsigned int len);
+extern unsigned int __kfifo_get_to_user(struct kfifo *fifo,
+					unsigned char __user *buffer,
+					unsigned int len);
 
 /**
  * __kfifo_reset - removes the entire FIFO contents, no locking version
@@ -151,6 +154,38 @@ static inline unsigned int kfifo_len(struct kfifo *fifo)
 	return ret;
 }
 
+/**
+ * kfifo_get_to_user - gets some data from the FIFO
+ * @fifo: the fifo to be used.
+ * @buffer: where the data must be copied. user buffer
+ * @len: the size of the destination buffer.
+ *
+ * This function copies at most @len bytes from the FIFO into the
+ * user @buffer and returns the number of copied bytes.
+ */
+static inline unsigned int kfifo_get_to_user(struct kfifo *fifo,
+					     unsigned char __user *buffer,
+					     unsigned int len)
+{
+	unsigned long flags;
+	unsigned int ret;
+
+	spin_lock_irqsave(fifo->lock, flags);
+
+	ret = __kfifo_get_to_user(fifo, buffer, len);
+
+	/*
+	 * optimization: if the FIFO is empty, set the indices to 0
+	 * so we don't wrap the next time
+	 */
+	if (fifo->in == fifo->out)
+		fifo->in = fifo->out = 0;
+
+	spin_unlock_irqrestore(fifo->lock, flags);
+
+	return ret;
+}
+
 #else
 #warning "don't include kernel headers in userspace"
 #endif /* __KERNEL__ */
diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index cee4191..abc62c3 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/kfifo.h>
+#include <linux/uaccess.h>
 
 /**
  * kfifo_init - allocates a new FIFO using a preallocated buffer
@@ -194,3 +195,59 @@ unsigned int __kfifo_get(struct kfifo *fifo,
 	return len;
 }
 EXPORT_SYMBOL(__kfifo_get);
+
+/**
+ * __kfifo_get_to_user - gets some data from the FIFO, no locking version
+ * @fifo: the fifo to be used.
+ * @buffer: where the data must be copied. user buffer.
+ * @len: the size of the destination buffer.
+ *
+ * This function copies at most @len bytes from the FIFO into the
+ * user @buffer and returns the number of copied bytes.
+ *
+ * Note that with only one concurrent reader and one concurrent
+ * writer, you don't need extra locking to use these functions.
+ */
+unsigned int __kfifo_get_to_user(struct kfifo *fifo,
+				 unsigned char __user *buffer,
+				 unsigned int len)
+{
+	unsigned int n1, n2;
+	int ret;
+
+	len = min(len, fifo->in - fifo->out);
+
+	/*
+	 * Ensure that we sample the fifo->in index -before- we
+	 * start removing bytes from the kfifo.
+	 */
+
+	smp_rmb();
+
+	/* first get the data from fifo->out until the end of the buffer */
+	n1 = min(len, fifo->size - (fifo->out & (fifo->size - 1)));
+	n2 = len -n1;
+	ret = copy_to_user(buffer,
+			   fifo->buffer + (fifo->out & (fifo->size - 1)), n1);
+	if (ret) {
+		len = n1 - ret;
+		goto out;
+	}
+
+	/* then get the rest (if any) from the beginning of the buffer */
+	ret = copy_to_user(buffer + n1, fifo->buffer, n2);
+	if (ret)
+		len = n1 + n2 - ret;
+
+	/*
+	 * Ensure that we remove the bytes from the kfifo -before-
+	 * we update the fifo->out index.
+	 */
+out:
+	smp_mb();
+
+	fifo->out += len;
+
+	return len;
+}
+EXPORT_SYMBOL(__kfifo_get_to_user);
-- 
1.5.3.rc3.24.g83b3d

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

* [PATCH 5/8] DSPGW: Use kfifo APIs instead of homemade ones
  2007-07-30 11:04     ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Hiroshi.DOYU
@ 2007-07-30 11:04       ` Hiroshi.DOYU
  2007-07-30 11:04         ` [PATCH 6/8] DSPGW: Use ALIGN macro instead of homemade one Hiroshi.DOYU
  2007-08-06 13:31       ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Trilok Soni
  1 sibling, 1 reply; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:04 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/plat-omap/dsp/fifo.h |  175 -----------------------------------------
 arch/arm/plat-omap/dsp/task.c |   66 +++++++++------
 2 files changed, 39 insertions(+), 202 deletions(-)
 delete mode 100644 arch/arm/plat-omap/dsp/fifo.h

diff --git a/arch/arm/plat-omap/dsp/fifo.h b/arch/arm/plat-omap/dsp/fifo.h
deleted file mode 100644
index c0dc26c..0000000
--- a/arch/arm/plat-omap/dsp/fifo.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * This file is part of OMAP DSP driver (DSP Gateway version 3.3.1)
- *
- * Copyright (C) 2002-2006 Nokia Corporation. All rights reserved.
- *
- * Contact: Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __PLAT_OMAP_DSP_FIFO_H
-#define __PLAT_OMAP_DSP_FIFO_H
-
-struct fifo_struct {
-	spinlock_t lock;
-	char *buf;
-	size_t sz;
-	size_t cnt;
-	unsigned int wp;
-};
-
-static inline int alloc_fifo(struct fifo_struct *fifo, size_t sz)
-{
-	if ((fifo->buf = kmalloc(sz, GFP_KERNEL)) == NULL) {
-		fifo->sz = 0;
-		return -ENOMEM;
-	}
-	fifo->sz = sz;
-	fifo->cnt = 0;
-	fifo->wp = 0;
-	return 0;
-}
-
-static inline int init_fifo(struct fifo_struct *fifo, size_t sz)
-{
-	spin_lock_init(&fifo->lock);
-	return alloc_fifo(fifo, sz);
-}
-
-static inline void free_fifo(struct fifo_struct *fifo)
-{
-	spin_lock(&fifo->lock);
-	if (fifo->buf == NULL) {
-		spin_unlock(&fifo->lock);
-		return;
-	}
-
-	kfree(fifo->buf);
-	fifo->buf = NULL;
-	fifo->sz = 0;
-	spin_unlock(&fifo->lock);
-}
-
-static inline void flush_fifo(struct fifo_struct *fifo)
-{
-	spin_lock(&fifo->lock);
-	fifo->cnt = 0;
-	fifo->wp = 0;
-	spin_unlock(&fifo->lock);
-}
-
-#define fifo_empty(fifo)	((fifo)->cnt == 0)
-
-static inline int realloc_fifo(struct fifo_struct *fifo, size_t sz)
-{
-	int ret = sz;
-
-	spin_lock(&fifo->lock);
-	if (!fifo_empty(fifo)) {
-		ret = -EBUSY;
-		goto out;
-	}
-
-	/* free */
-	if (fifo->buf)
-		kfree(fifo->buf);
-
-	/* alloc */
-	ret = alloc_fifo(fifo, sz);
-
-out:
-	spin_unlock(&fifo->lock);
-	return ret;
-}
-
-static inline void write_word_to_fifo(struct fifo_struct *fifo, u16 word)
-{
-	spin_lock(&fifo->lock);
-	*(u16 *)&fifo->buf[fifo->wp] = word;
-	if ((fifo->wp += 2) == fifo->sz)
-		fifo->wp = 0;
-	if ((fifo->cnt += 2) > fifo->sz)
-		fifo->cnt = fifo->sz;
-	spin_unlock(&fifo->lock);
-}
-
-/*
- * (before)
- *
- * [*******----------*************]
- *         ^wp
- *  <---------------------------->  sz = 30
- *  <----->          <----------->  cnt = 20
- *
- * (read: count=16)
- *  <->              <----------->  count = 16
- *                   <----------->  cnt1 = 13
- *                   ^rp
- *
- * (after)
- * [---****-----------------------]
- *         ^wp
- */
-static inline ssize_t copy_to_user_fm_fifo(char *dst, struct fifo_struct *fifo,
-					   size_t count)
-{
-	int rp;
-	ssize_t ret;
-
-	/* fifo size can be zero */
-	if (fifo->sz == 0)
-		return 0;
-
-	spin_lock(&fifo->lock);
-	if (count > fifo->cnt)
-		count = fifo->cnt;
-
-	if ((rp = fifo->wp - fifo->cnt) >= 0) {
-		/* valid area is straight */
-		if (copy_to_user(dst, &fifo->buf[rp], count)) {
-			ret = -EFAULT;
-			goto out;
-		}
-	} else {
-		int cnt1 = -rp;
-		rp += fifo->sz;
-		if (cnt1 >= count) {
-			/* requested area is straight */
-			if (copy_to_user(dst, &fifo->buf[rp], count)) {
-				ret = -EFAULT;
-				goto out;
-			}
-		} else {
-			if (copy_to_user(dst, &fifo->buf[rp], cnt1)) {
-				ret = -EFAULT;
-				goto out;
-			}
-			if (copy_to_user(dst+cnt1, fifo->buf, count-cnt1)) {
-				ret = -EFAULT;
-				goto out;
-			}
-		}
-	}
-	fifo->cnt -= count;
-	ret = count;
-
-out:
-	spin_unlock(&fifo->lock);
-	return ret;
-}
-
-#endif /* __PLAT_OMAP_DSP_FIFO_H */
diff --git a/arch/arm/plat-omap/dsp/task.c b/arch/arm/plat-omap/dsp/task.c
index b43f704..0e2b5c7 100644
--- a/arch/arm/plat-omap/dsp/task.c
+++ b/arch/arm/plat-omap/dsp/task.c
@@ -33,6 +33,7 @@
 #include <linux/mm.h>
 #include <linux/mutex.h>
 #include <linux/interrupt.h>
+#include <linux/kfifo.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/arch/mailbox.h>
@@ -41,7 +42,6 @@
 #include "dsp_mbcmd.h"
 #include "dsp.h"
 #include "ipbuf.h"
-#include "fifo.h"
 #include "proclist.h"
 
 #define is_aligned(adr,align)	(!((adr)&((align)-1)))
@@ -125,8 +125,9 @@ struct taskdev {
 	/* read stuff */
 	wait_queue_head_t read_wait_q;
 	struct mutex read_mutex;
+	spinlock_t read_lock;
 	union {
-		struct fifo_struct fifo;	/* for active word */
+		struct kfifo *fifo;	/* for active word */
 		struct rcvdt_bk_struct bk;
 	} rcvdt;
 
@@ -356,7 +357,7 @@ static int taskdev_flush_buf(struct taskdev *dev)
 
 	if (sndtyp_wd(ttyp)) {
 		/* word receiving */
-		flush_fifo(&dev->rcvdt.fifo);
+		kfifo_reset(dev->rcvdt.fifo);
 	} else {
 		/* block receiving */
 		struct rcvdt_bk_struct *rcvdt = &dev->rcvdt.bk;
@@ -379,7 +380,6 @@ static int taskdev_flush_buf(struct taskdev *dev)
 static int taskdev_set_fifosz(struct taskdev *dev, unsigned long sz)
 {
 	u16 ttyp = dev->task->ttyp;
-	int stat;
 
 	if (!(sndtyp_wd(ttyp) && sndtyp_acv(ttyp))) {
 		printk(KERN_ERR
@@ -393,15 +393,18 @@ static int taskdev_set_fifosz(struct taskdev *dev, unsigned long sz)
 		return -EINVAL;
 	}
 
-	stat = realloc_fifo(&dev->rcvdt.fifo, sz);
-	if (stat == -EBUSY) {
+	if (kfifo_len(dev->rcvdt.fifo)) {
 		printk(KERN_ERR "omapdsp: buffer is not empty!\n");
-		return stat;
-	} else if (stat < 0) {
+		return -EIO;
+	}
+
+	kfifo_free(dev->rcvdt.fifo);
+	dev->rcvdt.fifo = kfifo_alloc(sz, GFP_KERNEL, &dev->read_lock);
+	if (IS_ERR(dev->rcvdt.fifo)) {
 		printk(KERN_ERR
 		       "omapdsp: unable to change receive buffer size. "
 		       "(%ld bytes for %s)\n", sz, dev->name);
-		return stat;
+		return -ENOMEM;
 	}
 
 	return 0;
@@ -670,10 +673,10 @@ static ssize_t dsp_task_read_wd_acv(struct file *file, char __user *buf,
 
 
 	prepare_to_wait(&dev->read_wait_q, &wait, TASK_INTERRUPTIBLE);
-	if (fifo_empty(&dev->rcvdt.fifo))
+	if (kfifo_len(dev->rcvdt.fifo) == 0)
 		schedule();
 	finish_wait(&dev->read_wait_q, &wait);
-	if (fifo_empty(&dev->rcvdt.fifo)) {
+	if (kfifo_len(dev->rcvdt.fifo) == 0) {
 		/* failure */
 		if (signal_pending(current))
 			ret = -EINTR;
@@ -681,7 +684,7 @@ static ssize_t dsp_task_read_wd_acv(struct file *file, char __user *buf,
 	}
 
 
-	ret = copy_to_user_fm_fifo(buf, &dev->rcvdt.fifo, count);
+	ret = kfifo_get_to_user(dev->rcvdt.fifo, buf, count);
 
  up_out:
 	taskdev_unlock_and_stateunlock(dev, &dev->read_mutex);
@@ -837,14 +840,14 @@ static ssize_t dsp_task_read_wd_psv(struct file *file, char __user *buf,
 
 	mbcompose_send_and_wait(WDREQ, dev->task->tid, 0, &dev->read_wait_q);
 
-	if (fifo_empty(&dev->rcvdt.fifo)) {
+	if (kfifo_len(dev->rcvdt.fifo) == 0) {
 		/* failure */
 		if (signal_pending(current))
 			ret = -EINTR;
 		goto up_out;
 	}
 
-	ret = copy_to_user_fm_fifo(buf, &dev->rcvdt.fifo, count);
+	ret = kfifo_get_to_user(dev->rcvdt.fifo, buf, count);
 
 up_out:
 	taskdev_unlock_and_stateunlock(dev, &dev->read_mutex);
@@ -1125,7 +1128,7 @@ static unsigned int dsp_task_poll(struct file * file, poll_table * wait)
 	poll_wait(file, &dev->read_wait_q, wait);
 	poll_wait(file, &dev->write_wait_q, wait);
 	if (sndtyp_psv(task->ttyp) ||
-	    (sndtyp_wd(task->ttyp) && !fifo_empty(&dev->rcvdt.fifo)) ||
+	    (sndtyp_wd(task->ttyp) && kfifo_len(dev->rcvdt.fifo)) ||
 	    (sndtyp_bk(task->ttyp) && !ipblink_empty(&dev->rcvdt.bk.link)))
 		mask |= POLLIN | POLLRDNORM;
 	if (dev->wsz)
@@ -1764,7 +1767,7 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor)
 	task_dev = device_create(dsp_task_class, NULL,
 				 MKDEV(OMAP_DSP_TASK_MAJOR, minor),
 				 "dsptask%d", (int)minor);
-	
+
 	if (unlikely(IS_ERR(task_dev))) {
 		ret = -EINVAL;
 		goto fail_create_taskclass;
@@ -1815,11 +1818,11 @@ static int taskdev_attach_task(struct taskdev *dev, struct dsptask *task)
 		/* sndtyp_bk */   dsp_task_read_bk_psv;
 	if (sndtyp_wd(ttyp)) {
 		/* word */
-		size_t fifosz;
+		size_t fifosz = sndtyp_psv(ttyp) ? 2:32; /* passive:active */
 
-		fifosz = sndtyp_psv(ttyp) ? 2 :	/* passive */
-			32;	/* active */
-		if (init_fifo(&dev->rcvdt.fifo, fifosz) < 0) {
+		dev->rcvdt.fifo = kfifo_alloc(fifosz, GFP_KERNEL,
+					      &dev->read_lock);
+		if (IS_ERR(dev->rcvdt.fifo)) {
 			printk(KERN_ERR
 			       "omapdsp: unable to allocate receive buffer. "
 			       "(%d bytes for %s)\n", fifosz, dev->name);
@@ -1896,7 +1899,7 @@ static int taskdev_attach_task(struct taskdev *dev, struct dsptask *task)
 	taskdev_flush_buf(dev);
 
 	if (sndtyp_wd(ttyp))
-		free_fifo(&dev->rcvdt.fifo);
+		kfifo_free(dev->rcvdt.fifo);
 
 	dev->task = NULL;
 
@@ -1923,7 +1926,7 @@ static void taskdev_detach_task(struct taskdev *dev)
 	dev->fops.read = NULL;
 	taskdev_flush_buf(dev);
 	if (sndtyp_wd(ttyp))
-		free_fifo(&dev->rcvdt.fifo);
+		kfifo_free(dev->rcvdt.fifo);
 
 	dev->fops.write = NULL;
 	dev->wsz = 0;
@@ -2246,7 +2249,9 @@ long taskdev_state_stale(unsigned char minor)
  */
 void mbox_wdsnd(struct mbcmd *mb)
 {
+	unsigned int n;
 	u8 tid = mb->cmd_l;
+	u16 data = mb->data;
 	struct dsptask *task = dsptask[tid];
 
 	if ((tid >= TASKDEV_MAX) || (task == NULL)) {
@@ -2266,7 +2271,11 @@ void mbox_wdsnd(struct mbcmd *mb)
 		return;
 	}
 
-	write_word_to_fifo(&task->dev->rcvdt.fifo, mb->data);
+	n = kfifo_put(task->dev->rcvdt.fifo, (unsigned char *)&data,
+		      sizeof(data));
+	if (n != sizeof(data))
+		printk(KERN_WARNING "Receive FIFO(%d) is full\n", tid);
+
 	wake_up_interruptible(&task->dev->read_wait_q);
 }
 
@@ -2883,8 +2892,8 @@ static ssize_t ttyp_show(struct device *d, struct device_attribute *attr,
 static ssize_t fifosz_show(struct device *d, struct device_attribute *attr,
 			   char *buf)
 {
-	struct fifo_struct *fifo = &to_taskdev(d)->rcvdt.fifo;
-	return sprintf(buf, "%d\n", fifo->sz);
+	struct kfifo *fifo = to_taskdev(d)->rcvdt.fifo;
+	return sprintf(buf, "%d\n", fifo->size);
 }
 
 static int fifosz_store(struct device *d, struct device_attribute *attr,
@@ -2895,7 +2904,10 @@ static int fifosz_store(struct device *d, struct device_attribute *attr,
 	int ret;
 
 	fifosz = simple_strtol(buf, NULL, 10);
+	if (taskdev_lock_and_statelock_attached(dev, &dev->read_mutex))
+		return -ENODEV;
 	ret = taskdev_set_fifosz(dev, fifosz);
+	taskdev_unlock_and_stateunlock(dev, &dev->read_mutex);
 
 	return (ret < 0) ? ret : strlen(buf);
 }
@@ -2904,8 +2916,8 @@ static int fifosz_store(struct device *d, struct device_attribute *attr,
 static ssize_t fifocnt_show(struct device *d, struct device_attribute *attr,
 			    char *buf)
 {
-	struct fifo_struct *fifo = &to_taskdev(d)->rcvdt.fifo;
-	return sprintf(buf, "%d\n", fifo->cnt);
+	struct kfifo *fifo = to_taskdev(d)->rcvdt.fifo;
+	return sprintf(buf, "%d\n", fifo->size);
 }
 
 /* ipblink */
-- 
1.5.3.rc3.24.g83b3d

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

* [PATCH 6/8] DSPGW: Use ALIGN macro instead of homemade one
  2007-07-30 11:04       ` [PATCH 5/8] DSPGW: Use kfifo APIs instead of homemade ones Hiroshi.DOYU
@ 2007-07-30 11:04         ` Hiroshi.DOYU
  2007-07-30 11:04           ` [PATCH 7/8] ARM: OMAP: Fix Unbalanced enable for IRQ in omap mailbox Hiroshi.DOYU
  0 siblings, 1 reply; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:04 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/plat-omap/dsp/task.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/dsp/task.c b/arch/arm/plat-omap/dsp/task.c
index 0e2b5c7..2b2ab76 100644
--- a/arch/arm/plat-omap/dsp/task.c
+++ b/arch/arm/plat-omap/dsp/task.c
@@ -44,8 +44,6 @@
 #include "ipbuf.h"
 #include "proclist.h"
 
-#define is_aligned(adr,align)	(!((adr)&((align)-1)))
-
 /*
  * devstate: task device state machine
  * NOTASK:	task is not attached.
@@ -493,8 +491,8 @@ static int dsp_task_config(struct dsptask *task, u8 tid)
 
 	/* mmap buffer configuration check */
 	if ((task->map_length > 0) &&
-	    ((!is_aligned((unsigned long)task->map_base, PAGE_SIZE)) ||
-	     (!is_aligned(task->map_length, PAGE_SIZE)) ||
+	    ((!ALIGN((unsigned long)task->map_base, PAGE_SIZE)) ||
+	     (!ALIGN(task->map_length, PAGE_SIZE)) ||
 	     (dsp_mem_type(task->map_base, task->map_length) != MEM_TYPE_EXTERN))) {
 		printk(KERN_ERR
 		       "omapdsp: illegal mmap buffer address(0x%p) or "
-- 
1.5.3.rc3.24.g83b3d

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

* [PATCH 7/8] ARM: OMAP: Fix Unbalanced enable for IRQ in omap mailbox
  2007-07-30 11:04         ` [PATCH 6/8] DSPGW: Use ALIGN macro instead of homemade one Hiroshi.DOYU
@ 2007-07-30 11:04           ` Hiroshi.DOYU
  2007-07-30 11:04             ` [PATCH 8/8] ARM: OMAP: Add MMU TWL support for omap1 Hiroshi.DOYU
  0 siblings, 1 reply; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:04 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/mach-omap1/mailbox.c |   14 +++++++-------
 arch/arm/mach-omap2/mailbox.c |   25 +++++++++++++++----------
 arch/arm/plat-omap/mailbox.c  |    1 -
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index d3abf56..bad1e71 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -51,7 +51,7 @@ static inline void mbox_write_reg(unsigned int val, unsigned int reg)
 }
 
 /* msg */
-static inline mbox_msg_t omap1_mbox_fifo_read(struct omap_mbox *mbox)
+static mbox_msg_t omap1_mbox_fifo_read(struct omap_mbox *mbox)
 {
 	struct omap_mbox1_fifo *fifo =
 		&((struct omap_mbox1_priv *)mbox->priv)->rx_fifo;
@@ -63,7 +63,7 @@ static inline mbox_msg_t omap1_mbox_fifo_read(struct omap_mbox *mbox)
 	return msg;
 }
 
-static inline void
+static void
 omap1_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
 {
 	struct omap_mbox1_fifo *fifo =
@@ -73,12 +73,12 @@ omap1_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
 	mbox_write_reg(msg >> 16, fifo->cmd);
 }
 
-static inline int omap1_mbox_fifo_empty(struct omap_mbox *mbox)
+static int omap1_mbox_fifo_empty(struct omap_mbox *mbox)
 {
 	return 0;
 }
 
-static inline int omap1_mbox_fifo_full(struct omap_mbox *mbox)
+static int omap1_mbox_fifo_full(struct omap_mbox *mbox)
 {
 	struct omap_mbox1_fifo *fifo =
 		&((struct omap_mbox1_priv *)mbox->priv)->rx_fifo;
@@ -87,21 +87,21 @@ static inline int omap1_mbox_fifo_full(struct omap_mbox *mbox)
 }
 
 /* irq */
-static inline void
+static void
 omap1_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
 {
 	if (irq == IRQ_RX)
 		enable_irq(mbox->irq);
 }
 
-static inline void
+static void
 omap1_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
 {
 	if (irq == IRQ_RX)
 		disable_irq(mbox->irq);
 }
 
-static inline int
+static int
 omap1_mbox_is_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
 {
 	if (irq == IRQ_TX)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index b03cd06..4799561 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -70,6 +70,9 @@ struct omap_mbox2_priv {
 
 static struct clk *mbox_ick_handle;
 
+static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
+				  omap_mbox_type_t irq);
+
 static inline unsigned int mbox_read_reg(unsigned int reg)
 {
 	return __raw_readl(mbox_base + reg);
@@ -81,7 +84,7 @@ static inline void mbox_write_reg(unsigned int val, unsigned int reg)
 }
 
 /* Mailbox H/W preparations */
-static inline int omap2_mbox_startup(struct omap_mbox *mbox)
+static int omap2_mbox_startup(struct omap_mbox *mbox)
 {
 	unsigned int l;
 
@@ -97,38 +100,40 @@ static inline int omap2_mbox_startup(struct omap_mbox *mbox)
 	l |= 0x00000011;
 	mbox_write_reg(l, MAILBOX_SYSCONFIG);
 
+	omap2_mbox_enable_irq(mbox, IRQ_RX);
+
 	return 0;
 }
 
-static inline void omap2_mbox_shutdown(struct omap_mbox *mbox)
+static void omap2_mbox_shutdown(struct omap_mbox *mbox)
 {
 	clk_disable(mbox_ick_handle);
 	clk_put(mbox_ick_handle);
 }
 
 /* Mailbox FIFO handle functions */
-static inline mbox_msg_t omap2_mbox_fifo_read(struct omap_mbox *mbox)
+static mbox_msg_t omap2_mbox_fifo_read(struct omap_mbox *mbox)
 {
 	struct omap_mbox2_fifo *fifo =
 		&((struct omap_mbox2_priv *)mbox->priv)->rx_fifo;
 	return (mbox_msg_t) mbox_read_reg(fifo->msg);
 }
 
-static inline void omap2_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
+static void omap2_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
 {
 	struct omap_mbox2_fifo *fifo =
 		&((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
 	mbox_write_reg(msg, fifo->msg);
 }
 
-static inline int omap2_mbox_fifo_empty(struct omap_mbox *mbox)
+static int omap2_mbox_fifo_empty(struct omap_mbox *mbox)
 {
 	struct omap_mbox2_fifo *fifo =
 		&((struct omap_mbox2_priv *)mbox->priv)->rx_fifo;
 	return (mbox_read_reg(fifo->msg_stat) == 0);
 }
 
-static inline int omap2_mbox_fifo_full(struct omap_mbox *mbox)
+static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 {
 	struct omap_mbox2_fifo *fifo =
 		&((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
@@ -136,7 +141,7 @@ static inline int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 }
 
 /* Mailbox IRQ handle functions */
-static inline void omap2_mbox_enable_irq(struct omap_mbox *mbox,
+static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
 		omap_mbox_type_t irq)
 {
 	struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
@@ -147,7 +152,7 @@ static inline void omap2_mbox_enable_irq(struct omap_mbox *mbox,
 	mbox_write_reg(l, p->irqenable);
 }
 
-static inline void omap2_mbox_disable_irq(struct omap_mbox *mbox,
+static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 		omap_mbox_type_t irq)
 {
 	struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
@@ -158,7 +163,7 @@ static inline void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 	mbox_write_reg(l, p->irqenable);
 }
 
-static inline void omap2_mbox_ack_irq(struct omap_mbox *mbox,
+static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
 		omap_mbox_type_t irq)
 {
 	struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
@@ -167,7 +172,7 @@ static inline void omap2_mbox_ack_irq(struct omap_mbox *mbox,
 	mbox_write_reg(bit, p->irqstatus);
 }
 
-static inline int omap2_mbox_is_irq(struct omap_mbox *mbox,
+static int omap2_mbox_is_irq(struct omap_mbox *mbox,
 		omap_mbox_type_t irq)
 {
 	struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv;
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index de7e6ef..91efd16 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -359,7 +359,6 @@ static int omap_mbox_init(struct omap_mbox *mbox)
 			"failed to register mailbox interrupt:%d\n", ret);
 		goto fail_request_irq;
 	}
-	enable_mbox_irq(mbox, IRQ_RX);
 
 	mq = mbox_queue_alloc(mbox, mbox_txq_fn, mbox_tx_work);
 	if (!mq) {
-- 
1.5.3.rc3.24.g83b3d

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

* [PATCH 8/8] ARM: OMAP: Add MMU TWL support for omap1
  2007-07-30 11:04           ` [PATCH 7/8] ARM: OMAP: Fix Unbalanced enable for IRQ in omap mailbox Hiroshi.DOYU
@ 2007-07-30 11:04             ` Hiroshi.DOYU
  0 siblings, 0 replies; 11+ messages in thread
From: Hiroshi.DOYU @ 2007-07-30 11:04 UTC (permalink / raw)
  To: linux-omap-open-source; +Cc: Hiroshi DOYU

From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>

Table Walking Logic(TWL) is supported in omap1.

Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/mach-omap1/mmu.c |   11 ++++++++++-
 arch/arm/plat-omap/mmu.c  |   45 +++++++++++++++++++--------------------------
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-omap1/mmu.c b/arch/arm/mach-omap1/mmu.c
index 876952e..66aa0d4 100644
--- a/arch/arm/mach-omap1/mmu.c
+++ b/arch/arm/mach-omap1/mmu.c
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap2/mmu.c
+ * linux/arch/arm/mach-omap1/mmu.c
  *
  * Support for non-MPU OMAP1 MMUs.
  *
@@ -329,6 +329,14 @@ static void omap1_mmu_interrupt(struct omap_mmu *mmu)
 	schedule_work(&mmu->irq_work);
 }
 
+static pgprot_t omap1_mmu_pte_get_attr(struct omap_mmu_tlb_entry *entry)
+{
+	/* 4KB AP position as default */
+	u32 attr = entry->ap >> 4;
+	attr <<= ((entry->pgsz == OMAP_MMU_CAM_PAGESIZE_1MB) ? 6:0);
+	return attr;
+}
+
 struct omap_mmu_ops omap1_mmu_ops = {
 	.startup	= omap1_mmu_startup,
 	.shutdown	= omap1_mmu_shutdown,
@@ -341,5 +349,6 @@ struct omap_mmu_ops omap1_mmu_ops = {
 	.cam_ram_alloc	= omap1_mmu_cam_ram_alloc,
 	.cam_ram_valid	= omap1_mmu_cam_ram_valid,
 	.interrupt	= omap1_mmu_interrupt,
+	.pte_get_attr	= omap1_mmu_pte_get_attr,
 };
 EXPORT_SYMBOL_GPL(omap1_mmu_ops);
diff --git a/arch/arm/plat-omap/mmu.c b/arch/arm/plat-omap/mmu.c
index cb675d4..b6ec844 100644
--- a/arch/arm/plat-omap/mmu.c
+++ b/arch/arm/plat-omap/mmu.c
@@ -684,12 +684,10 @@ int omap_mmu_load_pte_entry(struct omap_mmu *mmu,
 			    struct omap_mmu_tlb_entry *entry)
 {
 	int ret = -1;
-	if ((!entry->prsvd) && (mmu->ops->pte_get_attr)) {
-		/*XXX use PG_flag for prsvd */
-		ret = omap_mmu_load_pte(mmu, entry);
-		if (ret)
-			return ret;
-	}
+	/*XXX use PG_flag for prsvd */
+	ret = omap_mmu_load_pte(mmu, entry);
+	if (ret)
+		return ret;
 	if (entry->tlb)
 		ret = omap_mmu_load_tlb_entry(mmu, entry);
 	return ret;
@@ -701,8 +699,7 @@ int omap_mmu_clear_pte_entry(struct omap_mmu *mmu, unsigned long vadr)
 	int ret = omap_mmu_clear_tlb_entry(mmu, vadr);
 	if (ret)
 		return ret;
-	if (mmu->ops->pte_get_attr)
-		omap_mmu_clear_pte(mmu, vadr);
+	omap_mmu_clear_pte(mmu, vadr);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(omap_mmu_clear_pte_entry);
@@ -1035,17 +1032,18 @@ EXPORT_SYMBOL_GPL(omap_mmu_disable);
 
 void omap_mmu_enable(struct omap_mmu *mmu, int reset)
 {
-	u32 val = OMAP_MMU_CNTL_MMU_EN;
+	u32 val = OMAP_MMU_CNTL_MMU_EN | MMU_CNTL_TWLENABLE;
 
 	if (likely(reset))
 		omap_mmu_reset(mmu);
 #if defined(CONFIG_ARCH_OMAP2) /* FIXME */
-	if (mmu->ops->pte_get_attr) {
-		omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd),
-				   OMAP_MMU_TTB);
-		val |= MMU_CNTL_TWLENABLE;
-	}
+	omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd),
+			   OMAP_MMU_TTB);
 #else
+	omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd) & 0xffff,
+			   OMAP_MMU_TTB_L);
+	omap_mmu_write_reg(mmu, (u32)virt_to_phys(mmu->twl_mm->pgd) >> 16,
+			   OMAP_MMU_TTB_H);
 	val |= OMAP_MMU_CNTL_RESET_SW;
 #endif
 	omap_mmu_write_reg(mmu, val, OMAP_MMU_CNTL);
@@ -1462,13 +1460,10 @@ int omap_mmu_register(struct omap_mmu *mmu)
 	if (!mmu->exmap_tbl)
 		return -ENOMEM;
 
-	if (mmu->ops->pte_get_attr) {
-		struct mm_struct *mm =  mm_alloc();
-		if (!mm) {
-			ret = -ENOMEM;
-			goto err_mm_alloc;
-		}
-		mmu->twl_mm = mm;
+	mmu->twl_mm = mm_alloc();
+	if (!mmu->twl_mm) {
+		ret = -ENOMEM;
+		goto err_mm_alloc;
 	}
 
 	ret = device_register(&mmu->dev);
@@ -1531,11 +1526,9 @@ void omap_mmu_unregister(struct omap_mmu *mmu)
 	kfree(mmu->exmap_tbl);
 	mmu->exmap_tbl = NULL;
 
-	if (mmu->ops->pte_get_attr) {
-		if (mmu->twl_mm) {
-			__mmdrop(mmu->twl_mm);
-			mmu->twl_mm = NULL;
-		}
+	if (mmu->twl_mm) {
+		__mmdrop(mmu->twl_mm);
+		mmu->twl_mm = NULL;
 	}
 
 	device_unregister(&mmu->dev);
-- 
1.5.3.rc3.24.g83b3d

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

* Re: [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly
  2007-07-30 11:04     ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Hiroshi.DOYU
  2007-07-30 11:04       ` [PATCH 5/8] DSPGW: Use kfifo APIs instead of homemade ones Hiroshi.DOYU
@ 2007-08-06 13:31       ` Trilok Soni
  2007-08-07  9:58         ` Hiroshi DOYU
  1 sibling, 1 reply; 11+ messages in thread
From: Trilok Soni @ 2007-08-06 13:31 UTC (permalink / raw)
  To: Hiroshi.DOYU@nokia.com; +Cc: linux-omap-open-source

Hi Doyu-San,

On 7/30/07, Hiroshi.DOYU@nokia.com <Hiroshi.DOYU@nokia.com> wrote:
> From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
>
> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
> ---
>  include/linux/kfifo.h |   35 ++++++++++++++++++++++++++++++
>  kernel/kfifo.c        |   57 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 92 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
> index 404f446..2dd610d 100644
> --- a/include/linux/kfifo.h
> +++ b/include/linux/kfifo.h
> @@ -43,6 +43,9 @@ extern unsigned int __kfifo_put(struct kfifo *fifo,
>                                 unsigned char *buffer, unsigned int len);
>  extern unsigned int __kfifo_get(struct kfifo *fifo,
>                                 unsigned char *buffer, unsigned int len);
> +extern unsigned int __kfifo_get_to_user(struct kfifo *fifo,
> +                                       unsigned char __user *buffer,
> +                                       unsigned int len);
>

Thanx. Finally that local fifo implementation is gone. Could you
please submit this patch to LKML also?

-- 
--Trilok Soni

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

* Re: [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly
  2007-08-06 13:31       ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Trilok Soni
@ 2007-08-07  9:58         ` Hiroshi DOYU
  2007-08-10  9:20           ` Tony Lindgren
  0 siblings, 1 reply; 11+ messages in thread
From: Hiroshi DOYU @ 2007-08-07  9:58 UTC (permalink / raw)
  To: soni.trilok; +Cc: linux-omap-open-source

From: "ext Trilok Soni" <soni.trilok@gmail.com>
Subject: Re: [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly
Date: Mon, 6 Aug 2007 19:01:10 +0530

> Hi Doyu-San,
> 
> On 7/30/07, Hiroshi.DOYU@nokia.com <Hiroshi.DOYU@nokia.com> wrote:
> > From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
> >
> > Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
> > ---
> >  include/linux/kfifo.h |   35 ++++++++++++++++++++++++++++++
> >  kernel/kfifo.c        |   57 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 92 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
> > index 404f446..2dd610d 100644
> > --- a/include/linux/kfifo.h
> > +++ b/include/linux/kfifo.h
> > @@ -43,6 +43,9 @@ extern unsigned int __kfifo_put(struct kfifo *fifo,
> >                                 unsigned char *buffer, unsigned int len);
> >  extern unsigned int __kfifo_get(struct kfifo *fifo,
> >                                 unsigned char *buffer, unsigned int len);
> > +extern unsigned int __kfifo_get_to_user(struct kfifo *fifo,
> > +                                       unsigned char __user *buffer,
> > +                                       unsigned int len);
> >
> 
> Thanx. Finally that local fifo implementation is gone. Could you
> please submit this patch to LKML also?

I got it. In that case, "__kfifo_put_from_user()" may be also necessary.

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

* Re: [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly
  2007-08-07  9:58         ` Hiroshi DOYU
@ 2007-08-10  9:20           ` Tony Lindgren
  0 siblings, 0 replies; 11+ messages in thread
From: Tony Lindgren @ 2007-08-10  9:20 UTC (permalink / raw)
  To: Hiroshi DOYU; +Cc: linux-omap-open-source

Hi,

* Hiroshi DOYU <Hiroshi.DOYU@nokia.com> [070807 04:19]:
> From: "ext Trilok Soni" <soni.trilok@gmail.com>
> Subject: Re: [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly
> Date: Mon, 6 Aug 2007 19:01:10 +0530
> 
> > Hi Doyu-San,
> > 
> > On 7/30/07, Hiroshi.DOYU@nokia.com <Hiroshi.DOYU@nokia.com> wrote:
> > > From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
> > >
> > > Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
> > > ---
> > >  include/linux/kfifo.h |   35 ++++++++++++++++++++++++++++++
> > >  kernel/kfifo.c        |   57 +++++++++++++++++++++++++++++++++++++++++++++++++
> > >  2 files changed, 92 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
> > > index 404f446..2dd610d 100644
> > > --- a/include/linux/kfifo.h
> > > +++ b/include/linux/kfifo.h
> > > @@ -43,6 +43,9 @@ extern unsigned int __kfifo_put(struct kfifo *fifo,
> > >                                 unsigned char *buffer, unsigned int len);
> > >  extern unsigned int __kfifo_get(struct kfifo *fifo,
> > >                                 unsigned char *buffer, unsigned int len);
> > > +extern unsigned int __kfifo_get_to_user(struct kfifo *fifo,
> > > +                                       unsigned char __user *buffer,
> > > +                                       unsigned int len);
> > >
> > 
> > Thanx. Finally that local fifo implementation is gone. Could you
> > please submit this patch to LKML also?
> 
> I got it. In that case, "__kfifo_put_from_user()" may be also necessary.

Pushing the series today. Yeah, please send the kfifo patches to LKML
for review and integration.

Regards,

Tony

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

end of thread, other threads:[~2007-08-10  9:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-30 11:03 [PATCH 1/8] ARM: OMAP: Fix omap mmu framework for omap1 Hiroshi.DOYU
2007-07-30 11:03 ` [PATCH 2/8] " Hiroshi.DOYU
2007-07-30 11:04   ` [PATCH 3/8] DSPGW: Remove CONFIG_OMAP_DSP_TASK_MULTIOPEN Hiroshi.DOYU
2007-07-30 11:04     ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Hiroshi.DOYU
2007-07-30 11:04       ` [PATCH 5/8] DSPGW: Use kfifo APIs instead of homemade ones Hiroshi.DOYU
2007-07-30 11:04         ` [PATCH 6/8] DSPGW: Use ALIGN macro instead of homemade one Hiroshi.DOYU
2007-07-30 11:04           ` [PATCH 7/8] ARM: OMAP: Fix Unbalanced enable for IRQ in omap mailbox Hiroshi.DOYU
2007-07-30 11:04             ` [PATCH 8/8] ARM: OMAP: Add MMU TWL support for omap1 Hiroshi.DOYU
2007-08-06 13:31       ` [PATCH 4/8] Add kfifo_get_to_user to copy data to userland directly Trilok Soni
2007-08-07  9:58         ` Hiroshi DOYU
2007-08-10  9:20           ` Tony Lindgren

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