Skip to contentSkip to conversation

Clean up some io.h and associated code

PATCH New Russell King - ARM Linux 2 participants 14 messages Aug 17, 2011 – Aug 21, 2011

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

cover Clean up some io.h and associated code

This series does some cleanup of the mach/io.h header files and associated definitions, including getting rid of quite a lot of IO_SPACE_LIMIT definitions.

#1 lore raw

PATCH 1/10 ARM: io: s3c2410: remove ioaddr()

There is only one user of ioaddr() in the kernel, and that is the Acorn expansion card core code. S3C2410 does not use this code, and so the definition of ioaddr() is redundant.

---
 arch/arm/mach-s3c2410/include/mach/io.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/mach-s3c2410/include/mach/io.h +0 -2
index 9813dbf..118749f 100644
@@ -199,8 +199,6 @@ DECLARE_IO(int,l,"")
 #define outw(v,p)	(__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
 #define outl(v,p)	(__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
 #define __ioaddr(p)	(__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
-/* the following macro is deprecated */
-#define ioaddr(port)	__ioaddr((port))
 
 #define insb(p,d,l)	__raw_readsb(__ioaddr(p),d,l)
 #define insw(p,d,l)	__raw_readsw(__ioaddr(p),d,l)
Signature · 1 line
1.7.4.4
#2 lore raw

PATCH 2/10 ARM: io: RiscPC: define io addresses relative to IO_BASE

In reply to Russell King - ARM Linux
---
 arch/arm/mach-rpc/include/mach/hardware.h |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-rpc/include/mach/hardware.h +6 -6
index dde6b3c..822b810 100644
@@ -51,12 +51,12 @@
 /*
  * IO Addresses
  */
-#define VIDC_BASE		IOMEM(0xe0400000)
-#define EXPMASK_BASE		0xe0360000
-#define IOMD_BASE		IOMEM(0xe0200000)
-#define IOC_BASE		IOMEM(0xe0200000)
-#define PCIO_BASE		IOMEM(0xe0010000)
-#define FLOPPYDMA_BASE		IOMEM(0xe002a000)
+#define VIDC_BASE		(IO_BASE + 0x00400000)
+#define EXPMASK_BASE		(IO_BASE + 0x00360000)
+#define IOMD_BASE		(IO_BASE + 0x00200000)
+#define IOC_BASE		(IO_BASE + 0x00200000)
+#define FLOPPYDMA_BASE		(IO_BASE + 0x0002a000)
+#define PCIO_BASE		(IO_BASE + 0x00010000)
 
 #define vidc_writel(val)	__raw_writel(val, VIDC_BASE)
 
Signature · 1 line
1.7.4.4
#3 lore raw

PATCH 3/10 ARM: io: ecard: move ioaddr() inside __ecard_address

In reply to Russell King - ARM Linux
---
 arch/arm/include/asm/ecard.h |    1 -
 arch/arm/kernel/ecard.c      |   11 ++++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/asm/ecard.h +0 -1
index 29f2610..eaea146 100644
@@ -161,7 +161,6 @@ struct expansion_card {
 
 	/* Private internal data */
 	const char		*card_desc;	/* Card description		*/
-	CONST unsigned int	podaddr;	/* Base Linux address for card	*/
 	CONST loader_t		loader;		/* loader program */
 	u64			dma_mask;
 };
arch/arm/kernel/ecard.c +6 -5
index d165001..920f1a3 100644
@@ -678,13 +678,13 @@ static int __init ecard_probeirqhw(void)
 #define IO_EC_MEMC8_BASE 0
 #endif
 
-static unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
+static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
 {
 	unsigned long address = 0;
 	int slot = ec->slot_no;
 
 	if (ec->slot_no == 8)
-		return IO_EC_MEMC8_BASE;
+		return (void __iomem *)ioaddr(IO_EC_MEMC8_BASE);
 
 	ectcr &= ~(1 << slot);
 
@@ -719,7 +719,7 @@ static unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t
 #ifdef IOMD_ECTCR
 	iomd_writeb(ectcr, IOMD_ECTCR);
 #endif
-	return address;
+	return (void __iomem *)(address ? ioaddr(address) : NULL);
 }
 
 static int ecard_prints(struct seq_file *m, ecard_t *ec)
