linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH /RFC] sh: landisk: Fix ioremap address for CF I/O window
@ 2011-01-07  2:59 Nobuhiro Iwamatsu
  2011-01-11  5:31 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Nobuhiro Iwamatsu @ 2011-01-07  2:59 UTC (permalink / raw)
  To: linux-sh

By commit f33609344acfdde1c1acedf6de3efe6b80af93a6, it was revised
by p3_ioremap to use ioremap_prot.
However, CF I/O window is not usable because this did not map to P3 area
This changes from ioremap_prot to __ioremap.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 arch/sh/boards/mach-landisk/setup.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/sh/boards/mach-landisk/setup.c b/arch/sh/boards/mach-landisk/setup.c
index 94186cf..e1fb98b 100644
--- a/arch/sh/boards/mach-landisk/setup.c
+++ b/arch/sh/boards/mach-landisk/setup.c
@@ -1,5 +1,5 @@
 /*
- * arch/sh/boards/landisk/setup.c
+ * arch/sh/boards/mach-landisk/setup.c
  *
  * I-O DATA Device, Inc. LANDISK Support.
  *
@@ -7,6 +7,7 @@
  * Copyright (C) 2002 Paul Mundt
  * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
  * Copyright (C) 2005-2007 kogiidena
+ * Copyright (C) 2011 Nobuhiro Iwamatsu
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -17,13 +18,13 @@
 #include <linux/ata_platform.h>
 #include <linux/pm.h>
 #include <linux/mm.h>
+#include <linux/io.h>
 #include <asm/machvec.h>
 #include <mach-landisk/mach/iodata_landisk.h>
-#include <asm/io.h>
 
 static void landisk_power_off(void)
 {
-        __raw_writeb(0x01, PA_SHUTDOWN);
+	__raw_writeb(0x01, PA_SHUTDOWN);
 }
 
 static struct resource cf_ide_resources[3];
@@ -61,9 +62,10 @@ static int __init landisk_devices_setup(void)
 	/* open I/O area window */
 	paddrbase = virt_to_phys((void *)PA_AREA5_IO);
 	prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
-	cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
+	cf_ide_base +		__ioremap(paddrbase, PAGE_SIZE, __pgprot(pgprot_val(prot)));
 	if (!cf_ide_base) {
-		printk("allocate_cf_area : can't open CF I/O window!\n");
+		printk(KERN_ERR "allocate_cf_area : can't open CF I/O window!\n");
 		return -ENOMEM;
 	}
 
@@ -85,7 +87,7 @@ device_initcall(landisk_devices_setup);
 
 static void __init landisk_setup(char **cmdline_p)
 {
-        /* LED ON */
+  	/* LED ON */
 	__raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
 
 	printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
@@ -97,7 +99,6 @@ static void __init landisk_setup(char **cmdline_p)
  */
 static struct sh_machine_vector mv_landisk __initmv = {
 	.mv_name = "LANDISK",
-	.mv_nr_irqs = 72,
 	.mv_setup = landisk_setup,
 	.mv_init_irq = init_landisk_IRQ,
 };
-- 
1.7.2.3


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

* Re: [PATCH /RFC] sh: landisk: Fix ioremap address for CF I/O window
  2011-01-07  2:59 [PATCH /RFC] sh: landisk: Fix ioremap address for CF I/O window Nobuhiro Iwamatsu
@ 2011-01-11  5:31 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2011-01-11  5:31 UTC (permalink / raw)
  To: linux-sh

On Fri, Jan 07, 2011 at 12:03:47PM +0900, Nobuhiro Iwamatsu wrote:
> By commit f33609344acfdde1c1acedf6de3efe6b80af93a6, it was revised
> by p3_ioremap to use ioremap_prot.
> However, CF I/O window is not usable because this did not map to P3 area
> This changes from ioremap_prot to __ioremap.
> 
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Does this work for you?

---

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 70c1186..6c4d156 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -290,6 +290,14 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
 	 * mapping must be done by the PMB or by using page tables.
 	 */
 	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
+		u64 flags = pgprot_val(prot);
+
+		/*
+		 * Anything using the legacy PTEA space attributes needs
+		 * to be kicked down to page table mappings.
+		 */
+		if (unlikely(flags & _PAGE_PCC_MASK))
+			return NULL;
 		if (unlikely(pgprot_val(prot) & _PAGE_CACHABLE))
 			return (void __iomem *)P1SEGADDR(offset);
 
diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
index 43528ec..f76b90f 100644
--- a/arch/sh/include/asm/pgtable_32.h
+++ b/arch/sh/include/asm/pgtable_32.h
@@ -76,6 +76,12 @@
 /* Wrapper for extended mode pgprot twiddling */
 #define _PAGE_EXT(x)		((unsigned long long)(x) << 32)
 
+#ifdef CONFIG_X2TLB
+
+#define _PAGE_PCC_MASK	0x00000000	/* No legacy PTEA support */
+
+#else
+
 /* software: moves to PTEA.TC (Timing Control) */
 #define _PAGE_PCC_AREA5	0x00000000	/* use BSC registers for area5 */
 #define _PAGE_PCC_AREA6	0x80000000	/* use BSC registers for area6 */
@@ -89,7 +95,8 @@
 #define _PAGE_PCC_ATR8	0x60000000	/* Attribute Memory space, 8 bit bus */
 #define _PAGE_PCC_ATR16	0x60000001	/* Attribute Memory space, 6 bit bus */
 
-#ifndef CONFIG_X2TLB
+#define _PAGE_PCC_MASK	0xe0000001
+
 /* copy the ptea attributes */
 static inline unsigned long copy_ptea_attributes(unsigned long x)
 {
@@ -231,13 +238,7 @@ static inline unsigned long copy_ptea_attributes(unsigned long x)
 					   _PAGE_EXT_KERN_EXEC))
 
 #define PAGE_KERNEL_PCC(slot, type) \
-			__pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
-				 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
-				 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
-					   _PAGE_EXT_KERN_WRITE | \
-					   _PAGE_EXT_KERN_EXEC) \
-				 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
-				 (type))
+			__pgprot(0)
 
 #elif defined(CONFIG_MMU) /* SH-X TLB */
 #define PAGE_NONE	__pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \

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

end of thread, other threads:[~2011-01-11  5:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-07  2:59 [PATCH /RFC] sh: landisk: Fix ioremap address for CF I/O window Nobuhiro Iwamatsu
2011-01-11  5:31 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).