@@ -990,6 +990,7 @@ ecard_probe(int slot, card_type_t type)
 	ecard_t **ecp;
 	ecard_t *ec;
 	struct ex_ecid cid;
+	void __iomem *addr;
 	int i, rc;
 
 	ec = ecard_alloc_card(type, slot);
@@ -999,7 +1000,7 @@ ecard_probe(int slot, card_type_t type)
 	}
 
 	rc = -ENODEV;
-	if ((ec->podaddr = __ecard_address(ec, type, ECARD_SYNC)) == 0)
+	if ((addr = __ecard_address(ec, type, ECARD_SYNC)) == NULL)
 		goto nodev;
 
 	cid.r_zero = 1;
@@ -1019,7 +1020,7 @@ ecard_probe(int slot, card_type_t type)
 	ec->cid.fiqmask = cid.r_fiqmask;
 	ec->cid.fiqoff  = ecard_gets24(cid.r_fiqoff);
 	ec->fiqaddr	=
-	ec->irqaddr	= (void __iomem *)ioaddr(ec->podaddr);
+	ec->irqaddr	= addr;
 
 	if (ec->cid.is) {
 		ec->irqmask = ec->cid.irqmask;
Signature · 1 line
1.7.4.4
#4 lore raw

PATCH 4/10 ARM: io: ecard: remove ioaddr() from ecard.c

In reply to Russell King - ARM Linux

Remove ioaddr() usage from ecard.c, updating (and renaming) the constants in RiscPC's hardware.h to contain the proper translation. As this gets rid of the last ioaddr() usage, kill that too.

---
 arch/arm/kernel/ecard.c                   |   29 +++++++++--------------------
 arch/arm/mach-rpc/include/mach/hardware.h |   11 +++++------
 arch/arm/mach-rpc/include/mach/io.h       |    3 ---
 3 files changed, 14 insertions(+), 29 deletions(-)
arch/arm/kernel/ecard.c +9 -20
index 920f1a3..3e84f66 100644
@@ -674,44 +674,37 @@ static int __init ecard_probeirqhw(void)
 #define ecard_probeirqhw() (0)
 #endif
 
-#ifndef IO_EC_MEMC8_BASE
-#define IO_EC_MEMC8_BASE 0
-#endif
-
 static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
 {
-	unsigned long address = 0;
+	void __iomem *address = NULL;
 	int slot = ec->slot_no;
 
 	if (ec->slot_no == 8)
-		return (void __iomem *)ioaddr(IO_EC_MEMC8_BASE);
+		return ECARD_MEMC8_BASE;
 
 	ectcr &= ~(1 << slot);
 
 	switch (type) {
 	case ECARD_MEMC:
 		if (slot < 4)
-			address = IO_EC_MEMC_BASE + (slot << 12);
+			address = ECARD_MEMC_BASE + (slot << 14);
 		break;
 
 	case ECARD_IOC:
 		if (slot < 4)
-			address = IO_EC_IOC_BASE + (slot << 12);
-#ifdef IO_EC_IOC4_BASE
+			address = ECARD_IOC_BASE + (slot << 14);
 		else
-			address = IO_EC_IOC4_BASE + ((slot - 4) << 12);
-#endif
+			address = ECARD_IOC4_BASE + ((slot - 4) << 14);
 		if (address)
-			address +=  speed << 17;
+			address += speed << 19;
 		break;
 
-#ifdef IO_EC_EASI_BASE
 	case ECARD_EASI:
-		address = IO_EC_EASI_BASE + (slot << 22);
+		address = ECARD_EASI_BASE + (slot << 24);
 		if (speed == ECARD_FAST)
 			ectcr |= 1 << slot;
 		break;
-#endif
+
 	default:
 		break;
 	}
@@ -719,7 +712,7 @@ static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t
 #ifdef IOMD_ECTCR
 	iomd_writeb(ectcr, IOMD_ECTCR);
 #endif
-	return (void __iomem *)(address ? ioaddr(address) : NULL);
+	return address;
 }
 
 static int ecard_prints(struct seq_file *m, ecard_t *ec)
@@ -1049,10 +1042,8 @@ ecard_probe(int slot, card_type_t type)
 		set_irq_flags(ec->irq, IRQF_VALID);
 	}
 
-#ifdef IO_EC_MEMC8_BASE
 	if (slot == 8)
 		ec->irq = 11;
-#endif
 #ifdef CONFIG_ARCH_RPC
 	/* On RiscPC, only first two slots have DMA capability */
 	if (slot < 2)
@@ -1098,9 +1089,7 @@ static int __init ecard_init(void)
 			ecard_probe(slot, ECARD_IOC);
 	}
 
-#ifdef IO_EC_MEMC8_BASE
 	ecard_probe(8, ECARD_IOC);
-#endif
 
 	irqhw = ecard_probeirqhw();
 
arch/arm/mach-rpc/include/mach/hardware.h +5 -6
index 822b810..4177766 100644
@@ -51,21 +51,20 @@
 /*
  * IO Addresses
  */
+#define ECARD_EASI_BASE		(IO_BASE + 0x05000000)
 #define VIDC_BASE		(IO_BASE + 0x00400000)
 #define EXPMASK_BASE		(IO_BASE + 0x00360000)
+#define ECARD_IOC4_BASE		(IO_BASE + 0x00270000)
+#define ECARD_IOC_BASE		(IO_BASE + 0x00240000)
 #define IOMD_BASE		(IO_BASE + 0x00200000)
 #define IOC_BASE		(IO_BASE + 0x00200000)
+#define ECARD_MEMC8_BASE	(IO_BASE + 0x0002b000)
 #define FLOPPYDMA_BASE		(IO_BASE + 0x0002a000)
 #define PCIO_BASE		(IO_BASE + 0x00010000)
+#define ECARD_MEMC_BASE		(IO_BASE + 0x00000000)
 
 #define vidc_writel(val)	__raw_writel(val, VIDC_BASE)
 
-#define IO_EC_EASI_BASE		0x81400000
-#define IO_EC_IOC4_BASE		0x8009c000
-#define IO_EC_IOC_BASE		0x80090000
-#define IO_EC_MEMC8_BASE	0x8000ac00
-#define IO_EC_MEMC_BASE		0x80000000
-
 #define NETSLOT_BASE		0x0302b000
 #define NETSLOT_SIZE		0x00001000
 
arch/arm/mach-rpc/include/mach/io.h +0 -3
index 20da7f4..dd706ff 100644
@@ -196,9 +196,6 @@ DECLARE_IO(int,l,"")
 #define outw(v,p)	(__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
 #define outl(v,p)	(__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
 
-/* the following macro is deprecated */
-#define ioaddr(port)	((unsigned long)__ioaddr((port)))
-
 #define insb(p,d,l)	__raw_readsb(__ioaddr(p),d,l)
 #define insw(p,d,l)	__raw_readsw(__ioaddr(p),d,l)
 
Signature · 1 line
1.7.4.4
#5 lore raw

PATCH 5/10 ARM: io: RiscPC: make EASI_BASE a void iomem pointer

In reply to Russell King - ARM Linux
---
 arch/arm/kernel/ecard.c                   |    2 +-
 arch/arm/mach-rpc/include/mach/hardware.h |    4 ++--
 arch/arm/mach-rpc/riscpc.c                |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/kernel/ecard.c +1 -1
index 3e84f66..4dd0eda 100644
@@ -237,7 +237,7 @@ static void ecard_init_pgtables(struct mm_struct *mm)
 
 	memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE));
 
-	src_pgd = pgd_offset(mm, EASI_BASE);
+	src_pgd = pgd_offset(mm, (unsigned long)EASI_BASE);
 	dst_pgd = pgd_offset(mm, EASI_START);
 
 	memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE));
arch/arm/mach-rpc/include/mach/hardware.h +2 -2
index 4177766..050d63c 100644
@@ -36,7 +36,7 @@
 
 #define EASI_SIZE		0x08000000	/* EASI I/O */
 #define EASI_START		0x08000000
-#define EASI_BASE		0xe5000000
+#define EASI_BASE		IOMEM(0xe5000000)
 
 #define IO_START		0x03000000	/* I/O */
 #define IO_SIZE			0x01000000
@@ -51,7 +51,7 @@
 /*
  * IO Addresses
  */
-#define ECARD_EASI_BASE		(IO_BASE + 0x05000000)
+#define ECARD_EASI_BASE		(EASI_BASE)
 #define VIDC_BASE		(IO_BASE + 0x00400000)
 #define EXPMASK_BASE		(IO_BASE + 0x00360000)
 #define ECARD_IOC4_BASE		(IO_BASE + 0x00270000)
arch/arm/mach-rpc/riscpc.c +1 -1
index 580b3c7..1e0e60d 100644
@@ -74,7 +74,7 @@ static struct map_desc rpc_io_desc[] __initdata = {
 		.length		= 	IO_SIZE	 ,
 		.type		= MT_DEVICE
 	}, {	/* EASI space	*/
-		.virtual	= EASI_BASE,
+		.virtual	= (unsigned long)EASI_BASE,
 		.pfn		= __phys_to_pfn(EASI_START),
 		.length		= EASI_SIZE,
 		.type		= MT_DEVICE
Signature · 1 line
1.7.4.4
#6 lore raw

PATCH 6/10 ARM: io: RiscPC: eliminate private inb() et.al. definitions

In reply to Russell King - ARM Linux

As we've got rid of the bit-31 set IO addresses, we can now use the standard inb() definitions and reduce the IO space limit to 64K.

---
 arch/arm/mach-rpc/include/mach/io.h |  190 ++---------------------------------
 1 files changed, 8 insertions(+), 182 deletions(-)
arch/arm/mach-rpc/include/mach/io.h +8 -182
index dd706ff..695f4ed 100644
@@ -15,192 +15,18 @@
 
 #include <mach/hardware.h>
 
-#define IO_SPACE_LIMIT 0xffffffff
+#define IO_SPACE_LIMIT 0xffff
 
 /*
- * We use two different types of addressing - PC style addresses, and ARM
- * addresses.  PC style accesses the PC hardware with the normal PC IO
- * addresses, eg 0x3f8 for serial#1.  ARM addresses are 0x80000000+
- * and are translated to the start of IO.  Note that all addresses are
- * shifted left!
- */
-#define __PORT_PCIO(x)	(!((x) & 0x80000000))
-
-/*
- * Dynamic IO functions.
- */
-static inline void __outb (unsigned int value, unsigned int port)
-{
-	unsigned long temp;
-	__asm__ __volatile__(
-	"tst	%2, #0x80000000\n\t"
-	"mov	%0, %4\n\t"
-	"addeq	%0, %0, %3\n\t"
-	"strb	%1, [%0, %2, lsl #2]	@ outb"
-	: "=&r" (temp)
-	: "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-	: "cc");
-}
-
-static inline void __outw (unsigned int value, unsigned int port)
-{
-	unsigned long temp;
-	__asm__ __volatile__(
-	"tst	%2, #0x80000000\n\t"
-	"mov	%0, %4\n\t"
-	"addeq	%0, %0, %3\n\t"
-	"str	%1, [%0, %2, lsl #2]	@ outw"
-	: "=&r" (temp)
-	: "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-	: "cc");
-}
-
-static inline void __outl (unsigned int value, unsigned int port)
-{
-	unsigned long temp;
-	__asm__ __volatile__(
-	"tst	%2, #0x80000000\n\t"
-	"mov	%0, %4\n\t"
-	"addeq	%0, %0, %3\n\t"
-	"str	%1, [%0, %2, lsl #2]	@ outl"
-	: "=&r" (temp)
-	: "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-	: "cc");
-}
-
-#define DECLARE_DYN_IN(sz,fnsuffix,instr)					\
-static inline unsigned sz __in##fnsuffix (unsigned int port)		\
-{										\
-	unsigned long temp, value;						\
-	__asm__ __volatile__(							\
-	"tst	%2, #0x80000000\n\t"						\
-	"mov	%0, %4\n\t"							\
-	"addeq	%0, %0, %3\n\t"							\
-	"ldr" instr "	%1, [%0, %2, lsl #2]	@ in" #fnsuffix			\
-	: "=&r" (temp), "=r" (value)						\
-	: "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)		\
-	: "cc");								\
-	return (unsigned sz)value;						\
-}
-
-static inline void __iomem *__deprecated __ioaddr(unsigned int port)
-{
-	void __iomem *ret;
-	if (__PORT_PCIO(port))
-		ret = PCIO_BASE;
-	else
-		ret = IO_BASE;
-	return ret + (port << 2);
-}
-
-#define DECLARE_IO(sz,fnsuffix,instr)	\
-	DECLARE_DYN_IN(sz,fnsuffix,instr)
-
-DECLARE_IO(char,b,"b")
-DECLARE_IO(short,w,"")
-DECLARE_IO(int,l,"")
-
-#undef DECLARE_IO
-#undef DECLARE_DYN_IN
-
-/*
- * Constant address IO functions
+ * We need PC style IO addressing for:
+ *  - floppy (at 0x3f2,0x3f4,0x3f5,0x3f7)
+ *  - parport (at 0x278-0x27a, 0x27b-0x27f, 0x778-0x77a)
+ *  - 8250 serial (only for compile)
  *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
+ * These peripherals are found in an area of MMIO which looks very much
+ * like an ISA bus, but with registers@the low byte of each word.
  */
-#define __outbc(value,port)							\
-({										\
-	if (__PORT_PCIO((port)))						\
-		__asm__ __volatile__(						\
-		"strb	%0, [%1, %2]	@ outbc"				\
-		: : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2));		\
-	else									\
-		__asm__ __volatile__(						\
-		"strb	%0, [%1, %2]	@ outbc"				\
-		: : "r" (value), "r" (IO_BASE), "r" ((port) << 2));		\
-})
-
-#define __inbc(port)								\
-({										\
-	unsigned char result;							\
-	if (__PORT_PCIO((port)))						\
-		__asm__ __volatile__(						\
-		"ldrb	%0, [%1, %2]	@ inbc"					\
-		: "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));		\
-	else									\
-		__asm__ __volatile__(						\
-		"ldrb	%0, [%1, %2]	@ inbc"					\
-		: "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));		\
-	result;									\
-})
-
-#define __outwc(value,port)							\
-({										\
-	unsigned long __v = value;						\
-	if (__PORT_PCIO((port)))						\
-		__asm__ __volatile__(						\
-		"str	%0, [%1, %2]	@ outwc"				\
-		: : "r" (__v|__v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2));	\
-	else									\
-		__asm__ __volatile__(						\
-		"str	%0, [%1, %2]	@ outwc"				\
-		: : "r" (__v|__v<<16), "r" (IO_BASE), "r" ((port) << 2));		\
-})
-
-#define __inwc(port)								\
-({										\
-	unsigned short result;							\
-	if (__PORT_PCIO((port)))						\
-		__asm__ __volatile__(						\
-		"ldr	%0, [%1, %2]	@ inwc"					\
-		: "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));		\
-	else									\
-		__asm__ __volatile__(						\
-		"ldr	%0, [%1, %2]	@ inwc"					\
-		: "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));		\
-	result & 0xffff;							\
-})
-
-#define __outlc(value,port)							\
-({										\
-	unsigned long __v = value;						\
-	if (__PORT_PCIO((port)))						\
-		__asm__ __volatile__(						\
-		"str	%0, [%1, %2]	@ outlc"				\
-		: : "r" (__v), "r" (PCIO_BASE), "Jr" ((port) << 2));		\
-	else									\
-		__asm__ __volatile__(						\
-		"str	%0, [%1, %2]	@ outlc"				\
-		: : "r" (__v), "r" (IO_BASE), "r" ((port) << 2));		\
-})
-
-#define __inlc(port)								\
-({										\
-	unsigned long result;							\
-	if (__PORT_PCIO((port)))						\
-		__asm__ __volatile__(						\
-		"ldr	%0, [%1, %2]	@ inlc"					\
-		: "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));		\
-	else									\
-		__asm__ __volatile__(						\
-		"ldr	%0, [%1, %2]	@ inlc"					\
-		: "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));		\
-	result;									\
-})
-
-#define inb(p)	 	(__builtin_constant_p((p)) ? __inbc(p)    : __inb(p))
-#define inw(p)	 	(__builtin_constant_p((p)) ? __inwc(p)    : __inw(p))
-#define inl(p)	 	(__builtin_constant_p((p)) ? __inlc(p)    : __inl(p))
-#define outb(v,p)	(__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
-#define outw(v,p)	(__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
-#define outl(v,p)	(__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
-
-#define insb(p,d,l)	__raw_readsb(__ioaddr(p),d,l)
-#define insw(p,d,l)	__raw_readsw(__ioaddr(p),d,l)
-
-#define outsb(p,d,l)	__raw_writesb(__ioaddr(p),d,l)
-#define outsw(p,d,l)	__raw_writesw(__ioaddr(p),d,l)
+#define __io(a)		(PCIO_BASE + ((a) << 2))
 
 /*
  * 1:1 mapping for ioremapped regions.
Signature · 1 line
1.7.4.4
#7 lore raw

PATCH 7/10 ARM: io: add a default IO_SPACE_LIMIT definition

In reply to Russell King - ARM Linux

Add a default IO_SPACE_LIMIT definition. Explain the chosen value and suggest why platforms would want to make it larger.

---
 arch/arm/include/asm/io.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/include/asm/io.h +21 -0
index d66605d..ffb089d 100644
@@ -110,6 +110,27 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
 #include <mach/io.h>
 
 /*
+ * This is the limit of PC card/PCI/ISA IO space, which is by default
+ * 64K if we have PC card, PCI or ISA support.  Otherwise, default to
+ * zero to prevent ISA/PCI drivers claiming IO space (and potentially
+ * oopsing.)
+ *
+ * Only set this larger if you really need inb() et.al. to operate over
+ * a larger address space.  Note that SOC_COMMON ioremaps each sockets
+ * IO space area, and so inb() et.al. must be defined to operate as per
+ * readb() et.al. on such platforms.
+ */
+#ifndef IO_SPACE_LIMIT
+#if defined(CONFIG_PCMCIA_SOC_COMMON) || defined(CONFIG_PCMCIA_SOC_COMMON_MODULE)
+#define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
+#elif defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD)
+#define IO_SPACE_LIMIT ((resource_size_t)0xffff)
+#else
+#define IO_SPACE_LIMIT ((resource_size_t)0)
+#endif
+#endif
+
+/*
  *  IO port access primitives
  *  -------------------------
  *
Signature · 1 line
1.7.4.4
#8 lore raw

PATCH 8/10 ARM: io: remove IO_SPACE_LIMIT from platforms with ISA/PCI and 64K window

In reply to Russell King - ARM Linux

Remove IO_SPACE_LIMIT definitions from platforms which have a well defined ISA or PCI, and has a 64K window.

EBSA110 - well defined set of ISA devices. Footbridge, Integrator, IXP4xx, VT8500 - PCI platforms.

---
 arch/arm/mach-ebsa110/include/mach/io.h    |    2 --
 arch/arm/mach-footbridge/include/mach/io.h |    2 --
 arch/arm/mach-integrator/include/mach/io.h |    2 --
 arch/arm/mach-ixp4xx/include/mach/io.h     |    2 --
 arch/arm/mach-vt8500/include/mach/io.h     |    2 --
 5 files changed, 0 insertions(+), 10 deletions(-)
arch/arm/mach-ebsa110/include/mach/io.h +0 -2
index f68daa63..44679db 100644
@@ -13,8 +13,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffff
-
 u8 __inb8(unsigned int port);
 void __outb8(u8  val, unsigned int port);
 
arch/arm/mach-footbridge/include/mach/io.h +0 -2
index 32e4cc3..15a7039 100644
@@ -23,8 +23,6 @@
 #define PCIO_SIZE       0x00100000
 #define PCIO_BASE       MMU_IO(0xff000000, 0x7c000000)
 
-#define IO_SPACE_LIMIT 0xffff
-
 /*
  * Translation of various region addresses to virtual addresses
  */
arch/arm/mach-integrator/include/mach/io.h +0 -2
index f21bb54..37beed3 100644
@@ -20,8 +20,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffff
-
 /*
  * WARNING: this has to mirror definitions in platform.h
  */
arch/arm/mach-ixp4xx/include/mach/io.h +0 -2
index 57b5410..ffb9d6a 100644
@@ -17,8 +17,6 @@
 
 #include <mach/hardware.h>
 
-#define IO_SPACE_LIMIT 0x0000ffff
-
 extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
 extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
 
arch/arm/mach-vt8500/include/mach/io.h +0 -2
index 9077239..46181ee 100644
@@ -20,8 +20,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffff
-
 #define __io(a)		__typesafe_io((a) + 0xf0000000)
 #define __mem_pci(a)	(a)
 
Signature · 1 line
1.7.4.4
#9 lore raw

PATCH 9/10 ARM: io: remove IO_SPACE_LIMIT from platforms without PCI/ISA

In reply to Russell King - ARM Linux

Nothing should be using PCI/ISA IO on these platforms, so their IO_SPACE_LIMIT definitions are irrelevent.

---
 arch/arm/mach-vexpress/include/mach/io.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/mach-vexpress/include/mach/io.h +0 -2
index 748bb52..13522d8 100644
@@ -20,8 +20,6 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffffffff
-
 #define __io(a)		__typesafe_io(a)
 #define __mem_pci(a)	(a)
 
Signature · 1 line
1.7.4.4
#10 lore raw

PATCH 10/10 ARM: io: remove IO_SPACE_LIMIT from SA11x0

In reply to Russell King - ARM Linux

SA11x0 only uses IO_SPACE_LIMIT for SOC_COMMON, so we can use the default value in asm/io.h.

---
 arch/arm/mach-sa1100/include/mach/io.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-sa1100/include/mach/io.h +2 -4
index d8b43f3..dfc27ff 100644
@@ -10,11 +10,9 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#define IO_SPACE_LIMIT 0xffffffff
-
 /*
- * We don't actually have real ISA nor PCI buses, but there is so many 
- * drivers out there that might just work if we fake them...
+ * __io() is required to be an equivalent mapping to __mem_pci() for
+ * SOC_COMMON to work.
  */
 #define __io(a)		__typesafe_io(a)
 #define __mem_pci(a)	(a)
Signature · 1 line
1.7.4.4
#11 lore raw

cover Clean up some io.h and associated code

In reply to Russell King - ARM Linux
Quoted 3 lines · Russell King - ARM Linux

This series does some cleanup of the mach/io.h header files and associated definitions, including getting rid of quite a lot of IO_SPACE_LIMIT definitions.

Hi Russell,

This looks very nice!

I did some research during the Cambourne meeting about of these and found that the omap1 and a91 platforms also need the IO_SPACE_LIMIT defined to 0xffffffff when CONFIG_AT91_CF or CONFIG_OMAP_CF are set, so these fall into the same category as CONFIG_PCMCIA_SOC_COMMON.

How about a new Kconfig symbol for this special I/O mode that is selected by the three drivers? That would take care of all remaning PCCARD users and simplify the generic IO_SPACE_LIMIT definition to

#ifndef IO_SPACE_LIMIT
#if defined(CONFIG_IO_SPACE_VIRTUAL) /* maybe you have a better name */ #define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
#elif defined(CONFIG_PCI) || defined(CONFIG_ISA)
#define IO_SPACE_LIMIT ((resource_size_t)0xffff)
#else
#define IO_SPACE_LIMIT ((resource_size_t)0)
#endif
#endif

The platforms that currently use PCI or ISA in the same way can then also set that symbol and get rid of their private definition, or converted over to having a single 64k window.

Arnd

#12 lore raw

cover Clean up some io.h and associated code

Quoted 5 lines · Arnd Bergmann
Quoted 3 lines · Russell King - ARM Linux

This series does some cleanup of the mach/io.h header files and associated definitions, including getting rid of quite a lot of IO_SPACE_LIMIT definitions.

Quoted 8 lines

Hi Russell,

This looks very nice!

I did some research during the Cambourne meeting about of these and found that the omap1 and a91 platforms also need the IO_SPACE_LIMIT defined to 0xffffffff when CONFIG_AT91_CF or CONFIG_OMAP_CF are set, so these fall into the same category as CONFIG_PCMCIA_SOC_COMMON.

It looks like AT91 and OMAP both only support one socket CF, so it probably makes sense to have them converted to use a single 64k window.

#13 lore raw

cover Clean up some io.h and associated code

Quoted 7 lines · On Sunday 21 August 2011 09:37:44 Russell King - ARM Linux wrote:
Quoted 4 lines

I did some research during the Cambourne meeting about of these and found that the omap1 and a91 platforms also need the IO_SPACE_LIMIT defined to 0xffffffff when CONFIG_AT91_CF or CONFIG_OMAP_CF are set, so these fall into the same category as CONFIG_PCMCIA_SOC_COMMON.

It looks like AT91 and OMAP both only support one socket CF, so it probably makes sense to have them converted to use a single 64k window.

If I read arch/arm/mach-at91/at91sam9260_devices.c correctly, it actually supports two CF slots. However, each slot only has 2KB worth of I/O space there, so it would still be reasonable to pretend having 64KB of total space and map the two slots at 4KB and 8KB offset into that.

Arnd